repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
grandstaish/paperparcel
paperparcel-compiler/src/main/java/paperparcel/Utils.java
Utils.paramAsMemberOf
private static TypeMirror paramAsMemberOf( Types types, DeclaredType type, TypeParameterElement param) { """ A custom implementation for getting the resolved value of a {@link TypeParameterElement} from a {@link DeclaredType}. Usually this can be resolved using {@link Types#asMemberOf(DeclaredType, Element)}, but the Jack compiler implementation currently does not work with {@link TypeParameterElement}s. See https://code.google.com/p/android/issues/detail?id=231164. """ TypeMirror resolved = paramAsMemberOfImpl(types, type, param); checkState(resolved != null, "Could not resolve parameter: " + param); return resolved; }
java
private static TypeMirror paramAsMemberOf( Types types, DeclaredType type, TypeParameterElement param) { TypeMirror resolved = paramAsMemberOfImpl(types, type, param); checkState(resolved != null, "Could not resolve parameter: " + param); return resolved; }
[ "private", "static", "TypeMirror", "paramAsMemberOf", "(", "Types", "types", ",", "DeclaredType", "type", ",", "TypeParameterElement", "param", ")", "{", "TypeMirror", "resolved", "=", "paramAsMemberOfImpl", "(", "types", ",", "type", ",", "param", ")", ";", "checkState", "(", "resolved", "!=", "null", ",", "\"Could not resolve parameter: \"", "+", "param", ")", ";", "return", "resolved", ";", "}" ]
A custom implementation for getting the resolved value of a {@link TypeParameterElement} from a {@link DeclaredType}. Usually this can be resolved using {@link Types#asMemberOf(DeclaredType, Element)}, but the Jack compiler implementation currently does not work with {@link TypeParameterElement}s. See https://code.google.com/p/android/issues/detail?id=231164.
[ "A", "custom", "implementation", "for", "getting", "the", "resolved", "value", "of", "a", "{", "@link", "TypeParameterElement", "}", "from", "a", "{", "@link", "DeclaredType", "}", "." ]
train
https://github.com/grandstaish/paperparcel/blob/917686ced81b335b6708d81d6cc0e3e496f7280d/paperparcel-compiler/src/main/java/paperparcel/Utils.java#L262-L267
MenoData/Time4J
base/src/main/java/net/time4j/range/MomentInterval.java
MomentInterval.toLocalInterval
public TimestampInterval toLocalInterval() { """ /*[deutsch] <p>Wandelt diese Instanz in ein lokales Zeitstempelintervall um. </p> @return local timestamp interval in system timezone (leap seconds will always be lost) @since 2.0 @see Timezone#ofSystem() @see #toZonalInterval(TZID) @see #toZonalInterval(String) """ Boundary<PlainTimestamp> b1; Boundary<PlainTimestamp> b2; if (this.getStart().isInfinite()) { b1 = Boundary.infinitePast(); } else { PlainTimestamp t1 = this.getStart().getTemporal().toLocalTimestamp(); b1 = Boundary.of(this.getStart().getEdge(), t1); } if (this.getEnd().isInfinite()) { b2 = Boundary.infiniteFuture(); } else { PlainTimestamp t2 = this.getEnd().getTemporal().toLocalTimestamp(); b2 = Boundary.of(this.getEnd().getEdge(), t2); } return new TimestampInterval(b1, b2); }
java
public TimestampInterval toLocalInterval() { Boundary<PlainTimestamp> b1; Boundary<PlainTimestamp> b2; if (this.getStart().isInfinite()) { b1 = Boundary.infinitePast(); } else { PlainTimestamp t1 = this.getStart().getTemporal().toLocalTimestamp(); b1 = Boundary.of(this.getStart().getEdge(), t1); } if (this.getEnd().isInfinite()) { b2 = Boundary.infiniteFuture(); } else { PlainTimestamp t2 = this.getEnd().getTemporal().toLocalTimestamp(); b2 = Boundary.of(this.getEnd().getEdge(), t2); } return new TimestampInterval(b1, b2); }
[ "public", "TimestampInterval", "toLocalInterval", "(", ")", "{", "Boundary", "<", "PlainTimestamp", ">", "b1", ";", "Boundary", "<", "PlainTimestamp", ">", "b2", ";", "if", "(", "this", ".", "getStart", "(", ")", ".", "isInfinite", "(", ")", ")", "{", "b1", "=", "Boundary", ".", "infinitePast", "(", ")", ";", "}", "else", "{", "PlainTimestamp", "t1", "=", "this", ".", "getStart", "(", ")", ".", "getTemporal", "(", ")", ".", "toLocalTimestamp", "(", ")", ";", "b1", "=", "Boundary", ".", "of", "(", "this", ".", "getStart", "(", ")", ".", "getEdge", "(", ")", ",", "t1", ")", ";", "}", "if", "(", "this", ".", "getEnd", "(", ")", ".", "isInfinite", "(", ")", ")", "{", "b2", "=", "Boundary", ".", "infiniteFuture", "(", ")", ";", "}", "else", "{", "PlainTimestamp", "t2", "=", "this", ".", "getEnd", "(", ")", ".", "getTemporal", "(", ")", ".", "toLocalTimestamp", "(", ")", ";", "b2", "=", "Boundary", ".", "of", "(", "this", ".", "getEnd", "(", ")", ".", "getEdge", "(", ")", ",", "t2", ")", ";", "}", "return", "new", "TimestampInterval", "(", "b1", ",", "b2", ")", ";", "}" ]
/*[deutsch] <p>Wandelt diese Instanz in ein lokales Zeitstempelintervall um. </p> @return local timestamp interval in system timezone (leap seconds will always be lost) @since 2.0 @see Timezone#ofSystem() @see #toZonalInterval(TZID) @see #toZonalInterval(String)
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Wandelt", "diese", "Instanz", "in", "ein", "lokales", "Zeitstempelintervall", "um", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/MomentInterval.java#L573-L595
windup/windup
rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/condition/annotation/AnnotationTypeCondition.java
AnnotationTypeCondition.addCondition
public AnnotationTypeCondition addCondition(String element, AnnotationCondition condition) { """ Adds another condition for an element within this annotation. """ this.conditions.put(element, condition); return this; }
java
public AnnotationTypeCondition addCondition(String element, AnnotationCondition condition) { this.conditions.put(element, condition); return this; }
[ "public", "AnnotationTypeCondition", "addCondition", "(", "String", "element", ",", "AnnotationCondition", "condition", ")", "{", "this", ".", "conditions", ".", "put", "(", "element", ",", "condition", ")", ";", "return", "this", ";", "}" ]
Adds another condition for an element within this annotation.
[ "Adds", "another", "condition", "for", "an", "element", "within", "this", "annotation", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/condition/annotation/AnnotationTypeCondition.java#L36-L40
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.queryEvents
public Observable<ComapiResult<EventsQueryResponse>> queryEvents(@NonNull final String conversationId, @NonNull final Long from, @NonNull final Integer limit) { """ Query events. Use {@link #queryConversationEvents(String, Long, Integer)} for better visibility of possible events. @param conversationId ID of a conversation to query events in it. @param from ID of the event to start from. @param limit Limit of events to obtain in this call. @return Observable to get events from a conversation. """ final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueQueryEvents(conversationId, from, limit); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doQueryEvents(token, conversationId, from, limit); } }
java
public Observable<ComapiResult<EventsQueryResponse>> queryEvents(@NonNull final String conversationId, @NonNull final Long from, @NonNull final Integer limit) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueQueryEvents(conversationId, from, limit); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doQueryEvents(token, conversationId, from, limit); } }
[ "public", "Observable", "<", "ComapiResult", "<", "EventsQueryResponse", ">", ">", "queryEvents", "(", "@", "NonNull", "final", "String", "conversationId", ",", "@", "NonNull", "final", "Long", "from", ",", "@", "NonNull", "final", "Integer", "limit", ")", "{", "final", "String", "token", "=", "getToken", "(", ")", ";", "if", "(", "sessionController", ".", "isCreatingSession", "(", ")", ")", "{", "return", "getTaskQueue", "(", ")", ".", "queueQueryEvents", "(", "conversationId", ",", "from", ",", "limit", ")", ";", "}", "else", "if", "(", "TextUtils", ".", "isEmpty", "(", "token", ")", ")", "{", "return", "Observable", ".", "error", "(", "getSessionStateErrorDescription", "(", ")", ")", ";", "}", "else", "{", "return", "doQueryEvents", "(", "token", ",", "conversationId", ",", "from", ",", "limit", ")", ";", "}", "}" ]
Query events. Use {@link #queryConversationEvents(String, Long, Integer)} for better visibility of possible events. @param conversationId ID of a conversation to query events in it. @param from ID of the event to start from. @param limit Limit of events to obtain in this call. @return Observable to get events from a conversation.
[ "Query", "events", ".", "Use", "{", "@link", "#queryConversationEvents", "(", "String", "Long", "Integer", ")", "}", "for", "better", "visibility", "of", "possible", "events", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L815-L826
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropsFilePropertiesSource.java
PropsFilePropertiesSource.loadConfig
protected void loadConfig(Properties props, String path, InputStream is) { """ Loads the configuration from the stream @param props the properties to update @param path The configuration path @param is the input stream """ // load properties into a Properties object try { props.load(is); } catch (IOException e) { throw new BundlingProcessException("Unable to load jawr configuration at " + path + ".", e); } }
java
protected void loadConfig(Properties props, String path, InputStream is) { // load properties into a Properties object try { props.load(is); } catch (IOException e) { throw new BundlingProcessException("Unable to load jawr configuration at " + path + ".", e); } }
[ "protected", "void", "loadConfig", "(", "Properties", "props", ",", "String", "path", ",", "InputStream", "is", ")", "{", "// load properties into a Properties object", "try", "{", "props", ".", "load", "(", "is", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "BundlingProcessException", "(", "\"Unable to load jawr configuration at \"", "+", "path", "+", "\".\"", ",", "e", ")", ";", "}", "}" ]
Loads the configuration from the stream @param props the properties to update @param path The configuration path @param is the input stream
[ "Loads", "the", "configuration", "from", "the", "stream" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropsFilePropertiesSource.java#L119-L126
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/QuickSelect.java
QuickSelect.selectIncludingZeros
public static double selectIncludingZeros(final double[] arr, final int pivot) { """ Gets the 1-based kth order statistic from the array including any zero values in the array. Warning! This changes the ordering of elements in the given array! @param arr The hash array. @param pivot The 1-based index of the value that is chosen as the pivot for the array. After the operation all values below this 1-based index will be less than this value and all values above this index will be greater. The 0-based index of the pivot will be pivot-1. @return The value of the smallest (N)th element including zeros, where N is 1-based. """ final int arrSize = arr.length; final int adj = pivot - 1; return select(arr, 0, arrSize - 1, adj); }
java
public static double selectIncludingZeros(final double[] arr, final int pivot) { final int arrSize = arr.length; final int adj = pivot - 1; return select(arr, 0, arrSize - 1, adj); }
[ "public", "static", "double", "selectIncludingZeros", "(", "final", "double", "[", "]", "arr", ",", "final", "int", "pivot", ")", "{", "final", "int", "arrSize", "=", "arr", ".", "length", ";", "final", "int", "adj", "=", "pivot", "-", "1", ";", "return", "select", "(", "arr", ",", "0", ",", "arrSize", "-", "1", ",", "adj", ")", ";", "}" ]
Gets the 1-based kth order statistic from the array including any zero values in the array. Warning! This changes the ordering of elements in the given array! @param arr The hash array. @param pivot The 1-based index of the value that is chosen as the pivot for the array. After the operation all values below this 1-based index will be less than this value and all values above this index will be greater. The 0-based index of the pivot will be pivot-1. @return The value of the smallest (N)th element including zeros, where N is 1-based.
[ "Gets", "the", "1", "-", "based", "kth", "order", "statistic", "from", "the", "array", "including", "any", "zero", "values", "in", "the", "array", ".", "Warning!", "This", "changes", "the", "ordering", "of", "elements", "in", "the", "given", "array!" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuickSelect.java#L163-L167
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/publickey/PublicKeySubsystem.java
PublicKeySubsystem.associateCommand
public void associateCommand(SshPublicKey key, String command) throws SshException, PublicKeySubsystemException { """ Associate a command with an accepted public key. The request will fail if the public key is not currently in the users acceptable list. Also some server implementations may choose not to support this feature. @param key @param command @throws SshException @throws PublicKeyStatusException """ try { Packet msg = createPacket(); msg.writeString("command"); msg.writeString(key.getAlgorithm()); msg.writeBinaryString(key.getEncoded()); msg.writeString(command); sendMessage(msg); readStatusResponse(); } catch (IOException ex) { throw new SshException(ex); } }
java
public void associateCommand(SshPublicKey key, String command) throws SshException, PublicKeySubsystemException { try { Packet msg = createPacket(); msg.writeString("command"); msg.writeString(key.getAlgorithm()); msg.writeBinaryString(key.getEncoded()); msg.writeString(command); sendMessage(msg); readStatusResponse(); } catch (IOException ex) { throw new SshException(ex); } }
[ "public", "void", "associateCommand", "(", "SshPublicKey", "key", ",", "String", "command", ")", "throws", "SshException", ",", "PublicKeySubsystemException", "{", "try", "{", "Packet", "msg", "=", "createPacket", "(", ")", ";", "msg", ".", "writeString", "(", "\"command\"", ")", ";", "msg", ".", "writeString", "(", "key", ".", "getAlgorithm", "(", ")", ")", ";", "msg", ".", "writeBinaryString", "(", "key", ".", "getEncoded", "(", ")", ")", ";", "msg", ".", "writeString", "(", "command", ")", ";", "sendMessage", "(", "msg", ")", ";", "readStatusResponse", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "SshException", "(", "ex", ")", ";", "}", "}" ]
Associate a command with an accepted public key. The request will fail if the public key is not currently in the users acceptable list. Also some server implementations may choose not to support this feature. @param key @param command @throws SshException @throws PublicKeyStatusException
[ "Associate", "a", "command", "with", "an", "accepted", "public", "key", ".", "The", "request", "will", "fail", "if", "the", "public", "key", "is", "not", "currently", "in", "the", "users", "acceptable", "list", ".", "Also", "some", "server", "implementations", "may", "choose", "not", "to", "support", "this", "feature", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/publickey/PublicKeySubsystem.java#L216-L235
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/util/CreateViewPageUtil.java
CreateViewPageUtil.doCreate
public void doCreate(ActionMapping actionMapping, ModelForm modelForm, HttpServletRequest request) throws Exception { """ create a ModelForm object two things: 1. create a ModelForm null instance 2. initial ModelForm instance value, obtain a inital Model instance copy the Model instance to the ModelForm instance obtaining datas two ways: 1.call ModelHandler initForm method; 2.call Modelhandler initModel method; """ Debug.logVerbose("[JdonFramework] enter doCreate... ", module); String formName = FormBeanUtil.getFormName(actionMapping); ModelHandler modelHandler = modelManager.borrowtHandlerObject(formName); try { ModelForm form = modelHandler.initForm(request); if (form != null) { form.setAction(ModelForm.CREATE_STR); FormBeanUtil.saveActionForm(form, actionMapping, request); } else { form = modelForm; } Debug.logVerbose("[JdonFramework] got a ModelForm ... ", module); Object modelDTO = modelManager.getModelObject(formName); modelHandler.formCopyToModelIF(form, modelDTO); EventModel em = new EventModel(); em.setActionName(form.getAction()); em.setModelIF(modelDTO); modelDTO = initModel(em, request, modelHandler, form); // copy initial model to form , intial form; if (modelDTO != null) { // the model can be null Debug.logVerbose("[JdonFramework] got a Model From the 'initModel' method of the service", module); modelHandler.modelIFCopyToForm(modelDTO, form); } } catch (Exception ex) { Debug.logError("[JdonFramework]please check your service 、 model or form, error is: " + ex, module); throw new Exception("System error! please call system admin. " + ex); } finally { modelManager.returnHandlerObject(modelHandler); // 返回modelhandler再用 } }
java
public void doCreate(ActionMapping actionMapping, ModelForm modelForm, HttpServletRequest request) throws Exception { Debug.logVerbose("[JdonFramework] enter doCreate... ", module); String formName = FormBeanUtil.getFormName(actionMapping); ModelHandler modelHandler = modelManager.borrowtHandlerObject(formName); try { ModelForm form = modelHandler.initForm(request); if (form != null) { form.setAction(ModelForm.CREATE_STR); FormBeanUtil.saveActionForm(form, actionMapping, request); } else { form = modelForm; } Debug.logVerbose("[JdonFramework] got a ModelForm ... ", module); Object modelDTO = modelManager.getModelObject(formName); modelHandler.formCopyToModelIF(form, modelDTO); EventModel em = new EventModel(); em.setActionName(form.getAction()); em.setModelIF(modelDTO); modelDTO = initModel(em, request, modelHandler, form); // copy initial model to form , intial form; if (modelDTO != null) { // the model can be null Debug.logVerbose("[JdonFramework] got a Model From the 'initModel' method of the service", module); modelHandler.modelIFCopyToForm(modelDTO, form); } } catch (Exception ex) { Debug.logError("[JdonFramework]please check your service 、 model or form, error is: " + ex, module); throw new Exception("System error! please call system admin. " + ex); } finally { modelManager.returnHandlerObject(modelHandler); // 返回modelhandler再用 } }
[ "public", "void", "doCreate", "(", "ActionMapping", "actionMapping", ",", "ModelForm", "modelForm", ",", "HttpServletRequest", "request", ")", "throws", "Exception", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] enter doCreate... \"", ",", "module", ")", ";", "String", "formName", "=", "FormBeanUtil", ".", "getFormName", "(", "actionMapping", ")", ";", "ModelHandler", "modelHandler", "=", "modelManager", ".", "borrowtHandlerObject", "(", "formName", ")", ";", "try", "{", "ModelForm", "form", "=", "modelHandler", ".", "initForm", "(", "request", ")", ";", "if", "(", "form", "!=", "null", ")", "{", "form", ".", "setAction", "(", "ModelForm", ".", "CREATE_STR", ")", ";", "FormBeanUtil", ".", "saveActionForm", "(", "form", ",", "actionMapping", ",", "request", ")", ";", "}", "else", "{", "form", "=", "modelForm", ";", "}", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] got a ModelForm ... \"", ",", "module", ")", ";", "Object", "modelDTO", "=", "modelManager", ".", "getModelObject", "(", "formName", ")", ";", "modelHandler", ".", "formCopyToModelIF", "(", "form", ",", "modelDTO", ")", ";", "EventModel", "em", "=", "new", "EventModel", "(", ")", ";", "em", ".", "setActionName", "(", "form", ".", "getAction", "(", ")", ")", ";", "em", ".", "setModelIF", "(", "modelDTO", ")", ";", "modelDTO", "=", "initModel", "(", "em", ",", "request", ",", "modelHandler", ",", "form", ")", ";", "// copy initial model to form , intial form;\r", "if", "(", "modelDTO", "!=", "null", ")", "{", "// the model can be null\r", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] got a Model From the 'initModel' method of the service\"", ",", "module", ")", ";", "modelHandler", ".", "modelIFCopyToForm", "(", "modelDTO", ",", "form", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework]please check your service 、 model or form, error is: \" +", "e", ", ", "m", "dule);", "\r", "", "throw", "new", "Exception", "(", "\"System error! please call system admin. \"", "+", "ex", ")", ";", "}", "finally", "{", "modelManager", ".", "returnHandlerObject", "(", "modelHandler", ")", ";", "// 返回modelhandler再用\r", "}", "}" ]
create a ModelForm object two things: 1. create a ModelForm null instance 2. initial ModelForm instance value, obtain a inital Model instance copy the Model instance to the ModelForm instance obtaining datas two ways: 1.call ModelHandler initForm method; 2.call Modelhandler initModel method;
[ "create", "a", "ModelForm", "object" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/util/CreateViewPageUtil.java#L55-L89
xwiki/xwiki-rendering
xwiki-rendering-macros/xwiki-rendering-macro-footnotes/src/main/java/org/xwiki/rendering/internal/macro/footnote/PutFootnotesMacro.java
PutFootnotesMacro.addFootnoteRef
private void addFootnoteRef(MacroMarkerBlock footnoteMacro, Block footnoteRef) { """ Add a footnote to the list of document footnotes. If such a list doesn't exist yet, create it and append it to the end of the document. @param footnoteMacro the {{footnote}} macro being processed @param footnoteRef the generated block corresponding to the footnote to be inserted """ footnoteMacro.getChildren().clear(); footnoteMacro.addChild(footnoteRef); }
java
private void addFootnoteRef(MacroMarkerBlock footnoteMacro, Block footnoteRef) { footnoteMacro.getChildren().clear(); footnoteMacro.addChild(footnoteRef); }
[ "private", "void", "addFootnoteRef", "(", "MacroMarkerBlock", "footnoteMacro", ",", "Block", "footnoteRef", ")", "{", "footnoteMacro", ".", "getChildren", "(", ")", ".", "clear", "(", ")", ";", "footnoteMacro", ".", "addChild", "(", "footnoteRef", ")", ";", "}" ]
Add a footnote to the list of document footnotes. If such a list doesn't exist yet, create it and append it to the end of the document. @param footnoteMacro the {{footnote}} macro being processed @param footnoteRef the generated block corresponding to the footnote to be inserted
[ "Add", "a", "footnote", "to", "the", "list", "of", "document", "footnotes", ".", "If", "such", "a", "list", "doesn", "t", "exist", "yet", "create", "it", "and", "append", "it", "to", "the", "end", "of", "the", "document", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-macros/xwiki-rendering-macro-footnotes/src/main/java/org/xwiki/rendering/internal/macro/footnote/PutFootnotesMacro.java#L175-L179
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java
ParticipantRepository.addListener
protected EventListener addListener(ADDRESST key, EventListener value) { """ Add a participant with the given address in this repository. @param key address of the participant. @param value is the participant to map to the address. @return the participant that was previously associated to the given address. """ synchronized (mutex()) { return this.listeners.put(key, value); } }
java
protected EventListener addListener(ADDRESST key, EventListener value) { synchronized (mutex()) { return this.listeners.put(key, value); } }
[ "protected", "EventListener", "addListener", "(", "ADDRESST", "key", ",", "EventListener", "value", ")", "{", "synchronized", "(", "mutex", "(", ")", ")", "{", "return", "this", ".", "listeners", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}" ]
Add a participant with the given address in this repository. @param key address of the participant. @param value is the participant to map to the address. @return the participant that was previously associated to the given address.
[ "Add", "a", "participant", "with", "the", "given", "address", "in", "this", "repository", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java#L126-L130
alexvasilkov/GestureViews
sample/src/main/java/com/alexvasilkov/gestures/sample/demo/utils/RecyclerAdapterHelper.java
RecyclerAdapterHelper.notifyChanges
public static <T> void notifyChanges(RecyclerView.Adapter<?> adapter, final List<T> oldList, final List<T> newList) { """ Calls adapter's notify* methods when items are added / removed / moved / updated. """ DiffUtil.calculateDiff(new DiffUtil.Callback() { @Override public int getOldListSize() { return oldList == null ? 0 : oldList.size(); } @Override public int getNewListSize() { return newList == null ? 0 : newList.size(); } @Override public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) { return oldList.get(oldItemPosition).equals(newList.get(newItemPosition)); } @Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return areItemsTheSame(oldItemPosition, newItemPosition); } }).dispatchUpdatesTo(adapter); }
java
public static <T> void notifyChanges(RecyclerView.Adapter<?> adapter, final List<T> oldList, final List<T> newList) { DiffUtil.calculateDiff(new DiffUtil.Callback() { @Override public int getOldListSize() { return oldList == null ? 0 : oldList.size(); } @Override public int getNewListSize() { return newList == null ? 0 : newList.size(); } @Override public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) { return oldList.get(oldItemPosition).equals(newList.get(newItemPosition)); } @Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return areItemsTheSame(oldItemPosition, newItemPosition); } }).dispatchUpdatesTo(adapter); }
[ "public", "static", "<", "T", ">", "void", "notifyChanges", "(", "RecyclerView", ".", "Adapter", "<", "?", ">", "adapter", ",", "final", "List", "<", "T", ">", "oldList", ",", "final", "List", "<", "T", ">", "newList", ")", "{", "DiffUtil", ".", "calculateDiff", "(", "new", "DiffUtil", ".", "Callback", "(", ")", "{", "@", "Override", "public", "int", "getOldListSize", "(", ")", "{", "return", "oldList", "==", "null", "?", "0", ":", "oldList", ".", "size", "(", ")", ";", "}", "@", "Override", "public", "int", "getNewListSize", "(", ")", "{", "return", "newList", "==", "null", "?", "0", ":", "newList", ".", "size", "(", ")", ";", "}", "@", "Override", "public", "boolean", "areItemsTheSame", "(", "int", "oldItemPosition", ",", "int", "newItemPosition", ")", "{", "return", "oldList", ".", "get", "(", "oldItemPosition", ")", ".", "equals", "(", "newList", ".", "get", "(", "newItemPosition", ")", ")", ";", "}", "@", "Override", "public", "boolean", "areContentsTheSame", "(", "int", "oldItemPosition", ",", "int", "newItemPosition", ")", "{", "return", "areItemsTheSame", "(", "oldItemPosition", ",", "newItemPosition", ")", ";", "}", "}", ")", ".", "dispatchUpdatesTo", "(", "adapter", ")", ";", "}" ]
Calls adapter's notify* methods when items are added / removed / moved / updated.
[ "Calls", "adapter", "s", "notify", "*", "methods", "when", "items", "are", "added", "/", "removed", "/", "moved", "/", "updated", "." ]
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/sample/src/main/java/com/alexvasilkov/gestures/sample/demo/utils/RecyclerAdapterHelper.java#L15-L39
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
JavacParser.earlier
static int earlier(int pos1, int pos2) { """ Return the lesser of two positions, making allowance for either one being unset. """ if (pos1 == Position.NOPOS) return pos2; if (pos2 == Position.NOPOS) return pos1; return (pos1 < pos2 ? pos1 : pos2); }
java
static int earlier(int pos1, int pos2) { if (pos1 == Position.NOPOS) return pos2; if (pos2 == Position.NOPOS) return pos1; return (pos1 < pos2 ? pos1 : pos2); }
[ "static", "int", "earlier", "(", "int", "pos1", ",", "int", "pos2", ")", "{", "if", "(", "pos1", "==", "Position", ".", "NOPOS", ")", "return", "pos2", ";", "if", "(", "pos2", "==", "Position", ".", "NOPOS", ")", "return", "pos1", ";", "return", "(", "pos1", "<", "pos2", "?", "pos1", ":", "pos2", ")", ";", "}" ]
Return the lesser of two positions, making allowance for either one being unset.
[ "Return", "the", "lesser", "of", "two", "positions", "making", "allowance", "for", "either", "one", "being", "unset", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L4017-L4023
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendSeekStatus
private void sendSeekStatus(IPlayItem item, int position) { """ Send seek status notification @param item Playlist item @param position Seek position """ Status seek = new Status(StatusCodes.NS_SEEK_NOTIFY); seek.setClientid(streamId); seek.setDetails(item.getName()); seek.setDesciption(String.format("Seeking %d (stream ID: %d).", position, streamId)); doPushMessage(seek); }
java
private void sendSeekStatus(IPlayItem item, int position) { Status seek = new Status(StatusCodes.NS_SEEK_NOTIFY); seek.setClientid(streamId); seek.setDetails(item.getName()); seek.setDesciption(String.format("Seeking %d (stream ID: %d).", position, streamId)); doPushMessage(seek); }
[ "private", "void", "sendSeekStatus", "(", "IPlayItem", "item", ",", "int", "position", ")", "{", "Status", "seek", "=", "new", "Status", "(", "StatusCodes", ".", "NS_SEEK_NOTIFY", ")", ";", "seek", ".", "setClientid", "(", "streamId", ")", ";", "seek", ".", "setDetails", "(", "item", ".", "getName", "(", ")", ")", ";", "seek", ".", "setDesciption", "(", "String", ".", "format", "(", "\"Seeking %d (stream ID: %d).\"", ",", "position", ",", "streamId", ")", ")", ";", "doPushMessage", "(", "seek", ")", ";", "}" ]
Send seek status notification @param item Playlist item @param position Seek position
[ "Send", "seek", "status", "notification" ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1232-L1239
GoogleCloudPlatform/bigdata-interop
util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java
ApiErrorExtractor.toUserPresentableMessage
public String toUserPresentableMessage(IOException ioe, @Nullable String action) { """ Converts the exception to a user-presentable error message. Specifically, extracts message field for HTTP 4xx codes, and creates a generic "Internal Server Error" for HTTP 5xx codes. """ String message = "Internal server error"; if (isClientError(ioe)) { message = getErrorMessage(ioe); } if (action == null) { return message; } else { return String.format("Encountered an error while %s: %s", action, message); } }
java
public String toUserPresentableMessage(IOException ioe, @Nullable String action) { String message = "Internal server error"; if (isClientError(ioe)) { message = getErrorMessage(ioe); } if (action == null) { return message; } else { return String.format("Encountered an error while %s: %s", action, message); } }
[ "public", "String", "toUserPresentableMessage", "(", "IOException", "ioe", ",", "@", "Nullable", "String", "action", ")", "{", "String", "message", "=", "\"Internal server error\"", ";", "if", "(", "isClientError", "(", "ioe", ")", ")", "{", "message", "=", "getErrorMessage", "(", "ioe", ")", ";", "}", "if", "(", "action", "==", "null", ")", "{", "return", "message", ";", "}", "else", "{", "return", "String", ".", "format", "(", "\"Encountered an error while %s: %s\"", ",", "action", ",", "message", ")", ";", "}", "}" ]
Converts the exception to a user-presentable error message. Specifically, extracts message field for HTTP 4xx codes, and creates a generic "Internal Server Error" for HTTP 5xx codes.
[ "Converts", "the", "exception", "to", "a", "user", "-", "presentable", "error", "message", ".", "Specifically", "extracts", "message", "field", "for", "HTTP", "4xx", "codes", "and", "creates", "a", "generic", "Internal", "Server", "Error", "for", "HTTP", "5xx", "codes", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L382-L393
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java
SimpleTimeZone.setEndRule
public void setEndRule(int endMonth, int endDay, int endDayOfWeek, int endTime, boolean after) { """ Sets the daylight saving time end rule to a weekday before or after the given date within a month, e.g., the first Monday on or after the 8th. @param endMonth The daylight saving time ending month. Month is a {@link Calendar#MONTH MONTH} field value (0-based. e.g., 9 for October). @param endDay The day of the month on which the daylight saving time ends. @param endDayOfWeek The daylight saving time ending day-of-week. @param endTime The daylight saving ending time in local wall clock time, (in milliseconds within the day) which is local daylight time in this case. @param after If true, this rule selects the first <code>endDayOfWeek</code> on or <em>after</em> <code>endDay</code>. If false, this rule selects the last <code>endDayOfWeek</code> on or before <code>endDay</code> of the month. @exception IllegalArgumentException the <code>endMonth</code>, <code>endDay</code>, <code>endDayOfWeek</code>, or <code>endTime</code> parameters are out of range @since 1.2 """ if (after) { setEndRule(endMonth, endDay, -endDayOfWeek, endTime); } else { setEndRule(endMonth, -endDay, -endDayOfWeek, endTime); } }
java
public void setEndRule(int endMonth, int endDay, int endDayOfWeek, int endTime, boolean after) { if (after) { setEndRule(endMonth, endDay, -endDayOfWeek, endTime); } else { setEndRule(endMonth, -endDay, -endDayOfWeek, endTime); } }
[ "public", "void", "setEndRule", "(", "int", "endMonth", ",", "int", "endDay", ",", "int", "endDayOfWeek", ",", "int", "endTime", ",", "boolean", "after", ")", "{", "if", "(", "after", ")", "{", "setEndRule", "(", "endMonth", ",", "endDay", ",", "-", "endDayOfWeek", ",", "endTime", ")", ";", "}", "else", "{", "setEndRule", "(", "endMonth", ",", "-", "endDay", ",", "-", "endDayOfWeek", ",", "endTime", ")", ";", "}", "}" ]
Sets the daylight saving time end rule to a weekday before or after the given date within a month, e.g., the first Monday on or after the 8th. @param endMonth The daylight saving time ending month. Month is a {@link Calendar#MONTH MONTH} field value (0-based. e.g., 9 for October). @param endDay The day of the month on which the daylight saving time ends. @param endDayOfWeek The daylight saving time ending day-of-week. @param endTime The daylight saving ending time in local wall clock time, (in milliseconds within the day) which is local daylight time in this case. @param after If true, this rule selects the first <code>endDayOfWeek</code> on or <em>after</em> <code>endDay</code>. If false, this rule selects the last <code>endDayOfWeek</code> on or before <code>endDay</code> of the month. @exception IllegalArgumentException the <code>endMonth</code>, <code>endDay</code>, <code>endDayOfWeek</code>, or <code>endTime</code> parameters are out of range @since 1.2
[ "Sets", "the", "daylight", "saving", "time", "end", "rule", "to", "a", "weekday", "before", "or", "after", "the", "given", "date", "within", "a", "month", "e", ".", "g", ".", "the", "first", "Monday", "on", "or", "after", "the", "8th", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java#L518-L525
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java
TableInfo.of
public static TableInfo of(TableId tableId, TableDefinition definition) { """ Returns a {@code TableInfo} object given table identity and definition. Use {@link StandardTableDefinition} to create simple BigQuery table. Use {@link ViewDefinition} to create a BigQuery view. Use {@link ExternalTableDefinition} to create a BigQuery a table backed by external data. """ return newBuilder(tableId, definition).build(); }
java
public static TableInfo of(TableId tableId, TableDefinition definition) { return newBuilder(tableId, definition).build(); }
[ "public", "static", "TableInfo", "of", "(", "TableId", "tableId", ",", "TableDefinition", "definition", ")", "{", "return", "newBuilder", "(", "tableId", ",", "definition", ")", ".", "build", "(", ")", ";", "}" ]
Returns a {@code TableInfo} object given table identity and definition. Use {@link StandardTableDefinition} to create simple BigQuery table. Use {@link ViewDefinition} to create a BigQuery view. Use {@link ExternalTableDefinition} to create a BigQuery a table backed by external data.
[ "Returns", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java#L457-L459
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/CellFinder.java
CellFinder.query
public static CellFinder query(final Sheet sheet, final String label, final Configuration config) { """ 検索する際の条件を組み立てる @param sheet 検索対象のシート @param label 検索するセルのラベル @param config システム設定。 設定値 {@link Configuration#isNormalizeLabelText()}、{@link Configuration#isRegexLabelText()}の値によって、 検索する際にラベルを正規化、または正規表現により一致するかで判定を行う。 """ return new CellFinder(sheet, label, config); }
java
public static CellFinder query(final Sheet sheet, final String label, final Configuration config) { return new CellFinder(sheet, label, config); }
[ "public", "static", "CellFinder", "query", "(", "final", "Sheet", "sheet", ",", "final", "String", "label", ",", "final", "Configuration", "config", ")", "{", "return", "new", "CellFinder", "(", "sheet", ",", "label", ",", "config", ")", ";", "}" ]
検索する際の条件を組み立てる @param sheet 検索対象のシート @param label 検索するセルのラベル @param config システム設定。 設定値 {@link Configuration#isNormalizeLabelText()}、{@link Configuration#isRegexLabelText()}の値によって、 検索する際にラベルを正規化、または正規表現により一致するかで判定を行う。
[ "検索する際の条件を組み立てる" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/CellFinder.java#L63-L65
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java
BooleanExpressionParser.getBooleanResultAsString
private static String getBooleanResultAsString(final String operator, final String rightOperand, final String leftOperand) { """ Evaluates a boolean expression to a String representation (true/false). @param operator The operator to apply on operands @param rightOperand The right hand side of the expression @param leftOperand The left hand side of the expression @return true/false as String """ switch (operator) { case "lt": return Boolean.toString(Integer.valueOf(leftOperand) < Integer.valueOf(rightOperand)); case "lt=": return Boolean.toString(Integer.valueOf(leftOperand) <= Integer.valueOf(rightOperand)); case "gt": return Boolean.toString(Integer.valueOf(leftOperand) > Integer.valueOf(rightOperand)); case "gt=": return Boolean.toString(Integer.valueOf(leftOperand) >= Integer.valueOf(rightOperand)); case "=": return Boolean.toString(Integer.parseInt(leftOperand) == Integer.parseInt(rightOperand)); case "and": return Boolean.toString(Boolean.valueOf(leftOperand) && Boolean.valueOf(rightOperand)); case "or": return Boolean.toString(Boolean.valueOf(leftOperand) || Boolean.valueOf(rightOperand)); default: throw new CitrusRuntimeException("Unknown operator '" + operator + "'"); } }
java
private static String getBooleanResultAsString(final String operator, final String rightOperand, final String leftOperand) { switch (operator) { case "lt": return Boolean.toString(Integer.valueOf(leftOperand) < Integer.valueOf(rightOperand)); case "lt=": return Boolean.toString(Integer.valueOf(leftOperand) <= Integer.valueOf(rightOperand)); case "gt": return Boolean.toString(Integer.valueOf(leftOperand) > Integer.valueOf(rightOperand)); case "gt=": return Boolean.toString(Integer.valueOf(leftOperand) >= Integer.valueOf(rightOperand)); case "=": return Boolean.toString(Integer.parseInt(leftOperand) == Integer.parseInt(rightOperand)); case "and": return Boolean.toString(Boolean.valueOf(leftOperand) && Boolean.valueOf(rightOperand)); case "or": return Boolean.toString(Boolean.valueOf(leftOperand) || Boolean.valueOf(rightOperand)); default: throw new CitrusRuntimeException("Unknown operator '" + operator + "'"); } }
[ "private", "static", "String", "getBooleanResultAsString", "(", "final", "String", "operator", ",", "final", "String", "rightOperand", ",", "final", "String", "leftOperand", ")", "{", "switch", "(", "operator", ")", "{", "case", "\"lt\"", ":", "return", "Boolean", ".", "toString", "(", "Integer", ".", "valueOf", "(", "leftOperand", ")", "<", "Integer", ".", "valueOf", "(", "rightOperand", ")", ")", ";", "case", "\"lt=\"", ":", "return", "Boolean", ".", "toString", "(", "Integer", ".", "valueOf", "(", "leftOperand", ")", "<=", "Integer", ".", "valueOf", "(", "rightOperand", ")", ")", ";", "case", "\"gt\"", ":", "return", "Boolean", ".", "toString", "(", "Integer", ".", "valueOf", "(", "leftOperand", ")", ">", "Integer", ".", "valueOf", "(", "rightOperand", ")", ")", ";", "case", "\"gt=\"", ":", "return", "Boolean", ".", "toString", "(", "Integer", ".", "valueOf", "(", "leftOperand", ")", ">=", "Integer", ".", "valueOf", "(", "rightOperand", ")", ")", ";", "case", "\"=\"", ":", "return", "Boolean", ".", "toString", "(", "Integer", ".", "parseInt", "(", "leftOperand", ")", "==", "Integer", ".", "parseInt", "(", "rightOperand", ")", ")", ";", "case", "\"and\"", ":", "return", "Boolean", ".", "toString", "(", "Boolean", ".", "valueOf", "(", "leftOperand", ")", "&&", "Boolean", ".", "valueOf", "(", "rightOperand", ")", ")", ";", "case", "\"or\"", ":", "return", "Boolean", ".", "toString", "(", "Boolean", ".", "valueOf", "(", "leftOperand", ")", "||", "Boolean", ".", "valueOf", "(", "rightOperand", ")", ")", ";", "default", ":", "throw", "new", "CitrusRuntimeException", "(", "\"Unknown operator '\"", "+", "operator", "+", "\"'\"", ")", ";", "}", "}" ]
Evaluates a boolean expression to a String representation (true/false). @param operator The operator to apply on operands @param rightOperand The right hand side of the expression @param leftOperand The left hand side of the expression @return true/false as String
[ "Evaluates", "a", "boolean", "expression", "to", "a", "String", "representation", "(", "true", "/", "false", ")", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L317-L336
google/closure-compiler
src/com/google/javascript/jscomp/RewriteObjectSpread.java
RewriteObjectSpread.visitObjectWithSpread
private void visitObjectWithSpread(NodeTraversal t, Node obj) { """ /* Convert '{first: b, c, ...spread, d: e, last}' to: Object.assign({}, {first:b, c}, spread, {d:e, last}); """ checkArgument(obj.isObjectLit()); // Add an empty target object literal so changes made by Object.assign will not affect any other // variables. Node result = astFactory.createObjectDotAssignCall( t.getScope(), obj.getJSType(), astFactory.createEmptyObjectLit()); // An indicator whether the current last thing in the param list is an object literal to which // properties may be added. Initialized to null since nothing should be added to the empty // object literal in first position of the param list. Node trailingObjectLiteral = null; for (Node child : obj.children()) { if (child.isSpread()) { // Add the object directly to the param list. Node spreaded = child.removeFirstChild(); result.addChildToBack(spreaded); // Properties should not be added to the trailing object. trailingObjectLiteral = null; } else { if (trailingObjectLiteral == null) { // Add a new object to which properties may be added. trailingObjectLiteral = astFactory.createEmptyObjectLit(); result.addChildToBack(trailingObjectLiteral); } // Add the property to the object literal. trailingObjectLiteral.addChildToBack(child.detach()); } } result.useSourceInfoIfMissingFromForTree(obj); obj.replaceWith(result); compiler.reportChangeToEnclosingScope(result); }
java
private void visitObjectWithSpread(NodeTraversal t, Node obj) { checkArgument(obj.isObjectLit()); // Add an empty target object literal so changes made by Object.assign will not affect any other // variables. Node result = astFactory.createObjectDotAssignCall( t.getScope(), obj.getJSType(), astFactory.createEmptyObjectLit()); // An indicator whether the current last thing in the param list is an object literal to which // properties may be added. Initialized to null since nothing should be added to the empty // object literal in first position of the param list. Node trailingObjectLiteral = null; for (Node child : obj.children()) { if (child.isSpread()) { // Add the object directly to the param list. Node spreaded = child.removeFirstChild(); result.addChildToBack(spreaded); // Properties should not be added to the trailing object. trailingObjectLiteral = null; } else { if (trailingObjectLiteral == null) { // Add a new object to which properties may be added. trailingObjectLiteral = astFactory.createEmptyObjectLit(); result.addChildToBack(trailingObjectLiteral); } // Add the property to the object literal. trailingObjectLiteral.addChildToBack(child.detach()); } } result.useSourceInfoIfMissingFromForTree(obj); obj.replaceWith(result); compiler.reportChangeToEnclosingScope(result); }
[ "private", "void", "visitObjectWithSpread", "(", "NodeTraversal", "t", ",", "Node", "obj", ")", "{", "checkArgument", "(", "obj", ".", "isObjectLit", "(", ")", ")", ";", "// Add an empty target object literal so changes made by Object.assign will not affect any other", "// variables.", "Node", "result", "=", "astFactory", ".", "createObjectDotAssignCall", "(", "t", ".", "getScope", "(", ")", ",", "obj", ".", "getJSType", "(", ")", ",", "astFactory", ".", "createEmptyObjectLit", "(", ")", ")", ";", "// An indicator whether the current last thing in the param list is an object literal to which", "// properties may be added. Initialized to null since nothing should be added to the empty", "// object literal in first position of the param list.", "Node", "trailingObjectLiteral", "=", "null", ";", "for", "(", "Node", "child", ":", "obj", ".", "children", "(", ")", ")", "{", "if", "(", "child", ".", "isSpread", "(", ")", ")", "{", "// Add the object directly to the param list.", "Node", "spreaded", "=", "child", ".", "removeFirstChild", "(", ")", ";", "result", ".", "addChildToBack", "(", "spreaded", ")", ";", "// Properties should not be added to the trailing object.", "trailingObjectLiteral", "=", "null", ";", "}", "else", "{", "if", "(", "trailingObjectLiteral", "==", "null", ")", "{", "// Add a new object to which properties may be added.", "trailingObjectLiteral", "=", "astFactory", ".", "createEmptyObjectLit", "(", ")", ";", "result", ".", "addChildToBack", "(", "trailingObjectLiteral", ")", ";", "}", "// Add the property to the object literal.", "trailingObjectLiteral", ".", "addChildToBack", "(", "child", ".", "detach", "(", ")", ")", ";", "}", "}", "result", ".", "useSourceInfoIfMissingFromForTree", "(", "obj", ")", ";", "obj", ".", "replaceWith", "(", "result", ")", ";", "compiler", ".", "reportChangeToEnclosingScope", "(", "result", ")", ";", "}" ]
/* Convert '{first: b, c, ...spread, d: e, last}' to: Object.assign({}, {first:b, c}, spread, {d:e, last});
[ "/", "*", "Convert", "{", "first", ":", "b", "c", "...", "spread", "d", ":", "e", "last", "}", "to", ":" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RewriteObjectSpread.java#L89-L125
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.iPv6Address
public static Validator<CharSequence> iPv6Address(@NonNull final Context context, @StringRes final int resourceId) { """ Creates and returns a validator, which allows to validate texts to ensure, that they represent valid IPv6 addresses. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource ID of the string resource, which contains the error message, which should be set, as an {@link Integer} value. The resource ID must correspond to a valid string resource @return The validator, which has been created, as an instance of the type {@link Validator} """ return new IPv6AddressValidator(context, resourceId); }
java
public static Validator<CharSequence> iPv6Address(@NonNull final Context context, @StringRes final int resourceId) { return new IPv6AddressValidator(context, resourceId); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "iPv6Address", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "StringRes", "final", "int", "resourceId", ")", "{", "return", "new", "IPv6AddressValidator", "(", "context", ",", "resourceId", ")", ";", "}" ]
Creates and returns a validator, which allows to validate texts to ensure, that they represent valid IPv6 addresses. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource ID of the string resource, which contains the error message, which should be set, as an {@link Integer} value. The resource ID must correspond to a valid string resource @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "represent", "valid", "IPv6", "addresses", ".", "Empty", "texts", "are", "also", "accepted", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L954-L957
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java
SphereUtil.bearingDegDeg
public static double bearingDegDeg(double latS, double lngS, double latE, double lngE) { """ Compute the bearing from start to end. @param latS Start latitude, in degree @param lngS Start longitude, in degree @param latE End latitude, in degree @param lngE End longitude, in degree @return Bearing in degree """ return rad2deg(bearingRad(deg2rad(latS), deg2rad(lngS), deg2rad(latE), deg2rad(lngE))); }
java
public static double bearingDegDeg(double latS, double lngS, double latE, double lngE) { return rad2deg(bearingRad(deg2rad(latS), deg2rad(lngS), deg2rad(latE), deg2rad(lngE))); }
[ "public", "static", "double", "bearingDegDeg", "(", "double", "latS", ",", "double", "lngS", ",", "double", "latE", ",", "double", "lngE", ")", "{", "return", "rad2deg", "(", "bearingRad", "(", "deg2rad", "(", "latS", ")", ",", "deg2rad", "(", "lngS", ")", ",", "deg2rad", "(", "latE", ")", ",", "deg2rad", "(", "lngE", ")", ")", ")", ";", "}" ]
Compute the bearing from start to end. @param latS Start latitude, in degree @param lngS Start longitude, in degree @param latE End latitude, in degree @param lngE End longitude, in degree @return Bearing in degree
[ "Compute", "the", "bearing", "from", "start", "to", "end", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L865-L867
googleapis/google-cloud-java
google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java
ClusterManagerClient.getServerConfig
public final ServerConfig getServerConfig(String projectId, String zone) { """ Returns configuration info about the Kubernetes Engine service. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; ServerConfig response = clusterManagerClient.getServerConfig(projectId, zone); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ GetServerConfigRequest request = GetServerConfigRequest.newBuilder().setProjectId(projectId).setZone(zone).build(); return getServerConfig(request); }
java
public final ServerConfig getServerConfig(String projectId, String zone) { GetServerConfigRequest request = GetServerConfigRequest.newBuilder().setProjectId(projectId).setZone(zone).build(); return getServerConfig(request); }
[ "public", "final", "ServerConfig", "getServerConfig", "(", "String", "projectId", ",", "String", "zone", ")", "{", "GetServerConfigRequest", "request", "=", "GetServerConfigRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", "setZone", "(", "zone", ")", ".", "build", "(", ")", ";", "return", "getServerConfig", "(", "request", ")", ";", "}" ]
Returns configuration info about the Kubernetes Engine service. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; ServerConfig response = clusterManagerClient.getServerConfig(projectId, zone); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Returns", "configuration", "info", "about", "the", "Kubernetes", "Engine", "service", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L1653-L1658
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Connection.java
JDBC4Connection.prepareStatement
@Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { """ Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability. """ checkClosed(); throw SQLError.noSupport(); }
java
@Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "PreparedStatement", "prepareStatement", "(", "String", "sql", ",", "int", "resultSetType", ",", "int", "resultSetConcurrency", ",", "int", "resultSetHoldability", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.
[ "Creates", "a", "PreparedStatement", "object", "that", "will", "generate", "ResultSet", "objects", "with", "the", "given", "type", "concurrency", "and", "holdability", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Connection.java#L398-L403
jfinal/jfinal
src/main/java/com/jfinal/config/JFinalConfig.java
JFinalConfig.loadPropertyFile
public Properties loadPropertyFile(File file, String encoding) { """ Load property file Example:<br> loadPropertyFile(new File("/var/config/my_config.txt"), "UTF-8"); @param file the properties File object @param encoding the encoding """ prop = new Prop(file, encoding); return prop.getProperties(); }
java
public Properties loadPropertyFile(File file, String encoding) { prop = new Prop(file, encoding); return prop.getProperties(); }
[ "public", "Properties", "loadPropertyFile", "(", "File", "file", ",", "String", "encoding", ")", "{", "prop", "=", "new", "Prop", "(", "file", ",", "encoding", ")", ";", "return", "prop", ".", "getProperties", "(", ")", ";", "}" ]
Load property file Example:<br> loadPropertyFile(new File("/var/config/my_config.txt"), "UTF-8"); @param file the properties File object @param encoding the encoding
[ "Load", "property", "file", "Example", ":", "<br", ">", "loadPropertyFile", "(", "new", "File", "(", "/", "var", "/", "config", "/", "my_config", ".", "txt", ")", "UTF", "-", "8", ")", ";" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/config/JFinalConfig.java#L125-L128
alkacon/opencms-core
src/org/opencms/workplace/CmsDialog.java
CmsDialog.htmlStartStyle
public String htmlStartStyle(String title, String stylesheet) { """ Builds the start html of the page, including setting of DOCTYPE, inserting a header with the content-type and choosing an individual style sheet.<p> @param title the title for the page @param stylesheet the style sheet to include @return the start html of the page """ return pageHtmlStyle(HTML_START, title, stylesheet); }
java
public String htmlStartStyle(String title, String stylesheet) { return pageHtmlStyle(HTML_START, title, stylesheet); }
[ "public", "String", "htmlStartStyle", "(", "String", "title", ",", "String", "stylesheet", ")", "{", "return", "pageHtmlStyle", "(", "HTML_START", ",", "title", ",", "stylesheet", ")", ";", "}" ]
Builds the start html of the page, including setting of DOCTYPE, inserting a header with the content-type and choosing an individual style sheet.<p> @param title the title for the page @param stylesheet the style sheet to include @return the start html of the page
[ "Builds", "the", "start", "html", "of", "the", "page", "including", "setting", "of", "DOCTYPE", "inserting", "a", "header", "with", "the", "content", "-", "type", "and", "choosing", "an", "individual", "style", "sheet", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L1406-L1409
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java
CommerceWarehouseItemPersistenceImpl.fetchByCWI_CPIU
@Override public CommerceWarehouseItem fetchByCWI_CPIU(long commerceWarehouseId, String CPInstanceUuid) { """ Returns the commerce warehouse item where commerceWarehouseId = &#63; and CPInstanceUuid = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param commerceWarehouseId the commerce warehouse ID @param CPInstanceUuid the cp instance uuid @return the matching commerce warehouse item, or <code>null</code> if a matching commerce warehouse item could not be found """ return fetchByCWI_CPIU(commerceWarehouseId, CPInstanceUuid, true); }
java
@Override public CommerceWarehouseItem fetchByCWI_CPIU(long commerceWarehouseId, String CPInstanceUuid) { return fetchByCWI_CPIU(commerceWarehouseId, CPInstanceUuid, true); }
[ "@", "Override", "public", "CommerceWarehouseItem", "fetchByCWI_CPIU", "(", "long", "commerceWarehouseId", ",", "String", "CPInstanceUuid", ")", "{", "return", "fetchByCWI_CPIU", "(", "commerceWarehouseId", ",", "CPInstanceUuid", ",", "true", ")", ";", "}" ]
Returns the commerce warehouse item where commerceWarehouseId = &#63; and CPInstanceUuid = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param commerceWarehouseId the commerce warehouse ID @param CPInstanceUuid the cp instance uuid @return the matching commerce warehouse item, or <code>null</code> if a matching commerce warehouse item could not be found
[ "Returns", "the", "commerce", "warehouse", "item", "where", "commerceWarehouseId", "=", "&#63", ";", "and", "CPInstanceUuid", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "cache", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java#L677-L681
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java
BeanBox.addBeanAop
public synchronized BeanBox addBeanAop(Object aop, String methodNameRegex) { """ Add an AOP to Bean @param aop An AOP alliance interceptor class or instance @param methodNameRegex @return """ checkOrCreateMethodAopRules(); aopRules.add(new Object[] { BeanBoxUtils.checkAOP(aop), methodNameRegex }); return this; }
java
public synchronized BeanBox addBeanAop(Object aop, String methodNameRegex) { checkOrCreateMethodAopRules(); aopRules.add(new Object[] { BeanBoxUtils.checkAOP(aop), methodNameRegex }); return this; }
[ "public", "synchronized", "BeanBox", "addBeanAop", "(", "Object", "aop", ",", "String", "methodNameRegex", ")", "{", "checkOrCreateMethodAopRules", "(", ")", ";", "aopRules", ".", "add", "(", "new", "Object", "[", "]", "{", "BeanBoxUtils", ".", "checkAOP", "(", "aop", ")", ",", "methodNameRegex", "}", ")", ";", "return", "this", ";", "}" ]
Add an AOP to Bean @param aop An AOP alliance interceptor class or instance @param methodNameRegex @return
[ "Add", "an", "AOP", "to", "Bean" ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java#L267-L271
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.getJsonConfig
public JSONObject getJsonConfig(Path name) throws IOException, JSONException { """ Given a xml config file specified by a path, return the corresponding json object if it exists. """ String pathString = name.toUri().getPath(); String xml = new Path(pathString).getName(); File jsonFile = new File(pathString.replace(xml, MATERIALIZEDJSON)) .getAbsoluteFile(); if (jsonFile.exists()) { InputStream in = new BufferedInputStream(new FileInputStream(jsonFile)); if (in != null) { JSONObject json = instantiateJsonObject(in); // Try to load the xml entity inside the json blob. if (json.has(xmlToThrift(xml))) { return json.getJSONObject(xmlToThrift(xml)); } } } return null; }
java
public JSONObject getJsonConfig(Path name) throws IOException, JSONException { String pathString = name.toUri().getPath(); String xml = new Path(pathString).getName(); File jsonFile = new File(pathString.replace(xml, MATERIALIZEDJSON)) .getAbsoluteFile(); if (jsonFile.exists()) { InputStream in = new BufferedInputStream(new FileInputStream(jsonFile)); if (in != null) { JSONObject json = instantiateJsonObject(in); // Try to load the xml entity inside the json blob. if (json.has(xmlToThrift(xml))) { return json.getJSONObject(xmlToThrift(xml)); } } } return null; }
[ "public", "JSONObject", "getJsonConfig", "(", "Path", "name", ")", "throws", "IOException", ",", "JSONException", "{", "String", "pathString", "=", "name", ".", "toUri", "(", ")", ".", "getPath", "(", ")", ";", "String", "xml", "=", "new", "Path", "(", "pathString", ")", ".", "getName", "(", ")", ";", "File", "jsonFile", "=", "new", "File", "(", "pathString", ".", "replace", "(", "xml", ",", "MATERIALIZEDJSON", ")", ")", ".", "getAbsoluteFile", "(", ")", ";", "if", "(", "jsonFile", ".", "exists", "(", ")", ")", "{", "InputStream", "in", "=", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "jsonFile", ")", ")", ";", "if", "(", "in", "!=", "null", ")", "{", "JSONObject", "json", "=", "instantiateJsonObject", "(", "in", ")", ";", "// Try to load the xml entity inside the json blob.", "if", "(", "json", ".", "has", "(", "xmlToThrift", "(", "xml", ")", ")", ")", "{", "return", "json", ".", "getJSONObject", "(", "xmlToThrift", "(", "xml", ")", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Given a xml config file specified by a path, return the corresponding json object if it exists.
[ "Given", "a", "xml", "config", "file", "specified", "by", "a", "path", "return", "the", "corresponding", "json", "object", "if", "it", "exists", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L1397-L1414
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/download/ImageDownloader.java
ImageDownloader.submitImageDownloadTask
public void submitImageDownloadTask(String URL, String id) { """ Submits a new image download task. @param URL The url of the image @param id The id of the image (used to name the image file after download) """ Callable<ImageDownloadResult> call = new ImageDownload(URL, id, downloadFolder, saveThumb, saveOriginal, followRedirects); pool.submit(call); numPendingTasks++; }
java
public void submitImageDownloadTask(String URL, String id) { Callable<ImageDownloadResult> call = new ImageDownload(URL, id, downloadFolder, saveThumb, saveOriginal, followRedirects); pool.submit(call); numPendingTasks++; }
[ "public", "void", "submitImageDownloadTask", "(", "String", "URL", ",", "String", "id", ")", "{", "Callable", "<", "ImageDownloadResult", ">", "call", "=", "new", "ImageDownload", "(", "URL", ",", "id", ",", "downloadFolder", ",", "saveThumb", ",", "saveOriginal", ",", "followRedirects", ")", ";", "pool", ".", "submit", "(", "call", ")", ";", "numPendingTasks", "++", ";", "}" ]
Submits a new image download task. @param URL The url of the image @param id The id of the image (used to name the image file after download)
[ "Submits", "a", "new", "image", "download", "task", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/download/ImageDownloader.java#L85-L90
lotaris/rox-client-java
rox-client-java/src/main/java/com/lotaris/rox/core/filters/FilterUtils.java
FilterUtils.isRunnable
public static boolean isRunnable(String name, String technicalName, String key, String tags, String tickets, String[] filters) { """ Define if a test is runnable based on its description data @param name Test name @param technicalName Technical name @param key ROX key @param tags The tags @param tickets The tickets @param filters The filters @return True if the test can be run """ return isRunnable(new FilterTargetData(tags, tickets, technicalName, name, key), filters); }
java
public static boolean isRunnable(String name, String technicalName, String key, String tags, String tickets, String[] filters) { return isRunnable(new FilterTargetData(tags, tickets, technicalName, name, key), filters); }
[ "public", "static", "boolean", "isRunnable", "(", "String", "name", ",", "String", "technicalName", ",", "String", "key", ",", "String", "tags", ",", "String", "tickets", ",", "String", "[", "]", "filters", ")", "{", "return", "isRunnable", "(", "new", "FilterTargetData", "(", "tags", ",", "tickets", ",", "technicalName", ",", "name", ",", "key", ")", ",", "filters", ")", ";", "}" ]
Define if a test is runnable based on its description data @param name Test name @param technicalName Technical name @param key ROX key @param tags The tags @param tickets The tickets @param filters The filters @return True if the test can be run
[ "Define", "if", "a", "test", "is", "runnable", "based", "on", "its", "description", "data" ]
train
https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/core/filters/FilterUtils.java#L64-L66
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java
SDNN.dotProductAttention
public SDVariable dotProductAttention(SDVariable queries, SDVariable keys, SDVariable values, SDVariable mask, boolean scaled) { """ This operation performs dot product attention on the given timeseries input with the given queries @see #dotProductAttention(String, SDVariable, SDVariable, SDVariable, SDVariable, boolean, boolean) """ return dotProductAttention(null, queries, keys, values, mask, scaled); }
java
public SDVariable dotProductAttention(SDVariable queries, SDVariable keys, SDVariable values, SDVariable mask, boolean scaled){ return dotProductAttention(null, queries, keys, values, mask, scaled); }
[ "public", "SDVariable", "dotProductAttention", "(", "SDVariable", "queries", ",", "SDVariable", "keys", ",", "SDVariable", "values", ",", "SDVariable", "mask", ",", "boolean", "scaled", ")", "{", "return", "dotProductAttention", "(", "null", ",", "queries", ",", "keys", ",", "values", ",", "mask", ",", "scaled", ")", ";", "}" ]
This operation performs dot product attention on the given timeseries input with the given queries @see #dotProductAttention(String, SDVariable, SDVariable, SDVariable, SDVariable, boolean, boolean)
[ "This", "operation", "performs", "dot", "product", "attention", "on", "the", "given", "timeseries", "input", "with", "the", "given", "queries" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L834-L836
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.WSG84_L1
@Pure public static Point2d WSG84_L1(double lambda, double phi) { """ This function convert WSG84 GPS coordinate to France Lambert I coordinate. @param lambda in degrees. @param phi in degrees. @return the France Lambert I coordinates. """ final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_1_N, LAMBERT_1_C, LAMBERT_1_XS, LAMBERT_1_YS); }
java
@Pure public static Point2d WSG84_L1(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_1_N, LAMBERT_1_C, LAMBERT_1_XS, LAMBERT_1_YS); }
[ "@", "Pure", "public", "static", "Point2d", "WSG84_L1", "(", "double", "lambda", ",", "double", "phi", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "WSG84_NTFLamdaPhi", "(", "lambda", ",", "phi", ")", ";", "return", "NTFLambdaPhi_NTFLambert", "(", "ntfLambdaPhi", ".", "getX", "(", ")", ",", "ntfLambdaPhi", ".", "getY", "(", ")", ",", "LAMBERT_1_N", ",", "LAMBERT_1_C", ",", "LAMBERT_1_XS", ",", "LAMBERT_1_YS", ")", ";", "}" ]
This function convert WSG84 GPS coordinate to France Lambert I coordinate. @param lambda in degrees. @param phi in degrees. @return the France Lambert I coordinates.
[ "This", "function", "convert", "WSG84", "GPS", "coordinate", "to", "France", "Lambert", "I", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1061-L1070
galan/commons
src/main/java/de/galan/commons/net/flux/Response.java
Response.getStreamAsString
public String getStreamAsString(String encoding) throws IOException { """ Converts the inputstream to a string with the given encoding. Subsequent the inputstream will be empty/closed. """ String result = null; try { result = IOUtils.toString(getStream(), encoding); } catch (NullPointerException npex) { throw new IOException("Timeout has been forced by CommonHttpClient", npex); } return result; }
java
public String getStreamAsString(String encoding) throws IOException { String result = null; try { result = IOUtils.toString(getStream(), encoding); } catch (NullPointerException npex) { throw new IOException("Timeout has been forced by CommonHttpClient", npex); } return result; }
[ "public", "String", "getStreamAsString", "(", "String", "encoding", ")", "throws", "IOException", "{", "String", "result", "=", "null", ";", "try", "{", "result", "=", "IOUtils", ".", "toString", "(", "getStream", "(", ")", ",", "encoding", ")", ";", "}", "catch", "(", "NullPointerException", "npex", ")", "{", "throw", "new", "IOException", "(", "\"Timeout has been forced by CommonHttpClient\"", ",", "npex", ")", ";", "}", "return", "result", ";", "}" ]
Converts the inputstream to a string with the given encoding. Subsequent the inputstream will be empty/closed.
[ "Converts", "the", "inputstream", "to", "a", "string", "with", "the", "given", "encoding", ".", "Subsequent", "the", "inputstream", "will", "be", "empty", "/", "closed", "." ]
train
https://github.com/galan/commons/blob/45d2f36c69958d3f847e5fed66603ea629471822/src/main/java/de/galan/commons/net/flux/Response.java#L87-L96
lambdazen/bitsy
src/main/java/com/lambdazen/bitsy/store/Record.java
Record.generateVertexLine
public static void generateVertexLine(StringWriter sw, ObjectMapper mapper, VertexBean vBean) throws JsonGenerationException, JsonMappingException, IOException { """ Efficient method to write a vertex -- avoids writeValueAsString """ sw.getBuffer().setLength(0); sw.append('V'); // Record type sw.append('='); mapper.writeValue(sw, vBean); sw.append('#'); int hashCode = sw.toString().hashCode(); sw.append(toHex(hashCode)); sw.append('\n'); }
java
public static void generateVertexLine(StringWriter sw, ObjectMapper mapper, VertexBean vBean) throws JsonGenerationException, JsonMappingException, IOException { sw.getBuffer().setLength(0); sw.append('V'); // Record type sw.append('='); mapper.writeValue(sw, vBean); sw.append('#'); int hashCode = sw.toString().hashCode(); sw.append(toHex(hashCode)); sw.append('\n'); }
[ "public", "static", "void", "generateVertexLine", "(", "StringWriter", "sw", ",", "ObjectMapper", "mapper", ",", "VertexBean", "vBean", ")", "throws", "JsonGenerationException", ",", "JsonMappingException", ",", "IOException", "{", "sw", ".", "getBuffer", "(", ")", ".", "setLength", "(", "0", ")", ";", "sw", ".", "append", "(", "'", "'", ")", ";", "// Record type", "sw", ".", "append", "(", "'", "'", ")", ";", "mapper", ".", "writeValue", "(", "sw", ",", "vBean", ")", ";", "sw", ".", "append", "(", "'", "'", ")", ";", "int", "hashCode", "=", "sw", ".", "toString", "(", ")", ".", "hashCode", "(", ")", ";", "sw", ".", "append", "(", "toHex", "(", "hashCode", ")", ")", ";", "sw", ".", "append", "(", "'", "'", ")", ";", "}" ]
Efficient method to write a vertex -- avoids writeValueAsString
[ "Efficient", "method", "to", "write", "a", "vertex", "--", "avoids", "writeValueAsString" ]
train
https://github.com/lambdazen/bitsy/blob/c0dd4b6c9d6dc9987d0168c91417eb04d80bf712/src/main/java/com/lambdazen/bitsy/store/Record.java#L71-L84
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java
Indices.isScalar
public static boolean isScalar(INDArray indexOver, INDArrayIndex... indexes) { """ Check if the given indexes over the specified array are searching for a scalar @param indexOver the array to index over @param indexes the index query @return true if the given indexes are searching for a scalar false otherwise """ boolean allOneLength = true; for (int i = 0; i < indexes.length; i++) { allOneLength = allOneLength && indexes[i].length() == 1; } int numNewAxes = NDArrayIndex.numNewAxis(indexes); if (allOneLength && numNewAxes == 0 && indexes.length == indexOver.rank()) return true; else if (allOneLength && indexes.length == indexOver.rank() - numNewAxes) { return allOneLength; } return allOneLength; }
java
public static boolean isScalar(INDArray indexOver, INDArrayIndex... indexes) { boolean allOneLength = true; for (int i = 0; i < indexes.length; i++) { allOneLength = allOneLength && indexes[i].length() == 1; } int numNewAxes = NDArrayIndex.numNewAxis(indexes); if (allOneLength && numNewAxes == 0 && indexes.length == indexOver.rank()) return true; else if (allOneLength && indexes.length == indexOver.rank() - numNewAxes) { return allOneLength; } return allOneLength; }
[ "public", "static", "boolean", "isScalar", "(", "INDArray", "indexOver", ",", "INDArrayIndex", "...", "indexes", ")", "{", "boolean", "allOneLength", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indexes", ".", "length", ";", "i", "++", ")", "{", "allOneLength", "=", "allOneLength", "&&", "indexes", "[", "i", "]", ".", "length", "(", ")", "==", "1", ";", "}", "int", "numNewAxes", "=", "NDArrayIndex", ".", "numNewAxis", "(", "indexes", ")", ";", "if", "(", "allOneLength", "&&", "numNewAxes", "==", "0", "&&", "indexes", ".", "length", "==", "indexOver", ".", "rank", "(", ")", ")", "return", "true", ";", "else", "if", "(", "allOneLength", "&&", "indexes", ".", "length", "==", "indexOver", ".", "rank", "(", ")", "-", "numNewAxes", ")", "{", "return", "allOneLength", ";", "}", "return", "allOneLength", ";", "}" ]
Check if the given indexes over the specified array are searching for a scalar @param indexOver the array to index over @param indexes the index query @return true if the given indexes are searching for a scalar false otherwise
[ "Check", "if", "the", "given", "indexes", "over", "the", "specified", "array", "are", "searching", "for", "a", "scalar" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java#L512-L526
looly/hutool
hutool-core/src/main/java/cn/hutool/core/convert/AbstractConverter.java
AbstractConverter.convertQuietly
public T convertQuietly(Object value, T defaultValue) { """ 不抛异常转换<br> 当转换失败时返回默认值 @param value 被转换的值 @param defaultValue 默认值 @return 转换后的值 @since 4.5.7 """ try { return convert(value, defaultValue); } catch (Exception e) { return defaultValue; } }
java
public T convertQuietly(Object value, T defaultValue) { try { return convert(value, defaultValue); } catch (Exception e) { return defaultValue; } }
[ "public", "T", "convertQuietly", "(", "Object", "value", ",", "T", "defaultValue", ")", "{", "try", "{", "return", "convert", "(", "value", ",", "defaultValue", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
不抛异常转换<br> 当转换失败时返回默认值 @param value 被转换的值 @param defaultValue 默认值 @return 转换后的值 @since 4.5.7
[ "不抛异常转换<br", ">", "当转换失败时返回默认值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/AbstractConverter.java#L28-L34
walkmod/walkmod-core
src/main/java/org/walkmod/WalkModFacade.java
WalkModFacade.removeChains
public void removeChains(List<String> chains, boolean recursive) throws Exception { """ Removes the chains from the Walkmod config file. @param chains Chain names to remove @param recursive If it necessary to remove the chains from all the submodules. @throws Exception If the walkmod configuration file can't be read. """ long startTime = System.currentTimeMillis(); Exception exception = null; if (cfg.exists()) { userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); manager.getProjectConfigurationProvider().removeChains(chains, recursive); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } } }
java
public void removeChains(List<String> chains, boolean recursive) throws Exception { long startTime = System.currentTimeMillis(); Exception exception = null; if (cfg.exists()) { userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); manager.getProjectConfigurationProvider().removeChains(chains, recursive); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } } }
[ "public", "void", "removeChains", "(", "List", "<", "String", ">", "chains", ",", "boolean", "recursive", ")", "throws", "Exception", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Exception", "exception", "=", "null", ";", "if", "(", "cfg", ".", "exists", "(", ")", ")", "{", "userDir", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"user.dir\"", ")", ")", ".", "getAbsolutePath", "(", ")", ";", "System", ".", "setProperty", "(", "\"user.dir\"", ",", "options", ".", "getExecutionDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ";", "try", "{", "ConfigurationManager", "manager", "=", "new", "ConfigurationManager", "(", "cfg", ",", "false", ")", ";", "manager", ".", "getProjectConfigurationProvider", "(", ")", ".", "removeChains", "(", "chains", ",", "recursive", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "exception", "=", "e", ";", "}", "finally", "{", "System", ".", "setProperty", "(", "\"user.dir\"", ",", "userDir", ")", ";", "updateMsg", "(", "startTime", ",", "exception", ")", ";", "}", "}", "}" ]
Removes the chains from the Walkmod config file. @param chains Chain names to remove @param recursive If it necessary to remove the chains from all the submodules. @throws Exception If the walkmod configuration file can't be read.
[ "Removes", "the", "chains", "from", "the", "Walkmod", "config", "file", "." ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L956-L974
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/TransformsInner.java
TransformsInner.listAsync
public Observable<Page<TransformInner>> listAsync(final String resourceGroupName, final String accountName) { """ List Transforms. Lists the Transforms in the account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;TransformInner&gt; object """ return listWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<TransformInner>>, Page<TransformInner>>() { @Override public Page<TransformInner> call(ServiceResponse<Page<TransformInner>> response) { return response.body(); } }); }
java
public Observable<Page<TransformInner>> listAsync(final String resourceGroupName, final String accountName) { return listWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<TransformInner>>, Page<TransformInner>>() { @Override public Page<TransformInner> call(ServiceResponse<Page<TransformInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "TransformInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "TransformInner", ">", ">", ",", "Page", "<", "TransformInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "TransformInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "TransformInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List Transforms. Lists the Transforms in the account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;TransformInner&gt; object
[ "List", "Transforms", ".", "Lists", "the", "Transforms", "in", "the", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/TransformsInner.java#L143-L151
jroyalty/jglm
src/main/java/com/hackoeur/jglm/support/FastMathCalc.java
FastMathCalc.printarray
static void printarray(PrintStream out, String name, int expectedLen, double[][] array2d) { """ Print an array. @param out text output stream where output should be printed @param name array name @param expectedLen expected length of the array @param array2d array data """ out.println(name); checkLen(expectedLen, array2d.length); out.println(TABLE_START_DECL + " "); int i = 0; for(double[] array : array2d) { // "double array[]" causes PMD parsing error out.print(" {"); for(double d : array) { // assume inner array has very few entries out.printf("%-25.25s", format(d)); // multiple entries per line } out.println("}, // " + i++); } out.println(TABLE_END_DECL); }
java
static void printarray(PrintStream out, String name, int expectedLen, double[][] array2d) { out.println(name); checkLen(expectedLen, array2d.length); out.println(TABLE_START_DECL + " "); int i = 0; for(double[] array : array2d) { // "double array[]" causes PMD parsing error out.print(" {"); for(double d : array) { // assume inner array has very few entries out.printf("%-25.25s", format(d)); // multiple entries per line } out.println("}, // " + i++); } out.println(TABLE_END_DECL); }
[ "static", "void", "printarray", "(", "PrintStream", "out", ",", "String", "name", ",", "int", "expectedLen", ",", "double", "[", "]", "[", "]", "array2d", ")", "{", "out", ".", "println", "(", "name", ")", ";", "checkLen", "(", "expectedLen", ",", "array2d", ".", "length", ")", ";", "out", ".", "println", "(", "TABLE_START_DECL", "+", "\" \"", ")", ";", "int", "i", "=", "0", ";", "for", "(", "double", "[", "]", "array", ":", "array2d", ")", "{", "// \"double array[]\" causes PMD parsing error", "out", ".", "print", "(", "\" {\"", ")", ";", "for", "(", "double", "d", ":", "array", ")", "{", "// assume inner array has very few entries", "out", ".", "printf", "(", "\"%-25.25s\"", ",", "format", "(", "d", ")", ")", ";", "// multiple entries per line", "}", "out", ".", "println", "(", "\"}, // \"", "+", "i", "++", ")", ";", "}", "out", ".", "println", "(", "TABLE_END_DECL", ")", ";", "}" ]
Print an array. @param out text output stream where output should be printed @param name array name @param expectedLen expected length of the array @param array2d array data
[ "Print", "an", "array", "." ]
train
https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMathCalc.java#L600-L613
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.getPageContent
public String getPageContent(Page currentPage, Boolean implementedVersion) throws GreenPepperServerException { """ <p>getPageContent.</p> @param currentPage a {@link com.atlassian.confluence.pages.Page} object. @param implementedVersion a {@link java.lang.Boolean} object. @return a {@link java.lang.String} object. @throws com.greenpepper.server.GreenPepperServerException if any. """ AbstractPage page = currentPage; if (implementedVersion) { page = getImplementedPage(currentPage); } return getBodyTypeAwareRenderer().render(page); }
java
public String getPageContent(Page currentPage, Boolean implementedVersion) throws GreenPepperServerException { AbstractPage page = currentPage; if (implementedVersion) { page = getImplementedPage(currentPage); } return getBodyTypeAwareRenderer().render(page); }
[ "public", "String", "getPageContent", "(", "Page", "currentPage", ",", "Boolean", "implementedVersion", ")", "throws", "GreenPepperServerException", "{", "AbstractPage", "page", "=", "currentPage", ";", "if", "(", "implementedVersion", ")", "{", "page", "=", "getImplementedPage", "(", "currentPage", ")", ";", "}", "return", "getBodyTypeAwareRenderer", "(", ")", ".", "render", "(", "page", ")", ";", "}" ]
<p>getPageContent.</p> @param currentPage a {@link com.atlassian.confluence.pages.Page} object. @param implementedVersion a {@link java.lang.Boolean} object. @return a {@link java.lang.String} object. @throws com.greenpepper.server.GreenPepperServerException if any.
[ "<p", ">", "getPageContent", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L453-L459
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java
FacesImpl.detectWithStream
public List<DetectedFace> detectWithStream(byte[] image, DetectWithStreamOptionalParameter detectWithStreamOptionalParameter) { """ Detect human faces in an image and returns face locations, and optionally with faceIds, landmarks, and attributes. @param image An image stream. @param detectWithStreamOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;DetectedFace&gt; object if successful. """ return detectWithStreamWithServiceResponseAsync(image, detectWithStreamOptionalParameter).toBlocking().single().body(); }
java
public List<DetectedFace> detectWithStream(byte[] image, DetectWithStreamOptionalParameter detectWithStreamOptionalParameter) { return detectWithStreamWithServiceResponseAsync(image, detectWithStreamOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "DetectedFace", ">", "detectWithStream", "(", "byte", "[", "]", "image", ",", "DetectWithStreamOptionalParameter", "detectWithStreamOptionalParameter", ")", "{", "return", "detectWithStreamWithServiceResponseAsync", "(", "image", ",", "detectWithStreamOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Detect human faces in an image and returns face locations, and optionally with faceIds, landmarks, and attributes. @param image An image stream. @param detectWithStreamOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;DetectedFace&gt; object if successful.
[ "Detect", "human", "faces", "in", "an", "image", "and", "returns", "face", "locations", "and", "optionally", "with", "faceIds", "landmarks", "and", "attributes", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java#L925-L927
aoindustries/aocode-public
src/main/java/com/aoindustries/servlet/jsp/tagext/JspTagUtils.java
JspTagUtils.findAncestor
public static <T> T findAncestor(JspTag from, Class<? extends T> clazz) throws JspException { """ Finds the first parent tag of the provided class (or subclass) or implementing the provided interface. @return the parent tag @exception JspException if parent not found """ T parent = clazz.cast(SimpleTagSupport.findAncestorWithClass(from, clazz)); if(parent==null) throw new LocalizedJspException(accessor, "JspTagUtils.findAncestor.notFound", getClassName(from.getClass()), getClassName(clazz)); return parent; }
java
public static <T> T findAncestor(JspTag from, Class<? extends T> clazz) throws JspException { T parent = clazz.cast(SimpleTagSupport.findAncestorWithClass(from, clazz)); if(parent==null) throw new LocalizedJspException(accessor, "JspTagUtils.findAncestor.notFound", getClassName(from.getClass()), getClassName(clazz)); return parent; }
[ "public", "static", "<", "T", ">", "T", "findAncestor", "(", "JspTag", "from", ",", "Class", "<", "?", "extends", "T", ">", "clazz", ")", "throws", "JspException", "{", "T", "parent", "=", "clazz", ".", "cast", "(", "SimpleTagSupport", ".", "findAncestorWithClass", "(", "from", ",", "clazz", ")", ")", ";", "if", "(", "parent", "==", "null", ")", "throw", "new", "LocalizedJspException", "(", "accessor", ",", "\"JspTagUtils.findAncestor.notFound\"", ",", "getClassName", "(", "from", ".", "getClass", "(", ")", ")", ",", "getClassName", "(", "clazz", ")", ")", ";", "return", "parent", ";", "}" ]
Finds the first parent tag of the provided class (or subclass) or implementing the provided interface. @return the parent tag @exception JspException if parent not found
[ "Finds", "the", "first", "parent", "tag", "of", "the", "provided", "class", "(", "or", "subclass", ")", "or", "implementing", "the", "provided", "interface", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/jsp/tagext/JspTagUtils.java#L53-L57
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listPrebuilts
public List<PrebuiltEntityExtractor> listPrebuilts(UUID appId, String versionId, ListPrebuiltsOptionalParameter listPrebuiltsOptionalParameter) { """ Gets information about the prebuilt entity models. @param appId The application ID. @param versionId The version ID. @param listPrebuiltsOptionalParameter the object representing the optional parameters to be set before calling this API @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 List&lt;PrebuiltEntityExtractor&gt; object if successful. """ return listPrebuiltsWithServiceResponseAsync(appId, versionId, listPrebuiltsOptionalParameter).toBlocking().single().body(); }
java
public List<PrebuiltEntityExtractor> listPrebuilts(UUID appId, String versionId, ListPrebuiltsOptionalParameter listPrebuiltsOptionalParameter) { return listPrebuiltsWithServiceResponseAsync(appId, versionId, listPrebuiltsOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "PrebuiltEntityExtractor", ">", "listPrebuilts", "(", "UUID", "appId", ",", "String", "versionId", ",", "ListPrebuiltsOptionalParameter", "listPrebuiltsOptionalParameter", ")", "{", "return", "listPrebuiltsWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "listPrebuiltsOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets information about the prebuilt entity models. @param appId The application ID. @param versionId The version ID. @param listPrebuiltsOptionalParameter the object representing the optional parameters to be set before calling this API @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 List&lt;PrebuiltEntityExtractor&gt; object if successful.
[ "Gets", "information", "about", "the", "prebuilt", "entity", "models", "." ]
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/ModelsImpl.java#L2183-L2185
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java
SvgGraphicsContext.drawLine
public void drawLine(Object parent, String name, LineString line, ShapeStyle style) { """ Draw a {@link LineString} geometry onto the <code>GraphicsContext</code>. @param parent parent group object @param name The LineString's name. @param line The LineString to be drawn. @param style The styling object for the LineString. Watch out for fill colors! If the fill opacity is not 0, then the LineString will have a fill surface. """ if (isAttached()) { Element element = helper.createOrUpdateElement(parent, name, "path", style); if (line != null) { Dom.setElementAttribute(element, "d", SvgPathDecoder.decode(line)); } } }
java
public void drawLine(Object parent, String name, LineString line, ShapeStyle style) { if (isAttached()) { Element element = helper.createOrUpdateElement(parent, name, "path", style); if (line != null) { Dom.setElementAttribute(element, "d", SvgPathDecoder.decode(line)); } } }
[ "public", "void", "drawLine", "(", "Object", "parent", ",", "String", "name", ",", "LineString", "line", ",", "ShapeStyle", "style", ")", "{", "if", "(", "isAttached", "(", ")", ")", "{", "Element", "element", "=", "helper", ".", "createOrUpdateElement", "(", "parent", ",", "name", ",", "\"path\"", ",", "style", ")", ";", "if", "(", "line", "!=", "null", ")", "{", "Dom", ".", "setElementAttribute", "(", "element", ",", "\"d\"", ",", "SvgPathDecoder", ".", "decode", "(", "line", ")", ")", ";", "}", "}", "}" ]
Draw a {@link LineString} geometry onto the <code>GraphicsContext</code>. @param parent parent group object @param name The LineString's name. @param line The LineString to be drawn. @param style The styling object for the LineString. Watch out for fill colors! If the fill opacity is not 0, then the LineString will have a fill surface.
[ "Draw", "a", "{", "@link", "LineString", "}", "geometry", "onto", "the", "<code", ">", "GraphicsContext<", "/", "code", ">", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L295-L302
codescape/bitvunit
bitvunit-core/src/main/java/de/codescape/bitvunit/util/html/HtmlPageUtil.java
HtmlPageUtil.toHtmlPage
public static HtmlPage toHtmlPage(String string) { """ Creates a {@link HtmlPage} from a given {@link String} that contains the HTML code for that page. @param string {@link String} that contains the HTML code @return {@link HtmlPage} for this {@link String} """ try { URL url = new URL("http://bitvunit.codescape.de/some_page.html"); return HTMLParser.parseHtml(new StringWebResponse(string, url), new WebClient().getCurrentWindow()); } catch (IOException e) { throw new RuntimeException("Error creating HtmlPage from String.", e); } }
java
public static HtmlPage toHtmlPage(String string) { try { URL url = new URL("http://bitvunit.codescape.de/some_page.html"); return HTMLParser.parseHtml(new StringWebResponse(string, url), new WebClient().getCurrentWindow()); } catch (IOException e) { throw new RuntimeException("Error creating HtmlPage from String.", e); } }
[ "public", "static", "HtmlPage", "toHtmlPage", "(", "String", "string", ")", "{", "try", "{", "URL", "url", "=", "new", "URL", "(", "\"http://bitvunit.codescape.de/some_page.html\"", ")", ";", "return", "HTMLParser", ".", "parseHtml", "(", "new", "StringWebResponse", "(", "string", ",", "url", ")", ",", "new", "WebClient", "(", ")", ".", "getCurrentWindow", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error creating HtmlPage from String.\"", ",", "e", ")", ";", "}", "}" ]
Creates a {@link HtmlPage} from a given {@link String} that contains the HTML code for that page. @param string {@link String} that contains the HTML code @return {@link HtmlPage} for this {@link String}
[ "Creates", "a", "{", "@link", "HtmlPage", "}", "from", "a", "given", "{", "@link", "String", "}", "that", "contains", "the", "HTML", "code", "for", "that", "page", "." ]
train
https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/util/html/HtmlPageUtil.java#L32-L39
bbottema/outlook-message-parser
src/main/java/org/simplejavamail/outlookmessageparser/OutlookMessageParser.java
OutlookMessageParser.checkDirectoryDocumentEntry
private void checkDirectoryDocumentEntry(final DocumentEntry de, final OutlookMessage msg) throws IOException { """ Parses a directory document entry which can either be a simple entry or a stream that has to be split up into multiple document entries again. The parsed information is put into the {@link OutlookMessage} object. @param de The current node in the .msg file. @param msg The resulting {@link OutlookMessage} object. @throws IOException Thrown if the .msg file could not be parsed. """ if (de.getName().startsWith(PROPS_KEY)) { //TODO: parse properties stream final List<DocumentEntry> deList = getDocumentEntriesFromPropertiesStream(de); for (final DocumentEntry deFromProps : deList) { final OutlookMessageProperty msgProp = getMessagePropertyFromDocumentEntry(deFromProps); msg.setProperty(msgProp); } } else { msg.setProperty(getMessagePropertyFromDocumentEntry(de)); } }
java
private void checkDirectoryDocumentEntry(final DocumentEntry de, final OutlookMessage msg) throws IOException { if (de.getName().startsWith(PROPS_KEY)) { //TODO: parse properties stream final List<DocumentEntry> deList = getDocumentEntriesFromPropertiesStream(de); for (final DocumentEntry deFromProps : deList) { final OutlookMessageProperty msgProp = getMessagePropertyFromDocumentEntry(deFromProps); msg.setProperty(msgProp); } } else { msg.setProperty(getMessagePropertyFromDocumentEntry(de)); } }
[ "private", "void", "checkDirectoryDocumentEntry", "(", "final", "DocumentEntry", "de", ",", "final", "OutlookMessage", "msg", ")", "throws", "IOException", "{", "if", "(", "de", ".", "getName", "(", ")", ".", "startsWith", "(", "PROPS_KEY", ")", ")", "{", "//TODO: parse properties stream", "final", "List", "<", "DocumentEntry", ">", "deList", "=", "getDocumentEntriesFromPropertiesStream", "(", "de", ")", ";", "for", "(", "final", "DocumentEntry", "deFromProps", ":", "deList", ")", "{", "final", "OutlookMessageProperty", "msgProp", "=", "getMessagePropertyFromDocumentEntry", "(", "deFromProps", ")", ";", "msg", ".", "setProperty", "(", "msgProp", ")", ";", "}", "}", "else", "{", "msg", ".", "setProperty", "(", "getMessagePropertyFromDocumentEntry", "(", "de", ")", ")", ";", "}", "}" ]
Parses a directory document entry which can either be a simple entry or a stream that has to be split up into multiple document entries again. The parsed information is put into the {@link OutlookMessage} object. @param de The current node in the .msg file. @param msg The resulting {@link OutlookMessage} object. @throws IOException Thrown if the .msg file could not be parsed.
[ "Parses", "a", "directory", "document", "entry", "which", "can", "either", "be", "a", "simple", "entry", "or", "a", "stream", "that", "has", "to", "be", "split", "up", "into", "multiple", "document", "entries", "again", ".", "The", "parsed", "information", "is", "put", "into", "the", "{", "@link", "OutlookMessage", "}", "object", "." ]
train
https://github.com/bbottema/outlook-message-parser/blob/ea7d59da33c8a62dfc2e0aa64d2f8f7c903ccb0e/src/main/java/org/simplejavamail/outlookmessageparser/OutlookMessageParser.java#L210-L222
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/helpers/ParameterHelper.java
ParameterHelper.parseParametersForSizeLimit
public static long parseParametersForSizeLimit(Map<String, String> parameters) throws JournalException { """ Get the size limit parameter (or let it default), and convert it to bytes. """ String sizeString = getOptionalStringParameter(parameters, PARAMETER_JOURNAL_FILE_SIZE_LIMIT, DEFAULT_SIZE_LIMIT); Pattern p = Pattern.compile("([0-9]+)([KMG]?)"); Matcher m = p.matcher(sizeString); if (!m.matches()) { throw new JournalException("Parameter '" + PARAMETER_JOURNAL_FILE_SIZE_LIMIT + "' must be an integer number of bytes, " + "optionally followed by 'K', 'M', or 'G', " + "or a 0 to indicate no size limit"); } long size = Long.parseLong(m.group(1)); String factor = m.group(2); if ("K".equals(factor)) { size *= 1024; } else if ("M".equals(factor)) { size *= 1024 * 1024; } else if ("G".equals(factor)) { size *= 1024 * 1024 * 1024; } return size; }
java
public static long parseParametersForSizeLimit(Map<String, String> parameters) throws JournalException { String sizeString = getOptionalStringParameter(parameters, PARAMETER_JOURNAL_FILE_SIZE_LIMIT, DEFAULT_SIZE_LIMIT); Pattern p = Pattern.compile("([0-9]+)([KMG]?)"); Matcher m = p.matcher(sizeString); if (!m.matches()) { throw new JournalException("Parameter '" + PARAMETER_JOURNAL_FILE_SIZE_LIMIT + "' must be an integer number of bytes, " + "optionally followed by 'K', 'M', or 'G', " + "or a 0 to indicate no size limit"); } long size = Long.parseLong(m.group(1)); String factor = m.group(2); if ("K".equals(factor)) { size *= 1024; } else if ("M".equals(factor)) { size *= 1024 * 1024; } else if ("G".equals(factor)) { size *= 1024 * 1024 * 1024; } return size; }
[ "public", "static", "long", "parseParametersForSizeLimit", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "throws", "JournalException", "{", "String", "sizeString", "=", "getOptionalStringParameter", "(", "parameters", ",", "PARAMETER_JOURNAL_FILE_SIZE_LIMIT", ",", "DEFAULT_SIZE_LIMIT", ")", ";", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "\"([0-9]+)([KMG]?)\"", ")", ";", "Matcher", "m", "=", "p", ".", "matcher", "(", "sizeString", ")", ";", "if", "(", "!", "m", ".", "matches", "(", ")", ")", "{", "throw", "new", "JournalException", "(", "\"Parameter '\"", "+", "PARAMETER_JOURNAL_FILE_SIZE_LIMIT", "+", "\"' must be an integer number of bytes, \"", "+", "\"optionally followed by 'K', 'M', or 'G', \"", "+", "\"or a 0 to indicate no size limit\"", ")", ";", "}", "long", "size", "=", "Long", ".", "parseLong", "(", "m", ".", "group", "(", "1", ")", ")", ";", "String", "factor", "=", "m", ".", "group", "(", "2", ")", ";", "if", "(", "\"K\"", ".", "equals", "(", "factor", ")", ")", "{", "size", "*=", "1024", ";", "}", "else", "if", "(", "\"M\"", ".", "equals", "(", "factor", ")", ")", "{", "size", "*=", "1024", "*", "1024", ";", "}", "else", "if", "(", "\"G\"", ".", "equals", "(", "factor", ")", ")", "{", "size", "*=", "1024", "*", "1024", "*", "1024", ";", "}", "return", "size", ";", "}" ]
Get the size limit parameter (or let it default), and convert it to bytes.
[ "Get", "the", "size", "limit", "parameter", "(", "or", "let", "it", "default", ")", "and", "convert", "it", "to", "bytes", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/helpers/ParameterHelper.java#L129-L154
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java
SARLFormatter._format
protected void _format(SarlEvent event, IFormattableDocument document) { """ Format the given SARL event. @param event the SARL component. @param document the document. """ formatAnnotations(event, document, XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations); formatModifiers(event, document); final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(event); document.append(regionFor.keyword(this.keywords.getEventKeyword()), ONE_SPACE); document.surround(regionFor.keyword(this.keywords.getExtendsKeyword()), ONE_SPACE); document.format(event.getExtends()); formatBody(event, document); }
java
protected void _format(SarlEvent event, IFormattableDocument document) { formatAnnotations(event, document, XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations); formatModifiers(event, document); final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(event); document.append(regionFor.keyword(this.keywords.getEventKeyword()), ONE_SPACE); document.surround(regionFor.keyword(this.keywords.getExtendsKeyword()), ONE_SPACE); document.format(event.getExtends()); formatBody(event, document); }
[ "protected", "void", "_format", "(", "SarlEvent", "event", ",", "IFormattableDocument", "document", ")", "{", "formatAnnotations", "(", "event", ",", "document", ",", "XbaseFormatterPreferenceKeys", ".", "newLineAfterClassAnnotations", ")", ";", "formatModifiers", "(", "event", ",", "document", ")", ";", "final", "ISemanticRegionsFinder", "regionFor", "=", "this", ".", "textRegionExtensions", ".", "regionFor", "(", "event", ")", ";", "document", ".", "append", "(", "regionFor", ".", "keyword", "(", "this", ".", "keywords", ".", "getEventKeyword", "(", ")", ")", ",", "ONE_SPACE", ")", ";", "document", ".", "surround", "(", "regionFor", ".", "keyword", "(", "this", ".", "keywords", ".", "getExtendsKeyword", "(", ")", ")", ",", "ONE_SPACE", ")", ";", "document", ".", "format", "(", "event", ".", "getExtends", "(", ")", ")", ";", "formatBody", "(", "event", ",", "document", ")", ";", "}" ]
Format the given SARL event. @param event the SARL component. @param document the document.
[ "Format", "the", "given", "SARL", "event", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java#L195-L206
NessComputing/service-discovery
jms/src/main/java/com/nesscomputing/jms/activemq/ServiceDiscoveryTransportFactory.java
ServiceDiscoveryTransportFactory.getDiscoveryId
private UUID getDiscoveryId(final Map<String, String> params) throws IOException { """ Find and validate the discoveryId given in a connection string """ final String discoveryId = params.get("discoveryId"); if (discoveryId == null) { throw new IOException("srvc transport did not get a discoveryId parameter. Refusing to create."); } return UUID.fromString(discoveryId); }
java
private UUID getDiscoveryId(final Map<String, String> params) throws IOException { final String discoveryId = params.get("discoveryId"); if (discoveryId == null) { throw new IOException("srvc transport did not get a discoveryId parameter. Refusing to create."); } return UUID.fromString(discoveryId); }
[ "private", "UUID", "getDiscoveryId", "(", "final", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "IOException", "{", "final", "String", "discoveryId", "=", "params", ".", "get", "(", "\"discoveryId\"", ")", ";", "if", "(", "discoveryId", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"srvc transport did not get a discoveryId parameter. Refusing to create.\"", ")", ";", "}", "return", "UUID", ".", "fromString", "(", "discoveryId", ")", ";", "}" ]
Find and validate the discoveryId given in a connection string
[ "Find", "and", "validate", "the", "discoveryId", "given", "in", "a", "connection", "string" ]
train
https://github.com/NessComputing/service-discovery/blob/5091ffdb1de6b12d216d1c238f72858037c7b765/jms/src/main/java/com/nesscomputing/jms/activemq/ServiceDiscoveryTransportFactory.java#L108-L115
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/geo/GeometryShapeConverter.java
GeometryShapeConverter.decodeObject
@SuppressWarnings("unchecked") // always have unchecked casts when dealing with raw classes private Geometry decodeObject(final List mongoDBGeometry, final List<GeometryFactory> geometryFactories) { """ /* We're expecting a List that can be turned into a geometry using a series of factories """ GeometryFactory factory = geometryFactories.get(0); if (geometryFactories.size() == 1) { // This should be the last list, so no need to decode further return factory.createGeometry(mongoDBGeometry); } else { List<Geometry> decodedObjects = new ArrayList<Geometry>(); for (final Object objectThatNeedsDecoding : mongoDBGeometry) { // MongoDB geometries are lists of lists of lists... decodedObjects.add(decodeObject((List) objectThatNeedsDecoding, geometryFactories.subList(1, geometryFactories.size()))); } return factory.createGeometry(decodedObjects); } }
java
@SuppressWarnings("unchecked") // always have unchecked casts when dealing with raw classes private Geometry decodeObject(final List mongoDBGeometry, final List<GeometryFactory> geometryFactories) { GeometryFactory factory = geometryFactories.get(0); if (geometryFactories.size() == 1) { // This should be the last list, so no need to decode further return factory.createGeometry(mongoDBGeometry); } else { List<Geometry> decodedObjects = new ArrayList<Geometry>(); for (final Object objectThatNeedsDecoding : mongoDBGeometry) { // MongoDB geometries are lists of lists of lists... decodedObjects.add(decodeObject((List) objectThatNeedsDecoding, geometryFactories.subList(1, geometryFactories.size()))); } return factory.createGeometry(decodedObjects); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// always have unchecked casts when dealing with raw classes", "private", "Geometry", "decodeObject", "(", "final", "List", "mongoDBGeometry", ",", "final", "List", "<", "GeometryFactory", ">", "geometryFactories", ")", "{", "GeometryFactory", "factory", "=", "geometryFactories", ".", "get", "(", "0", ")", ";", "if", "(", "geometryFactories", ".", "size", "(", ")", "==", "1", ")", "{", "// This should be the last list, so no need to decode further", "return", "factory", ".", "createGeometry", "(", "mongoDBGeometry", ")", ";", "}", "else", "{", "List", "<", "Geometry", ">", "decodedObjects", "=", "new", "ArrayList", "<", "Geometry", ">", "(", ")", ";", "for", "(", "final", "Object", "objectThatNeedsDecoding", ":", "mongoDBGeometry", ")", "{", "// MongoDB geometries are lists of lists of lists...", "decodedObjects", ".", "add", "(", "decodeObject", "(", "(", "List", ")", "objectThatNeedsDecoding", ",", "geometryFactories", ".", "subList", "(", "1", ",", "geometryFactories", ".", "size", "(", ")", ")", ")", ")", ";", "}", "return", "factory", ".", "createGeometry", "(", "decodedObjects", ")", ";", "}", "}" ]
/* We're expecting a List that can be turned into a geometry using a series of factories
[ "/", "*", "We", "re", "expecting", "a", "List", "that", "can", "be", "turned", "into", "a", "geometry", "using", "a", "series", "of", "factories" ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/geo/GeometryShapeConverter.java#L56-L71
apache/incubator-atlas
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
EntityResource.getEntityListByType
public Response getEntityListByType(String entityType) { """ Gets the list of entities for a given entity type. @param entityType name of a type which is unique """ try { Preconditions.checkNotNull(entityType, "Entity type cannot be null"); if (LOG.isDebugEnabled()) { LOG.debug("Fetching entity list for type={} ", entityType); } final List<String> entityList = metadataService.getEntityList(entityType); JSONObject response = new JSONObject(); response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId()); response.put(AtlasClient.TYPENAME, entityType); response.put(AtlasClient.RESULTS, new JSONArray(entityList)); response.put(AtlasClient.COUNT, entityList.size()); return Response.ok(response).build(); } catch (NullPointerException e) { LOG.error("Entity type cannot be null", e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST)); } catch (AtlasException | IllegalArgumentException e) { LOG.error("Unable to get entity list for type {}", entityType, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST)); } catch (WebApplicationException e) { LOG.error("Unable to get entity list for type {}", entityType, e); throw e; } catch (Throwable e) { LOG.error("Unable to get entity list for type {}", entityType, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR)); } }
java
public Response getEntityListByType(String entityType) { try { Preconditions.checkNotNull(entityType, "Entity type cannot be null"); if (LOG.isDebugEnabled()) { LOG.debug("Fetching entity list for type={} ", entityType); } final List<String> entityList = metadataService.getEntityList(entityType); JSONObject response = new JSONObject(); response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId()); response.put(AtlasClient.TYPENAME, entityType); response.put(AtlasClient.RESULTS, new JSONArray(entityList)); response.put(AtlasClient.COUNT, entityList.size()); return Response.ok(response).build(); } catch (NullPointerException e) { LOG.error("Entity type cannot be null", e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST)); } catch (AtlasException | IllegalArgumentException e) { LOG.error("Unable to get entity list for type {}", entityType, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST)); } catch (WebApplicationException e) { LOG.error("Unable to get entity list for type {}", entityType, e); throw e; } catch (Throwable e) { LOG.error("Unable to get entity list for type {}", entityType, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR)); } }
[ "public", "Response", "getEntityListByType", "(", "String", "entityType", ")", "{", "try", "{", "Preconditions", ".", "checkNotNull", "(", "entityType", ",", "\"Entity type cannot be null\"", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Fetching entity list for type={} \"", ",", "entityType", ")", ";", "}", "final", "List", "<", "String", ">", "entityList", "=", "metadataService", ".", "getEntityList", "(", "entityType", ")", ";", "JSONObject", "response", "=", "new", "JSONObject", "(", ")", ";", "response", ".", "put", "(", "AtlasClient", ".", "REQUEST_ID", ",", "Servlets", ".", "getRequestId", "(", ")", ")", ";", "response", ".", "put", "(", "AtlasClient", ".", "TYPENAME", ",", "entityType", ")", ";", "response", ".", "put", "(", "AtlasClient", ".", "RESULTS", ",", "new", "JSONArray", "(", "entityList", ")", ")", ";", "response", ".", "put", "(", "AtlasClient", ".", "COUNT", ",", "entityList", ".", "size", "(", ")", ")", ";", "return", "Response", ".", "ok", "(", "response", ")", ".", "build", "(", ")", ";", "}", "catch", "(", "NullPointerException", "e", ")", "{", "LOG", ".", "error", "(", "\"Entity type cannot be null\"", ",", "e", ")", ";", "throw", "new", "WebApplicationException", "(", "Servlets", ".", "getErrorResponse", "(", "e", ",", "Response", ".", "Status", ".", "BAD_REQUEST", ")", ")", ";", "}", "catch", "(", "AtlasException", "|", "IllegalArgumentException", "e", ")", "{", "LOG", ".", "error", "(", "\"Unable to get entity list for type {}\"", ",", "entityType", ",", "e", ")", ";", "throw", "new", "WebApplicationException", "(", "Servlets", ".", "getErrorResponse", "(", "e", ",", "Response", ".", "Status", ".", "BAD_REQUEST", ")", ")", ";", "}", "catch", "(", "WebApplicationException", "e", ")", "{", "LOG", ".", "error", "(", "\"Unable to get entity list for type {}\"", ",", "entityType", ",", "e", ")", ";", "throw", "e", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "LOG", ".", "error", "(", "\"Unable to get entity list for type {}\"", ",", "entityType", ",", "e", ")", ";", "throw", "new", "WebApplicationException", "(", "Servlets", ".", "getErrorResponse", "(", "e", ",", "Response", ".", "Status", ".", "INTERNAL_SERVER_ERROR", ")", ")", ";", "}", "}" ]
Gets the list of entities for a given entity type. @param entityType name of a type which is unique
[ "Gets", "the", "list", "of", "entities", "for", "a", "given", "entity", "type", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java#L711-L741
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmBreakpointPropertyPage.java
VdmBreakpointPropertyPage.createText
protected Text createText(Composite parent, String initialValue) { """ Creates a fully configured text editor with the given initial value @param parent @param initialValue @return the configured text editor """ Text t = SWTFactory.createText(parent, SWT.SINGLE | SWT.BORDER, 1); t.setText(initialValue); return t; }
java
protected Text createText(Composite parent, String initialValue) { Text t = SWTFactory.createText(parent, SWT.SINGLE | SWT.BORDER, 1); t.setText(initialValue); return t; }
[ "protected", "Text", "createText", "(", "Composite", "parent", ",", "String", "initialValue", ")", "{", "Text", "t", "=", "SWTFactory", ".", "createText", "(", "parent", ",", "SWT", ".", "SINGLE", "|", "SWT", ".", "BORDER", ",", "1", ")", ";", "t", ".", "setText", "(", "initialValue", ")", ";", "return", "t", ";", "}" ]
Creates a fully configured text editor with the given initial value @param parent @param initialValue @return the configured text editor
[ "Creates", "a", "fully", "configured", "text", "editor", "with", "the", "given", "initial", "value" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmBreakpointPropertyPage.java#L476-L481
square/picasso
picasso/src/main/java/com/squareup/picasso3/RequestCreator.java
RequestCreator.get
@Nullable // TODO make non-null and always throw? public Bitmap get() throws IOException { """ Synchronously fulfill this request. Must not be called from the main thread. """ long started = System.nanoTime(); checkNotMain(); if (deferred) { throw new IllegalStateException("Fit cannot be used with get."); } if (!data.hasImage()) { return null; } Request request = createRequest(started); Action action = new GetAction(picasso, request); RequestHandler.Result result = forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt(); Bitmap bitmap = result.getBitmap(); if (bitmap != null && shouldWriteToMemoryCache(request.memoryPolicy)) { picasso.cache.set(request.key, bitmap); } return bitmap; }
java
@Nullable // TODO make non-null and always throw? public Bitmap get() throws IOException { long started = System.nanoTime(); checkNotMain(); if (deferred) { throw new IllegalStateException("Fit cannot be used with get."); } if (!data.hasImage()) { return null; } Request request = createRequest(started); Action action = new GetAction(picasso, request); RequestHandler.Result result = forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt(); Bitmap bitmap = result.getBitmap(); if (bitmap != null && shouldWriteToMemoryCache(request.memoryPolicy)) { picasso.cache.set(request.key, bitmap); } return bitmap; }
[ "@", "Nullable", "// TODO make non-null and always throw?", "public", "Bitmap", "get", "(", ")", "throws", "IOException", "{", "long", "started", "=", "System", ".", "nanoTime", "(", ")", ";", "checkNotMain", "(", ")", ";", "if", "(", "deferred", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Fit cannot be used with get.\"", ")", ";", "}", "if", "(", "!", "data", ".", "hasImage", "(", ")", ")", "{", "return", "null", ";", "}", "Request", "request", "=", "createRequest", "(", "started", ")", ";", "Action", "action", "=", "new", "GetAction", "(", "picasso", ",", "request", ")", ";", "RequestHandler", ".", "Result", "result", "=", "forRequest", "(", "picasso", ",", "picasso", ".", "dispatcher", ",", "picasso", ".", "cache", ",", "picasso", ".", "stats", ",", "action", ")", ".", "hunt", "(", ")", ";", "Bitmap", "bitmap", "=", "result", ".", "getBitmap", "(", ")", ";", "if", "(", "bitmap", "!=", "null", "&&", "shouldWriteToMemoryCache", "(", "request", ".", "memoryPolicy", ")", ")", "{", "picasso", ".", "cache", ".", "set", "(", "request", ".", "key", ",", "bitmap", ")", ";", "}", "return", "bitmap", ";", "}" ]
Synchronously fulfill this request. Must not be called from the main thread.
[ "Synchronously", "fulfill", "this", "request", ".", "Must", "not", "be", "called", "from", "the", "main", "thread", "." ]
train
https://github.com/square/picasso/blob/89f55b76e3be2b65e5997b7698f782f16f8547e3/picasso/src/main/java/com/squareup/picasso3/RequestCreator.java#L405-L427
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.deletePropertyDefinition
public void deletePropertyDefinition(CmsRequestContext context, String name) throws CmsException, CmsSecurityException, CmsRoleViolationException { """ Deletes a property definition.<p> @param context the current request context @param name the name of the property definition to delete @throws CmsException if something goes wrong @throws CmsSecurityException if the project to delete is the "Online" project @throws CmsRoleViolationException if the current user does not own the role {@link CmsRole#WORKPLACE_MANAGER} """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkRole(dbc, CmsRole.WORKPLACE_MANAGER.forOrgUnit(null)); m_driverManager.deletePropertyDefinition(dbc, name); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DELETE_PROPERTY_1, name), e); } finally { dbc.clear(); } }
java
public void deletePropertyDefinition(CmsRequestContext context, String name) throws CmsException, CmsSecurityException, CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkRole(dbc, CmsRole.WORKPLACE_MANAGER.forOrgUnit(null)); m_driverManager.deletePropertyDefinition(dbc, name); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DELETE_PROPERTY_1, name), e); } finally { dbc.clear(); } }
[ "public", "void", "deletePropertyDefinition", "(", "CmsRequestContext", "context", ",", "String", "name", ")", "throws", "CmsException", ",", "CmsSecurityException", ",", "CmsRoleViolationException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try", "{", "checkOfflineProject", "(", "dbc", ")", ";", "checkRole", "(", "dbc", ",", "CmsRole", ".", "WORKPLACE_MANAGER", ".", "forOrgUnit", "(", "null", ")", ")", ";", "m_driverManager", ".", "deletePropertyDefinition", "(", "dbc", ",", "name", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_DELETE_PROPERTY_1", ",", "name", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "}" ]
Deletes a property definition.<p> @param context the current request context @param name the name of the property definition to delete @throws CmsException if something goes wrong @throws CmsSecurityException if the project to delete is the "Online" project @throws CmsRoleViolationException if the current user does not own the role {@link CmsRole#WORKPLACE_MANAGER}
[ "Deletes", "a", "property", "definition", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1516-L1529
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/reader/JsonWriter.java
JsonWriter.remapField
@SuppressWarnings( { """ remap field name in custom classes @param fromJava field name in java @param toJson field name in json @since 2.1.1 """ "rawtypes", "unchecked" }) public <T> void remapField(Class<T> type, String fromJava, String toJson) { JsonWriterI map = this.getWrite(type); if (!(map instanceof BeansWriterASMRemap)) { map = new BeansWriterASMRemap(); registerWriter(map, type); } ((BeansWriterASMRemap) map).renameField(fromJava, toJson); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public <T> void remapField(Class<T> type, String fromJava, String toJson) { JsonWriterI map = this.getWrite(type); if (!(map instanceof BeansWriterASMRemap)) { map = new BeansWriterASMRemap(); registerWriter(map, type); } ((BeansWriterASMRemap) map).renameField(fromJava, toJson); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "<", "T", ">", "void", "remapField", "(", "Class", "<", "T", ">", "type", ",", "String", "fromJava", ",", "String", "toJson", ")", "{", "JsonWriterI", "map", "=", "this", ".", "getWrite", "(", "type", ")", ";", "if", "(", "!", "(", "map", "instanceof", "BeansWriterASMRemap", ")", ")", "{", "map", "=", "new", "BeansWriterASMRemap", "(", ")", ";", "registerWriter", "(", "map", ",", "type", ")", ";", "}", "(", "(", "BeansWriterASMRemap", ")", "map", ")", ".", "renameField", "(", "fromJava", ",", "toJson", ")", ";", "}" ]
remap field name in custom classes @param fromJava field name in java @param toJson field name in json @since 2.1.1
[ "remap", "field", "name", "in", "custom", "classes" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/reader/JsonWriter.java#L36-L44
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/bytebuffer/WsByteBufferUtils.java
WsByteBufferUtils.asInt
public static final int asInt(WsByteBuffer buff, int position, int limit) { """ Convert a buffer to an int using the starting position and ending limit. @param buff @param position @param limit @return int """ return asInt(asByteArray(buff, position, limit)); }
java
public static final int asInt(WsByteBuffer buff, int position, int limit) { return asInt(asByteArray(buff, position, limit)); }
[ "public", "static", "final", "int", "asInt", "(", "WsByteBuffer", "buff", ",", "int", "position", ",", "int", "limit", ")", "{", "return", "asInt", "(", "asByteArray", "(", "buff", ",", "position", ",", "limit", ")", ")", ";", "}" ]
Convert a buffer to an int using the starting position and ending limit. @param buff @param position @param limit @return int
[ "Convert", "a", "buffer", "to", "an", "int", "using", "the", "starting", "position", "and", "ending", "limit", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/bytebuffer/WsByteBufferUtils.java#L234-L236
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/reflect/GenericTypeUtils.java
GenericTypeUtils.resolveInterfaceTypeArgument
public static Optional<Class> resolveInterfaceTypeArgument(Class type, Class interfaceType) { """ Resolves a single type argument from the given interface of the given class. Also searches superclasses. @param type The type to resolve from @param interfaceType The interface to resolve for @return The class or null """ Type[] genericInterfaces = type.getGenericInterfaces(); for (Type genericInterface : genericInterfaces) { if (genericInterface instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) genericInterface; if (pt.getRawType() == interfaceType) { return resolveSingleTypeArgument(genericInterface); } } } Class superClass = type.getSuperclass(); if (superClass != null && superClass != Object.class) { return resolveInterfaceTypeArgument(superClass, interfaceType); } return Optional.empty(); }
java
public static Optional<Class> resolveInterfaceTypeArgument(Class type, Class interfaceType) { Type[] genericInterfaces = type.getGenericInterfaces(); for (Type genericInterface : genericInterfaces) { if (genericInterface instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) genericInterface; if (pt.getRawType() == interfaceType) { return resolveSingleTypeArgument(genericInterface); } } } Class superClass = type.getSuperclass(); if (superClass != null && superClass != Object.class) { return resolveInterfaceTypeArgument(superClass, interfaceType); } return Optional.empty(); }
[ "public", "static", "Optional", "<", "Class", ">", "resolveInterfaceTypeArgument", "(", "Class", "type", ",", "Class", "interfaceType", ")", "{", "Type", "[", "]", "genericInterfaces", "=", "type", ".", "getGenericInterfaces", "(", ")", ";", "for", "(", "Type", "genericInterface", ":", "genericInterfaces", ")", "{", "if", "(", "genericInterface", "instanceof", "ParameterizedType", ")", "{", "ParameterizedType", "pt", "=", "(", "ParameterizedType", ")", "genericInterface", ";", "if", "(", "pt", ".", "getRawType", "(", ")", "==", "interfaceType", ")", "{", "return", "resolveSingleTypeArgument", "(", "genericInterface", ")", ";", "}", "}", "}", "Class", "superClass", "=", "type", ".", "getSuperclass", "(", ")", ";", "if", "(", "superClass", "!=", "null", "&&", "superClass", "!=", "Object", ".", "class", ")", "{", "return", "resolveInterfaceTypeArgument", "(", "superClass", ",", "interfaceType", ")", ";", "}", "return", "Optional", ".", "empty", "(", ")", ";", "}" ]
Resolves a single type argument from the given interface of the given class. Also searches superclasses. @param type The type to resolve from @param interfaceType The interface to resolve for @return The class or null
[ "Resolves", "a", "single", "type", "argument", "from", "the", "given", "interface", "of", "the", "given", "class", ".", "Also", "searches", "superclasses", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/reflect/GenericTypeUtils.java#L147-L162
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java
MCMPHandler.processNodeCommand
void processNodeCommand(final HttpServerExchange exchange, final RequestData requestData, final MCMPAction action) throws IOException { """ Process a mgmt command targeting a node. @param exchange the http server exchange @param requestData the request data @param action the mgmt action @throws IOException """ final String jvmRoute = requestData.getFirst(JVMROUTE); if (jvmRoute == null) { processError(TYPESYNTAX, SMISFLD, exchange); return; } if (processNodeCommand(jvmRoute, action)) { processOK(exchange); } else { processError(MCMPErrorCode.CANT_UPDATE_NODE, exchange); } }
java
void processNodeCommand(final HttpServerExchange exchange, final RequestData requestData, final MCMPAction action) throws IOException { final String jvmRoute = requestData.getFirst(JVMROUTE); if (jvmRoute == null) { processError(TYPESYNTAX, SMISFLD, exchange); return; } if (processNodeCommand(jvmRoute, action)) { processOK(exchange); } else { processError(MCMPErrorCode.CANT_UPDATE_NODE, exchange); } }
[ "void", "processNodeCommand", "(", "final", "HttpServerExchange", "exchange", ",", "final", "RequestData", "requestData", ",", "final", "MCMPAction", "action", ")", "throws", "IOException", "{", "final", "String", "jvmRoute", "=", "requestData", ".", "getFirst", "(", "JVMROUTE", ")", ";", "if", "(", "jvmRoute", "==", "null", ")", "{", "processError", "(", "TYPESYNTAX", ",", "SMISFLD", ",", "exchange", ")", ";", "return", ";", "}", "if", "(", "processNodeCommand", "(", "jvmRoute", ",", "action", ")", ")", "{", "processOK", "(", "exchange", ")", ";", "}", "else", "{", "processError", "(", "MCMPErrorCode", ".", "CANT_UPDATE_NODE", ",", "exchange", ")", ";", "}", "}" ]
Process a mgmt command targeting a node. @param exchange the http server exchange @param requestData the request data @param action the mgmt action @throws IOException
[ "Process", "a", "mgmt", "command", "targeting", "a", "node", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java#L341-L352
twilio/twilio-java
src/main/java/com/twilio/rest/proxy/v1/service/session/participant/MessageInteractionReader.java
MessageInteractionReader.nextPage
@Override public Page<MessageInteraction> nextPage(final Page<MessageInteraction> page, final TwilioRestClient client) { """ Retrieve the next page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Next Page """ Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.PROXY.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<MessageInteraction> nextPage(final Page<MessageInteraction> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.PROXY.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "MessageInteraction", ">", "nextPage", "(", "final", "Page", "<", "MessageInteraction", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", "page", ".", "getNextPageUrl", "(", "Domains", ".", "PROXY", ".", "toString", "(", ")", ",", "client", ".", "getRegion", "(", ")", ")", ")", ";", "return", "pageForRequest", "(", "client", ",", "request", ")", ";", "}" ]
Retrieve the next page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Next Page
[ "Retrieve", "the", "next", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/proxy/v1/service/session/participant/MessageInteractionReader.java#L102-L113
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_service_serviceName_directory_getWayTypes_GET
public ArrayList<OvhDirectoryWayType> billingAccount_service_serviceName_directory_getWayTypes_GET(String billingAccount, String serviceName) throws IOException { """ Get all the way types availables REST: GET /telephony/{billingAccount}/service/{serviceName}/directory/getWayTypes @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/service/{serviceName}/directory/getWayTypes"; StringBuilder sb = path(qPath, billingAccount, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t14); }
java
public ArrayList<OvhDirectoryWayType> billingAccount_service_serviceName_directory_getWayTypes_GET(String billingAccount, String serviceName) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/directory/getWayTypes"; StringBuilder sb = path(qPath, billingAccount, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t14); }
[ "public", "ArrayList", "<", "OvhDirectoryWayType", ">", "billingAccount_service_serviceName_directory_getWayTypes_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/service/{serviceName}/directory/getWayTypes\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t14", ")", ";", "}" ]
Get all the way types availables REST: GET /telephony/{billingAccount}/service/{serviceName}/directory/getWayTypes @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Get", "all", "the", "way", "types", "availables" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4022-L4027
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java
HttpConversionUtil.toFullHttpResponse
public static FullHttpResponse toFullHttpResponse(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc, boolean validateHttpHeaders) throws Http2Exception { """ Create a new object to contain the response data @param streamId The stream associated with the response @param http2Headers The initial set of HTTP/2 headers to create the response with @param alloc The {@link ByteBufAllocator} to use to generate the content of the message @param validateHttpHeaders <ul> <li>{@code true} to validate HTTP headers in the http-codec</li> <li>{@code false} not to validate HTTP headers in the http-codec</li> </ul> @return A new response object which represents headers/data @throws Http2Exception see {@link #addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)} """ HttpResponseStatus status = parseStatus(http2Headers.status()); // HTTP/2 does not define a way to carry the version or reason phrase that is included in an // HTTP/1.1 status line. FullHttpResponse msg = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status, alloc.buffer(), validateHttpHeaders); try { addHttp2ToHttpHeaders(streamId, http2Headers, msg, false); } catch (Http2Exception e) { msg.release(); throw e; } catch (Throwable t) { msg.release(); throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error"); } return msg; }
java
public static FullHttpResponse toFullHttpResponse(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc, boolean validateHttpHeaders) throws Http2Exception { HttpResponseStatus status = parseStatus(http2Headers.status()); // HTTP/2 does not define a way to carry the version or reason phrase that is included in an // HTTP/1.1 status line. FullHttpResponse msg = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status, alloc.buffer(), validateHttpHeaders); try { addHttp2ToHttpHeaders(streamId, http2Headers, msg, false); } catch (Http2Exception e) { msg.release(); throw e; } catch (Throwable t) { msg.release(); throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error"); } return msg; }
[ "public", "static", "FullHttpResponse", "toFullHttpResponse", "(", "int", "streamId", ",", "Http2Headers", "http2Headers", ",", "ByteBufAllocator", "alloc", ",", "boolean", "validateHttpHeaders", ")", "throws", "Http2Exception", "{", "HttpResponseStatus", "status", "=", "parseStatus", "(", "http2Headers", ".", "status", "(", ")", ")", ";", "// HTTP/2 does not define a way to carry the version or reason phrase that is included in an", "// HTTP/1.1 status line.", "FullHttpResponse", "msg", "=", "new", "DefaultFullHttpResponse", "(", "HttpVersion", ".", "HTTP_1_1", ",", "status", ",", "alloc", ".", "buffer", "(", ")", ",", "validateHttpHeaders", ")", ";", "try", "{", "addHttp2ToHttpHeaders", "(", "streamId", ",", "http2Headers", ",", "msg", ",", "false", ")", ";", "}", "catch", "(", "Http2Exception", "e", ")", "{", "msg", ".", "release", "(", ")", ";", "throw", "e", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "msg", ".", "release", "(", ")", ";", "throw", "streamError", "(", "streamId", ",", "PROTOCOL_ERROR", ",", "t", ",", "\"HTTP/2 to HTTP/1.x headers conversion error\"", ")", ";", "}", "return", "msg", ";", "}" ]
Create a new object to contain the response data @param streamId The stream associated with the response @param http2Headers The initial set of HTTP/2 headers to create the response with @param alloc The {@link ByteBufAllocator} to use to generate the content of the message @param validateHttpHeaders <ul> <li>{@code true} to validate HTTP headers in the http-codec</li> <li>{@code false} not to validate HTTP headers in the http-codec</li> </ul> @return A new response object which represents headers/data @throws Http2Exception see {@link #addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)}
[ "Create", "a", "new", "object", "to", "contain", "the", "response", "data" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L213-L231
Teddy-Zhu/SilentGo
utils/src/main/java/com/silentgo/utils/asm/Type.java
Type.getClassName
public String getClassName() { """ Returns the binary name of the class corresponding to this type. This method must not be used on method types. @return the binary name of the class corresponding to this type. """ switch (sort) { case VOID: return "void"; case BOOLEAN: return "boolean"; case CHAR: return "char"; case BYTE: return "byte"; case SHORT: return "short"; case INT: return "int"; case FLOAT: return "float"; case LONG: return "long"; case DOUBLE: return "double"; case ARRAY: StringBuilder sb = new StringBuilder(getElementType().getClassName()); for (int i = getDimensions(); i > 0; --i) { sb.append("[]"); } return sb.toString(); case OBJECT: return new String(buf, off, len).replace('/', '.').intern(); default: return null; } }
java
public String getClassName() { switch (sort) { case VOID: return "void"; case BOOLEAN: return "boolean"; case CHAR: return "char"; case BYTE: return "byte"; case SHORT: return "short"; case INT: return "int"; case FLOAT: return "float"; case LONG: return "long"; case DOUBLE: return "double"; case ARRAY: StringBuilder sb = new StringBuilder(getElementType().getClassName()); for (int i = getDimensions(); i > 0; --i) { sb.append("[]"); } return sb.toString(); case OBJECT: return new String(buf, off, len).replace('/', '.').intern(); default: return null; } }
[ "public", "String", "getClassName", "(", ")", "{", "switch", "(", "sort", ")", "{", "case", "VOID", ":", "return", "\"void\"", ";", "case", "BOOLEAN", ":", "return", "\"boolean\"", ";", "case", "CHAR", ":", "return", "\"char\"", ";", "case", "BYTE", ":", "return", "\"byte\"", ";", "case", "SHORT", ":", "return", "\"short\"", ";", "case", "INT", ":", "return", "\"int\"", ";", "case", "FLOAT", ":", "return", "\"float\"", ";", "case", "LONG", ":", "return", "\"long\"", ";", "case", "DOUBLE", ":", "return", "\"double\"", ";", "case", "ARRAY", ":", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "getElementType", "(", ")", ".", "getClassName", "(", ")", ")", ";", "for", "(", "int", "i", "=", "getDimensions", "(", ")", ";", "i", ">", "0", ";", "--", "i", ")", "{", "sb", ".", "append", "(", "\"[]\"", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "case", "OBJECT", ":", "return", "new", "String", "(", "buf", ",", "off", ",", "len", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "intern", "(", ")", ";", "default", ":", "return", "null", ";", "}", "}" ]
Returns the binary name of the class corresponding to this type. This method must not be used on method types. @return the binary name of the class corresponding to this type.
[ "Returns", "the", "binary", "name", "of", "the", "class", "corresponding", "to", "this", "type", ".", "This", "method", "must", "not", "be", "used", "on", "method", "types", "." ]
train
https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/asm/Type.java#L547-L578
cdk/cdk
legacy/src/main/java/org/openscience/cdk/isomorphism/matchers/CTFileQueryBond.java
CTFileQueryBond.ofType
public static CTFileQueryBond ofType(IBond bond, int type) { """ Create a CTFileQueryBond of the specified type (from the MDL spec). The bond copies the atoms and sets the type using the value 'type', 5 = single or double, 8 = any, etc. @param bond an existing bond @param type the specified type @return a new CTFileQueryBond """ CTFileQueryBond queryBond = new CTFileQueryBond(bond.getBuilder()); queryBond.setOrder(Order.UNSET); queryBond.setAtoms(new IAtom[]{bond.getBegin(), bond.getEnd()}); switch (type) { case 1: queryBond.setType(Type.SINGLE); break; case 2: queryBond.setType(Type.DOUBLE); break; case 3: queryBond.setType(Type.TRIPLE); break; case 4: queryBond.setType(Type.AROMATIC); break; case 5: queryBond.setType(Type.SINGLE_OR_DOUBLE); break; case 6: queryBond.setType(Type.SINGLE_OR_AROMATIC); break; case 7: queryBond.setType(Type.DOUBLE_OR_AROMATIC); break; case 8: queryBond.setType(Type.ANY); break; default: throw new IllegalArgumentException("Unknown bond type: " + type); } return queryBond; }
java
public static CTFileQueryBond ofType(IBond bond, int type) { CTFileQueryBond queryBond = new CTFileQueryBond(bond.getBuilder()); queryBond.setOrder(Order.UNSET); queryBond.setAtoms(new IAtom[]{bond.getBegin(), bond.getEnd()}); switch (type) { case 1: queryBond.setType(Type.SINGLE); break; case 2: queryBond.setType(Type.DOUBLE); break; case 3: queryBond.setType(Type.TRIPLE); break; case 4: queryBond.setType(Type.AROMATIC); break; case 5: queryBond.setType(Type.SINGLE_OR_DOUBLE); break; case 6: queryBond.setType(Type.SINGLE_OR_AROMATIC); break; case 7: queryBond.setType(Type.DOUBLE_OR_AROMATIC); break; case 8: queryBond.setType(Type.ANY); break; default: throw new IllegalArgumentException("Unknown bond type: " + type); } return queryBond; }
[ "public", "static", "CTFileQueryBond", "ofType", "(", "IBond", "bond", ",", "int", "type", ")", "{", "CTFileQueryBond", "queryBond", "=", "new", "CTFileQueryBond", "(", "bond", ".", "getBuilder", "(", ")", ")", ";", "queryBond", ".", "setOrder", "(", "Order", ".", "UNSET", ")", ";", "queryBond", ".", "setAtoms", "(", "new", "IAtom", "[", "]", "{", "bond", ".", "getBegin", "(", ")", ",", "bond", ".", "getEnd", "(", ")", "}", ")", ";", "switch", "(", "type", ")", "{", "case", "1", ":", "queryBond", ".", "setType", "(", "Type", ".", "SINGLE", ")", ";", "break", ";", "case", "2", ":", "queryBond", ".", "setType", "(", "Type", ".", "DOUBLE", ")", ";", "break", ";", "case", "3", ":", "queryBond", ".", "setType", "(", "Type", ".", "TRIPLE", ")", ";", "break", ";", "case", "4", ":", "queryBond", ".", "setType", "(", "Type", ".", "AROMATIC", ")", ";", "break", ";", "case", "5", ":", "queryBond", ".", "setType", "(", "Type", ".", "SINGLE_OR_DOUBLE", ")", ";", "break", ";", "case", "6", ":", "queryBond", ".", "setType", "(", "Type", ".", "SINGLE_OR_AROMATIC", ")", ";", "break", ";", "case", "7", ":", "queryBond", ".", "setType", "(", "Type", ".", "DOUBLE_OR_AROMATIC", ")", ";", "break", ";", "case", "8", ":", "queryBond", ".", "setType", "(", "Type", ".", "ANY", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unknown bond type: \"", "+", "type", ")", ";", "}", "return", "queryBond", ";", "}" ]
Create a CTFileQueryBond of the specified type (from the MDL spec). The bond copies the atoms and sets the type using the value 'type', 5 = single or double, 8 = any, etc. @param bond an existing bond @param type the specified type @return a new CTFileQueryBond
[ "Create", "a", "CTFileQueryBond", "of", "the", "specified", "type", "(", "from", "the", "MDL", "spec", ")", ".", "The", "bond", "copies", "the", "atoms", "and", "sets", "the", "type", "using", "the", "value", "type", "5", "=", "single", "or", "double", "8", "=", "any", "etc", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/isomorphism/matchers/CTFileQueryBond.java#L88-L121
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java
SDNN.layerNorm
public SDVariable layerNorm(String name, SDVariable input, SDVariable gain, SDVariable bias, int... dimensions) { """ Apply Layer Normalization y = gain * standardize(x) + bias @param name Name of the output variable @param input Input variable @param gain gain @param bias bias @return Output variable """ validateFloatingPoint("layerNorm", "input", input); validateFloatingPoint("layerNorm", "gain", gain); validateFloatingPoint("layerNorm", "bias", bias); SDVariable result = f().layerNorm(input, gain, bias, dimensions); return updateVariableNameAndReference(result, name); }
java
public SDVariable layerNorm(String name, SDVariable input, SDVariable gain, SDVariable bias, int... dimensions) { validateFloatingPoint("layerNorm", "input", input); validateFloatingPoint("layerNorm", "gain", gain); validateFloatingPoint("layerNorm", "bias", bias); SDVariable result = f().layerNorm(input, gain, bias, dimensions); return updateVariableNameAndReference(result, name); }
[ "public", "SDVariable", "layerNorm", "(", "String", "name", ",", "SDVariable", "input", ",", "SDVariable", "gain", ",", "SDVariable", "bias", ",", "int", "...", "dimensions", ")", "{", "validateFloatingPoint", "(", "\"layerNorm\"", ",", "\"input\"", ",", "input", ")", ";", "validateFloatingPoint", "(", "\"layerNorm\"", ",", "\"gain\"", ",", "gain", ")", ";", "validateFloatingPoint", "(", "\"layerNorm\"", ",", "\"bias\"", ",", "bias", ")", ";", "SDVariable", "result", "=", "f", "(", ")", ".", "layerNorm", "(", "input", ",", "gain", ",", "bias", ",", "dimensions", ")", ";", "return", "updateVariableNameAndReference", "(", "result", ",", "name", ")", ";", "}" ]
Apply Layer Normalization y = gain * standardize(x) + bias @param name Name of the output variable @param input Input variable @param gain gain @param bias bias @return Output variable
[ "Apply", "Layer", "Normalization" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L716-L722
rubenlagus/TelegramBots
telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/DefaultBotCommand.java
DefaultBotCommand.execute
@Override public final void execute(AbsSender absSender, User user, Chat chat, String[] arguments) { """ We'll override this method here for not repeating it in DefaultBotCommand's children """ }
java
@Override public final void execute(AbsSender absSender, User user, Chat chat, String[] arguments) { }
[ "@", "Override", "public", "final", "void", "execute", "(", "AbsSender", "absSender", ",", "User", "user", ",", "Chat", "chat", ",", "String", "[", "]", "arguments", ")", "{", "}" ]
We'll override this method here for not repeating it in DefaultBotCommand's children
[ "We", "ll", "override", "this", "method", "here", "for", "not", "repeating", "it", "in", "DefaultBotCommand", "s", "children" ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/DefaultBotCommand.java#L39-L41
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/factory/sfm/FactoryVisualOdometry.java
FactoryVisualOdometry.stereoQuadPnP
public static <T extends ImageGray<T>,Desc extends TupleDesc> StereoVisualOdometry<T> stereoQuadPnP( double inlierPixelTol , double epipolarPixelTol , double maxDistanceF2F, double maxAssociationError, int ransacIterations , int refineIterations , DetectDescribeMulti<T,Desc> detector, Class<T> imageType ) { """ Stereo visual odometry which uses the two most recent stereo observations (total of four views) to estimate motion. @see VisOdomQuadPnP @param inlierPixelTol Pixel tolerance for RANSAC inliers - Euclidean distance @param epipolarPixelTol Feature association tolerance in pixels. @param maxDistanceF2F Maximum allowed distance between two features in pixels @param maxAssociationError Maxium error between two features when associating. @param ransacIterations Number of iterations RANSAC will perform @param refineIterations Number of refinement iterations @param detector Which feature detector to use @param imageType Type of input image """ EstimateNofPnP pnp = FactoryMultiView.pnp_N(EnumPNP.P3P_FINSTERWALDER, -1); DistanceFromModelMultiView<Se3_F64,Point2D3D> distanceMono = new PnPDistanceReprojectionSq(); PnPStereoDistanceReprojectionSq distanceStereo = new PnPStereoDistanceReprojectionSq(); PnPStereoEstimator pnpStereo = new PnPStereoEstimator(pnp,distanceMono,0); ModelManagerSe3_F64 manager = new ModelManagerSe3_F64(); EstimatorToGenerator<Se3_F64,Stereo2D3D> generator = new EstimatorToGenerator<>(pnpStereo); // euclidean error squared from left + right images double ransacTOL = 2*inlierPixelTol * inlierPixelTol; ModelMatcher<Se3_F64, Stereo2D3D> motion = new Ransac<>(2323, manager, generator, distanceStereo, ransacIterations, ransacTOL); RefinePnPStereo refinePnP = null; if( refineIterations > 0 ) { refinePnP = new PnPStereoRefineRodrigues(1e-12,refineIterations); } Class<Desc> descType = detector.getDescriptionType(); ScoreAssociation<Desc> scorer = FactoryAssociation.defaultScore(descType); // TODO need a better way to keep track of what error is squared and not AssociateDescription2D<Desc> assocSame; if( maxDistanceF2F > 0 ) { AssociateMaxDistanceNaive<Desc> a = new AssociateMaxDistanceNaive<>(scorer, true, maxAssociationError); a.setSquaredDistance(true); a.setMaxDistance(maxDistanceF2F); assocSame = a; } else { assocSame = new AssociateDescTo2D<>(FactoryAssociation.greedy(scorer, maxAssociationError, true)); } AssociateStereo2D<Desc> associateStereo = new AssociateStereo2D<>(scorer, epipolarPixelTol, descType); Triangulate2ViewsMetric triangulate = FactoryMultiView.triangulate2ViewMetric( new ConfigTriangulation(ConfigTriangulation.Type.GEOMETRIC)); associateStereo.setMaxScoreThreshold(maxAssociationError); VisOdomQuadPnP<T,Desc> alg = new VisOdomQuadPnP<>( detector, assocSame, associateStereo, triangulate, motion, refinePnP); return new WrapVisOdomQuadPnP<>(alg, refinePnP, associateStereo, distanceStereo, distanceMono, imageType); }
java
public static <T extends ImageGray<T>,Desc extends TupleDesc> StereoVisualOdometry<T> stereoQuadPnP( double inlierPixelTol , double epipolarPixelTol , double maxDistanceF2F, double maxAssociationError, int ransacIterations , int refineIterations , DetectDescribeMulti<T,Desc> detector, Class<T> imageType ) { EstimateNofPnP pnp = FactoryMultiView.pnp_N(EnumPNP.P3P_FINSTERWALDER, -1); DistanceFromModelMultiView<Se3_F64,Point2D3D> distanceMono = new PnPDistanceReprojectionSq(); PnPStereoDistanceReprojectionSq distanceStereo = new PnPStereoDistanceReprojectionSq(); PnPStereoEstimator pnpStereo = new PnPStereoEstimator(pnp,distanceMono,0); ModelManagerSe3_F64 manager = new ModelManagerSe3_F64(); EstimatorToGenerator<Se3_F64,Stereo2D3D> generator = new EstimatorToGenerator<>(pnpStereo); // euclidean error squared from left + right images double ransacTOL = 2*inlierPixelTol * inlierPixelTol; ModelMatcher<Se3_F64, Stereo2D3D> motion = new Ransac<>(2323, manager, generator, distanceStereo, ransacIterations, ransacTOL); RefinePnPStereo refinePnP = null; if( refineIterations > 0 ) { refinePnP = new PnPStereoRefineRodrigues(1e-12,refineIterations); } Class<Desc> descType = detector.getDescriptionType(); ScoreAssociation<Desc> scorer = FactoryAssociation.defaultScore(descType); // TODO need a better way to keep track of what error is squared and not AssociateDescription2D<Desc> assocSame; if( maxDistanceF2F > 0 ) { AssociateMaxDistanceNaive<Desc> a = new AssociateMaxDistanceNaive<>(scorer, true, maxAssociationError); a.setSquaredDistance(true); a.setMaxDistance(maxDistanceF2F); assocSame = a; } else { assocSame = new AssociateDescTo2D<>(FactoryAssociation.greedy(scorer, maxAssociationError, true)); } AssociateStereo2D<Desc> associateStereo = new AssociateStereo2D<>(scorer, epipolarPixelTol, descType); Triangulate2ViewsMetric triangulate = FactoryMultiView.triangulate2ViewMetric( new ConfigTriangulation(ConfigTriangulation.Type.GEOMETRIC)); associateStereo.setMaxScoreThreshold(maxAssociationError); VisOdomQuadPnP<T,Desc> alg = new VisOdomQuadPnP<>( detector, assocSame, associateStereo, triangulate, motion, refinePnP); return new WrapVisOdomQuadPnP<>(alg, refinePnP, associateStereo, distanceStereo, distanceMono, imageType); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ",", "Desc", "extends", "TupleDesc", ">", "StereoVisualOdometry", "<", "T", ">", "stereoQuadPnP", "(", "double", "inlierPixelTol", ",", "double", "epipolarPixelTol", ",", "double", "maxDistanceF2F", ",", "double", "maxAssociationError", ",", "int", "ransacIterations", ",", "int", "refineIterations", ",", "DetectDescribeMulti", "<", "T", ",", "Desc", ">", "detector", ",", "Class", "<", "T", ">", "imageType", ")", "{", "EstimateNofPnP", "pnp", "=", "FactoryMultiView", ".", "pnp_N", "(", "EnumPNP", ".", "P3P_FINSTERWALDER", ",", "-", "1", ")", ";", "DistanceFromModelMultiView", "<", "Se3_F64", ",", "Point2D3D", ">", "distanceMono", "=", "new", "PnPDistanceReprojectionSq", "(", ")", ";", "PnPStereoDistanceReprojectionSq", "distanceStereo", "=", "new", "PnPStereoDistanceReprojectionSq", "(", ")", ";", "PnPStereoEstimator", "pnpStereo", "=", "new", "PnPStereoEstimator", "(", "pnp", ",", "distanceMono", ",", "0", ")", ";", "ModelManagerSe3_F64", "manager", "=", "new", "ModelManagerSe3_F64", "(", ")", ";", "EstimatorToGenerator", "<", "Se3_F64", ",", "Stereo2D3D", ">", "generator", "=", "new", "EstimatorToGenerator", "<>", "(", "pnpStereo", ")", ";", "// euclidean error squared from left + right images", "double", "ransacTOL", "=", "2", "*", "inlierPixelTol", "*", "inlierPixelTol", ";", "ModelMatcher", "<", "Se3_F64", ",", "Stereo2D3D", ">", "motion", "=", "new", "Ransac", "<>", "(", "2323", ",", "manager", ",", "generator", ",", "distanceStereo", ",", "ransacIterations", ",", "ransacTOL", ")", ";", "RefinePnPStereo", "refinePnP", "=", "null", ";", "if", "(", "refineIterations", ">", "0", ")", "{", "refinePnP", "=", "new", "PnPStereoRefineRodrigues", "(", "1e-12", ",", "refineIterations", ")", ";", "}", "Class", "<", "Desc", ">", "descType", "=", "detector", ".", "getDescriptionType", "(", ")", ";", "ScoreAssociation", "<", "Desc", ">", "scorer", "=", "FactoryAssociation", ".", "defaultScore", "(", "descType", ")", ";", "// TODO need a better way to keep track of what error is squared and not", "AssociateDescription2D", "<", "Desc", ">", "assocSame", ";", "if", "(", "maxDistanceF2F", ">", "0", ")", "{", "AssociateMaxDistanceNaive", "<", "Desc", ">", "a", "=", "new", "AssociateMaxDistanceNaive", "<>", "(", "scorer", ",", "true", ",", "maxAssociationError", ")", ";", "a", ".", "setSquaredDistance", "(", "true", ")", ";", "a", ".", "setMaxDistance", "(", "maxDistanceF2F", ")", ";", "assocSame", "=", "a", ";", "}", "else", "{", "assocSame", "=", "new", "AssociateDescTo2D", "<>", "(", "FactoryAssociation", ".", "greedy", "(", "scorer", ",", "maxAssociationError", ",", "true", ")", ")", ";", "}", "AssociateStereo2D", "<", "Desc", ">", "associateStereo", "=", "new", "AssociateStereo2D", "<>", "(", "scorer", ",", "epipolarPixelTol", ",", "descType", ")", ";", "Triangulate2ViewsMetric", "triangulate", "=", "FactoryMultiView", ".", "triangulate2ViewMetric", "(", "new", "ConfigTriangulation", "(", "ConfigTriangulation", ".", "Type", ".", "GEOMETRIC", ")", ")", ";", "associateStereo", ".", "setMaxScoreThreshold", "(", "maxAssociationError", ")", ";", "VisOdomQuadPnP", "<", "T", ",", "Desc", ">", "alg", "=", "new", "VisOdomQuadPnP", "<>", "(", "detector", ",", "assocSame", ",", "associateStereo", ",", "triangulate", ",", "motion", ",", "refinePnP", ")", ";", "return", "new", "WrapVisOdomQuadPnP", "<>", "(", "alg", ",", "refinePnP", ",", "associateStereo", ",", "distanceStereo", ",", "distanceMono", ",", "imageType", ")", ";", "}" ]
Stereo visual odometry which uses the two most recent stereo observations (total of four views) to estimate motion. @see VisOdomQuadPnP @param inlierPixelTol Pixel tolerance for RANSAC inliers - Euclidean distance @param epipolarPixelTol Feature association tolerance in pixels. @param maxDistanceF2F Maximum allowed distance between two features in pixels @param maxAssociationError Maxium error between two features when associating. @param ransacIterations Number of iterations RANSAC will perform @param refineIterations Number of refinement iterations @param detector Which feature detector to use @param imageType Type of input image
[ "Stereo", "visual", "odometry", "which", "uses", "the", "two", "most", "recent", "stereo", "observations", "(", "total", "of", "four", "views", ")", "to", "estimate", "motion", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/factory/sfm/FactoryVisualOdometry.java#L357-L411
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.buttonBarStartTab
public String buttonBarStartTab(int leftPixel, int rightPixel) { """ Generates a button bar starter tab.<p> @param leftPixel the amount of pixel left to the starter @param rightPixel the amount of pixel right to the starter @return a button bar starter tab """ StringBuffer result = new StringBuffer(512); result.append(buttonBarLineSpacer(leftPixel)); result.append("<td><span class=\"starttab\"><span style=\"width:1px; height:1px\"></span></span></td>\n"); result.append(buttonBarLineSpacer(rightPixel)); return result.toString(); }
java
public String buttonBarStartTab(int leftPixel, int rightPixel) { StringBuffer result = new StringBuffer(512); result.append(buttonBarLineSpacer(leftPixel)); result.append("<td><span class=\"starttab\"><span style=\"width:1px; height:1px\"></span></span></td>\n"); result.append(buttonBarLineSpacer(rightPixel)); return result.toString(); }
[ "public", "String", "buttonBarStartTab", "(", "int", "leftPixel", ",", "int", "rightPixel", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "512", ")", ";", "result", ".", "append", "(", "buttonBarLineSpacer", "(", "leftPixel", ")", ")", ";", "result", ".", "append", "(", "\"<td><span class=\\\"starttab\\\"><span style=\\\"width:1px; height:1px\\\"></span></span></td>\\n\"", ")", ";", "result", ".", "append", "(", "buttonBarLineSpacer", "(", "rightPixel", ")", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Generates a button bar starter tab.<p> @param leftPixel the amount of pixel left to the starter @param rightPixel the amount of pixel right to the starter @return a button bar starter tab
[ "Generates", "a", "button", "bar", "starter", "tab", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L1418-L1425
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getWritableChannel
public WritableGridFileChannel getWritableChannel(String pathname, boolean append) throws IOException { """ Opens a WritableGridFileChannel for writing to the file denoted by pathname. The channel can either overwrite the existing file or append to it. @param pathname the path to write to @param append if true, the bytes written to the WritableGridFileChannel will be appended to the end of the file. If false, the bytes will overwrite the original contents. @return a WritableGridFileChannel for writing to the file at pathname @throws IOException if an error occurs """ return getWritableChannel(pathname, append, defaultChunkSize); }
java
public WritableGridFileChannel getWritableChannel(String pathname, boolean append) throws IOException { return getWritableChannel(pathname, append, defaultChunkSize); }
[ "public", "WritableGridFileChannel", "getWritableChannel", "(", "String", "pathname", ",", "boolean", "append", ")", "throws", "IOException", "{", "return", "getWritableChannel", "(", "pathname", ",", "append", ",", "defaultChunkSize", ")", ";", "}" ]
Opens a WritableGridFileChannel for writing to the file denoted by pathname. The channel can either overwrite the existing file or append to it. @param pathname the path to write to @param append if true, the bytes written to the WritableGridFileChannel will be appended to the end of the file. If false, the bytes will overwrite the original contents. @return a WritableGridFileChannel for writing to the file at pathname @throws IOException if an error occurs
[ "Opens", "a", "WritableGridFileChannel", "for", "writing", "to", "the", "file", "denoted", "by", "pathname", ".", "The", "channel", "can", "either", "overwrite", "the", "existing", "file", "or", "append", "to", "it", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L215-L217
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/cache/CacheArgumentServices.java
CacheArgumentServices.processArg
String processArg(String[] path, String jsonArg) { """ Extract considerate value from json arg for compute cache key and function of key<br> Example : if key = "a.i" and jsonarg = {\"i\":5} then return 5 @param path @param jsonArg @return """ String keyArg = jsonArg; if (path.length > 0) { try { keyArg = processSubFieldsOfArg(path, jsonArg); } catch (Throwable ex) { logger.warn("Fail to access to field for '{}'", jsonArg, ex); } } return keyArg; }
java
String processArg(String[] path, String jsonArg) { String keyArg = jsonArg; if (path.length > 0) { try { keyArg = processSubFieldsOfArg(path, jsonArg); } catch (Throwable ex) { logger.warn("Fail to access to field for '{}'", jsonArg, ex); } } return keyArg; }
[ "String", "processArg", "(", "String", "[", "]", "path", ",", "String", "jsonArg", ")", "{", "String", "keyArg", "=", "jsonArg", ";", "if", "(", "path", ".", "length", ">", "0", ")", "{", "try", "{", "keyArg", "=", "processSubFieldsOfArg", "(", "path", ",", "jsonArg", ")", ";", "}", "catch", "(", "Throwable", "ex", ")", "{", "logger", ".", "warn", "(", "\"Fail to access to field for '{}'\"", ",", "jsonArg", ",", "ex", ")", ";", "}", "}", "return", "keyArg", ";", "}" ]
Extract considerate value from json arg for compute cache key and function of key<br> Example : if key = "a.i" and jsonarg = {\"i\":5} then return 5 @param path @param jsonArg @return
[ "Extract", "considerate", "value", "from", "json", "arg", "for", "compute", "cache", "key", "and", "function", "of", "key<br", ">", "Example", ":", "if", "key", "=", "a", ".", "i", "and", "jsonarg", "=", "{", "\\", "i", "\\", ":", "5", "}", "then", "return", "5" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/cache/CacheArgumentServices.java#L85-L95
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/IoTDiscoveryManager.java
IoTDiscoveryManager.claimThing
public IoTClaimed claimThing(Jid registry, Collection<Tag> metaTags, boolean publicThing) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Claim a thing by providing a collection of meta tags. If the claim was successful, then a {@link IoTClaimed} instance will be returned, which contains the XMPP address of the thing. Use {@link IoTClaimed#getJid()} to retrieve this address. @param registry the registry use to claim the thing. @param metaTags a collection of meta tags used to identify the thing. @param publicThing if this is a public thing. @return a {@link IoTClaimed} if successful. @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException """ interactWithRegistry(registry); IoTMine iotMine = new IoTMine(metaTags, publicThing); iotMine.setTo(registry); IoTClaimed iotClaimed = connection().createStanzaCollectorAndSend(iotMine).nextResultOrThrow(); // The 'jid' attribute of the <claimed/> response now represents the XMPP address of the thing we just successfully claimed. Jid thing = iotClaimed.getJid(); IoTProvisioningManager.getInstanceFor(connection()).sendFriendshipRequest(thing.asBareJid()); return iotClaimed; }
java
public IoTClaimed claimThing(Jid registry, Collection<Tag> metaTags, boolean publicThing) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { interactWithRegistry(registry); IoTMine iotMine = new IoTMine(metaTags, publicThing); iotMine.setTo(registry); IoTClaimed iotClaimed = connection().createStanzaCollectorAndSend(iotMine).nextResultOrThrow(); // The 'jid' attribute of the <claimed/> response now represents the XMPP address of the thing we just successfully claimed. Jid thing = iotClaimed.getJid(); IoTProvisioningManager.getInstanceFor(connection()).sendFriendshipRequest(thing.asBareJid()); return iotClaimed; }
[ "public", "IoTClaimed", "claimThing", "(", "Jid", "registry", ",", "Collection", "<", "Tag", ">", "metaTags", ",", "boolean", "publicThing", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "interactWithRegistry", "(", "registry", ")", ";", "IoTMine", "iotMine", "=", "new", "IoTMine", "(", "metaTags", ",", "publicThing", ")", ";", "iotMine", ".", "setTo", "(", "registry", ")", ";", "IoTClaimed", "iotClaimed", "=", "connection", "(", ")", ".", "createStanzaCollectorAndSend", "(", "iotMine", ")", ".", "nextResultOrThrow", "(", ")", ";", "// The 'jid' attribute of the <claimed/> response now represents the XMPP address of the thing we just successfully claimed.", "Jid", "thing", "=", "iotClaimed", ".", "getJid", "(", ")", ";", "IoTProvisioningManager", ".", "getInstanceFor", "(", "connection", "(", ")", ")", ".", "sendFriendshipRequest", "(", "thing", ".", "asBareJid", "(", ")", ")", ";", "return", "iotClaimed", ";", "}" ]
Claim a thing by providing a collection of meta tags. If the claim was successful, then a {@link IoTClaimed} instance will be returned, which contains the XMPP address of the thing. Use {@link IoTClaimed#getJid()} to retrieve this address. @param registry the registry use to claim the thing. @param metaTags a collection of meta tags used to identify the thing. @param publicThing if this is a public thing. @return a {@link IoTClaimed} if successful. @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "Claim", "a", "thing", "by", "providing", "a", "collection", "of", "meta", "tags", ".", "If", "the", "claim", "was", "successful", "then", "a", "{", "@link", "IoTClaimed", "}", "instance", "will", "be", "returned", "which", "contains", "the", "XMPP", "address", "of", "the", "thing", ".", "Use", "{", "@link", "IoTClaimed#getJid", "()", "}", "to", "retrieve", "this", "address", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/IoTDiscoveryManager.java#L291-L304
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java
ProvFactory.newEntity
public Entity newEntity(QualifiedName id, Collection<Attribute> attributes) { """ Creates a new {@link Entity} with provided identifier and attributes @param id a {@link QualifiedName} for the entity @param attributes a collection of {@link Attribute} for the entity @return an object of type {@link Entity} """ Entity res = newEntity(id); setAttributes(res, attributes); return res; }
java
public Entity newEntity(QualifiedName id, Collection<Attribute> attributes) { Entity res = newEntity(id); setAttributes(res, attributes); return res; }
[ "public", "Entity", "newEntity", "(", "QualifiedName", "id", ",", "Collection", "<", "Attribute", ">", "attributes", ")", "{", "Entity", "res", "=", "newEntity", "(", "id", ")", ";", "setAttributes", "(", "res", ",", "attributes", ")", ";", "return", "res", ";", "}" ]
Creates a new {@link Entity} with provided identifier and attributes @param id a {@link QualifiedName} for the entity @param attributes a collection of {@link Attribute} for the entity @return an object of type {@link Entity}
[ "Creates", "a", "new", "{" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L638-L642
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/StreamSupport.java
StreamSupport.intStream
public static IntStream intStream(Spliterator.OfInt spliterator, boolean parallel) { """ Creates a new sequential or parallel {@code IntStream} from a {@code Spliterator.OfInt}. <p>The spliterator is only traversed, split, or queried for estimated size after the terminal operation of the stream pipeline commences. <p>It is strongly recommended the spliterator report a characteristic of {@code IMMUTABLE} or {@code CONCURRENT}, or be <a href="../Spliterator.html#binding">late-binding</a>. Otherwise, {@link #intStream(java.util.function.Supplier, int, boolean)} should be used to reduce the scope of potential interference with the source. See <a href="package-summary.html#NonInterference">Non-Interference</a> for more details. @param spliterator a {@code Spliterator.OfInt} describing the stream elements @param parallel if {@code true} then the returned stream is a parallel stream; if {@code false} the returned stream is a sequential stream. @return a new sequential or parallel {@code IntStream} """ return new IntPipeline.Head<>(spliterator, StreamOpFlag.fromCharacteristics(spliterator), parallel); }
java
public static IntStream intStream(Spliterator.OfInt spliterator, boolean parallel) { return new IntPipeline.Head<>(spliterator, StreamOpFlag.fromCharacteristics(spliterator), parallel); }
[ "public", "static", "IntStream", "intStream", "(", "Spliterator", ".", "OfInt", "spliterator", ",", "boolean", "parallel", ")", "{", "return", "new", "IntPipeline", ".", "Head", "<>", "(", "spliterator", ",", "StreamOpFlag", ".", "fromCharacteristics", "(", "spliterator", ")", ",", "parallel", ")", ";", "}" ]
Creates a new sequential or parallel {@code IntStream} from a {@code Spliterator.OfInt}. <p>The spliterator is only traversed, split, or queried for estimated size after the terminal operation of the stream pipeline commences. <p>It is strongly recommended the spliterator report a characteristic of {@code IMMUTABLE} or {@code CONCURRENT}, or be <a href="../Spliterator.html#binding">late-binding</a>. Otherwise, {@link #intStream(java.util.function.Supplier, int, boolean)} should be used to reduce the scope of potential interference with the source. See <a href="package-summary.html#NonInterference">Non-Interference</a> for more details. @param spliterator a {@code Spliterator.OfInt} describing the stream elements @param parallel if {@code true} then the returned stream is a parallel stream; if {@code false} the returned stream is a sequential stream. @return a new sequential or parallel {@code IntStream}
[ "Creates", "a", "new", "sequential", "or", "parallel", "{", "@code", "IntStream", "}", "from", "a", "{", "@code", "Spliterator", ".", "OfInt", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/StreamSupport.java#L137-L141
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/Journaler.java
Journaler.initModule
@Override public void initModule() throws ModuleInitializationException { """ Augment the parameters with values obtained from System Properties, and create the proper worker (JournalCreator or JournalConsumer) for the current mode. """ Map<String, String> parameters = getParameters(); copyPropertiesOverParameters(parameters); serverInterface = new ServerWrapper(getServer()); logger.info("Journaling parameters: " + parameters); parseParameters(parameters); if (inRecoveryMode) { worker = new JournalConsumer(parameters, getRole(), serverInterface); } else { worker = new JournalCreator(parameters, getRole(), serverInterface); } logger.info("Journal worker module is: " + worker.toString()); }
java
@Override public void initModule() throws ModuleInitializationException { Map<String, String> parameters = getParameters(); copyPropertiesOverParameters(parameters); serverInterface = new ServerWrapper(getServer()); logger.info("Journaling parameters: " + parameters); parseParameters(parameters); if (inRecoveryMode) { worker = new JournalConsumer(parameters, getRole(), serverInterface); } else { worker = new JournalCreator(parameters, getRole(), serverInterface); } logger.info("Journal worker module is: " + worker.toString()); }
[ "@", "Override", "public", "void", "initModule", "(", ")", "throws", "ModuleInitializationException", "{", "Map", "<", "String", ",", "String", ">", "parameters", "=", "getParameters", "(", ")", ";", "copyPropertiesOverParameters", "(", "parameters", ")", ";", "serverInterface", "=", "new", "ServerWrapper", "(", "getServer", "(", ")", ")", ";", "logger", ".", "info", "(", "\"Journaling parameters: \"", "+", "parameters", ")", ";", "parseParameters", "(", "parameters", ")", ";", "if", "(", "inRecoveryMode", ")", "{", "worker", "=", "new", "JournalConsumer", "(", "parameters", ",", "getRole", "(", ")", ",", "serverInterface", ")", ";", "}", "else", "{", "worker", "=", "new", "JournalCreator", "(", "parameters", ",", "getRole", "(", ")", ",", "serverInterface", ")", ";", "}", "logger", ".", "info", "(", "\"Journal worker module is: \"", "+", "worker", ".", "toString", "(", ")", ")", ";", "}" ]
Augment the parameters with values obtained from System Properties, and create the proper worker (JournalCreator or JournalConsumer) for the current mode.
[ "Augment", "the", "parameters", "with", "values", "obtained", "from", "System", "Properties", "and", "create", "the", "proper", "worker", "(", "JournalCreator", "or", "JournalConsumer", ")", "for", "the", "current", "mode", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/Journaler.java#L61-L76
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
MethodReturnsConstant.visitCode
@Override public void visitCode(Code obj) { """ implements the visitor to reset the stack and proceed for private methods @param obj the context object of the currently parsed code block """ Method m = getMethod(); if (overloadedMethods.contains(m)) { return; } int aFlags = m.getAccessFlags(); if ((((aFlags & Const.ACC_PRIVATE) != 0) || ((aFlags & Const.ACC_STATIC) != 0)) && ((aFlags & Const.ACC_SYNTHETIC) == 0) && (!m.getSignature().endsWith(")Z"))) { stack.resetForMethodEntry(this); returnRegister = Values.NEGATIVE_ONE; returnConstant = null; registerConstants.clear(); returnPC = -1; try { super.visitCode(obj); if ((returnConstant != null)) { BugInstance bi = new BugInstance(this, BugType.MRC_METHOD_RETURNS_CONSTANT.name(), ((aFlags & Const.ACC_PRIVATE) != 0) ? NORMAL_PRIORITY : LOW_PRIORITY).addClass(this).addMethod(this); if (returnPC >= 0) { bi.addSourceLine(this, returnPC); } bi.addString(returnConstant.toString()); bugReporter.reportBug(bi); } } catch (StopOpcodeParsingException e) { // method was not suspect } } }
java
@Override public void visitCode(Code obj) { Method m = getMethod(); if (overloadedMethods.contains(m)) { return; } int aFlags = m.getAccessFlags(); if ((((aFlags & Const.ACC_PRIVATE) != 0) || ((aFlags & Const.ACC_STATIC) != 0)) && ((aFlags & Const.ACC_SYNTHETIC) == 0) && (!m.getSignature().endsWith(")Z"))) { stack.resetForMethodEntry(this); returnRegister = Values.NEGATIVE_ONE; returnConstant = null; registerConstants.clear(); returnPC = -1; try { super.visitCode(obj); if ((returnConstant != null)) { BugInstance bi = new BugInstance(this, BugType.MRC_METHOD_RETURNS_CONSTANT.name(), ((aFlags & Const.ACC_PRIVATE) != 0) ? NORMAL_PRIORITY : LOW_PRIORITY).addClass(this).addMethod(this); if (returnPC >= 0) { bi.addSourceLine(this, returnPC); } bi.addString(returnConstant.toString()); bugReporter.reportBug(bi); } } catch (StopOpcodeParsingException e) { // method was not suspect } } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "overloadedMethods", ".", "contains", "(", "m", ")", ")", "{", "return", ";", "}", "int", "aFlags", "=", "m", ".", "getAccessFlags", "(", ")", ";", "if", "(", "(", "(", "(", "aFlags", "&", "Const", ".", "ACC_PRIVATE", ")", "!=", "0", ")", "||", "(", "(", "aFlags", "&", "Const", ".", "ACC_STATIC", ")", "!=", "0", ")", ")", "&&", "(", "(", "aFlags", "&", "Const", ".", "ACC_SYNTHETIC", ")", "==", "0", ")", "&&", "(", "!", "m", ".", "getSignature", "(", ")", ".", "endsWith", "(", "\")Z\"", ")", ")", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "returnRegister", "=", "Values", ".", "NEGATIVE_ONE", ";", "returnConstant", "=", "null", ";", "registerConstants", ".", "clear", "(", ")", ";", "returnPC", "=", "-", "1", ";", "try", "{", "super", ".", "visitCode", "(", "obj", ")", ";", "if", "(", "(", "returnConstant", "!=", "null", ")", ")", "{", "BugInstance", "bi", "=", "new", "BugInstance", "(", "this", ",", "BugType", ".", "MRC_METHOD_RETURNS_CONSTANT", ".", "name", "(", ")", ",", "(", "(", "aFlags", "&", "Const", ".", "ACC_PRIVATE", ")", "!=", "0", ")", "?", "NORMAL_PRIORITY", ":", "LOW_PRIORITY", ")", ".", "addClass", "(", "this", ")", ".", "addMethod", "(", "this", ")", ";", "if", "(", "returnPC", ">=", "0", ")", "{", "bi", ".", "addSourceLine", "(", "this", ",", "returnPC", ")", ";", "}", "bi", ".", "addString", "(", "returnConstant", ".", "toString", "(", ")", ")", ";", "bugReporter", ".", "reportBug", "(", "bi", ")", ";", "}", "}", "catch", "(", "StopOpcodeParsingException", "e", ")", "{", "// method was not suspect", "}", "}", "}" ]
implements the visitor to reset the stack and proceed for private methods @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "reset", "the", "stack", "and", "proceed", "for", "private", "methods" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java#L98-L131
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java
SSLReadServiceContext.handleAsyncError
private void handleAsyncError(boolean forceQueue, IOException exception, TCPReadCompletedCallback inCallback) { """ This method handles errors when they occur during the code path of an async read. It takes appropriate action based on the setting of the forceQueue parameter. If it is true, the error callback is called on a separate thread. Otherwise it is called right here. @param forceQueue @param exception @param inCallback """ boolean fireHere = true; if (forceQueue) { // Error must be returned on a separate thread. // Reuse queuedWork object (performance), but reset the error parameters. queuedWork.setErrorParameters(getConnLink().getVirtualConnection(), this, inCallback, exception); EventEngine events = SSLChannelProvider.getEventService(); if (null == events) { Exception e = new Exception("missing event service"); FFDCFilter.processException(e, getClass().getName(), "503", this); // fall-thru below and use callback here regardless } else { // fire an event to continue this queued work Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK); event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork); events.postEvent(event); fireHere = false; } } if (fireHere) { // Call the callback right here. inCallback.error(getConnLink().getVirtualConnection(), this, exception); } }
java
private void handleAsyncError(boolean forceQueue, IOException exception, TCPReadCompletedCallback inCallback) { boolean fireHere = true; if (forceQueue) { // Error must be returned on a separate thread. // Reuse queuedWork object (performance), but reset the error parameters. queuedWork.setErrorParameters(getConnLink().getVirtualConnection(), this, inCallback, exception); EventEngine events = SSLChannelProvider.getEventService(); if (null == events) { Exception e = new Exception("missing event service"); FFDCFilter.processException(e, getClass().getName(), "503", this); // fall-thru below and use callback here regardless } else { // fire an event to continue this queued work Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK); event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork); events.postEvent(event); fireHere = false; } } if (fireHere) { // Call the callback right here. inCallback.error(getConnLink().getVirtualConnection(), this, exception); } }
[ "private", "void", "handleAsyncError", "(", "boolean", "forceQueue", ",", "IOException", "exception", ",", "TCPReadCompletedCallback", "inCallback", ")", "{", "boolean", "fireHere", "=", "true", ";", "if", "(", "forceQueue", ")", "{", "// Error must be returned on a separate thread.", "// Reuse queuedWork object (performance), but reset the error parameters.", "queuedWork", ".", "setErrorParameters", "(", "getConnLink", "(", ")", ".", "getVirtualConnection", "(", ")", ",", "this", ",", "inCallback", ",", "exception", ")", ";", "EventEngine", "events", "=", "SSLChannelProvider", ".", "getEventService", "(", ")", ";", "if", "(", "null", "==", "events", ")", "{", "Exception", "e", "=", "new", "Exception", "(", "\"missing event service\"", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", ",", "\"503\"", ",", "this", ")", ";", "// fall-thru below and use callback here regardless", "}", "else", "{", "// fire an event to continue this queued work", "Event", "event", "=", "events", ".", "createEvent", "(", "SSLEventHandler", ".", "TOPIC_QUEUED_WORK", ")", ";", "event", ".", "setProperty", "(", "SSLEventHandler", ".", "KEY_RUNNABLE", ",", "this", ".", "queuedWork", ")", ";", "events", ".", "postEvent", "(", "event", ")", ";", "fireHere", "=", "false", ";", "}", "}", "if", "(", "fireHere", ")", "{", "// Call the callback right here.", "inCallback", ".", "error", "(", "getConnLink", "(", ")", ".", "getVirtualConnection", "(", ")", ",", "this", ",", "exception", ")", ";", "}", "}" ]
This method handles errors when they occur during the code path of an async read. It takes appropriate action based on the setting of the forceQueue parameter. If it is true, the error callback is called on a separate thread. Otherwise it is called right here. @param forceQueue @param exception @param inCallback
[ "This", "method", "handles", "errors", "when", "they", "occur", "during", "the", "code", "path", "of", "an", "async", "read", ".", "It", "takes", "appropriate", "action", "based", "on", "the", "setting", "of", "the", "forceQueue", "parameter", ".", "If", "it", "is", "true", "the", "error", "callback", "is", "called", "on", "a", "separate", "thread", ".", "Otherwise", "it", "is", "called", "right", "here", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L611-L636
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/RuleInformation.java
RuleInformation.ignoreForIncompleteSentences
public static boolean ignoreForIncompleteSentences(String ruleId, Language lang) { """ Whether this rule should be ignored when the sentence isn't finished yet. @since 4.4 """ return rules.contains(new Key(lang.getShortCode(), ruleId)); }
java
public static boolean ignoreForIncompleteSentences(String ruleId, Language lang) { return rules.contains(new Key(lang.getShortCode(), ruleId)); }
[ "public", "static", "boolean", "ignoreForIncompleteSentences", "(", "String", "ruleId", ",", "Language", "lang", ")", "{", "return", "rules", ".", "contains", "(", "new", "Key", "(", "lang", ".", "getShortCode", "(", ")", ",", "ruleId", ")", ")", ";", "}" ]
Whether this rule should be ignored when the sentence isn't finished yet. @since 4.4
[ "Whether", "this", "rule", "should", "be", "ignored", "when", "the", "sentence", "isn", "t", "finished", "yet", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/RuleInformation.java#L65-L67
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/requests/restaction/GuildAction.java
GuildAction.newChannel
@CheckReturnValue public ChannelData newChannel(ChannelType type, String name) { """ Creates a new {@link net.dv8tion.jda.core.requests.restaction.GuildAction.ChannelData ChannelData} instance and adds it to this GuildAction. @param type The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} of the resulting Channel <br>This may be of type {@link net.dv8tion.jda.core.entities.ChannelType#TEXT TEXT} or {@link net.dv8tion.jda.core.entities.ChannelType#VOICE VOICE}! @param name The name of the channel. This must be alphanumeric with underscores for type TEXT @throws java.lang.IllegalArgumentException <ul> <li>If provided with an invalid ChannelType</li> <li>If the provided name is {@code null} or blank</li> <li>If the provided name is not between 2-100 characters long</li> <li>If the type is TEXT and the provided name is not alphanumeric with underscores</li> </ul> @return The new ChannelData instance """ ChannelData data = new ChannelData(type, name); addChannel(data); return data; }
java
@CheckReturnValue public ChannelData newChannel(ChannelType type, String name) { ChannelData data = new ChannelData(type, name); addChannel(data); return data; }
[ "@", "CheckReturnValue", "public", "ChannelData", "newChannel", "(", "ChannelType", "type", ",", "String", "name", ")", "{", "ChannelData", "data", "=", "new", "ChannelData", "(", "type", ",", "name", ")", ";", "addChannel", "(", "data", ")", ";", "return", "data", ";", "}" ]
Creates a new {@link net.dv8tion.jda.core.requests.restaction.GuildAction.ChannelData ChannelData} instance and adds it to this GuildAction. @param type The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} of the resulting Channel <br>This may be of type {@link net.dv8tion.jda.core.entities.ChannelType#TEXT TEXT} or {@link net.dv8tion.jda.core.entities.ChannelType#VOICE VOICE}! @param name The name of the channel. This must be alphanumeric with underscores for type TEXT @throws java.lang.IllegalArgumentException <ul> <li>If provided with an invalid ChannelType</li> <li>If the provided name is {@code null} or blank</li> <li>If the provided name is not between 2-100 characters long</li> <li>If the type is TEXT and the provided name is not alphanumeric with underscores</li> </ul> @return The new ChannelData instance
[ "Creates", "a", "new", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "requests", ".", "restaction", ".", "GuildAction", ".", "ChannelData", "ChannelData", "}", "instance", "and", "adds", "it", "to", "this", "GuildAction", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/GuildAction.java#L277-L283
beangle/beangle3
struts/s2/src/main/java/org/beangle/struts2/freemarker/BeangleFreemarkerManager.java
BeangleFreemarkerManager.createTemplateLoader
@Override protected TemplateLoader createTemplateLoader(ServletContext servletContext, String templatePath) { """ The default template loader is a MultiTemplateLoader which includes BeangleClassTemplateLoader(classpath:) and a WebappTemplateLoader (webapp:) and FileTemplateLoader(file:) . All template path described in init parameter templatePath or TemplatePlath <p/> The ClassTemplateLoader will resolve fully qualified template includes that begin with a slash. for example /com/company/template/common.ftl <p/> The WebappTemplateLoader attempts to resolve templates relative to the web root folder """ // construct a FileTemplateLoader for the init-param 'TemplatePath' String[] paths = split(templatePath, ","); List<TemplateLoader> loaders = CollectUtils.newArrayList(); for (String path : paths) { if (path.startsWith("class://")) { loaders.add(new BeangleClassTemplateLoader(substringAfter(path, "class://"))); } else if (path.startsWith("file://")) { try { loaders.add(new FileTemplateLoader(new File(substringAfter(path, "file://")))); } catch (IOException e) { throw new RuntimeException("templatePath: " + path + " cannot be accessed", e); } } else if (path.startsWith("webapp://")) { loaders.add(new WebappTemplateLoader(servletContext, substringAfter(path, "webapp://"))); } else { throw new RuntimeException("templatePath: " + path + " is not well-formed. Use [class://|file://|webapp://] seperated with ,"); } } return new MultiTemplateLoader(loaders.toArray(new TemplateLoader[loaders.size()])); }
java
@Override protected TemplateLoader createTemplateLoader(ServletContext servletContext, String templatePath) { // construct a FileTemplateLoader for the init-param 'TemplatePath' String[] paths = split(templatePath, ","); List<TemplateLoader> loaders = CollectUtils.newArrayList(); for (String path : paths) { if (path.startsWith("class://")) { loaders.add(new BeangleClassTemplateLoader(substringAfter(path, "class://"))); } else if (path.startsWith("file://")) { try { loaders.add(new FileTemplateLoader(new File(substringAfter(path, "file://")))); } catch (IOException e) { throw new RuntimeException("templatePath: " + path + " cannot be accessed", e); } } else if (path.startsWith("webapp://")) { loaders.add(new WebappTemplateLoader(servletContext, substringAfter(path, "webapp://"))); } else { throw new RuntimeException("templatePath: " + path + " is not well-formed. Use [class://|file://|webapp://] seperated with ,"); } } return new MultiTemplateLoader(loaders.toArray(new TemplateLoader[loaders.size()])); }
[ "@", "Override", "protected", "TemplateLoader", "createTemplateLoader", "(", "ServletContext", "servletContext", ",", "String", "templatePath", ")", "{", "// construct a FileTemplateLoader for the init-param 'TemplatePath'", "String", "[", "]", "paths", "=", "split", "(", "templatePath", ",", "\",\"", ")", ";", "List", "<", "TemplateLoader", ">", "loaders", "=", "CollectUtils", ".", "newArrayList", "(", ")", ";", "for", "(", "String", "path", ":", "paths", ")", "{", "if", "(", "path", ".", "startsWith", "(", "\"class://\"", ")", ")", "{", "loaders", ".", "add", "(", "new", "BeangleClassTemplateLoader", "(", "substringAfter", "(", "path", ",", "\"class://\"", ")", ")", ")", ";", "}", "else", "if", "(", "path", ".", "startsWith", "(", "\"file://\"", ")", ")", "{", "try", "{", "loaders", ".", "add", "(", "new", "FileTemplateLoader", "(", "new", "File", "(", "substringAfter", "(", "path", ",", "\"file://\"", ")", ")", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"templatePath: \"", "+", "path", "+", "\" cannot be accessed\"", ",", "e", ")", ";", "}", "}", "else", "if", "(", "path", ".", "startsWith", "(", "\"webapp://\"", ")", ")", "{", "loaders", ".", "add", "(", "new", "WebappTemplateLoader", "(", "servletContext", ",", "substringAfter", "(", "path", ",", "\"webapp://\"", ")", ")", ")", ";", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"templatePath: \"", "+", "path", "+", "\" is not well-formed. Use [class://|file://|webapp://] seperated with ,\"", ")", ";", "}", "}", "return", "new", "MultiTemplateLoader", "(", "loaders", ".", "toArray", "(", "new", "TemplateLoader", "[", "loaders", ".", "size", "(", ")", "]", ")", ")", ";", "}" ]
The default template loader is a MultiTemplateLoader which includes BeangleClassTemplateLoader(classpath:) and a WebappTemplateLoader (webapp:) and FileTemplateLoader(file:) . All template path described in init parameter templatePath or TemplatePlath <p/> The ClassTemplateLoader will resolve fully qualified template includes that begin with a slash. for example /com/company/template/common.ftl <p/> The WebappTemplateLoader attempts to resolve templates relative to the web root folder
[ "The", "default", "template", "loader", "is", "a", "MultiTemplateLoader", "which", "includes", "BeangleClassTemplateLoader", "(", "classpath", ":", ")", "and", "a", "WebappTemplateLoader", "(", "webapp", ":", ")", "and", "FileTemplateLoader", "(", "file", ":", ")", ".", "All", "template", "path", "described", "in", "init", "parameter", "templatePath", "or", "TemplatePlath", "<p", "/", ">", "The", "ClassTemplateLoader", "will", "resolve", "fully", "qualified", "template", "includes", "that", "begin", "with", "a", "slash", ".", "for", "example", "/", "com", "/", "company", "/", "template", "/", "common", ".", "ftl", "<p", "/", ">", "The", "WebappTemplateLoader", "attempts", "to", "resolve", "templates", "relative", "to", "the", "web", "root", "folder" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/freemarker/BeangleFreemarkerManager.java#L109-L132
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java
Quaternion.mul
public final void mul(Quaternion q1, Quaternion q2) { """ Sets the value of this quaternion to the quaternion product of quaternions q1 and q2 (this = q1 * q2). Note that this is safe for aliasing (e.g. this can be q1 or q2). @param q1 the first quaternion @param q2 the second quaternion """ if (this != q1 && this != q2) { this.w = q1.w*q2.w - q1.x*q2.x - q1.y*q2.y - q1.z*q2.z; this.x = q1.w*q2.x + q2.w*q1.x + q1.y*q2.z - q1.z*q2.y; this.y = q1.w*q2.y + q2.w*q1.y - q1.x*q2.z + q1.z*q2.x; this.z = q1.w*q2.z + q2.w*q1.z + q1.x*q2.y - q1.y*q2.x; } else { double x1, y1, w1; w1 = q1.w*q2.w - q1.x*q2.x - q1.y*q2.y - q1.z*q2.z; x1 = q1.w*q2.x + q2.w*q1.x + q1.y*q2.z - q1.z*q2.y; y1 = q1.w*q2.y + q2.w*q1.y - q1.x*q2.z + q1.z*q2.x; this.z = q1.w*q2.z + q2.w*q1.z + q1.x*q2.y - q1.y*q2.x; this.w = w1; this.x = x1; this.y = y1; } }
java
public final void mul(Quaternion q1, Quaternion q2) { if (this != q1 && this != q2) { this.w = q1.w*q2.w - q1.x*q2.x - q1.y*q2.y - q1.z*q2.z; this.x = q1.w*q2.x + q2.w*q1.x + q1.y*q2.z - q1.z*q2.y; this.y = q1.w*q2.y + q2.w*q1.y - q1.x*q2.z + q1.z*q2.x; this.z = q1.w*q2.z + q2.w*q1.z + q1.x*q2.y - q1.y*q2.x; } else { double x1, y1, w1; w1 = q1.w*q2.w - q1.x*q2.x - q1.y*q2.y - q1.z*q2.z; x1 = q1.w*q2.x + q2.w*q1.x + q1.y*q2.z - q1.z*q2.y; y1 = q1.w*q2.y + q2.w*q1.y - q1.x*q2.z + q1.z*q2.x; this.z = q1.w*q2.z + q2.w*q1.z + q1.x*q2.y - q1.y*q2.x; this.w = w1; this.x = x1; this.y = y1; } }
[ "public", "final", "void", "mul", "(", "Quaternion", "q1", ",", "Quaternion", "q2", ")", "{", "if", "(", "this", "!=", "q1", "&&", "this", "!=", "q2", ")", "{", "this", ".", "w", "=", "q1", ".", "w", "*", "q2", ".", "w", "-", "q1", ".", "x", "*", "q2", ".", "x", "-", "q1", ".", "y", "*", "q2", ".", "y", "-", "q1", ".", "z", "*", "q2", ".", "z", ";", "this", ".", "x", "=", "q1", ".", "w", "*", "q2", ".", "x", "+", "q2", ".", "w", "*", "q1", ".", "x", "+", "q1", ".", "y", "*", "q2", ".", "z", "-", "q1", ".", "z", "*", "q2", ".", "y", ";", "this", ".", "y", "=", "q1", ".", "w", "*", "q2", ".", "y", "+", "q2", ".", "w", "*", "q1", ".", "y", "-", "q1", ".", "x", "*", "q2", ".", "z", "+", "q1", ".", "z", "*", "q2", ".", "x", ";", "this", ".", "z", "=", "q1", ".", "w", "*", "q2", ".", "z", "+", "q2", ".", "w", "*", "q1", ".", "z", "+", "q1", ".", "x", "*", "q2", ".", "y", "-", "q1", ".", "y", "*", "q2", ".", "x", ";", "}", "else", "{", "double", "x1", ",", "y1", ",", "w1", ";", "w1", "=", "q1", ".", "w", "*", "q2", ".", "w", "-", "q1", ".", "x", "*", "q2", ".", "x", "-", "q1", ".", "y", "*", "q2", ".", "y", "-", "q1", ".", "z", "*", "q2", ".", "z", ";", "x1", "=", "q1", ".", "w", "*", "q2", ".", "x", "+", "q2", ".", "w", "*", "q1", ".", "x", "+", "q1", ".", "y", "*", "q2", ".", "z", "-", "q1", ".", "z", "*", "q2", ".", "y", ";", "y1", "=", "q1", ".", "w", "*", "q2", ".", "y", "+", "q2", ".", "w", "*", "q1", ".", "y", "-", "q1", ".", "x", "*", "q2", ".", "z", "+", "q1", ".", "z", "*", "q2", ".", "x", ";", "this", ".", "z", "=", "q1", ".", "w", "*", "q2", ".", "z", "+", "q2", ".", "w", "*", "q1", ".", "z", "+", "q1", ".", "x", "*", "q2", ".", "y", "-", "q1", ".", "y", "*", "q2", ".", "x", ";", "this", ".", "w", "=", "w1", ";", "this", ".", "x", "=", "x1", ";", "this", ".", "y", "=", "y1", ";", "}", "}" ]
Sets the value of this quaternion to the quaternion product of quaternions q1 and q2 (this = q1 * q2). Note that this is safe for aliasing (e.g. this can be q1 or q2). @param q1 the first quaternion @param q2 the second quaternion
[ "Sets", "the", "value", "of", "this", "quaternion", "to", "the", "quaternion", "product", "of", "quaternions", "q1", "and", "q2", "(", "this", "=", "q1", "*", "q2", ")", ".", "Note", "that", "this", "is", "safe", "for", "aliasing", "(", "e", ".", "g", ".", "this", "can", "be", "q1", "or", "q2", ")", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java#L350-L368
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java
SibRaMessagingEngineConnection.createListener
SibRaListener createListener(final SIDestinationAddress destination, MessageEndpointFactory messageEndpointFactory) throws ResourceException { """ Creates a new listener to the given destination. @param destination the destination to listen to @return a listener @throws ResourceException if the creation fails """ final String methodName = "createListener"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, new Object[] { destination, messageEndpointFactory }); } if (_closed) { throw new IllegalStateException(NLS .getString("LISTENER_CLOSED_CWSIV0952")); } final SibRaListener listener; listener = new SibRaSingleProcessListener(this, destination, messageEndpointFactory); _listeners.put(destination, listener); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName, listener); } return listener; }
java
SibRaListener createListener(final SIDestinationAddress destination, MessageEndpointFactory messageEndpointFactory) throws ResourceException { final String methodName = "createListener"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, new Object[] { destination, messageEndpointFactory }); } if (_closed) { throw new IllegalStateException(NLS .getString("LISTENER_CLOSED_CWSIV0952")); } final SibRaListener listener; listener = new SibRaSingleProcessListener(this, destination, messageEndpointFactory); _listeners.put(destination, listener); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName, listener); } return listener; }
[ "SibRaListener", "createListener", "(", "final", "SIDestinationAddress", "destination", ",", "MessageEndpointFactory", "messageEndpointFactory", ")", "throws", "ResourceException", "{", "final", "String", "methodName", "=", "\"createListener\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "this", ",", "TRACE", ",", "methodName", ",", "new", "Object", "[", "]", "{", "destination", ",", "messageEndpointFactory", "}", ")", ";", "}", "if", "(", "_closed", ")", "{", "throw", "new", "IllegalStateException", "(", "NLS", ".", "getString", "(", "\"LISTENER_CLOSED_CWSIV0952\"", ")", ")", ";", "}", "final", "SibRaListener", "listener", ";", "listener", "=", "new", "SibRaSingleProcessListener", "(", "this", ",", "destination", ",", "messageEndpointFactory", ")", ";", "_listeners", ".", "put", "(", "destination", ",", "listener", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "this", ",", "TRACE", ",", "methodName", ",", "listener", ")", ";", "}", "return", "listener", ";", "}" ]
Creates a new listener to the given destination. @param destination the destination to listen to @return a listener @throws ResourceException if the creation fails
[ "Creates", "a", "new", "listener", "to", "the", "given", "destination", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java#L661-L686
json-path/JsonPath
json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
JsonPath.put
public <T> T put(Object jsonObject, String key, Object value, Configuration configuration) { """ Adds or updates the Object this path points to in the provided jsonObject with a key with a value @param jsonObject a json object @param key the key to add or update @param value the new value @param configuration configuration to use @param <T> expected return type @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. """ notNull(jsonObject, "json can not be null"); notEmpty(key, "key can not be null or empty"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.put(key, value, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
java
public <T> T put(Object jsonObject, String key, Object value, Configuration configuration) { notNull(jsonObject, "json can not be null"); notEmpty(key, "key can not be null or empty"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.put(key, value, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
[ "public", "<", "T", ">", "T", "put", "(", "Object", "jsonObject", ",", "String", "key", ",", "Object", "value", ",", "Configuration", "configuration", ")", "{", "notNull", "(", "jsonObject", ",", "\"json can not be null\"", ")", ";", "notEmpty", "(", "key", ",", "\"key can not be null or empty\"", ")", ";", "notNull", "(", "configuration", ",", "\"configuration can not be null\"", ")", ";", "EvaluationContext", "evaluationContext", "=", "path", ".", "evaluate", "(", "jsonObject", ",", "jsonObject", ",", "configuration", ",", "true", ")", ";", "for", "(", "PathRef", "updateOperation", ":", "evaluationContext", ".", "updateOperations", "(", ")", ")", "{", "updateOperation", ".", "put", "(", "key", ",", "value", ",", "configuration", ")", ";", "}", "return", "resultByConfiguration", "(", "jsonObject", ",", "configuration", ",", "evaluationContext", ")", ";", "}" ]
Adds or updates the Object this path points to in the provided jsonObject with a key with a value @param jsonObject a json object @param key the key to add or update @param value the new value @param configuration configuration to use @param <T> expected return type @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set.
[ "Adds", "or", "updates", "the", "Object", "this", "path", "points", "to", "in", "the", "provided", "jsonObject", "with", "a", "key", "with", "a", "value" ]
train
https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java#L294-L303
phax/ph-commons
ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetEncoder.java
UTF7StyleCharsetEncoder._unshift
private void _unshift (final ByteBuffer out, final char ch) { """ <p> Writes the bytes necessary to leave <i>base 64 mode</i>. This might include an unshift character. </p> @param out @param ch """ if (!m_bBase64mode) return; if (m_nBitsToOutput != 0) out.put (m_aBase64.getChar (m_nSextet)); if (m_aBase64.contains (ch) || ch == m_nUnshift || m_bStrict) out.put (m_nUnshift); m_bBase64mode = false; m_nSextet = 0; m_nBitsToOutput = 0; }
java
private void _unshift (final ByteBuffer out, final char ch) { if (!m_bBase64mode) return; if (m_nBitsToOutput != 0) out.put (m_aBase64.getChar (m_nSextet)); if (m_aBase64.contains (ch) || ch == m_nUnshift || m_bStrict) out.put (m_nUnshift); m_bBase64mode = false; m_nSextet = 0; m_nBitsToOutput = 0; }
[ "private", "void", "_unshift", "(", "final", "ByteBuffer", "out", ",", "final", "char", "ch", ")", "{", "if", "(", "!", "m_bBase64mode", ")", "return", ";", "if", "(", "m_nBitsToOutput", "!=", "0", ")", "out", ".", "put", "(", "m_aBase64", ".", "getChar", "(", "m_nSextet", ")", ")", ";", "if", "(", "m_aBase64", ".", "contains", "(", "ch", ")", "||", "ch", "==", "m_nUnshift", "||", "m_bStrict", ")", "out", ".", "put", "(", "m_nUnshift", ")", ";", "m_bBase64mode", "=", "false", ";", "m_nSextet", "=", "0", ";", "m_nBitsToOutput", "=", "0", ";", "}" ]
<p> Writes the bytes necessary to leave <i>base 64 mode</i>. This might include an unshift character. </p> @param out @param ch
[ "<p", ">", "Writes", "the", "bytes", "necessary", "to", "leave", "<i", ">", "base", "64", "mode<", "/", "i", ">", ".", "This", "might", "include", "an", "unshift", "character", ".", "<", "/", "p", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetEncoder.java#L172-L183
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java
TotpUtils.getQRCode
public static String getQRCode(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) { """ Generates a QR code to share a secret with a user @param name The name of the account @param issuer The name of the issuer @param secret The secret to use @param algorithm The algorithm to use @param digits The number of digits to use @param period The period to use @return An URL to Google charts API with the QR code """ Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString()); Objects.requireNonNull(secret, Required.SECRET.toString()); Objects.requireNonNull(issuer, Required.ISSUER.toString()); Objects.requireNonNull(algorithm, Required.ALGORITHM.toString()); Objects.requireNonNull(digits, Required.DIGITS.toString()); Objects.requireNonNull(period, Required.PERIOD.toString()); var buffer = new StringBuilder(); buffer.append("https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=200x200&chld=M|0&cht=qr&chl=") .append(getOtpauthURL(name, issuer, secret, algorithm, digits, period)); return buffer.toString(); }
java
public static String getQRCode(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) { Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString()); Objects.requireNonNull(secret, Required.SECRET.toString()); Objects.requireNonNull(issuer, Required.ISSUER.toString()); Objects.requireNonNull(algorithm, Required.ALGORITHM.toString()); Objects.requireNonNull(digits, Required.DIGITS.toString()); Objects.requireNonNull(period, Required.PERIOD.toString()); var buffer = new StringBuilder(); buffer.append("https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=200x200&chld=M|0&cht=qr&chl=") .append(getOtpauthURL(name, issuer, secret, algorithm, digits, period)); return buffer.toString(); }
[ "public", "static", "String", "getQRCode", "(", "String", "name", ",", "String", "issuer", ",", "String", "secret", ",", "HmacShaAlgorithm", "algorithm", ",", "String", "digits", ",", "String", "period", ")", "{", "Objects", ".", "requireNonNull", "(", "name", ",", "Required", ".", "ACCOUNT_NAME", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "secret", ",", "Required", ".", "SECRET", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "issuer", ",", "Required", ".", "ISSUER", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "algorithm", ",", "Required", ".", "ALGORITHM", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "digits", ",", "Required", ".", "DIGITS", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "period", ",", "Required", ".", "PERIOD", ".", "toString", "(", ")", ")", ";", "var", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "buffer", ".", "append", "(", "\"https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=200x200&chld=M|0&cht=qr&chl=\"", ")", ".", "append", "(", "getOtpauthURL", "(", "name", ",", "issuer", ",", "secret", ",", "algorithm", ",", "digits", ",", "period", ")", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
Generates a QR code to share a secret with a user @param name The name of the account @param issuer The name of the issuer @param secret The secret to use @param algorithm The algorithm to use @param digits The number of digits to use @param period The period to use @return An URL to Google charts API with the QR code
[ "Generates", "a", "QR", "code", "to", "share", "a", "secret", "with", "a", "user" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java#L156-L169
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/android/DbxOfficialAppConnector.java
DbxOfficialAppConnector.addExtrasToIntent
protected void addExtrasToIntent(Context context, Intent intent) { """ Add uid information to an explicit intent directed to DropboxApp """ intent.putExtra(EXTRA_DROPBOX_UID, uid); intent.putExtra(EXTRA_CALLING_PACKAGE, context.getPackageName()); }
java
protected void addExtrasToIntent(Context context, Intent intent) { intent.putExtra(EXTRA_DROPBOX_UID, uid); intent.putExtra(EXTRA_CALLING_PACKAGE, context.getPackageName()); }
[ "protected", "void", "addExtrasToIntent", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "intent", ".", "putExtra", "(", "EXTRA_DROPBOX_UID", ",", "uid", ")", ";", "intent", ".", "putExtra", "(", "EXTRA_CALLING_PACKAGE", ",", "context", ".", "getPackageName", "(", ")", ")", ";", "}" ]
Add uid information to an explicit intent directed to DropboxApp
[ "Add", "uid", "information", "to", "an", "explicit", "intent", "directed", "to", "DropboxApp" ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/android/DbxOfficialAppConnector.java#L117-L120
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/Record.java
Record.formatTableNames
public static final String formatTableNames(String strTableNames, boolean bAddQuotes) { """ Utility routine to add quotes to a string if the string contains a space. @param strTableNames The table name to add quotes to if there is a space in the name. @param bAddQuotes Add the quotes? @return The new quoted table name. """ if (bAddQuotes) if (strTableNames.indexOf(' ') != -1) strTableNames = BaseField.addQuotes(strTableNames, DBConstants.SQL_START_QUOTE, DBConstants.SQL_END_QUOTE); // Spaces in name, quotes required return strTableNames; }
java
public static final String formatTableNames(String strTableNames, boolean bAddQuotes) { if (bAddQuotes) if (strTableNames.indexOf(' ') != -1) strTableNames = BaseField.addQuotes(strTableNames, DBConstants.SQL_START_QUOTE, DBConstants.SQL_END_QUOTE); // Spaces in name, quotes required return strTableNames; }
[ "public", "static", "final", "String", "formatTableNames", "(", "String", "strTableNames", ",", "boolean", "bAddQuotes", ")", "{", "if", "(", "bAddQuotes", ")", "if", "(", "strTableNames", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "strTableNames", "=", "BaseField", ".", "addQuotes", "(", "strTableNames", ",", "DBConstants", ".", "SQL_START_QUOTE", ",", "DBConstants", ".", "SQL_END_QUOTE", ")", ";", "// Spaces in name, quotes required", "return", "strTableNames", ";", "}" ]
Utility routine to add quotes to a string if the string contains a space. @param strTableNames The table name to add quotes to if there is a space in the name. @param bAddQuotes Add the quotes? @return The new quoted table name.
[ "Utility", "routine", "to", "add", "quotes", "to", "a", "string", "if", "the", "string", "contains", "a", "space", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L847-L853
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/validation/SARLUIStrings.java
SARLUIStrings.parametersToStyledString
protected StyledString parametersToStyledString(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName) { """ Replies the styled string representation of the parameters. @param elements the parameters. @param isVarArgs indicates if the last parameter is variadic. @param includeName indicates if the names are included. @return the styled string. @since 0.6 """ return getParameterStyledString(elements, isVarArgs, includeName, this.keywords, this.annotationFinder, this); }
java
protected StyledString parametersToStyledString(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName) { return getParameterStyledString(elements, isVarArgs, includeName, this.keywords, this.annotationFinder, this); }
[ "protected", "StyledString", "parametersToStyledString", "(", "Iterable", "<", "?", "extends", "JvmFormalParameter", ">", "elements", ",", "boolean", "isVarArgs", ",", "boolean", "includeName", ")", "{", "return", "getParameterStyledString", "(", "elements", ",", "isVarArgs", ",", "includeName", ",", "this", ".", "keywords", ",", "this", ".", "annotationFinder", ",", "this", ")", ";", "}" ]
Replies the styled string representation of the parameters. @param elements the parameters. @param isVarArgs indicates if the last parameter is variadic. @param includeName indicates if the names are included. @return the styled string. @since 0.6
[ "Replies", "the", "styled", "string", "representation", "of", "the", "parameters", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/validation/SARLUIStrings.java#L113-L115
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/style/TableCellStyleBuilder.java
TableCellStyleBuilder.borderAll
public TableCellStyleBuilder borderAll(final Length size, final Color borderColor, final BorderAttribute.Style style) { """ Add a border style for all the borders of this cell. @param size the size of the line @param borderColor the color to be used in format #rrggbb e.g. '#ff0000' for a red border @param style the style of the border line, either BorderAttribute.BORDER_SOLID or BorderAttribute.BORDER_DOUBLE @return this for fluent style """ final BorderAttribute bs = new BorderAttribute(size, borderColor, style); this.bordersBuilder.all(bs); return this; }
java
public TableCellStyleBuilder borderAll(final Length size, final Color borderColor, final BorderAttribute.Style style) { final BorderAttribute bs = new BorderAttribute(size, borderColor, style); this.bordersBuilder.all(bs); return this; }
[ "public", "TableCellStyleBuilder", "borderAll", "(", "final", "Length", "size", ",", "final", "Color", "borderColor", ",", "final", "BorderAttribute", ".", "Style", "style", ")", "{", "final", "BorderAttribute", "bs", "=", "new", "BorderAttribute", "(", "size", ",", "borderColor", ",", "style", ")", ";", "this", ".", "bordersBuilder", ".", "all", "(", "bs", ")", ";", "return", "this", ";", "}" ]
Add a border style for all the borders of this cell. @param size the size of the line @param borderColor the color to be used in format #rrggbb e.g. '#ff0000' for a red border @param style the style of the border line, either BorderAttribute.BORDER_SOLID or BorderAttribute.BORDER_DOUBLE @return this for fluent style
[ "Add", "a", "border", "style", "for", "all", "the", "borders", "of", "this", "cell", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/style/TableCellStyleBuilder.java#L98-L103
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceListenerHelper.java
DfuServiceListenerHelper.unregisterLogListener
public static void unregisterLogListener(@NonNull final Context context, @NonNull final DfuLogListener listener) { """ Unregisters the previously registered log listener. @param context the application context. @param listener the listener to unregister. """ if (mLogBroadcastReceiver != null) { final boolean empty = mLogBroadcastReceiver.removeLogListener(listener); if (empty) { LocalBroadcastManager.getInstance(context).unregisterReceiver(mLogBroadcastReceiver); mLogBroadcastReceiver = null; } } }
java
public static void unregisterLogListener(@NonNull final Context context, @NonNull final DfuLogListener listener) { if (mLogBroadcastReceiver != null) { final boolean empty = mLogBroadcastReceiver.removeLogListener(listener); if (empty) { LocalBroadcastManager.getInstance(context).unregisterReceiver(mLogBroadcastReceiver); mLogBroadcastReceiver = null; } } }
[ "public", "static", "void", "unregisterLogListener", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "NonNull", "final", "DfuLogListener", "listener", ")", "{", "if", "(", "mLogBroadcastReceiver", "!=", "null", ")", "{", "final", "boolean", "empty", "=", "mLogBroadcastReceiver", ".", "removeLogListener", "(", "listener", ")", ";", "if", "(", "empty", ")", "{", "LocalBroadcastManager", ".", "getInstance", "(", "context", ")", ".", "unregisterReceiver", "(", "mLogBroadcastReceiver", ")", ";", "mLogBroadcastReceiver", "=", "null", ";", "}", "}", "}" ]
Unregisters the previously registered log listener. @param context the application context. @param listener the listener to unregister.
[ "Unregisters", "the", "previously", "registered", "log", "listener", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceListenerHelper.java#L378-L387
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_volume_volumeId_DELETE
public void project_serviceName_volume_volumeId_DELETE(String serviceName, String volumeId) throws IOException { """ Delete a volume REST: DELETE /cloud/project/{serviceName}/volume/{volumeId} @param serviceName [required] Project id @param volumeId [required] Volume id """ String qPath = "/cloud/project/{serviceName}/volume/{volumeId}"; StringBuilder sb = path(qPath, serviceName, volumeId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void project_serviceName_volume_volumeId_DELETE(String serviceName, String volumeId) throws IOException { String qPath = "/cloud/project/{serviceName}/volume/{volumeId}"; StringBuilder sb = path(qPath, serviceName, volumeId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "project_serviceName_volume_volumeId_DELETE", "(", "String", "serviceName", ",", "String", "volumeId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/volume/{volumeId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "volumeId", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete a volume REST: DELETE /cloud/project/{serviceName}/volume/{volumeId} @param serviceName [required] Project id @param volumeId [required] Volume id
[ "Delete", "a", "volume" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1106-L1110
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/MessageSourceFieldFaceSource.java
MessageSourceFieldFaceSource.getMessage
protected String getMessage(String contextId, String fieldPath, String[] faceDescriptorProperty) { """ Returns the value of the required property of the FieldFace. Delegates to the getMessageKeys for the message key generation strategy. This method uses </code>[contextId + "." + ] fieldPath [ + "." + faceDescriptorProperty[0]]</code> for the default value """ String[] keys = getMessageKeys(contextId, fieldPath, faceDescriptorProperty); return getMessageSourceAccessor().getMessage(new DefaultMessageSourceResolvable(keys, null, keys[0])); }
java
protected String getMessage(String contextId, String fieldPath, String[] faceDescriptorProperty) { String[] keys = getMessageKeys(contextId, fieldPath, faceDescriptorProperty); return getMessageSourceAccessor().getMessage(new DefaultMessageSourceResolvable(keys, null, keys[0])); }
[ "protected", "String", "getMessage", "(", "String", "contextId", ",", "String", "fieldPath", ",", "String", "[", "]", "faceDescriptorProperty", ")", "{", "String", "[", "]", "keys", "=", "getMessageKeys", "(", "contextId", ",", "fieldPath", ",", "faceDescriptorProperty", ")", ";", "return", "getMessageSourceAccessor", "(", ")", ".", "getMessage", "(", "new", "DefaultMessageSourceResolvable", "(", "keys", ",", "null", ",", "keys", "[", "0", "]", ")", ")", ";", "}" ]
Returns the value of the required property of the FieldFace. Delegates to the getMessageKeys for the message key generation strategy. This method uses </code>[contextId + "." + ] fieldPath [ + "." + faceDescriptorProperty[0]]</code> for the default value
[ "Returns", "the", "value", "of", "the", "required", "property", "of", "the", "FieldFace", ".", "Delegates", "to", "the", "getMessageKeys", "for", "the", "message", "key", "generation", "strategy", ".", "This", "method", "uses", "<", "/", "code", ">", "[", "contextId", "+", ".", "+", "]", "fieldPath", "[", "+", ".", "+", "faceDescriptorProperty", "[", "0", "]]", "<", "/", "code", ">", "for", "the", "default", "value" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/MessageSourceFieldFaceSource.java#L113-L116
rey5137/material
material/src/main/java/com/rey/material/app/DatePickerDialog.java
DatePickerDialog.dateRange
public DatePickerDialog dateRange(int minDay, int minMonth, int minYear, int maxDay, int maxMonth, int maxYear) { """ Set the range of selectable dates. @param minDay The day value of minimum date. @param minMonth The month value of minimum date. @param minYear The year value of minimum date. @param maxDay The day value of maximum date. @param maxMonth The month value of maximum date. @param maxYear The year value of maximum date. @return The DatePickerDialog for chaining methods. """ mDatePickerLayout.setDateRange(minDay, minMonth, minYear, maxDay, maxMonth, maxYear); return this; }
java
public DatePickerDialog dateRange(int minDay, int minMonth, int minYear, int maxDay, int maxMonth, int maxYear){ mDatePickerLayout.setDateRange(minDay, minMonth, minYear, maxDay, maxMonth, maxYear); return this; }
[ "public", "DatePickerDialog", "dateRange", "(", "int", "minDay", ",", "int", "minMonth", ",", "int", "minYear", ",", "int", "maxDay", ",", "int", "maxMonth", ",", "int", "maxYear", ")", "{", "mDatePickerLayout", ".", "setDateRange", "(", "minDay", ",", "minMonth", ",", "minYear", ",", "maxDay", ",", "maxMonth", ",", "maxYear", ")", ";", "return", "this", ";", "}" ]
Set the range of selectable dates. @param minDay The day value of minimum date. @param minMonth The month value of minimum date. @param minYear The year value of minimum date. @param maxDay The day value of maximum date. @param maxMonth The month value of maximum date. @param maxYear The year value of maximum date. @return The DatePickerDialog for chaining methods.
[ "Set", "the", "range", "of", "selectable", "dates", "." ]
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/DatePickerDialog.java#L103-L106
juebanlin/util4j
util4j/src/main/java/net/jueb/util4j/proxy/methodProxy/MethodHandleUtil.java
MethodHandleUtil.proxyMethod
public static MethodHandleProxy proxyMethod(Object target,String methodName,Object ...args) { """ 代理对象方法 会根据方法名和方法参数严格匹配 @param target 代理对象 @param methodName 对象方法名 @param args 对象方法参数 @return """ MethodHandle mh=findMethodHandle(target, methodName, args); if(mh!=null) { return new MethodHandleProxy(target, mh, args); } return null; }
java
public static MethodHandleProxy proxyMethod(Object target,String methodName,Object ...args) { MethodHandle mh=findMethodHandle(target, methodName, args); if(mh!=null) { return new MethodHandleProxy(target, mh, args); } return null; }
[ "public", "static", "MethodHandleProxy", "proxyMethod", "(", "Object", "target", ",", "String", "methodName", ",", "Object", "...", "args", ")", "{", "MethodHandle", "mh", "=", "findMethodHandle", "(", "target", ",", "methodName", ",", "args", ")", ";", "if", "(", "mh", "!=", "null", ")", "{", "return", "new", "MethodHandleProxy", "(", "target", ",", "mh", ",", "args", ")", ";", "}", "return", "null", ";", "}" ]
代理对象方法 会根据方法名和方法参数严格匹配 @param target 代理对象 @param methodName 对象方法名 @param args 对象方法参数 @return
[ "代理对象方法", "会根据方法名和方法参数严格匹配" ]
train
https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/proxy/methodProxy/MethodHandleUtil.java#L34-L42
tango-controls/JTango
server/src/main/java/org/tango/server/events/EventManager.java
EventManager.pushAttributeDataReadyEvent
public void pushAttributeDataReadyEvent(final String deviceName, final String attributeName, final int counter) throws DevFailed { """ fire event with AttDataReady @param deviceName Specified event device @param attributeName specified event attribute name @param counter a counter value @throws DevFailed """ xlogger.entry(); final String fullName = EventUtilities.buildEventName(deviceName, attributeName, EventType.DATA_READY_EVENT); final EventImpl eventImpl = getEventImpl(fullName); if (eventImpl != null) { for (ZMQ.Socket eventSocket : eventEndpoints.values()) { eventImpl.pushAttributeDataReadyEvent(counter, eventSocket); } } xlogger.exit(); }
java
public void pushAttributeDataReadyEvent(final String deviceName, final String attributeName, final int counter) throws DevFailed { xlogger.entry(); final String fullName = EventUtilities.buildEventName(deviceName, attributeName, EventType.DATA_READY_EVENT); final EventImpl eventImpl = getEventImpl(fullName); if (eventImpl != null) { for (ZMQ.Socket eventSocket : eventEndpoints.values()) { eventImpl.pushAttributeDataReadyEvent(counter, eventSocket); } } xlogger.exit(); }
[ "public", "void", "pushAttributeDataReadyEvent", "(", "final", "String", "deviceName", ",", "final", "String", "attributeName", ",", "final", "int", "counter", ")", "throws", "DevFailed", "{", "xlogger", ".", "entry", "(", ")", ";", "final", "String", "fullName", "=", "EventUtilities", ".", "buildEventName", "(", "deviceName", ",", "attributeName", ",", "EventType", ".", "DATA_READY_EVENT", ")", ";", "final", "EventImpl", "eventImpl", "=", "getEventImpl", "(", "fullName", ")", ";", "if", "(", "eventImpl", "!=", "null", ")", "{", "for", "(", "ZMQ", ".", "Socket", "eventSocket", ":", "eventEndpoints", ".", "values", "(", ")", ")", "{", "eventImpl", ".", "pushAttributeDataReadyEvent", "(", "counter", ",", "eventSocket", ")", ";", "}", "}", "xlogger", ".", "exit", "(", ")", ";", "}" ]
fire event with AttDataReady @param deviceName Specified event device @param attributeName specified event attribute name @param counter a counter value @throws DevFailed
[ "fire", "event", "with", "AttDataReady" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/events/EventManager.java#L543-L554
looly/hutool
hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java
SqlConnRunner.findAll
public List<Entity> findAll(Connection conn, String tableName) throws SQLException { """ 查询数据列表,返回所有字段 @param conn 数据库连接对象 @param tableName 表名 @return 数据对象列表 @throws SQLException SQL执行异常 """ return findAll(conn, Entity.create(tableName)); }
java
public List<Entity> findAll(Connection conn, String tableName) throws SQLException{ return findAll(conn, Entity.create(tableName)); }
[ "public", "List", "<", "Entity", ">", "findAll", "(", "Connection", "conn", ",", "String", "tableName", ")", "throws", "SQLException", "{", "return", "findAll", "(", "conn", ",", "Entity", ".", "create", "(", "tableName", ")", ")", ";", "}" ]
查询数据列表,返回所有字段 @param conn 数据库连接对象 @param tableName 表名 @return 数据对象列表 @throws SQLException SQL执行异常
[ "查询数据列表,返回所有字段" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L385-L387
nemerosa/ontrack
ontrack-extension-general/src/main/java/net/nemerosa/ontrack/extension/general/ReleasePropertyType.java
ReleasePropertyType.canEdit
@Override public boolean canEdit(ProjectEntity entity, SecurityService securityService) { """ If one can promote a build, he can also attach a release label to a build. """ return securityService.isProjectFunctionGranted(entity, PromotionRunCreate.class); }
java
@Override public boolean canEdit(ProjectEntity entity, SecurityService securityService) { return securityService.isProjectFunctionGranted(entity, PromotionRunCreate.class); }
[ "@", "Override", "public", "boolean", "canEdit", "(", "ProjectEntity", "entity", ",", "SecurityService", "securityService", ")", "{", "return", "securityService", ".", "isProjectFunctionGranted", "(", "entity", ",", "PromotionRunCreate", ".", "class", ")", ";", "}" ]
If one can promote a build, he can also attach a release label to a build.
[ "If", "one", "can", "promote", "a", "build", "he", "can", "also", "attach", "a", "release", "label", "to", "a", "build", "." ]
train
https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-extension-general/src/main/java/net/nemerosa/ontrack/extension/general/ReleasePropertyType.java#L48-L51
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java
FieldDescriptorConstraints.checkAnonymous
private void checkAnonymous(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException { """ Checks anonymous fields. @param fieldDef The field descriptor @param checkLevel The current check level (this constraint is checked in basic and strict) @exception ConstraintException If the constraint has been violated """ if (CHECKLEVEL_NONE.equals(checkLevel)) { return; } String access = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ACCESS); if (!"anonymous".equals(access)) { throw new ConstraintException("The access property of the field "+fieldDef.getName()+" defined in class "+fieldDef.getOwner().getName()+" cannot be changed"); } if ((fieldDef.getName() == null) || (fieldDef.getName().length() == 0)) { throw new ConstraintException("An anonymous field defined in class "+fieldDef.getOwner().getName()+" has no name"); } }
java
private void checkAnonymous(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException { if (CHECKLEVEL_NONE.equals(checkLevel)) { return; } String access = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ACCESS); if (!"anonymous".equals(access)) { throw new ConstraintException("The access property of the field "+fieldDef.getName()+" defined in class "+fieldDef.getOwner().getName()+" cannot be changed"); } if ((fieldDef.getName() == null) || (fieldDef.getName().length() == 0)) { throw new ConstraintException("An anonymous field defined in class "+fieldDef.getOwner().getName()+" has no name"); } }
[ "private", "void", "checkAnonymous", "(", "FieldDescriptorDef", "fieldDef", ",", "String", "checkLevel", ")", "throws", "ConstraintException", "{", "if", "(", "CHECKLEVEL_NONE", ".", "equals", "(", "checkLevel", ")", ")", "{", "return", ";", "}", "String", "access", "=", "fieldDef", ".", "getProperty", "(", "PropertyHelper", ".", "OJB_PROPERTY_ACCESS", ")", ";", "if", "(", "!", "\"anonymous\"", ".", "equals", "(", "access", ")", ")", "{", "throw", "new", "ConstraintException", "(", "\"The access property of the field \"", "+", "fieldDef", ".", "getName", "(", ")", "+", "\" defined in class \"", "+", "fieldDef", ".", "getOwner", "(", ")", ".", "getName", "(", ")", "+", "\" cannot be changed\"", ")", ";", "}", "if", "(", "(", "fieldDef", ".", "getName", "(", ")", "==", "null", ")", "||", "(", "fieldDef", ".", "getName", "(", ")", ".", "length", "(", ")", "==", "0", ")", ")", "{", "throw", "new", "ConstraintException", "(", "\"An anonymous field defined in class \"", "+", "fieldDef", ".", "getOwner", "(", ")", ".", "getName", "(", ")", "+", "\" has no name\"", ")", ";", "}", "}" ]
Checks anonymous fields. @param fieldDef The field descriptor @param checkLevel The current check level (this constraint is checked in basic and strict) @exception ConstraintException If the constraint has been violated
[ "Checks", "anonymous", "fields", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java#L420-L438
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/TileCollidableModel.java
TileCollidableModel.onCollided
private void onCollided(CollisionResult result, CollisionCategory category) { """ Called when a collision occurred on a specified axis. @param result The result reference. @param category The collision category reference. """ for (final TileCollidableListener listener : listeners) { listener.notifyTileCollided(result, category); } }
java
private void onCollided(CollisionResult result, CollisionCategory category) { for (final TileCollidableListener listener : listeners) { listener.notifyTileCollided(result, category); } }
[ "private", "void", "onCollided", "(", "CollisionResult", "result", ",", "CollisionCategory", "category", ")", "{", "for", "(", "final", "TileCollidableListener", "listener", ":", "listeners", ")", "{", "listener", ".", "notifyTileCollided", "(", "result", ",", "category", ")", ";", "}", "}" ]
Called when a collision occurred on a specified axis. @param result The result reference. @param category The collision category reference.
[ "Called", "when", "a", "collision", "occurred", "on", "a", "specified", "axis", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/TileCollidableModel.java#L114-L120
apache/incubator-heron
heron/scheduler-core/src/java/org/apache/heron/scheduler/dryrun/FormatterUtils.java
FormatterUtils.percentageChange
public static Optional<Cell> percentageChange(double oldAmount, double newAmount) { """ Format new amount associated with change in percentage For example, with {@code oldAmount = 2} and {@code newAmount = 1} the result Cell is " -50.00%" (in red color) @param oldAmount old resource usage @param newAmount new resource usage @return formatted chagne in percentage if oldAmount and newAmount differ """ double delta = newAmount - oldAmount; double percentage = delta / oldAmount * 100.0; if (percentage == 0.0) { return Optional.absent(); } else { String sign = ""; if (percentage > 0.0) { sign = "+"; } Cell cell = new Cell(String.format("%s%.2f%%", sign, percentage)); // set color to red if percentage drops, to green if percentage increases if ("".equals(sign)) { cell.setColor(TextColor.RED); } else { cell.setColor(TextColor.GREEN); } return Optional.of(cell); } }
java
public static Optional<Cell> percentageChange(double oldAmount, double newAmount) { double delta = newAmount - oldAmount; double percentage = delta / oldAmount * 100.0; if (percentage == 0.0) { return Optional.absent(); } else { String sign = ""; if (percentage > 0.0) { sign = "+"; } Cell cell = new Cell(String.format("%s%.2f%%", sign, percentage)); // set color to red if percentage drops, to green if percentage increases if ("".equals(sign)) { cell.setColor(TextColor.RED); } else { cell.setColor(TextColor.GREEN); } return Optional.of(cell); } }
[ "public", "static", "Optional", "<", "Cell", ">", "percentageChange", "(", "double", "oldAmount", ",", "double", "newAmount", ")", "{", "double", "delta", "=", "newAmount", "-", "oldAmount", ";", "double", "percentage", "=", "delta", "/", "oldAmount", "*", "100.0", ";", "if", "(", "percentage", "==", "0.0", ")", "{", "return", "Optional", ".", "absent", "(", ")", ";", "}", "else", "{", "String", "sign", "=", "\"\"", ";", "if", "(", "percentage", ">", "0.0", ")", "{", "sign", "=", "\"+\"", ";", "}", "Cell", "cell", "=", "new", "Cell", "(", "String", ".", "format", "(", "\"%s%.2f%%\"", ",", "sign", ",", "percentage", ")", ")", ";", "// set color to red if percentage drops, to green if percentage increases", "if", "(", "\"\"", ".", "equals", "(", "sign", ")", ")", "{", "cell", ".", "setColor", "(", "TextColor", ".", "RED", ")", ";", "}", "else", "{", "cell", ".", "setColor", "(", "TextColor", ".", "GREEN", ")", ";", "}", "return", "Optional", ".", "of", "(", "cell", ")", ";", "}", "}" ]
Format new amount associated with change in percentage For example, with {@code oldAmount = 2} and {@code newAmount = 1} the result Cell is " -50.00%" (in red color) @param oldAmount old resource usage @param newAmount new resource usage @return formatted chagne in percentage if oldAmount and newAmount differ
[ "Format", "new", "amount", "associated", "with", "change", "in", "percentage", "For", "example", "with", "{" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/dryrun/FormatterUtils.java#L428-L447
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/enhance/GEnhanceImageOps.java
GEnhanceImageOps.applyTransform
public static <T extends ImageGray<T>> void applyTransform( T input , int transform[] , int minValue , T output ) { """ Applies the transformation table to the provided input image. @param input Input image. @param transform Input transformation table. @param minValue Minimum possible pixel value. @param output Output image. """ InputSanityCheck.checkSameShape(input, output); if( input instanceof GrayU8) { EnhanceImageOps.applyTransform((GrayU8) input, transform, (GrayU8) output); } else if( input instanceof GrayS8) { EnhanceImageOps.applyTransform((GrayS8)input,transform,minValue,(GrayS8)output); } else if( input instanceof GrayU16) { EnhanceImageOps.applyTransform((GrayU16)input,transform,(GrayU16)output); } else if( input instanceof GrayS16) { EnhanceImageOps.applyTransform((GrayS16)input,transform,minValue,(GrayS16)output); } else if( input instanceof GrayS32) { EnhanceImageOps.applyTransform((GrayS32)input,transform,minValue,(GrayS32)output); } else { throw new IllegalArgumentException("Image type not supported. "+input.getClass().getSimpleName()); } }
java
public static <T extends ImageGray<T>> void applyTransform( T input , int transform[] , int minValue , T output ) { InputSanityCheck.checkSameShape(input, output); if( input instanceof GrayU8) { EnhanceImageOps.applyTransform((GrayU8) input, transform, (GrayU8) output); } else if( input instanceof GrayS8) { EnhanceImageOps.applyTransform((GrayS8)input,transform,minValue,(GrayS8)output); } else if( input instanceof GrayU16) { EnhanceImageOps.applyTransform((GrayU16)input,transform,(GrayU16)output); } else if( input instanceof GrayS16) { EnhanceImageOps.applyTransform((GrayS16)input,transform,minValue,(GrayS16)output); } else if( input instanceof GrayS32) { EnhanceImageOps.applyTransform((GrayS32)input,transform,minValue,(GrayS32)output); } else { throw new IllegalArgumentException("Image type not supported. "+input.getClass().getSimpleName()); } }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "void", "applyTransform", "(", "T", "input", ",", "int", "transform", "[", "]", ",", "int", "minValue", ",", "T", "output", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "input", ",", "output", ")", ";", "if", "(", "input", "instanceof", "GrayU8", ")", "{", "EnhanceImageOps", ".", "applyTransform", "(", "(", "GrayU8", ")", "input", ",", "transform", ",", "(", "GrayU8", ")", "output", ")", ";", "}", "else", "if", "(", "input", "instanceof", "GrayS8", ")", "{", "EnhanceImageOps", ".", "applyTransform", "(", "(", "GrayS8", ")", "input", ",", "transform", ",", "minValue", ",", "(", "GrayS8", ")", "output", ")", ";", "}", "else", "if", "(", "input", "instanceof", "GrayU16", ")", "{", "EnhanceImageOps", ".", "applyTransform", "(", "(", "GrayU16", ")", "input", ",", "transform", ",", "(", "GrayU16", ")", "output", ")", ";", "}", "else", "if", "(", "input", "instanceof", "GrayS16", ")", "{", "EnhanceImageOps", ".", "applyTransform", "(", "(", "GrayS16", ")", "input", ",", "transform", ",", "minValue", ",", "(", "GrayS16", ")", "output", ")", ";", "}", "else", "if", "(", "input", "instanceof", "GrayS32", ")", "{", "EnhanceImageOps", ".", "applyTransform", "(", "(", "GrayS32", ")", "input", ",", "transform", ",", "minValue", ",", "(", "GrayS32", ")", "output", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Image type not supported. \"", "+", "input", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "}", "}" ]
Applies the transformation table to the provided input image. @param input Input image. @param transform Input transformation table. @param minValue Minimum possible pixel value. @param output Output image.
[ "Applies", "the", "transformation", "table", "to", "the", "provided", "input", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/enhance/GEnhanceImageOps.java#L39-L56
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java
NetworkInterfacesInner.updateTagsAsync
public Observable<NetworkInterfaceInner> updateTagsAsync(String resourceGroupName, String networkInterfaceName, Map<String, String> tags) { """ Updates a network interface tags. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateTagsWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tags).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() { @Override public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) { return response.body(); } }); }
java
public Observable<NetworkInterfaceInner> updateTagsAsync(String resourceGroupName, String networkInterfaceName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tags).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() { @Override public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NetworkInterfaceInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "networkInterfaceName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkInterfaceName", ",", "tags", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "NetworkInterfaceInner", ">", ",", "NetworkInterfaceInner", ">", "(", ")", "{", "@", "Override", "public", "NetworkInterfaceInner", "call", "(", "ServiceResponse", "<", "NetworkInterfaceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates a network interface tags. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "network", "interface", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L757-L764