repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
sequencelengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
sequencelengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplFloat_CustomFieldSerializer.java
OWLLiteralImplFloat_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplFloat instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplFloat instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLLiteralImplFloat", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplFloat_CustomFieldSerializer.java#L66-L69
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendBinary
public static <T> void sendBinary(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) { sendInternal(pooledData, WebSocketFrameType.BINARY, wsChannel, callback, context, -1); }
java
public static <T> void sendBinary(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) { sendInternal(pooledData, WebSocketFrameType.BINARY, wsChannel, callback, context, -1); }
[ "public", "static", "<", "T", ">", "void", "sendBinary", "(", "final", "PooledByteBuffer", "pooledData", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "T", ">", "callback", ",", "T", "context", ")", "{", "sendInternal", "(", "pooledData", ",", "WebSocketFrameType", ".", "BINARY", ",", "wsChannel", ",", "callback", ",", "context", ",", "-", "1", ")", ";", "}" ]
Sends a complete binary message, invoking the callback when complete Automatically frees the pooled byte buffer when done. @param pooledData The data to send, it will be freed when done @param wsChannel The web socket channel @param callback The callback to invoke on completion @param context The context object that will be passed to the callback on completion
[ "Sends", "a", "complete", "binary", "message", "invoking", "the", "callback", "when", "complete", "Automatically", "frees", "the", "pooled", "byte", "buffer", "when", "done", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L699-L701
hawkular/hawkular-apm
client/collector/src/main/java/org/hawkular/apm/client/collector/internal/DefaultTraceCollector.java
DefaultTraceCollector.processInContent
protected void processInContent(String location, FragmentBuilder builder, int hashCode) { if (builder.isInBufferActive(hashCode)) { processIn(location, null, builder.getInData(hashCode)); } else if (log.isLoggable(Level.FINEST)) { log.finest("processInContent: location=[" + location + "] hashCode=" + hashCode + " in buffer is not active"); } }
java
protected void processInContent(String location, FragmentBuilder builder, int hashCode) { if (builder.isInBufferActive(hashCode)) { processIn(location, null, builder.getInData(hashCode)); } else if (log.isLoggable(Level.FINEST)) { log.finest("processInContent: location=[" + location + "] hashCode=" + hashCode + " in buffer is not active"); } }
[ "protected", "void", "processInContent", "(", "String", "location", ",", "FragmentBuilder", "builder", ",", "int", "hashCode", ")", "{", "if", "(", "builder", ".", "isInBufferActive", "(", "hashCode", ")", ")", "{", "processIn", "(", "location", ",", "null", ",", "builder", ".", "getInData", "(", "hashCode", ")", ")", ";", "}", "else", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINEST", ")", ")", "{", "log", ".", "finest", "(", "\"processInContent: location=[\"", "+", "location", "+", "\"] hashCode=\"", "+", "hashCode", "+", "\" in buffer is not active\"", ")", ";", "}", "}" ]
This method processes the in content if available. @param location The instrumentation location @param builder The builder @param hashCode The hash code, or -1 to ignore the hash code
[ "This", "method", "processes", "the", "in", "content", "if", "available", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/DefaultTraceCollector.java#L894-L901
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java
AbstractRadial.createSection3DEffectGradient
protected RadialGradientPaint createSection3DEffectGradient(final int WIDTH, final float RADIUS_FACTOR) { final float[] FRACTIONS; final Color[] COLORS; if (isExpandedSectionsEnabled()) { FRACTIONS = new float[]{ 0.0f, 0.7f, 0.75f, 0.96f, 1.0f }; COLORS = new Color[]{ new Color(0.0f, 0.0f, 0.0f, 1.0f), new Color(0.9f, 0.9f, 0.9f, 0.2f), new Color(1.0f, 1.0f, 1.0f, 0.5f), new Color(0.1843137255f, 0.1843137255f, 0.1843137255f, 0.3f), new Color(0.0f, 0.0f, 0.0f, 0.2f) }; } else { FRACTIONS = new float[]{ 0.0f, 0.89f, 0.955f, 1.0f }; COLORS = new Color[]{ new Color(0.0f, 0.0f, 0.0f, 0.0f), new Color(0.0f, 0.0f, 0.0f, 0.3f), new Color(1.0f, 1.0f, 1.0f, 0.6f), new Color(0.0f, 0.0f, 0.0f, 0.4f) }; } final Point2D GRADIENT_CENTER = new Point2D.Double(WIDTH / 2.0, WIDTH / 2.0); return new RadialGradientPaint(GRADIENT_CENTER, WIDTH * RADIUS_FACTOR, FRACTIONS, COLORS); }
java
protected RadialGradientPaint createSection3DEffectGradient(final int WIDTH, final float RADIUS_FACTOR) { final float[] FRACTIONS; final Color[] COLORS; if (isExpandedSectionsEnabled()) { FRACTIONS = new float[]{ 0.0f, 0.7f, 0.75f, 0.96f, 1.0f }; COLORS = new Color[]{ new Color(0.0f, 0.0f, 0.0f, 1.0f), new Color(0.9f, 0.9f, 0.9f, 0.2f), new Color(1.0f, 1.0f, 1.0f, 0.5f), new Color(0.1843137255f, 0.1843137255f, 0.1843137255f, 0.3f), new Color(0.0f, 0.0f, 0.0f, 0.2f) }; } else { FRACTIONS = new float[]{ 0.0f, 0.89f, 0.955f, 1.0f }; COLORS = new Color[]{ new Color(0.0f, 0.0f, 0.0f, 0.0f), new Color(0.0f, 0.0f, 0.0f, 0.3f), new Color(1.0f, 1.0f, 1.0f, 0.6f), new Color(0.0f, 0.0f, 0.0f, 0.4f) }; } final Point2D GRADIENT_CENTER = new Point2D.Double(WIDTH / 2.0, WIDTH / 2.0); return new RadialGradientPaint(GRADIENT_CENTER, WIDTH * RADIUS_FACTOR, FRACTIONS, COLORS); }
[ "protected", "RadialGradientPaint", "createSection3DEffectGradient", "(", "final", "int", "WIDTH", ",", "final", "float", "RADIUS_FACTOR", ")", "{", "final", "float", "[", "]", "FRACTIONS", ";", "final", "Color", "[", "]", "COLORS", ";", "if", "(", "isExpandedSectionsEnabled", "(", ")", ")", "{", "FRACTIONS", "=", "new", "float", "[", "]", "{", "0.0f", ",", "0.7f", ",", "0.75f", ",", "0.96f", ",", "1.0f", "}", ";", "COLORS", "=", "new", "Color", "[", "]", "{", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "1.0f", ")", ",", "new", "Color", "(", "0.9f", ",", "0.9f", ",", "0.9f", ",", "0.2f", ")", ",", "new", "Color", "(", "1.0f", ",", "1.0f", ",", "1.0f", ",", "0.5f", ")", ",", "new", "Color", "(", "0.1843137255f", ",", "0.1843137255f", ",", "0.1843137255f", ",", "0.3f", ")", ",", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.2f", ")", "}", ";", "}", "else", "{", "FRACTIONS", "=", "new", "float", "[", "]", "{", "0.0f", ",", "0.89f", ",", "0.955f", ",", "1.0f", "}", ";", "COLORS", "=", "new", "Color", "[", "]", "{", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.0f", ")", ",", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.3f", ")", ",", "new", "Color", "(", "1.0f", ",", "1.0f", ",", "1.0f", ",", "0.6f", ")", ",", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.4f", ")", "}", ";", "}", "final", "Point2D", "GRADIENT_CENTER", "=", "new", "Point2D", ".", "Double", "(", "WIDTH", "/", "2.0", ",", "WIDTH", "/", "2.0", ")", ";", "return", "new", "RadialGradientPaint", "(", "GRADIENT_CENTER", ",", "WIDTH", "*", "RADIUS_FACTOR", ",", "FRACTIONS", ",", "COLORS", ")", ";", "}" ]
Returns a radial gradient paint that will be used as overlay for the track or section image to achieve some kind of a 3d effect. @param WIDTH @param RADIUS_FACTOR : 0.38f for the standard radial gauge @return a radial gradient paint that will be used as overlay for the track or section image
[ "Returns", "a", "radial", "gradient", "paint", "that", "will", "be", "used", "as", "overlay", "for", "the", "track", "or", "section", "image", "to", "achieve", "some", "kind", "of", "a", "3d", "effect", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L1189-L1229
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java
VirtualNetworkPeeringsInner.createOrUpdateAsync
public Observable<VirtualNetworkPeeringInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, VirtualNetworkPeeringInner virtualNetworkPeeringParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters).map(new Func1<ServiceResponse<VirtualNetworkPeeringInner>, VirtualNetworkPeeringInner>() { @Override public VirtualNetworkPeeringInner call(ServiceResponse<VirtualNetworkPeeringInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkPeeringInner> createOrUpdateAsync(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, VirtualNetworkPeeringInner virtualNetworkPeeringParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters).map(new Func1<ServiceResponse<VirtualNetworkPeeringInner>, VirtualNetworkPeeringInner>() { @Override public VirtualNetworkPeeringInner call(ServiceResponse<VirtualNetworkPeeringInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkPeeringInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkName", ",", "String", "virtualNetworkPeeringName", ",", "VirtualNetworkPeeringInner", "virtualNetworkPeeringParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkName", ",", "virtualNetworkPeeringName", ",", "virtualNetworkPeeringParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkPeeringInner", ">", ",", "VirtualNetworkPeeringInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkPeeringInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkPeeringInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a peering in the specified virtual network. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param virtualNetworkPeeringName The name of the peering. @param virtualNetworkPeeringParameters Parameters supplied to the create or update virtual network peering operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "peering", "in", "the", "specified", "virtual", "network", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java#L391-L398
grails/grails-core
grails-spring/src/main/groovy/grails/spring/BeanBuilder.java
BeanBuilder.xmlns
public void xmlns(Map<String, String> definition) { Assert.notNull(namespaceHandlerResolver, "You cannot define a Spring namespace without a [namespaceHandlerResolver] set"); if (definition.isEmpty()) { return; } for (Map.Entry<String, String> entry : definition.entrySet()) { String namespace = entry.getKey(); String uri = entry.getValue() == null ? null : entry.getValue(); Assert.notNull(uri, "Namespace definition cannot supply a null URI"); final NamespaceHandler namespaceHandler = namespaceHandlerResolver.resolve(uri); if (namespaceHandler == null) { throw new BeanDefinitionParsingException( new Problem("No namespace handler found for URI: " + uri, new Location(readerContext.getResource()))); } namespaceHandlers.put(namespace, namespaceHandler); namespaces.put(namespace, uri); } }
java
public void xmlns(Map<String, String> definition) { Assert.notNull(namespaceHandlerResolver, "You cannot define a Spring namespace without a [namespaceHandlerResolver] set"); if (definition.isEmpty()) { return; } for (Map.Entry<String, String> entry : definition.entrySet()) { String namespace = entry.getKey(); String uri = entry.getValue() == null ? null : entry.getValue(); Assert.notNull(uri, "Namespace definition cannot supply a null URI"); final NamespaceHandler namespaceHandler = namespaceHandlerResolver.resolve(uri); if (namespaceHandler == null) { throw new BeanDefinitionParsingException( new Problem("No namespace handler found for URI: " + uri, new Location(readerContext.getResource()))); } namespaceHandlers.put(namespace, namespaceHandler); namespaces.put(namespace, uri); } }
[ "public", "void", "xmlns", "(", "Map", "<", "String", ",", "String", ">", "definition", ")", "{", "Assert", ".", "notNull", "(", "namespaceHandlerResolver", ",", "\"You cannot define a Spring namespace without a [namespaceHandlerResolver] set\"", ")", ";", "if", "(", "definition", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "definition", ".", "entrySet", "(", ")", ")", "{", "String", "namespace", "=", "entry", ".", "getKey", "(", ")", ";", "String", "uri", "=", "entry", ".", "getValue", "(", ")", "==", "null", "?", "null", ":", "entry", ".", "getValue", "(", ")", ";", "Assert", ".", "notNull", "(", "uri", ",", "\"Namespace definition cannot supply a null URI\"", ")", ";", "final", "NamespaceHandler", "namespaceHandler", "=", "namespaceHandlerResolver", ".", "resolve", "(", "uri", ")", ";", "if", "(", "namespaceHandler", "==", "null", ")", "{", "throw", "new", "BeanDefinitionParsingException", "(", "new", "Problem", "(", "\"No namespace handler found for URI: \"", "+", "uri", ",", "new", "Location", "(", "readerContext", ".", "getResource", "(", ")", ")", ")", ")", ";", "}", "namespaceHandlers", ".", "put", "(", "namespace", ",", "namespaceHandler", ")", ";", "namespaces", ".", "put", "(", "namespace", ",", "uri", ")", ";", "}", "}" ]
Defines a Spring namespace definition to use. @param definition The definition
[ "Defines", "a", "Spring", "namespace", "definition", "to", "use", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-spring/src/main/groovy/grails/spring/BeanBuilder.java#L220-L241
facebook/fresco
drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java
RoundedDrawable.setBorder
@Override public void setBorder(int color, float width) { if (mBorderColor != color || mBorderWidth != width) { mBorderColor = color; mBorderWidth = width; mIsPathDirty = true; invalidateSelf(); } }
java
@Override public void setBorder(int color, float width) { if (mBorderColor != color || mBorderWidth != width) { mBorderColor = color; mBorderWidth = width; mIsPathDirty = true; invalidateSelf(); } }
[ "@", "Override", "public", "void", "setBorder", "(", "int", "color", ",", "float", "width", ")", "{", "if", "(", "mBorderColor", "!=", "color", "||", "mBorderWidth", "!=", "width", ")", "{", "mBorderColor", "=", "color", ";", "mBorderWidth", "=", "width", ";", "mIsPathDirty", "=", "true", ";", "invalidateSelf", "(", ")", ";", "}", "}" ]
Sets the border @param color of the border @param width of the border
[ "Sets", "the", "border" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java#L144-L152
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/extraction/AbstractExtractor.java
AbstractExtractor.toStringFunction
public T toStringFunction(@NonNull SerializableFunction<HString, String> toStringFunction) { this.toStringFunction = toStringFunction; return Cast.as(this); }
java
public T toStringFunction(@NonNull SerializableFunction<HString, String> toStringFunction) { this.toStringFunction = toStringFunction; return Cast.as(this); }
[ "public", "T", "toStringFunction", "(", "@", "NonNull", "SerializableFunction", "<", "HString", ",", "String", ">", "toStringFunction", ")", "{", "this", ".", "toStringFunction", "=", "toStringFunction", ";", "return", "Cast", ".", "as", "(", "this", ")", ";", "}" ]
To string function t. @param toStringFunction the to string function @return the t
[ "To", "string", "function", "t", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/extraction/AbstractExtractor.java#L202-L205
republicofgavin/PauseResumeAudioRecorder
library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java
PauseResumeAudioRecorder.setAudioFile
public void setAudioFile(final String audioFilePath){ if (audioFilePath==null || audioFilePath.trim().isEmpty()){ throw new IllegalArgumentException("audioFile cannot be null, empty, blank, or directory"); } else if (currentAudioState.get()!=PREPARED_STATE && currentAudioState.get()!=INITIALIZED_STATE ){ throw new IllegalStateException("Recorder cannot have its file changed when it is not in an initialized or prepared state"); } String modifiedAudioFilePath=audioFilePath; if (modifiedAudioFilePath.toLowerCase(Locale.getDefault()).contains(".")){ final String subString=modifiedAudioFilePath.substring(modifiedAudioFilePath.lastIndexOf(".")); modifiedAudioFilePath=modifiedAudioFilePath.replace(subString,".temp"); } else { modifiedAudioFilePath=modifiedAudioFilePath+".temp"; } this.audioFile=modifiedAudioFilePath; currentAudioState.getAndSet(PREPARED_STATE); }
java
public void setAudioFile(final String audioFilePath){ if (audioFilePath==null || audioFilePath.trim().isEmpty()){ throw new IllegalArgumentException("audioFile cannot be null, empty, blank, or directory"); } else if (currentAudioState.get()!=PREPARED_STATE && currentAudioState.get()!=INITIALIZED_STATE ){ throw new IllegalStateException("Recorder cannot have its file changed when it is not in an initialized or prepared state"); } String modifiedAudioFilePath=audioFilePath; if (modifiedAudioFilePath.toLowerCase(Locale.getDefault()).contains(".")){ final String subString=modifiedAudioFilePath.substring(modifiedAudioFilePath.lastIndexOf(".")); modifiedAudioFilePath=modifiedAudioFilePath.replace(subString,".temp"); } else { modifiedAudioFilePath=modifiedAudioFilePath+".temp"; } this.audioFile=modifiedAudioFilePath; currentAudioState.getAndSet(PREPARED_STATE); }
[ "public", "void", "setAudioFile", "(", "final", "String", "audioFilePath", ")", "{", "if", "(", "audioFilePath", "==", "null", "||", "audioFilePath", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"audioFile cannot be null, empty, blank, or directory\"", ")", ";", "}", "else", "if", "(", "currentAudioState", ".", "get", "(", ")", "!=", "PREPARED_STATE", "&&", "currentAudioState", ".", "get", "(", ")", "!=", "INITIALIZED_STATE", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Recorder cannot have its file changed when it is not in an initialized or prepared state\"", ")", ";", "}", "String", "modifiedAudioFilePath", "=", "audioFilePath", ";", "if", "(", "modifiedAudioFilePath", ".", "toLowerCase", "(", "Locale", ".", "getDefault", "(", ")", ")", ".", "contains", "(", "\".\"", ")", ")", "{", "final", "String", "subString", "=", "modifiedAudioFilePath", ".", "substring", "(", "modifiedAudioFilePath", ".", "lastIndexOf", "(", "\".\"", ")", ")", ";", "modifiedAudioFilePath", "=", "modifiedAudioFilePath", ".", "replace", "(", "subString", ",", "\".temp\"", ")", ";", "}", "else", "{", "modifiedAudioFilePath", "=", "modifiedAudioFilePath", "+", "\".temp\"", ";", "}", "this", ".", "audioFile", "=", "modifiedAudioFilePath", ";", "currentAudioState", ".", "getAndSet", "(", "PREPARED_STATE", ")", ";", "}" ]
Setter for the audioFile. If the file does not contain a .wav suffix, it will be added. If the file has a suffix other than .wav, it will be removed. This API puts it in the prepared state. NOTE: The .wav file does not exist until the stop recording (and subsequent conversion) is completed. Where the data is stored temporarily is the same path and name just with .temp instead of .wav. @param audioFilePath A fully qualified file path for the audio file to be stored. The file path should exist and the file should not, errors can occur during writing. @throws IllegalArgumentException if the parameter is null, empty, blank. @throws IllegalStateException If the API is called while the recorder is not initialized or prepared.
[ "Setter", "for", "the", "audioFile", ".", "If", "the", "file", "does", "not", "contain", "a", ".", "wav", "suffix", "it", "will", "be", "added", ".", "If", "the", "file", "has", "a", "suffix", "other", "than", ".", "wav", "it", "will", "be", "removed", ".", "This", "API", "puts", "it", "in", "the", "prepared", "state", ".", "NOTE", ":", "The", ".", "wav", "file", "does", "not", "exist", "until", "the", "stop", "recording", "(", "and", "subsequent", "conversion", ")", "is", "completed", ".", "Where", "the", "data", "is", "stored", "temporarily", "is", "the", "same", "path", "and", "name", "just", "with", ".", "temp", "instead", "of", ".", "wav", "." ]
train
https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L159-L176
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XScreenField.java
XScreenField.printInputControl
public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, String strFieldType) { out.println(" <xfm:" + strControlType + " xform=\"form1\" ref=\"" + strFieldName + "\" cols=\"" + strSize + "\" type=\"" + strFieldType + "\">"); out.println(" <xfm:caption>" + strFieldDesc + "</xfm:caption>"); out.println(" </xfm:" + strControlType + ">"); }
java
public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, String strFieldType) { out.println(" <xfm:" + strControlType + " xform=\"form1\" ref=\"" + strFieldName + "\" cols=\"" + strSize + "\" type=\"" + strFieldType + "\">"); out.println(" <xfm:caption>" + strFieldDesc + "</xfm:caption>"); out.println(" </xfm:" + strControlType + ">"); }
[ "public", "void", "printInputControl", "(", "PrintWriter", "out", ",", "String", "strFieldDesc", ",", "String", "strFieldName", ",", "String", "strSize", ",", "String", "strMaxSize", ",", "String", "strValue", ",", "String", "strControlType", ",", "String", "strFieldType", ")", "{", "out", ".", "println", "(", "\" <xfm:\"", "+", "strControlType", "+", "\" xform=\\\"form1\\\" ref=\\\"\"", "+", "strFieldName", "+", "\"\\\" cols=\\\"\"", "+", "strSize", "+", "\"\\\" type=\\\"\"", "+", "strFieldType", "+", "\"\\\">\"", ")", ";", "out", ".", "println", "(", "\" <xfm:caption>\"", "+", "strFieldDesc", "+", "\"</xfm:caption>\"", ")", ";", "out", ".", "println", "(", "\" </xfm:\"", "+", "strControlType", "+", "\">\"", ")", ";", "}" ]
Display this field in XML input format. @param strFieldType The field type
[ "Display", "this", "field", "in", "XML", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XScreenField.java#L147-L152
liferay/com-liferay-commerce
commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java
CommerceTaxFixedRateAddressRelPersistenceImpl.findAll
@Override public List<CommerceTaxFixedRateAddressRel> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceTaxFixedRateAddressRel> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceTaxFixedRateAddressRel", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce tax fixed rate address rels. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceTaxFixedRateAddressRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce tax fixed rate address rels @param end the upper bound of the range of commerce tax fixed rate address rels (not inclusive) @return the range of commerce tax fixed rate address rels
[ "Returns", "a", "range", "of", "all", "the", "commerce", "tax", "fixed", "rate", "address", "rels", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java#L1737-L1740
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSegment.java
IPv6AddressSegment.getSplitSegments
public <S extends AddressSegment> void getSplitSegments(S segs[], int index, AddressSegmentCreator<S> creator) { if(!isMultiple()) { int bitSizeSplit = IPv6Address.BITS_PER_SEGMENT >>> 1; Integer myPrefix = getSegmentPrefixLength(); Integer highPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 0); Integer lowPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 1); if(index >= 0 && index < segs.length) { segs[index] = creator.createSegment(highByte(), highPrefixBits); } if(++index >= 0 && index < segs.length) { segs[index] = creator.createSegment(lowByte(), lowPrefixBits); } } else { getSplitSegmentsMultiple(segs, index, creator); } }
java
public <S extends AddressSegment> void getSplitSegments(S segs[], int index, AddressSegmentCreator<S> creator) { if(!isMultiple()) { int bitSizeSplit = IPv6Address.BITS_PER_SEGMENT >>> 1; Integer myPrefix = getSegmentPrefixLength(); Integer highPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 0); Integer lowPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 1); if(index >= 0 && index < segs.length) { segs[index] = creator.createSegment(highByte(), highPrefixBits); } if(++index >= 0 && index < segs.length) { segs[index] = creator.createSegment(lowByte(), lowPrefixBits); } } else { getSplitSegmentsMultiple(segs, index, creator); } }
[ "public", "<", "S", "extends", "AddressSegment", ">", "void", "getSplitSegments", "(", "S", "segs", "[", "]", ",", "int", "index", ",", "AddressSegmentCreator", "<", "S", ">", "creator", ")", "{", "if", "(", "!", "isMultiple", "(", ")", ")", "{", "int", "bitSizeSplit", "=", "IPv6Address", ".", "BITS_PER_SEGMENT", ">>>", "1", ";", "Integer", "myPrefix", "=", "getSegmentPrefixLength", "(", ")", ";", "Integer", "highPrefixBits", "=", "getSplitSegmentPrefix", "(", "bitSizeSplit", ",", "myPrefix", ",", "0", ")", ";", "Integer", "lowPrefixBits", "=", "getSplitSegmentPrefix", "(", "bitSizeSplit", ",", "myPrefix", ",", "1", ")", ";", "if", "(", "index", ">=", "0", "&&", "index", "<", "segs", ".", "length", ")", "{", "segs", "[", "index", "]", "=", "creator", ".", "createSegment", "(", "highByte", "(", ")", ",", "highPrefixBits", ")", ";", "}", "if", "(", "++", "index", ">=", "0", "&&", "index", "<", "segs", ".", "length", ")", "{", "segs", "[", "index", "]", "=", "creator", ".", "createSegment", "(", "lowByte", "(", ")", ",", "lowPrefixBits", ")", ";", "}", "}", "else", "{", "getSplitSegmentsMultiple", "(", "segs", ",", "index", ",", "creator", ")", ";", "}", "}" ]
Converts this IPv6 address segment into smaller segments, copying them into the given array starting at the given index. If a segment does not fit into the array because the segment index in the array is out of bounds of the array, then it is not copied. @param segs @param index
[ "Converts", "this", "IPv6", "address", "segment", "into", "smaller", "segments", "copying", "them", "into", "the", "given", "array", "starting", "at", "the", "given", "index", "." ]
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSegment.java#L302-L317
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java
UnsignedUtils.forDigit
public static char forDigit(int digit, int radix) { if (digit >= 0 && digit < radix && radix >= Character.MIN_RADIX && radix <= MAX_RADIX) { return digits[digit]; } return '\u0000'; }
java
public static char forDigit(int digit, int radix) { if (digit >= 0 && digit < radix && radix >= Character.MIN_RADIX && radix <= MAX_RADIX) { return digits[digit]; } return '\u0000'; }
[ "public", "static", "char", "forDigit", "(", "int", "digit", ",", "int", "radix", ")", "{", "if", "(", "digit", ">=", "0", "&&", "digit", "<", "radix", "&&", "radix", ">=", "Character", ".", "MIN_RADIX", "&&", "radix", "<=", "MAX_RADIX", ")", "{", "return", "digits", "[", "digit", "]", ";", "}", "return", "'", "'", ";", "}" ]
Determines the character representation for a specific digit in the specified radix. Note: If the value of radix is not a valid radix, or the value of digit is not a valid digit in the specified radix, the null character ('\u0000') is returned. @param digit @param radix @return
[ "Determines", "the", "character", "representation", "for", "a", "specific", "digit", "in", "the", "specified", "radix", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java#L76-L81
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/MetadataClient.java
MetadataClient.unregisterWorkflowDef
public void unregisterWorkflowDef(String name, Integer version) { Preconditions.checkArgument(StringUtils.isNotBlank(name), "Workflow name cannot be blank"); Preconditions.checkNotNull(version, "Version cannot be null"); delete("metadata/workflow/{name}/{version}", name, version); }
java
public void unregisterWorkflowDef(String name, Integer version) { Preconditions.checkArgument(StringUtils.isNotBlank(name), "Workflow name cannot be blank"); Preconditions.checkNotNull(version, "Version cannot be null"); delete("metadata/workflow/{name}/{version}", name, version); }
[ "public", "void", "unregisterWorkflowDef", "(", "String", "name", ",", "Integer", "version", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "name", ")", ",", "\"Workflow name cannot be blank\"", ")", ";", "Preconditions", ".", "checkNotNull", "(", "version", ",", "\"Version cannot be null\"", ")", ";", "delete", "(", "\"metadata/workflow/{name}/{version}\"", ",", "name", ",", "version", ")", ";", "}" ]
Removes the workflow definition of a workflow from the conductor server. It does not remove associated workflows. Use with caution. @param name Name of the workflow to be unregistered. @param version Version of the workflow definition to be unregistered.
[ "Removes", "the", "workflow", "definition", "of", "a", "workflow", "from", "the", "conductor", "server", ".", "It", "does", "not", "remove", "associated", "workflows", ".", "Use", "with", "caution", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/MetadataClient.java#L127-L131
bazaarvoice/emodb
queue-client-common/src/main/java/com/bazaarvoice/emodb/queue/client/AbstractQueueClient.java
AbstractQueueClient.sendAll
public void sendAll(String apiKey, String queue, Collection<?> messages) { checkNotNull(queue, "queue"); checkNotNull(messages, "messages"); if (messages.isEmpty()) { return; } try { URI uri = _queueService.clone() .segment(queue, "sendbatch") .build(); _client.resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .post(messages); } catch (EmoClientException e) { throw convertException(e); } }
java
public void sendAll(String apiKey, String queue, Collection<?> messages) { checkNotNull(queue, "queue"); checkNotNull(messages, "messages"); if (messages.isEmpty()) { return; } try { URI uri = _queueService.clone() .segment(queue, "sendbatch") .build(); _client.resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .post(messages); } catch (EmoClientException e) { throw convertException(e); } }
[ "public", "void", "sendAll", "(", "String", "apiKey", ",", "String", "queue", ",", "Collection", "<", "?", ">", "messages", ")", "{", "checkNotNull", "(", "queue", ",", "\"queue\"", ")", ";", "checkNotNull", "(", "messages", ",", "\"messages\"", ")", ";", "if", "(", "messages", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "try", "{", "URI", "uri", "=", "_queueService", ".", "clone", "(", ")", ".", "segment", "(", "queue", ",", "\"sendbatch\"", ")", ".", "build", "(", ")", ";", "_client", ".", "resource", "(", "uri", ")", ".", "type", "(", "MediaType", ".", "APPLICATION_JSON_TYPE", ")", ".", "header", "(", "ApiKeyRequest", ".", "AUTHENTICATION_HEADER", ",", "apiKey", ")", ".", "post", "(", "messages", ")", ";", "}", "catch", "(", "EmoClientException", "e", ")", "{", "throw", "convertException", "(", "e", ")", ";", "}", "}" ]
Any server can handle sending messages, no need for @PartitionKey
[ "Any", "server", "can", "handle", "sending", "messages", "no", "need", "for" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/queue-client-common/src/main/java/com/bazaarvoice/emodb/queue/client/AbstractQueueClient.java#L59-L76
LearnLib/automatalib
util/src/main/java/net/automatalib/util/ts/copy/TSCopy.java
TSCopy.copy
public static <S1, I1, T1, SP, TP, S2, I2, T2> Mapping<S1, S2> copy(TSTraversalMethod method, UniversalTransitionSystem<S1, ? super I1, T1, ? extends SP, ? extends TP> in, int limit, Collection<? extends I1> inputs, MutableAutomaton<S2, I2, T2, ? super SP, ? super TP> out, Function<? super I1, ? extends I2> inputsMapping) { return copy(method, in, limit, inputs, out, inputsMapping, x -> true, TransitionPredicates.alwaysTrue()); }
java
public static <S1, I1, T1, SP, TP, S2, I2, T2> Mapping<S1, S2> copy(TSTraversalMethod method, UniversalTransitionSystem<S1, ? super I1, T1, ? extends SP, ? extends TP> in, int limit, Collection<? extends I1> inputs, MutableAutomaton<S2, I2, T2, ? super SP, ? super TP> out, Function<? super I1, ? extends I2> inputsMapping) { return copy(method, in, limit, inputs, out, inputsMapping, x -> true, TransitionPredicates.alwaysTrue()); }
[ "public", "static", "<", "S1", ",", "I1", ",", "T1", ",", "SP", ",", "TP", ",", "S2", ",", "I2", ",", "T2", ">", "Mapping", "<", "S1", ",", "S2", ">", "copy", "(", "TSTraversalMethod", "method", ",", "UniversalTransitionSystem", "<", "S1", ",", "?", "super", "I1", ",", "T1", ",", "?", "extends", "SP", ",", "?", "extends", "TP", ">", "in", ",", "int", "limit", ",", "Collection", "<", "?", "extends", "I1", ">", "inputs", ",", "MutableAutomaton", "<", "S2", ",", "I2", ",", "T2", ",", "?", "super", "SP", ",", "?", "super", "TP", ">", "out", ",", "Function", "<", "?", "super", "I1", ",", "?", "extends", "I2", ">", "inputsMapping", ")", "{", "return", "copy", "(", "method", ",", "in", ",", "limit", ",", "inputs", ",", "out", ",", "inputsMapping", ",", "x", "->", "true", ",", "TransitionPredicates", ".", "alwaysTrue", "(", ")", ")", ";", "}" ]
Copies a {@link UniversalAutomaton} with possibly heterogeneous input alphabets, but compatible properties. States and transitions will not be filtered @param method the traversal method to use @param in the input transition system @param limit the traversal limit, a value less than 0 means no limit @param inputs the inputs to consider @param out the output automaton @param inputsMapping a mapping from inputs in the input automaton to inputs in the output automaton @return a mapping from old to new states
[ "Copies", "a", "{", "@link", "UniversalAutomaton", "}", "with", "possibly", "heterogeneous", "input", "alphabets", "but", "compatible", "properties", ".", "States", "and", "transitions", "will", "not", "be", "filtered" ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/ts/copy/TSCopy.java#L415-L422
haifengl/smile
nlp/src/main/java/smile/nlp/Trie.java
Trie.put
public void put(K[] key, V value) { Node child = root.get(key[0]); if (child == null) { child = new Node(key[0]); root.put(key[0], child); } child.addChild(key, value, 1); }
java
public void put(K[] key, V value) { Node child = root.get(key[0]); if (child == null) { child = new Node(key[0]); root.put(key[0], child); } child.addChild(key, value, 1); }
[ "public", "void", "put", "(", "K", "[", "]", "key", ",", "V", "value", ")", "{", "Node", "child", "=", "root", ".", "get", "(", "key", "[", "0", "]", ")", ";", "if", "(", "child", "==", "null", ")", "{", "child", "=", "new", "Node", "(", "key", "[", "0", "]", ")", ";", "root", ".", "put", "(", "key", "[", "0", "]", ",", "child", ")", ";", "}", "child", ".", "addChild", "(", "key", ",", "value", ",", "1", ")", ";", "}" ]
Add a key with associated value to the trie. @param key the key. @param value the value.
[ "Add", "a", "key", "with", "associated", "value", "to", "the", "trie", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/Trie.java#L136-L143
pravega/pravega
common/src/main/java/io/pravega/common/util/CollectionHelpers.java
CollectionHelpers.binarySearch
public static <T> int binarySearch(List<? extends T> list, Function<? super T, Integer> comparator) { return binarySearch(list, comparator, false); }
java
public static <T> int binarySearch(List<? extends T> list, Function<? super T, Integer> comparator) { return binarySearch(list, comparator, false); }
[ "public", "static", "<", "T", ">", "int", "binarySearch", "(", "List", "<", "?", "extends", "T", ">", "list", ",", "Function", "<", "?", "super", "T", ",", "Integer", ">", "comparator", ")", "{", "return", "binarySearch", "(", "list", ",", "comparator", ",", "false", ")", ";", "}" ]
Performs a binary search on the given sorted list using the given comparator. This method has undefined behavior if the list is not sorted. <p> This method is different than that in java.util.Collections in the following ways: 1. This one searches by a simple comparator, vs the ones in the Collections class which search for a specific element. This one is useful if we don't have an instance of a search object or we want to implement a fuzzy comparison. 2. This one returns -1 if the element is not found. The ones in the Collections class return (-(start+1)), which is the index where the item should be inserted if it were to go in the list. @param list The list to search on. @param comparator The comparator to use for comparison. Returns -1 if sought item is before the current item, +1 if it is after or 0 if an exact match. @param <T> Type of the elements in the list. @return The index of the sought item, or -1 if not found.
[ "Performs", "a", "binary", "search", "on", "the", "given", "sorted", "list", "using", "the", "given", "comparator", ".", "This", "method", "has", "undefined", "behavior", "if", "the", "list", "is", "not", "sorted", ".", "<p", ">", "This", "method", "is", "different", "than", "that", "in", "java", ".", "util", ".", "Collections", "in", "the", "following", "ways", ":", "1", ".", "This", "one", "searches", "by", "a", "simple", "comparator", "vs", "the", "ones", "in", "the", "Collections", "class", "which", "search", "for", "a", "specific", "element", ".", "This", "one", "is", "useful", "if", "we", "don", "t", "have", "an", "instance", "of", "a", "search", "object", "or", "we", "want", "to", "implement", "a", "fuzzy", "comparison", ".", "2", ".", "This", "one", "returns", "-", "1", "if", "the", "element", "is", "not", "found", ".", "The", "ones", "in", "the", "Collections", "class", "return", "(", "-", "(", "start", "+", "1", "))", "which", "is", "the", "index", "where", "the", "item", "should", "be", "inserted", "if", "it", "were", "to", "go", "in", "the", "list", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/CollectionHelpers.java#L44-L46
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/IntCounter.java
IntCounter.incrementCounts
public void incrementCounts(Collection<E> keys, int count) { for (E key : keys) { incrementCount(key, count); } }
java
public void incrementCounts(Collection<E> keys, int count) { for (E key : keys) { incrementCount(key, count); } }
[ "public", "void", "incrementCounts", "(", "Collection", "<", "E", ">", "keys", ",", "int", "count", ")", "{", "for", "(", "E", "key", ":", "keys", ")", "{", "incrementCount", "(", "key", ",", "count", ")", ";", "}", "}" ]
Adds the given count to the current counts for each of the given keys. If any of the keys haven't been seen before, they are assumed to have count 0, and thus this method will set their counts to the given amount. Negative increments are equivalent to calling <tt>decrementCounts</tt>. <p/> To more conveniently increment the counts of a collection of objects by 1, use {@link #incrementCounts(Collection)}. <p/> To set the counts of a collection of objects to a specific value instead of incrementing them, use {@link #setCounts(Collection,int)}.
[ "Adds", "the", "given", "count", "to", "the", "current", "counts", "for", "each", "of", "the", "given", "keys", ".", "If", "any", "of", "the", "keys", "haven", "t", "been", "seen", "before", "they", "are", "assumed", "to", "have", "count", "0", "and", "thus", "this", "method", "will", "set", "their", "counts", "to", "the", "given", "amount", ".", "Negative", "increments", "are", "equivalent", "to", "calling", "<tt", ">", "decrementCounts<", "/", "tt", ">", ".", "<p", "/", ">", "To", "more", "conveniently", "increment", "the", "counts", "of", "a", "collection", "of", "objects", "by", "1", "use", "{" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/IntCounter.java#L280-L284
ixa-ehu/ixa-pipe-pos
src/main/java/eus/ixa/ixa/pipe/pos/Resources.java
Resources.getBinaryDict
public final URL getBinaryDict(final String lang, final String resourcesDirectory) { return resourcesDirectory == null ? getBinaryDictFromResources(lang) : getBinaryDictFromDirectory(lang, resourcesDirectory); }
java
public final URL getBinaryDict(final String lang, final String resourcesDirectory) { return resourcesDirectory == null ? getBinaryDictFromResources(lang) : getBinaryDictFromDirectory(lang, resourcesDirectory); }
[ "public", "final", "URL", "getBinaryDict", "(", "final", "String", "lang", ",", "final", "String", "resourcesDirectory", ")", "{", "return", "resourcesDirectory", "==", "null", "?", "getBinaryDictFromResources", "(", "lang", ")", ":", "getBinaryDictFromDirectory", "(", "lang", ",", "resourcesDirectory", ")", ";", "}" ]
The the dictionary for the {@code MorfologikLemmatizer}. @param lang the language @param resourcesDirectory the directory where the dictionary can be found. If {@code null}, load from package resources. @return the URL of the dictonary
[ "The", "the", "dictionary", "for", "the", "{", "@code", "MorfologikLemmatizer", "}", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/Resources.java#L67-L71
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.retrieveCertificateActions
public List<CertificateOrderActionInner> retrieveCertificateActions(String resourceGroupName, String name) { return retrieveCertificateActionsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
java
public List<CertificateOrderActionInner> retrieveCertificateActions(String resourceGroupName, String name) { return retrieveCertificateActionsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
[ "public", "List", "<", "CertificateOrderActionInner", ">", "retrieveCertificateActions", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "retrieveCertificateActionsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Retrieve the list of certificate actions. Retrieve the list of certificate actions. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the certificate order. @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException 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;CertificateOrderActionInner&gt; object if successful.
[ "Retrieve", "the", "list", "of", "certificate", "actions", ".", "Retrieve", "the", "list", "of", "certificate", "actions", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L2234-L2236
actorapp/actor-platform
actor-sdk/sdk-core-android/android-app/src/main/java/im/actor/tour/VerticalViewPager.java
VerticalViewPager.setPageTransformer
public void setPageTransformer(boolean reverseDrawingOrder, ViewPager.PageTransformer transformer) { if (Build.VERSION.SDK_INT >= 11) { final boolean hasTransformer = transformer != null; final boolean needsPopulate = hasTransformer != (mPageTransformer != null); mPageTransformer = transformer; setChildrenDrawingOrderEnabledCompat(hasTransformer); if (hasTransformer) { mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD; } else { mDrawingOrder = DRAW_ORDER_DEFAULT; } if (needsPopulate) populate(); } }
java
public void setPageTransformer(boolean reverseDrawingOrder, ViewPager.PageTransformer transformer) { if (Build.VERSION.SDK_INT >= 11) { final boolean hasTransformer = transformer != null; final boolean needsPopulate = hasTransformer != (mPageTransformer != null); mPageTransformer = transformer; setChildrenDrawingOrderEnabledCompat(hasTransformer); if (hasTransformer) { mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD; } else { mDrawingOrder = DRAW_ORDER_DEFAULT; } if (needsPopulate) populate(); } }
[ "public", "void", "setPageTransformer", "(", "boolean", "reverseDrawingOrder", ",", "ViewPager", ".", "PageTransformer", "transformer", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "11", ")", "{", "final", "boolean", "hasTransformer", "=", "transformer", "!=", "null", ";", "final", "boolean", "needsPopulate", "=", "hasTransformer", "!=", "(", "mPageTransformer", "!=", "null", ")", ";", "mPageTransformer", "=", "transformer", ";", "setChildrenDrawingOrderEnabledCompat", "(", "hasTransformer", ")", ";", "if", "(", "hasTransformer", ")", "{", "mDrawingOrder", "=", "reverseDrawingOrder", "?", "DRAW_ORDER_REVERSE", ":", "DRAW_ORDER_FORWARD", ";", "}", "else", "{", "mDrawingOrder", "=", "DRAW_ORDER_DEFAULT", ";", "}", "if", "(", "needsPopulate", ")", "populate", "(", ")", ";", "}", "}" ]
Set a {@link ViewPager.PageTransformer} that will be called for each attached page whenever the scroll position is changed. This allows the application to apply custom property transformations to each page, overriding the default sliding look and feel. <p/> <p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist. As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.</p> @param reverseDrawingOrder true if the supplied PageTransformer requires page views to be drawn from last to first instead of first to last. @param transformer PageTransformer that will modify each page's animation properties
[ "Set", "a", "{", "@link", "ViewPager", ".", "PageTransformer", "}", "that", "will", "be", "called", "for", "each", "attached", "page", "whenever", "the", "scroll", "position", "is", "changed", ".", "This", "allows", "the", "application", "to", "apply", "custom", "property", "transformations", "to", "each", "page", "overriding", "the", "default", "sliding", "look", "and", "feel", ".", "<p", "/", ">", "<p", ">", "<em", ">", "Note", ":", "<", "/", "em", ">", "Prior", "to", "Android", "3", ".", "0", "the", "property", "animation", "APIs", "did", "not", "exist", ".", "As", "a", "result", "setting", "a", "PageTransformer", "prior", "to", "Android", "3", ".", "0", "(", "API", "11", ")", "will", "have", "no", "effect", ".", "<", "/", "p", ">" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-app/src/main/java/im/actor/tour/VerticalViewPager.java#L472-L485
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_user.java
snmp_user.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { snmp_user_responses result = (snmp_user_responses) service.get_payload_formatter().string_to_resource(snmp_user_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.snmp_user_response_array); } snmp_user[] result_snmp_user = new snmp_user[result.snmp_user_response_array.length]; for(int i = 0; i < result.snmp_user_response_array.length; i++) { result_snmp_user[i] = result.snmp_user_response_array[i].snmp_user[0]; } return result_snmp_user; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { snmp_user_responses result = (snmp_user_responses) service.get_payload_formatter().string_to_resource(snmp_user_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.snmp_user_response_array); } snmp_user[] result_snmp_user = new snmp_user[result.snmp_user_response_array.length]; for(int i = 0; i < result.snmp_user_response_array.length; i++) { result_snmp_user[i] = result.snmp_user_response_array[i].snmp_user[0]; } return result_snmp_user; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "snmp_user_responses", "result", "=", "(", "snmp_user_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "snmp_user_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "snmp_user_response_array", ")", ";", "}", "snmp_user", "[", "]", "result_snmp_user", "=", "new", "snmp_user", "[", "result", ".", "snmp_user_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "snmp_user_response_array", ".", "length", ";", "i", "++", ")", "{", "result_snmp_user", "[", "i", "]", "=", "result", ".", "snmp_user_response_array", "[", "i", "]", ".", "snmp_user", "[", "0", "]", ";", "}", "return", "result_snmp_user", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_user.java#L494-L511
eclipse/xtext-core
org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/splitting/AntlrCodeQualityHelper.java
AntlrCodeQualityHelper.removeDuplicateBitsets
public String removeDuplicateBitsets(String javaContent, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return javaContent; } return removeDuplicateFields(javaContent, followsetPattern, 1, 2, "\\bFOLLOW_\\w+\\b", "FOLLOW_%d", options.getKeptBitSetsPattern(), options.getKeptBitSetName()); }
java
public String removeDuplicateBitsets(String javaContent, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return javaContent; } return removeDuplicateFields(javaContent, followsetPattern, 1, 2, "\\bFOLLOW_\\w+\\b", "FOLLOW_%d", options.getKeptBitSetsPattern(), options.getKeptBitSetName()); }
[ "public", "String", "removeDuplicateBitsets", "(", "String", "javaContent", ",", "AntlrOptions", "options", ")", "{", "if", "(", "!", "options", ".", "isOptimizeCodeQuality", "(", ")", ")", "{", "return", "javaContent", ";", "}", "return", "removeDuplicateFields", "(", "javaContent", ",", "followsetPattern", ",", "1", ",", "2", ",", "\"\\\\bFOLLOW_\\\\w+\\\\b\"", ",", "\"FOLLOW_%d\"", ",", "options", ".", "getKeptBitSetsPattern", "(", ")", ",", "options", ".", "getKeptBitSetName", "(", ")", ")", ";", "}" ]
Remove duplicate bitset declarations to reduce the size of the static initializer but keep the bitsets that match the given pattern with a normalized name.
[ "Remove", "duplicate", "bitset", "declarations", "to", "reduce", "the", "size", "of", "the", "static", "initializer", "but", "keep", "the", "bitsets", "that", "match", "the", "given", "pattern", "with", "a", "normalized", "name", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/splitting/AntlrCodeQualityHelper.java#L67-L73
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java
FileSystem.makeRelative
private static File makeRelative(File filenameToMakeRelative, File rootPath, boolean appendCurrentDirectorySymbol) throws IOException { if (filenameToMakeRelative == null || rootPath == null) { throw new IllegalArgumentException(); } if (!filenameToMakeRelative.isAbsolute()) { return filenameToMakeRelative; } if (!rootPath.isAbsolute()) { return filenameToMakeRelative; } final File root = rootPath.getCanonicalFile(); final File dir = filenameToMakeRelative.getParentFile().getCanonicalFile(); final String[] parts1 = split(dir); final String[] parts2 = split(root); final String relPath = makeRelative(parts1, parts2, filenameToMakeRelative.getName()); if (appendCurrentDirectorySymbol) { return new File(CURRENT_DIRECTORY, relPath); } return new File(relPath); }
java
private static File makeRelative(File filenameToMakeRelative, File rootPath, boolean appendCurrentDirectorySymbol) throws IOException { if (filenameToMakeRelative == null || rootPath == null) { throw new IllegalArgumentException(); } if (!filenameToMakeRelative.isAbsolute()) { return filenameToMakeRelative; } if (!rootPath.isAbsolute()) { return filenameToMakeRelative; } final File root = rootPath.getCanonicalFile(); final File dir = filenameToMakeRelative.getParentFile().getCanonicalFile(); final String[] parts1 = split(dir); final String[] parts2 = split(root); final String relPath = makeRelative(parts1, parts2, filenameToMakeRelative.getName()); if (appendCurrentDirectorySymbol) { return new File(CURRENT_DIRECTORY, relPath); } return new File(relPath); }
[ "private", "static", "File", "makeRelative", "(", "File", "filenameToMakeRelative", ",", "File", "rootPath", ",", "boolean", "appendCurrentDirectorySymbol", ")", "throws", "IOException", "{", "if", "(", "filenameToMakeRelative", "==", "null", "||", "rootPath", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "!", "filenameToMakeRelative", ".", "isAbsolute", "(", ")", ")", "{", "return", "filenameToMakeRelative", ";", "}", "if", "(", "!", "rootPath", ".", "isAbsolute", "(", ")", ")", "{", "return", "filenameToMakeRelative", ";", "}", "final", "File", "root", "=", "rootPath", ".", "getCanonicalFile", "(", ")", ";", "final", "File", "dir", "=", "filenameToMakeRelative", ".", "getParentFile", "(", ")", ".", "getCanonicalFile", "(", ")", ";", "final", "String", "[", "]", "parts1", "=", "split", "(", "dir", ")", ";", "final", "String", "[", "]", "parts2", "=", "split", "(", "root", ")", ";", "final", "String", "relPath", "=", "makeRelative", "(", "parts1", ",", "parts2", ",", "filenameToMakeRelative", ".", "getName", "(", ")", ")", ";", "if", "(", "appendCurrentDirectorySymbol", ")", "{", "return", "new", "File", "(", "CURRENT_DIRECTORY", ",", "relPath", ")", ";", "}", "return", "new", "File", "(", "relPath", ")", ";", "}" ]
Make the given filename relative to the given root path. @param filenameToMakeRelative is the name to make relative. @param rootPath is the root path from which the relative path will be set. @param appendCurrentDirectorySymbol indicates if "./" should be append at the begining of the relative filename. @return a relative filename. @throws IOException when is is impossible to retreive canonical paths.
[ "Make", "the", "given", "filename", "relative", "to", "the", "given", "root", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L2729-L2755
stagemonitor/stagemonitor
stagemonitor-tracing/src/main/java/org/stagemonitor/tracing/profiler/CallStackElement.java
CallStackElement.create
public static CallStackElement create(CallStackElement parent, String signature, long startTimestamp) { CallStackElement cse; if (useObjectPooling) { cse = objectPool.poll(); if (cse == null) { cse = new CallStackElement(); } } else { cse = new CallStackElement(); } cse.executionTime = startTimestamp; cse.signature = signature; if (parent != null) { cse.parent = parent; parent.children.add(cse); } return cse; }
java
public static CallStackElement create(CallStackElement parent, String signature, long startTimestamp) { CallStackElement cse; if (useObjectPooling) { cse = objectPool.poll(); if (cse == null) { cse = new CallStackElement(); } } else { cse = new CallStackElement(); } cse.executionTime = startTimestamp; cse.signature = signature; if (parent != null) { cse.parent = parent; parent.children.add(cse); } return cse; }
[ "public", "static", "CallStackElement", "create", "(", "CallStackElement", "parent", ",", "String", "signature", ",", "long", "startTimestamp", ")", "{", "CallStackElement", "cse", ";", "if", "(", "useObjectPooling", ")", "{", "cse", "=", "objectPool", ".", "poll", "(", ")", ";", "if", "(", "cse", "==", "null", ")", "{", "cse", "=", "new", "CallStackElement", "(", ")", ";", "}", "}", "else", "{", "cse", "=", "new", "CallStackElement", "(", ")", ";", "}", "cse", ".", "executionTime", "=", "startTimestamp", ";", "cse", ".", "signature", "=", "signature", ";", "if", "(", "parent", "!=", "null", ")", "{", "cse", ".", "parent", "=", "parent", ";", "parent", ".", "children", ".", "add", "(", "cse", ")", ";", "}", "return", "cse", ";", "}" ]
This static factory method also sets the parent-child relationships. @param parent the parent @param startTimestamp the timestamp at the beginning of the method
[ "This", "static", "factory", "method", "also", "sets", "the", "parent", "-", "child", "relationships", "." ]
train
https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-tracing/src/main/java/org/stagemonitor/tracing/profiler/CallStackElement.java#L55-L73
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java
JobScheduleOperations.patchJobSchedule
public void patchJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List<MetadataItem> metadata, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { JobSchedulePatchOptions options = new JobSchedulePatchOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); JobSchedulePatchParameter param = new JobSchedulePatchParameter() .withJobSpecification(jobSpecification) .withMetadata(metadata) .withSchedule(schedule); this.parentBatchClient.protocolLayer().jobSchedules().patch(jobScheduleId, param, options); }
java
public void patchJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List<MetadataItem> metadata, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { JobSchedulePatchOptions options = new JobSchedulePatchOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); JobSchedulePatchParameter param = new JobSchedulePatchParameter() .withJobSpecification(jobSpecification) .withMetadata(metadata) .withSchedule(schedule); this.parentBatchClient.protocolLayer().jobSchedules().patch(jobScheduleId, param, options); }
[ "public", "void", "patchJobSchedule", "(", "String", "jobScheduleId", ",", "Schedule", "schedule", ",", "JobSpecification", "jobSpecification", ",", "List", "<", "MetadataItem", ">", "metadata", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "JobSchedulePatchOptions", "options", "=", "new", "JobSchedulePatchOptions", "(", ")", ";", "BehaviorManager", "bhMgr", "=", "new", "BehaviorManager", "(", "this", ".", "customBehaviors", "(", ")", ",", "additionalBehaviors", ")", ";", "bhMgr", ".", "applyRequestBehaviors", "(", "options", ")", ";", "JobSchedulePatchParameter", "param", "=", "new", "JobSchedulePatchParameter", "(", ")", ".", "withJobSpecification", "(", "jobSpecification", ")", ".", "withMetadata", "(", "metadata", ")", ".", "withSchedule", "(", "schedule", ")", ";", "this", ".", "parentBatchClient", ".", "protocolLayer", "(", ")", ".", "jobSchedules", "(", ")", ".", "patch", "(", "jobScheduleId", ",", "param", ",", "options", ")", ";", "}" ]
Updates the specified job schedule. This method only replaces the properties specified with non-null values. @param jobScheduleId The ID of the job schedule. @param schedule The schedule according to which jobs will be created. If null, any existing schedule is left unchanged. @param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. If null, the existing job specification is left unchanged. @param metadata A list of name-value pairs associated with the job schedule as metadata. If null, the existing metadata are left unchanged. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Updates", "the", "specified", "job", "schedule", ".", "This", "method", "only", "replaces", "the", "properties", "specified", "with", "non", "-", "null", "values", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L209-L219
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_instance_bulk_POST
public ArrayList<OvhInstance> project_serviceName_instance_bulk_POST(String serviceName, String flavorId, String groupId, String imageId, Boolean monthlyBilling, String name, OvhNetworkBulkParams[] networks, Long number, String region, String sshKeyId, String userData, String volumeId) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/bulk"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "flavorId", flavorId); addBody(o, "groupId", groupId); addBody(o, "imageId", imageId); addBody(o, "monthlyBilling", monthlyBilling); addBody(o, "name", name); addBody(o, "networks", networks); addBody(o, "number", number); addBody(o, "region", region); addBody(o, "sshKeyId", sshKeyId); addBody(o, "userData", userData); addBody(o, "volumeId", volumeId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t21); }
java
public ArrayList<OvhInstance> project_serviceName_instance_bulk_POST(String serviceName, String flavorId, String groupId, String imageId, Boolean monthlyBilling, String name, OvhNetworkBulkParams[] networks, Long number, String region, String sshKeyId, String userData, String volumeId) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/bulk"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "flavorId", flavorId); addBody(o, "groupId", groupId); addBody(o, "imageId", imageId); addBody(o, "monthlyBilling", monthlyBilling); addBody(o, "name", name); addBody(o, "networks", networks); addBody(o, "number", number); addBody(o, "region", region); addBody(o, "sshKeyId", sshKeyId); addBody(o, "userData", userData); addBody(o, "volumeId", volumeId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t21); }
[ "public", "ArrayList", "<", "OvhInstance", ">", "project_serviceName_instance_bulk_POST", "(", "String", "serviceName", ",", "String", "flavorId", ",", "String", "groupId", ",", "String", "imageId", ",", "Boolean", "monthlyBilling", ",", "String", "name", ",", "OvhNetworkBulkParams", "[", "]", "networks", ",", "Long", "number", ",", "String", "region", ",", "String", "sshKeyId", ",", "String", "userData", ",", "String", "volumeId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/instance/bulk\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"flavorId\"", ",", "flavorId", ")", ";", "addBody", "(", "o", ",", "\"groupId\"", ",", "groupId", ")", ";", "addBody", "(", "o", ",", "\"imageId\"", ",", "imageId", ")", ";", "addBody", "(", "o", ",", "\"monthlyBilling\"", ",", "monthlyBilling", ")", ";", "addBody", "(", "o", ",", "\"name\"", ",", "name", ")", ";", "addBody", "(", "o", ",", "\"networks\"", ",", "networks", ")", ";", "addBody", "(", "o", ",", "\"number\"", ",", "number", ")", ";", "addBody", "(", "o", ",", "\"region\"", ",", "region", ")", ";", "addBody", "(", "o", ",", "\"sshKeyId\"", ",", "sshKeyId", ")", ";", "addBody", "(", "o", ",", "\"userData\"", ",", "userData", ")", ";", "addBody", "(", "o", ",", "\"volumeId\"", ",", "volumeId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "t21", ")", ";", "}" ]
Create multiple instances REST: POST /cloud/project/{serviceName}/instance/bulk @param flavorId [required] Instance flavor id @param groupId [required] Start instance in group @param imageId [required] Instance image id @param monthlyBilling [required] Active monthly billing @param name [required] Instance name @param networks [required] Create network interfaces @param number [required] Number of instances you want to create @param region [required] Instance region @param serviceName [required] Project name @param sshKeyId [required] SSH keypair id @param userData [required] Configuration information or scripts to use upon launch @param volumeId [required] Specify a volume id to boot from it
[ "Create", "multiple", "instances" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2090-L2107
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLibFunction.java
FunctionLibFunction.setFunctionClass
public void setFunctionClass(String value, Identification id, Attributes attrs) { functionCD = ClassDefinitionImpl.toClassDefinition(value, id, attrs); }
java
public void setFunctionClass(String value, Identification id, Attributes attrs) { functionCD = ClassDefinitionImpl.toClassDefinition(value, id, attrs); }
[ "public", "void", "setFunctionClass", "(", "String", "value", ",", "Identification", "id", ",", "Attributes", "attrs", ")", "{", "functionCD", "=", "ClassDefinitionImpl", ".", "toClassDefinition", "(", "value", ",", "id", ",", "attrs", ")", ";", "}" ]
Setzt die Klassendefinition als Zeichenkette, welche diese Funktion implementiert. @param value Klassendefinition als Zeichenkette.
[ "Setzt", "die", "Klassendefinition", "als", "Zeichenkette", "welche", "diese", "Funktion", "implementiert", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFunction.java#L271-L274
allengeorge/libraft
libraft-agent/src/main/java/io/libraft/agent/RaftMember.java
RaftMember.compareAndSetChannel
public boolean compareAndSetChannel(@Nullable Channel oldChannel, @Nullable Channel newChannel) { return channel.compareAndSet(oldChannel, newChannel); }
java
public boolean compareAndSetChannel(@Nullable Channel oldChannel, @Nullable Channel newChannel) { return channel.compareAndSet(oldChannel, newChannel); }
[ "public", "boolean", "compareAndSetChannel", "(", "@", "Nullable", "Channel", "oldChannel", ",", "@", "Nullable", "Channel", "newChannel", ")", "{", "return", "channel", ".", "compareAndSet", "(", "oldChannel", ",", "newChannel", ")", ";", "}" ]
Set the {@link Channel} used to communicate with the Raft server to {@code newChannel} <strong>only if</strong> the current channel is {@code oldChannel}. noop otherwise. @param oldChannel expected value of the {@code Channel} @param newChannel a valid, <strong>connected</strong>d {@code Channel} to the Raft server. {@code null} if no connection exists @return true if the value was set to {@code newChannel}, false otherwise
[ "Set", "the", "{", "@link", "Channel", "}", "used", "to", "communicate", "with", "the", "Raft", "server", "to", "{", "@code", "newChannel", "}", "<strong", ">", "only", "if<", "/", "strong", ">", "the", "current", "channel", "is", "{", "@code", "oldChannel", "}", ".", "noop", "otherwise", "." ]
train
https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-agent/src/main/java/io/libraft/agent/RaftMember.java#L114-L116
gallandarakhneorg/afc
core/text/src/main/java/org/arakhne/afc/text/TextUtil.java
TextUtil.equalsIgnoreCaseAccents
@Pure @Inline(value = "TextUtil.removeAccents($1, $3).equalsIgnoreCase(TextUtil.removeAccents($2, $3))", imported = {TextUtil.class}) public static boolean equalsIgnoreCaseAccents(String s1, String s2, Map<Character, String> map) { return removeAccents(s1, map).equalsIgnoreCase(removeAccents(s2, map)); }
java
@Pure @Inline(value = "TextUtil.removeAccents($1, $3).equalsIgnoreCase(TextUtil.removeAccents($2, $3))", imported = {TextUtil.class}) public static boolean equalsIgnoreCaseAccents(String s1, String s2, Map<Character, String> map) { return removeAccents(s1, map).equalsIgnoreCase(removeAccents(s2, map)); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"TextUtil.removeAccents($1, $3).equalsIgnoreCase(TextUtil.removeAccents($2, $3))\"", ",", "imported", "=", "{", "TextUtil", ".", "class", "}", ")", "public", "static", "boolean", "equalsIgnoreCaseAccents", "(", "String", "s1", ",", "String", "s2", ",", "Map", "<", "Character", ",", "String", ">", "map", ")", "{", "return", "removeAccents", "(", "s1", ",", "map", ")", ".", "equalsIgnoreCase", "(", "removeAccents", "(", "s2", ",", "map", ")", ")", ";", "}" ]
Compares this <code>String</code> to another <code>String</code>, ignoring case and accent considerations. Two strings are considered equal ignoring case and accents if they are of the same length, and corresponding characters in the two strings are equal ignoring case and accents. <p>This method is equivalent to: <pre><code> TextUtil.removeAccents(s1,map).equalsIgnoreCase(TextUtil.removeAccents(s2,map)); </code></pre> @param s1 is the first string to compare. @param s2 is the second string to compare. @param map is the translation table from an accentuated character to an unaccentuated character. @return <code>true</code> if the argument is not <code>null</code> and the <code>String</code>s are equal, ignoring case; <code>false</code> otherwise. @see #removeAccents(String, Map)
[ "Compares", "this", "<code", ">", "String<", "/", "code", ">", "to", "another", "<code", ">", "String<", "/", "code", ">", "ignoring", "case", "and", "accent", "considerations", ".", "Two", "strings", "are", "considered", "equal", "ignoring", "case", "and", "accents", "if", "they", "are", "of", "the", "same", "length", "and", "corresponding", "characters", "in", "the", "two", "strings", "are", "equal", "ignoring", "case", "and", "accents", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L1376-L1381
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/StringUtil.java
StringUtil.endsWithAny
public static boolean endsWithAny(boolean _ignoreCase, String _str, String... _args) { if (_str == null || _args == null || _args.length == 0) { return false; } String heystack = _str; if (_ignoreCase) { heystack = _str.toLowerCase(); } for (String s : _args) { String needle = _ignoreCase ? s.toLowerCase() : s; if (heystack.endsWith(needle)) { return true; } } return false; }
java
public static boolean endsWithAny(boolean _ignoreCase, String _str, String... _args) { if (_str == null || _args == null || _args.length == 0) { return false; } String heystack = _str; if (_ignoreCase) { heystack = _str.toLowerCase(); } for (String s : _args) { String needle = _ignoreCase ? s.toLowerCase() : s; if (heystack.endsWith(needle)) { return true; } } return false; }
[ "public", "static", "boolean", "endsWithAny", "(", "boolean", "_ignoreCase", ",", "String", "_str", ",", "String", "...", "_args", ")", "{", "if", "(", "_str", "==", "null", "||", "_args", "==", "null", "||", "_args", ".", "length", "==", "0", ")", "{", "return", "false", ";", "}", "String", "heystack", "=", "_str", ";", "if", "(", "_ignoreCase", ")", "{", "heystack", "=", "_str", ".", "toLowerCase", "(", ")", ";", "}", "for", "(", "String", "s", ":", "_args", ")", "{", "String", "needle", "=", "_ignoreCase", "?", "s", ".", "toLowerCase", "(", ")", ":", "s", ";", "if", "(", "heystack", ".", "endsWith", "(", "needle", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if given string in _str ends with any of the given strings in _args. @param _ignoreCase true to ignore case, false to be case sensitive @param _str string to check @param _args patterns to find @return true if given string in _str ends with any of the given strings in _args, false if not or _str/_args is null
[ "Checks", "if", "given", "string", "in", "_str", "ends", "with", "any", "of", "the", "given", "strings", "in", "_args", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/StringUtil.java#L521-L538
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/GrayFilter.java
GrayFilter.filterRGB
public int filterRGB(int pX, int pY, int pARGB) { // Get color components int r = pARGB >> 16 & 0xFF; int g = pARGB >> 8 & 0xFF; int b = pARGB & 0xFF; // ITU standard: Gray scale=(222*Red+707*Green+71*Blue)/1000 int gray = (222 * r + 707 * g + 71 * b) / 1000; //int gray = (int) ((float) (r + g + b) / 3.0f); if (range != 1.0f) { // Apply range gray = low + (int) (gray * range); } // Return ARGB pixel return (pARGB & 0xFF000000) | (gray << 16) | (gray << 8) | gray; }
java
public int filterRGB(int pX, int pY, int pARGB) { // Get color components int r = pARGB >> 16 & 0xFF; int g = pARGB >> 8 & 0xFF; int b = pARGB & 0xFF; // ITU standard: Gray scale=(222*Red+707*Green+71*Blue)/1000 int gray = (222 * r + 707 * g + 71 * b) / 1000; //int gray = (int) ((float) (r + g + b) / 3.0f); if (range != 1.0f) { // Apply range gray = low + (int) (gray * range); } // Return ARGB pixel return (pARGB & 0xFF000000) | (gray << 16) | (gray << 8) | gray; }
[ "public", "int", "filterRGB", "(", "int", "pX", ",", "int", "pY", ",", "int", "pARGB", ")", "{", "// Get color components\r", "int", "r", "=", "pARGB", ">>", "16", "&", "0xFF", ";", "int", "g", "=", "pARGB", ">>", "8", "&", "0xFF", ";", "int", "b", "=", "pARGB", "&", "0xFF", ";", "// ITU standard: Gray scale=(222*Red+707*Green+71*Blue)/1000\r", "int", "gray", "=", "(", "222", "*", "r", "+", "707", "*", "g", "+", "71", "*", "b", ")", "/", "1000", ";", "//int gray = (int) ((float) (r + g + b) / 3.0f);\r", "if", "(", "range", "!=", "1.0f", ")", "{", "// Apply range\r", "gray", "=", "low", "+", "(", "int", ")", "(", "gray", "*", "range", ")", ";", "}", "// Return ARGB pixel\r", "return", "(", "pARGB", "&", "0xFF000000", ")", "|", "(", "gray", "<<", "16", ")", "|", "(", "gray", "<<", "8", ")", "|", "gray", ";", "}" ]
Filters one pixel using ITU color-conversion. @param pX x @param pY y @param pARGB pixel value in default color space @return the filtered pixel value in the default color space
[ "Filters", "one", "pixel", "using", "ITU", "color", "-", "conversion", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/GrayFilter.java#L112-L130
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaBindSurfaceToArray
public static int cudaBindSurfaceToArray(surfaceReference surfref, cudaArray array, cudaChannelFormatDesc desc) { return checkResult(cudaBindSurfaceToArrayNative(surfref, array, desc)); }
java
public static int cudaBindSurfaceToArray(surfaceReference surfref, cudaArray array, cudaChannelFormatDesc desc) { return checkResult(cudaBindSurfaceToArrayNative(surfref, array, desc)); }
[ "public", "static", "int", "cudaBindSurfaceToArray", "(", "surfaceReference", "surfref", ",", "cudaArray", "array", ",", "cudaChannelFormatDesc", "desc", ")", "{", "return", "checkResult", "(", "cudaBindSurfaceToArrayNative", "(", "surfref", ",", "array", ",", "desc", ")", ")", ";", "}" ]
[C++ API] Binds an array to a surface <pre> template < class T, int dim > cudaError_t cudaBindSurfaceToArray ( const surface < T, dim > & surf, cudaArray_const_t array, const cudaChannelFormatDesc& desc ) [inline] </pre> <div> <p>[C++ API] Binds an array to a surface Binds the CUDA array <tt>array</tt> to the surface reference <tt>surf</tt>. <tt>desc</tt> describes how the memory is interpreted when dealing with the surface. Any CUDA array previously bound to <tt>surf</tt> is unbound. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param surfref Surface to bind @param array Memory array on device @param desc Channel format @param surf Surface to bind @param array Memory array on device @param surf Surface to bind @param array Memory array on device @param desc Channel format @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidSurface @see JCuda#cudaBindSurfaceToArray @see JCuda#cudaBindSurfaceToArray
[ "[", "C", "++", "API", "]", "Binds", "an", "array", "to", "a", "surface" ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L9477-L9480
openbase/jul
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java
MultiLanguageTextProcessor.getBestMatch
public static String getBestMatch(final Locale locale, final MultiLanguageTextOrBuilder multiLanguageText) throws NotAvailableException { try { // resolve multiLanguageText via preferred locale. return getMultiLanguageTextByLanguage(locale.getLanguage(), multiLanguageText); } catch (NotAvailableException ex) { try { // resolve world language multiLanguageText. return getMultiLanguageTextByLanguage(Locale.ENGLISH, multiLanguageText); } catch (NotAvailableException exx) { // resolve any multiLanguageText. return getFirstMultiLanguageText(multiLanguageText); } } }
java
public static String getBestMatch(final Locale locale, final MultiLanguageTextOrBuilder multiLanguageText) throws NotAvailableException { try { // resolve multiLanguageText via preferred locale. return getMultiLanguageTextByLanguage(locale.getLanguage(), multiLanguageText); } catch (NotAvailableException ex) { try { // resolve world language multiLanguageText. return getMultiLanguageTextByLanguage(Locale.ENGLISH, multiLanguageText); } catch (NotAvailableException exx) { // resolve any multiLanguageText. return getFirstMultiLanguageText(multiLanguageText); } } }
[ "public", "static", "String", "getBestMatch", "(", "final", "Locale", "locale", ",", "final", "MultiLanguageTextOrBuilder", "multiLanguageText", ")", "throws", "NotAvailableException", "{", "try", "{", "// resolve multiLanguageText via preferred locale.", "return", "getMultiLanguageTextByLanguage", "(", "locale", ".", "getLanguage", "(", ")", ",", "multiLanguageText", ")", ";", "}", "catch", "(", "NotAvailableException", "ex", ")", "{", "try", "{", "// resolve world language multiLanguageText.", "return", "getMultiLanguageTextByLanguage", "(", "Locale", ".", "ENGLISH", ",", "multiLanguageText", ")", ";", "}", "catch", "(", "NotAvailableException", "exx", ")", "{", "// resolve any multiLanguageText.", "return", "getFirstMultiLanguageText", "(", "multiLanguageText", ")", ";", "}", "}", "}" ]
Get the first multiLanguageText for a languageCode from a multiLanguageText type. This is equivalent to calling {@link #getMultiLanguageTextByLanguage(String, MultiLanguageTextOrBuilder)} but the language code is extracted from the locale by calling {@link Locale#getLanguage()}. If no multiLanguageText matches the languageCode, than the first multiLanguageText of any other provided language is returned. @param locale the locale from which a language code is extracted @param multiLanguageText the multiLanguageText type which is searched for multiLanguageTexts in the language @return the first multiLanguageText from the multiLanguageText type for the locale @throws NotAvailableException if no multiLanguageText is provided by the {@code multiLanguageText} argument.
[ "Get", "the", "first", "multiLanguageText", "for", "a", "languageCode", "from", "a", "multiLanguageText", "type", ".", "This", "is", "equivalent", "to", "calling", "{", "@link", "#getMultiLanguageTextByLanguage", "(", "String", "MultiLanguageTextOrBuilder", ")", "}", "but", "the", "language", "code", "is", "extracted", "from", "the", "locale", "by", "calling", "{", "@link", "Locale#getLanguage", "()", "}", ".", "If", "no", "multiLanguageText", "matches", "the", "languageCode", "than", "the", "first", "multiLanguageText", "of", "any", "other", "provided", "language", "is", "returned", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java#L184-L197
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_voicemail_serviceName_directories_id_GET
public OvhVoicemailMessages billingAccount_voicemail_serviceName_directories_id_GET(String billingAccount, String serviceName, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVoicemailMessages.class); }
java
public OvhVoicemailMessages billingAccount_voicemail_serviceName_directories_id_GET(String billingAccount, String serviceName, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVoicemailMessages.class); }
[ "public", "OvhVoicemailMessages", "billingAccount_voicemail_serviceName_directories_id_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "id", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhVoicemailMessages", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/voicemail/{serviceName}/directories/{id} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param id [required] Id of the object
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7942-L7947
alipay/sofa-rpc
extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperProviderObserver.java
ZookeeperProviderObserver.addProviderListener
public void addProviderListener(ConsumerConfig consumerConfig, ProviderInfoListener listener) { if (listener != null) { RegistryUtils.initOrAddList(providerListenerMap, consumerConfig, listener); } }
java
public void addProviderListener(ConsumerConfig consumerConfig, ProviderInfoListener listener) { if (listener != null) { RegistryUtils.initOrAddList(providerListenerMap, consumerConfig, listener); } }
[ "public", "void", "addProviderListener", "(", "ConsumerConfig", "consumerConfig", ",", "ProviderInfoListener", "listener", ")", "{", "if", "(", "listener", "!=", "null", ")", "{", "RegistryUtils", ".", "initOrAddList", "(", "providerListenerMap", ",", "consumerConfig", ",", "listener", ")", ";", "}", "}" ]
Add provider listener. @param consumerConfig the consumer config @param listener the listener
[ "Add", "provider", "listener", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperProviderObserver.java#L59-L63
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java
JacksonUtils.fromJson
public static <T> T fromJson(JsonNode json, Class<T> clazz, ClassLoader classLoader) { return SerializationUtils.fromJson(json, clazz, classLoader); }
java
public static <T> T fromJson(JsonNode json, Class<T> clazz, ClassLoader classLoader) { return SerializationUtils.fromJson(json, clazz, classLoader); }
[ "public", "static", "<", "T", ">", "T", "fromJson", "(", "JsonNode", "json", ",", "Class", "<", "T", ">", "clazz", ",", "ClassLoader", "classLoader", ")", "{", "return", "SerializationUtils", ".", "fromJson", "(", "json", ",", "clazz", ",", "classLoader", ")", ";", "}" ]
Deserialize a {@link JsonNode}, with custom class loader. @param json @param clazz @return
[ "Deserialize", "a", "{", "@link", "JsonNode", "}", "with", "custom", "class", "loader", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L96-L98
apache/flink
flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonReceiver.java
PythonReceiver.collectBuffer
@SuppressWarnings({ "rawtypes", "unchecked" }) public void collectBuffer(Collector<OUT> c, int bufferSize) throws IOException { fileBuffer.position(0); while (fileBuffer.position() < bufferSize) { c.collect(deserializer.deserialize()); } }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public void collectBuffer(Collector<OUT> c, int bufferSize) throws IOException { fileBuffer.position(0); while (fileBuffer.position() < bufferSize) { c.collect(deserializer.deserialize()); } }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "collectBuffer", "(", "Collector", "<", "OUT", ">", "c", ",", "int", "bufferSize", ")", "throws", "IOException", "{", "fileBuffer", ".", "position", "(", "0", ")", ";", "while", "(", "fileBuffer", ".", "position", "(", ")", "<", "bufferSize", ")", "{", "c", ".", "collect", "(", "deserializer", ".", "deserialize", "(", ")", ")", ";", "}", "}" ]
Reads a buffer of the given size from the memory-mapped file, and collects all records contained. This method assumes that all values in the buffer are of the same type. This method does NOT take care of synchronization. The user must guarantee that the buffer was completely written before calling this method. @param c Collector to collect records @param bufferSize size of the buffer @throws IOException
[ "Reads", "a", "buffer", "of", "the", "given", "size", "from", "the", "memory", "-", "mapped", "file", "and", "collects", "all", "records", "contained", ".", "This", "method", "assumes", "that", "all", "values", "in", "the", "buffer", "are", "of", "the", "same", "type", ".", "This", "method", "does", "NOT", "take", "care", "of", "synchronization", ".", "The", "user", "must", "guarantee", "that", "the", "buffer", "was", "completely", "written", "before", "calling", "this", "method", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonReceiver.java#L91-L98
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java
Hierarchy.isSubtype
public static boolean isSubtype(ReferenceType t, ReferenceType possibleSupertype) throws ClassNotFoundException { return Global.getAnalysisCache().getDatabase(Subtypes2.class).isSubtype(t, possibleSupertype); }
java
public static boolean isSubtype(ReferenceType t, ReferenceType possibleSupertype) throws ClassNotFoundException { return Global.getAnalysisCache().getDatabase(Subtypes2.class).isSubtype(t, possibleSupertype); }
[ "public", "static", "boolean", "isSubtype", "(", "ReferenceType", "t", ",", "ReferenceType", "possibleSupertype", ")", "throws", "ClassNotFoundException", "{", "return", "Global", ".", "getAnalysisCache", "(", ")", ".", "getDatabase", "(", "Subtypes2", ".", "class", ")", ".", "isSubtype", "(", "t", ",", "possibleSupertype", ")", ";", "}" ]
Determine if one reference type is a subtype of another. @param t a reference type @param possibleSupertype the possible supertype @return true if t is a subtype of possibleSupertype, false if not
[ "Determine", "if", "one", "reference", "type", "is", "a", "subtype", "of", "another", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L109-L111
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/handlers/LogRepositoryComponent.java
LogRepositoryComponent.addRemoteProcessFile
public static String addRemoteProcessFile(String destinationType, long spTimeStamp, String spPid, String spLabel) { LogRepositoryManager destManager = getManager(destinationType) ; String subProcessFileName = null ; if (destManager instanceof LogRepositoryManagerImpl) subProcessFileName = ((LogRepositoryManagerImpl)destManager).addNewFileFromSubProcess(spTimeStamp, spPid, spLabel) ; return subProcessFileName ; }
java
public static String addRemoteProcessFile(String destinationType, long spTimeStamp, String spPid, String spLabel) { LogRepositoryManager destManager = getManager(destinationType) ; String subProcessFileName = null ; if (destManager instanceof LogRepositoryManagerImpl) subProcessFileName = ((LogRepositoryManagerImpl)destManager).addNewFileFromSubProcess(spTimeStamp, spPid, spLabel) ; return subProcessFileName ; }
[ "public", "static", "String", "addRemoteProcessFile", "(", "String", "destinationType", ",", "long", "spTimeStamp", ",", "String", "spPid", ",", "String", "spLabel", ")", "{", "LogRepositoryManager", "destManager", "=", "getManager", "(", "destinationType", ")", ";", "String", "subProcessFileName", "=", "null", ";", "if", "(", "destManager", "instanceof", "LogRepositoryManagerImpl", ")", "subProcessFileName", "=", "(", "(", "LogRepositoryManagerImpl", ")", "destManager", ")", ".", "addNewFileFromSubProcess", "(", "spTimeStamp", ",", "spPid", ",", "spLabel", ")", ";", "return", "subProcessFileName", ";", "}" ]
add a remote file to the cache of files currently considered for retention on the parent. The child process uses some form of interProcessCommunication to notify receiver of file creation, and this method is driven @param destinationType Type of destination/repository @param spTimeStamp timeStamp to be associated with the file @param spPid Process Id of the creating process @param spLabel Label of the creating process @return String with fully qualified name of file to create
[ "add", "a", "remote", "file", "to", "the", "cache", "of", "files", "currently", "considered", "for", "retention", "on", "the", "parent", ".", "The", "child", "process", "uses", "some", "form", "of", "interProcessCommunication", "to", "notify", "receiver", "of", "file", "creation", "and", "this", "method", "is", "driven" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/handlers/LogRepositoryComponent.java#L104-L110
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java
MailService.findMessages
public List<MailMessage> findMessages(final MailAccount mailAccount, final Predicate<MailMessage> condition, final long timeoutSeconds) { return findMessages(mailAccount, condition, timeoutSeconds, defaultSleepMillis); }
java
public List<MailMessage> findMessages(final MailAccount mailAccount, final Predicate<MailMessage> condition, final long timeoutSeconds) { return findMessages(mailAccount, condition, timeoutSeconds, defaultSleepMillis); }
[ "public", "List", "<", "MailMessage", ">", "findMessages", "(", "final", "MailAccount", "mailAccount", ",", "final", "Predicate", "<", "MailMessage", ">", "condition", ",", "final", "long", "timeoutSeconds", ")", "{", "return", "findMessages", "(", "mailAccount", ",", "condition", ",", "timeoutSeconds", ",", "defaultSleepMillis", ")", ";", "}" ]
<p> Tries to find messages for the specified mail account applying the specified {@code condition} until it times out using the specified {@code timeout} and {@link EmailConstants#MAIL_SLEEP_MILLIS}. </p> <b>Note:</b><br /> This method uses the specified mail account independently without reservation. If, however, the specified mail account has been reserved by any thread (including the current one), an {@link IllegalStateException} is thrown. </p> @param mailAccount the mail account @param condition the condition a message must meet @param timeoutSeconds the timeout in seconds @return an immutable list of mail messages
[ "<p", ">", "Tries", "to", "find", "messages", "for", "the", "specified", "mail", "account", "applying", "the", "specified", "{", "@code", "condition", "}", "until", "it", "times", "out", "using", "the", "specified", "{", "@code", "timeout", "}", "and", "{", "@link", "EmailConstants#MAIL_SLEEP_MILLIS", "}", ".", "<", "/", "p", ">", "<b", ">", "Note", ":", "<", "/", "b", ">", "<br", "/", ">", "This", "method", "uses", "the", "specified", "mail", "account", "independently", "without", "reservation", ".", "If", "however", "the", "specified", "mail", "account", "has", "been", "reserved", "by", "any", "thread", "(", "including", "the", "current", "one", ")", "an", "{", "@link", "IllegalStateException", "}", "is", "thrown", ".", "<", "/", "p", ">" ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java#L346-L349
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CProductPersistenceImpl.java
CProductPersistenceImpl.removeByUUID_G
@Override public CProduct removeByUUID_G(String uuid, long groupId) throws NoSuchCProductException { CProduct cProduct = findByUUID_G(uuid, groupId); return remove(cProduct); }
java
@Override public CProduct removeByUUID_G(String uuid, long groupId) throws NoSuchCProductException { CProduct cProduct = findByUUID_G(uuid, groupId); return remove(cProduct); }
[ "@", "Override", "public", "CProduct", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCProductException", "{", "CProduct", "cProduct", "=", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "return", "remove", "(", "cProduct", ")", ";", "}" ]
Removes the c product where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the c product that was removed
[ "Removes", "the", "c", "product", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CProductPersistenceImpl.java#L804-L810
wcm-io/wcm-io-tooling
commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/XmlContentBuilder.java
XmlContentBuilder.buildContent
public Document buildContent(Map<String, Object> content) { Document doc = documentBuilder.newDocument(); String primaryType = StringUtils.defaultString((String)content.get(PN_PRIMARY_TYPE), NT_UNSTRUCTURED); Element jcrRoot = createJcrRoot(doc, primaryType); exportPayload(doc, jcrRoot, content); return doc; }
java
public Document buildContent(Map<String, Object> content) { Document doc = documentBuilder.newDocument(); String primaryType = StringUtils.defaultString((String)content.get(PN_PRIMARY_TYPE), NT_UNSTRUCTURED); Element jcrRoot = createJcrRoot(doc, primaryType); exportPayload(doc, jcrRoot, content); return doc; }
[ "public", "Document", "buildContent", "(", "Map", "<", "String", ",", "Object", ">", "content", ")", "{", "Document", "doc", "=", "documentBuilder", ".", "newDocument", "(", ")", ";", "String", "primaryType", "=", "StringUtils", ".", "defaultString", "(", "(", "String", ")", "content", ".", "get", "(", "PN_PRIMARY_TYPE", ")", ",", "NT_UNSTRUCTURED", ")", ";", "Element", "jcrRoot", "=", "createJcrRoot", "(", "doc", ",", "primaryType", ")", ";", "exportPayload", "(", "doc", ",", "jcrRoot", ",", "content", ")", ";", "return", "doc", ";", "}" ]
Build XML for any JCR content. @param content Content with properties and nested nodes @return JCR XML
[ "Build", "XML", "for", "any", "JCR", "content", "." ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/XmlContentBuilder.java#L119-L128
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/soap/AuthorizationHeaderHandler.java
AuthorizationHeaderHandler.setAuthorization
@SuppressWarnings("unchecked") /* See constructor comments. */ public void setAuthorization(Object soapClient, AdsSession adsSession) throws AuthenticationException { final String authorizationHeader = authorizationHeaderProvider.getAuthorizationHeader(adsSession, soapClientHandler.getEndpointAddress(soapClient)); soapClientHandler.putAllHttpHeaders(soapClient, new HashMap<String, String>() { { put("Authorization", authorizationHeader); } }); }
java
@SuppressWarnings("unchecked") /* See constructor comments. */ public void setAuthorization(Object soapClient, AdsSession adsSession) throws AuthenticationException { final String authorizationHeader = authorizationHeaderProvider.getAuthorizationHeader(adsSession, soapClientHandler.getEndpointAddress(soapClient)); soapClientHandler.putAllHttpHeaders(soapClient, new HashMap<String, String>() { { put("Authorization", authorizationHeader); } }); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "/* See constructor comments. */", "public", "void", "setAuthorization", "(", "Object", "soapClient", ",", "AdsSession", "adsSession", ")", "throws", "AuthenticationException", "{", "final", "String", "authorizationHeader", "=", "authorizationHeaderProvider", ".", "getAuthorizationHeader", "(", "adsSession", ",", "soapClientHandler", ".", "getEndpointAddress", "(", "soapClient", ")", ")", ";", "soapClientHandler", ".", "putAllHttpHeaders", "(", "soapClient", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", "{", "{", "put", "(", "\"Authorization\"", ",", "authorizationHeader", ")", ";", "}", "}", ")", ";", "}" ]
Sets the authorization header created from the session on the soap client. @param soapClient the SOAP client to set the HTTP header on @param adsSession the session @throws AuthenticationException if the authorization header could not be created
[ "Sets", "the", "authorization", "header", "created", "from", "the", "session", "on", "the", "soap", "client", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/soap/AuthorizationHeaderHandler.java#L61-L72
pwittchen/ReactiveWiFi
library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java
ReactiveWifi.observeWifiSignalLevel
@RequiresPermission(ACCESS_WIFI_STATE) public static Observable<WifiSignalLevel> observeWifiSignalLevel(final Context context) { return observeWifiSignalLevel(context, WifiSignalLevel.getMaxLevel()).map( new Function<Integer, WifiSignalLevel>() { @Override public WifiSignalLevel apply(Integer level) throws Exception { return WifiSignalLevel.fromLevel(level); } }); }
java
@RequiresPermission(ACCESS_WIFI_STATE) public static Observable<WifiSignalLevel> observeWifiSignalLevel(final Context context) { return observeWifiSignalLevel(context, WifiSignalLevel.getMaxLevel()).map( new Function<Integer, WifiSignalLevel>() { @Override public WifiSignalLevel apply(Integer level) throws Exception { return WifiSignalLevel.fromLevel(level); } }); }
[ "@", "RequiresPermission", "(", "ACCESS_WIFI_STATE", ")", "public", "static", "Observable", "<", "WifiSignalLevel", ">", "observeWifiSignalLevel", "(", "final", "Context", "context", ")", "{", "return", "observeWifiSignalLevel", "(", "context", ",", "WifiSignalLevel", ".", "getMaxLevel", "(", ")", ")", ".", "map", "(", "new", "Function", "<", "Integer", ",", "WifiSignalLevel", ">", "(", ")", "{", "@", "Override", "public", "WifiSignalLevel", "apply", "(", "Integer", "level", ")", "throws", "Exception", "{", "return", "WifiSignalLevel", ".", "fromLevel", "(", "level", ")", ";", "}", "}", ")", ";", "}" ]
Observes WiFi signal level with predefined max num levels. Returns WiFi signal level as enum with information about current level @param context Context of the activity or an application @return WifiSignalLevel as an enum
[ "Observes", "WiFi", "signal", "level", "with", "predefined", "max", "num", "levels", ".", "Returns", "WiFi", "signal", "level", "as", "enum", "with", "information", "about", "current", "level" ]
train
https://github.com/pwittchen/ReactiveWiFi/blob/eb2048663c1593b1706cfafb876542a41a223a1f/library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java#L125-L133
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java
base_resource.perform_operationEx
public base_resource perform_operationEx(nitro_service service, String action) throws Exception { if (!service.isLogin() && !get_object_type().equals("login")) service.login(); options option = new options(); option.set_action(action); base_resource response = post_requestEx(service, option); return response; }
java
public base_resource perform_operationEx(nitro_service service, String action) throws Exception { if (!service.isLogin() && !get_object_type().equals("login")) service.login(); options option = new options(); option.set_action(action); base_resource response = post_requestEx(service, option); return response; }
[ "public", "base_resource", "perform_operationEx", "(", "nitro_service", "service", ",", "String", "action", ")", "throws", "Exception", "{", "if", "(", "!", "service", ".", "isLogin", "(", ")", "&&", "!", "get_object_type", "(", ")", ".", "equals", "(", "\"login\"", ")", ")", "service", ".", "login", "(", ")", ";", "options", "option", "=", "new", "options", "(", ")", ";", "option", ".", "set_action", "(", "action", ")", ";", "base_resource", "response", "=", "post_requestEx", "(", "service", ",", "option", ")", ";", "return", "response", ";", "}" ]
Use this method to perform a POST operation that returns a resource ...etc operation on netscaler resource. @param service nitro_service object. @param action action needs to be taken on resource. @return requested resource @throws Exception Nitro exception is thrown.
[ "Use", "this", "method", "to", "perform", "a", "POST", "operation", "that", "returns", "a", "resource", "...", "etc", "operation", "on", "netscaler", "resource", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L374-L382
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java
RendererUtils.findNestingForm
public static FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext) { UIComponent parent = uiComponent.getParent(); while (parent != null && (!ADF_FORM_COMPONENT_FAMILY.equals(parent.getFamily()) && !TRINIDAD_FORM_COMPONENT_FAMILY.equals(parent .getFamily()) && !(parent instanceof UIForm))) { parent = parent.getParent(); } if (parent != null) { //link is nested inside a form String formName = parent.getClientId(facesContext); return new FormInfo(parent, formName); } return null; }
java
public static FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext) { UIComponent parent = uiComponent.getParent(); while (parent != null && (!ADF_FORM_COMPONENT_FAMILY.equals(parent.getFamily()) && !TRINIDAD_FORM_COMPONENT_FAMILY.equals(parent .getFamily()) && !(parent instanceof UIForm))) { parent = parent.getParent(); } if (parent != null) { //link is nested inside a form String formName = parent.getClientId(facesContext); return new FormInfo(parent, formName); } return null; }
[ "public", "static", "FormInfo", "findNestingForm", "(", "UIComponent", "uiComponent", ",", "FacesContext", "facesContext", ")", "{", "UIComponent", "parent", "=", "uiComponent", ".", "getParent", "(", ")", ";", "while", "(", "parent", "!=", "null", "&&", "(", "!", "ADF_FORM_COMPONENT_FAMILY", ".", "equals", "(", "parent", ".", "getFamily", "(", ")", ")", "&&", "!", "TRINIDAD_FORM_COMPONENT_FAMILY", ".", "equals", "(", "parent", ".", "getFamily", "(", ")", ")", "&&", "!", "(", "parent", "instanceof", "UIForm", ")", ")", ")", "{", "parent", "=", "parent", ".", "getParent", "(", ")", ";", "}", "if", "(", "parent", "!=", "null", ")", "{", "//link is nested inside a form", "String", "formName", "=", "parent", ".", "getClientId", "(", "facesContext", ")", ";", "return", "new", "FormInfo", "(", "parent", ",", "formName", ")", ";", "}", "return", "null", ";", "}" ]
Find the enclosing form of a component in the view-tree. All Subclasses of <code>UIForm</code> and all known form-families are searched for. Currently those are the Trinidad form family, and the (old) ADF Faces form family. <p/> There might be additional form families which have to be explicitly entered here. @param uiComponent @param facesContext @return FormInfo Information about the form - the form itself and its name.
[ "Find", "the", "enclosing", "form", "of", "a", "component", "in", "the", "view", "-", "tree", ".", "All", "Subclasses", "of", "<code", ">", "UIForm<", "/", "code", ">", "and", "all", "known", "form", "-", "families", "are", "searched", "for", ".", "Currently", "those", "are", "the", "Trinidad", "form", "family", "and", "the", "(", "old", ")", "ADF", "Faces", "form", "family", ".", "<p", "/", ">", "There", "might", "be", "additional", "form", "families", "which", "have", "to", "be", "explicitly", "entered", "here", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L1098-L1118
apache/incubator-heron
heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java
SchedulerStateManagerAdaptor.setTopology
public Boolean setTopology(TopologyAPI.Topology topology, String topologyName) { return awaitResult(delegate.setTopology(topology, topologyName)); }
java
public Boolean setTopology(TopologyAPI.Topology topology, String topologyName) { return awaitResult(delegate.setTopology(topology, topologyName)); }
[ "public", "Boolean", "setTopology", "(", "TopologyAPI", ".", "Topology", "topology", ",", "String", "topologyName", ")", "{", "return", "awaitResult", "(", "delegate", ".", "setTopology", "(", "topology", ",", "topologyName", ")", ")", ";", "}" ]
Set the topology definition for the given topology @param topologyName the name of the topology @return Boolean - Success or Failure
[ "Set", "the", "topology", "definition", "for", "the", "given", "topology" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L118-L120
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java
LegacyBehavior.repairParentRelationships
public static void repairParentRelationships(Collection<ActivityInstanceImpl> values, String processInstanceId) { for (ActivityInstanceImpl activityInstance : values) { // if the determined activity instance id and the parent activity instance are equal, // just put the activity instance under the process instance if (valuesEqual(activityInstance.getId(), activityInstance.getParentActivityInstanceId())) { activityInstance.setParentActivityInstanceId(processInstanceId); } } }
java
public static void repairParentRelationships(Collection<ActivityInstanceImpl> values, String processInstanceId) { for (ActivityInstanceImpl activityInstance : values) { // if the determined activity instance id and the parent activity instance are equal, // just put the activity instance under the process instance if (valuesEqual(activityInstance.getId(), activityInstance.getParentActivityInstanceId())) { activityInstance.setParentActivityInstanceId(processInstanceId); } } }
[ "public", "static", "void", "repairParentRelationships", "(", "Collection", "<", "ActivityInstanceImpl", ">", "values", ",", "String", "processInstanceId", ")", "{", "for", "(", "ActivityInstanceImpl", "activityInstance", ":", "values", ")", "{", "// if the determined activity instance id and the parent activity instance are equal,", "// just put the activity instance under the process instance", "if", "(", "valuesEqual", "(", "activityInstance", ".", "getId", "(", ")", ",", "activityInstance", ".", "getParentActivityInstanceId", "(", ")", ")", ")", "{", "activityInstance", ".", "setParentActivityInstanceId", "(", "processInstanceId", ")", ";", "}", "}", "}" ]
This is relevant for {@link GetActivityInstanceCmd} where in case of legacy multi-instance execution trees, the default algorithm omits multi-instance activity instances.
[ "This", "is", "relevant", "for", "{" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java#L508-L516
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/FailOverExecutionControlProvider.java
FailOverExecutionControlProvider.generate
@Override public ExecutionControl generate(ExecutionEnv env, Map<String, String> parameters) throws Throwable { Throwable thrown = null; for (int i = 0; i <= 9; ++i) { String param = parameters.get("" + i); if (param != null && !param.isEmpty()) { try { ExecutionControl ec = ExecutionControl.generate(env, param); logger().finest( String.format("FailOverExecutionControlProvider: Success %s -- %d = %s\n", name(), i, param)); return ec; } catch (Throwable ex) { logger().warning( String.format("FailOverExecutionControlProvider: Failure %s -- %d = %s -- %s\n", name(), i, param, ex.toString())); StringWriter writer = new StringWriter(); PrintWriter log = new PrintWriter(writer); log.println("FailOverExecutionControlProvider:"); ex.printStackTrace(log); log.flush(); logger().fine(writer.toString()); // only care about the first, and only if they all fail if (thrown == null) { thrown = ex; } } } } logger().severe("FailOverExecutionControlProvider: Terminating, failovers exhausted"); if (thrown == null) { throw new IllegalArgumentException("All least one parameter must be set to a provider."); } throw thrown; }
java
@Override public ExecutionControl generate(ExecutionEnv env, Map<String, String> parameters) throws Throwable { Throwable thrown = null; for (int i = 0; i <= 9; ++i) { String param = parameters.get("" + i); if (param != null && !param.isEmpty()) { try { ExecutionControl ec = ExecutionControl.generate(env, param); logger().finest( String.format("FailOverExecutionControlProvider: Success %s -- %d = %s\n", name(), i, param)); return ec; } catch (Throwable ex) { logger().warning( String.format("FailOverExecutionControlProvider: Failure %s -- %d = %s -- %s\n", name(), i, param, ex.toString())); StringWriter writer = new StringWriter(); PrintWriter log = new PrintWriter(writer); log.println("FailOverExecutionControlProvider:"); ex.printStackTrace(log); log.flush(); logger().fine(writer.toString()); // only care about the first, and only if they all fail if (thrown == null) { thrown = ex; } } } } logger().severe("FailOverExecutionControlProvider: Terminating, failovers exhausted"); if (thrown == null) { throw new IllegalArgumentException("All least one parameter must be set to a provider."); } throw thrown; }
[ "@", "Override", "public", "ExecutionControl", "generate", "(", "ExecutionEnv", "env", ",", "Map", "<", "String", ",", "String", ">", "parameters", ")", "throws", "Throwable", "{", "Throwable", "thrown", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "9", ";", "++", "i", ")", "{", "String", "param", "=", "parameters", ".", "get", "(", "\"\"", "+", "i", ")", ";", "if", "(", "param", "!=", "null", "&&", "!", "param", ".", "isEmpty", "(", ")", ")", "{", "try", "{", "ExecutionControl", "ec", "=", "ExecutionControl", ".", "generate", "(", "env", ",", "param", ")", ";", "logger", "(", ")", ".", "finest", "(", "String", ".", "format", "(", "\"FailOverExecutionControlProvider: Success %s -- %d = %s\\n\"", ",", "name", "(", ")", ",", "i", ",", "param", ")", ")", ";", "return", "ec", ";", "}", "catch", "(", "Throwable", "ex", ")", "{", "logger", "(", ")", ".", "warning", "(", "String", ".", "format", "(", "\"FailOverExecutionControlProvider: Failure %s -- %d = %s -- %s\\n\"", ",", "name", "(", ")", ",", "i", ",", "param", ",", "ex", ".", "toString", "(", ")", ")", ")", ";", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "PrintWriter", "log", "=", "new", "PrintWriter", "(", "writer", ")", ";", "log", ".", "println", "(", "\"FailOverExecutionControlProvider:\"", ")", ";", "ex", ".", "printStackTrace", "(", "log", ")", ";", "log", ".", "flush", "(", ")", ";", "logger", "(", ")", ".", "fine", "(", "writer", ".", "toString", "(", ")", ")", ";", "// only care about the first, and only if they all fail", "if", "(", "thrown", "==", "null", ")", "{", "thrown", "=", "ex", ";", "}", "}", "}", "}", "logger", "(", ")", ".", "severe", "(", "\"FailOverExecutionControlProvider: Terminating, failovers exhausted\"", ")", ";", "if", "(", "thrown", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"All least one parameter must be set to a provider.\"", ")", ";", "}", "throw", "thrown", ";", "}" ]
Create and return a locally executing {@code ExecutionControl} instance. At least one parameter should have a spec. @param env the execution environment, provided by JShell @param parameters the modified parameter map. @return the execution engine @throws Throwable if all the given providers fail, the exception that occurred on the first attempt to create the execution engine.
[ "Create", "and", "return", "a", "locally", "executing", "{", "@code", "ExecutionControl", "}", "instance", ".", "At", "least", "one", "parameter", "should", "have", "a", "spec", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/FailOverExecutionControlProvider.java#L95-L131
apache/incubator-gobblin
gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java
Instrumented.getMetricContext
public static MetricContext getMetricContext(State state, Class<?> klazz) { return getMetricContext(state, klazz, new ArrayList<Tag<?>>()); }
java
public static MetricContext getMetricContext(State state, Class<?> klazz) { return getMetricContext(state, klazz, new ArrayList<Tag<?>>()); }
[ "public", "static", "MetricContext", "getMetricContext", "(", "State", "state", ",", "Class", "<", "?", ">", "klazz", ")", "{", "return", "getMetricContext", "(", "state", ",", "klazz", ",", "new", "ArrayList", "<", "Tag", "<", "?", ">", ">", "(", ")", ")", ";", "}" ]
Gets metric context with no additional tags. See {@link #getMetricContext(State, Class, List)}
[ "Gets", "metric", "context", "with", "no", "additional", "tags", ".", "See", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java#L90-L92
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.eraseJob
public GitlabJob eraseJob(Integer projectId, Integer jobId) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabJob.URL + "/" + sanitizeId(jobId, "JobID") + "/erase"; return dispatch().to(tailUrl, GitlabJob.class); }
java
public GitlabJob eraseJob(Integer projectId, Integer jobId) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabJob.URL + "/" + sanitizeId(jobId, "JobID") + "/erase"; return dispatch().to(tailUrl, GitlabJob.class); }
[ "public", "GitlabJob", "eraseJob", "(", "Integer", "projectId", ",", "Integer", "jobId", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "sanitizeProjectId", "(", "projectId", ")", "+", "GitlabJob", ".", "URL", "+", "\"/\"", "+", "sanitizeId", "(", "jobId", ",", "\"JobID\"", ")", "+", "\"/erase\"", ";", "return", "dispatch", "(", ")", ".", "to", "(", "tailUrl", ",", "GitlabJob", ".", "class", ")", ";", "}" ]
Erase a single job of a project (remove job artifacts and a job trace) @param projectId @param jobId @return @throws IOException on gitlab api call error
[ "Erase", "a", "single", "job", "of", "a", "project", "(", "remove", "job", "artifacts", "and", "a", "job", "trace", ")" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L1059-L1062
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkmax/MkMaxTree.java
MkMaxTree.kNNdistanceAdjustment
@Override protected void kNNdistanceAdjustment(MkMaxEntry entry, Map<DBID, KNNList> knnLists) { MkMaxTreeNode<O> node = getNode(entry); double knnDist_node = 0.; if (node.isLeaf()) { for (int i = 0; i < node.getNumEntries(); i++) { MkMaxEntry leafEntry = node.getEntry(i); leafEntry.setKnnDistance(knnLists.get(leafEntry.getRoutingObjectID()).getKNNDistance()); knnDist_node = Math.max(knnDist_node, leafEntry.getKnnDistance()); } } else { for (int i = 0; i < node.getNumEntries(); i++) { MkMaxEntry dirEntry = node.getEntry(i); kNNdistanceAdjustment(dirEntry, knnLists); knnDist_node = Math.max(knnDist_node, dirEntry.getKnnDistance()); } } entry.setKnnDistance(knnDist_node); }
java
@Override protected void kNNdistanceAdjustment(MkMaxEntry entry, Map<DBID, KNNList> knnLists) { MkMaxTreeNode<O> node = getNode(entry); double knnDist_node = 0.; if (node.isLeaf()) { for (int i = 0; i < node.getNumEntries(); i++) { MkMaxEntry leafEntry = node.getEntry(i); leafEntry.setKnnDistance(knnLists.get(leafEntry.getRoutingObjectID()).getKNNDistance()); knnDist_node = Math.max(knnDist_node, leafEntry.getKnnDistance()); } } else { for (int i = 0; i < node.getNumEntries(); i++) { MkMaxEntry dirEntry = node.getEntry(i); kNNdistanceAdjustment(dirEntry, knnLists); knnDist_node = Math.max(knnDist_node, dirEntry.getKnnDistance()); } } entry.setKnnDistance(knnDist_node); }
[ "@", "Override", "protected", "void", "kNNdistanceAdjustment", "(", "MkMaxEntry", "entry", ",", "Map", "<", "DBID", ",", "KNNList", ">", "knnLists", ")", "{", "MkMaxTreeNode", "<", "O", ">", "node", "=", "getNode", "(", "entry", ")", ";", "double", "knnDist_node", "=", "0.", ";", "if", "(", "node", ".", "isLeaf", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getNumEntries", "(", ")", ";", "i", "++", ")", "{", "MkMaxEntry", "leafEntry", "=", "node", ".", "getEntry", "(", "i", ")", ";", "leafEntry", ".", "setKnnDistance", "(", "knnLists", ".", "get", "(", "leafEntry", ".", "getRoutingObjectID", "(", ")", ")", ".", "getKNNDistance", "(", ")", ")", ";", "knnDist_node", "=", "Math", ".", "max", "(", "knnDist_node", ",", "leafEntry", ".", "getKnnDistance", "(", ")", ")", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getNumEntries", "(", ")", ";", "i", "++", ")", "{", "MkMaxEntry", "dirEntry", "=", "node", ".", "getEntry", "(", "i", ")", ";", "kNNdistanceAdjustment", "(", "dirEntry", ",", "knnLists", ")", ";", "knnDist_node", "=", "Math", ".", "max", "(", "knnDist_node", ",", "dirEntry", ".", "getKnnDistance", "(", ")", ")", ";", "}", "}", "entry", ".", "setKnnDistance", "(", "knnDist_node", ")", ";", "}" ]
Adjusts the knn distance in the subtree of the specified root entry.
[ "Adjusts", "the", "knn", "distance", "in", "the", "subtree", "of", "the", "specified", "root", "entry", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkmax/MkMaxTree.java#L137-L155
molgenis/molgenis
molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java
JsMagmaScriptEvaluator.createBindings
private Bindings createBindings(Entity entity, int depth) { Bindings bindings = new SimpleBindings(); JSObject global = (JSObject) magmaBindings.get("nashorn.global"); JSObject magmaScript = (JSObject) global.getMember(KEY_MAGMA_SCRIPT); JSObject dollarFunction = (JSObject) magmaScript.getMember(KEY_DOLLAR); JSObject bindFunction = (JSObject) dollarFunction.getMember(BIND); Object boundDollar = bindFunction.call(dollarFunction, toScriptEngineValueMap(entity, depth)); bindings.put(KEY_DOLLAR, boundDollar); bindings.put(KEY_NEW_VALUE, magmaScript.getMember(KEY_NEW_VALUE)); bindings.put(KEY_IS_NULL, magmaScript.getMember(KEY_IS_NULL)); return bindings; }
java
private Bindings createBindings(Entity entity, int depth) { Bindings bindings = new SimpleBindings(); JSObject global = (JSObject) magmaBindings.get("nashorn.global"); JSObject magmaScript = (JSObject) global.getMember(KEY_MAGMA_SCRIPT); JSObject dollarFunction = (JSObject) magmaScript.getMember(KEY_DOLLAR); JSObject bindFunction = (JSObject) dollarFunction.getMember(BIND); Object boundDollar = bindFunction.call(dollarFunction, toScriptEngineValueMap(entity, depth)); bindings.put(KEY_DOLLAR, boundDollar); bindings.put(KEY_NEW_VALUE, magmaScript.getMember(KEY_NEW_VALUE)); bindings.put(KEY_IS_NULL, magmaScript.getMember(KEY_IS_NULL)); return bindings; }
[ "private", "Bindings", "createBindings", "(", "Entity", "entity", ",", "int", "depth", ")", "{", "Bindings", "bindings", "=", "new", "SimpleBindings", "(", ")", ";", "JSObject", "global", "=", "(", "JSObject", ")", "magmaBindings", ".", "get", "(", "\"nashorn.global\"", ")", ";", "JSObject", "magmaScript", "=", "(", "JSObject", ")", "global", ".", "getMember", "(", "KEY_MAGMA_SCRIPT", ")", ";", "JSObject", "dollarFunction", "=", "(", "JSObject", ")", "magmaScript", ".", "getMember", "(", "KEY_DOLLAR", ")", ";", "JSObject", "bindFunction", "=", "(", "JSObject", ")", "dollarFunction", ".", "getMember", "(", "BIND", ")", ";", "Object", "boundDollar", "=", "bindFunction", ".", "call", "(", "dollarFunction", ",", "toScriptEngineValueMap", "(", "entity", ",", "depth", ")", ")", ";", "bindings", ".", "put", "(", "KEY_DOLLAR", ",", "boundDollar", ")", ";", "bindings", ".", "put", "(", "KEY_NEW_VALUE", ",", "magmaScript", ".", "getMember", "(", "KEY_NEW_VALUE", ")", ")", ";", "bindings", ".", "put", "(", "KEY_IS_NULL", ",", "magmaScript", ".", "getMember", "(", "KEY_IS_NULL", ")", ")", ";", "return", "bindings", ";", "}" ]
Creates magmascript bindings for a given Entity. @param entity the entity to bind to the magmascript $ function @param depth maximum depth to follow references when creating the entity value map @return Bindings with $ function bound to the entity
[ "Creates", "magmascript", "bindings", "for", "a", "given", "Entity", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java#L128-L139
FXMisc/Flowless
src/main/java/org/fxmisc/flowless/CellPositioner.java
CellPositioner.placeStartFromEnd
public C placeStartFromEnd(int itemIndex, double startOffEnd) { C cell = getSizedCell(itemIndex); double y = sizeTracker.getViewportLength() + startOffEnd; relocate(cell, 0, y); cell.getNode().setVisible(true); return cell; }
java
public C placeStartFromEnd(int itemIndex, double startOffEnd) { C cell = getSizedCell(itemIndex); double y = sizeTracker.getViewportLength() + startOffEnd; relocate(cell, 0, y); cell.getNode().setVisible(true); return cell; }
[ "public", "C", "placeStartFromEnd", "(", "int", "itemIndex", ",", "double", "startOffEnd", ")", "{", "C", "cell", "=", "getSizedCell", "(", "itemIndex", ")", ";", "double", "y", "=", "sizeTracker", ".", "getViewportLength", "(", ")", "+", "startOffEnd", ";", "relocate", "(", "cell", ",", "0", ",", "y", ")", ";", "cell", ".", "getNode", "(", ")", ".", "setVisible", "(", "true", ")", ";", "return", "cell", ";", "}" ]
Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by {@code endOffStart}, so that the node's <em>bottom</em> edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge. See {@link OrientationHelper}'s javadoc for more explanation on what quoted terms mean. <pre><code> --------- bottom of cell's node if startOffStart is negative __________ "top edge" of viewport / bottom of cell's node if startOffStart = 0 | | |--------- bottom of cell's node if startOffStart is positive | </code></pre> @param itemIndex the index of the item in the list of all (not currently visible) cells @param startOffEnd the amount by which to offset the "layoutY" value of the cell's node
[ "Properly", "resizes", "the", "cell", "s", "node", "and", "sets", "its", "layoutY", "value", "so", "that", "is", "the", "last", "visible", "node", "in", "the", "viewport", "and", "further", "offsets", "this", "value", "by", "{", "@code", "endOffStart", "}", "so", "that", "the", "node", "s", "<em", ">", "bottom<", "/", "em", ">", "edge", "appears", "(", "if", "negative", ")", "above", "(", "if", "0", ")", "at", "or", "(", "if", "negative", ")", "below", "the", "viewport", "s", "top", "edge", ".", "See", "{", "@link", "OrientationHelper", "}", "s", "javadoc", "for", "more", "explanation", "on", "what", "quoted", "terms", "mean", "." ]
train
https://github.com/FXMisc/Flowless/blob/dce2269ebafed8f79203d00085af41f06f3083bc/src/main/java/org/fxmisc/flowless/CellPositioner.java#L204-L210
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.Chebyshev
public static double Chebyshev(double x1, double y1, double x2, double y2) { double max = Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2)); return max; }
java
public static double Chebyshev(double x1, double y1, double x2, double y2) { double max = Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2)); return max; }
[ "public", "static", "double", "Chebyshev", "(", "double", "x1", ",", "double", "y1", ",", "double", "x2", ",", "double", "y2", ")", "{", "double", "max", "=", "Math", ".", "max", "(", "Math", ".", "abs", "(", "x1", "-", "x2", ")", ",", "Math", ".", "abs", "(", "y1", "-", "y2", ")", ")", ";", "return", "max", ";", "}" ]
Gets the Chebyshev distance between two points. @param x1 X1 axis coordinate. @param y1 Y1 axis coordinate. @param x2 X2 axis coordinate. @param y2 Y2 axis coordinate. @return The Chebyshev distance between x and y.
[ "Gets", "the", "Chebyshev", "distance", "between", "two", "points", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L198-L201
lkwg82/enforcer-rules
src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java
EnforcerRuleUtils.checkIfModelMatches
protected boolean checkIfModelMatches ( String groupId, String artifactId, String version, Model model ) { // try these first. String modelGroup = model.getGroupId(); String modelArtifactId = model.getArtifactId(); String modelVersion = model.getVersion(); try { if ( StringUtils.isEmpty( modelGroup ) ) { modelGroup = model.getParent().getGroupId(); } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.groupId} modelGroup = (String) helper.evaluate( modelGroup ); } if ( StringUtils.isEmpty( modelVersion ) ) { modelVersion = model.getParent().getVersion(); } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.version} modelVersion = (String) helper.evaluate( modelVersion ); } // Is this only required for Maven2? modelArtifactId = (String) helper.evaluate( modelArtifactId ); } catch ( NullPointerException e ) { // this is probably bad. I don't have a valid // group or version and I can't find a // parent???? // lets see if it's what we're looking for // anyway. } catch ( ExpressionEvaluationException e ) { // as above } return ( StringUtils.equals( groupId, modelGroup ) && StringUtils.equals( version, modelVersion ) && StringUtils .equals( artifactId, modelArtifactId ) ); }
java
protected boolean checkIfModelMatches ( String groupId, String artifactId, String version, Model model ) { // try these first. String modelGroup = model.getGroupId(); String modelArtifactId = model.getArtifactId(); String modelVersion = model.getVersion(); try { if ( StringUtils.isEmpty( modelGroup ) ) { modelGroup = model.getParent().getGroupId(); } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.groupId} modelGroup = (String) helper.evaluate( modelGroup ); } if ( StringUtils.isEmpty( modelVersion ) ) { modelVersion = model.getParent().getVersion(); } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.version} modelVersion = (String) helper.evaluate( modelVersion ); } // Is this only required for Maven2? modelArtifactId = (String) helper.evaluate( modelArtifactId ); } catch ( NullPointerException e ) { // this is probably bad. I don't have a valid // group or version and I can't find a // parent???? // lets see if it's what we're looking for // anyway. } catch ( ExpressionEvaluationException e ) { // as above } return ( StringUtils.equals( groupId, modelGroup ) && StringUtils.equals( version, modelVersion ) && StringUtils .equals( artifactId, modelArtifactId ) ); }
[ "protected", "boolean", "checkIfModelMatches", "(", "String", "groupId", ",", "String", "artifactId", ",", "String", "version", ",", "Model", "model", ")", "{", "// try these first.", "String", "modelGroup", "=", "model", ".", "getGroupId", "(", ")", ";", "String", "modelArtifactId", "=", "model", ".", "getArtifactId", "(", ")", ";", "String", "modelVersion", "=", "model", ".", "getVersion", "(", ")", ";", "try", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "modelGroup", ")", ")", "{", "modelGroup", "=", "model", ".", "getParent", "(", ")", ".", "getGroupId", "(", ")", ";", "}", "else", "{", "// MENFORCER-30, handle cases where the value is a property like ${project.parent.groupId}", "modelGroup", "=", "(", "String", ")", "helper", ".", "evaluate", "(", "modelGroup", ")", ";", "}", "if", "(", "StringUtils", ".", "isEmpty", "(", "modelVersion", ")", ")", "{", "modelVersion", "=", "model", ".", "getParent", "(", ")", ".", "getVersion", "(", ")", ";", "}", "else", "{", "// MENFORCER-30, handle cases where the value is a property like ${project.parent.version}", "modelVersion", "=", "(", "String", ")", "helper", ".", "evaluate", "(", "modelVersion", ")", ";", "}", "// Is this only required for Maven2?", "modelArtifactId", "=", "(", "String", ")", "helper", ".", "evaluate", "(", "modelArtifactId", ")", ";", "}", "catch", "(", "NullPointerException", "e", ")", "{", "// this is probably bad. I don't have a valid", "// group or version and I can't find a", "// parent????", "// lets see if it's what we're looking for", "// anyway.", "}", "catch", "(", "ExpressionEvaluationException", "e", ")", "{", "// as above", "}", "return", "(", "StringUtils", ".", "equals", "(", "groupId", ",", "modelGroup", ")", "&&", "StringUtils", ".", "equals", "(", "version", ",", "modelVersion", ")", "&&", "StringUtils", ".", "equals", "(", "artifactId", ",", "modelArtifactId", ")", ")", ";", "}" ]
Make sure the model is the one I'm expecting. @param groupId the group id @param artifactId the artifact id @param version the version @param model Model being checked. @return true, if check if model matches
[ "Make", "sure", "the", "model", "is", "the", "one", "I", "m", "expecting", "." ]
train
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java#L285-L331
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.createOccurrence
public final Occurrence createOccurrence(String parent, Occurrence occurrence) { CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder().setParent(parent).setOccurrence(occurrence).build(); return createOccurrence(request); }
java
public final Occurrence createOccurrence(String parent, Occurrence occurrence) { CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder().setParent(parent).setOccurrence(occurrence).build(); return createOccurrence(request); }
[ "public", "final", "Occurrence", "createOccurrence", "(", "String", "parent", ",", "Occurrence", "occurrence", ")", "{", "CreateOccurrenceRequest", "request", "=", "CreateOccurrenceRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setOccurrence", "(", "occurrence", ")", ".", "build", "(", ")", ";", "return", "createOccurrence", "(", "request", ")", ";", "}" ]
Creates a new occurrence. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); Occurrence occurrence = Occurrence.newBuilder().build(); Occurrence response = grafeasV1Beta1Client.createOccurrence(parent.toString(), occurrence); } </code></pre> @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrence is to be created. @param occurrence The occurrence to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "occurrence", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L571-L576
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/converter/filter/AvroFieldsPickConverter.java
AvroFieldsPickConverter.createSchema
private static Schema createSchema(Schema schema, String fieldsStr) { List<String> fields = SPLITTER_ON_COMMA.splitToList(fieldsStr); TrieNode root = buildTrie(fields); return createSchemaHelper(schema, root); }
java
private static Schema createSchema(Schema schema, String fieldsStr) { List<String> fields = SPLITTER_ON_COMMA.splitToList(fieldsStr); TrieNode root = buildTrie(fields); return createSchemaHelper(schema, root); }
[ "private", "static", "Schema", "createSchema", "(", "Schema", "schema", ",", "String", "fieldsStr", ")", "{", "List", "<", "String", ">", "fields", "=", "SPLITTER_ON_COMMA", ".", "splitToList", "(", "fieldsStr", ")", ";", "TrieNode", "root", "=", "buildTrie", "(", "fields", ")", ";", "return", "createSchemaHelper", "(", "schema", ",", "root", ")", ";", "}" ]
Creates Schema containing only specified fields. Traversing via either fully qualified names or input Schema is quite inefficient as it's hard to align each other. Also, as Schema's fields is immutable, all the fields need to be collected before updating field in Schema. Figuring out all required field in just input Schema and fully qualified names is also not efficient as well. This is where Trie comes into picture. Having fully qualified names in Trie means, it is aligned with input schema and also it can provides all children on specific prefix. This solves two problems mentioned above. 1. Based on fully qualified field name, build a Trie to present dependencies. 2. Traverse the Trie. If it's leaf, add field. If it's not a leaf, recurse with child schema. @param schema @param fieldsStr @return
[ "Creates", "Schema", "containing", "only", "specified", "fields", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/filter/AvroFieldsPickConverter.java#L133-L137
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/UnitVectorProperty3dfx.java
UnitVectorProperty3dfx.set
public void set(double x, double y, double z) { assert Vector3D.isUnitVector(x, y, z) : AssertMessages.normalizedParameters(0, 1, 2); if ((x != getX() || y != getY() || z != getZ()) && !isBound()) { final Vector3dfx v = super.get(); v.set(x, y, z); fireValueChangedEvent(); } }
java
public void set(double x, double y, double z) { assert Vector3D.isUnitVector(x, y, z) : AssertMessages.normalizedParameters(0, 1, 2); if ((x != getX() || y != getY() || z != getZ()) && !isBound()) { final Vector3dfx v = super.get(); v.set(x, y, z); fireValueChangedEvent(); } }
[ "public", "void", "set", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "assert", "Vector3D", ".", "isUnitVector", "(", "x", ",", "y", ",", "z", ")", ":", "AssertMessages", ".", "normalizedParameters", "(", "0", ",", "1", ",", "2", ")", ";", "if", "(", "(", "x", "!=", "getX", "(", ")", "||", "y", "!=", "getY", "(", ")", "||", "z", "!=", "getZ", "(", ")", ")", "&&", "!", "isBound", "(", ")", ")", "{", "final", "Vector3dfx", "v", "=", "super", ".", "get", "(", ")", ";", "v", ".", "set", "(", "x", ",", "y", ",", "z", ")", ";", "fireValueChangedEvent", "(", ")", ";", "}", "}" ]
Change the coordinates of the vector. @param x x coordinate of the vector. @param y y coordinate of the vector. @param z z coordinate of the vector.
[ "Change", "the", "coordinates", "of", "the", "vector", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/UnitVectorProperty3dfx.java#L137-L144
trustathsh/ironcommon
src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java
Properties.getString
public String getString(String propertyPath, String defaultValue) { Object o = getValue(propertyPath, defaultValue); if (o != null) { return o.toString(); } else { // if the defaultValue is null return (String) o; } }
java
public String getString(String propertyPath, String defaultValue) { Object o = getValue(propertyPath, defaultValue); if (o != null) { return o.toString(); } else { // if the defaultValue is null return (String) o; } }
[ "public", "String", "getString", "(", "String", "propertyPath", ",", "String", "defaultValue", ")", "{", "Object", "o", "=", "getValue", "(", "propertyPath", ",", "defaultValue", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "return", "o", ".", "toString", "(", ")", ";", "}", "else", "{", "// if the defaultValue is null", "return", "(", "String", ")", "o", ";", "}", "}" ]
Get the String-value from the property path. If the property path does not exist, the default value is returned. @param propertyPath Example: foo.bar.key @param defaultValue is returned when the propertyPath does not exist @return the value for the given propertyPath
[ "Get", "the", "String", "-", "value", "from", "the", "property", "path", ".", "If", "the", "property", "path", "does", "not", "exist", "the", "default", "value", "is", "returned", "." ]
train
https://github.com/trustathsh/ironcommon/blob/fee589a9300ab16744ca12fafae4357dd18c9fcb/src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java#L244-L252
JodaOrg/joda-time
src/main/java/org/joda/time/Partial.java
Partial.without
public Partial without(DateTimeFieldType fieldType) { int index = indexOf(fieldType); if (index != -1) { DateTimeFieldType[] newTypes = new DateTimeFieldType[size() - 1]; int[] newValues = new int[size() - 1]; System.arraycopy(iTypes, 0, newTypes, 0, index); System.arraycopy(iTypes, index + 1, newTypes, index, newTypes.length - index); System.arraycopy(iValues, 0, newValues, 0, index); System.arraycopy(iValues, index + 1, newValues, index, newValues.length - index); Partial newPartial = new Partial(iChronology, newTypes, newValues); iChronology.validate(newPartial, newValues); return newPartial; } return this; }
java
public Partial without(DateTimeFieldType fieldType) { int index = indexOf(fieldType); if (index != -1) { DateTimeFieldType[] newTypes = new DateTimeFieldType[size() - 1]; int[] newValues = new int[size() - 1]; System.arraycopy(iTypes, 0, newTypes, 0, index); System.arraycopy(iTypes, index + 1, newTypes, index, newTypes.length - index); System.arraycopy(iValues, 0, newValues, 0, index); System.arraycopy(iValues, index + 1, newValues, index, newValues.length - index); Partial newPartial = new Partial(iChronology, newTypes, newValues); iChronology.validate(newPartial, newValues); return newPartial; } return this; }
[ "public", "Partial", "without", "(", "DateTimeFieldType", "fieldType", ")", "{", "int", "index", "=", "indexOf", "(", "fieldType", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "DateTimeFieldType", "[", "]", "newTypes", "=", "new", "DateTimeFieldType", "[", "size", "(", ")", "-", "1", "]", ";", "int", "[", "]", "newValues", "=", "new", "int", "[", "size", "(", ")", "-", "1", "]", ";", "System", ".", "arraycopy", "(", "iTypes", ",", "0", ",", "newTypes", ",", "0", ",", "index", ")", ";", "System", ".", "arraycopy", "(", "iTypes", ",", "index", "+", "1", ",", "newTypes", ",", "index", ",", "newTypes", ".", "length", "-", "index", ")", ";", "System", ".", "arraycopy", "(", "iValues", ",", "0", ",", "newValues", ",", "0", ",", "index", ")", ";", "System", ".", "arraycopy", "(", "iValues", ",", "index", "+", "1", ",", "newValues", ",", "index", ",", "newValues", ".", "length", "-", "index", ")", ";", "Partial", "newPartial", "=", "new", "Partial", "(", "iChronology", ",", "newTypes", ",", "newValues", ")", ";", "iChronology", ".", "validate", "(", "newPartial", ",", "newValues", ")", ";", "return", "newPartial", ";", "}", "return", "this", ";", "}" ]
Gets a copy of this date with the specified field removed. <p> If this partial did not previously support the field, no error occurs. @param fieldType the field type to remove, may be null @return a copy of this instance with the field removed
[ "Gets", "a", "copy", "of", "this", "date", "with", "the", "specified", "field", "removed", ".", "<p", ">", "If", "this", "partial", "did", "not", "previously", "support", "the", "field", "no", "error", "occurs", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Partial.java#L515-L529
liferay/com-liferay-commerce
commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceCountryUtil.java
CommerceCountryUtil.findByUUID_G
public static CommerceCountry findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.exception.NoSuchCountryException { return getPersistence().findByUUID_G(uuid, groupId); }
java
public static CommerceCountry findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.exception.NoSuchCountryException { return getPersistence().findByUUID_G(uuid, groupId); }
[ "public", "static", "CommerceCountry", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "exception", ".", "NoSuchCountryException", "{", "return", "getPersistence", "(", ")", ".", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "}" ]
Returns the commerce country where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCountryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce country @throws NoSuchCountryException if a matching commerce country could not be found
[ "Returns", "the", "commerce", "country", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCountryException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceCountryUtil.java#L279-L282
OpenLiberty/open-liberty
dev/com.ibm.ws.javamail/src/com/ibm/ws/javamail/internal/injection/MailSessionResourceFactoryBuilder.java
MailSessionResourceFactoryBuilder.getMailSessionID
private static final String getMailSessionID(String application, String module, String component, String jndiName) { StringBuilder sb = new StringBuilder(jndiName.length() + 80); if (application != null) { sb.append("application").append('[').append(application).append(']').append('/'); if (module != null) { sb.append("module").append('[').append(module).append(']').append('/'); if (component != null) sb.append("component").append('[').append(component).append(']').append('/'); } } return sb.append(MailSessionService.MAILSESSIONID).append('[').append(jndiName).append(']').toString(); }
java
private static final String getMailSessionID(String application, String module, String component, String jndiName) { StringBuilder sb = new StringBuilder(jndiName.length() + 80); if (application != null) { sb.append("application").append('[').append(application).append(']').append('/'); if (module != null) { sb.append("module").append('[').append(module).append(']').append('/'); if (component != null) sb.append("component").append('[').append(component).append(']').append('/'); } } return sb.append(MailSessionService.MAILSESSIONID).append('[').append(jndiName).append(']').toString(); }
[ "private", "static", "final", "String", "getMailSessionID", "(", "String", "application", ",", "String", "module", ",", "String", "component", ",", "String", "jndiName", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "jndiName", ".", "length", "(", ")", "+", "80", ")", ";", "if", "(", "application", "!=", "null", ")", "{", "sb", ".", "append", "(", "\"application\"", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "application", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "if", "(", "module", "!=", "null", ")", "{", "sb", ".", "append", "(", "\"module\"", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "module", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "if", "(", "component", "!=", "null", ")", "sb", ".", "append", "(", "\"component\"", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "component", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "}", "}", "return", "sb", ".", "append", "(", "MailSessionService", ".", "MAILSESSIONID", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "jndiName", ")", ".", "append", "(", "'", "'", ")", ".", "toString", "(", ")", ";", "}" ]
Utility method that creates a unique identifier for an application defined data source. For example, application[MyApp]/module[MyModule]/connectionFactory[java:module/env/jdbc/cf1] @param application application name if data source is in java:app, java:module, or java:comp. Otherwise null. @param module module name if data source is in java:module or java:comp. Otherwise null. @param component component name if data source is in java:comp and isn't in web container. Otherwise null. @param jndiName configured JNDI name for the data source. For example, java:module/env/jca/cf1 @return the unique identifier
[ "Utility", "method", "that", "creates", "a", "unique", "identifier", "for", "an", "application", "defined", "data", "source", ".", "For", "example", "application", "[", "MyApp", "]", "/", "module", "[", "MyModule", "]", "/", "connectionFactory", "[", "java", ":", "module", "/", "env", "/", "jdbc", "/", "cf1", "]" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail/src/com/ibm/ws/javamail/internal/injection/MailSessionResourceFactoryBuilder.java#L159-L170
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/FavoritesInner.java
FavoritesInner.getAsync
public Observable<ApplicationInsightsComponentFavoriteInner> getAsync(String resourceGroupName, String resourceName, String favoriteId) { return getWithServiceResponseAsync(resourceGroupName, resourceName, favoriteId).map(new Func1<ServiceResponse<ApplicationInsightsComponentFavoriteInner>, ApplicationInsightsComponentFavoriteInner>() { @Override public ApplicationInsightsComponentFavoriteInner call(ServiceResponse<ApplicationInsightsComponentFavoriteInner> response) { return response.body(); } }); }
java
public Observable<ApplicationInsightsComponentFavoriteInner> getAsync(String resourceGroupName, String resourceName, String favoriteId) { return getWithServiceResponseAsync(resourceGroupName, resourceName, favoriteId).map(new Func1<ServiceResponse<ApplicationInsightsComponentFavoriteInner>, ApplicationInsightsComponentFavoriteInner>() { @Override public ApplicationInsightsComponentFavoriteInner call(ServiceResponse<ApplicationInsightsComponentFavoriteInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationInsightsComponentFavoriteInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "favoriteId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "favoriteId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ApplicationInsightsComponentFavoriteInner", ">", ",", "ApplicationInsightsComponentFavoriteInner", ">", "(", ")", "{", "@", "Override", "public", "ApplicationInsightsComponentFavoriteInner", "call", "(", "ServiceResponse", "<", "ApplicationInsightsComponentFavoriteInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get a single favorite by its FavoriteId, defined within an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param favoriteId The Id of a specific favorite defined in the Application Insights component @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInsightsComponentFavoriteInner object
[ "Get", "a", "single", "favorite", "by", "its", "FavoriteId", "defined", "within", "an", "Application", "Insights", "component", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/FavoritesInner.java#L311-L318
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java
GenericEncodingStrategy.getLobLocator
private void getLobLocator(CodeAssembler a, StorablePropertyInfo info) { if (!info.isLob()) { throw new IllegalArgumentException(); } a.invokeInterface(TypeDesc.forClass(RawSupport.class), "getLocator", TypeDesc.LONG, new TypeDesc[] {info.getStorageType()}); }
java
private void getLobLocator(CodeAssembler a, StorablePropertyInfo info) { if (!info.isLob()) { throw new IllegalArgumentException(); } a.invokeInterface(TypeDesc.forClass(RawSupport.class), "getLocator", TypeDesc.LONG, new TypeDesc[] {info.getStorageType()}); }
[ "private", "void", "getLobLocator", "(", "CodeAssembler", "a", ",", "StorablePropertyInfo", "info", ")", "{", "if", "(", "!", "info", ".", "isLob", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "a", ".", "invokeInterface", "(", "TypeDesc", ".", "forClass", "(", "RawSupport", ".", "class", ")", ",", "\"getLocator\"", ",", "TypeDesc", ".", "LONG", ",", "new", "TypeDesc", "[", "]", "{", "info", ".", "getStorageType", "(", ")", "}", ")", ";", "}" ]
Generates code to get a Lob locator value from RawSupport. RawSupport instance and Lob instance must be on the stack. Result is a long locator value on the stack.
[ "Generates", "code", "to", "get", "a", "Lob", "locator", "value", "from", "RawSupport", ".", "RawSupport", "instance", "and", "Lob", "instance", "must", "be", "on", "the", "stack", ".", "Result", "is", "a", "long", "locator", "value", "on", "the", "stack", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java#L1795-L1801
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/historycleanup/HistoryCleanupHelper.java
HistoryCleanupHelper.isWithinBatchWindow
public static boolean isWithinBatchWindow(Date date, ProcessEngineConfigurationImpl configuration) { if (configuration.getBatchWindowManager().isBatchWindowConfigured(configuration)) { BatchWindow batchWindow = configuration.getBatchWindowManager().getCurrentOrNextBatchWindow(date, configuration); if (batchWindow == null) { return false; } return batchWindow.isWithin(date); } else { return false; } }
java
public static boolean isWithinBatchWindow(Date date, ProcessEngineConfigurationImpl configuration) { if (configuration.getBatchWindowManager().isBatchWindowConfigured(configuration)) { BatchWindow batchWindow = configuration.getBatchWindowManager().getCurrentOrNextBatchWindow(date, configuration); if (batchWindow == null) { return false; } return batchWindow.isWithin(date); } else { return false; } }
[ "public", "static", "boolean", "isWithinBatchWindow", "(", "Date", "date", ",", "ProcessEngineConfigurationImpl", "configuration", ")", "{", "if", "(", "configuration", ".", "getBatchWindowManager", "(", ")", ".", "isBatchWindowConfigured", "(", "configuration", ")", ")", "{", "BatchWindow", "batchWindow", "=", "configuration", ".", "getBatchWindowManager", "(", ")", ".", "getCurrentOrNextBatchWindow", "(", "date", ",", "configuration", ")", ";", "if", "(", "batchWindow", "==", "null", ")", "{", "return", "false", ";", "}", "return", "batchWindow", ".", "isWithin", "(", "date", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Checks if given date is within a batch window. Batch window start time is checked inclusively. @param date @return
[ "Checks", "if", "given", "date", "is", "within", "a", "batch", "window", ".", "Batch", "window", "start", "time", "is", "checked", "inclusively", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/historycleanup/HistoryCleanupHelper.java#L45-L55
jsurfer/JsonSurfer
jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java
JsonSurfer.collectOne
public Object collectOne(InputStream inputStream, JsonPath... paths) { return collectOne(inputStream, Object.class, paths); }
java
public Object collectOne(InputStream inputStream, JsonPath... paths) { return collectOne(inputStream, Object.class, paths); }
[ "public", "Object", "collectOne", "(", "InputStream", "inputStream", ",", "JsonPath", "...", "paths", ")", "{", "return", "collectOne", "(", "inputStream", ",", "Object", ".", "class", ",", "paths", ")", ";", "}" ]
Collect the first matched value and stop parsing immediately @param inputStream json inpustream @param paths JsonPath @return Matched value
[ "Collect", "the", "first", "matched", "value", "and", "stop", "parsing", "immediately" ]
train
https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L488-L490
timehop/sticky-headers-recyclerview
library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java
HeaderPositionCalculator.hasStickyHeader
public boolean hasStickyHeader(View itemView, int orientation, int position) { int offset, margin; mDimensionCalculator.initMargins(mTempRect1, itemView); if (orientation == LinearLayout.VERTICAL) { offset = itemView.getTop(); margin = mTempRect1.top; } else { offset = itemView.getLeft(); margin = mTempRect1.left; } return offset <= margin && mAdapter.getHeaderId(position) >= 0; }
java
public boolean hasStickyHeader(View itemView, int orientation, int position) { int offset, margin; mDimensionCalculator.initMargins(mTempRect1, itemView); if (orientation == LinearLayout.VERTICAL) { offset = itemView.getTop(); margin = mTempRect1.top; } else { offset = itemView.getLeft(); margin = mTempRect1.left; } return offset <= margin && mAdapter.getHeaderId(position) >= 0; }
[ "public", "boolean", "hasStickyHeader", "(", "View", "itemView", ",", "int", "orientation", ",", "int", "position", ")", "{", "int", "offset", ",", "margin", ";", "mDimensionCalculator", ".", "initMargins", "(", "mTempRect1", ",", "itemView", ")", ";", "if", "(", "orientation", "==", "LinearLayout", ".", "VERTICAL", ")", "{", "offset", "=", "itemView", ".", "getTop", "(", ")", ";", "margin", "=", "mTempRect1", ".", "top", ";", "}", "else", "{", "offset", "=", "itemView", ".", "getLeft", "(", ")", ";", "margin", "=", "mTempRect1", ".", "left", ";", "}", "return", "offset", "<=", "margin", "&&", "mAdapter", ".", "getHeaderId", "(", "position", ")", ">=", "0", ";", "}" ]
Determines if a view should have a sticky header. The view has a sticky header if: 1. It is the first element in the recycler view 2. It has a valid ID associated to its position @param itemView given by the RecyclerView @param orientation of the Recyclerview @param position of the list item in question @return True if the view should have a sticky header
[ "Determines", "if", "a", "view", "should", "have", "a", "sticky", "header", ".", "The", "view", "has", "a", "sticky", "header", "if", ":", "1", ".", "It", "is", "the", "first", "element", "in", "the", "recycler", "view", "2", ".", "It", "has", "a", "valid", "ID", "associated", "to", "its", "position" ]
train
https://github.com/timehop/sticky-headers-recyclerview/blob/f5a9e9b8f5d96734e20439b0a41381865fa52fb7/library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java#L50-L62
moleculer-java/moleculer-java
src/main/java/services/moleculer/ServiceBroker.java
ServiceBroker.createService
public ServiceBroker createService(String name, Service service) { if (serviceRegistry == null) { // Start service later services.put(name, service); } else { // Register and start service now eventbus.addListeners(name, service); serviceRegistry.addActions(name, service); } return this; }
java
public ServiceBroker createService(String name, Service service) { if (serviceRegistry == null) { // Start service later services.put(name, service); } else { // Register and start service now eventbus.addListeners(name, service); serviceRegistry.addActions(name, service); } return this; }
[ "public", "ServiceBroker", "createService", "(", "String", "name", ",", "Service", "service", ")", "{", "if", "(", "serviceRegistry", "==", "null", ")", "{", "// Start service later", "services", ".", "put", "(", "name", ",", "service", ")", ";", "}", "else", "{", "// Register and start service now", "eventbus", ".", "addListeners", "(", "name", ",", "service", ")", ";", "serviceRegistry", ".", "addActions", "(", "name", ",", "service", ")", ";", "}", "return", "this", ";", "}" ]
Installs a new service with the specified name (eg. "user" service) and notifies other nodes about the actions/listeners of this new service. @param name custom service name (eg. "user", "logger", "configurator", etc.) @param service the new service instance @return this ServiceBroker instance (from "method chaining")
[ "Installs", "a", "new", "service", "with", "the", "specified", "name", "(", "eg", ".", "user", "service", ")", "and", "notifies", "other", "nodes", "about", "the", "actions", "/", "listeners", "of", "this", "new", "service", "." ]
train
https://github.com/moleculer-java/moleculer-java/blob/27575c44b9ecacc17c4456ceacf5d1851abf1cc4/src/main/java/services/moleculer/ServiceBroker.java#L612-L624
actorapp/actor-platform
actor-sdk/sdk-core/core/core-js/src/main/java/im/actor/core/js/modules/JsFilesModule.java
JsFilesModule.getFileUrl
public String getFileUrl(long id, long accessHash) { CachedFileUrl cachedFileUrl = keyValueStorage.getValue(id); if (cachedFileUrl != null) { long urlTime = cachedFileUrl.getTimeout(); long currentTime = im.actor.runtime.Runtime.getCurrentSyncedTime(); if (urlTime <= currentTime) { Log.w("JsFilesModule", "URL #" + id + " timeout (urlTime: " + urlTime + ", current:" + currentTime + ")"); keyValueStorage.removeItem(id); } else { return cachedFileUrl.getUrl(); } } if (!requestedFiles.contains(id)) { requestedFiles.add(id); urlLoader.send(new FileRequest(id, accessHash)); } return null; }
java
public String getFileUrl(long id, long accessHash) { CachedFileUrl cachedFileUrl = keyValueStorage.getValue(id); if (cachedFileUrl != null) { long urlTime = cachedFileUrl.getTimeout(); long currentTime = im.actor.runtime.Runtime.getCurrentSyncedTime(); if (urlTime <= currentTime) { Log.w("JsFilesModule", "URL #" + id + " timeout (urlTime: " + urlTime + ", current:" + currentTime + ")"); keyValueStorage.removeItem(id); } else { return cachedFileUrl.getUrl(); } } if (!requestedFiles.contains(id)) { requestedFiles.add(id); urlLoader.send(new FileRequest(id, accessHash)); } return null; }
[ "public", "String", "getFileUrl", "(", "long", "id", ",", "long", "accessHash", ")", "{", "CachedFileUrl", "cachedFileUrl", "=", "keyValueStorage", ".", "getValue", "(", "id", ")", ";", "if", "(", "cachedFileUrl", "!=", "null", ")", "{", "long", "urlTime", "=", "cachedFileUrl", ".", "getTimeout", "(", ")", ";", "long", "currentTime", "=", "im", ".", "actor", ".", "runtime", ".", "Runtime", ".", "getCurrentSyncedTime", "(", ")", ";", "if", "(", "urlTime", "<=", "currentTime", ")", "{", "Log", ".", "w", "(", "\"JsFilesModule\"", ",", "\"URL #\"", "+", "id", "+", "\" timeout (urlTime: \"", "+", "urlTime", "+", "\", current:\"", "+", "currentTime", "+", "\")\"", ")", ";", "keyValueStorage", ".", "removeItem", "(", "id", ")", ";", "}", "else", "{", "return", "cachedFileUrl", ".", "getUrl", "(", ")", ";", "}", "}", "if", "(", "!", "requestedFiles", ".", "contains", "(", "id", ")", ")", "{", "requestedFiles", ".", "add", "(", "id", ")", ";", "urlLoader", ".", "send", "(", "new", "FileRequest", "(", "id", ",", "accessHash", ")", ")", ";", "}", "return", "null", ";", "}" ]
Getting URL for file if available @param id file's id @param accessHash file's accessHash @return url for a file or null if not yet available
[ "Getting", "URL", "for", "file", "if", "available" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-js/src/main/java/im/actor/core/js/modules/JsFilesModule.java#L93-L112
Red5/red5-io
src/main/java/org/red5/io/amf/Output.java
Output.encodeString
protected static byte[] encodeString(String string) { Element element = getStringCache().get(string); byte[] encoded = (element == null ? null : (byte[]) element.getObjectValue()); if (encoded == null) { ByteBuffer buf = AMF.CHARSET.encode(string); encoded = new byte[buf.limit()]; buf.get(encoded); getStringCache().put(new Element(string, encoded)); } return encoded; }
java
protected static byte[] encodeString(String string) { Element element = getStringCache().get(string); byte[] encoded = (element == null ? null : (byte[]) element.getObjectValue()); if (encoded == null) { ByteBuffer buf = AMF.CHARSET.encode(string); encoded = new byte[buf.limit()]; buf.get(encoded); getStringCache().put(new Element(string, encoded)); } return encoded; }
[ "protected", "static", "byte", "[", "]", "encodeString", "(", "String", "string", ")", "{", "Element", "element", "=", "getStringCache", "(", ")", ".", "get", "(", "string", ")", ";", "byte", "[", "]", "encoded", "=", "(", "element", "==", "null", "?", "null", ":", "(", "byte", "[", "]", ")", "element", ".", "getObjectValue", "(", ")", ")", ";", "if", "(", "encoded", "==", "null", ")", "{", "ByteBuffer", "buf", "=", "AMF", ".", "CHARSET", ".", "encode", "(", "string", ")", ";", "encoded", "=", "new", "byte", "[", "buf", ".", "limit", "(", ")", "]", ";", "buf", ".", "get", "(", "encoded", ")", ";", "getStringCache", "(", ")", ".", "put", "(", "new", "Element", "(", "string", ",", "encoded", ")", ")", ";", "}", "return", "encoded", ";", "}" ]
Encode string. @param string string to encode @return encoded string
[ "Encode", "string", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Output.java#L526-L536
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
3
Edit dataset card