repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
msgpack/msgpack-java
msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java
MessageBuffer.newMessageBuffer
private static MessageBuffer newMessageBuffer(ByteBuffer bb) { checkNotNull(bb); if (mbBBConstructor != null) { return newInstance(mbBBConstructor, bb); } return new MessageBuffer(bb); }
java
private static MessageBuffer newMessageBuffer(ByteBuffer bb) { checkNotNull(bb); if (mbBBConstructor != null) { return newInstance(mbBBConstructor, bb); } return new MessageBuffer(bb); }
[ "private", "static", "MessageBuffer", "newMessageBuffer", "(", "ByteBuffer", "bb", ")", "{", "checkNotNull", "(", "bb", ")", ";", "if", "(", "mbBBConstructor", "!=", "null", ")", "{", "return", "newInstance", "(", "mbBBConstructor", ",", "bb", ")", ";", "}",...
Creates a new MessageBuffer instance backed by ByteBuffer @param bb @return
[ "Creates", "a", "new", "MessageBuffer", "instance", "backed", "by", "ByteBuffer" ]
train
https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L288-L295
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getBackStoryAnswerInfo
public void getBackStoryAnswerInfo(String[] ids, Callback<List<BackStoryAnswer>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getBackStoryAnswerInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getBackStoryAnswerInfo(String[] ids, Callback<List<BackStoryAnswer>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getBackStoryAnswerInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getBackStoryAnswerInfo", "(", "String", "[", "]", "ids", ",", "Callback", "<", "List", "<", "BackStoryAnswer", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecke...
For more info on back story answer API go <a href="https://wiki.guildwars2.com/wiki/API:2/backstory/answers">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of back story answer id(s) @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key @throws NullPointerException if given {@link Callback} is empty @see BackStoryAnswer back story answer info
[ "For", "more", "info", "on", "back", "story", "answer", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "backstory", "/", "answers", ">", "here<", "/", "a", ">", "...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L591-L594
micronaut-projects/micronaut-core
function/src/main/java/io/micronaut/function/executor/FunctionInitializer.java
FunctionInitializer.run
public void run(String[] args, Function<ParseContext, ?> supplier) throws IOException { ApplicationContext applicationContext = this.applicationContext; this.functionExitHandler = applicationContext.findBean(FunctionExitHandler.class).orElse(this.functionExitHandler); ParseContext context = new ParseContext(args); try { Object result = supplier.apply(context); if (result != null) { LocalFunctionRegistry bean = applicationContext.getBean(LocalFunctionRegistry.class); StreamFunctionExecutor.encode(applicationContext.getEnvironment(), bean, result.getClass(), result, System.out); functionExitHandler.exitWithSuccess(); } } catch (Exception e) { functionExitHandler.exitWithError(e, context.debug); } }
java
public void run(String[] args, Function<ParseContext, ?> supplier) throws IOException { ApplicationContext applicationContext = this.applicationContext; this.functionExitHandler = applicationContext.findBean(FunctionExitHandler.class).orElse(this.functionExitHandler); ParseContext context = new ParseContext(args); try { Object result = supplier.apply(context); if (result != null) { LocalFunctionRegistry bean = applicationContext.getBean(LocalFunctionRegistry.class); StreamFunctionExecutor.encode(applicationContext.getEnvironment(), bean, result.getClass(), result, System.out); functionExitHandler.exitWithSuccess(); } } catch (Exception e) { functionExitHandler.exitWithError(e, context.debug); } }
[ "public", "void", "run", "(", "String", "[", "]", "args", ",", "Function", "<", "ParseContext", ",", "?", ">", "supplier", ")", "throws", "IOException", "{", "ApplicationContext", "applicationContext", "=", "this", ".", "applicationContext", ";", "this", ".", ...
This method is designed to be called when using the {@link FunctionInitializer} from a static Application main method. @param args The arguments passed to main @param supplier The function that executes this function @throws IOException If an error occurs
[ "This", "method", "is", "designed", "to", "be", "called", "when", "using", "the", "{", "@link", "FunctionInitializer", "}", "from", "a", "static", "Application", "main", "method", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/function/src/main/java/io/micronaut/function/executor/FunctionInitializer.java#L90-L105
lotaris/rox-client-java
rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java
Configuration.writeUid
private void writeUid(File uidFile, String uid) { BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(uidFile)); bw.write(uid); } catch (IOException ioe) {} finally { if (bw != null) { try { bw.close(); } catch (IOException ioe) {} } } }
java
private void writeUid(File uidFile, String uid) { BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(uidFile)); bw.write(uid); } catch (IOException ioe) {} finally { if (bw != null) { try { bw.close(); } catch (IOException ioe) {} } } }
[ "private", "void", "writeUid", "(", "File", "uidFile", ",", "String", "uid", ")", "{", "BufferedWriter", "bw", "=", "null", ";", "try", "{", "bw", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "uidFile", ")", ")", ";", "bw", ".", "write"...
Write a UID file @param uidFile The UID file to write @param uid The UID to write to the file
[ "Write", "a", "UID", "file" ]
train
https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java#L489-L497
btrplace/scheduler
btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java
SymbolsTable.declareImmutable
public boolean declareImmutable(String label, BtrpOperand t) { if (isDeclared(label)) { return false; } level.put(label, -1); type.put(label, t); return true; }
java
public boolean declareImmutable(String label, BtrpOperand t) { if (isDeclared(label)) { return false; } level.put(label, -1); type.put(label, t); return true; }
[ "public", "boolean", "declareImmutable", "(", "String", "label", ",", "BtrpOperand", "t", ")", "{", "if", "(", "isDeclared", "(", "label", ")", ")", "{", "return", "false", ";", "}", "level", ".", "put", "(", "label", ",", "-", "1", ")", ";", "type",...
Declare an immutable variable. The variable must not has been already declared. @param label the identifier of the variable @param t the operand associated to the identifier @return {@code true} if the variable as been declared. {@code false} otherwise
[ "Declare", "an", "immutable", "variable", ".", "The", "variable", "must", "not", "has", "been", "already", "declared", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java#L73-L80
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.noNullElements
@GwtIncompatible("incompatible method") public static <T> T[] noNullElements(final T[] array, final String message, final Object... values) { Validate.notNull(array); for (int i = 0; i < array.length; i++) { if (array[i] == null) { final Object[] values2 = ArrayUtils.add(values, Integer.valueOf(i)); throw new IllegalArgumentException(StringUtils.simpleFormat(message, values2)); } } return array; }
java
@GwtIncompatible("incompatible method") public static <T> T[] noNullElements(final T[] array, final String message, final Object... values) { Validate.notNull(array); for (int i = 0; i < array.length; i++) { if (array[i] == null) { final Object[] values2 = ArrayUtils.add(values, Integer.valueOf(i)); throw new IllegalArgumentException(StringUtils.simpleFormat(message, values2)); } } return array; }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "<", "T", ">", "T", "[", "]", "noNullElements", "(", "final", "T", "[", "]", "array", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "...
<p>Validate that the specified argument array is neither {@code null} nor contains any elements that are {@code null}; otherwise throwing an exception with the specified message. <pre>Validate.noNullElements(myArray, "The array contain null at position %d");</pre> <p>If the array is {@code null}, then the message in the exception is &quot;The validated object is null&quot;.</p> <p>If the array has a {@code null} element, then the iteration index of the invalid element is appended to the {@code values} argument.</p> @param <T> the array type @param array the array to check, validated not null by this method @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the validated array (never {@code null} method for chaining) @throws NullPointerException if the array is {@code null} @throws IllegalArgumentException if an element is {@code null} @see #noNullElements(Object[])
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "array", "is", "neither", "{", "@code", "null", "}", "nor", "contains", "any", "elements", "that", "are", "{", "@code", "null", "}", ";", "otherwise", "throwing", "an", "exception", "with", "th...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L510-L520
di2e/Argo
CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java
ClientProbeSenders.createProbeSenders
private void createProbeSenders(ArgoClientContext context) throws TransportConfigException { senders = new ArrayList<ProbeSender>(); if (config.usesNetworkInterface()) { try { for (String niName : context.getAvailableNetworkInterfaces(config.requiresMulticast())) { try { Transport transport = instantiateTransportClass(config.getClassname()); transport.initialize(transportProps, niName); ProbeSender sender = new ProbeSender(transport); senders.add(sender); } catch (TransportConfigException e) { LOGGER.warn( e.getLocalizedMessage()); } } } catch (SocketException e) { throw new TransportConfigException("Error getting available network interfaces", e); } } else { Transport transport = instantiateTransportClass(config.getClassname()); transport.initialize(transportProps, ""); ProbeSender sender = new ProbeSender(transport); senders.add(sender); } }
java
private void createProbeSenders(ArgoClientContext context) throws TransportConfigException { senders = new ArrayList<ProbeSender>(); if (config.usesNetworkInterface()) { try { for (String niName : context.getAvailableNetworkInterfaces(config.requiresMulticast())) { try { Transport transport = instantiateTransportClass(config.getClassname()); transport.initialize(transportProps, niName); ProbeSender sender = new ProbeSender(transport); senders.add(sender); } catch (TransportConfigException e) { LOGGER.warn( e.getLocalizedMessage()); } } } catch (SocketException e) { throw new TransportConfigException("Error getting available network interfaces", e); } } else { Transport transport = instantiateTransportClass(config.getClassname()); transport.initialize(transportProps, ""); ProbeSender sender = new ProbeSender(transport); senders.add(sender); } }
[ "private", "void", "createProbeSenders", "(", "ArgoClientContext", "context", ")", "throws", "TransportConfigException", "{", "senders", "=", "new", "ArrayList", "<", "ProbeSender", ">", "(", ")", ";", "if", "(", "config", ".", "usesNetworkInterface", "(", ")", ...
Create the actual ProbeSender instances given the configuration information. If the transport depends on Network Interfaces, then create a ProbeSender for each NI we can find on this machine. @param context the main client configuration information @throws TransportConfigException if there is some issue initializing the transport.
[ "Create", "the", "actual", "ProbeSender", "instances", "given", "the", "configuration", "information", ".", "If", "the", "transport", "depends", "on", "Network", "Interfaces", "then", "create", "a", "ProbeSender", "for", "each", "NI", "we", "can", "find", "on", ...
train
https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java#L161-L186
OpenTSDB/opentsdb
src/meta/Annotation.java
Annotation.syncNote
private void syncNote(final Annotation note, final boolean overwrite) { if (note.start_time > 0 && (note.start_time < start_time || start_time == 0)) { start_time = note.start_time; } // handle user-accessible stuff if (!overwrite && !changed.get("end_time")) { end_time = note.end_time; } if (!overwrite && !changed.get("description")) { description = note.description; } if (!overwrite && !changed.get("notes")) { notes = note.notes; } if (!overwrite && !changed.get("custom")) { custom = note.custom; } // reset changed flags initializeChangedMap(); }
java
private void syncNote(final Annotation note, final boolean overwrite) { if (note.start_time > 0 && (note.start_time < start_time || start_time == 0)) { start_time = note.start_time; } // handle user-accessible stuff if (!overwrite && !changed.get("end_time")) { end_time = note.end_time; } if (!overwrite && !changed.get("description")) { description = note.description; } if (!overwrite && !changed.get("notes")) { notes = note.notes; } if (!overwrite && !changed.get("custom")) { custom = note.custom; } // reset changed flags initializeChangedMap(); }
[ "private", "void", "syncNote", "(", "final", "Annotation", "note", ",", "final", "boolean", "overwrite", ")", "{", "if", "(", "note", ".", "start_time", ">", "0", "&&", "(", "note", ".", "start_time", "<", "start_time", "||", "start_time", "==", "0", ")"...
Syncs the local object with the stored object for atomic writes, overwriting the stored data if the user issued a PUT request <b>Note:</b> This method also resets the {@code changed} map to false for every field @param meta The stored object to sync from @param overwrite Whether or not all user mutable data in storage should be replaced by the local object
[ "Syncs", "the", "local", "object", "with", "the", "stored", "object", "for", "atomic", "writes", "overwriting", "the", "stored", "data", "if", "the", "user", "issued", "a", "PUT", "request", "<b", ">", "Note", ":", "<", "/", "b", ">", "This", "method", ...
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/Annotation.java#L556-L577
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java
FormalParameterBuilderImpl.eInit
public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) { setTypeResolutionContext(typeContext); this.context = context; this.parameter = SarlFactory.eINSTANCE.createSarlFormalParameter(); this.parameter.setName(name); this.parameter.setParameterType(newTypeRef(this.context, Object.class.getName())); this.context.getParameters().add(this.parameter); }
java
public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) { setTypeResolutionContext(typeContext); this.context = context; this.parameter = SarlFactory.eINSTANCE.createSarlFormalParameter(); this.parameter.setName(name); this.parameter.setParameterType(newTypeRef(this.context, Object.class.getName())); this.context.getParameters().add(this.parameter); }
[ "public", "void", "eInit", "(", "XtendExecutable", "context", ",", "String", "name", ",", "IJvmTypeProvider", "typeContext", ")", "{", "setTypeResolutionContext", "(", "typeContext", ")", ";", "this", ".", "context", "=", "context", ";", "this", ".", "parameter"...
Initialize the formal parameter. @param context the context of the formal parameter. @param name the name of the formal parameter.
[ "Initialize", "the", "formal", "parameter", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java#L71-L78
amzn/ion-java
src/com/amazon/ion/util/IonTextUtils.java
IonTextUtils.printQuotedSymbol
public static void printQuotedSymbol(Appendable out, CharSequence text) throws IOException { if (text == null) { out.append("null.symbol"); } else { out.append('\''); printCodePoints(out, text, EscapeMode.ION_SYMBOL); out.append('\''); } }
java
public static void printQuotedSymbol(Appendable out, CharSequence text) throws IOException { if (text == null) { out.append("null.symbol"); } else { out.append('\''); printCodePoints(out, text, EscapeMode.ION_SYMBOL); out.append('\''); } }
[ "public", "static", "void", "printQuotedSymbol", "(", "Appendable", "out", ",", "CharSequence", "text", ")", "throws", "IOException", "{", "if", "(", "text", "==", "null", ")", "{", "out", ".", "append", "(", "\"null.symbol\"", ")", ";", "}", "else", "{", ...
Prints text as a single-quoted Ion symbol. If the {@code text} is null, this prints {@code null.symbol}. @param out the stream to receive the data. @param text the symbol text; may be {@code null}. @throws IOException if the {@link Appendable} throws an exception. @throws IllegalArgumentException if the text contains invalid UTF-16 surrogates.
[ "Prints", "text", "as", "a", "single", "-", "quoted", "Ion", "symbol", ".", "If", "the", "{", "@code", "text", "}", "is", "null", "this", "prints", "{", "@code", "null", ".", "symbol", "}", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonTextUtils.java#L648-L661
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassIcon.java
SeaGlassIcon.getIconWidth
@Override public int getIconWidth(SynthContext context) { if (context == null) { return width; } JComponent c = context.getComponent(); if (c instanceof JToolBar && ((JToolBar) c).getOrientation() == JToolBar.VERTICAL) { // we only do the -1 hack for UIResource borders, assuming // that the border is probably going to be our border if (c.getBorder() instanceof UIResource) { return c.getWidth() - 1; } else { return c.getWidth(); } } else { return scale(context, width); } }
java
@Override public int getIconWidth(SynthContext context) { if (context == null) { return width; } JComponent c = context.getComponent(); if (c instanceof JToolBar && ((JToolBar) c).getOrientation() == JToolBar.VERTICAL) { // we only do the -1 hack for UIResource borders, assuming // that the border is probably going to be our border if (c.getBorder() instanceof UIResource) { return c.getWidth() - 1; } else { return c.getWidth(); } } else { return scale(context, width); } }
[ "@", "Override", "public", "int", "getIconWidth", "(", "SynthContext", "context", ")", "{", "if", "(", "context", "==", "null", ")", "{", "return", "width", ";", "}", "JComponent", "c", "=", "context", ".", "getComponent", "(", ")", ";", "if", "(", "c"...
Returns the icon's width. This is a cover methods for <code> getIconWidth(null)</code>. @param context the SynthContext describing the component/region, the style, and the state. @return an int specifying the fixed width of the icon.
[ "Returns", "the", "icon", "s", "width", ".", "This", "is", "a", "cover", "methods", "for", "<code", ">", "getIconWidth", "(", "null", ")", "<", "/", "code", ">", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassIcon.java#L210-L230
fracpete/multisearch-weka-package
src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java
AbstractSearch.logPerformances
protected String logPerformances(Space space, Vector<Performance> performances, Tag type) { return m_Owner.logPerformances(space, performances, type); }
java
protected String logPerformances(Space space, Vector<Performance> performances, Tag type) { return m_Owner.logPerformances(space, performances, type); }
[ "protected", "String", "logPerformances", "(", "Space", "space", ",", "Vector", "<", "Performance", ">", "performances", ",", "Tag", "type", ")", "{", "return", "m_Owner", ".", "logPerformances", "(", "space", ",", "performances", ",", "type", ")", ";", "}" ...
generates a table string for all the performances in the space and returns that. @param space the current space to align the performances to @param performances the performances to align @param type the type of performance @return the table string
[ "generates", "a", "table", "string", "for", "all", "the", "performances", "in", "the", "space", "and", "returns", "that", "." ]
train
https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L262-L264
Azure/azure-sdk-for-java
streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java
StreamingJobsInner.beginStop
public void beginStop(String resourceGroupName, String jobName) { beginStopWithServiceResponseAsync(resourceGroupName, jobName).toBlocking().single().body(); }
java
public void beginStop(String resourceGroupName, String jobName) { beginStopWithServiceResponseAsync(resourceGroupName, jobName).toBlocking().single().body(); }
[ "public", "void", "beginStop", "(", "String", "resourceGroupName", ",", "String", "jobName", ")", "{", "beginStopWithServiceResponseAsync", "(", "resourceGroupName", ",", "jobName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", "...
Stops a running streaming job. This will cause a running streaming job to stop processing input events and producing output. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param jobName The name of the streaming job. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Stops", "a", "running", "streaming", "job", ".", "This", "will", "cause", "a", "running", "streaming", "job", "to", "stop", "processing", "input", "events", "and", "producing", "output", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java#L1828-L1830
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/ScanPlan.java
ScanPlan.addTokenRangeToCurrentBatchForCluster
public void addTokenRangeToCurrentBatchForCluster(String cluster, String placement, Collection<ScanRange> ranges) { PlanBatch batch = _clusterTails.get(cluster); if (batch == null) { batch = new PlanBatch(); _clusterHeads.put(cluster, batch); _clusterTails.put(cluster, batch); } batch.addPlanItem(new PlanItem(placement, ranges)); }
java
public void addTokenRangeToCurrentBatchForCluster(String cluster, String placement, Collection<ScanRange> ranges) { PlanBatch batch = _clusterTails.get(cluster); if (batch == null) { batch = new PlanBatch(); _clusterHeads.put(cluster, batch); _clusterTails.put(cluster, batch); } batch.addPlanItem(new PlanItem(placement, ranges)); }
[ "public", "void", "addTokenRangeToCurrentBatchForCluster", "(", "String", "cluster", ",", "String", "placement", ",", "Collection", "<", "ScanRange", ">", "ranges", ")", "{", "PlanBatch", "batch", "=", "_clusterTails", ".", "get", "(", "cluster", ")", ";", "if",...
Adds a collection of scan ranges to the plan for a specific placement. The range collection should all belong to a single token range in the ring. @param cluster An identifier for the underlying resources used to scan the placement (typically an identifier for the Cassandra ring) @param placement The name of the placement @param ranges All non-overlapping sub-ranges from a single token range in the ring
[ "Adds", "a", "collection", "of", "scan", "ranges", "to", "the", "plan", "for", "a", "specific", "placement", ".", "The", "range", "collection", "should", "all", "belong", "to", "a", "single", "token", "range", "in", "the", "ring", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/ScanPlan.java#L81-L89
tango-controls/JTango
server/src/main/java/org/tango/server/build/BuilderUtils.java
BuilderUtils.getPipeName
static String getPipeName(final String fieldName, final Pipe annot) { String attributeName = null; if (annot.name().equals("")) { attributeName = fieldName; } else { attributeName = annot.name(); } return attributeName; }
java
static String getPipeName(final String fieldName, final Pipe annot) { String attributeName = null; if (annot.name().equals("")) { attributeName = fieldName; } else { attributeName = annot.name(); } return attributeName; }
[ "static", "String", "getPipeName", "(", "final", "String", "fieldName", ",", "final", "Pipe", "annot", ")", "{", "String", "attributeName", "=", "null", ";", "if", "(", "annot", ".", "name", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "attribu...
Get pipe name from annotation {@link Pipe} @param fieldName @param annot @return
[ "Get", "pipe", "name", "from", "annotation", "{", "@link", "Pipe", "}" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/BuilderUtils.java#L92-L100
sriharshachilakapati/WebGL4J
webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java
WebGL10.glBindBuffer
public static void glBindBuffer(int target, int buffer) { checkContextCompatibility(); nglBindBuffer(target, WebGLObjectMap.get().toBuffer(buffer)); }
java
public static void glBindBuffer(int target, int buffer) { checkContextCompatibility(); nglBindBuffer(target, WebGLObjectMap.get().toBuffer(buffer)); }
[ "public", "static", "void", "glBindBuffer", "(", "int", "target", ",", "int", "buffer", ")", "{", "checkContextCompatibility", "(", ")", ";", "nglBindBuffer", "(", "target", ",", "WebGLObjectMap", ".", "get", "(", ")", ".", "toBuffer", "(", "buffer", ")", ...
<p>{@code glBindBuffer} binds a buffer object to the specified buffer binding point. Calling {@code glBindBuffer} with {@code target} set to one of the accepted symbolic constants and {@code buffer} set to the name of a buffer object binds that buffer object name to the target. If no buffer object with name {@code buffer} exists, one is created with that name. When a buffer object is bound to a target, the previous binding for that target is automatically broken.</p> <p>{@link #GL_INVALID_ENUM} is generated if target is not one of the allowable values.</p> <p>{@link #GL_INVALID_VALUE} is generated if buffer is not a name previously returned from a call to {@link #glCreateBuffer()}. @param target Specifies the target to which the buffer object is bound. The symbolic constant must be {@link #GL_ARRAY_BUFFER}, {@link #GL_ELEMENT_ARRAY_BUFFER}. @param buffer Specifies the name of a buffer object.
[ "<p", ">", "{", "@code", "glBindBuffer", "}", "binds", "a", "buffer", "object", "to", "the", "specified", "buffer", "binding", "point", ".", "Calling", "{", "@code", "glBindBuffer", "}", "with", "{", "@code", "target", "}", "set", "to", "one", "of", "the...
train
https://github.com/sriharshachilakapati/WebGL4J/blob/7daa425300b08b338b50cef2935289849c92d415/webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java#L577-L581
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/avro/HiveAvroCopyEntityHelper.java
HiveAvroCopyEntityHelper.updatePartitionAttributesIfAvro
public static void updatePartitionAttributesIfAvro(Table targetTable, Map<List<String>, Partition> sourcePartitions, HiveCopyEntityHelper hiveHelper) throws IOException { if (isHiveTableAvroType(targetTable)) { for (Map.Entry<List<String>, Partition> partition : sourcePartitions.entrySet()) { updateAvroSchemaURL(partition.getValue().getCompleteName(), partition.getValue().getTPartition().getSd(), hiveHelper); } } }
java
public static void updatePartitionAttributesIfAvro(Table targetTable, Map<List<String>, Partition> sourcePartitions, HiveCopyEntityHelper hiveHelper) throws IOException { if (isHiveTableAvroType(targetTable)) { for (Map.Entry<List<String>, Partition> partition : sourcePartitions.entrySet()) { updateAvroSchemaURL(partition.getValue().getCompleteName(), partition.getValue().getTPartition().getSd(), hiveHelper); } } }
[ "public", "static", "void", "updatePartitionAttributesIfAvro", "(", "Table", "targetTable", ",", "Map", "<", "List", "<", "String", ">", ",", "Partition", ">", "sourcePartitions", ",", "HiveCopyEntityHelper", "hiveHelper", ")", "throws", "IOException", "{", "if", ...
Currently updated the {@link #HIVE_TABLE_AVRO_SCHEMA_URL} location for new hive partitions @param targetTable, new Table to be registered in hive @param sourcePartitions, source partitions @throws IOException
[ "Currently", "updated", "the", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/avro/HiveAvroCopyEntityHelper.java#L63-L69
ronmamo/reflections
src/main/java/org/reflections/Reflections.java
Reflections.getConstructorsAnnotatedWith
public Set<Constructor> getConstructorsAnnotatedWith(final Class<? extends Annotation> annotation) { Iterable<String> methods = store.get(index(MethodAnnotationsScanner.class), annotation.getName()); return getConstructorsFromDescriptors(methods, loaders()); }
java
public Set<Constructor> getConstructorsAnnotatedWith(final Class<? extends Annotation> annotation) { Iterable<String> methods = store.get(index(MethodAnnotationsScanner.class), annotation.getName()); return getConstructorsFromDescriptors(methods, loaders()); }
[ "public", "Set", "<", "Constructor", ">", "getConstructorsAnnotatedWith", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "Iterable", "<", "String", ">", "methods", "=", "store", ".", "get", "(", "index", "(", "MethodAn...
get all constructors annotated with a given annotation <p/>depends on MethodAnnotationsScanner configured
[ "get", "all", "constructors", "annotated", "with", "a", "given", "annotation", "<p", "/", ">", "depends", "on", "MethodAnnotationsScanner", "configured" ]
train
https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/Reflections.java#L524-L527
Ordinastie/MalisisCore
src/main/java/net/malisis/core/block/component/WallComponent.java
WallComponent.getBoundingBoxes
@Override public AxisAlignedBB[] getBoundingBoxes(Block block, IBlockAccess world, BlockPos pos, IBlockState state, BoundingBoxType type) { boolean corner = isCorner(state); if (type == BoundingBoxType.SELECTION && corner) return AABBUtils.identities(); AxisAlignedBB aabb = new AxisAlignedBB(0, 0, 0, 1, 1, 3 / 16F); if (world == null) aabb = AABBUtils.rotate(aabb.offset(0, 0, 0.5F), -1); if (!corner) return new AxisAlignedBB[] { aabb }; return new AxisAlignedBB[] { aabb, AABBUtils.rotate(aabb, -1) }; }
java
@Override public AxisAlignedBB[] getBoundingBoxes(Block block, IBlockAccess world, BlockPos pos, IBlockState state, BoundingBoxType type) { boolean corner = isCorner(state); if (type == BoundingBoxType.SELECTION && corner) return AABBUtils.identities(); AxisAlignedBB aabb = new AxisAlignedBB(0, 0, 0, 1, 1, 3 / 16F); if (world == null) aabb = AABBUtils.rotate(aabb.offset(0, 0, 0.5F), -1); if (!corner) return new AxisAlignedBB[] { aabb }; return new AxisAlignedBB[] { aabb, AABBUtils.rotate(aabb, -1) }; }
[ "@", "Override", "public", "AxisAlignedBB", "[", "]", "getBoundingBoxes", "(", "Block", "block", ",", "IBlockAccess", "world", ",", "BlockPos", "pos", ",", "IBlockState", "state", ",", "BoundingBoxType", "type", ")", "{", "boolean", "corner", "=", "isCorner", ...
Gets the bounding boxes for the block. @param block the block @param world the world @param pos the pos @param type the type @return the bounding boxes
[ "Gets", "the", "bounding", "boxes", "for", "the", "block", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/block/component/WallComponent.java#L207-L222
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.deleteUser
public void deleteUser(CmsRequestContext context, CmsUUID userId) throws CmsException { CmsUser user = readUser(context, userId); deleteUser(context, user, null); }
java
public void deleteUser(CmsRequestContext context, CmsUUID userId) throws CmsException { CmsUser user = readUser(context, userId); deleteUser(context, user, null); }
[ "public", "void", "deleteUser", "(", "CmsRequestContext", "context", ",", "CmsUUID", "userId", ")", "throws", "CmsException", "{", "CmsUser", "user", "=", "readUser", "(", "context", ",", "userId", ")", ";", "deleteUser", "(", "context", ",", "user", ",", "n...
Deletes a user.<p> @param context the current request context @param userId the Id of the user to be deleted @throws CmsException if something goes wrong
[ "Deletes", "a", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1663-L1667
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.setFrustumLH
public Matrix4d setFrustumLH(double left, double right, double bottom, double top, double zNear, double zFar, boolean zZeroToOne) { if ((properties & PROPERTY_IDENTITY) == 0) _identity(); m00 = (zNear + zNear) / (right - left); m11 = (zNear + zNear) / (top - bottom); m20 = (right + left) / (right - left); m21 = (top + bottom) / (top - bottom); boolean farInf = zFar > 0 && Double.isInfinite(zFar); boolean nearInf = zNear > 0 && Double.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) double e = 1E-6; m22 = 1.0 - e; m32 = (e - (zZeroToOne ? 1.0 : 2.0)) * zNear; } else if (nearInf) { double e = 1E-6; m22 = (zZeroToOne ? 0.0 : 1.0) - e; m32 = ((zZeroToOne ? 1.0 : 2.0) - e) * zFar; } else { m22 = (zZeroToOne ? zFar : zFar + zNear) / (zFar - zNear); m32 = (zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar); } m23 = 1.0; m33 = 0.0; properties = this.m20 == 0.0 && this.m21 == 0.0 ? PROPERTY_PERSPECTIVE : 0; return this; }
java
public Matrix4d setFrustumLH(double left, double right, double bottom, double top, double zNear, double zFar, boolean zZeroToOne) { if ((properties & PROPERTY_IDENTITY) == 0) _identity(); m00 = (zNear + zNear) / (right - left); m11 = (zNear + zNear) / (top - bottom); m20 = (right + left) / (right - left); m21 = (top + bottom) / (top - bottom); boolean farInf = zFar > 0 && Double.isInfinite(zFar); boolean nearInf = zNear > 0 && Double.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) double e = 1E-6; m22 = 1.0 - e; m32 = (e - (zZeroToOne ? 1.0 : 2.0)) * zNear; } else if (nearInf) { double e = 1E-6; m22 = (zZeroToOne ? 0.0 : 1.0) - e; m32 = ((zZeroToOne ? 1.0 : 2.0) - e) * zFar; } else { m22 = (zZeroToOne ? zFar : zFar + zNear) / (zFar - zNear); m32 = (zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar); } m23 = 1.0; m33 = 0.0; properties = this.m20 == 0.0 && this.m21 == 0.0 ? PROPERTY_PERSPECTIVE : 0; return this; }
[ "public", "Matrix4d", "setFrustumLH", "(", "double", "left", ",", "double", "right", ",", "double", "bottom", ",", "double", "top", ",", "double", "zNear", ",", "double", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "if", "(", "(", "properties", "&", ...
Set this matrix to be an arbitrary perspective projection frustum transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> In order to apply the perspective frustum transformation to an existing transformation, use {@link #frustumLH(double, double, double, double, double, double, boolean) frustumLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#perspective">http://www.songho.ca</a> @see #frustumLH(double, double, double, double, double, double, boolean) @param left the distance along the x-axis to the left frustum edge @param right the distance along the x-axis to the right frustum edge @param bottom the distance along the y-axis to the bottom frustum edge @param top the distance along the y-axis to the top frustum edge @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Set", "this", "matrix", "to", "be", "an", "arbitrary", "perspective", "projection", "frustum", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", ".....
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L13600-L13626
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/Async.java
Async.go
public static Thread go(Runnable runnable, String threadName) { Thread thread = daemonThreadFrom(runnable); thread.setName(threadName); thread.start(); return thread; }
java
public static Thread go(Runnable runnable, String threadName) { Thread thread = daemonThreadFrom(runnable); thread.setName(threadName); thread.start(); return thread; }
[ "public", "static", "Thread", "go", "(", "Runnable", "runnable", ",", "String", "threadName", ")", "{", "Thread", "thread", "=", "daemonThreadFrom", "(", "runnable", ")", ";", "thread", ".", "setName", "(", "threadName", ")", ";", "thread", ".", "start", "...
Creates a new thread with the given Runnable, marks it daemon, sets the name, starts it and returns the started thread. @param runnable @param threadName the thread name. @return the started thread.
[ "Creates", "a", "new", "thread", "with", "the", "given", "Runnable", "marks", "it", "daemon", "sets", "the", "name", "starts", "it", "and", "returns", "the", "started", "thread", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/Async.java#L44-L49
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/UtilLepetitEPnP.java
UtilLepetitEPnP.constraintMatrix6x6
public static void constraintMatrix6x6( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x6 ) { int index = 0; for( int i = 0; i < 6; i++ ) { L_6x6.data[index++] = L_6x10.get(i,0); L_6x6.data[index++] = L_6x10.get(i,1); L_6x6.data[index++] = L_6x10.get(i,2); L_6x6.data[index++] = L_6x10.get(i,4); L_6x6.data[index++] = L_6x10.get(i,5); L_6x6.data[index++] = L_6x10.get(i,7); } }
java
public static void constraintMatrix6x6( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x6 ) { int index = 0; for( int i = 0; i < 6; i++ ) { L_6x6.data[index++] = L_6x10.get(i,0); L_6x6.data[index++] = L_6x10.get(i,1); L_6x6.data[index++] = L_6x10.get(i,2); L_6x6.data[index++] = L_6x10.get(i,4); L_6x6.data[index++] = L_6x10.get(i,5); L_6x6.data[index++] = L_6x10.get(i,7); } }
[ "public", "static", "void", "constraintMatrix6x6", "(", "DMatrixRMaj", "L_6x10", ",", "DMatrixRMaj", "L_6x6", ")", "{", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "6", ";", "i", "++", ")", "{", "L_6x6", ".", "da...
Extracts the linear constraint matrix for case 3 from the full 6x10 constraint matrix.
[ "Extracts", "the", "linear", "constraint", "matrix", "for", "case", "3", "from", "the", "full", "6x10", "constraint", "matrix", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/UtilLepetitEPnP.java#L95-L106
ops4j/org.ops4j.pax.exam2
core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java
ZipBuilder.normalizePath
private String normalizePath(File root, File file) { String relativePath = file.getPath().substring(root.getPath().length() + 1); String path = relativePath.replaceAll("\\" + File.separator, "/"); return path; }
java
private String normalizePath(File root, File file) { String relativePath = file.getPath().substring(root.getPath().length() + 1); String path = relativePath.replaceAll("\\" + File.separator, "/"); return path; }
[ "private", "String", "normalizePath", "(", "File", "root", ",", "File", "file", ")", "{", "String", "relativePath", "=", "file", ".", "getPath", "(", ")", ".", "substring", "(", "root", ".", "getPath", "(", ")", ".", "length", "(", ")", "+", "1", ")"...
Returns the relative path of the given file with respect to the root directory, with all file separators replaced by slashes. Example: For root {@code C:\work} and file {@code C:\work\com\example\Foo.class}, the result is {@code com/example/Foo.class} @param root root directory @param file relative path @return normalized file path
[ "Returns", "the", "relative", "path", "of", "the", "given", "file", "with", "respect", "to", "the", "root", "directory", "with", "all", "file", "separators", "replaced", "by", "slashes", "." ]
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java#L198-L202
beangle/beangle3
commons/model/src/main/java/org/beangle/commons/entity/metadata/Model.java
Model.populate
public static void populate(Object entity, Map<String, Object> params) { meta.getPopulator().populate(entity, meta.getEntityType(entity.getClass()), params); }
java
public static void populate(Object entity, Map<String, Object> params) { meta.getPopulator().populate(entity, meta.getEntityType(entity.getClass()), params); }
[ "public", "static", "void", "populate", "(", "Object", "entity", ",", "Map", "<", "String", ",", "Object", ">", "params", ")", "{", "meta", ".", "getPopulator", "(", ")", ".", "populate", "(", "entity", ",", "meta", ".", "getEntityType", "(", "entity", ...
将params中的属性([attr(string)->value(object)],放入到实体类中。<br> 如果引用到了别的实体,那么<br> 如果params中的id为null,则将该实体的置为null.<br> 否则新生成一个实体,将其id设为params中指定的值。 空字符串按照null处理 @param params a {@link java.util.Map} object. @param entity a {@link java.lang.Object} object.
[ "将params中的属性", "(", "[", "attr", "(", "string", ")", "-", ">", "value", "(", "object", ")", "]", ",放入到实体类中。<br", ">", "如果引用到了别的实体,那么<br", ">", "如果params中的id为null,则将该实体的置为null", ".", "<br", ">", "否则新生成一个实体,将其id设为params中指定的值。", "空字符串按照null处理" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/entity/metadata/Model.java#L119-L121
spockframework/spock
spock-core/src/main/java/org/spockframework/mock/MockUtil.java
MockUtil.createDetachedMock
@Beta public Object createDetachedMock(@Nullable String name, Type type, MockNature nature, MockImplementation implementation, Map<String, Object> options, ClassLoader classloader) { Object mock = CompositeMockFactory.INSTANCE.createDetached( new MockConfiguration(name, type, nature, implementation, options), classloader); return mock; }
java
@Beta public Object createDetachedMock(@Nullable String name, Type type, MockNature nature, MockImplementation implementation, Map<String, Object> options, ClassLoader classloader) { Object mock = CompositeMockFactory.INSTANCE.createDetached( new MockConfiguration(name, type, nature, implementation, options), classloader); return mock; }
[ "@", "Beta", "public", "Object", "createDetachedMock", "(", "@", "Nullable", "String", "name", ",", "Type", "type", ",", "MockNature", "nature", ",", "MockImplementation", "implementation", ",", "Map", "<", "String", ",", "Object", ">", "options", ",", "ClassL...
Creates a detached mock. @param name the name @param type the type of the mock @param nature the nature @param implementation the implementation @param options the options @param classloader the classloader to use @return the mock
[ "Creates", "a", "detached", "mock", "." ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/mock/MockUtil.java#L88-L95
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/search/condition/DateRangeCondition.java
DateRangeCondition.parseSpatialOperation
static SpatialOperation parseSpatialOperation(String operation) { if (operation == null) { throw new IndexException("Operation is required"); } else if (operation.equalsIgnoreCase("is_within")) { return SpatialOperation.IsWithin; } else if (operation.equalsIgnoreCase("contains")) { return SpatialOperation.Contains; } else if (operation.equalsIgnoreCase("intersects")) { return SpatialOperation.Intersects; } else { throw new IndexException("Operation is invalid: {}", operation); } }
java
static SpatialOperation parseSpatialOperation(String operation) { if (operation == null) { throw new IndexException("Operation is required"); } else if (operation.equalsIgnoreCase("is_within")) { return SpatialOperation.IsWithin; } else if (operation.equalsIgnoreCase("contains")) { return SpatialOperation.Contains; } else if (operation.equalsIgnoreCase("intersects")) { return SpatialOperation.Intersects; } else { throw new IndexException("Operation is invalid: {}", operation); } }
[ "static", "SpatialOperation", "parseSpatialOperation", "(", "String", "operation", ")", "{", "if", "(", "operation", "==", "null", ")", "{", "throw", "new", "IndexException", "(", "\"Operation is required\"", ")", ";", "}", "else", "if", "(", "operation", ".", ...
Returns the {@link SpatialOperation} representing the specified {@code String}. @param operation a {@code String} representing a {@link SpatialOperation} @return the {@link SpatialOperation} representing the specified {@code String}
[ "Returns", "the", "{", "@link", "SpatialOperation", "}", "representing", "the", "specified", "{", "@code", "String", "}", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/condition/DateRangeCondition.java#L98-L110
ecclesia/kipeto
kipeto-core/src/main/java/de/ecclesia/kipeto/repository/FileRepositoryStrategy.java
FileRepositoryStrategy.subDirForId
private File subDirForId(String id) { File subDir = new File(objs, id.substring(0, SUBDIR_POLICY)); if (!subDir.exists()) { subDir.mkdirs(); } return subDir; }
java
private File subDirForId(String id) { File subDir = new File(objs, id.substring(0, SUBDIR_POLICY)); if (!subDir.exists()) { subDir.mkdirs(); } return subDir; }
[ "private", "File", "subDirForId", "(", "String", "id", ")", "{", "File", "subDir", "=", "new", "File", "(", "objs", ",", "id", ".", "substring", "(", "0", ",", "SUBDIR_POLICY", ")", ")", ";", "if", "(", "!", "subDir", ".", "exists", "(", ")", ")", ...
Ermittelt anhand der <code>SUBDIR_POLICY</code> das Unterverzeichnis, in dem das Item zu der übergebenen Id gepeichert ist bzw. werden muss. } Das Verzeichnis wird angelegt, falls es nicht existiert. @param id des Items @return Verzeichnis, in dem das Item gespeichert ist bzw. werden soll.
[ "Ermittelt", "anhand", "der", "<code", ">", "SUBDIR_POLICY<", "/", "code", ">", "das", "Unterverzeichnis", "in", "dem", "das", "Item", "zu", "der", "übergebenen", "Id", "gepeichert", "ist", "bzw", ".", "werden", "muss", "." ]
train
https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-core/src/main/java/de/ecclesia/kipeto/repository/FileRepositoryStrategy.java#L216-L224
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java
TableWorks.addExprIndex
Index addExprIndex(int[] col, Expression[] indexExprs, HsqlName name, boolean unique, boolean migrating, Expression predicate) { Index newindex; if (table.isEmpty(session) || table.isIndexingMutable()) { newindex = table.createAndAddExprIndexStructure(name, col, indexExprs, unique, migrating, false); } else { newindex = table.createIndexStructure(name, col, null, null, unique, migrating, false, false).withExpressions(indexExprs); Table tn = table.moveDefinition(session, table.tableType, null, null, newindex, -1, 0, emptySet, emptySet); // for all sessions move the data tn.moveData(session, table, -1, 0); database.persistentStoreCollection.releaseStore(table); table = tn; setNewTableInSchema(table); updateConstraints(table, emptySet); } database.schemaManager.addSchemaObject(newindex); database.schemaManager.recompileDependentObjects(table); if (predicate != null) { newindex = newindex.withPredicate(predicate); } return newindex; }
java
Index addExprIndex(int[] col, Expression[] indexExprs, HsqlName name, boolean unique, boolean migrating, Expression predicate) { Index newindex; if (table.isEmpty(session) || table.isIndexingMutable()) { newindex = table.createAndAddExprIndexStructure(name, col, indexExprs, unique, migrating, false); } else { newindex = table.createIndexStructure(name, col, null, null, unique, migrating, false, false).withExpressions(indexExprs); Table tn = table.moveDefinition(session, table.tableType, null, null, newindex, -1, 0, emptySet, emptySet); // for all sessions move the data tn.moveData(session, table, -1, 0); database.persistentStoreCollection.releaseStore(table); table = tn; setNewTableInSchema(table); updateConstraints(table, emptySet); } database.schemaManager.addSchemaObject(newindex); database.schemaManager.recompileDependentObjects(table); if (predicate != null) { newindex = newindex.withPredicate(predicate); } return newindex; }
[ "Index", "addExprIndex", "(", "int", "[", "]", "col", ",", "Expression", "[", "]", "indexExprs", ",", "HsqlName", "name", ",", "boolean", "unique", ",", "boolean", "migrating", ",", "Expression", "predicate", ")", "{", "Index", "newindex", ";", "if", "(", ...
A VoltDB extended variant of addIndex that supports indexed generalized non-column expressions. @param cols int[] @param indexExprs Expression[] @param name HsqlName @param unique boolean @param predicate Expression @return new index
[ "A", "VoltDB", "extended", "variant", "of", "addIndex", "that", "supports", "indexed", "generalized", "non", "-", "column", "expressions", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java#L1172-L1203
jbundle/webapp
proxy/src/main/java/org/jbundle/util/webapp/proxy/ProxyServlet.java
ProxyServlet.service
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { if ((proxyURLPrefix == null) || (proxyURLPrefix.length() == 0)) { // No proxy specified super.service(req, res); return; } ServletOutputStream streamOut = res.getOutputStream(); try { String proxyURLString = getProxyURLString(req); HttpRequestBase httpRequest = getHttpRequest(req, proxyURLString); addHeaders(req, httpRequest); this.getDataFromClient(httpRequest, streamOut); } catch (Exception e) { displayErrorInHtml(streamOut, e); } }
java
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { if ((proxyURLPrefix == null) || (proxyURLPrefix.length() == 0)) { // No proxy specified super.service(req, res); return; } ServletOutputStream streamOut = res.getOutputStream(); try { String proxyURLString = getProxyURLString(req); HttpRequestBase httpRequest = getHttpRequest(req, proxyURLString); addHeaders(req, httpRequest); this.getDataFromClient(httpRequest, streamOut); } catch (Exception e) { displayErrorInHtml(streamOut, e); } }
[ "public", "void", "service", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "ServletException", ",", "IOException", "{", "if", "(", "(", "proxyURLPrefix", "==", "null", ")", "||", "(", "proxyURLPrefix", ".", "length", "(", ...
Process an HTML get or post. @exception ServletException From inherited class. @exception IOException From inherited class.
[ "Process", "an", "HTML", "get", "or", "post", "." ]
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/proxy/src/main/java/org/jbundle/util/webapp/proxy/ProxyServlet.java#L78-L95
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/BuildState.java
BuildState.copyPackagesExcept
public void copyPackagesExcept(BuildState prev, Set<String> recompiled, Set<String> removed) { for (String pkg : prev.packages().keySet()) { // Do not copy recompiled or removed packages. if (recompiled.contains(pkg) || removed.contains(pkg)) continue; Module mnew = findModuleFromPackageName(pkg); Package pprev = prev.packages().get(pkg); mnew.addPackage(pprev); // Do not forget to update the flattened data. packages.put(pkg, pprev); } }
java
public void copyPackagesExcept(BuildState prev, Set<String> recompiled, Set<String> removed) { for (String pkg : prev.packages().keySet()) { // Do not copy recompiled or removed packages. if (recompiled.contains(pkg) || removed.contains(pkg)) continue; Module mnew = findModuleFromPackageName(pkg); Package pprev = prev.packages().get(pkg); mnew.addPackage(pprev); // Do not forget to update the flattened data. packages.put(pkg, pprev); } }
[ "public", "void", "copyPackagesExcept", "(", "BuildState", "prev", ",", "Set", "<", "String", ">", "recompiled", ",", "Set", "<", "String", ">", "removed", ")", "{", "for", "(", "String", "pkg", ":", "prev", ".", "packages", "(", ")", ".", "keySet", "(...
During an incremental compile we need to copy the old javac state information about packages that were not recompiled.
[ "During", "an", "incremental", "compile", "we", "need", "to", "copy", "the", "old", "javac", "state", "information", "about", "packages", "that", "were", "not", "recompiled", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/BuildState.java#L268-L278
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java
PartitionLevelWatermarker.getExpectedHighWatermark
@Override public LongWatermark getExpectedHighWatermark(Partition partition, long tableProcessTime, long partitionProcessTime) { return new LongWatermark(this.expectedHighWatermarks.getPartitionWatermark(tableKey(partition.getTable()), partitionKey(partition))); }
java
@Override public LongWatermark getExpectedHighWatermark(Partition partition, long tableProcessTime, long partitionProcessTime) { return new LongWatermark(this.expectedHighWatermarks.getPartitionWatermark(tableKey(partition.getTable()), partitionKey(partition))); }
[ "@", "Override", "public", "LongWatermark", "getExpectedHighWatermark", "(", "Partition", "partition", ",", "long", "tableProcessTime", ",", "long", "partitionProcessTime", ")", "{", "return", "new", "LongWatermark", "(", "this", ".", "expectedHighWatermarks", ".", "g...
Get the expected high watermark for this partition {@inheritDoc} @see org.apache.gobblin.data.management.conversion.hive.watermarker.HiveSourceWatermarker#getExpectedHighWatermark(org.apache.hadoop.hive.ql.metadata.Partition, long, long)
[ "Get", "the", "expected", "high", "watermark", "for", "this", "partition", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java#L357-L361
janus-project/guava.janusproject.io
guava/src/com/google/common/base/CharMatcher.java
CharMatcher.replaceFrom
@CheckReturnValue public String replaceFrom(CharSequence sequence, char replacement) { String string = sequence.toString(); int pos = indexIn(string); if (pos == -1) { return string; } char[] chars = string.toCharArray(); chars[pos] = replacement; for (int i = pos + 1; i < chars.length; i++) { if (matches(chars[i])) { chars[i] = replacement; } } return new String(chars); }
java
@CheckReturnValue public String replaceFrom(CharSequence sequence, char replacement) { String string = sequence.toString(); int pos = indexIn(string); if (pos == -1) { return string; } char[] chars = string.toCharArray(); chars[pos] = replacement; for (int i = pos + 1; i < chars.length; i++) { if (matches(chars[i])) { chars[i] = replacement; } } return new String(chars); }
[ "@", "CheckReturnValue", "public", "String", "replaceFrom", "(", "CharSequence", "sequence", ",", "char", "replacement", ")", "{", "String", "string", "=", "sequence", ".", "toString", "(", ")", ";", "int", "pos", "=", "indexIn", "(", "string", ")", ";", "...
Returns a string copy of the input character sequence, with each character that matches this matcher replaced by a given replacement character. For example: <pre> {@code CharMatcher.is('a').replaceFrom("radar", 'o')}</pre> ... returns {@code "rodor"}. <p>The default implementation uses {@link #indexIn(CharSequence)} to find the first matching character, then iterates the remainder of the sequence calling {@link #matches(char)} for each character. @param sequence the character sequence to replace matching characters in @param replacement the character to append to the result string in place of each matching character in {@code sequence} @return the new string
[ "Returns", "a", "string", "copy", "of", "the", "input", "character", "sequence", "with", "each", "character", "that", "matches", "this", "matcher", "replaced", "by", "a", "given", "replacement", "character", ".", "For", "example", ":", "<pre", ">", "{", "@co...
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/base/CharMatcher.java#L1113-L1128
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/annotation/AnnotationValueBuilder.java
AnnotationValueBuilder.values
public AnnotationValueBuilder<T> values(@Nullable Class<?>... types) { return member(AnnotationMetadata.VALUE_MEMBER, types); }
java
public AnnotationValueBuilder<T> values(@Nullable Class<?>... types) { return member(AnnotationMetadata.VALUE_MEMBER, types); }
[ "public", "AnnotationValueBuilder", "<", "T", ">", "values", "(", "@", "Nullable", "Class", "<", "?", ">", "...", "types", ")", "{", "return", "member", "(", "AnnotationMetadata", ".", "VALUE_MEMBER", ",", "types", ")", ";", "}" ]
Sets the value member to the given type objects. @param types The type[] @return This builder
[ "Sets", "the", "value", "member", "to", "the", "given", "type", "objects", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/annotation/AnnotationValueBuilder.java#L169-L171
RogerParkinson/madura-objects-parent
madura-rules/src/main/java/nz/co/senanque/rules/OperationsImpl.java
OperationsImpl.match
@InternalFunction() public Boolean match(final List<ProxyField> list,final List<ProxyField> list2) { if (list == null) { return Boolean.TRUE; } for (ProxyField proxyField: list) { boolean found = false; for (ProxyField proxyField2: list2) { if (proxyField.getValue().equals(proxyField2.getValue())) { found = true; break; } } if (!found) { return Boolean.FALSE; } } return Boolean.TRUE; }
java
@InternalFunction() public Boolean match(final List<ProxyField> list,final List<ProxyField> list2) { if (list == null) { return Boolean.TRUE; } for (ProxyField proxyField: list) { boolean found = false; for (ProxyField proxyField2: list2) { if (proxyField.getValue().equals(proxyField2.getValue())) { found = true; break; } } if (!found) { return Boolean.FALSE; } } return Boolean.TRUE; }
[ "@", "InternalFunction", "(", ")", "public", "Boolean", "match", "(", "final", "List", "<", "ProxyField", ">", "list", ",", "final", "List", "<", "ProxyField", ">", "list2", ")", "{", "if", "(", "list", "==", "null", ")", "{", "return", "Boolean", ".",...
Everything in the first list must be in the second list too But not necessarily the reverse. @param list @param list2 @return true if first list is in the second
[ "Everything", "in", "the", "first", "list", "must", "be", "in", "the", "second", "list", "too", "But", "not", "necessarily", "the", "reverse", "." ]
train
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-rules/src/main/java/nz/co/senanque/rules/OperationsImpl.java#L300-L324
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java
EntityJsonParser.parseStructuredObject
public StructuredObject parseStructuredObject(Object instanceSource, Reader instanceReader) throws SchemaValidationException, InvalidInstanceException { try { return new StructuredObject(validate(STRUCTURED_OBJECT_SCHEMA_URL, instanceSource, instanceReader)); } catch (NoSchemaException | InvalidSchemaException e) { // In theory this cannot happen throw new RuntimeException(e); } }
java
public StructuredObject parseStructuredObject(Object instanceSource, Reader instanceReader) throws SchemaValidationException, InvalidInstanceException { try { return new StructuredObject(validate(STRUCTURED_OBJECT_SCHEMA_URL, instanceSource, instanceReader)); } catch (NoSchemaException | InvalidSchemaException e) { // In theory this cannot happen throw new RuntimeException(e); } }
[ "public", "StructuredObject", "parseStructuredObject", "(", "Object", "instanceSource", ",", "Reader", "instanceReader", ")", "throws", "SchemaValidationException", ",", "InvalidInstanceException", "{", "try", "{", "return", "new", "StructuredObject", "(", "validate", "("...
Parse a single StructuredObject instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way. @param instanceSource An object describing the source of the instance, typically an instance of java.net.URL or java.io.File. @param instanceReader A Reader containing the JSON representation of a single StructuredObject instance. @return A StructuredObject instance. @throws SchemaValidationException If the given instance does not meet the general EntityJSON schema. @throws InvalidInstanceException If the given instance is structurally invalid.
[ "Parse", "a", "single", "StructuredObject", "instance", "from", "the", "given", "URL", "." ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java#L214-L225
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/integration/WSHelper.java
WSHelper.getOptionalAttachment
public static <A> A getOptionalAttachment( final Deployment dep, final Class< A > key ) { return dep.getAttachment( key ); }
java
public static <A> A getOptionalAttachment( final Deployment dep, final Class< A > key ) { return dep.getAttachment( key ); }
[ "public", "static", "<", "A", ">", "A", "getOptionalAttachment", "(", "final", "Deployment", "dep", ",", "final", "Class", "<", "A", ">", "key", ")", "{", "return", "dep", ".", "getAttachment", "(", "key", ")", ";", "}" ]
Returns optional attachment value from webservice deployment or null if not bound. @param <A> expected value @param dep webservice deployment @param key attachment key @return optional attachment value or null
[ "Returns", "optional", "attachment", "value", "from", "webservice", "deployment", "or", "null", "if", "not", "bound", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/integration/WSHelper.java#L80-L83
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getSessionTokenVerified
public SessionTokenInfo getSessionTokenVerified(String devideId, String stateToken, String otpToken, String allowedOrigin) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getSessionTokenVerified(devideId, stateToken, otpToken, allowedOrigin, false); }
java
public SessionTokenInfo getSessionTokenVerified(String devideId, String stateToken, String otpToken, String allowedOrigin) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getSessionTokenVerified(devideId, stateToken, otpToken, allowedOrigin, false); }
[ "public", "SessionTokenInfo", "getSessionTokenVerified", "(", "String", "devideId", ",", "String", "stateToken", ",", "String", "otpToken", ",", "String", "allowedOrigin", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{",...
Verify a one-time password (OTP) value provided for multi-factor authentication (MFA). @param devideId Provide the MFA device_id you are submitting for verification. @param stateToken Provide the state_token associated with the MFA device_id you are submitting for verification. @param otpToken Provide the OTP value for the MFA factor you are submitting for verification. @param allowedOrigin Custom-Allowed-Origin-Header. Required for CORS requests only. Set to the Origin URI from which you are allowed to send a request using CORS. @return Session Token @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/verify-factor">Verify Factor documentation</a>
[ "Verify", "a", "one", "-", "time", "password", "(", "OTP", ")", "value", "provided", "for", "multi", "-", "factor", "authentication", "(", "MFA", ")", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L960-L962
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java
Configuration.getLong
public long getLong(String name, long defaultValue) { String valueString = get(name); if (valueString == null) return defaultValue; try { String hexString = getHexDigits(valueString); if (hexString != null) { return Long.parseLong(hexString, 16); } return Long.parseLong(valueString); } catch (NumberFormatException e) { return defaultValue; } }
java
public long getLong(String name, long defaultValue) { String valueString = get(name); if (valueString == null) return defaultValue; try { String hexString = getHexDigits(valueString); if (hexString != null) { return Long.parseLong(hexString, 16); } return Long.parseLong(valueString); } catch (NumberFormatException e) { return defaultValue; } }
[ "public", "long", "getLong", "(", "String", "name", ",", "long", "defaultValue", ")", "{", "String", "valueString", "=", "get", "(", "name", ")", ";", "if", "(", "valueString", "==", "null", ")", "return", "defaultValue", ";", "try", "{", "String", "hexS...
Get the value of the <code>name</code> property as a <code>long</code>. If no such property is specified, or if the specified value is not a valid <code>long</code>, then <code>defaultValue</code> is returned. @param name property name. @param defaultValue default value. @return property value as a <code>long</code>, or <code>defaultValue</code>.
[ "Get", "the", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "a", "<code", ">", "long<", "/", "code", ">", ".", "If", "no", "such", "property", "is", "specified", "or", "if", "the", "specified", "value", "is", "not",...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java#L510-L523
alkacon/opencms-core
src/org/opencms/util/CmsXmlSaxWriter.java
CmsXmlSaxWriter.resolveName
private String resolveName(String localName, String qualifiedName) { if ((localName == null) || (localName.length() == 0)) { return qualifiedName; } else { return localName; } }
java
private String resolveName(String localName, String qualifiedName) { if ((localName == null) || (localName.length() == 0)) { return qualifiedName; } else { return localName; } }
[ "private", "String", "resolveName", "(", "String", "localName", ",", "String", "qualifiedName", ")", "{", "if", "(", "(", "localName", "==", "null", ")", "||", "(", "localName", ".", "length", "(", ")", "==", "0", ")", ")", "{", "return", "qualifiedName"...
Resolves the local vs. the qualified name.<p> If the local name is the empty String "", the qualified name is used.<p> @param localName the local name @param qualifiedName the qualified XML 1.0 name @return the resolved name to use
[ "Resolves", "the", "local", "vs", ".", "the", "qualified", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsXmlSaxWriter.java#L420-L427
JOML-CI/JOML
src/org/joml/Quaterniond.java
Quaterniond.fromAxisAngleDeg
public Quaterniond fromAxisAngleDeg(Vector3dc axis, double angle) { return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), Math.toRadians(angle)); }
java
public Quaterniond fromAxisAngleDeg(Vector3dc axis, double angle) { return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), Math.toRadians(angle)); }
[ "public", "Quaterniond", "fromAxisAngleDeg", "(", "Vector3dc", "axis", ",", "double", "angle", ")", "{", "return", "fromAxisAngleRad", "(", "axis", ".", "x", "(", ")", ",", "axis", ".", "y", "(", ")", ",", "axis", ".", "z", "(", ")", ",", "Math", "."...
Set this quaternion to be a representation of the supplied axis and angle (in degrees). @param axis the rotation axis @param angle the angle in degrees @return this
[ "Set", "this", "quaternion", "to", "be", "a", "representation", "of", "the", "supplied", "axis", "and", "angle", "(", "in", "degrees", ")", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L686-L688
vst/commons-math-extensions
src/main/java/com/vsthost/rnd/commons/math/ext/linear/DMatrixUtils.java
DMatrixUtils.roundDoubleToClosest
public static double roundDoubleToClosest (double value, double steps) { final double down = DMatrixUtils.roundDoubleDownTo(value, steps); final double up = DMatrixUtils.roundDoubleUpTo(value, steps); if (Math.abs(value - down) < Math.abs(value - up)) { return down; } return up; }
java
public static double roundDoubleToClosest (double value, double steps) { final double down = DMatrixUtils.roundDoubleDownTo(value, steps); final double up = DMatrixUtils.roundDoubleUpTo(value, steps); if (Math.abs(value - down) < Math.abs(value - up)) { return down; } return up; }
[ "public", "static", "double", "roundDoubleToClosest", "(", "double", "value", ",", "double", "steps", ")", "{", "final", "double", "down", "=", "DMatrixUtils", ".", "roundDoubleDownTo", "(", "value", ",", "steps", ")", ";", "final", "double", "up", "=", "DMa...
Same functionality as {@link DMatrixUtils#roundToClosest(double, double)} but operating on double values. @param value The value to be rounded. @param steps Steps. @return Rounded value.
[ "Same", "functionality", "as", "{", "@link", "DMatrixUtils#roundToClosest", "(", "double", "double", ")", "}", "but", "operating", "on", "double", "values", "." ]
train
https://github.com/vst/commons-math-extensions/blob/a11ee78ffe53ab7c016062be93c5af07aa8e1823/src/main/java/com/vsthost/rnd/commons/math/ext/linear/DMatrixUtils.java#L364-L371
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.parseHtmlTemplate
public TemplateParserResult parseHtmlTemplate(String htmlTemplate, TemplateParserContext context, Elements elements, Messager messager, URI htmlTemplateUri) { this.context = context; this.elements = elements; this.messager = messager; this.logger = new TemplateParserLogger(context, messager); this.htmlTemplateUri = htmlTemplateUri; initJerichoConfig(this.logger); Source source = new Source(htmlTemplate); outputDocument = new OutputDocument(source); result = new TemplateParserResult(context); processImports(source); result.setScopedCss(processScopedCss(source)); source.getChildElements().forEach(this::processElement); result.setProcessedTemplate(outputDocument.toString()); return result; }
java
public TemplateParserResult parseHtmlTemplate(String htmlTemplate, TemplateParserContext context, Elements elements, Messager messager, URI htmlTemplateUri) { this.context = context; this.elements = elements; this.messager = messager; this.logger = new TemplateParserLogger(context, messager); this.htmlTemplateUri = htmlTemplateUri; initJerichoConfig(this.logger); Source source = new Source(htmlTemplate); outputDocument = new OutputDocument(source); result = new TemplateParserResult(context); processImports(source); result.setScopedCss(processScopedCss(source)); source.getChildElements().forEach(this::processElement); result.setProcessedTemplate(outputDocument.toString()); return result; }
[ "public", "TemplateParserResult", "parseHtmlTemplate", "(", "String", "htmlTemplate", ",", "TemplateParserContext", "context", ",", "Elements", "elements", ",", "Messager", "messager", ",", "URI", "htmlTemplateUri", ")", "{", "this", ".", "context", "=", "context", ...
Parse a given HTML template and return the a result object containing the expressions and a transformed HTML. @param htmlTemplate The HTML template to process, as a String @param context Context of the Component we are currently processing @param messager Used to report errors in template during Annotation Processing @return A {@link TemplateParserResult} containing the processed template and expressions
[ "Parse", "a", "given", "HTML", "template", "and", "return", "the", "a", "result", "object", "containing", "the", "expressions", "and", "a", "transformed", "HTML", "." ]
train
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L101-L121
apache/incubator-heron
heron/scheduler-core/src/java/org/apache/heron/scheduler/client/SchedulerClientFactory.java
SchedulerClientFactory.getSchedulerClient
public ISchedulerClient getSchedulerClient() throws SchedulerException { LOG.fine("Creating scheduler client"); ISchedulerClient schedulerClient; if (Context.schedulerService(config)) { // get the instance of the state manager SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime); Scheduler.SchedulerLocation schedulerLocation = statemgr.getSchedulerLocation(Runtime.topologyName(runtime)); if (schedulerLocation == null) { throw new SchedulerException("Failed to get scheduler location from state manager"); } LOG.log(Level.FINE, "Scheduler is listening on location: {0} ", schedulerLocation.toString()); schedulerClient = new HttpServiceSchedulerClient(config, runtime, schedulerLocation.getHttpEndpoint()); } else { // create an instance of scheduler final IScheduler scheduler = LauncherUtils.getInstance() .getSchedulerInstance(config, runtime); LOG.fine("Invoke scheduler as a library"); schedulerClient = new LibrarySchedulerClient(config, runtime, scheduler); } return schedulerClient; }
java
public ISchedulerClient getSchedulerClient() throws SchedulerException { LOG.fine("Creating scheduler client"); ISchedulerClient schedulerClient; if (Context.schedulerService(config)) { // get the instance of the state manager SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime); Scheduler.SchedulerLocation schedulerLocation = statemgr.getSchedulerLocation(Runtime.topologyName(runtime)); if (schedulerLocation == null) { throw new SchedulerException("Failed to get scheduler location from state manager"); } LOG.log(Level.FINE, "Scheduler is listening on location: {0} ", schedulerLocation.toString()); schedulerClient = new HttpServiceSchedulerClient(config, runtime, schedulerLocation.getHttpEndpoint()); } else { // create an instance of scheduler final IScheduler scheduler = LauncherUtils.getInstance() .getSchedulerInstance(config, runtime); LOG.fine("Invoke scheduler as a library"); schedulerClient = new LibrarySchedulerClient(config, runtime, scheduler); } return schedulerClient; }
[ "public", "ISchedulerClient", "getSchedulerClient", "(", ")", "throws", "SchedulerException", "{", "LOG", ".", "fine", "(", "\"Creating scheduler client\"", ")", ";", "ISchedulerClient", "schedulerClient", ";", "if", "(", "Context", ".", "schedulerService", "(", "conf...
Implementation of getSchedulerClient - Used to create objects Currently it creates either HttpServiceSchedulerClient or LibrarySchedulerClient @return getSchedulerClient created. return null if failed to create ISchedulerClient instance
[ "Implementation", "of", "getSchedulerClient", "-", "Used", "to", "create", "objects", "Currently", "it", "creates", "either", "HttpServiceSchedulerClient", "or", "LibrarySchedulerClient" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/client/SchedulerClientFactory.java#L52-L81
Erudika/para
para-client/src/main/java/com/erudika/para/client/ParaClient.java
ParaClient.revokeAllResourcePermissions
public Map<String, Map<String, List<String>>> revokeAllResourcePermissions(String subjectid) { if (StringUtils.isBlank(subjectid)) { return Collections.emptyMap(); } return getEntity(invokeDelete(Utils.formatMessage("_permissions/{0}", subjectid), null), Map.class); }
java
public Map<String, Map<String, List<String>>> revokeAllResourcePermissions(String subjectid) { if (StringUtils.isBlank(subjectid)) { return Collections.emptyMap(); } return getEntity(invokeDelete(Utils.formatMessage("_permissions/{0}", subjectid), null), Map.class); }
[ "public", "Map", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", ">", "revokeAllResourcePermissions", "(", "String", "subjectid", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "subjectid", ")", ")", "{", "return...
Revokes all permission for a subject. @param subjectid subject id (user id) @return a map of the permissions for this subject id
[ "Revokes", "all", "permission", "for", "a", "subject", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L1477-L1482
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java
SheetBindingErrors.createFieldConversionError
public InternalFieldErrorBuilder createFieldConversionError(final String field, final Class<?> fieldType, final Object rejectedValue) { final String fieldPath = buildFieldPath(field); final String[] codes = messageCodeGenerator.generateTypeMismatchCodes(getObjectName(), fieldPath, fieldType); return new InternalFieldErrorBuilder(this, getObjectName(), fieldPath, codes) .sheetName(getSheetName()) .rejectedValue(rejectedValue) .conversionFailure(true); }
java
public InternalFieldErrorBuilder createFieldConversionError(final String field, final Class<?> fieldType, final Object rejectedValue) { final String fieldPath = buildFieldPath(field); final String[] codes = messageCodeGenerator.generateTypeMismatchCodes(getObjectName(), fieldPath, fieldType); return new InternalFieldErrorBuilder(this, getObjectName(), fieldPath, codes) .sheetName(getSheetName()) .rejectedValue(rejectedValue) .conversionFailure(true); }
[ "public", "InternalFieldErrorBuilder", "createFieldConversionError", "(", "final", "String", "field", ",", "final", "Class", "<", "?", ">", "fieldType", ",", "final", "Object", "rejectedValue", ")", "{", "final", "String", "fieldPath", "=", "buildFieldPath", "(", ...
型変換失敗時のフィールエラー用のビルダを作成します。 @param field フィールドパス。 @param fieldType フィールドのクラスタイプ @param rejectedValue 型変換に失敗した値 @return {@link FieldError}のインスタンスを組み立てるビルダクラス。
[ "型変換失敗時のフィールエラー用のビルダを作成します。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java#L643-L654
ronmamo/reflections
src/main/java/org/reflections/vfs/Vfs.java
Vfs.fromURL
public static Dir fromURL(final URL url, final List<UrlType> urlTypes) { for (UrlType type : urlTypes) { try { if (type.matches(url)) { Dir dir = type.createDir(url); if (dir != null) return dir; } } catch (Throwable e) { if (Reflections.log != null) { Reflections.log.warn("could not create Dir using " + type + " from url " + url.toExternalForm() + ". skipping.", e); } } } throw new ReflectionsException("could not create Vfs.Dir from url, no matching UrlType was found [" + url.toExternalForm() + "]\n" + "either use fromURL(final URL url, final List<UrlType> urlTypes) or " + "use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) " + "with your specialized UrlType."); }
java
public static Dir fromURL(final URL url, final List<UrlType> urlTypes) { for (UrlType type : urlTypes) { try { if (type.matches(url)) { Dir dir = type.createDir(url); if (dir != null) return dir; } } catch (Throwable e) { if (Reflections.log != null) { Reflections.log.warn("could not create Dir using " + type + " from url " + url.toExternalForm() + ". skipping.", e); } } } throw new ReflectionsException("could not create Vfs.Dir from url, no matching UrlType was found [" + url.toExternalForm() + "]\n" + "either use fromURL(final URL url, final List<UrlType> urlTypes) or " + "use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) " + "with your specialized UrlType."); }
[ "public", "static", "Dir", "fromURL", "(", "final", "URL", "url", ",", "final", "List", "<", "UrlType", ">", "urlTypes", ")", "{", "for", "(", "UrlType", "type", ":", "urlTypes", ")", "{", "try", "{", "if", "(", "type", ".", "matches", "(", "url", ...
tries to create a Dir from the given url, using the given urlTypes
[ "tries", "to", "create", "a", "Dir", "from", "the", "given", "url", "using", "the", "given", "urlTypes" ]
train
https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/vfs/Vfs.java#L97-L115
dyu/protostuff-1.0.x
protostuff-benchmark/src/main/java/com/google/protobuf/JsonFormat.java
JsonFormat.print
public static void print(UnknownFieldSet fields, Appendable output) throws IOException { JsonGenerator generator = new JsonGenerator(output); generator.print("{"); printUnknownFields(fields, generator); generator.print("}"); }
java
public static void print(UnknownFieldSet fields, Appendable output) throws IOException { JsonGenerator generator = new JsonGenerator(output); generator.print("{"); printUnknownFields(fields, generator); generator.print("}"); }
[ "public", "static", "void", "print", "(", "UnknownFieldSet", "fields", ",", "Appendable", "output", ")", "throws", "IOException", "{", "JsonGenerator", "generator", "=", "new", "JsonGenerator", "(", "output", ")", ";", "generator", ".", "print", "(", "\"{\"", ...
Outputs a textual representation of {@code fields} to {@code output}.
[ "Outputs", "a", "textual", "representation", "of", "{" ]
train
https://github.com/dyu/protostuff-1.0.x/blob/d7c964ec20da3fe44699d86ee95c2677ddffde96/protostuff-benchmark/src/main/java/com/google/protobuf/JsonFormat.java#L81-L86
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UPropertyAliases.java
UPropertyAliases.getPropertyValueEnum
public int getPropertyValueEnum(int property, CharSequence alias) { int valueMapIndex=findProperty(property); if(valueMapIndex==0) { throw new IllegalArgumentException( "Invalid property enum "+property+" (0x"+Integer.toHexString(property)+")"); } valueMapIndex=valueMaps[valueMapIndex+1]; if(valueMapIndex==0) { throw new IllegalArgumentException( "Property "+property+" (0x"+Integer.toHexString(property)+ ") does not have named values"); } // valueMapIndex is the start of the property's valueMap, // where the first word is the BytesTrie offset. return getPropertyOrValueEnum(valueMaps[valueMapIndex], alias); }
java
public int getPropertyValueEnum(int property, CharSequence alias) { int valueMapIndex=findProperty(property); if(valueMapIndex==0) { throw new IllegalArgumentException( "Invalid property enum "+property+" (0x"+Integer.toHexString(property)+")"); } valueMapIndex=valueMaps[valueMapIndex+1]; if(valueMapIndex==0) { throw new IllegalArgumentException( "Property "+property+" (0x"+Integer.toHexString(property)+ ") does not have named values"); } // valueMapIndex is the start of the property's valueMap, // where the first word is the BytesTrie offset. return getPropertyOrValueEnum(valueMaps[valueMapIndex], alias); }
[ "public", "int", "getPropertyValueEnum", "(", "int", "property", ",", "CharSequence", "alias", ")", "{", "int", "valueMapIndex", "=", "findProperty", "(", "property", ")", ";", "if", "(", "valueMapIndex", "==", "0", ")", "{", "throw", "new", "IllegalArgumentEx...
Returns a value enum given a property enum and one of its value names.
[ "Returns", "a", "value", "enum", "given", "a", "property", "enum", "and", "one", "of", "its", "value", "names", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UPropertyAliases.java#L293-L308
netty/netty
codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java
MqttDecoder.decodeFixedHeader
private static MqttFixedHeader decodeFixedHeader(ByteBuf buffer) { short b1 = buffer.readUnsignedByte(); MqttMessageType messageType = MqttMessageType.valueOf(b1 >> 4); boolean dupFlag = (b1 & 0x08) == 0x08; int qosLevel = (b1 & 0x06) >> 1; boolean retain = (b1 & 0x01) != 0; int remainingLength = 0; int multiplier = 1; short digit; int loops = 0; do { digit = buffer.readUnsignedByte(); remainingLength += (digit & 127) * multiplier; multiplier *= 128; loops++; } while ((digit & 128) != 0 && loops < 4); // MQTT protocol limits Remaining Length to 4 bytes if (loops == 4 && (digit & 128) != 0) { throw new DecoderException("remaining length exceeds 4 digits (" + messageType + ')'); } MqttFixedHeader decodedFixedHeader = new MqttFixedHeader(messageType, dupFlag, MqttQoS.valueOf(qosLevel), retain, remainingLength); return validateFixedHeader(resetUnusedFields(decodedFixedHeader)); }
java
private static MqttFixedHeader decodeFixedHeader(ByteBuf buffer) { short b1 = buffer.readUnsignedByte(); MqttMessageType messageType = MqttMessageType.valueOf(b1 >> 4); boolean dupFlag = (b1 & 0x08) == 0x08; int qosLevel = (b1 & 0x06) >> 1; boolean retain = (b1 & 0x01) != 0; int remainingLength = 0; int multiplier = 1; short digit; int loops = 0; do { digit = buffer.readUnsignedByte(); remainingLength += (digit & 127) * multiplier; multiplier *= 128; loops++; } while ((digit & 128) != 0 && loops < 4); // MQTT protocol limits Remaining Length to 4 bytes if (loops == 4 && (digit & 128) != 0) { throw new DecoderException("remaining length exceeds 4 digits (" + messageType + ')'); } MqttFixedHeader decodedFixedHeader = new MqttFixedHeader(messageType, dupFlag, MqttQoS.valueOf(qosLevel), retain, remainingLength); return validateFixedHeader(resetUnusedFields(decodedFixedHeader)); }
[ "private", "static", "MqttFixedHeader", "decodeFixedHeader", "(", "ByteBuf", "buffer", ")", "{", "short", "b1", "=", "buffer", ".", "readUnsignedByte", "(", ")", ";", "MqttMessageType", "messageType", "=", "MqttMessageType", ".", "valueOf", "(", "b1", ">>", "4",...
Decodes the fixed header. It's one byte for the flags and then variable bytes for the remaining length. @param buffer the buffer to decode from @return the fixed header
[ "Decodes", "the", "fixed", "header", ".", "It", "s", "one", "byte", "for", "the", "flags", "and", "then", "variable", "bytes", "for", "the", "remaining", "length", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java#L145-L171
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/converter/Converter.java
Converter.getValue
protected Object getValue(Object einstance, Field field) { return getNestedProperty(einstance, field.getProperty()); }
java
protected Object getValue(Object einstance, Field field) { return getNestedProperty(einstance, field.getProperty()); }
[ "protected", "Object", "getValue", "(", "Object", "einstance", ",", "Field", "field", ")", "{", "return", "getNestedProperty", "(", "einstance", ",", "field", ".", "getProperty", "(", ")", ")", ";", "}" ]
Getter for the value @param einstance The entity instance @param field The field @return The field value on the entity instance
[ "Getter", "for", "the", "value" ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/converter/Converter.java#L95-L97
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java
MandatoryWarningHandler.logMandatoryNote
private void logMandatoryNote(JavaFileObject file, String msg, Object... args) { if (enforceMandatory) log.mandatoryNote(file, msg, args); else log.note(file, msg, args); }
java
private void logMandatoryNote(JavaFileObject file, String msg, Object... args) { if (enforceMandatory) log.mandatoryNote(file, msg, args); else log.note(file, msg, args); }
[ "private", "void", "logMandatoryNote", "(", "JavaFileObject", "file", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "enforceMandatory", ")", "log", ".", "mandatoryNote", "(", "file", ",", "msg", ",", "args", ")", ";", "else", "...
Reports a mandatory note to the log. If mandatory notes are not being enforced, treat this as an ordinary note.
[ "Reports", "a", "mandatory", "note", "to", "the", "log", ".", "If", "mandatory", "notes", "are", "not", "being", "enforced", "treat", "this", "as", "an", "ordinary", "note", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java#L264-L269
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java
UriUtils.encodeHost
public static String encodeHost(String host, String encoding) throws UnsupportedEncodingException { return HierarchicalUriComponents.encodeUriComponent(host, encoding, HierarchicalUriComponents.Type.HOST_IPV4); }
java
public static String encodeHost(String host, String encoding) throws UnsupportedEncodingException { return HierarchicalUriComponents.encodeUriComponent(host, encoding, HierarchicalUriComponents.Type.HOST_IPV4); }
[ "public", "static", "String", "encodeHost", "(", "String", "host", ",", "String", "encoding", ")", "throws", "UnsupportedEncodingException", "{", "return", "HierarchicalUriComponents", ".", "encodeUriComponent", "(", "host", ",", "encoding", ",", "HierarchicalUriCompone...
Encodes the given URI host with the given encoding. @param host the host to be encoded @param encoding the character encoding to encode to @return the encoded host @throws UnsupportedEncodingException when the given encoding parameter is not supported
[ "Encodes", "the", "given", "URI", "host", "with", "the", "given", "encoding", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L252-L254
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.getVnetFromServerFarmAsync
public Observable<VnetInfoInner> getVnetFromServerFarmAsync(String resourceGroupName, String name, String vnetName) { return getVnetFromServerFarmWithServiceResponseAsync(resourceGroupName, name, vnetName).map(new Func1<ServiceResponse<VnetInfoInner>, VnetInfoInner>() { @Override public VnetInfoInner call(ServiceResponse<VnetInfoInner> response) { return response.body(); } }); }
java
public Observable<VnetInfoInner> getVnetFromServerFarmAsync(String resourceGroupName, String name, String vnetName) { return getVnetFromServerFarmWithServiceResponseAsync(resourceGroupName, name, vnetName).map(new Func1<ServiceResponse<VnetInfoInner>, VnetInfoInner>() { @Override public VnetInfoInner call(ServiceResponse<VnetInfoInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VnetInfoInner", ">", "getVnetFromServerFarmAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "vnetName", ")", "{", "return", "getVnetFromServerFarmWithServiceResponseAsync", "(", "resourceGroupName", ",", "name...
Get a Virtual Network associated with an App Service plan. Get a Virtual Network associated with an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VnetInfoInner object
[ "Get", "a", "Virtual", "Network", "associated", "with", "an", "App", "Service", "plan", ".", "Get", "a", "Virtual", "Network", "associated", "with", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3104-L3111
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.readJsonFile
public static String readJsonFile(Path dir, Path config, String version, String filename) throws IOException { try { return readJsonVersionedFile(dir, version, filename); } catch (NoSuchFileException e) { // We fall back to default mappings in config dir return readDefaultJsonVersionedFile(config, version, filename); } }
java
public static String readJsonFile(Path dir, Path config, String version, String filename) throws IOException { try { return readJsonVersionedFile(dir, version, filename); } catch (NoSuchFileException e) { // We fall back to default mappings in config dir return readDefaultJsonVersionedFile(config, version, filename); } }
[ "public", "static", "String", "readJsonFile", "(", "Path", "dir", ",", "Path", "config", ",", "String", "version", ",", "String", "filename", ")", "throws", "IOException", "{", "try", "{", "return", "readJsonVersionedFile", "(", "dir", ",", "version", ",", "...
Reads a Json file from dir/version/filename.json file. If not found, read from ~/.fscrawler/_default/version/filename.json @param dir Directory which might contain filename files per major version (job dir) @param config Root dir where we can find the configuration (default to ~/.fscrawler) @param version Elasticsearch major version number (only major digit is kept so for 2.3.4 it will be 2) @param filename The expected filename (will be expanded to filename.json) @return the mapping @throws IOException If the mapping can not be read
[ "Reads", "a", "Json", "file", "from", "dir", "/", "version", "/", "filename", ".", "json", "file", ".", "If", "not", "found", "read", "from", "~", "/", ".", "fscrawler", "/", "_default", "/", "version", "/", "filename", ".", "json" ]
train
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L116-L123
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java
TenantService.isValidUserAccess
private boolean isValidUserAccess(UserDefinition userDef, Permission permNeeded) { Set<Permission> permList = userDef.getPermissions(); if (permList.size() == 0 || permList.contains(Permission.ALL)) { return true; } switch (permNeeded) { case APPEND: return permList.contains(Permission.APPEND) || permList.contains(Permission.UPDATE); case READ: return permList.contains(Permission.READ); case UPDATE: return permList.contains(Permission.UPDATE); default: return false; } }
java
private boolean isValidUserAccess(UserDefinition userDef, Permission permNeeded) { Set<Permission> permList = userDef.getPermissions(); if (permList.size() == 0 || permList.contains(Permission.ALL)) { return true; } switch (permNeeded) { case APPEND: return permList.contains(Permission.APPEND) || permList.contains(Permission.UPDATE); case READ: return permList.contains(Permission.READ); case UPDATE: return permList.contains(Permission.UPDATE); default: return false; } }
[ "private", "boolean", "isValidUserAccess", "(", "UserDefinition", "userDef", ",", "Permission", "permNeeded", ")", "{", "Set", "<", "Permission", ">", "permList", "=", "userDef", ".", "getPermissions", "(", ")", ";", "if", "(", "permList", ".", "size", "(", ...
Validate user's permission vs. the given required permission.
[ "Validate", "user", "s", "permission", "vs", ".", "the", "given", "required", "permission", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java#L544-L559
Stratio/cassandra-lucene-index
builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java
Builder.geoShape
public static GeoShapeCondition geoShape(String field, String shape) { return geoShape(field, wkt(shape)); }
java
public static GeoShapeCondition geoShape(String field, String shape) { return geoShape(field, wkt(shape)); }
[ "public", "static", "GeoShapeCondition", "geoShape", "(", "String", "field", ",", "String", "shape", ")", "{", "return", "geoShape", "(", "field", ",", "wkt", "(", "shape", ")", ")", ";", "}" ]
Returns a new {@link GeoShapeCondition} with the specified shape. @param field the name of the field @param shape the shape in WKT format @return a new geo shape condition
[ "Returns", "a", "new", "{", "@link", "GeoShapeCondition", "}", "with", "the", "specified", "shape", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java#L481-L483
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.selectField
private AssignmentField selectField(AssignmentField[] fields, int index) { if (index < 1 || index > fields.length) { throw new IllegalArgumentException(index + " is not a valid field index"); } return (fields[index - 1]); }
java
private AssignmentField selectField(AssignmentField[] fields, int index) { if (index < 1 || index > fields.length) { throw new IllegalArgumentException(index + " is not a valid field index"); } return (fields[index - 1]); }
[ "private", "AssignmentField", "selectField", "(", "AssignmentField", "[", "]", "fields", ",", "int", "index", ")", "{", "if", "(", "index", "<", "1", "||", "index", ">", "fields", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "i...
Maps a field index to an AssignmentField instance. @param fields array of fields used as the basis for the mapping. @param index required field index @return AssignmnetField instance
[ "Maps", "a", "field", "index", "to", "an", "AssignmentField", "instance", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2683-L2690
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/encode/HashSHAConverter.java
HashSHAConverter.setString
public int setString(String strValue, boolean bDisplayOption, int iMoveMode) { if ((strValue == null) || (strValue.length() == 0)) return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display if (TEN_SPACES.equals(strValue)) return DBConstants.NORMAL_RETURN; return super.setString(strValue, bDisplayOption, iMoveMode); }
java
public int setString(String strValue, boolean bDisplayOption, int iMoveMode) { if ((strValue == null) || (strValue.length() == 0)) return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display if (TEN_SPACES.equals(strValue)) return DBConstants.NORMAL_RETURN; return super.setString(strValue, bDisplayOption, iMoveMode); }
[ "public", "int", "setString", "(", "String", "strValue", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "(", "strValue", "==", "null", ")", "||", "(", "strValue", ".", "length", "(", ")", "==", "0", ")", ")", "return", ...
Convert and move string to this field. @param strString the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code (or NORMAL_RETURN).
[ "Convert", "and", "move", "string", "to", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/encode/HashSHAConverter.java#L74-L81
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java
Properties.getBool
public boolean getBool(String name, boolean def) { final String s = getProperty(name); if (s == null) { return def; } try { return s != null && s.equalsIgnoreCase("true"); } catch (Exception e) { return def; } }
java
public boolean getBool(String name, boolean def) { final String s = getProperty(name); if (s == null) { return def; } try { return s != null && s.equalsIgnoreCase("true"); } catch (Exception e) { return def; } }
[ "public", "boolean", "getBool", "(", "String", "name", ",", "boolean", "def", ")", "{", "final", "String", "s", "=", "getProperty", "(", "name", ")", ";", "if", "(", "s", "==", "null", ")", "{", "return", "def", ";", "}", "try", "{", "return", "s",...
Returns the property assuming its a boolean. If it isn't or if its not defined, returns default value. @param name Property name @param def Default value @return Property value or def
[ "Returns", "the", "property", "assuming", "its", "a", "boolean", ".", "If", "it", "isn", "t", "or", "if", "its", "not", "defined", "returns", "default", "value", "." ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java#L66-L76
drewnoakes/metadata-extractor
Source/com/drew/imaging/ImageMetadataReader.java
ImageMetadataReader.readMetadata
@NotNull public static Metadata readMetadata(@NotNull final InputStream inputStream, final long streamLength, final FileType fileType) throws IOException, ImageProcessingException { switch (fileType) { case Jpeg: return JpegMetadataReader.readMetadata(inputStream); case Tiff: case Arw: case Cr2: case Nef: case Orf: case Rw2: return TiffMetadataReader.readMetadata(new RandomAccessStreamReader(inputStream, RandomAccessStreamReader.DEFAULT_CHUNK_LENGTH, streamLength)); case Psd: return PsdMetadataReader.readMetadata(inputStream); case Png: return PngMetadataReader.readMetadata(inputStream); case Bmp: return BmpMetadataReader.readMetadata(inputStream); case Gif: return GifMetadataReader.readMetadata(inputStream); case Ico: return IcoMetadataReader.readMetadata(inputStream); case Pcx: return PcxMetadataReader.readMetadata(inputStream); case WebP: return WebpMetadataReader.readMetadata(inputStream); case Raf: return RafMetadataReader.readMetadata(inputStream); case Avi: return AviMetadataReader.readMetadata(inputStream); case Wav: return WavMetadataReader.readMetadata(inputStream); case Mov: return QuickTimeMetadataReader.readMetadata(inputStream); case Mp4: return Mp4MetadataReader.readMetadata(inputStream); case Mp3: return Mp3MetadataReader.readMetadata(inputStream); case Eps: return EpsMetadataReader.readMetadata(inputStream); case Heif: return HeifMetadataReader.readMetadata(inputStream); case Unknown: throw new ImageProcessingException("File format could not be determined"); default: return new Metadata(); } }
java
@NotNull public static Metadata readMetadata(@NotNull final InputStream inputStream, final long streamLength, final FileType fileType) throws IOException, ImageProcessingException { switch (fileType) { case Jpeg: return JpegMetadataReader.readMetadata(inputStream); case Tiff: case Arw: case Cr2: case Nef: case Orf: case Rw2: return TiffMetadataReader.readMetadata(new RandomAccessStreamReader(inputStream, RandomAccessStreamReader.DEFAULT_CHUNK_LENGTH, streamLength)); case Psd: return PsdMetadataReader.readMetadata(inputStream); case Png: return PngMetadataReader.readMetadata(inputStream); case Bmp: return BmpMetadataReader.readMetadata(inputStream); case Gif: return GifMetadataReader.readMetadata(inputStream); case Ico: return IcoMetadataReader.readMetadata(inputStream); case Pcx: return PcxMetadataReader.readMetadata(inputStream); case WebP: return WebpMetadataReader.readMetadata(inputStream); case Raf: return RafMetadataReader.readMetadata(inputStream); case Avi: return AviMetadataReader.readMetadata(inputStream); case Wav: return WavMetadataReader.readMetadata(inputStream); case Mov: return QuickTimeMetadataReader.readMetadata(inputStream); case Mp4: return Mp4MetadataReader.readMetadata(inputStream); case Mp3: return Mp3MetadataReader.readMetadata(inputStream); case Eps: return EpsMetadataReader.readMetadata(inputStream); case Heif: return HeifMetadataReader.readMetadata(inputStream); case Unknown: throw new ImageProcessingException("File format could not be determined"); default: return new Metadata(); } }
[ "@", "NotNull", "public", "static", "Metadata", "readMetadata", "(", "@", "NotNull", "final", "InputStream", "inputStream", ",", "final", "long", "streamLength", ",", "final", "FileType", "fileType", ")", "throws", "IOException", ",", "ImageProcessingException", "{"...
Reads metadata from an {@link InputStream} of known length and file type. @param inputStream a stream from which the file data may be read. The stream must be positioned at the beginning of the file's data. @param streamLength the length of the stream, if known, otherwise -1. @param fileType the file type of the data stream. @return a populated {@link Metadata} object containing directories of tags with values and any processing errors. @throws ImageProcessingException if the file type is unknown, or for general processing errors.
[ "Reads", "metadata", "from", "an", "{", "@link", "InputStream", "}", "of", "known", "length", "and", "file", "type", "." ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/imaging/ImageMetadataReader.java#L142-L190
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/TextBuilder.java
TextBuilder.parStyledContent
public TextBuilder parStyledContent(final String text, final TextStyle ts) { return this.par().styledSpan(text, ts); }
java
public TextBuilder parStyledContent(final String text, final TextStyle ts) { return this.par().styledSpan(text, ts); }
[ "public", "TextBuilder", "parStyledContent", "(", "final", "String", "text", ",", "final", "TextStyle", "ts", ")", "{", "return", "this", ".", "par", "(", ")", ".", "styledSpan", "(", "text", ",", "ts", ")", ";", "}" ]
Create a new paragraph with a text content @param text the text @param ts the style @return this for fluent style
[ "Create", "a", "new", "paragraph", "with", "a", "text", "content" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TextBuilder.java#L98-L100
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/res/XPATHErrorResources.java
XPATHErrorResources.loadResourceBundle
public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } }
java
public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } }
[ "public", "static", "final", "XPATHErrorResources", "loadResourceBundle", "(", "String", "className", ")", "throws", "MissingResourceException", "{", "Locale", "locale", "=", "Locale", ".", "getDefault", "(", ")", ";", "String", "suffix", "=", "getResourceSuffix", "...
Return a named ResourceBundle for a particular locale. This method mimics the behavior of ResourceBundle.getBundle(). @param className Name of local-specific subclass. @return the ResourceBundle @throws MissingResourceException
[ "Return", "a", "named", "ResourceBundle", "for", "a", "particular", "locale", ".", "This", "method", "mimics", "the", "behavior", "of", "ResourceBundle", ".", "getBundle", "()", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/res/XPATHErrorResources.java#L944-L977
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java
PackageSummaryBuilder.buildAnnotationTypeSummary
public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) { String annotationtypeTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Annotation_Types_Summary"), configuration.getText("doclet.annotationtypes")); List<String> annotationtypeTableHeader = Arrays.asList( configuration.getText("doclet.AnnotationType"), configuration.getText("doclet.Description")); SortedSet<TypeElement> iannotationTypes = utils.isSpecified(packageElement) ? utils.getTypeElementsAsSortedSet(utils.getAnnotationTypes(packageElement)) : configuration.typeElementCatalog.annotationTypes(packageElement); SortedSet<TypeElement> annotationTypes = utils.filterOutPrivateClasses(iannotationTypes, configuration.javafx); if (!annotationTypes.isEmpty()) { packageWriter.addClassesSummary(annotationTypes, configuration.getText("doclet.Annotation_Types_Summary"), annotationtypeTableSummary, annotationtypeTableHeader, summaryContentTree); } }
java
public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) { String annotationtypeTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Annotation_Types_Summary"), configuration.getText("doclet.annotationtypes")); List<String> annotationtypeTableHeader = Arrays.asList( configuration.getText("doclet.AnnotationType"), configuration.getText("doclet.Description")); SortedSet<TypeElement> iannotationTypes = utils.isSpecified(packageElement) ? utils.getTypeElementsAsSortedSet(utils.getAnnotationTypes(packageElement)) : configuration.typeElementCatalog.annotationTypes(packageElement); SortedSet<TypeElement> annotationTypes = utils.filterOutPrivateClasses(iannotationTypes, configuration.javafx); if (!annotationTypes.isEmpty()) { packageWriter.addClassesSummary(annotationTypes, configuration.getText("doclet.Annotation_Types_Summary"), annotationtypeTableSummary, annotationtypeTableHeader, summaryContentTree); } }
[ "public", "void", "buildAnnotationTypeSummary", "(", "XMLNode", "node", ",", "Content", "summaryContentTree", ")", "{", "String", "annotationtypeTableSummary", "=", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getTex...
Build the summary for the annotation type in this package. @param node the XML element that specifies which components to document @param summaryContentTree the summary tree to which the annotation type summary will be added
[ "Build", "the", "summary", "for", "the", "annotation", "type", "in", "this", "package", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java#L305-L325
opentable/otj-jaxrs
client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java
JaxRsClientFactory.addFeatureMap
public synchronized JaxRsClientFactory addFeatureMap(SetMultimap<JaxRsFeatureGroup, Feature> map) { return addFeatureMap(Multimaps.asMap(map)); }
java
public synchronized JaxRsClientFactory addFeatureMap(SetMultimap<JaxRsFeatureGroup, Feature> map) { return addFeatureMap(Multimaps.asMap(map)); }
[ "public", "synchronized", "JaxRsClientFactory", "addFeatureMap", "(", "SetMultimap", "<", "JaxRsFeatureGroup", ",", "Feature", ">", "map", ")", "{", "return", "addFeatureMap", "(", "Multimaps", ".", "asMap", "(", "map", ")", ")", ";", "}" ]
Register many features at once. Mostly a convenience for DI environments.
[ "Register", "many", "features", "at", "once", ".", "Mostly", "a", "convenience", "for", "DI", "environments", "." ]
train
https://github.com/opentable/otj-jaxrs/blob/384e7094fe5a56d41b2a9970bfd783fa85cbbcb8/client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java#L108-L110
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listMultiRoleMetricDefinitionsAsync
public Observable<Page<ResourceMetricDefinitionInner>> listMultiRoleMetricDefinitionsAsync(final String resourceGroupName, final String name) { return listMultiRoleMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() { @Override public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) { return response.body(); } }); }
java
public Observable<Page<ResourceMetricDefinitionInner>> listMultiRoleMetricDefinitionsAsync(final String resourceGroupName, final String name) { return listMultiRoleMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() { @Override public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ResourceMetricDefinitionInner", ">", ">", "listMultiRoleMetricDefinitionsAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listMultiRoleMetricDefinitionsWithServiceResponseAsync...
Get metric definitions for a multi-role pool of an App Service Environment. Get metric definitions for a multi-role pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricDefinitionInner&gt; object
[ "Get", "metric", "definitions", "for", "a", "multi", "-", "role", "pool", "of", "an", "App", "Service", "Environment", ".", "Get", "metric", "definitions", "for", "a", "multi", "-", "role", "pool", "of", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3005-L3013
jmrozanec/cron-utils
src/main/java/com/cronutils/descriptor/CronDescriptor.java
CronDescriptor.describeYear
public String describeYear(final Map<CronFieldName, CronField> fields) { final String description = DescriptionStrategyFactory.plainInstance( resourceBundle, fields.containsKey(CronFieldName.YEAR) ? fields.get(CronFieldName.YEAR).getExpression() : null ).describe(); return addExpressions(description, resourceBundle.getString("year"), resourceBundle.getString("years")); }
java
public String describeYear(final Map<CronFieldName, CronField> fields) { final String description = DescriptionStrategyFactory.plainInstance( resourceBundle, fields.containsKey(CronFieldName.YEAR) ? fields.get(CronFieldName.YEAR).getExpression() : null ).describe(); return addExpressions(description, resourceBundle.getString("year"), resourceBundle.getString("years")); }
[ "public", "String", "describeYear", "(", "final", "Map", "<", "CronFieldName", ",", "CronField", ">", "fields", ")", "{", "final", "String", "description", "=", "DescriptionStrategyFactory", ".", "plainInstance", "(", "resourceBundle", ",", "fields", ".", "contain...
Provide description for a year. @param fields - fields to describe; @return description - String
[ "Provide", "description", "for", "a", "year", "." ]
train
https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/CronDescriptor.java#L151-L158
google/closure-compiler
src/com/google/javascript/jscomp/MinimizeExitPoints.java
MinimizeExitPoints.matchingExitNode
private static boolean matchingExitNode(Node n, Token type, @Nullable String labelName) { if (n.getToken() == type) { if (type == Token.RETURN) { // only returns without expressions. return !n.hasChildren(); } else { if (labelName == null) { return !n.hasChildren(); } else { return n.hasChildren() && labelName.equals(n.getFirstChild().getString()); } } } return false; }
java
private static boolean matchingExitNode(Node n, Token type, @Nullable String labelName) { if (n.getToken() == type) { if (type == Token.RETURN) { // only returns without expressions. return !n.hasChildren(); } else { if (labelName == null) { return !n.hasChildren(); } else { return n.hasChildren() && labelName.equals(n.getFirstChild().getString()); } } } return false; }
[ "private", "static", "boolean", "matchingExitNode", "(", "Node", "n", ",", "Token", "type", ",", "@", "Nullable", "String", "labelName", ")", "{", "if", "(", "n", ".", "getToken", "(", ")", "==", "type", ")", "{", "if", "(", "type", "==", "Token", "....
Determines if n matches the type and name for the following types of "exits": - return without values - continues and breaks with or without names. @param n The node to inspect. @param type The Token type to look for. @param labelName The name that must be associated with the exit type. non-null only for breaks associated with labels. @return Whether the node matches the specified block-exit type.
[ "Determines", "if", "n", "matches", "the", "type", "and", "name", "for", "the", "following", "types", "of", "exits", ":", "-", "return", "without", "values", "-", "continues", "and", "breaks", "with", "or", "without", "names", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MinimizeExitPoints.java#L321-L336
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseShortObj
@Nullable public static Short parseShortObj (@Nullable final String sStr) { return parseShortObj (sStr, DEFAULT_RADIX, null); }
java
@Nullable public static Short parseShortObj (@Nullable final String sStr) { return parseShortObj (sStr, DEFAULT_RADIX, null); }
[ "@", "Nullable", "public", "static", "Short", "parseShortObj", "(", "@", "Nullable", "final", "String", "sStr", ")", "{", "return", "parseShortObj", "(", "sStr", ",", "DEFAULT_RADIX", ",", "null", ")", ";", "}" ]
Parse the given {@link String} as {@link Short} with radix {@value #DEFAULT_RADIX}. @param sStr The string to parse. May be <code>null</code>. @return <code>null</code> if the string does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "String", "}", "as", "{", "@link", "Short", "}", "with", "radix", "{", "@value", "#DEFAULT_RADIX", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1317-L1321
hawkular/hawkular-apm
client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java
OpenTracingManager.sanitizePaths
public String sanitizePaths(String baseUri, String resourcePath) { if (baseUri.endsWith("/") && resourcePath.startsWith("/")) { return baseUri.substring(0, baseUri.length()-1) + resourcePath; } if ((!baseUri.endsWith("/")) && (!resourcePath.startsWith("/"))) { return baseUri + "/" + resourcePath; } return baseUri + resourcePath; }
java
public String sanitizePaths(String baseUri, String resourcePath) { if (baseUri.endsWith("/") && resourcePath.startsWith("/")) { return baseUri.substring(0, baseUri.length()-1) + resourcePath; } if ((!baseUri.endsWith("/")) && (!resourcePath.startsWith("/"))) { return baseUri + "/" + resourcePath; } return baseUri + resourcePath; }
[ "public", "String", "sanitizePaths", "(", "String", "baseUri", ",", "String", "resourcePath", ")", "{", "if", "(", "baseUri", ".", "endsWith", "(", "\"/\"", ")", "&&", "resourcePath", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "return", "baseUri", "."...
Helper to remove duplicate slashes @param baseUri the base URI, usually in the format "/context/restapp/" @param resourcePath the resource path, usually in the format "/resource/method/record" @return The two parameters joined, with the double slash between them removed, like "/context/restapp/resource/method/record"
[ "Helper", "to", "remove", "duplicate", "slashes" ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java#L543-L552
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/crypto/DeterministicHierarchy.java
DeterministicHierarchy.deriveChild
public DeterministicKey deriveChild(List<ChildNumber> parentPath, boolean relative, boolean createParent, ChildNumber createChildNumber) { return deriveChild(get(parentPath, relative, createParent), createChildNumber); }
java
public DeterministicKey deriveChild(List<ChildNumber> parentPath, boolean relative, boolean createParent, ChildNumber createChildNumber) { return deriveChild(get(parentPath, relative, createParent), createChildNumber); }
[ "public", "DeterministicKey", "deriveChild", "(", "List", "<", "ChildNumber", ">", "parentPath", ",", "boolean", "relative", ",", "boolean", "createParent", ",", "ChildNumber", "createChildNumber", ")", "{", "return", "deriveChild", "(", "get", "(", "parentPath", ...
Extends the tree by calculating the requested child for the given path. For example, to get the key at position 1/2/3 you would pass 1/2 as the parent path and 3 as the child number. @param parentPath the path to the parent @param relative whether the path is relative to the root path @param createParent whether the parent corresponding to path should be created (with any necessary ancestors) if it doesn't exist already @return the requested key. @throws IllegalArgumentException if the parent doesn't exist and createParent is false.
[ "Extends", "the", "tree", "by", "calculating", "the", "requested", "child", "for", "the", "given", "path", ".", "For", "example", "to", "get", "the", "key", "at", "position", "1", "/", "2", "/", "3", "you", "would", "pass", "1", "/", "2", "as", "the"...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicHierarchy.java#L146-L148
apache/flink
flink-core/src/main/java/org/apache/flink/util/StringUtils.java
StringUtils.byteToHexString
public static String byteToHexString(final byte[] bytes, final int start, final int end) { if (bytes == null) { throw new IllegalArgumentException("bytes == null"); } int length = end - start; char[] out = new char[length * 2]; for (int i = start, j = 0; i < end; i++) { out[j++] = HEX_CHARS[(0xF0 & bytes[i]) >>> 4]; out[j++] = HEX_CHARS[0x0F & bytes[i]]; } return new String(out); }
java
public static String byteToHexString(final byte[] bytes, final int start, final int end) { if (bytes == null) { throw new IllegalArgumentException("bytes == null"); } int length = end - start; char[] out = new char[length * 2]; for (int i = start, j = 0; i < end; i++) { out[j++] = HEX_CHARS[(0xF0 & bytes[i]) >>> 4]; out[j++] = HEX_CHARS[0x0F & bytes[i]]; } return new String(out); }
[ "public", "static", "String", "byteToHexString", "(", "final", "byte", "[", "]", "bytes", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "if", "(", "bytes", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"...
Given an array of bytes it will convert the bytes to a hex string representation of the bytes. @param bytes the bytes to convert in a hex string @param start start index, inclusively @param end end index, exclusively @return hex string representation of the byte array
[ "Given", "an", "array", "of", "bytes", "it", "will", "convert", "the", "bytes", "to", "a", "hex", "string", "representation", "of", "the", "bytes", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L58-L72
LearnLib/automatalib
util/src/main/java/net/automatalib/util/automata/fsa/DFAs.java
DFAs.acceptsEmptyLanguage
public static <S> boolean acceptsEmptyLanguage(DFA<S, ?> dfa) { return dfa.getStates().stream().noneMatch(dfa::isAccepting); }
java
public static <S> boolean acceptsEmptyLanguage(DFA<S, ?> dfa) { return dfa.getStates().stream().noneMatch(dfa::isAccepting); }
[ "public", "static", "<", "S", ">", "boolean", "acceptsEmptyLanguage", "(", "DFA", "<", "S", ",", "?", ">", "dfa", ")", "{", "return", "dfa", ".", "getStates", "(", ")", ".", "stream", "(", ")", ".", "noneMatch", "(", "dfa", "::", "isAccepting", ")", ...
Computes whether the given {@link DFA} accepts the empty language. Assumes all states in the given {@link DFA} are reachable from the initial state. @param dfa the {@link DFA} to check. @param <S> the state type. @return whether the given {@link DFA} accepts the empty language.
[ "Computes", "whether", "the", "given", "{", "@link", "DFA", "}", "accepts", "the", "empty", "language", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/fsa/DFAs.java#L401-L403
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/Img.java
Img.cut
public Img cut(int x, int y, int radius) { final BufferedImage srcImage = getValidSrcImg(); final int width = srcImage.getWidth(); final int height = srcImage.getHeight(); // 计算直径 final int diameter = radius > 0 ? radius * 2 : Math.min(width, height); final BufferedImage targetImage = new BufferedImage(diameter, diameter, BufferedImage.TYPE_INT_ARGB); final Graphics2D g = targetImage.createGraphics(); g.setClip(new Ellipse2D.Double(0, 0, diameter, diameter)); if (this.positionBaseCentre) { x = x - width / 2 + diameter / 2; y = y - height / 2 + diameter / 2; } g.drawImage(srcImage, x, y, null); g.dispose(); this.targetImage = targetImage; return this; }
java
public Img cut(int x, int y, int radius) { final BufferedImage srcImage = getValidSrcImg(); final int width = srcImage.getWidth(); final int height = srcImage.getHeight(); // 计算直径 final int diameter = radius > 0 ? radius * 2 : Math.min(width, height); final BufferedImage targetImage = new BufferedImage(diameter, diameter, BufferedImage.TYPE_INT_ARGB); final Graphics2D g = targetImage.createGraphics(); g.setClip(new Ellipse2D.Double(0, 0, diameter, diameter)); if (this.positionBaseCentre) { x = x - width / 2 + diameter / 2; y = y - height / 2 + diameter / 2; } g.drawImage(srcImage, x, y, null); g.dispose(); this.targetImage = targetImage; return this; }
[ "public", "Img", "cut", "(", "int", "x", ",", "int", "y", ",", "int", "radius", ")", "{", "final", "BufferedImage", "srcImage", "=", "getValidSrcImg", "(", ")", ";", "final", "int", "width", "=", "srcImage", ".", "getWidth", "(", ")", ";", "final", "...
图像切割为圆形(按指定起点坐标和半径切割) @param x 原图的x坐标起始位置 @param y 原图的y坐标起始位置 @param radius 半径,小于0表示填充满整个图片(直径取长宽最小值) @return this @since 4.1.15
[ "图像切割为圆形", "(", "按指定起点坐标和半径切割", ")" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L316-L335
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java
WSJdbcResultSet.updateBinaryStream
public void updateBinaryStream(String arg0, InputStream arg1, int arg2) throws SQLException { try { rsetImpl.updateBinaryStream(arg0, arg1, arg2); } catch (SQLException ex) { FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateBinaryStream", "3075", this); throw WSJdbcUtil.mapException(this, ex); } catch (NullPointerException nullX) { // No FFDC code needed; we might be closed. throw runtimeXIfNotClosed(nullX); } }
java
public void updateBinaryStream(String arg0, InputStream arg1, int arg2) throws SQLException { try { rsetImpl.updateBinaryStream(arg0, arg1, arg2); } catch (SQLException ex) { FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateBinaryStream", "3075", this); throw WSJdbcUtil.mapException(this, ex); } catch (NullPointerException nullX) { // No FFDC code needed; we might be closed. throw runtimeXIfNotClosed(nullX); } }
[ "public", "void", "updateBinaryStream", "(", "String", "arg0", ",", "InputStream", "arg1", ",", "int", "arg2", ")", "throws", "SQLException", "{", "try", "{", "rsetImpl", ".", "updateBinaryStream", "(", "arg0", ",", "arg1", ",", "arg2", ")", ";", "}", "cat...
Updates a column with a binary stream value. The updateXXX methods are used to update column values in the current row, or the insert row. The updateXXX methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database. @param columnName - the name of the column x - the new column value length - of the stream @throws SQLException if a database access error occurs.
[ "Updates", "a", "column", "with", "a", "binary", "stream", "value", ".", "The", "updateXXX", "methods", "are", "used", "to", "update", "column", "values", "in", "the", "current", "row", "or", "the", "insert", "row", ".", "The", "updateXXX", "methods", "do"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L2824-L2834
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
QuorumJournalManager.journalIdBytesToString
public static String journalIdBytesToString(byte[] jid) { char[] charArray = new char[jid.length]; for (int i = 0; i < jid.length; i++) { charArray[i] = (char) jid[i]; } return new String(charArray, 0, charArray.length); }
java
public static String journalIdBytesToString(byte[] jid) { char[] charArray = new char[jid.length]; for (int i = 0; i < jid.length; i++) { charArray[i] = (char) jid[i]; } return new String(charArray, 0, charArray.length); }
[ "public", "static", "String", "journalIdBytesToString", "(", "byte", "[", "]", "jid", ")", "{", "char", "[", "]", "charArray", "=", "new", "char", "[", "jid", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "jid", ".", "...
Translates byte[] journal id into String. This will be done only the first time we are accessing a journal.
[ "Translates", "byte", "[]", "journal", "id", "into", "String", ".", "This", "will", "be", "done", "only", "the", "first", "time", "we", "are", "accessing", "a", "journal", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L612-L618
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java
SDValidation.validateFloatingPoint
protected static void validateFloatingPoint(String opName, SDVariable v) { if (v == null) return; if (!v.dataType().isFPType()) throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-floating point data type " + v.dataType()); }
java
protected static void validateFloatingPoint(String opName, SDVariable v) { if (v == null) return; if (!v.dataType().isFPType()) throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-floating point data type " + v.dataType()); }
[ "protected", "static", "void", "validateFloatingPoint", "(", "String", "opName", ",", "SDVariable", "v", ")", "{", "if", "(", "v", "==", "null", ")", "return", ";", "if", "(", "!", "v", ".", "dataType", "(", ")", ".", "isFPType", "(", ")", ")", "thro...
Validate that the operation is being applied on an floating point type SDVariable @param opName Operation name to print in the exception @param v Variable to validate datatype for (input to operation)
[ "Validate", "that", "the", "operation", "is", "being", "applied", "on", "an", "floating", "point", "type", "SDVariable" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java#L90-L95
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_output_graylog_dashboard_dashboardId_GET
public OvhDashboard serviceName_output_graylog_dashboard_dashboardId_GET(String serviceName, String dashboardId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/graylog/dashboard/{dashboardId}"; StringBuilder sb = path(qPath, serviceName, dashboardId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDashboard.class); }
java
public OvhDashboard serviceName_output_graylog_dashboard_dashboardId_GET(String serviceName, String dashboardId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/graylog/dashboard/{dashboardId}"; StringBuilder sb = path(qPath, serviceName, dashboardId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDashboard.class); }
[ "public", "OvhDashboard", "serviceName_output_graylog_dashboard_dashboardId_GET", "(", "String", "serviceName", ",", "String", "dashboardId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/output/graylog/dashboard/{dashboardId}\"", ";", "S...
Returns details of specified graylog dashboard REST: GET /dbaas/logs/{serviceName}/output/graylog/dashboard/{dashboardId} @param serviceName [required] Service name @param dashboardId [required] Dashboard ID
[ "Returns", "details", "of", "specified", "graylog", "dashboard" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1149-L1154
aws/aws-sdk-java
aws-java-sdk-mediatailor/src/main/java/com/amazonaws/services/mediatailor/model/GetPlaybackConfigurationResult.java
GetPlaybackConfigurationResult.withTags
public GetPlaybackConfigurationResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public GetPlaybackConfigurationResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "GetPlaybackConfigurationResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags assigned to the playback configuration. </p> @param tags The tags assigned to the playback configuration. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "assigned", "to", "the", "playback", "configuration", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-mediatailor/src/main/java/com/amazonaws/services/mediatailor/model/GetPlaybackConfigurationResult.java#L555-L558
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_account_primaryEmailAddress_archive_POST
public OvhTask organizationName_service_exchangeService_account_primaryEmailAddress_archive_POST(String organizationName, String exchangeService, String primaryEmailAddress, Long quota) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/archive"; StringBuilder sb = path(qPath, organizationName, exchangeService, primaryEmailAddress); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "quota", quota); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask organizationName_service_exchangeService_account_primaryEmailAddress_archive_POST(String organizationName, String exchangeService, String primaryEmailAddress, Long quota) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/archive"; StringBuilder sb = path(qPath, organizationName, exchangeService, primaryEmailAddress); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "quota", quota); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "organizationName_service_exchangeService_account_primaryEmailAddress_archive_POST", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "primaryEmailAddress", ",", "Long", "quota", ")", "throws", "IOException", "{", "String"...
Create new archive mailbox REST: POST /email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/archive @param quota [required] Archive mailbox quota (if not provided mailbox quota will be taken) @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param primaryEmailAddress [required] Default email for this mailbox
[ "Create", "new", "archive", "mailbox" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1577-L1584
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.startDTD
public void startDTD(String name, String publicId, String systemId) throws SAXException { flushStartDoc(); if (null != m_resultLexicalHandler) m_resultLexicalHandler.startDTD(name, publicId, systemId); }
java
public void startDTD(String name, String publicId, String systemId) throws SAXException { flushStartDoc(); if (null != m_resultLexicalHandler) m_resultLexicalHandler.startDTD(name, publicId, systemId); }
[ "public", "void", "startDTD", "(", "String", "name", ",", "String", "publicId", ",", "String", "systemId", ")", "throws", "SAXException", "{", "flushStartDoc", "(", ")", ";", "if", "(", "null", "!=", "m_resultLexicalHandler", ")", "m_resultLexicalHandler", ".", ...
Report the start of DTD declarations, if any. <p>Any declarations are assumed to be in the internal subset unless otherwise indicated by a {@link #startEntity startEntity} event.</p> <p>Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.</p> @param name The document type name. @param publicId The declared public identifier for the external DTD subset, or null if none was declared. @param systemId The declared system identifier for the external DTD subset, or null if none was declared. @throws SAXException The application may raise an exception. @see #endDTD @see #startEntity
[ "Report", "the", "start", "of", "DTD", "declarations", "if", "any", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L1219-L1225
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/detector/Detector.java
Detector.calculateModuleSizeOneWay
private float calculateModuleSizeOneWay(ResultPoint pattern, ResultPoint otherPattern) { float moduleSizeEst1 = sizeOfBlackWhiteBlackRunBothWays((int) pattern.getX(), (int) pattern.getY(), (int) otherPattern.getX(), (int) otherPattern.getY()); float moduleSizeEst2 = sizeOfBlackWhiteBlackRunBothWays((int) otherPattern.getX(), (int) otherPattern.getY(), (int) pattern.getX(), (int) pattern.getY()); if (Float.isNaN(moduleSizeEst1)) { return moduleSizeEst2 / 7.0f; } if (Float.isNaN(moduleSizeEst2)) { return moduleSizeEst1 / 7.0f; } // Average them, and divide by 7 since we've counted the width of 3 black modules, // and 1 white and 1 black module on either side. Ergo, divide sum by 14. return (moduleSizeEst1 + moduleSizeEst2) / 14.0f; }
java
private float calculateModuleSizeOneWay(ResultPoint pattern, ResultPoint otherPattern) { float moduleSizeEst1 = sizeOfBlackWhiteBlackRunBothWays((int) pattern.getX(), (int) pattern.getY(), (int) otherPattern.getX(), (int) otherPattern.getY()); float moduleSizeEst2 = sizeOfBlackWhiteBlackRunBothWays((int) otherPattern.getX(), (int) otherPattern.getY(), (int) pattern.getX(), (int) pattern.getY()); if (Float.isNaN(moduleSizeEst1)) { return moduleSizeEst2 / 7.0f; } if (Float.isNaN(moduleSizeEst2)) { return moduleSizeEst1 / 7.0f; } // Average them, and divide by 7 since we've counted the width of 3 black modules, // and 1 white and 1 black module on either side. Ergo, divide sum by 14. return (moduleSizeEst1 + moduleSizeEst2) / 14.0f; }
[ "private", "float", "calculateModuleSizeOneWay", "(", "ResultPoint", "pattern", ",", "ResultPoint", "otherPattern", ")", "{", "float", "moduleSizeEst1", "=", "sizeOfBlackWhiteBlackRunBothWays", "(", "(", "int", ")", "pattern", ".", "getX", "(", ")", ",", "(", "int...
<p>Estimates module size based on two finder patterns -- it uses {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the width of each, measuring along the axis between their centers.</p>
[ "<p", ">", "Estimates", "module", "size", "based", "on", "two", "finder", "patterns", "--", "it", "uses", "{" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/detector/Detector.java#L241-L259
haifengl/smile
math/src/main/java/smile/math/Math.java
Math.JensenShannonDivergence
public static double JensenShannonDivergence(SparseArray x, double[] y) { if (x.isEmpty()) { throw new IllegalArgumentException("List x is empty."); } Iterator<SparseArray.Entry> iter = x.iterator(); double js = 0.0; while (iter.hasNext()) { SparseArray.Entry b = iter.next(); int i = b.i; double mi = (b.x + y[i]) / 2; js += b.x * Math.log(b.x / mi); if (y[i] > 0) { js += y[i] * Math.log(y[i] / mi); } } return js / 2; }
java
public static double JensenShannonDivergence(SparseArray x, double[] y) { if (x.isEmpty()) { throw new IllegalArgumentException("List x is empty."); } Iterator<SparseArray.Entry> iter = x.iterator(); double js = 0.0; while (iter.hasNext()) { SparseArray.Entry b = iter.next(); int i = b.i; double mi = (b.x + y[i]) / 2; js += b.x * Math.log(b.x / mi); if (y[i] > 0) { js += y[i] * Math.log(y[i] / mi); } } return js / 2; }
[ "public", "static", "double", "JensenShannonDivergence", "(", "SparseArray", "x", ",", "double", "[", "]", "y", ")", "{", "if", "(", "x", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"List x is empty.\"", ")", ";", ...
Jensen-Shannon divergence JS(P||Q) = (KL(P||M) + KL(Q||M)) / 2, where M = (P+Q)/2. The Jensen-Shannon divergence is a popular method of measuring the similarity between two probability distributions. It is also known as information radius or total divergence to the average. It is based on the Kullback-Leibler divergence, with the difference that it is always a finite value. The square root of the Jensen-Shannon divergence is a metric.
[ "Jensen", "-", "Shannon", "divergence", "JS", "(", "P||Q", ")", "=", "(", "KL", "(", "P||M", ")", "+", "KL", "(", "Q||M", "))", "/", "2", "where", "M", "=", "(", "P", "+", "Q", ")", "/", "2", ".", "The", "Jensen", "-", "Shannon", "divergence", ...
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L2473-L2492
JodaOrg/joda-time
src/main/java/org/joda/time/Weeks.java
Weeks.weeksBetween
public static Weeks weeksBetween(ReadablePartial start, ReadablePartial end) { if (start instanceof LocalDate && end instanceof LocalDate) { Chronology chrono = DateTimeUtils.getChronology(start.getChronology()); int weeks = chrono.weeks().getDifference( ((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis()); return Weeks.weeks(weeks); } int amount = BaseSingleFieldPeriod.between(start, end, ZERO); return Weeks.weeks(amount); }
java
public static Weeks weeksBetween(ReadablePartial start, ReadablePartial end) { if (start instanceof LocalDate && end instanceof LocalDate) { Chronology chrono = DateTimeUtils.getChronology(start.getChronology()); int weeks = chrono.weeks().getDifference( ((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis()); return Weeks.weeks(weeks); } int amount = BaseSingleFieldPeriod.between(start, end, ZERO); return Weeks.weeks(amount); }
[ "public", "static", "Weeks", "weeksBetween", "(", "ReadablePartial", "start", ",", "ReadablePartial", "end", ")", "{", "if", "(", "start", "instanceof", "LocalDate", "&&", "end", "instanceof", "LocalDate", ")", "{", "Chronology", "chrono", "=", "DateTimeUtils", ...
Creates a <code>Weeks</code> representing the number of whole weeks between the two specified partial datetimes. <p> The two partials must contain the same fields, for example you can specify two <code>LocalDate</code> objects. @param start the start partial date, must not be null @param end the end partial date, must not be null @return the period in weeks @throws IllegalArgumentException if the partials are null or invalid
[ "Creates", "a", "<code", ">", "Weeks<", "/", "code", ">", "representing", "the", "number", "of", "whole", "weeks", "between", "the", "two", "specified", "partial", "datetimes", ".", "<p", ">", "The", "two", "partials", "must", "contain", "the", "same", "fi...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Weeks.java#L117-L126
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointSendConfiguration.java
EndpointSendConfiguration.withContext
public EndpointSendConfiguration withContext(java.util.Map<String, String> context) { setContext(context); return this; }
java
public EndpointSendConfiguration withContext(java.util.Map<String, String> context) { setContext(context); return this; }
[ "public", "EndpointSendConfiguration", "withContext", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "context", ")", "{", "setContext", "(", "context", ")", ";", "return", "this", ";", "}" ]
A map of custom attributes to attributes to be attached to the message for this address. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @param context A map of custom attributes to attributes to be attached to the message for this address. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "map", "of", "custom", "attributes", "to", "attributes", "to", "be", "attached", "to", "the", "message", "for", "this", "address", ".", "This", "payload", "is", "added", "to", "the", "push", "notification", "s", "data", ".", "pinpoint", "object", "or"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointSendConfiguration.java#L118-L121
google/closure-compiler
src/com/google/javascript/jscomp/StrictModeCheck.java
StrictModeCheck.checkDelete
private static void checkDelete(NodeTraversal t, Node n) { if (n.getFirstChild().isName()) { Var v = t.getScope().getVar(n.getFirstChild().getString()); if (v != null) { t.report(n, DELETE_VARIABLE); } } }
java
private static void checkDelete(NodeTraversal t, Node n) { if (n.getFirstChild().isName()) { Var v = t.getScope().getVar(n.getFirstChild().getString()); if (v != null) { t.report(n, DELETE_VARIABLE); } } }
[ "private", "static", "void", "checkDelete", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "if", "(", "n", ".", "getFirstChild", "(", ")", ".", "isName", "(", ")", ")", "{", "Var", "v", "=", "t", ".", "getScope", "(", ")", ".", "getVar", ...
Checks that variables, functions, and arguments are not deleted.
[ "Checks", "that", "variables", "functions", "and", "arguments", "are", "not", "deleted", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/StrictModeCheck.java#L165-L172
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.getObject
public JSONObject getObject(String objectID, List<String> attributesToRetrieve, RequestOptions requestOptions) throws AlgoliaException { try { String params = encodeAttributes(attributesToRetrieve, true); return client.getRequest("/1/indexes/" + encodedIndexName + "/" + URLEncoder.encode(objectID, "UTF-8") + params.toString(), false, requestOptions); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
java
public JSONObject getObject(String objectID, List<String> attributesToRetrieve, RequestOptions requestOptions) throws AlgoliaException { try { String params = encodeAttributes(attributesToRetrieve, true); return client.getRequest("/1/indexes/" + encodedIndexName + "/" + URLEncoder.encode(objectID, "UTF-8") + params.toString(), false, requestOptions); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
[ "public", "JSONObject", "getObject", "(", "String", "objectID", ",", "List", "<", "String", ">", "attributesToRetrieve", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaException", "{", "try", "{", "String", "params", "=", "encodeAttributes", "(", ...
Get an object from this index @param objectID the unique identifier of the object to retrieve @param attributesToRetrieve contains the list of attributes to retrieve. @param requestOptions Options to pass to this request
[ "Get", "an", "object", "from", "this", "index" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L267-L274
dkmfbk/knowledgestore
ks-core/src/main/java/eu/fbk/knowledgestore/data/XPath.java
XPath.asFunction
public final <T> Function<Object, List<T>> asFunction(final Class<T> resultClass) { Preconditions.checkNotNull(resultClass); return new Function<Object, List<T>>() { @Override public List<T> apply(@Nullable final Object object) { Preconditions.checkNotNull(object); return eval(object, resultClass); } }; }
java
public final <T> Function<Object, List<T>> asFunction(final Class<T> resultClass) { Preconditions.checkNotNull(resultClass); return new Function<Object, List<T>>() { @Override public List<T> apply(@Nullable final Object object) { Preconditions.checkNotNull(object); return eval(object, resultClass); } }; }
[ "public", "final", "<", "T", ">", "Function", "<", "Object", ",", "List", "<", "T", ">", ">", "asFunction", "(", "final", "Class", "<", "T", ">", "resultClass", ")", "{", "Preconditions", ".", "checkNotNull", "(", "resultClass", ")", ";", "return", "ne...
Returns a function view of this {@code XPath} expression that produces a {@code List<T>} result given an input object. If this {@code XPath} is lenient, evaluation of the function will return an empty list on failure, rather than throwing an {@link IllegalArgumentException}. @param resultClass the {@code Class} object for the list elements of the expected function result @param <T> the type of result list element @return the requested function view
[ "Returns", "a", "function", "view", "of", "this", "{", "@code", "XPath", "}", "expression", "that", "produces", "a", "{", "@code", "List<T", ">", "}", "result", "given", "an", "input", "object", ".", "If", "this", "{", "@code", "XPath", "}", "is", "len...
train
https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-core/src/main/java/eu/fbk/knowledgestore/data/XPath.java#L826-L839
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java
ReceiveQueueSession.removeRemoteMessageFilter
public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException { Utility.getLogger().info("EJB removeMessageFilter filter: " + messageFilter); MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager(); BaseMessageReceiver messageReceiver = (BaseMessageReceiver)messageManager.getMessageQueue(messageFilter.getRemoteFilterQueueName(), messageFilter.getRemoteFilterQueueType()).getMessageReceiver(); boolean bRemoved = false; if (messageReceiver != null) bRemoved = messageReceiver.removeMessageFilter(messageFilter.getRemoteFilterID(), bFreeFilter); return bRemoved; }
java
public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException { Utility.getLogger().info("EJB removeMessageFilter filter: " + messageFilter); MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager(); BaseMessageReceiver messageReceiver = (BaseMessageReceiver)messageManager.getMessageQueue(messageFilter.getRemoteFilterQueueName(), messageFilter.getRemoteFilterQueueType()).getMessageReceiver(); boolean bRemoved = false; if (messageReceiver != null) bRemoved = messageReceiver.removeMessageFilter(messageFilter.getRemoteFilterID(), bFreeFilter); return bRemoved; }
[ "public", "boolean", "removeRemoteMessageFilter", "(", "BaseMessageFilter", "messageFilter", ",", "boolean", "bFreeFilter", ")", "throws", "RemoteException", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"EJB removeMessageFilter filter: \"", "+", "mess...
Remove this listener (called from remote). @param messageFilter The message filter.
[ "Remove", "this", "listener", "(", "called", "from", "remote", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java#L184-L193
netty/netty
common/src/main/java/io/netty/util/internal/StringUtil.java
StringUtil.commonSuffixOfLength
public static boolean commonSuffixOfLength(String s, String p, int len) { return s != null && p != null && len >= 0 && s.regionMatches(s.length() - len, p, p.length() - len, len); }
java
public static boolean commonSuffixOfLength(String s, String p, int len) { return s != null && p != null && len >= 0 && s.regionMatches(s.length() - len, p, p.length() - len, len); }
[ "public", "static", "boolean", "commonSuffixOfLength", "(", "String", "s", ",", "String", "p", ",", "int", "len", ")", "{", "return", "s", "!=", "null", "&&", "p", "!=", "null", "&&", "len", ">=", "0", "&&", "s", ".", "regionMatches", "(", "s", ".", ...
Checks if two strings have the same suffix of specified length @param s string @param p string @param len length of the common suffix @return true if both s and p are not null and both have the same suffix. Otherwise - false
[ "Checks", "if", "two", "strings", "have", "the", "same", "suffix", "of", "specified", "length" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L83-L85
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.resumeWithServiceResponseAsync
public Observable<ServiceResponse<Page<SiteInner>>> resumeWithServiceResponseAsync(final String resourceGroupName, final String name) { return resumeSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(resumeNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<SiteInner>>> resumeWithServiceResponseAsync(final String resourceGroupName, final String name) { return resumeSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(resumeNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SiteInner", ">", ">", ">", "resumeWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "resumeSinglePageAsync", "(", "resourceGr...
Resume an App Service Environment. Resume an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SiteInner&gt; object
[ "Resume", "an", "App", "Service", "Environment", ".", "Resume", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3869-L3881
ZieIony/Carbon
carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java
LayerDrawable.setPadding
public void setPadding(int left, int top, int right, int bottom) { final LayerState layerState = mLayerState; layerState.mPaddingLeft = left; layerState.mPaddingTop = top; layerState.mPaddingRight = right; layerState.mPaddingBottom = bottom; // Clear relative padding values. layerState.mPaddingStart = -1; layerState.mPaddingEnd = -1; }
java
public void setPadding(int left, int top, int right, int bottom) { final LayerState layerState = mLayerState; layerState.mPaddingLeft = left; layerState.mPaddingTop = top; layerState.mPaddingRight = right; layerState.mPaddingBottom = bottom; // Clear relative padding values. layerState.mPaddingStart = -1; layerState.mPaddingEnd = -1; }
[ "public", "void", "setPadding", "(", "int", "left", ",", "int", "top", ",", "int", "right", ",", "int", "bottom", ")", "{", "final", "LayerState", "layerState", "=", "mLayerState", ";", "layerState", ".", "mPaddingLeft", "=", "left", ";", "layerState", "."...
Sets the absolute padding. <p/> If padding in a dimension is specified as {@code -1}, the resolved padding will use the value computed according to the padding mode (see {@link #setPaddingMode(int)}). <p/> Calling this method clears any relative padding values previously set using {@link #setPaddingRelative(int, int, int, int)}. @param left the left padding in pixels, or -1 to use computed padding @param top the top padding in pixels, or -1 to use computed padding @param right the right padding in pixels, or -1 to use computed padding @param bottom the bottom padding in pixels, or -1 to use computed padding @attr ref android.R.styleable#LayerDrawable_paddingLeft @attr ref android.R.styleable#LayerDrawable_paddingTop @attr ref android.R.styleable#LayerDrawable_paddingRight @attr ref android.R.styleable#LayerDrawable_paddingBottom @see #setPaddingRelative(int, int, int, int)
[ "Sets", "the", "absolute", "padding", ".", "<p", "/", ">", "If", "padding", "in", "a", "dimension", "is", "specified", "as", "{", "@code", "-", "1", "}", "the", "resolved", "padding", "will", "use", "the", "value", "computed", "according", "to", "the", ...
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java#L940-L950
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java
SVGPlot.cloneDocument
protected SVGDocument cloneDocument() { return (SVGDocument) new CloneInlineImages() { @Override public Node cloneNode(Document doc, Node eold) { // Skip elements with noexport attribute set if(eold instanceof Element) { Element eeold = (Element) eold; String vis = eeold.getAttribute(NO_EXPORT_ATTRIBUTE); if(vis != null && vis.length() > 0) { return null; } } return super.cloneNode(doc, eold); } }.cloneDocument(getDomImpl(), document); }
java
protected SVGDocument cloneDocument() { return (SVGDocument) new CloneInlineImages() { @Override public Node cloneNode(Document doc, Node eold) { // Skip elements with noexport attribute set if(eold instanceof Element) { Element eeold = (Element) eold; String vis = eeold.getAttribute(NO_EXPORT_ATTRIBUTE); if(vis != null && vis.length() > 0) { return null; } } return super.cloneNode(doc, eold); } }.cloneDocument(getDomImpl(), document); }
[ "protected", "SVGDocument", "cloneDocument", "(", ")", "{", "return", "(", "SVGDocument", ")", "new", "CloneInlineImages", "(", ")", "{", "@", "Override", "public", "Node", "cloneNode", "(", "Document", "doc", ",", "Node", "eold", ")", "{", "// Skip elements w...
Clone the SVGPlot document for transcoding. This will usually be necessary for exporting the SVG document if it is currently being displayed: otherwise, we break the Batik rendering trees. (Discovered by Simon). @return cloned document
[ "Clone", "the", "SVGPlot", "document", "for", "transcoding", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L436-L451
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaiveFive.java
StereoDisparityWtoNaiveFive.computeScore
protected double computeScore( int leftX , int rightX , int centerY ) { double center = computeScoreRect(leftX,rightX,centerY); four[0] = computeScoreRect(leftX-radiusX,rightX-radiusX,centerY-radiusY); four[1] = computeScoreRect(leftX+radiusX,rightX+radiusX,centerY-radiusY); four[2] = computeScoreRect(leftX-radiusX,rightX-radiusX,centerY+radiusY); four[3] = computeScoreRect(leftX+radiusX,rightX+radiusX,centerY+radiusY); Arrays.sort(four); return four[0] + four[1] + center; }
java
protected double computeScore( int leftX , int rightX , int centerY ) { double center = computeScoreRect(leftX,rightX,centerY); four[0] = computeScoreRect(leftX-radiusX,rightX-radiusX,centerY-radiusY); four[1] = computeScoreRect(leftX+radiusX,rightX+radiusX,centerY-radiusY); four[2] = computeScoreRect(leftX-radiusX,rightX-radiusX,centerY+radiusY); four[3] = computeScoreRect(leftX+radiusX,rightX+radiusX,centerY+radiusY); Arrays.sort(four); return four[0] + four[1] + center; }
[ "protected", "double", "computeScore", "(", "int", "leftX", ",", "int", "rightX", ",", "int", "centerY", ")", "{", "double", "center", "=", "computeScoreRect", "(", "leftX", ",", "rightX", ",", "centerY", ")", ";", "four", "[", "0", "]", "=", "computeSco...
Compute the score for five local regions and just use the center + the two best @param leftX X-axis center left image @param rightX X-axis center left image @param centerY Y-axis center for both images @return Fit score for both regions.
[ "Compute", "the", "score", "for", "five", "local", "regions", "and", "just", "use", "the", "center", "+", "the", "two", "best" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaiveFive.java#L139-L150
sothawo/mapjfx
src/main/java/com/sothawo/mapjfx/MapView.java
JavaConnector.extentChanged
public void extentChanged(double latMin, double lonMin, double latMax, double lonMax) { final Extent extent = Extent.forCoordinates(new Coordinate(latMin, lonMin), new Coordinate(latMax, lonMax)); if (logger.isTraceEnabled()) { logger.trace("JS reports extend change: {}", extent); } fireEvent(new MapViewEvent(MapViewEvent.MAP_BOUNDING_EXTENT, extent)); }
java
public void extentChanged(double latMin, double lonMin, double latMax, double lonMax) { final Extent extent = Extent.forCoordinates(new Coordinate(latMin, lonMin), new Coordinate(latMax, lonMax)); if (logger.isTraceEnabled()) { logger.trace("JS reports extend change: {}", extent); } fireEvent(new MapViewEvent(MapViewEvent.MAP_BOUNDING_EXTENT, extent)); }
[ "public", "void", "extentChanged", "(", "double", "latMin", ",", "double", "lonMin", ",", "double", "latMax", ",", "double", "lonMax", ")", "{", "final", "Extent", "extent", "=", "Extent", ".", "forCoordinates", "(", "new", "Coordinate", "(", "latMin", ",", ...
called when the map extent changed by changing the center or zoom of the map. @param latMin latitude of upper left corner @param lonMin longitude of upper left corner @param latMax latitude of lower right corner @param lonMax longitude of lower right corner
[ "called", "when", "the", "map", "extent", "changed", "by", "changing", "the", "center", "or", "zoom", "of", "the", "map", "." ]
train
https://github.com/sothawo/mapjfx/blob/202091de492ab7a8b000c77efd833029f7f0ef92/src/main/java/com/sothawo/mapjfx/MapView.java#L1673-L1679
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/BaseDataJsonFieldBo.java
BaseDataJsonFieldBo.getDataAttr
public <T> T getDataAttr(String dPath, Class<T> clazz) { Lock lock = lockForRead(); try { return DPathUtils.getValue(dataJson, dPath, clazz); } finally { lock.unlock(); } }
java
public <T> T getDataAttr(String dPath, Class<T> clazz) { Lock lock = lockForRead(); try { return DPathUtils.getValue(dataJson, dPath, clazz); } finally { lock.unlock(); } }
[ "public", "<", "T", ">", "T", "getDataAttr", "(", "String", "dPath", ",", "Class", "<", "T", ">", "clazz", ")", "{", "Lock", "lock", "=", "lockForRead", "(", ")", ";", "try", "{", "return", "DPathUtils", ".", "getValue", "(", "dataJson", ",", "dPath"...
Get a "data"'s sub-attribute using d-path. @param dPath @param clazz @return @see DPathUtils
[ "Get", "a", "data", "s", "sub", "-", "attribute", "using", "d", "-", "path", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseDataJsonFieldBo.java#L142-L149
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.createEventHubConsumerGroup
public EventHubConsumerGroupInfoInner createEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); }
java
public EventHubConsumerGroupInfoInner createEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); }
[ "public", "EventHubConsumerGroupInfoInner", "createEventHubConsumerGroup", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "eventHubEndpointName", ",", "String", "name", ")", "{", "return", "createEventHubConsumerGroupWithServiceResponseAsync", ...
Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. @param name The name of the consumer group to add. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EventHubConsumerGroupInfoInner object if successful.
[ "Add", "a", "consumer", "group", "to", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", ".", "Add", "a", "consumer", "group", "to", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L1874-L1876
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpViewBase.java
HelpViewBase.createView
public static HelpViewBase createView(HelpViewer viewer, HelpViewType viewType) { Class<? extends HelpViewBase> viewClass = viewType == null ? null : getViewClass(viewType); if (viewClass == null) { return null; } try { return viewClass.getConstructor(HelpViewer.class, HelpViewType.class).newInstance(viewer, viewType); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
java
public static HelpViewBase createView(HelpViewer viewer, HelpViewType viewType) { Class<? extends HelpViewBase> viewClass = viewType == null ? null : getViewClass(viewType); if (viewClass == null) { return null; } try { return viewClass.getConstructor(HelpViewer.class, HelpViewType.class).newInstance(viewer, viewType); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
[ "public", "static", "HelpViewBase", "createView", "(", "HelpViewer", "viewer", ",", "HelpViewType", "viewType", ")", "{", "Class", "<", "?", "extends", "HelpViewBase", ">", "viewClass", "=", "viewType", "==", "null", "?", "null", ":", "getViewClass", "(", "vie...
Creates a new tab for the specified view type. @param viewer The help viewer instance. @param viewType The view type supported by the created tab. @return The help tab that supports the specified view type.
[ "Creates", "a", "new", "tab", "for", "the", "specified", "view", "type", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpViewBase.java#L59-L71
apereo/cas
support/cas-server-support-aup-jdbc/src/main/java/org/apereo/cas/aup/JdbcAcceptableUsagePolicyRepository.java
JdbcAcceptableUsagePolicyRepository.determinePrincipalId
protected String determinePrincipalId(final RequestContext requestContext, final Credential credential) { if (StringUtils.isBlank(properties.getJdbc().getPrincipalIdAttribute())) { return credential.getId(); } val principal = WebUtils.getAuthentication(requestContext).getPrincipal(); val pIdAttribName = properties.getJdbc().getPrincipalIdAttribute(); if (!principal.getAttributes().containsKey(pIdAttribName)) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] cannot be found"); } val pIdAttributeValue = principal.getAttributes().get(pIdAttribName); val pIdAttributeValues = CollectionUtils.toCollection(pIdAttributeValue); var principalId = StringUtils.EMPTY; if (!pIdAttributeValues.isEmpty()) { principalId = pIdAttributeValues.iterator().next().toString().trim(); } if (pIdAttributeValues.size() > 1) { LOGGER.warn("Principal attribute [{}] was found, but its value [{}] is multi-valued. " + "Proceeding with the first element [{}]", pIdAttribName, pIdAttributeValue, principalId); } if (principalId.isEmpty()) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] was found, but it is either empty" + " or multi-valued with an empty element"); } return principalId; }
java
protected String determinePrincipalId(final RequestContext requestContext, final Credential credential) { if (StringUtils.isBlank(properties.getJdbc().getPrincipalIdAttribute())) { return credential.getId(); } val principal = WebUtils.getAuthentication(requestContext).getPrincipal(); val pIdAttribName = properties.getJdbc().getPrincipalIdAttribute(); if (!principal.getAttributes().containsKey(pIdAttribName)) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] cannot be found"); } val pIdAttributeValue = principal.getAttributes().get(pIdAttribName); val pIdAttributeValues = CollectionUtils.toCollection(pIdAttributeValue); var principalId = StringUtils.EMPTY; if (!pIdAttributeValues.isEmpty()) { principalId = pIdAttributeValues.iterator().next().toString().trim(); } if (pIdAttributeValues.size() > 1) { LOGGER.warn("Principal attribute [{}] was found, but its value [{}] is multi-valued. " + "Proceeding with the first element [{}]", pIdAttribName, pIdAttributeValue, principalId); } if (principalId.isEmpty()) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] was found, but it is either empty" + " or multi-valued with an empty element"); } return principalId; }
[ "protected", "String", "determinePrincipalId", "(", "final", "RequestContext", "requestContext", ",", "final", "Credential", "credential", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "properties", ".", "getJdbc", "(", ")", ".", "getPrincipalIdAttribute"...
Extracts principal ID from a principal attribute or the provided credentials. @param requestContext the context @param credential the credential @return the principal ID to update the AUP setting in the database for
[ "Extracts", "principal", "ID", "from", "a", "principal", "attribute", "or", "the", "provided", "credentials", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-aup-jdbc/src/main/java/org/apereo/cas/aup/JdbcAcceptableUsagePolicyRepository.java#L68-L92
deeplearning4j/deeplearning4j
nd4j/nd4j-serde/nd4j-gson/src/main/java/org/nd4j/serde/gson/GsonDeserializationUtils.java
GsonDeserializationUtils.getSizeMultiDimensionalArray
private static void getSizeMultiDimensionalArray(JsonArray jsonArray, List<Integer> dimensions) { Iterator<JsonElement> iterator = jsonArray.iterator(); if (iterator.hasNext()) { JsonElement jsonElement = iterator.next(); if (jsonElement.isJsonArray()) { JsonArray shapeArray = jsonElement.getAsJsonArray(); dimensions.add(shapeArray.size()); getSizeMultiDimensionalArray(shapeArray, dimensions); } } }
java
private static void getSizeMultiDimensionalArray(JsonArray jsonArray, List<Integer> dimensions) { Iterator<JsonElement> iterator = jsonArray.iterator(); if (iterator.hasNext()) { JsonElement jsonElement = iterator.next(); if (jsonElement.isJsonArray()) { JsonArray shapeArray = jsonElement.getAsJsonArray(); dimensions.add(shapeArray.size()); getSizeMultiDimensionalArray(shapeArray, dimensions); } } }
[ "private", "static", "void", "getSizeMultiDimensionalArray", "(", "JsonArray", "jsonArray", ",", "List", "<", "Integer", ">", "dimensions", ")", "{", "Iterator", "<", "JsonElement", ">", "iterator", "=", "jsonArray", ".", "iterator", "(", ")", ";", "if", "(", ...
/* The below method works under the following assumption which is an INDArray can not have a row such as [ 1 , 2, [3, 4] ] and either all elements of an INDArray are either INDArrays themselves or scalars. So if that is the case, then it suffices to only check the first element of each JsonArray to see if that first element is itself an JsonArray. If it is an array, then we must check the first element of that array to see if it's a scalar or array.
[ "/", "*", "The", "below", "method", "works", "under", "the", "following", "assumption", "which", "is", "an", "INDArray", "can", "not", "have", "a", "row", "such", "as", "[", "1", "2", "[", "3", "4", "]", "]", "and", "either", "all", "elements", "of",...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-gson/src/main/java/org/nd4j/serde/gson/GsonDeserializationUtils.java#L75-L86