repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/shared/MultiTable.java
MultiTable.getInfoFromHandle
public Object getInfoFromHandle(Object bookmark, boolean bGetTable, int iHandleType) throws DBException { if (iHandleType == DBConstants.OBJECT_ID_HANDLE) { if (!(bookmark instanceof String)) return null; int iLastColon = ((String)bookmark).lastIndexOf(BaseTable.HANDLE_SEPARATOR); if (iLastColon == -1) return null; if (bGetTable) return ((String)bookmark).substring(0, iLastColon); else return ((String)bookmark).substring(iLastColon+1); } return bookmark; }
java
public Object getInfoFromHandle(Object bookmark, boolean bGetTable, int iHandleType) throws DBException { if (iHandleType == DBConstants.OBJECT_ID_HANDLE) { if (!(bookmark instanceof String)) return null; int iLastColon = ((String)bookmark).lastIndexOf(BaseTable.HANDLE_SEPARATOR); if (iLastColon == -1) return null; if (bGetTable) return ((String)bookmark).substring(0, iLastColon); else return ((String)bookmark).substring(iLastColon+1); } return bookmark; }
[ "public", "Object", "getInfoFromHandle", "(", "Object", "bookmark", ",", "boolean", "bGetTable", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "if", "(", "iHandleType", "==", "DBConstants", ".", "OBJECT_ID_HANDLE", ")", "{", "if", "(", "!", "("...
Get the table or object ID portion of the bookmark. @exception DBException File exception.
[ "Get", "the", "table", "or", "object", "ID", "portion", "of", "the", "bookmark", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/shared/MultiTable.java#L190-L205
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java
ConditionalCheck.notEmpty
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T extends Collection<?>> void notEmpty(final boolean condition, @Nonnull final T collection) { if (condition) { Check.notEmpty(collection); } }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T extends Collection<?>> void notEmpty(final boolean condition, @Nonnull final T collection) { if (condition) { Check.notEmpty(collection); } }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalEmptyArgumentException", ".", "class", "}", ")", "public", "static", "<", "T", "extends", "Collection", "<", "?", ">", ">", "void", "notEmpty", "(", "f...
Ensures that a passed collection as a parameter of the calling method is not empty. <p> We recommend to use the overloaded method {@link Check#notEmpty(Collection, String)} and pass as second argument the name of the parameter to enhance the exception message. @param condition condition must be {@code true}^ so that the check will be performed @param collection a collection which should not be empty @throws IllegalNullArgumentException if the given argument {@code collection} is {@code null} @throws IllegalEmptyArgumentException if the given argument {@code collection} is empty
[ "Ensures", "that", "a", "passed", "collection", "as", "a", "parameter", "of", "the", "calling", "method", "is", "not", "empty", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L1233-L1239
aol/cyclops
cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java
StreamSource.ofMultiple
public static <T> MultipleStreamSource<T> ofMultiple(final QueueFactory<?> q) { Objects.requireNonNull(q); return new MultipleStreamSource<T>( StreamSource.of(q) .createQueue()); }
java
public static <T> MultipleStreamSource<T> ofMultiple(final QueueFactory<?> q) { Objects.requireNonNull(q); return new MultipleStreamSource<T>( StreamSource.of(q) .createQueue()); }
[ "public", "static", "<", "T", ">", "MultipleStreamSource", "<", "T", ">", "ofMultiple", "(", "final", "QueueFactory", "<", "?", ">", "q", ")", "{", "Objects", ".", "requireNonNull", "(", "q", ")", ";", "return", "new", "MultipleStreamSource", "<", "T", "...
Construct a StreamSource that supports multiple readers of the same data backed by a Queue created from the supplied QueueFactory @see QueueFactories for Factory creation options and various backpressure strategies <pre> {@code MultipleStreamSource<Integer> multi = StreamSource .ofMultiple(QueueFactories.boundedQueue(100)); FutureStream<Integer> pushable = multi.futureStream(new LazyReact()); ReactiveSeq<Integer> seq = multi.reactiveSeq(); multi.getInput().offer(100); multi.getInput().close(); pushable.collect(CyclopsCollectors.toList()); //[100] seq.collect(CyclopsCollectors.toList()); //[100] } </pre> @param q QueueFactory used to create the Adapter to back the pushable StreamSource @return a builder that will use Topics to allow multiple Streams from the same data
[ "Construct", "a", "StreamSource", "that", "supports", "multiple", "readers", "of", "the", "same", "data", "backed", "by", "a", "Queue", "created", "from", "the", "supplied", "QueueFactory" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java#L281-L286
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.clickOnAndSwitchWindow
@Conditioned @Quand("Je clique sur '(.*)-(.*)' et passe sur '(.*)' de type fenêtre[\\.|\\?]") @When("I click on '(.*)-(.*)' and switch to '(.*)' window[\\.|\\?]") public void clickOnAndSwitchWindow(String page, String toClick, String windowKey, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { final String wKey = Page.getInstance(page).getApplication() + Page.getInstance(windowKey).getPageKey(); final String handleToSwitch = Context.getWindows().get(wKey); if (handleToSwitch != null) { Context.getDriver().switchTo().window(handleToSwitch); // As a workaround: NoraUi specify window size manually, e.g. window_size: 1920 x 1080 (instead of .window().maximize()). Context.getDriver().manage().window().setSize(new Dimension(1920, 1080)); Context.setMainWindow(windowKey); } else { try { final Set<String> initialWindows = getDriver().getWindowHandles(); clickOn(Page.getInstance(page).getPageElementByKey('-' + toClick)); final String newWindowHandle = Context.waitUntil(WindowManager.newWindowOpens(initialWindows)); Context.addWindow(wKey, newWindowHandle); getDriver().switchTo().window(newWindowHandle); // As a workaround: NoraUi specify window size manually, e.g. window_size: 1920 x 1080 (instead of .window().maximize()). Context.getDriver().manage().window().setSize(new Dimension(1920, 1080)); Context.setMainWindow(newWindowHandle); } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_SWITCH_WINDOW), windowKey), true, Page.getInstance(page).getCallBack()); } if (!Page.getInstance(windowKey).checkPage()) { new Result.Failure<>(windowKey, Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_SWITCH_WINDOW), windowKey), true, Page.getInstance(page).getCallBack()); } } }
java
@Conditioned @Quand("Je clique sur '(.*)-(.*)' et passe sur '(.*)' de type fenêtre[\\.|\\?]") @When("I click on '(.*)-(.*)' and switch to '(.*)' window[\\.|\\?]") public void clickOnAndSwitchWindow(String page, String toClick, String windowKey, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { final String wKey = Page.getInstance(page).getApplication() + Page.getInstance(windowKey).getPageKey(); final String handleToSwitch = Context.getWindows().get(wKey); if (handleToSwitch != null) { Context.getDriver().switchTo().window(handleToSwitch); // As a workaround: NoraUi specify window size manually, e.g. window_size: 1920 x 1080 (instead of .window().maximize()). Context.getDriver().manage().window().setSize(new Dimension(1920, 1080)); Context.setMainWindow(windowKey); } else { try { final Set<String> initialWindows = getDriver().getWindowHandles(); clickOn(Page.getInstance(page).getPageElementByKey('-' + toClick)); final String newWindowHandle = Context.waitUntil(WindowManager.newWindowOpens(initialWindows)); Context.addWindow(wKey, newWindowHandle); getDriver().switchTo().window(newWindowHandle); // As a workaround: NoraUi specify window size manually, e.g. window_size: 1920 x 1080 (instead of .window().maximize()). Context.getDriver().manage().window().setSize(new Dimension(1920, 1080)); Context.setMainWindow(newWindowHandle); } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_SWITCH_WINDOW), windowKey), true, Page.getInstance(page).getCallBack()); } if (!Page.getInstance(windowKey).checkPage()) { new Result.Failure<>(windowKey, Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_SWITCH_WINDOW), windowKey), true, Page.getInstance(page).getCallBack()); } } }
[ "@", "Conditioned", "@", "Quand", "(", "\"Je clique sur '(.*)-(.*)' et passe sur '(.*)' de type fenêtre[\\\\.|\\\\?]\")", "\r", "@", "When", "(", "\"I click on '(.*)-(.*)' and switch to '(.*)' window[\\\\.|\\\\?]\"", ")", "public", "void", "clickOnAndSwitchWindow", "(", "String", "...
Click on html element and switch window when the scenario contain more one windows (one more application for example), if all 'expected' parameters equals 'actual' parameters in conditions. @param page The concerned page of toClick @param toClick html element @param windowKey the key of window (popup, ...) Example: 'demo.Popup1DemoPage'. @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws FailureException if the scenario encounters a functional error @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
[ "Click", "on", "html", "element", "and", "switch", "window", "when", "the", "scenario", "contain", "more", "one", "windows", "(", "one", "more", "application", "for", "example", ")", "if", "all", "expected", "parameters", "equals", "actual", "parameters", "in"...
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L454-L483
finmath/finmath-lib
src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java
ForwardCurveInterpolation.createForwardCurveFromForwards
public static ForwardCurveInterpolation createForwardCurveFromForwards(String name, double[] times, double[] givenForwards, AnalyticModel model, String discountCurveName, double paymentOffset) { RandomVariable[] givenForwardsAsRandomVariables = DoubleStream.of(givenForwards).mapToObj(new DoubleFunction<RandomVariableFromDoubleArray>() { @Override public RandomVariableFromDoubleArray apply(double x) { return new RandomVariableFromDoubleArray(x); } }).toArray(RandomVariable[]::new); return createForwardCurveFromForwards(name, times, givenForwardsAsRandomVariables, model, discountCurveName, paymentOffset); }
java
public static ForwardCurveInterpolation createForwardCurveFromForwards(String name, double[] times, double[] givenForwards, AnalyticModel model, String discountCurveName, double paymentOffset) { RandomVariable[] givenForwardsAsRandomVariables = DoubleStream.of(givenForwards).mapToObj(new DoubleFunction<RandomVariableFromDoubleArray>() { @Override public RandomVariableFromDoubleArray apply(double x) { return new RandomVariableFromDoubleArray(x); } }).toArray(RandomVariable[]::new); return createForwardCurveFromForwards(name, times, givenForwardsAsRandomVariables, model, discountCurveName, paymentOffset); }
[ "public", "static", "ForwardCurveInterpolation", "createForwardCurveFromForwards", "(", "String", "name", ",", "double", "[", "]", "times", ",", "double", "[", "]", "givenForwards", ",", "AnalyticModel", "model", ",", "String", "discountCurveName", ",", "double", "p...
Create a forward curve from given times and given forwards with respect to an associated discount curve and payment offset. @param name The name of this curve. @param times A vector of given time points. @param givenForwards A vector of given forwards (corresponding to the given time points). @param model An analytic model providing a context. The discount curve (if needed) is obtained from this model. @param discountCurveName Name of the discount curve associated with this index (associated with it's funding or collateralization). @param paymentOffset Time between fixing and payment. @return A new ForwardCurve object.
[ "Create", "a", "forward", "curve", "from", "given", "times", "and", "given", "forwards", "with", "respect", "to", "an", "associated", "discount", "curve", "and", "payment", "offset", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java#L317-L323
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java
MyStringUtils.replaceHtmlEntities
public static String replaceHtmlEntities(String content, Map<String, Character> map) { for (Entry<String, Character> entry : escapeStrings.entrySet()) { if (content.indexOf(entry.getKey()) != -1) { content = content.replace(entry.getKey(), String.valueOf(entry.getValue())); } } return content; }
java
public static String replaceHtmlEntities(String content, Map<String, Character> map) { for (Entry<String, Character> entry : escapeStrings.entrySet()) { if (content.indexOf(entry.getKey()) != -1) { content = content.replace(entry.getKey(), String.valueOf(entry.getValue())); } } return content; }
[ "public", "static", "String", "replaceHtmlEntities", "(", "String", "content", ",", "Map", "<", "String", ",", "Character", ">", "map", ")", "{", "for", "(", "Entry", "<", "String", ",", "Character", ">", "entry", ":", "escapeStrings", ".", "entrySet", "("...
Replace HTML entities @param content Content @param map Map @return Replaced content
[ "Replace", "HTML", "entities" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L2096-L2107
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/Validate.java
Validate.inclusiveBetween
public static long inclusiveBetween(long start, long end, long value, String message) { return INSTANCE.inclusiveBetween(start, end, value, message); }
java
public static long inclusiveBetween(long start, long end, long value, String message) { return INSTANCE.inclusiveBetween(start, end, value, message); }
[ "public", "static", "long", "inclusiveBetween", "(", "long", "start", ",", "long", "end", ",", "long", "value", ",", "String", "message", ")", "{", "return", "INSTANCE", ".", "inclusiveBetween", "(", "start", ",", "end", ",", "value", ",", "message", ")", ...
Validate that the specified primitive value falls between the two inclusive values specified; otherwise, throws an exception with the specified message. <pre>Validate.inclusiveBetween(0, 2, 1, "Not in range");</pre> @param start the inclusive start value @param end the inclusive end value @param value the value to validate @param message the exception message if invalid, not null @return the value @throws IllegalArgumentValidationException if the value falls outside the boundaries
[ "Validate", "that", "the", "specified", "primitive", "value", "falls", "between", "the", "two", "inclusive", "values", "specified", ";", "otherwise", "throws", "an", "exception", "with", "the", "specified", "message", ".", "<pre", ">", "Validate", ".", "inclusiv...
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L1501-L1503
redkale/redkale
src/org/redkale/util/ByteArray.java
ByteArray.toDecodeString
public String toDecodeString(final int offset, int len, final Charset charset) { int start = offset; final int end = offset + len; boolean flag = false; //是否需要转义 byte[] bs = content; for (int i = offset; i < end; i++) { if (content[i] == '+' || content[i] == '%') { flag = true; break; } } if (flag) { int index = 0; bs = new byte[len]; for (int i = offset; i < end; i++) { switch (content[i]) { case '+': bs[index] = ' '; break; case '%': bs[index] = (byte) ((hexBit(content[++i]) * 16 + hexBit(content[++i]))); break; default: bs[index] = content[i]; break; } index++; } start = 0; len = index; } if (charset == null) return new String(Utility.decodeUTF8(bs, start, len)); return new String(bs, start, len, charset); }
java
public String toDecodeString(final int offset, int len, final Charset charset) { int start = offset; final int end = offset + len; boolean flag = false; //是否需要转义 byte[] bs = content; for (int i = offset; i < end; i++) { if (content[i] == '+' || content[i] == '%') { flag = true; break; } } if (flag) { int index = 0; bs = new byte[len]; for (int i = offset; i < end; i++) { switch (content[i]) { case '+': bs[index] = ' '; break; case '%': bs[index] = (byte) ((hexBit(content[++i]) * 16 + hexBit(content[++i]))); break; default: bs[index] = content[i]; break; } index++; } start = 0; len = index; } if (charset == null) return new String(Utility.decodeUTF8(bs, start, len)); return new String(bs, start, len, charset); }
[ "public", "String", "toDecodeString", "(", "final", "int", "offset", ",", "int", "len", ",", "final", "Charset", "charset", ")", "{", "int", "start", "=", "offset", ";", "final", "int", "end", "=", "offset", "+", "len", ";", "boolean", "flag", "=", "fa...
将指定的起始位置和长度按指定字符集并转义后转成字符串 @param offset 起始位置 @param len 长度 @param charset 字符集 @return 字符串
[ "将指定的起始位置和长度按指定字符集并转义后转成字符串" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/ByteArray.java#L339-L372
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java
RingBuffer.publishEvents
public <A, B, C> void publishEvents(EventTranslatorThreeArg<E, A, B, C> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1, C[] arg2) { checkBounds(arg0, arg1, arg2, batchStartsAt, batchSize); final long finalSequence = sequencer.next(batchSize); translateAndPublishBatch(translator, arg0, arg1, arg2, batchStartsAt, batchSize, finalSequence); }
java
public <A, B, C> void publishEvents(EventTranslatorThreeArg<E, A, B, C> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1, C[] arg2) { checkBounds(arg0, arg1, arg2, batchStartsAt, batchSize); final long finalSequence = sequencer.next(batchSize); translateAndPublishBatch(translator, arg0, arg1, arg2, batchStartsAt, batchSize, finalSequence); }
[ "public", "<", "A", ",", "B", ",", "C", ">", "void", "publishEvents", "(", "EventTranslatorThreeArg", "<", "E", ",", "A", ",", "B", ",", "C", ">", "translator", ",", "int", "batchStartsAt", ",", "int", "batchSize", ",", "A", "[", "]", "arg0", ",", ...
Allows three user supplied arguments per event. @param translator The user specified translation for the event @param batchStartsAt The first element of the array which is within the batch. @param batchSize The number of elements in the batch. @param arg0 An array of user supplied arguments, one element per event. @param arg1 An array of user supplied arguments, one element per event. @param arg2 An array of user supplied arguments, one element per event. @see #publishEvents(EventTranslator[])
[ "Allows", "three", "user", "supplied", "arguments", "per", "event", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java#L710-L714
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/GaussianAffinityMatrixBuilder.java
GaussianAffinityMatrixBuilder.buildDistanceMatrix
protected double[][] buildDistanceMatrix(ArrayDBIDs ids, DistanceQuery<?> dq) { final int size = ids.size(); double[][] dmat = new double[size][size]; final boolean square = !dq.getDistanceFunction().isSquared(); FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Computing distance matrix", (size * (size - 1)) >>> 1, LOG) : null; Duration timer = LOG.isStatistics() ? LOG.newDuration(this.getClass().getName() + ".runtime.distancematrix").begin() : null; DBIDArrayIter ix = ids.iter(), iy = ids.iter(); for(ix.seek(0); ix.valid(); ix.advance()) { double[] dmat_x = dmat[ix.getOffset()]; for(iy.seek(ix.getOffset() + 1); iy.valid(); iy.advance()) { final double dist = dq.distance(ix, iy); dmat[iy.getOffset()][ix.getOffset()] = dmat_x[iy.getOffset()] = square ? (dist * dist) : dist; } if(prog != null) { int row = ix.getOffset() + 1; prog.setProcessed(row * size - ((row * (row + 1)) >>> 1), LOG); } } LOG.ensureCompleted(prog); if(timer != null) { LOG.statistics(timer.end()); } return dmat; }
java
protected double[][] buildDistanceMatrix(ArrayDBIDs ids, DistanceQuery<?> dq) { final int size = ids.size(); double[][] dmat = new double[size][size]; final boolean square = !dq.getDistanceFunction().isSquared(); FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Computing distance matrix", (size * (size - 1)) >>> 1, LOG) : null; Duration timer = LOG.isStatistics() ? LOG.newDuration(this.getClass().getName() + ".runtime.distancematrix").begin() : null; DBIDArrayIter ix = ids.iter(), iy = ids.iter(); for(ix.seek(0); ix.valid(); ix.advance()) { double[] dmat_x = dmat[ix.getOffset()]; for(iy.seek(ix.getOffset() + 1); iy.valid(); iy.advance()) { final double dist = dq.distance(ix, iy); dmat[iy.getOffset()][ix.getOffset()] = dmat_x[iy.getOffset()] = square ? (dist * dist) : dist; } if(prog != null) { int row = ix.getOffset() + 1; prog.setProcessed(row * size - ((row * (row + 1)) >>> 1), LOG); } } LOG.ensureCompleted(prog); if(timer != null) { LOG.statistics(timer.end()); } return dmat; }
[ "protected", "double", "[", "]", "[", "]", "buildDistanceMatrix", "(", "ArrayDBIDs", "ids", ",", "DistanceQuery", "<", "?", ">", "dq", ")", "{", "final", "int", "size", "=", "ids", ".", "size", "(", ")", ";", "double", "[", "]", "[", "]", "dmat", "...
Build a distance matrix of squared distances. @param ids DBIDs @param dq Distance query @return Distance matrix
[ "Build", "a", "distance", "matrix", "of", "squared", "distances", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/GaussianAffinityMatrixBuilder.java#L116-L139
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java
Node.getAffiliations
public List<Affiliation> getAffiliations(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getAffiliations(AffiliationNamespace.basic, additionalExtensions, returnedExtensions); }
java
public List<Affiliation> getAffiliations(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getAffiliations(AffiliationNamespace.basic, additionalExtensions, returnedExtensions); }
[ "public", "List", "<", "Affiliation", ">", "getAffiliations", "(", "List", "<", "ExtensionElement", ">", "additionalExtensions", ",", "Collection", "<", "ExtensionElement", ">", "returnedExtensions", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", ...
Get the affiliations of this node. <p> {@code additionalExtensions} can be used e.g. to add a "Result Set Management" extension. {@code returnedExtensions} will be filled with the stanza extensions found in the answer. </p> @param additionalExtensions additional {@code PacketExtensions} add to the request @param returnedExtensions a collection that will be filled with the returned packet extensions @return List of {@link Affiliation} @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "Get", "the", "affiliations", "of", "this", "node", ".", "<p", ">", "{", "@code", "additionalExtensions", "}", "can", "be", "used", "e", ".", "g", ".", "to", "add", "a", "Result", "Set", "Management", "extension", ".", "{", "@code", "returnedExtensions", ...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L278-L282
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F64.java
EquirectangularTools_F64.latlonToEqui
public void latlonToEqui(double lat, double lon, Point2D_F64 rect) { rect.x = UtilAngle.wrapZeroToOne(lon / GrlConstants.PI2 + 0.5)*width; rect.y = UtilAngle.reflectZeroToOne(lat / GrlConstants.PI + 0.5)*(height-1); }
java
public void latlonToEqui(double lat, double lon, Point2D_F64 rect) { rect.x = UtilAngle.wrapZeroToOne(lon / GrlConstants.PI2 + 0.5)*width; rect.y = UtilAngle.reflectZeroToOne(lat / GrlConstants.PI + 0.5)*(height-1); }
[ "public", "void", "latlonToEqui", "(", "double", "lat", ",", "double", "lon", ",", "Point2D_F64", "rect", ")", "{", "rect", ".", "x", "=", "UtilAngle", ".", "wrapZeroToOne", "(", "lon", "/", "GrlConstants", ".", "PI2", "+", "0.5", ")", "*", "width", ";...
Convert from latitude-longitude coordinates into equirectangular coordinates @param lat Latitude @param lon Longitude @param rect (Output) equirectangular coordinate
[ "Convert", "from", "latitude", "-", "longitude", "coordinates", "into", "equirectangular", "coordinates" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F64.java#L145-L148
m-m-m/util
lang/src/main/java/net/sf/mmm/util/lang/api/BasicHelper.java
BasicHelper.toLowerCase
public static String toLowerCase(String string, Locale locale) { if (locale == null) { return toLowerCase(string, STANDARD_LOCALE); } return string.toLowerCase(locale); }
java
public static String toLowerCase(String string, Locale locale) { if (locale == null) { return toLowerCase(string, STANDARD_LOCALE); } return string.toLowerCase(locale); }
[ "public", "static", "String", "toLowerCase", "(", "String", "string", ",", "Locale", "locale", ")", "{", "if", "(", "locale", "==", "null", ")", "{", "return", "toLowerCase", "(", "string", ",", "STANDARD_LOCALE", ")", ";", "}", "return", "string", ".", ...
Indirection for {@link String#toLowerCase(Locale)}. @param string is the {@link String}. @param locale is the {@link Locale}. @return the result of {@link String#toLowerCase(Locale)}.
[ "Indirection", "for", "{", "@link", "String#toLowerCase", "(", "Locale", ")", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/lang/src/main/java/net/sf/mmm/util/lang/api/BasicHelper.java#L89-L95
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
MethodBuilder.buildMethodComments
public void buildMethodComments(XMLNode node, Content methodDocTree) { if (!configuration.nocomment) { MethodDoc method = (MethodDoc) methods.get(currentMethodIndex); if (method.inlineTags().length == 0) { DocFinder.Output docs = DocFinder.search(configuration, new DocFinder.Input(method)); method = docs.inlineTags != null && docs.inlineTags.length > 0 ? (MethodDoc) docs.holder : method; } //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does // not pass all implemented interfaces, holder will be the // interface type. For now, it is really the erasure. writer.addComments(method.containingClass(), method, methodDocTree); } }
java
public void buildMethodComments(XMLNode node, Content methodDocTree) { if (!configuration.nocomment) { MethodDoc method = (MethodDoc) methods.get(currentMethodIndex); if (method.inlineTags().length == 0) { DocFinder.Output docs = DocFinder.search(configuration, new DocFinder.Input(method)); method = docs.inlineTags != null && docs.inlineTags.length > 0 ? (MethodDoc) docs.holder : method; } //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does // not pass all implemented interfaces, holder will be the // interface type. For now, it is really the erasure. writer.addComments(method.containingClass(), method, methodDocTree); } }
[ "public", "void", "buildMethodComments", "(", "XMLNode", "node", ",", "Content", "methodDocTree", ")", "{", "if", "(", "!", "configuration", ".", "nocomment", ")", "{", "MethodDoc", "method", "=", "(", "MethodDoc", ")", "methods", ".", "get", "(", "currentMe...
Build the comments for the method. Do nothing if {@link Configuration#nocomment} is set to true. @param node the XML element that specifies which components to document @param methodDocTree the content tree to which the documentation will be added
[ "Build", "the", "comments", "for", "the", "method", ".", "Do", "nothing", "if", "{", "@link", "Configuration#nocomment", "}", "is", "set", "to", "true", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java#L206-L221
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java
TimeSeriesUtils.reshapeVectorToTimeSeriesMask
public static INDArray reshapeVectorToTimeSeriesMask(INDArray timeSeriesMaskAsVector, int minibatchSize) { if (!timeSeriesMaskAsVector.isVector()) throw new IllegalArgumentException("Cannot reshape mask: expected vector"); val timeSeriesLength = timeSeriesMaskAsVector.length() / minibatchSize; return timeSeriesMaskAsVector.reshape('f', minibatchSize, timeSeriesLength); }
java
public static INDArray reshapeVectorToTimeSeriesMask(INDArray timeSeriesMaskAsVector, int minibatchSize) { if (!timeSeriesMaskAsVector.isVector()) throw new IllegalArgumentException("Cannot reshape mask: expected vector"); val timeSeriesLength = timeSeriesMaskAsVector.length() / minibatchSize; return timeSeriesMaskAsVector.reshape('f', minibatchSize, timeSeriesLength); }
[ "public", "static", "INDArray", "reshapeVectorToTimeSeriesMask", "(", "INDArray", "timeSeriesMaskAsVector", ",", "int", "minibatchSize", ")", "{", "if", "(", "!", "timeSeriesMaskAsVector", ".", "isVector", "(", ")", ")", "throw", "new", "IllegalArgumentException", "("...
Reshape time series mask arrays. This should match the assumptions (f order, etc) in RnnOutputLayer @param timeSeriesMaskAsVector Mask array to reshape to a column vector @return Mask array as a column vector
[ "Reshape", "time", "series", "mask", "arrays", ".", "This", "should", "match", "the", "assumptions", "(", "f", "order", "etc", ")", "in", "RnnOutputLayer" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java#L110-L117
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslContext.java
SslContext.newClientContext
@Deprecated public static SslContext newClientContext( SslProvider provider, TrustManagerFactory trustManagerFactory) throws SSLException { return newClientContext(provider, null, trustManagerFactory); }
java
@Deprecated public static SslContext newClientContext( SslProvider provider, TrustManagerFactory trustManagerFactory) throws SSLException { return newClientContext(provider, null, trustManagerFactory); }
[ "@", "Deprecated", "public", "static", "SslContext", "newClientContext", "(", "SslProvider", "provider", ",", "TrustManagerFactory", "trustManagerFactory", ")", "throws", "SSLException", "{", "return", "newClientContext", "(", "provider", ",", "null", ",", "trustManager...
Creates a new client-side {@link SslContext}. @param provider the {@link SslContext} implementation to use. {@code null} to use the current default one. @param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s that verifies the certificates sent from servers. {@code null} to use the default. @return a new client-side {@link SslContext} @deprecated Replaced by {@link SslContextBuilder}
[ "Creates", "a", "new", "client", "-", "side", "{", "@link", "SslContext", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L603-L607
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/ClassLoaderHelper.java
ClassLoaderHelper.getResource
@Nullable public static URL getResource (@Nonnull final ClassLoader aClassLoader, @Nonnull @Nonempty final String sPath) { ValueEnforcer.notNull (aClassLoader, "ClassLoader"); ValueEnforcer.notEmpty (sPath, "Path"); // Ensure the path does NOT starts with a "/" final String sPathWithoutSlash = _getPathWithoutLeadingSlash (sPath); // returns null if not found return aClassLoader.getResource (sPathWithoutSlash); }
java
@Nullable public static URL getResource (@Nonnull final ClassLoader aClassLoader, @Nonnull @Nonempty final String sPath) { ValueEnforcer.notNull (aClassLoader, "ClassLoader"); ValueEnforcer.notEmpty (sPath, "Path"); // Ensure the path does NOT starts with a "/" final String sPathWithoutSlash = _getPathWithoutLeadingSlash (sPath); // returns null if not found return aClassLoader.getResource (sPathWithoutSlash); }
[ "@", "Nullable", "public", "static", "URL", "getResource", "(", "@", "Nonnull", "final", "ClassLoader", "aClassLoader", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sPath", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aClassLoader", ",", "\"Cl...
Get the URL of the passed resource using the specified class loader only. This is a sanity wrapper around <code>classLoader.getResource (sPath)</code>. @param aClassLoader The class loader to be used. May not be <code>null</code>. @param sPath The path to be resolved. May neither be <code>null</code> nor empty. Internally it is ensured that the provided path does NOT start with a slash. @return <code>null</code> if the path could not be resolved using the specified class loader.
[ "Get", "the", "URL", "of", "the", "passed", "resource", "using", "the", "specified", "class", "loader", "only", ".", "This", "is", "a", "sanity", "wrapper", "around", "<code", ">", "classLoader", ".", "getResource", "(", "sPath", ")", "<", "/", "code", "...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassLoaderHelper.java#L121-L132
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/UserInterfaceApi.java
UserInterfaceApi.postUiOpenwindowContract
public void postUiOpenwindowContract(Integer contractId, String datasource, String token) throws ApiException { postUiOpenwindowContractWithHttpInfo(contractId, datasource, token); }
java
public void postUiOpenwindowContract(Integer contractId, String datasource, String token) throws ApiException { postUiOpenwindowContractWithHttpInfo(contractId, datasource, token); }
[ "public", "void", "postUiOpenwindowContract", "(", "Integer", "contractId", ",", "String", "datasource", ",", "String", "token", ")", "throws", "ApiException", "{", "postUiOpenwindowContractWithHttpInfo", "(", "contractId", ",", "datasource", ",", "token", ")", ";", ...
Open Contract Window Open the contract window inside the client --- SSO Scope: esi-ui.open_window.v1 @param contractId The contract to open (required) @param datasource The server name you would like data from (optional, default to tranquility) @param token Access token to use if unable to set a header (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Open", "Contract", "Window", "Open", "the", "contract", "window", "inside", "the", "client", "---", "SSO", "Scope", ":", "esi", "-", "ui", ".", "open_window", ".", "v1" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/UserInterfaceApi.java#L335-L337
tvesalainen/util
util/src/main/java/org/vesalainen/nio/RingBuffer.java
RingBuffer.subSequence
@Override public CharSequence subSequence(int start, int end) { StringBuilder sb = new StringBuilder(); for (int ii=start;ii<end;ii++) { sb.append((char)getAt(ii)); } return sb.toString(); }
java
@Override public CharSequence subSequence(int start, int end) { StringBuilder sb = new StringBuilder(); for (int ii=start;ii<end;ii++) { sb.append((char)getAt(ii)); } return sb.toString(); }
[ "@", "Override", "public", "CharSequence", "subSequence", "(", "int", "start", ",", "int", "end", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "ii", "=", "start", ";", "ii", "<", "end", ";", "ii", "+...
Note that implementation uses StringBuilder to create String as CharSequence. @param start @param end @return
[ "Note", "that", "implementation", "uses", "StringBuilder", "to", "create", "String", "as", "CharSequence", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/RingBuffer.java#L344-L353
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java
ConnectionPoolSupport.createGenericObjectPool
public static <T extends StatefulConnection<?, ?>> GenericObjectPool<T> createGenericObjectPool( Supplier<T> connectionSupplier, GenericObjectPoolConfig<T> config) { return createGenericObjectPool(connectionSupplier, config, true); }
java
public static <T extends StatefulConnection<?, ?>> GenericObjectPool<T> createGenericObjectPool( Supplier<T> connectionSupplier, GenericObjectPoolConfig<T> config) { return createGenericObjectPool(connectionSupplier, config, true); }
[ "public", "static", "<", "T", "extends", "StatefulConnection", "<", "?", ",", "?", ">", ">", "GenericObjectPool", "<", "T", ">", "createGenericObjectPool", "(", "Supplier", "<", "T", ">", "connectionSupplier", ",", "GenericObjectPoolConfig", "<", "T", ">", "co...
Creates a new {@link GenericObjectPool} using the {@link Supplier}. Allocated instances are wrapped and must not be returned with {@link ObjectPool#returnObject(Object)}. @param connectionSupplier must not be {@literal null}. @param config must not be {@literal null}. @param <T> connection type. @return the connection pool.
[ "Creates", "a", "new", "{", "@link", "GenericObjectPool", "}", "using", "the", "{", "@link", "Supplier", "}", ".", "Allocated", "instances", "are", "wrapped", "and", "must", "not", "be", "returned", "with", "{", "@link", "ObjectPool#returnObject", "(", "Object...
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java#L92-L95
moleculer-java/moleculer-java
src/main/java/services/moleculer/eventbus/EventEmitter.java
EventEmitter.broadcastLocal
public void broadcastLocal(String name, Tree payload, Groups groups) { eventbus.broadcast(name, payload, groups, true); }
java
public void broadcastLocal(String name, Tree payload, Groups groups) { eventbus.broadcast(name, payload, groups, true); }
[ "public", "void", "broadcastLocal", "(", "String", "name", ",", "Tree", "payload", ",", "Groups", "groups", ")", "{", "eventbus", ".", "broadcast", "(", "name", ",", "payload", ",", "groups", ",", "true", ")", ";", "}" ]
Emits a <b>LOCAL</b> event to <b>ALL</b> listeners from the specified event group(s), who are listening this event. Sample code:<br> <br> Tree params = new Tree();<br> params.put("a", true);<br> params.putList("b").add(1).add(2).add(3);<br> ctx.broadcastLocal("user.created", params, Groups.of("group1", "group2")); @param name name of event (eg. "user.modified") @param payload {@link Tree} structure (payload of the event) @param groups {@link Groups event group} container
[ "Emits", "a", "<b", ">", "LOCAL<", "/", "b", ">", "event", "to", "<b", ">", "ALL<", "/", "b", ">", "listeners", "from", "the", "specified", "event", "group", "(", "s", ")", "who", "are", "listening", "this", "event", ".", "Sample", "code", ":", "<b...
train
https://github.com/moleculer-java/moleculer-java/blob/27575c44b9ecacc17c4456ceacf5d1851abf1cc4/src/main/java/services/moleculer/eventbus/EventEmitter.java#L221-L223
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.ortho2DLH
public Matrix4x3f ortho2DLH(float left, float right, float bottom, float top) { return ortho2DLH(left, right, bottom, top, this); }
java
public Matrix4x3f ortho2DLH(float left, float right, float bottom, float top) { return ortho2DLH(left, right, bottom, top, this); }
[ "public", "Matrix4x3f", "ortho2DLH", "(", "float", "left", ",", "float", "right", ",", "float", "bottom", ",", "float", "top", ")", "{", "return", "ortho2DLH", "(", "left", ",", "right", ",", "bottom", ",", "top", ",", "this", ")", ";", "}" ]
Apply an orthographic projection transformation for a left-handed coordinate system to this matrix. <p> This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float) orthoLH()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho2DLH(float, float, float, float) setOrtho2DLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoLH(float, float, float, float, float, float) @see #setOrtho2DLH(float, float, float, float) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @return this
[ "Apply", "an", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "to", "this", "matrix", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#orthoLH", "(", "float", "...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5829-L5831
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/Mapcode.java
Mapcode.getCode
@Nonnull public String getCode(final int precision, @Nullable final Alphabet alphabet) { if (precision == 0) { return convertStringToAlphabet(codePrecision8.substring(0, codePrecision8.length() - 9), alphabet); } else if (precision <= 8) { return convertStringToAlphabet(codePrecision8.substring(0, (codePrecision8.length() - 8) + precision), alphabet); } else { throw new IllegalArgumentException("getCodePrecision: precision must be in [0, 8]"); } }
java
@Nonnull public String getCode(final int precision, @Nullable final Alphabet alphabet) { if (precision == 0) { return convertStringToAlphabet(codePrecision8.substring(0, codePrecision8.length() - 9), alphabet); } else if (precision <= 8) { return convertStringToAlphabet(codePrecision8.substring(0, (codePrecision8.length() - 8) + precision), alphabet); } else { throw new IllegalArgumentException("getCodePrecision: precision must be in [0, 8]"); } }
[ "@", "Nonnull", "public", "String", "getCode", "(", "final", "int", "precision", ",", "@", "Nullable", "final", "Alphabet", "alphabet", ")", "{", "if", "(", "precision", "==", "0", ")", "{", "return", "convertStringToAlphabet", "(", "codePrecision8", ".", "s...
Get the mapcode code (without territory information) with a specified precision. The returned mapcode includes a '-' separator and additional digits for precisions 1 to 8. The precision defines the size of a geographical area a single mapcode covers. This means It also defines the maximum distance to the location, a (latitude, longitude) pair, that encoded to this mapcode. Precision 0: area is approx 10 x 10 meters (100 m2); max. distance from original location less than 7.5 meters. Precision 1: area is approx 3.33 m2; max. distance from original location less than 1.5 meters. Precision 1: area is approx 0.11 m2; max. distance from original location less than 0.4 meters. etc. (each level reduces the area by a factor of 30) The accuracy is slightly better than the figures above, but these figures are safe assumptions. @param precision Precision. Range: 0..8. @param alphabet Alphabet. @return Mapcode code. @throws IllegalArgumentException Thrown if precision is out of range (must be in [0, 8]).
[ "Get", "the", "mapcode", "code", "(", "without", "territory", "information", ")", "with", "a", "specified", "precision", ".", "The", "returned", "mapcode", "includes", "a", "-", "separator", "and", "additional", "digits", "for", "precisions", "1", "to", "8", ...
train
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Mapcode.java#L152-L162
guardtime/ksi-java-sdk
ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java
HashTreeBuilder.calculateHeight
public long calculateHeight(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException { return calculateHeight(aggregate(node, metadata)); }
java
public long calculateHeight(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException { return calculateHeight(aggregate(node, metadata)); }
[ "public", "long", "calculateHeight", "(", "ImprintNode", "node", ",", "IdentityMetadata", "metadata", ")", "throws", "HashException", ",", "KSIException", "{", "return", "calculateHeight", "(", "aggregate", "(", "node", ",", "metadata", ")", ")", ";", "}" ]
Calculates the height of the hash tree in case a new node with metadata would be added. @param node a leaf to be added to the tree, must not be null. @param metadata metadata associated with the node. @return Height of the hash tree. @throws HashException @throws KSIException
[ "Calculates", "the", "height", "of", "the", "hash", "tree", "in", "case", "a", "new", "node", "with", "metadata", "would", "be", "added", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java#L137-L139
alkacon/opencms-core
src/org/opencms/main/CmsAliasResourceHandler.java
CmsAliasResourceHandler.redirectToTarget
private void redirectToTarget(HttpServletRequest req, HttpServletResponse res, String link, boolean isPermanent) throws IOException, CmsResourceInitException { CmsResourceInitException resInitException = new CmsResourceInitException(getClass()); if (res != null) { // preserve request parameters for the redirect String query = req.getQueryString(); if (query != null) { link += "?" + query; } // disable 404 handler resInitException.setClearErrors(true); if (isPermanent) { res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); res.setHeader("Location", link); } else { res.sendRedirect(link); } } throw resInitException; }
java
private void redirectToTarget(HttpServletRequest req, HttpServletResponse res, String link, boolean isPermanent) throws IOException, CmsResourceInitException { CmsResourceInitException resInitException = new CmsResourceInitException(getClass()); if (res != null) { // preserve request parameters for the redirect String query = req.getQueryString(); if (query != null) { link += "?" + query; } // disable 404 handler resInitException.setClearErrors(true); if (isPermanent) { res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); res.setHeader("Location", link); } else { res.sendRedirect(link); } } throw resInitException; }
[ "private", "void", "redirectToTarget", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ",", "String", "link", ",", "boolean", "isPermanent", ")", "throws", "IOException", ",", "CmsResourceInitException", "{", "CmsResourceInitException", "resInitExcept...
Helper method for sending a redirect to a new URI.<p> @param req the current request @param res the current response @param link the redirect target @param isPermanent if true, sends a 'moved permanently' redirect @throws IOException @throws CmsResourceInitException
[ "Helper", "method", "for", "sending", "a", "redirect", "to", "a", "new", "URI", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsAliasResourceHandler.java#L166-L186
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/client/ClientDatasource.java
ClientDatasource.getInstance
public static Client getInstance(String datasourceName, PageContext pc, Log log) throws PageException { Struct _sct = _loadData(pc, datasourceName, "client", SCOPE_CLIENT, log, false); if (_sct == null) _sct = new StructImpl(); return new ClientDatasource(pc, datasourceName, _sct); }
java
public static Client getInstance(String datasourceName, PageContext pc, Log log) throws PageException { Struct _sct = _loadData(pc, datasourceName, "client", SCOPE_CLIENT, log, false); if (_sct == null) _sct = new StructImpl(); return new ClientDatasource(pc, datasourceName, _sct); }
[ "public", "static", "Client", "getInstance", "(", "String", "datasourceName", ",", "PageContext", "pc", ",", "Log", "log", ")", "throws", "PageException", "{", "Struct", "_sct", "=", "_loadData", "(", "pc", ",", "datasourceName", ",", "\"client\"", ",", "SCOPE...
load an new instance of the client datasource scope @param datasourceName @param appName @param pc @param log @return client datasource scope @throws PageException
[ "load", "an", "new", "instance", "of", "the", "client", "datasource", "scope" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/client/ClientDatasource.java#L55-L61
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/ui/tools/Utils.java
Utils.collapseJTree
public static void collapseJTree(javax.swing.JTree tree, int depth) { javax.swing.tree.TreeModel model = tree.getModel(); collapseJTreeNode(tree, model, model.getRoot(), 0, depth); }
java
public static void collapseJTree(javax.swing.JTree tree, int depth) { javax.swing.tree.TreeModel model = tree.getModel(); collapseJTreeNode(tree, model, model.getRoot(), 0, depth); }
[ "public", "static", "void", "collapseJTree", "(", "javax", ".", "swing", ".", "JTree", "tree", ",", "int", "depth", ")", "{", "javax", ".", "swing", ".", "tree", ".", "TreeModel", "model", "=", "tree", ".", "getModel", "(", ")", ";", "collapseJTreeNode",...
Expands all nodes in a JTree. @param tree The JTree to expand. @param depth The depth to which the tree should be expanded. Zero will just expand the root node, a negative value will fully expand the tree, and a positive value will recursively expand the tree to that depth.
[ "Expands", "all", "nodes", "in", "a", "JTree", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/ui/tools/Utils.java#L125-L128
soi-toolkit/soi-toolkit-mule
commons/components/studio-components/src/main/java/org/soitoolkit/commons/studio/components/logger/LoggerModule.java
LoggerModule.logDebug
@Processor public Object logDebug( @Optional @FriendlyName("Log Message") String message, @Optional String integrationScenario, @Optional String messageType, @Optional String contractId, @Optional String correlationId, @Optional @FriendlyName("Extra Info") Map<String, String> extraInfo) { return doLog(LogLevelType.DEBUG, message, integrationScenario, contractId, correlationId, extraInfo); }
java
@Processor public Object logDebug( @Optional @FriendlyName("Log Message") String message, @Optional String integrationScenario, @Optional String messageType, @Optional String contractId, @Optional String correlationId, @Optional @FriendlyName("Extra Info") Map<String, String> extraInfo) { return doLog(LogLevelType.DEBUG, message, integrationScenario, contractId, correlationId, extraInfo); }
[ "@", "Processor", "public", "Object", "logDebug", "(", "@", "Optional", "@", "FriendlyName", "(", "\"Log Message\"", ")", "String", "message", ",", "@", "Optional", "String", "integrationScenario", ",", "@", "Optional", "String", "messageType", ",", "@", "Option...
Log processor for level DEBUG {@sample.xml ../../../doc/soitoolkit-connector.xml.sample soitoolkit:log-debug} @param message Log-message to be processed @param integrationScenario Optional name of the integration scenario or business process @param messageType Optional name of the message type, e.g. a XML Schema namespace for a XML payload @param contractId Optional name of the contract in use @param correlationId Optional correlation identity of the message @param extraInfo Optional extra info @return The incoming payload
[ "Log", "processor", "for", "level", "DEBUG" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/studio-components/src/main/java/org/soitoolkit/commons/studio/components/logger/LoggerModule.java#L277-L287
larsga/Duke
duke-core/src/main/java/no/priv/garshol/duke/ConfigLoader.java
ConfigLoader.load
public static Configuration load(String file) throws IOException, SAXException { ConfigurationImpl cfg = new ConfigurationImpl(); XMLReader parser = XMLReaderFactory.createXMLReader(); parser.setContentHandler(new ConfigHandler(cfg, file)); if (file.startsWith("classpath:")) { String resource = file.substring("classpath:".length()); ClassLoader cloader = Thread.currentThread().getContextClassLoader(); InputStream istream = cloader.getResourceAsStream(resource); parser.parse(new InputSource(istream)); } else parser.parse(file); return cfg; }
java
public static Configuration load(String file) throws IOException, SAXException { ConfigurationImpl cfg = new ConfigurationImpl(); XMLReader parser = XMLReaderFactory.createXMLReader(); parser.setContentHandler(new ConfigHandler(cfg, file)); if (file.startsWith("classpath:")) { String resource = file.substring("classpath:".length()); ClassLoader cloader = Thread.currentThread().getContextClassLoader(); InputStream istream = cloader.getResourceAsStream(resource); parser.parse(new InputSource(istream)); } else parser.parse(file); return cfg; }
[ "public", "static", "Configuration", "load", "(", "String", "file", ")", "throws", "IOException", ",", "SAXException", "{", "ConfigurationImpl", "cfg", "=", "new", "ConfigurationImpl", "(", ")", ";", "XMLReader", "parser", "=", "XMLReaderFactory", ".", "createXMLR...
Note that if file starts with 'classpath:' the resource is looked up on the classpath instead.
[ "Note", "that", "if", "file", "starts", "with", "classpath", ":", "the", "resource", "is", "looked", "up", "on", "the", "classpath", "instead", "." ]
train
https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-core/src/main/java/no/priv/garshol/duke/ConfigLoader.java#L37-L52
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/dataaccess/file/PackageDir.java
PackageDir.getAssetFile
@ApiModelProperty(hidden=true) public AssetFile getAssetFile(File file, AssetRevision rev) throws IOException { AssetFile assetFile; if (rev == null) { rev = versionControl.getRevision(file); if (rev == null) { // presumably dropped-in asset rev = new AssetRevision(); rev.setVersion(0); rev.setModDate(new Date()); } assetFile = new AssetFile(this, file.getName(), rev); assetFile.setRevision(rev); } else { versionControl.setRevision(file, rev); assetFile = new AssetFile(this, file.getName(), rev); versionControl.clearId(assetFile); } assetFile.setId(versionControl.getId(assetFile.getLogicalFile())); assetFiles.put(assetFile.getLogicalFile(), assetFile); return assetFile; }
java
@ApiModelProperty(hidden=true) public AssetFile getAssetFile(File file, AssetRevision rev) throws IOException { AssetFile assetFile; if (rev == null) { rev = versionControl.getRevision(file); if (rev == null) { // presumably dropped-in asset rev = new AssetRevision(); rev.setVersion(0); rev.setModDate(new Date()); } assetFile = new AssetFile(this, file.getName(), rev); assetFile.setRevision(rev); } else { versionControl.setRevision(file, rev); assetFile = new AssetFile(this, file.getName(), rev); versionControl.clearId(assetFile); } assetFile.setId(versionControl.getId(assetFile.getLogicalFile())); assetFiles.put(assetFile.getLogicalFile(), assetFile); return assetFile; }
[ "@", "ApiModelProperty", "(", "hidden", "=", "true", ")", "public", "AssetFile", "getAssetFile", "(", "File", "file", ",", "AssetRevision", "rev", ")", "throws", "IOException", "{", "AssetFile", "assetFile", ";", "if", "(", "rev", "==", "null", ")", "{", "...
Called during initial load the file param is a standard file.
[ "Called", "during", "initial", "load", "the", "file", "param", "is", "a", "standard", "file", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/dataaccess/file/PackageDir.java#L215-L237
alkacon/opencms-core
src/org/opencms/security/CmsOrgUnitManager.java
CmsOrgUnitManager.removeResourceFromOrgUnit
public void removeResourceFromOrgUnit(CmsObject cms, String ouFqn, String resourceName) throws CmsException { CmsOrganizationalUnit orgUnit = readOrganizationalUnit(cms, ouFqn); CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL); m_securityManager.removeResourceFromOrgUnit(cms.getRequestContext(), orgUnit, resource); }
java
public void removeResourceFromOrgUnit(CmsObject cms, String ouFqn, String resourceName) throws CmsException { CmsOrganizationalUnit orgUnit = readOrganizationalUnit(cms, ouFqn); CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL); m_securityManager.removeResourceFromOrgUnit(cms.getRequestContext(), orgUnit, resource); }
[ "public", "void", "removeResourceFromOrgUnit", "(", "CmsObject", "cms", ",", "String", "ouFqn", ",", "String", "resourceName", ")", "throws", "CmsException", "{", "CmsOrganizationalUnit", "orgUnit", "=", "readOrganizationalUnit", "(", "cms", ",", "ouFqn", ")", ";", ...
Removes a resource from the given organizational unit.<p> @param cms the opencms context @param ouFqn the fully qualified name of the organizational unit to remove the resource from @param resourceName the name of the resource that is to be removed from the organizational unit @throws CmsException if something goes wrong
[ "Removes", "a", "resource", "from", "the", "given", "organizational", "unit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsOrgUnitManager.java#L324-L330
eyp/serfj
src/main/java/net/sf/serfj/ServletHelper.java
ServletHelper.isRequestMethodServed
private boolean isRequestMethodServed(Method method, HttpMethod httpMethod) { boolean accepts = false; switch (httpMethod) { case GET: accepts = method.getAnnotation(GET.class) != null; break; case POST: accepts = method.getAnnotation(POST.class) != null; break; case PUT: accepts = method.getAnnotation(PUT.class) != null; break; case DELETE: accepts = method.getAnnotation(DELETE.class) != null; break; default: throw new IllegalArgumentException("HTTP method not supported: " + httpMethod); } return accepts; }
java
private boolean isRequestMethodServed(Method method, HttpMethod httpMethod) { boolean accepts = false; switch (httpMethod) { case GET: accepts = method.getAnnotation(GET.class) != null; break; case POST: accepts = method.getAnnotation(POST.class) != null; break; case PUT: accepts = method.getAnnotation(PUT.class) != null; break; case DELETE: accepts = method.getAnnotation(DELETE.class) != null; break; default: throw new IllegalArgumentException("HTTP method not supported: " + httpMethod); } return accepts; }
[ "private", "boolean", "isRequestMethodServed", "(", "Method", "method", ",", "HttpMethod", "httpMethod", ")", "{", "boolean", "accepts", "=", "false", ";", "switch", "(", "httpMethod", ")", "{", "case", "GET", ":", "accepts", "=", "method", ".", "getAnnotation...
Checks if a resource's method attends HTTP requests using a concrete HTTP_METHOD (GET, POST, PUT, DELETE). A method accept a particular HTTP_METHOD if it's annotated with the correct annotation (@GET, @POST, @PUT, @DELETE). @param method A class's method. @param httpMethod HTTP_METHOD that comes in the request. @return <code>true</code> if the method accepts that HTTP_METHOD, <code>false</code> otherwise. @throws IllegalArgumentException if HttpMethod is not supported.
[ "Checks", "if", "a", "resource", "s", "method", "attends", "HTTP", "requests", "using", "a", "concrete", "HTTP_METHOD", "(", "GET", "POST", "PUT", "DELETE", ")", ".", "A", "method", "accept", "a", "particular", "HTTP_METHOD", "if", "it", "s", "annotated", ...
train
https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ServletHelper.java#L288-L307
spring-projects/spring-shell
spring-shell-core/src/main/java/org/springframework/shell/jline/ExtendedDefaultParser.java
ExtendedDefaultParser.isEscapeChar
public boolean isEscapeChar(final CharSequence buffer, final int pos) { if (pos < 0) { return false; } for (int i = 0; (escapeChars != null) && (i < escapeChars.length); i++) { if (buffer.charAt(pos) == escapeChars[i]) { return !isEscaped(buffer, pos); // escape escape } } return false; }
java
public boolean isEscapeChar(final CharSequence buffer, final int pos) { if (pos < 0) { return false; } for (int i = 0; (escapeChars != null) && (i < escapeChars.length); i++) { if (buffer.charAt(pos) == escapeChars[i]) { return !isEscaped(buffer, pos); // escape escape } } return false; }
[ "public", "boolean", "isEscapeChar", "(", "final", "CharSequence", "buffer", ",", "final", "int", "pos", ")", "{", "if", "(", "pos", "<", "0", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "(", "escapeChars", "!=", "...
Check if this character is a valid escape char (i.e. one that has not been escaped)
[ "Check", "if", "this", "character", "is", "a", "valid", "escape", "char", "(", "i", ".", "e", ".", "one", "that", "has", "not", "been", "escaped", ")" ]
train
https://github.com/spring-projects/spring-shell/blob/23d99f45eb8f487e31a1f080c837061313bbfafa/spring-shell-core/src/main/java/org/springframework/shell/jline/ExtendedDefaultParser.java#L183-L195
nulab/backlog4j
src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java
CreateIssueParams.milestoneIds
public CreateIssueParams milestoneIds(List milestoneIds) { for (Object milestoneId : milestoneIds) { parameters.add(new NameValuePair("milestoneId[]", milestoneId.toString())); } return this; }
java
public CreateIssueParams milestoneIds(List milestoneIds) { for (Object milestoneId : milestoneIds) { parameters.add(new NameValuePair("milestoneId[]", milestoneId.toString())); } return this; }
[ "public", "CreateIssueParams", "milestoneIds", "(", "List", "milestoneIds", ")", "{", "for", "(", "Object", "milestoneId", ":", "milestoneIds", ")", "{", "parameters", ".", "add", "(", "new", "NameValuePair", "(", "\"milestoneId[]\"", ",", "milestoneId", ".", "t...
Sets the issue milestones. @param milestoneIds the milestone identifiers @return CreateIssueParams instance
[ "Sets", "the", "issue", "milestones", "." ]
train
https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L162-L167
inversoft/restify
src/main/java/com/inversoft/net/ssl/SSLTools.java
SSLTools.getSSLServerContext
public static SSLContext getSSLServerContext(String certificateString, String keyString) throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException, InvalidKeySpecException { byte[] certBytes = parseDERFromPEM(certificateString, CERT_START, CERT_END); byte[] keyBytes = parseDERFromPEM(keyString, P8_KEY_START, P8_KEY_END); X509Certificate cert = generateCertificateFromDER(certBytes); PrivateKey key = generatePrivateKeyFromPKCS8DER(keyBytes); KeyStore keystore = KeyStore.getInstance("JKS"); keystore.load(null); keystore.setCertificateEntry("cert-alias", cert); keystore.setKeyEntry("key-alias", key, "changeit".toCharArray(), new Certificate[]{cert}); KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(keystore, "changeit".toCharArray()); KeyManager[] km = kmf.getKeyManagers(); SSLContext context = SSLContext.getInstance("TLS"); context.init(km, null, null); return context; }
java
public static SSLContext getSSLServerContext(String certificateString, String keyString) throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException, InvalidKeySpecException { byte[] certBytes = parseDERFromPEM(certificateString, CERT_START, CERT_END); byte[] keyBytes = parseDERFromPEM(keyString, P8_KEY_START, P8_KEY_END); X509Certificate cert = generateCertificateFromDER(certBytes); PrivateKey key = generatePrivateKeyFromPKCS8DER(keyBytes); KeyStore keystore = KeyStore.getInstance("JKS"); keystore.load(null); keystore.setCertificateEntry("cert-alias", cert); keystore.setKeyEntry("key-alias", key, "changeit".toCharArray(), new Certificate[]{cert}); KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(keystore, "changeit".toCharArray()); KeyManager[] km = kmf.getKeyManagers(); SSLContext context = SSLContext.getInstance("TLS"); context.init(km, null, null); return context; }
[ "public", "static", "SSLContext", "getSSLServerContext", "(", "String", "certificateString", ",", "String", "keyString", ")", "throws", "CertificateException", ",", "KeyStoreException", ",", "IOException", ",", "NoSuchAlgorithmException", ",", "UnrecoverableKeyException", "...
This creates an in-memory keystore containing the certificate and private key and initializes the SSLContext with the key material it contains. <p> For using with an HttpsServer: {@code SSLContext sslContext = getSSLServerContext(...); HttpsServer server = HttpsServer.create(); server.setHttpsConfigurator (new HttpsConfigurator(sslContext));} @param certificateString a PEM formatted Certificate @param keyString a PKCS8 PEM formatted Private Key @return a SSLContext configured with the Certificate and Private Key
[ "This", "creates", "an", "in", "-", "memory", "keystore", "containing", "the", "certificate", "and", "private", "key", "and", "initializes", "the", "SSLContext", "with", "the", "key", "material", "it", "contains", ".", "<p", ">", "For", "using", "with", "an"...
train
https://github.com/inversoft/restify/blob/f2426d9082e00a9d958af28f78ccda61802c6700/src/main/java/com/inversoft/net/ssl/SSLTools.java#L122-L142
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountBatchConfigurationsInner.java
IntegrationAccountBatchConfigurationsInner.getAsync
public Observable<BatchConfigurationInner> getAsync(String resourceGroupName, String integrationAccountName, String batchConfigurationName) { return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, batchConfigurationName).map(new Func1<ServiceResponse<BatchConfigurationInner>, BatchConfigurationInner>() { @Override public BatchConfigurationInner call(ServiceResponse<BatchConfigurationInner> response) { return response.body(); } }); }
java
public Observable<BatchConfigurationInner> getAsync(String resourceGroupName, String integrationAccountName, String batchConfigurationName) { return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, batchConfigurationName).map(new Func1<ServiceResponse<BatchConfigurationInner>, BatchConfigurationInner>() { @Override public BatchConfigurationInner call(ServiceResponse<BatchConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BatchConfigurationInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "batchConfigurationName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Get a batch configuration for an integration account. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param batchConfigurationName The batch configuration name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BatchConfigurationInner object
[ "Get", "a", "batch", "configuration", "for", "an", "integration", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountBatchConfigurationsInner.java#L206-L213
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java
ApiOvhHostingprivateDatabase.serviceName_dump_dumpId_DELETE
public OvhTask serviceName_dump_dumpId_DELETE(String serviceName, Long dumpId) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/dump/{dumpId}"; StringBuilder sb = path(qPath, serviceName, dumpId); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_dump_dumpId_DELETE(String serviceName, Long dumpId) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/dump/{dumpId}"; StringBuilder sb = path(qPath, serviceName, dumpId); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_dump_dumpId_DELETE", "(", "String", "serviceName", ",", "Long", "dumpId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/privateDatabase/{serviceName}/dump/{dumpId}\"", ";", "StringBuilder", "sb", "=", "path", "(",...
Delete dump before expiration date REST: DELETE /hosting/privateDatabase/{serviceName}/dump/{dumpId} @param serviceName [required] The internal name of your private database @param dumpId [required] Dump id
[ "Delete", "dump", "before", "expiration", "date" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L685-L690
statefulj/statefulj
statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-common/src/main/java/org/statefulj/framework/binders/common/utils/JavassistUtils.java
JavassistUtils.cloneAnnotation
public static Annotation cloneAnnotation(ConstPool constPool, java.lang.annotation.Annotation annotation) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { Class<?> clazz = annotation.annotationType(); Annotation annot = new Annotation(clazz.getName(), constPool); for(Method method : clazz.getDeclaredMethods()) { MemberValue memberVal = null; if (method.getReturnType().isArray()) { List<MemberValue> memberVals = new LinkedList<MemberValue>(); for(Object val : (Object[])method.invoke(annotation)) { memberVals.add(createMemberValue(constPool, val)); } memberVal = new ArrayMemberValue(constPool); ((ArrayMemberValue)memberVal).setValue(memberVals.toArray(new MemberValue[]{})); } else { memberVal = createMemberValue(constPool, method.invoke(annotation)); } annot.addMemberValue(method.getName(), memberVal); } return annot; }
java
public static Annotation cloneAnnotation(ConstPool constPool, java.lang.annotation.Annotation annotation) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { Class<?> clazz = annotation.annotationType(); Annotation annot = new Annotation(clazz.getName(), constPool); for(Method method : clazz.getDeclaredMethods()) { MemberValue memberVal = null; if (method.getReturnType().isArray()) { List<MemberValue> memberVals = new LinkedList<MemberValue>(); for(Object val : (Object[])method.invoke(annotation)) { memberVals.add(createMemberValue(constPool, val)); } memberVal = new ArrayMemberValue(constPool); ((ArrayMemberValue)memberVal).setValue(memberVals.toArray(new MemberValue[]{})); } else { memberVal = createMemberValue(constPool, method.invoke(annotation)); } annot.addMemberValue(method.getName(), memberVal); } return annot; }
[ "public", "static", "Annotation", "cloneAnnotation", "(", "ConstPool", "constPool", ",", "java", ".", "lang", ".", "annotation", ".", "Annotation", "annotation", ")", "throws", "IllegalArgumentException", ",", "IllegalAccessException", ",", "InvocationTargetException", ...
Clone an annotation and all of it's methods @param constPool @param annotation @return @throws IllegalArgumentException @throws IllegalAccessException @throws InvocationTargetException
[ "Clone", "an", "annotation", "and", "all", "of", "it", "s", "methods" ]
train
https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-common/src/main/java/org/statefulj/framework/binders/common/utils/JavassistUtils.java#L94-L114
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java
InsertAllRequest.newBuilder
public static Builder newBuilder(TableId table, Iterable<RowToInsert> rows) { return newBuilder(table).setRows(rows); }
java
public static Builder newBuilder(TableId table, Iterable<RowToInsert> rows) { return newBuilder(table).setRows(rows); }
[ "public", "static", "Builder", "newBuilder", "(", "TableId", "table", ",", "Iterable", "<", "RowToInsert", ">", "rows", ")", "{", "return", "newBuilder", "(", "table", ")", ".", "setRows", "(", "rows", ")", ";", "}" ]
Returns a builder for an {@code InsertAllRequest} object given the destination table and the rows to insert.
[ "Returns", "a", "builder", "for", "an", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java#L343-L345
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/StringUtil.java
StringUtil.skipSpaces
public static int skipSpaces(String s, int start) { int limit = s.length(); int i = start; for (; i < limit; i++) { if (s.charAt(i) != ' ') { break; } } return i; }
java
public static int skipSpaces(String s, int start) { int limit = s.length(); int i = start; for (; i < limit; i++) { if (s.charAt(i) != ' ') { break; } } return i; }
[ "public", "static", "int", "skipSpaces", "(", "String", "s", ",", "int", "start", ")", "{", "int", "limit", "=", "s", ".", "length", "(", ")", ";", "int", "i", "=", "start", ";", "for", "(", ";", "i", "<", "limit", ";", "i", "++", ")", "{", "...
Skips any spaces at or after start and returns the index of first non-space character; @param s the string @param start index to start @return index of first non-space
[ "Skips", "any", "spaces", "at", "or", "after", "start", "and", "returns", "the", "index", "of", "first", "non", "-", "space", "character", ";" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/StringUtil.java#L334-L346
toberkoe/fluent-assertions
src/main/java/de/toberkoe/fluentassertions/api/objects/ThrowableAssert.java
ThrowableAssert.extractThrowable
private Throwable extractThrowable(Throwable exception, Class<?> causeClass) { if (exception == null) { return null; } else if (causeClass.isInstance(exception)) { return exception; } else { return extractThrowable(exception.getCause(), causeClass); } }
java
private Throwable extractThrowable(Throwable exception, Class<?> causeClass) { if (exception == null) { return null; } else if (causeClass.isInstance(exception)) { return exception; } else { return extractThrowable(exception.getCause(), causeClass); } }
[ "private", "Throwable", "extractThrowable", "(", "Throwable", "exception", ",", "Class", "<", "?", ">", "causeClass", ")", "{", "if", "(", "exception", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "causeClass", ".", "isInstance", ...
Extracts the requested throwable from given {@link Throwable}. @param exception the complete exception stack @param causeClass the requested cause to search for @return found throwable or null
[ "Extracts", "the", "requested", "throwable", "from", "given", "{", "@link", "Throwable", "}", "." ]
train
https://github.com/toberkoe/fluent-assertions/blob/8942959ee244cd63dc139a98dc445aec924e3143/src/main/java/de/toberkoe/fluentassertions/api/objects/ThrowableAssert.java#L122-L130
real-logic/agrona
agrona/src/main/java/org/agrona/collections/Int2IntCounterMap.java
Int2IntCounterMap.getAndAdd
public int getAndAdd(final int key, final int amount) { final int[] entries = this.entries; final int initialValue = this.initialValue; @DoNotSub final int mask = entries.length - 1; @DoNotSub int index = Hashing.evenHash(key, mask); int oldValue = initialValue; while (entries[index + 1] != initialValue) { if (entries[index] == key) { oldValue = entries[index + 1]; break; } index = next(index, mask); } if (amount != 0) { final int newValue = oldValue + amount; entries[index + 1] = newValue; if (oldValue == initialValue) { ++size; entries[index] = key; increaseCapacity(); } else if (newValue == initialValue) { size--; compactChain(index); } } return oldValue; }
java
public int getAndAdd(final int key, final int amount) { final int[] entries = this.entries; final int initialValue = this.initialValue; @DoNotSub final int mask = entries.length - 1; @DoNotSub int index = Hashing.evenHash(key, mask); int oldValue = initialValue; while (entries[index + 1] != initialValue) { if (entries[index] == key) { oldValue = entries[index + 1]; break; } index = next(index, mask); } if (amount != 0) { final int newValue = oldValue + amount; entries[index + 1] = newValue; if (oldValue == initialValue) { ++size; entries[index] = key; increaseCapacity(); } else if (newValue == initialValue) { size--; compactChain(index); } } return oldValue; }
[ "public", "int", "getAndAdd", "(", "final", "int", "key", ",", "final", "int", "amount", ")", "{", "final", "int", "[", "]", "entries", "=", "this", ".", "entries", ";", "final", "int", "initialValue", "=", "this", ".", "initialValue", ";", "@", "DoNot...
Add amount to the current value associated with this key. If no such value exists use {@link #initialValue()} as current value and associate key with {@link #initialValue()} + amount unless amount is 0, in which case map remains unchanged. @param key new or existing @param amount to be added @return the previous value associated with the specified key, or {@link #initialValue()} if there was no mapping for the key.
[ "Add", "amount", "to", "the", "current", "value", "associated", "with", "this", "key", ".", "If", "no", "such", "value", "exists", "use", "{", "@link", "#initialValue", "()", "}", "as", "current", "value", "and", "associate", "key", "with", "{", "@link", ...
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/collections/Int2IntCounterMap.java#L268-L306
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.resetPassword
public void resetPassword(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, ResetPasswordPayload resetPasswordPayload) { resetPasswordWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).toBlocking().last().body(); }
java
public void resetPassword(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, ResetPasswordPayload resetPasswordPayload) { resetPasswordWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).toBlocking().last().body(); }
[ "public", "void", "resetPassword", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ",", "ResetPasswordPayload", "resetPasswordPayload", ")", "{", "r...
Resets the user password on an environment This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param resetPasswordPayload Represents the payload for resetting passwords. @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
[ "Resets", "the", "user", "password", "on", "an", "environment", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L1179-L1181
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java
SlotPoolImpl.scheduleRunAsync
protected void scheduleRunAsync(Runnable runnable, long delay, TimeUnit unit) { componentMainThreadExecutor.schedule(runnable, delay, unit); }
java
protected void scheduleRunAsync(Runnable runnable, long delay, TimeUnit unit) { componentMainThreadExecutor.schedule(runnable, delay, unit); }
[ "protected", "void", "scheduleRunAsync", "(", "Runnable", "runnable", ",", "long", "delay", ",", "TimeUnit", "unit", ")", "{", "componentMainThreadExecutor", ".", "schedule", "(", "runnable", ",", "delay", ",", "unit", ")", ";", "}" ]
Execute the runnable in the main thread of the underlying RPC endpoint, with a delay of the given number of milliseconds. @param runnable Runnable to be executed @param delay The delay after which the runnable will be executed
[ "Execute", "the", "runnable", "in", "the", "main", "thread", "of", "the", "underlying", "RPC", "endpoint", "with", "a", "delay", "of", "the", "given", "number", "of", "milliseconds", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L889-L891
mikereedell/sunrisesunsetlib-java
src/main/java/com/luckycatlabs/sunrisesunset/SunriseSunsetCalculator.java
SunriseSunsetCalculator.getSunset
public static Calendar getSunset(double latitude, double longitude, TimeZone timeZone, Calendar date, double degrees) { SolarEventCalculator solarEventCalculator = new SolarEventCalculator(new Location(latitude, longitude), timeZone); return solarEventCalculator.computeSunsetCalendar(new Zenith(90 - degrees), date); }
java
public static Calendar getSunset(double latitude, double longitude, TimeZone timeZone, Calendar date, double degrees) { SolarEventCalculator solarEventCalculator = new SolarEventCalculator(new Location(latitude, longitude), timeZone); return solarEventCalculator.computeSunsetCalendar(new Zenith(90 - degrees), date); }
[ "public", "static", "Calendar", "getSunset", "(", "double", "latitude", ",", "double", "longitude", ",", "TimeZone", "timeZone", ",", "Calendar", "date", ",", "double", "degrees", ")", "{", "SolarEventCalculator", "solarEventCalculator", "=", "new", "SolarEventCalcu...
Computes the sunset for an arbitrary declination. @param latitude @param longitude Coordinates for the location to compute the sunrise/sunset for. @param timeZone timezone to compute the sunrise/sunset times in. @param date <code>Calendar</code> object containing the date to compute the official sunset for. @param degrees Angle under the horizon for which to compute sunrise. For example, "civil sunset" corresponds to 6 degrees. @return the requested sunset time as a <code>Calendar</code> object.
[ "Computes", "the", "sunset", "for", "an", "arbitrary", "declination", "." ]
train
https://github.com/mikereedell/sunrisesunsetlib-java/blob/6e6de23f1d11429eef58de2541582cbde9b85b92/src/main/java/com/luckycatlabs/sunrisesunset/SunriseSunsetCalculator.java#L277-L280
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.accessRestriction_ip_id_PUT
public void accessRestriction_ip_id_PUT(Long id, OvhIpRestriction body) throws IOException { String qPath = "/me/accessRestriction/ip/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void accessRestriction_ip_id_PUT(Long id, OvhIpRestriction body) throws IOException { String qPath = "/me/accessRestriction/ip/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "accessRestriction_ip_id_PUT", "(", "Long", "id", ",", "OvhIpRestriction", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/accessRestriction/ip/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", "...
Alter this object properties REST: PUT /me/accessRestriction/ip/{id} @param body [required] New object properties @param id [required] The Id of the restriction
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4107-L4111
openbase/jul
extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/ProtoBufBuilderProcessor.java
ProtoBufBuilderProcessor.addDefaultInstanceToRepeatedField
public static AbstractMessage.Builder addDefaultInstanceToRepeatedField(final int repeatedFieldNumber, final AbstractMessage.Builder builder) throws CouldNotPerformException { return addDefaultInstanceToRepeatedField(builder.getDescriptorForType().findFieldByNumber(repeatedFieldNumber), builder); }
java
public static AbstractMessage.Builder addDefaultInstanceToRepeatedField(final int repeatedFieldNumber, final AbstractMessage.Builder builder) throws CouldNotPerformException { return addDefaultInstanceToRepeatedField(builder.getDescriptorForType().findFieldByNumber(repeatedFieldNumber), builder); }
[ "public", "static", "AbstractMessage", ".", "Builder", "addDefaultInstanceToRepeatedField", "(", "final", "int", "repeatedFieldNumber", ",", "final", "AbstractMessage", ".", "Builder", "builder", ")", "throws", "CouldNotPerformException", "{", "return", "addDefaultInstanceT...
Method adds a new default message instance to the repeated field and return it's builder instance. @param repeatedFieldNumber The field number of the repeated field. @param builder The builder instance of the message which contains the repeated field. @return The builder instance of the new added message is returned. @throws CouldNotPerformException
[ "Method", "adds", "a", "new", "default", "message", "instance", "to", "the", "repeated", "field", "and", "return", "it", "s", "builder", "instance", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/ProtoBufBuilderProcessor.java#L237-L239
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java
ApacheHTTPClient.setupHTTPRequestHeaderProperties
protected void setupHTTPRequestHeaderProperties(HTTPRequest httpRequest,HttpMethodBase httpMethodClient) { //setup header properties Properties headerProperties=httpRequest.getHeaderProperties(); if(headerProperties!=null) { Iterator<Entry<Object,Object>> iterator=headerProperties.entrySet().iterator(); Entry<Object,Object> entry=null; while(iterator.hasNext()) { //get next entry entry=iterator.next(); //set header values httpMethodClient.addRequestHeader((String)entry.getKey(),(String)entry.getValue()); } } }
java
protected void setupHTTPRequestHeaderProperties(HTTPRequest httpRequest,HttpMethodBase httpMethodClient) { //setup header properties Properties headerProperties=httpRequest.getHeaderProperties(); if(headerProperties!=null) { Iterator<Entry<Object,Object>> iterator=headerProperties.entrySet().iterator(); Entry<Object,Object> entry=null; while(iterator.hasNext()) { //get next entry entry=iterator.next(); //set header values httpMethodClient.addRequestHeader((String)entry.getKey(),(String)entry.getValue()); } } }
[ "protected", "void", "setupHTTPRequestHeaderProperties", "(", "HTTPRequest", "httpRequest", ",", "HttpMethodBase", "httpMethodClient", ")", "{", "//setup header properties", "Properties", "headerProperties", "=", "httpRequest", ".", "getHeaderProperties", "(", ")", ";", "if...
This function sets the header properties in the HTTP method. @param httpRequest The HTTP request @param httpMethodClient The apache HTTP method
[ "This", "function", "sets", "the", "header", "properties", "in", "the", "HTTP", "method", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java#L255-L272
kiswanij/jk-util
src/main/java/com/jk/util/JKIOUtil.java
JKIOUtil.convertToString
public static String convertToString(InputStream input) throws IOException { try { if (input == null) { throw new IOException("Input Stream Cannot be NULL"); } StringBuilder sb1 = new StringBuilder(); String line; try { BufferedReader r1 = new BufferedReader(new InputStreamReader(input, "UTF-8")); while ((line = r1.readLine()) != null) { sb1.append(line); } } finally { input.close(); } return sb1.toString(); } catch (IOException e) { throw new JKException(e); } }
java
public static String convertToString(InputStream input) throws IOException { try { if (input == null) { throw new IOException("Input Stream Cannot be NULL"); } StringBuilder sb1 = new StringBuilder(); String line; try { BufferedReader r1 = new BufferedReader(new InputStreamReader(input, "UTF-8")); while ((line = r1.readLine()) != null) { sb1.append(line); } } finally { input.close(); } return sb1.toString(); } catch (IOException e) { throw new JKException(e); } }
[ "public", "static", "String", "convertToString", "(", "InputStream", "input", ")", "throws", "IOException", "{", "try", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Input Stream Cannot be NULL\"", ")", ";", "}", "Stri...
Convert to string. @param input the input @return the string @throws IOException Signals that an I/O exception has occurred.
[ "Convert", "to", "string", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L205-L224
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java
SlotSharingGroupAssignment.getSlotForTask
public SimpleSlot getSlotForTask(JobVertexID vertexID, Iterable<TaskManagerLocation> locationPreferences) { synchronized (lock) { Tuple2<SharedSlot, Locality> p = getSharedSlotForTask(vertexID, locationPreferences, false); if (p != null) { SharedSlot ss = p.f0; SimpleSlot slot = ss.allocateSubSlot(vertexID); slot.setLocality(p.f1); return slot; } else { return null; } } }
java
public SimpleSlot getSlotForTask(JobVertexID vertexID, Iterable<TaskManagerLocation> locationPreferences) { synchronized (lock) { Tuple2<SharedSlot, Locality> p = getSharedSlotForTask(vertexID, locationPreferences, false); if (p != null) { SharedSlot ss = p.f0; SimpleSlot slot = ss.allocateSubSlot(vertexID); slot.setLocality(p.f1); return slot; } else { return null; } } }
[ "public", "SimpleSlot", "getSlotForTask", "(", "JobVertexID", "vertexID", ",", "Iterable", "<", "TaskManagerLocation", ">", "locationPreferences", ")", "{", "synchronized", "(", "lock", ")", "{", "Tuple2", "<", "SharedSlot", ",", "Locality", ">", "p", "=", "getS...
Gets a slot suitable for the given task vertex. This method will prefer slots that are local (with respect to {@link ExecutionVertex#getPreferredLocationsBasedOnInputs()}), but will return non local slots if no local slot is available. The method returns null, when this sharing group has no slot available for the given JobVertexID. @param vertexID the vertex id @param locationPreferences location preferences @return A slot to execute the given ExecutionVertex in, or null, if none is available.
[ "Gets", "a", "slot", "suitable", "for", "the", "given", "task", "vertex", ".", "This", "method", "will", "prefer", "slots", "that", "are", "local", "(", "with", "respect", "to", "{", "@link", "ExecutionVertex#getPreferredLocationsBasedOnInputs", "()", "}", ")", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java#L275-L289
mangstadt/biweekly
src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java
ICalPropertyScribe._parseXml
protected T _parseXml(XCalElement element, ICalParameters parameters, ParseContext context) { XCalValue firstValue = element.firstValue(); ICalDataType dataType = firstValue.getDataType(); String value = VObjectPropertyValues.escape(firstValue.getValue()); return _parseText(value, dataType, parameters, context); }
java
protected T _parseXml(XCalElement element, ICalParameters parameters, ParseContext context) { XCalValue firstValue = element.firstValue(); ICalDataType dataType = firstValue.getDataType(); String value = VObjectPropertyValues.escape(firstValue.getValue()); return _parseText(value, dataType, parameters, context); }
[ "protected", "T", "_parseXml", "(", "XCalElement", "element", ",", "ICalParameters", "parameters", ",", "ParseContext", "context", ")", "{", "XCalValue", "firstValue", "=", "element", ".", "firstValue", "(", ")", ";", "ICalDataType", "dataType", "=", "firstValue",...
<p> Unmarshals a property from an XML document (xCal). </p> <p> This method should be overridden by child classes that wish to support xCal. The default implementation of this method will find the first child element with the xCal namespace. The element's name will be used as the property's data type and its text content will be passed into the {@link #_parseText} method. If no such child element is found, then the parent element's text content will be passed into {@link #_parseText} and the data type will be null. </p> @param element the property's XML element @param parameters the parsed parameters. These parameters will be assigned to the property object once this method returns. Therefore, do not assign any parameters to the property object itself whilst inside of this method, or else they will be overwritten. @param context the context @return the unmarshalled property object @throws CannotParseException if the scribe could not parse the property's value @throws SkipMeException if the property should not be added to the final {@link ICalendar} object
[ "<p", ">", "Unmarshals", "a", "property", "from", "an", "XML", "document", "(", "xCal", ")", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "should", "be", "overridden", "by", "child", "classes", "that", "wish", "to", "support", "xCal", ".", "...
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java#L448-L453
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileUtil.java
FileUtil.makeShellPath
public static String makeShellPath(File file, boolean makeCanonicalPath) throws IOException { if (makeCanonicalPath) { return makeShellPath(file.getCanonicalPath()); } else { return makeShellPath(file.toString()); } }
java
public static String makeShellPath(File file, boolean makeCanonicalPath) throws IOException { if (makeCanonicalPath) { return makeShellPath(file.getCanonicalPath()); } else { return makeShellPath(file.toString()); } }
[ "public", "static", "String", "makeShellPath", "(", "File", "file", ",", "boolean", "makeCanonicalPath", ")", "throws", "IOException", "{", "if", "(", "makeCanonicalPath", ")", "{", "return", "makeShellPath", "(", "file", ".", "getCanonicalPath", "(", ")", ")", ...
Convert a os-native filename to a path that works for the shell. @param file The filename to convert @param makeCanonicalPath Whether to make canonical path for the file passed @return The unix pathname @throws IOException on windows, there can be problems with the subprocess
[ "Convert", "a", "os", "-", "native", "filename", "to", "a", "path", "that", "works", "for", "the", "shell", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L592-L599
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java
SquareGridTools.orderNodeGrid
protected void orderNodeGrid(SquareGrid grid, int row, int col) { SquareNode node = grid.get(row,col); if(grid.rows==1 && grid.columns==1 ) { for (int i = 0; i < 4; i++) { ordered[i] = node.square.get(i); } } else if( grid.columns==1 ) { if (row == grid.rows - 1) { orderNode(node, grid.get(row - 1, col), false); rotateTwiceOrdered(); } else { orderNode(node, grid.get(row + 1, col), false); } } else { if( col == grid.columns-1) { orderNode(node, grid.get(row, col-1), true); rotateTwiceOrdered(); } else { orderNode(node, grid.get(row, col+1), true); } } }
java
protected void orderNodeGrid(SquareGrid grid, int row, int col) { SquareNode node = grid.get(row,col); if(grid.rows==1 && grid.columns==1 ) { for (int i = 0; i < 4; i++) { ordered[i] = node.square.get(i); } } else if( grid.columns==1 ) { if (row == grid.rows - 1) { orderNode(node, grid.get(row - 1, col), false); rotateTwiceOrdered(); } else { orderNode(node, grid.get(row + 1, col), false); } } else { if( col == grid.columns-1) { orderNode(node, grid.get(row, col-1), true); rotateTwiceOrdered(); } else { orderNode(node, grid.get(row, col+1), true); } } }
[ "protected", "void", "orderNodeGrid", "(", "SquareGrid", "grid", ",", "int", "row", ",", "int", "col", ")", "{", "SquareNode", "node", "=", "grid", ".", "get", "(", "row", ",", "col", ")", ";", "if", "(", "grid", ".", "rows", "==", "1", "&&", "grid...
Given the grid coordinate, order the corners for the node at that location. Takes in handles situations where there are no neighbors.
[ "Given", "the", "grid", "coordinate", "order", "the", "corners", "for", "the", "node", "at", "that", "location", ".", "Takes", "in", "handles", "situations", "where", "there", "are", "no", "neighbors", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java#L223-L245
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java
BouncyCastleCertProcessingFactory.createCredential
public X509Credential createCredential(X509Certificate[] certs, PrivateKey privateKey, int bits, int lifetime, GSIConstants.DelegationType delegType, X509ExtensionSet extSet, String cnValue) throws GeneralSecurityException { X509Certificate[] bcCerts = getX509CertificateObjectChain(certs); return createCredential(bcCerts, privateKey, bits, lifetime, decideProxyType(bcCerts[0], delegType), extSet, cnValue); }
java
public X509Credential createCredential(X509Certificate[] certs, PrivateKey privateKey, int bits, int lifetime, GSIConstants.DelegationType delegType, X509ExtensionSet extSet, String cnValue) throws GeneralSecurityException { X509Certificate[] bcCerts = getX509CertificateObjectChain(certs); return createCredential(bcCerts, privateKey, bits, lifetime, decideProxyType(bcCerts[0], delegType), extSet, cnValue); }
[ "public", "X509Credential", "createCredential", "(", "X509Certificate", "[", "]", "certs", ",", "PrivateKey", "privateKey", ",", "int", "bits", ",", "int", "lifetime", ",", "GSIConstants", ".", "DelegationType", "delegType", ",", "X509ExtensionSet", "extSet", ",", ...
Creates a new proxy credential from the specified certificate chain and a private key, using the given delegation mode. @see #createCredential(X509Certificate[], PrivateKey, int, int, GSIConstants.CertificateType, X509ExtensionSet, String)
[ "Creates", "a", "new", "proxy", "credential", "from", "the", "specified", "certificate", "chain", "and", "a", "private", "key", "using", "the", "given", "delegation", "mode", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java#L694-L700
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java
RegistriesInner.importImageAsync
public Observable<Void> importImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters) { return importImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> importImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters) { return importImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "importImageAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "ImportImageParameters", "parameters", ")", "{", "return", "importImageWithServiceResponseAsync", "(", "resourceGroupName", ",", "registry...
Copies an image to this container registry from the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param parameters The parameters specifying the image to copy and the source container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Copies", "an", "image", "to", "this", "container", "registry", "from", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L193-L200
GII/broccoli
broccoli-impl/src/main/java/com/hi3project/broccoli/bsdl/impl/parsing/xml/AxiomAssign.java
AxiomAssign.assignParsedElement
public boolean assignParsedElement(Multiplicity parsedMultiplicity, String syntaxElementName, ISyntaxElement syntaxElement) throws ModelException { if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MIN()) && syntaxElement instanceof SimpleProperty) { if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) { parsedMultiplicity.setMin(null); } else { parsedMultiplicity.setMin(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString())); } return true; } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MAX()) && syntaxElement instanceof SimpleProperty) { if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) { parsedMultiplicity.setMax(null); } else { parsedMultiplicity.setMax(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString())); } return true; } return false; }
java
public boolean assignParsedElement(Multiplicity parsedMultiplicity, String syntaxElementName, ISyntaxElement syntaxElement) throws ModelException { if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MIN()) && syntaxElement instanceof SimpleProperty) { if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) { parsedMultiplicity.setMin(null); } else { parsedMultiplicity.setMin(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString())); } return true; } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MAX()) && syntaxElement instanceof SimpleProperty) { if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) { parsedMultiplicity.setMax(null); } else { parsedMultiplicity.setMax(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString())); } return true; } return false; }
[ "public", "boolean", "assignParsedElement", "(", "Multiplicity", "parsedMultiplicity", ",", "String", "syntaxElementName", ",", "ISyntaxElement", "syntaxElement", ")", "throws", "ModelException", "{", "if", "(", "syntaxElementName", ".", "equalsIgnoreCase", "(", "XMLSynta...
/* A property: -has a min: number or "*" -has a max: number or "*"
[ "/", "*", "A", "property", ":", "-", "has", "a", "min", ":", "number", "or", "*", "-", "has", "a", "max", ":", "number", "or", "*" ]
train
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-impl/src/main/java/com/hi3project/broccoli/bsdl/impl/parsing/xml/AxiomAssign.java#L327-L345
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.addWorkplaceServer
public void addWorkplaceServer(String workplaceServer, String sslmode) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } if (!m_workplaceServers.containsKey(workplaceServer)) { m_workplaceServers.put(workplaceServer, CmsSSLMode.getModeFromXML(sslmode)); } }
java
public void addWorkplaceServer(String workplaceServer, String sslmode) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } if (!m_workplaceServers.containsKey(workplaceServer)) { m_workplaceServers.put(workplaceServer, CmsSSLMode.getModeFromXML(sslmode)); } }
[ "public", "void", "addWorkplaceServer", "(", "String", "workplaceServer", ",", "String", "sslmode", ")", "{", "if", "(", "m_frozen", ")", "{", "throw", "new", "CmsRuntimeException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", "....
Adds a workplace server, this is only allowed during configuration.<p> @param workplaceServer the workplace server @param sslmode CmsSSLMode of workplace server
[ "Adds", "a", "workplace", "server", "this", "is", "only", "allowed", "during", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L466-L474
UrielCh/ovh-java-sdk
ovh-java-sdk-licensesqlserver/src/main/java/net/minidev/ovh/api/ApiOvhLicensesqlserver.java
ApiOvhLicensesqlserver.orderableVersions_GET
public ArrayList<OvhSqlServerOrderConfiguration> orderableVersions_GET(String ip) throws IOException { String qPath = "/license/sqlserver/orderableVersions"; StringBuilder sb = path(qPath); query(sb, "ip", ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
java
public ArrayList<OvhSqlServerOrderConfiguration> orderableVersions_GET(String ip) throws IOException { String qPath = "/license/sqlserver/orderableVersions"; StringBuilder sb = path(qPath); query(sb, "ip", ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
[ "public", "ArrayList", "<", "OvhSqlServerOrderConfiguration", ">", "orderableVersions_GET", "(", "String", "ip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/license/sqlserver/orderableVersions\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath",...
Get the orderable Sql Server versions REST: GET /license/sqlserver/orderableVersions @param ip [required] Your license Ip
[ "Get", "the", "orderable", "Sql", "Server", "versions" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-licensesqlserver/src/main/java/net/minidev/ovh/api/ApiOvhLicensesqlserver.java#L153-L159
zeromq/jeromq
src/main/java/org/zeromq/ZFrame.java
ZFrame.recvFrame
public static ZFrame recvFrame(Socket socket, int flags) { ZFrame f = new ZFrame(); byte[] data = f.recv(socket, flags); if (data == null) { return null; } return f; }
java
public static ZFrame recvFrame(Socket socket, int flags) { ZFrame f = new ZFrame(); byte[] data = f.recv(socket, flags); if (data == null) { return null; } return f; }
[ "public", "static", "ZFrame", "recvFrame", "(", "Socket", "socket", ",", "int", "flags", ")", "{", "ZFrame", "f", "=", "new", "ZFrame", "(", ")", ";", "byte", "[", "]", "data", "=", "f", ".", "recv", "(", "socket", ",", "flags", ")", ";", "if", "...
Receive a new frame off the socket, Returns newly-allocated frame, or null if there was no input waiting, or if the read was interrupted. @param socket Socket to read from @param flags Pass flags to 0MQ socket.recv call @return received frame, else null
[ "Receive", "a", "new", "frame", "off", "the", "socket", "Returns", "newly", "-", "allocated", "frame", "or", "null", "if", "there", "was", "no", "input", "waiting", "or", "if", "the", "read", "was", "interrupted", "." ]
train
https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/ZFrame.java#L342-L350
windup/windup
config/api/src/main/java/org/jboss/windup/config/GraphRewrite.java
GraphRewrite.ruleEvaluationProgress
public boolean ruleEvaluationProgress(String name, int currentPosition, int total, int timeRemainingInSeconds) { boolean windupStopRequested = false; for (RuleLifecycleListener listener : listeners) windupStopRequested = listener.ruleEvaluationProgress(this, name, currentPosition, total, timeRemainingInSeconds); return windupStopRequested; } public boolean shouldWindupStop() { for (RuleLifecycleListener listener : listeners) if (listener.shouldWindupStop()) return true; return false; } }
java
public boolean ruleEvaluationProgress(String name, int currentPosition, int total, int timeRemainingInSeconds) { boolean windupStopRequested = false; for (RuleLifecycleListener listener : listeners) windupStopRequested = listener.ruleEvaluationProgress(this, name, currentPosition, total, timeRemainingInSeconds); return windupStopRequested; } public boolean shouldWindupStop() { for (RuleLifecycleListener listener : listeners) if (listener.shouldWindupStop()) return true; return false; } }
[ "public", "boolean", "ruleEvaluationProgress", "(", "String", "name", ",", "int", "currentPosition", ",", "int", "total", ",", "int", "timeRemainingInSeconds", ")", "{", "boolean", "windupStopRequested", "=", "false", ";", "for", "(", "RuleLifecycleListener", "liste...
This is optionally called by long-running rules to indicate their current progress and estimated time-remaining.
[ "This", "is", "optionally", "called", "by", "long", "-", "running", "rules", "to", "indicate", "their", "current", "progress", "and", "estimated", "time", "-", "remaining", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/GraphRewrite.java#L93-L109
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/REEFLauncher.java
REEFLauncher.main
@SuppressWarnings("checkstyle:illegalcatch") public static void main(final String[] args) { LOG.log(Level.INFO, "Entering REEFLauncher.main()."); LOG.log(Level.FINE, "REEFLauncher started with user name [{0}]", System.getProperty("user.name")); LOG.log(Level.FINE, "REEFLauncher started. Assertions are {0} in this process.", EnvironmentUtils.areAssertionsEnabled() ? "ENABLED" : "DISABLED"); if (args.length != 1) { final String message = "REEFLauncher have one and only one argument to specify the runtime clock " + "configuration path"; throw fatal(message, new IllegalArgumentException(message)); } final REEFLauncher launcher = getREEFLauncher(args[0]); Thread.setDefaultUncaughtExceptionHandler(new REEFUncaughtExceptionHandler(launcher.envConfig)); try (final REEFEnvironment reef = REEFEnvironment.fromConfiguration(launcher.envConfig)) { reef.run(); } catch (final Throwable ex) { throw fatal("Unable to configure and start REEFEnvironment.", ex); } ThreadLogger.logThreads(LOG, Level.FINEST, "Threads running after REEFEnvironment.close():"); LOG.log(Level.INFO, "Exiting REEFLauncher.main()"); System.exit(0); // TODO[REEF-1715]: Should be able to exit cleanly at the end of main() }
java
@SuppressWarnings("checkstyle:illegalcatch") public static void main(final String[] args) { LOG.log(Level.INFO, "Entering REEFLauncher.main()."); LOG.log(Level.FINE, "REEFLauncher started with user name [{0}]", System.getProperty("user.name")); LOG.log(Level.FINE, "REEFLauncher started. Assertions are {0} in this process.", EnvironmentUtils.areAssertionsEnabled() ? "ENABLED" : "DISABLED"); if (args.length != 1) { final String message = "REEFLauncher have one and only one argument to specify the runtime clock " + "configuration path"; throw fatal(message, new IllegalArgumentException(message)); } final REEFLauncher launcher = getREEFLauncher(args[0]); Thread.setDefaultUncaughtExceptionHandler(new REEFUncaughtExceptionHandler(launcher.envConfig)); try (final REEFEnvironment reef = REEFEnvironment.fromConfiguration(launcher.envConfig)) { reef.run(); } catch (final Throwable ex) { throw fatal("Unable to configure and start REEFEnvironment.", ex); } ThreadLogger.logThreads(LOG, Level.FINEST, "Threads running after REEFEnvironment.close():"); LOG.log(Level.INFO, "Exiting REEFLauncher.main()"); System.exit(0); // TODO[REEF-1715]: Should be able to exit cleanly at the end of main() }
[ "@", "SuppressWarnings", "(", "\"checkstyle:illegalcatch\"", ")", "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "{", "LOG", ".", "log", "(", "Level", ".", "INFO", ",", "\"Entering REEFLauncher.main().\"", ")", ";", "LOG", ...
Launches a REEF client process (Driver or Evaluator). @param args Command-line arguments. Must be a single element containing local path to the configuration file.
[ "Launches", "a", "REEF", "client", "process", "(", "Driver", "or", "Evaluator", ")", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/REEFLauncher.java#L160-L191
OpenLiberty/open-liberty
dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/OSGiInjectionScopeData.java
OSGiInjectionScopeData.getInjectionBinding
public InjectionBinding<?> getInjectionBinding(NamingConstants.JavaColonNamespace namespace, String name) throws NamingException { if (namespace == NamingConstants.JavaColonNamespace.COMP) { return lookup(compLock, compBindings, name); } if (namespace == NamingConstants.JavaColonNamespace.COMP_ENV) { return lookup(compLock, compEnvBindings, name); } if (namespace == this.namespace) { NonCompBinding nonCompBinding = lookup(nonCompEnvLock, nonCompBindings, name); return nonCompBinding == null ? null : nonCompBinding.binding; } return null; }
java
public InjectionBinding<?> getInjectionBinding(NamingConstants.JavaColonNamespace namespace, String name) throws NamingException { if (namespace == NamingConstants.JavaColonNamespace.COMP) { return lookup(compLock, compBindings, name); } if (namespace == NamingConstants.JavaColonNamespace.COMP_ENV) { return lookup(compLock, compEnvBindings, name); } if (namespace == this.namespace) { NonCompBinding nonCompBinding = lookup(nonCompEnvLock, nonCompBindings, name); return nonCompBinding == null ? null : nonCompBinding.binding; } return null; }
[ "public", "InjectionBinding", "<", "?", ">", "getInjectionBinding", "(", "NamingConstants", ".", "JavaColonNamespace", "namespace", ",", "String", "name", ")", "throws", "NamingException", "{", "if", "(", "namespace", "==", "NamingConstants", ".", "JavaColonNamespace"...
Gets the injection binding for a JNDI name. The caller is responsible for calling {@link #processDeferredReferenceData}.
[ "Gets", "the", "injection", "binding", "for", "a", "JNDI", "name", ".", "The", "caller", "is", "responsible", "for", "calling", "{" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/OSGiInjectionScopeData.java#L376-L388
apereo/cas
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java
LdapUtils.getString
public static String getString(final LdapEntry entry, final String attribute, final String nullValue) { val attr = entry.getAttribute(attribute); if (attr == null) { return nullValue; } val v = attr.isBinary() ? new String(attr.getBinaryValue(), StandardCharsets.UTF_8) : attr.getStringValue(); if (StringUtils.isNotBlank(v)) { return v; } return nullValue; }
java
public static String getString(final LdapEntry entry, final String attribute, final String nullValue) { val attr = entry.getAttribute(attribute); if (attr == null) { return nullValue; } val v = attr.isBinary() ? new String(attr.getBinaryValue(), StandardCharsets.UTF_8) : attr.getStringValue(); if (StringUtils.isNotBlank(v)) { return v; } return nullValue; }
[ "public", "static", "String", "getString", "(", "final", "LdapEntry", "entry", ",", "final", "String", "attribute", ",", "final", "String", "nullValue", ")", "{", "val", "attr", "=", "entry", ".", "getAttribute", "(", "attribute", ")", ";", "if", "(", "att...
Reads a String value from the LdapEntry. @param entry the ldap entry @param attribute the attribute name @param nullValue the value which should be returning in case of a null value @return the string
[ "Reads", "a", "String", "value", "from", "the", "LdapEntry", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L202-L216
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/DashboardResources.java
DashboardResources.createDashboard
@POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Description("Creates a dashboard.") public DashboardDto createDashboard(@Context HttpServletRequest req, DashboardDto dashboardDto) { if (dashboardDto == null) { throw new WebApplicationException("Null dashboard object cannot be created.", Status.BAD_REQUEST); } PrincipalUser owner = validateAndGetOwner(req, dashboardDto.getOwnerName()); Dashboard dashboard = new Dashboard(getRemoteUser(req), dashboardDto.getName(), owner); copyProperties(dashboard, dashboardDto); return DashboardDto.transformToDto(dService.updateDashboard(dashboard)); }
java
@POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Description("Creates a dashboard.") public DashboardDto createDashboard(@Context HttpServletRequest req, DashboardDto dashboardDto) { if (dashboardDto == null) { throw new WebApplicationException("Null dashboard object cannot be created.", Status.BAD_REQUEST); } PrincipalUser owner = validateAndGetOwner(req, dashboardDto.getOwnerName()); Dashboard dashboard = new Dashboard(getRemoteUser(req), dashboardDto.getName(), owner); copyProperties(dashboard, dashboardDto); return DashboardDto.transformToDto(dService.updateDashboard(dashboard)); }
[ "@", "POST", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Description", "(", "\"Creates a dashboard.\"", ")", "public", "DashboardDto", "createDashboard", "(", "@", "Context...
Creates a dashboard. @param req The HTTP request. @param dashboardDto The dashboard to create. @return The corresponding updated DTO for the created dashboard. @throws WebApplicationException If an error occurs.
[ "Creates", "a", "dashboard", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/DashboardResources.java#L285-L299
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/gremlin/optimizer/GremlinQueryOptimizer.java
GremlinQueryOptimizer.visitCallHierarchy
public static void visitCallHierarchy(GroovyExpression expr, CallHierarchyVisitor visitor) { if (expr == null) { visitor.visitNullCaller(); return; } if (expr instanceof AbstractFunctionExpression) { AbstractFunctionExpression functionCall = (AbstractFunctionExpression)expr; if (!visitor.preVisitFunctionCaller(functionCall)) { return; } GroovyExpression caller = functionCall.getCaller(); visitCallHierarchy(caller, visitor); if (!visitor.postVisitFunctionCaller(functionCall)) { return; } } else { visitor.visitNonFunctionCaller(expr); } }
java
public static void visitCallHierarchy(GroovyExpression expr, CallHierarchyVisitor visitor) { if (expr == null) { visitor.visitNullCaller(); return; } if (expr instanceof AbstractFunctionExpression) { AbstractFunctionExpression functionCall = (AbstractFunctionExpression)expr; if (!visitor.preVisitFunctionCaller(functionCall)) { return; } GroovyExpression caller = functionCall.getCaller(); visitCallHierarchy(caller, visitor); if (!visitor.postVisitFunctionCaller(functionCall)) { return; } } else { visitor.visitNonFunctionCaller(expr); } }
[ "public", "static", "void", "visitCallHierarchy", "(", "GroovyExpression", "expr", ",", "CallHierarchyVisitor", "visitor", ")", "{", "if", "(", "expr", "==", "null", ")", "{", "visitor", ".", "visitNullCaller", "(", ")", ";", "return", ";", "}", "if", "(", ...
Visits all expressions in the call hierarchy of an expression. For example, in the expression g.V().has('x','y'), the order would be <ol> <li>pre-visit has('x','y')</li> <li>pre-visit V()</li> <li>visit g (non-function caller)</li> <li>post-visit V()</li> <li>post-visit has('x','y')</li> </ol> @param expr @param visitor
[ "Visits", "all", "expressions", "in", "the", "call", "hierarchy", "of", "an", "expression", ".", "For", "example", "in", "the", "expression", "g", ".", "V", "()", ".", "has", "(", "x", "y", ")", "the", "order", "would", "be", "<ol", ">", "<li", ">", ...
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/gremlin/optimizer/GremlinQueryOptimizer.java#L166-L185
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getClosedListEntityRole
public EntityRole getClosedListEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return getClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
java
public EntityRole getClosedListEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return getClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
[ "public", "EntityRole", "getClosedListEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "getClosedListEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId",...
Get one entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity ID. @param roleId entity role ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EntityRole object if successful.
[ "Get", "one", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L11548-L11550
pinterest/secor
src/main/java/com/pinterest/secor/util/ProtobufUtil.java
ProtobufUtil.decodeProtobufOrJsonMessage
public Message decodeProtobufOrJsonMessage(String topic, byte[] payload) { try { if (shouldDecodeFromJsonMessage(topic)) { return decodeJsonMessage(topic, payload); } } catch (InvalidProtocolBufferException e) { //When trimming files, the Uploader will read and then decode messages in protobuf format LOG.debug("Unable to translate JSON string {} to protobuf message", new String(payload, Charsets.UTF_8)); } return decodeProtobufMessage(topic, payload); }
java
public Message decodeProtobufOrJsonMessage(String topic, byte[] payload) { try { if (shouldDecodeFromJsonMessage(topic)) { return decodeJsonMessage(topic, payload); } } catch (InvalidProtocolBufferException e) { //When trimming files, the Uploader will read and then decode messages in protobuf format LOG.debug("Unable to translate JSON string {} to protobuf message", new String(payload, Charsets.UTF_8)); } return decodeProtobufMessage(topic, payload); }
[ "public", "Message", "decodeProtobufOrJsonMessage", "(", "String", "topic", ",", "byte", "[", "]", "payload", ")", "{", "try", "{", "if", "(", "shouldDecodeFromJsonMessage", "(", "topic", ")", ")", "{", "return", "decodeJsonMessage", "(", "topic", ",", "payloa...
Decodes protobuf message If the secor.topic.message.format property is set to "JSON" for "topic" assume "payload" is JSON @param topic Kafka topic name @param payload Byte array containing encoded protobuf or JSON message @return protobuf message instance @throws RuntimeException when there's problem decoding protobuf or JSON message
[ "Decodes", "protobuf", "message", "If", "the", "secor", ".", "topic", ".", "message", ".", "format", "property", "is", "set", "to", "JSON", "for", "topic", "assume", "payload", "is", "JSON" ]
train
https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ProtobufUtil.java#L208-L218
samskivert/pythagoras
src/main/java/pythagoras/d/Quaternion.java
Quaternion.fromVectorFromNegativeZ
public Quaternion fromVectorFromNegativeZ (double tx, double ty, double tz) { double angle = Math.acos(-tz); if (angle < MathUtil.EPSILON) { return set(IDENTITY); } if (angle > Math.PI - MathUtil.EPSILON) { return set(0f, 1f, 0f, 0f); // 180 degrees about y } double len = Math.hypot(tx, ty); return fromAngleAxis(angle, ty/len, -tx/len, 0f); }
java
public Quaternion fromVectorFromNegativeZ (double tx, double ty, double tz) { double angle = Math.acos(-tz); if (angle < MathUtil.EPSILON) { return set(IDENTITY); } if (angle > Math.PI - MathUtil.EPSILON) { return set(0f, 1f, 0f, 0f); // 180 degrees about y } double len = Math.hypot(tx, ty); return fromAngleAxis(angle, ty/len, -tx/len, 0f); }
[ "public", "Quaternion", "fromVectorFromNegativeZ", "(", "double", "tx", ",", "double", "ty", ",", "double", "tz", ")", "{", "double", "angle", "=", "Math", ".", "acos", "(", "-", "tz", ")", ";", "if", "(", "angle", "<", "MathUtil", ".", "EPSILON", ")",...
Sets this quaternion to the rotation of (0, 0, -1) onto the supplied normalized vector. @return a reference to the quaternion, for chaining.
[ "Sets", "this", "quaternion", "to", "the", "rotation", "of", "(", "0", "0", "-", "1", ")", "onto", "the", "supplied", "normalized", "vector", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Quaternion.java#L120-L130
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java
VersionsImpl.deleteUnlabelledUtteranceAsync
public Observable<OperationStatus> deleteUnlabelledUtteranceAsync(UUID appId, String versionId, String utterance) { return deleteUnlabelledUtteranceWithServiceResponseAsync(appId, versionId, utterance).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deleteUnlabelledUtteranceAsync(UUID appId, String versionId, String utterance) { return deleteUnlabelledUtteranceWithServiceResponseAsync(appId, versionId, utterance).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deleteUnlabelledUtteranceAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "String", "utterance", ")", "{", "return", "deleteUnlabelledUtteranceWithServiceResponseAsync", "(", "appId", ",", "versionId", ...
Deleted an unlabelled utterance. @param appId The application ID. @param versionId The version ID. @param utterance The utterance text to delete. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Deleted", "an", "unlabelled", "utterance", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L1071-L1078
walkmod/walkmod-core
src/main/java/org/walkmod/util/location/LocationAttributes.java
LocationAttributes.getLocation
public static Location getLocation(Attributes attrs, String description) { String src = attrs.getValue(URI, SRC_ATTR); if (src == null) { return LocationImpl.UNKNOWN; } return new LocationImpl(description, src, getLine(attrs), getColumn(attrs)); }
java
public static Location getLocation(Attributes attrs, String description) { String src = attrs.getValue(URI, SRC_ATTR); if (src == null) { return LocationImpl.UNKNOWN; } return new LocationImpl(description, src, getLine(attrs), getColumn(attrs)); }
[ "public", "static", "Location", "getLocation", "(", "Attributes", "attrs", ",", "String", "description", ")", "{", "String", "src", "=", "attrs", ".", "getValue", "(", "URI", ",", "SRC_ATTR", ")", ";", "if", "(", "src", "==", "null", ")", "{", "return", ...
Returns the {@link Location} of an element (SAX flavor). @param attrs the element's attributes that hold the location information @param description a description for the location (can be null) @return a {@link Location} object
[ "Returns", "the", "{", "@link", "Location", "}", "of", "an", "element", "(", "SAX", "flavor", ")", "." ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/util/location/LocationAttributes.java#L85-L91
vkostyukov/la4j
src/main/java/org/la4j/Vectors.java
Vectors.asPlusFunction
public static VectorFunction asPlusFunction(final double arg) { return new VectorFunction() { @Override public double evaluate(int i, double value) { return value + arg; } }; }
java
public static VectorFunction asPlusFunction(final double arg) { return new VectorFunction() { @Override public double evaluate(int i, double value) { return value + arg; } }; }
[ "public", "static", "VectorFunction", "asPlusFunction", "(", "final", "double", "arg", ")", "{", "return", "new", "VectorFunction", "(", ")", "{", "@", "Override", "public", "double", "evaluate", "(", "int", "i", ",", "double", "value", ")", "{", "return", ...
Creates a plus function that adds given {@code value} to it's argument. @param arg a value to be added to function's argument @return a closure object that does {@code _ + _}
[ "Creates", "a", "plus", "function", "that", "adds", "given", "{", "@code", "value", "}", "to", "it", "s", "argument", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L154-L161
apache/flink
flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java
FieldParser.resetErrorStateAndParse
public int resetErrorStateAndParse(byte[] bytes, int startPos, int limit, byte[] delim, T reuse) { resetParserState(); return parseField(bytes, startPos, limit, delim, reuse); }
java
public int resetErrorStateAndParse(byte[] bytes, int startPos, int limit, byte[] delim, T reuse) { resetParserState(); return parseField(bytes, startPos, limit, delim, reuse); }
[ "public", "int", "resetErrorStateAndParse", "(", "byte", "[", "]", "bytes", ",", "int", "startPos", ",", "int", "limit", ",", "byte", "[", "]", "delim", ",", "T", "reuse", ")", "{", "resetParserState", "(", ")", ";", "return", "parseField", "(", "bytes",...
Parses the value of a field from the byte array, taking care of properly reset the state of this parser. The start position within the byte array and the array's valid length is given. The content of the value is delimited by a field delimiter. @param bytes The byte array that holds the value. @param startPos The index where the field starts @param limit The limit unto which the byte contents is valid for the parser. The limit is the position one after the last valid byte. @param delim The field delimiter character @param reuse An optional reusable field to hold the value @return The index of the next delimiter, if the field was parsed correctly. A value less than 0 otherwise.
[ "Parses", "the", "value", "of", "a", "field", "from", "the", "byte", "array", "taking", "care", "of", "properly", "reset", "the", "state", "of", "this", "parser", ".", "The", "start", "position", "within", "the", "byte", "array", "and", "the", "array", "...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java#L102-L105
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java
RouteFilterRulesInner.beginCreateOrUpdateAsync
public Observable<RouteFilterRuleInner> beginCreateOrUpdateAsync(String resourceGroupName, String routeFilterName, String ruleName, RouteFilterRuleInner routeFilterRuleParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters).map(new Func1<ServiceResponse<RouteFilterRuleInner>, RouteFilterRuleInner>() { @Override public RouteFilterRuleInner call(ServiceResponse<RouteFilterRuleInner> response) { return response.body(); } }); }
java
public Observable<RouteFilterRuleInner> beginCreateOrUpdateAsync(String resourceGroupName, String routeFilterName, String ruleName, RouteFilterRuleInner routeFilterRuleParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters).map(new Func1<ServiceResponse<RouteFilterRuleInner>, RouteFilterRuleInner>() { @Override public RouteFilterRuleInner call(ServiceResponse<RouteFilterRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RouteFilterRuleInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "routeFilterName", ",", "String", "ruleName", ",", "RouteFilterRuleInner", "routeFilterRuleParameters", ")", "{", "return", "beginCreateO...
Creates or updates a route in the specified route filter. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param ruleName The name of the route filter rule. @param routeFilterRuleParameters Parameters supplied to the create or update route filter rule operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RouteFilterRuleInner object
[ "Creates", "or", "updates", "a", "route", "in", "the", "specified", "route", "filter", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java#L483-L490
vst/commons-math-extensions
src/main/java/com/vsthost/rnd/commons/math/ext/linear/EMatrixUtils.java
EMatrixUtils.rbind
public static RealMatrix rbind (RealMatrix m1, RealMatrix m2) { return MatrixUtils.createRealMatrix(ArrayUtils.addAll(m1.getData(), m2.getData())); }
java
public static RealMatrix rbind (RealMatrix m1, RealMatrix m2) { return MatrixUtils.createRealMatrix(ArrayUtils.addAll(m1.getData(), m2.getData())); }
[ "public", "static", "RealMatrix", "rbind", "(", "RealMatrix", "m1", ",", "RealMatrix", "m2", ")", "{", "return", "MatrixUtils", ".", "createRealMatrix", "(", "ArrayUtils", ".", "addAll", "(", "m1", ".", "getData", "(", ")", ",", "m2", ".", "getData", "(", ...
Appends to matrices by rows. @param m1 The first matrix @param m2 The second matrix. @return Returns the new row-bound matrix.
[ "Appends", "to", "matrices", "by", "rows", "." ]
train
https://github.com/vst/commons-math-extensions/blob/a11ee78ffe53ab7c016062be93c5af07aa8e1823/src/main/java/com/vsthost/rnd/commons/math/ext/linear/EMatrixUtils.java#L285-L287
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhDbaastimeseries.java
ApiOvhDbaastimeseries.serviceName_setup_POST
public net.minidev.ovh.api.paas.timeseries.OvhProject serviceName_setup_POST(String serviceName, String description, String displayName, String raTokenId, String raTokenKey, String regionId) throws IOException { String qPath = "/dbaas/timeseries/{serviceName}/setup"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "displayName", displayName); addBody(o, "raTokenId", raTokenId); addBody(o, "raTokenKey", raTokenKey); addBody(o, "regionId", regionId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, net.minidev.ovh.api.paas.timeseries.OvhProject.class); }
java
public net.minidev.ovh.api.paas.timeseries.OvhProject serviceName_setup_POST(String serviceName, String description, String displayName, String raTokenId, String raTokenKey, String regionId) throws IOException { String qPath = "/dbaas/timeseries/{serviceName}/setup"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "displayName", displayName); addBody(o, "raTokenId", raTokenId); addBody(o, "raTokenKey", raTokenKey); addBody(o, "regionId", regionId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, net.minidev.ovh.api.paas.timeseries.OvhProject.class); }
[ "public", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "paas", ".", "timeseries", ".", "OvhProject", "serviceName_setup_POST", "(", "String", "serviceName", ",", "String", "description", ",", "String", "displayName", ",", "String", "raTokenId", ",", "St...
Setup a project REST: POST /dbaas/timeseries/{serviceName}/setup @param serviceName [required] Service Name @param displayName [required] Project name @param description [required] Project description @param regionId [required] Region to use @param raTokenId [required] Your runabove app token id @param raTokenKey [required] Your runabove app token key
[ "Setup", "a", "project" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhDbaastimeseries.java#L79-L90
jboss-integration/fuse-bxms-integ
switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java
KnowledgeOperations.setGlobals
public static void setGlobals(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime, boolean singleton) { Globals globals = runtime.getSessionGlobals(); if (globals != null) { Map<String, Object> globalsMap = new HashMap<String, Object>(); globalsMap.put(GLOBALS, new ConcurrentHashMap<String, Object>()); Map<String, Object> expressionMap = getMap(message, operation.getGlobalExpressionMappings(), null); if (expressionMap != null) { globalsMap.putAll(expressionMap); } for (Entry<String, Object> globalsEntry : globalsMap.entrySet()) { if (!singleton) { globals.set(globalsEntry.getKey(), globalsEntry.getValue()); } else { if (globals.get(globalsEntry.getKey()) == null || (globalsEntry.getValue() != null && (globalsEntry.getValue() instanceof Map && !((Map)globalsEntry.getValue()).isEmpty()))) { globals.set(globalsEntry.getKey(), globalsEntry.getValue()); } } } } }
java
public static void setGlobals(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime, boolean singleton) { Globals globals = runtime.getSessionGlobals(); if (globals != null) { Map<String, Object> globalsMap = new HashMap<String, Object>(); globalsMap.put(GLOBALS, new ConcurrentHashMap<String, Object>()); Map<String, Object> expressionMap = getMap(message, operation.getGlobalExpressionMappings(), null); if (expressionMap != null) { globalsMap.putAll(expressionMap); } for (Entry<String, Object> globalsEntry : globalsMap.entrySet()) { if (!singleton) { globals.set(globalsEntry.getKey(), globalsEntry.getValue()); } else { if (globals.get(globalsEntry.getKey()) == null || (globalsEntry.getValue() != null && (globalsEntry.getValue() instanceof Map && !((Map)globalsEntry.getValue()).isEmpty()))) { globals.set(globalsEntry.getKey(), globalsEntry.getValue()); } } } } }
[ "public", "static", "void", "setGlobals", "(", "Message", "message", ",", "KnowledgeOperation", "operation", ",", "KnowledgeRuntimeEngine", "runtime", ",", "boolean", "singleton", ")", "{", "Globals", "globals", "=", "runtime", ".", "getSessionGlobals", "(", ")", ...
Sets the globals. @param message the message @param operation the operation @param runtime the runtime engine @param singleton singleton
[ "Sets", "the", "globals", "." ]
train
https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java#L129-L149
Jasig/uPortal
uPortal-security/uPortal-security-core/src/main/java/org/apereo/portal/security/provider/AuthorizationPrincipalImpl.java
AuthorizationPrincipalImpl.hasPermission
@Override public boolean hasPermission(String owner, String activity, String target) throws AuthorizationException { return getAuthorizationService().doesPrincipalHavePermission(this, owner, activity, target); }
java
@Override public boolean hasPermission(String owner, String activity, String target) throws AuthorizationException { return getAuthorizationService().doesPrincipalHavePermission(this, owner, activity, target); }
[ "@", "Override", "public", "boolean", "hasPermission", "(", "String", "owner", ",", "String", "activity", ",", "String", "target", ")", "throws", "AuthorizationException", "{", "return", "getAuthorizationService", "(", ")", ".", "doesPrincipalHavePermission", "(", "...
Answers if this <code>IAuthorizationPrincipal</code> has permission to perform the <code> activity</code> on the <code>target</code>. Params <code>owner</code> and <code>activity </code> must be non-null. If <code>target</code> is null, then the target is not checked. @return boolean @param owner String @param activity String @param target String @exception AuthorizationException indicates authorization information could not be retrieved.
[ "Answers", "if", "this", "<code", ">", "IAuthorizationPrincipal<", "/", "code", ">", "has", "permission", "to", "perform", "the", "<code", ">", "activity<", "/", "code", ">", "on", "the", "<code", ">", "target<", "/", "code", ">", ".", "Params", "<code", ...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-core/src/main/java/org/apereo/portal/security/provider/AuthorizationPrincipalImpl.java#L212-L216
BioPAX/Paxtools
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
SBGNLayoutManager.createLNode
private void createLNode(VNode vNode, VNode parent) { LNode lNode = layout.newNode(vNode); lNode.type = vNode.glyph.getClazz(); lNode.label = vNode.glyph.getId(); LGraph rootLGraph = layout.getGraphManager().getRoot(); //Add corresponding nodes to corresponding maps viewToLayout.put(vNode, lNode); layoutToView.put(lNode.label,vNode); // if the vNode has a parent, add the lNode as a child of the parent l-node. // otherwise, add the node to the root graph. if (parent != null) { LNode parentLNode = viewToLayout.get(parent); parentLNode.getChild().add(lNode); } else { rootLGraph.add(lNode); } lNode.setLocation(vNode.glyph.getBbox().getX(), vNode.glyph.getBbox().getY()); if (vNode instanceof VCompound) { VCompound vCompound = (VCompound) vNode; // add new LGraph to the graph manager for the compound node layout.getGraphManager().add(layout.newGraph(null), lNode); // for each VNode in the node set create an LNode for (VNode vChildNode: vCompound.getChildren()) { createLNode(vChildNode, vCompound); } } else { lNode.setWidth(vNode.glyph.getBbox().getW()); lNode.setHeight(vNode.glyph.getBbox().getH()); } }
java
private void createLNode(VNode vNode, VNode parent) { LNode lNode = layout.newNode(vNode); lNode.type = vNode.glyph.getClazz(); lNode.label = vNode.glyph.getId(); LGraph rootLGraph = layout.getGraphManager().getRoot(); //Add corresponding nodes to corresponding maps viewToLayout.put(vNode, lNode); layoutToView.put(lNode.label,vNode); // if the vNode has a parent, add the lNode as a child of the parent l-node. // otherwise, add the node to the root graph. if (parent != null) { LNode parentLNode = viewToLayout.get(parent); parentLNode.getChild().add(lNode); } else { rootLGraph.add(lNode); } lNode.setLocation(vNode.glyph.getBbox().getX(), vNode.glyph.getBbox().getY()); if (vNode instanceof VCompound) { VCompound vCompound = (VCompound) vNode; // add new LGraph to the graph manager for the compound node layout.getGraphManager().add(layout.newGraph(null), lNode); // for each VNode in the node set create an LNode for (VNode vChildNode: vCompound.getChildren()) { createLNode(vChildNode, vCompound); } } else { lNode.setWidth(vNode.glyph.getBbox().getW()); lNode.setHeight(vNode.glyph.getBbox().getH()); } }
[ "private", "void", "createLNode", "(", "VNode", "vNode", ",", "VNode", "parent", ")", "{", "LNode", "lNode", "=", "layout", ".", "newNode", "(", "vNode", ")", ";", "lNode", ".", "type", "=", "vNode", ".", "glyph", ".", "getClazz", "(", ")", ";", "lNo...
Helper function for creating LNode objects from VNode objects and adds them to the given layout. @param vNode VNode object from which a corresponding LNode object will be created. @param parent parent of vNode, if not null vNode will be added to layout as child node.
[ "Helper", "function", "for", "creating", "LNode", "objects", "from", "VNode", "objects", "and", "adds", "them", "to", "the", "given", "layout", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L449-L492
languagetool-org/languagetool
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanStyleRepeatedWordRule.java
GermanStyleRepeatedWordRule.isTokenPair
protected boolean isTokenPair(AnalyzedTokenReadings[] tokens, int n, boolean before) { if (before) { if ((tokens[n-2].hasPosTagStartingWith("SUB") && tokens[n-1].hasPosTagStartingWith("PRP") && tokens[n].hasPosTagStartingWith("SUB")) || (!tokens[n-2].getToken().equals("hart") && !tokens[n-1].getToken().equals("auf") && !tokens[n].getToken().equals("hart")) ) { return true; } } else { if ((tokens[n].hasPosTagStartingWith("SUB") && tokens[n+1].hasPosTagStartingWith("PRP") && tokens[n+2].hasPosTagStartingWith("SUB")) || (!tokens[n].getToken().equals("hart") && !tokens[n-1].getToken().equals("auf") && !tokens[n + 2].getToken().equals("hart")) ) { return true; } } return false; }
java
protected boolean isTokenPair(AnalyzedTokenReadings[] tokens, int n, boolean before) { if (before) { if ((tokens[n-2].hasPosTagStartingWith("SUB") && tokens[n-1].hasPosTagStartingWith("PRP") && tokens[n].hasPosTagStartingWith("SUB")) || (!tokens[n-2].getToken().equals("hart") && !tokens[n-1].getToken().equals("auf") && !tokens[n].getToken().equals("hart")) ) { return true; } } else { if ((tokens[n].hasPosTagStartingWith("SUB") && tokens[n+1].hasPosTagStartingWith("PRP") && tokens[n+2].hasPosTagStartingWith("SUB")) || (!tokens[n].getToken().equals("hart") && !tokens[n-1].getToken().equals("auf") && !tokens[n + 2].getToken().equals("hart")) ) { return true; } } return false; }
[ "protected", "boolean", "isTokenPair", "(", "AnalyzedTokenReadings", "[", "]", "tokens", ",", "int", "n", ",", "boolean", "before", ")", "{", "if", "(", "before", ")", "{", "if", "(", "(", "tokens", "[", "n", "-", "2", "]", ".", "hasPosTagStartingWith", ...
/* Pairs of substantive are excluded like "Arm in Arm", "Seite an Seite", etc.
[ "/", "*", "Pairs", "of", "substantive", "are", "excluded", "like", "Arm", "in", "Arm", "Seite", "an", "Seite", "etc", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanStyleRepeatedWordRule.java#L98-L115
BioPAX/Paxtools
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/EventWrapper.java
EventWrapper.addToUpstream
protected void addToUpstream(BioPAXElement ele, Graph graph) { AbstractNode node = (AbstractNode) graph.getGraphObject(ele); if (node == null) return; Edge edge = new EdgeL3(node, this, graph); if (isTranscription()) { if (node instanceof ControlWrapper) { ((ControlWrapper) node).setTranscription(true); } } node.getDownstreamNoInit().add(edge); this.getUpstreamNoInit().add(edge); }
java
protected void addToUpstream(BioPAXElement ele, Graph graph) { AbstractNode node = (AbstractNode) graph.getGraphObject(ele); if (node == null) return; Edge edge = new EdgeL3(node, this, graph); if (isTranscription()) { if (node instanceof ControlWrapper) { ((ControlWrapper) node).setTranscription(true); } } node.getDownstreamNoInit().add(edge); this.getUpstreamNoInit().add(edge); }
[ "protected", "void", "addToUpstream", "(", "BioPAXElement", "ele", ",", "Graph", "graph", ")", "{", "AbstractNode", "node", "=", "(", "AbstractNode", ")", "graph", ".", "getGraphObject", "(", "ele", ")", ";", "if", "(", "node", "==", "null", ")", "return",...
Bind the wrapper of the given element to the upstream. @param ele Element to bind @param graph Owner graph.
[ "Bind", "the", "wrapper", "of", "the", "given", "element", "to", "the", "upstream", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/EventWrapper.java#L67-L84
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldBit.java
JBBPFieldBit.reverseBits
public static long reverseBits(final byte value, final JBBPBitNumber bits) { return JBBPUtils.reverseBitsInByte(value) >>> (8 - bits.getBitNumber()) & bits.getMask(); }
java
public static long reverseBits(final byte value, final JBBPBitNumber bits) { return JBBPUtils.reverseBitsInByte(value) >>> (8 - bits.getBitNumber()) & bits.getMask(); }
[ "public", "static", "long", "reverseBits", "(", "final", "byte", "value", ",", "final", "JBBPBitNumber", "bits", ")", "{", "return", "JBBPUtils", ".", "reverseBitsInByte", "(", "value", ")", ">>>", "(", "8", "-", "bits", ".", "getBitNumber", "(", ")", ")",...
Get the reversed bit representation of the value. @param value the value to be reversed @param bits number of bits to be reversed, must not be null @return the reversed value
[ "Get", "the", "reversed", "bit", "representation", "of", "the", "value", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldBit.java#L61-L63
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.optBoolean
public boolean optBoolean( String key, boolean defaultValue ) { verifyIsNull(); try{ return getBoolean( key ); }catch( Exception e ){ return defaultValue; } }
java
public boolean optBoolean( String key, boolean defaultValue ) { verifyIsNull(); try{ return getBoolean( key ); }catch( Exception e ){ return defaultValue; } }
[ "public", "boolean", "optBoolean", "(", "String", "key", ",", "boolean", "defaultValue", ")", "{", "verifyIsNull", "(", ")", ";", "try", "{", "return", "getBoolean", "(", "key", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "defaultV...
Get an optional boolean associated with a key. It returns the defaultValue if there is no such key, or if it is not a Boolean or the String "true" or "false" (case insensitive). @param key A key string. @param defaultValue The default. @return The truth.
[ "Get", "an", "optional", "boolean", "associated", "with", "a", "key", ".", "It", "returns", "the", "defaultValue", "if", "there", "is", "no", "such", "key", "or", "if", "it", "is", "not", "a", "Boolean", "or", "the", "String", "true", "or", "false", "(...
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L2138-L2145
line/line-bot-sdk-java
line-bot-servlet/src/main/java/com/linecorp/bot/servlet/LineBotCallbackRequestParser.java
LineBotCallbackRequestParser.handle
public CallbackRequest handle(String signature, String payload) throws LineBotCallbackException, IOException { // validate signature if (signature == null || signature.length() == 0) { throw new LineBotCallbackException("Missing 'X-Line-Signature' header"); } log.debug("got: {}", payload); final byte[] json = payload.getBytes(StandardCharsets.UTF_8); if (!lineSignatureValidator.validateSignature(json, signature)) { throw new LineBotCallbackException("Invalid API signature"); } final CallbackRequest callbackRequest = objectMapper.readValue(json, CallbackRequest.class); if (callbackRequest == null || callbackRequest.getEvents() == null) { throw new LineBotCallbackException("Invalid content"); } return callbackRequest; }
java
public CallbackRequest handle(String signature, String payload) throws LineBotCallbackException, IOException { // validate signature if (signature == null || signature.length() == 0) { throw new LineBotCallbackException("Missing 'X-Line-Signature' header"); } log.debug("got: {}", payload); final byte[] json = payload.getBytes(StandardCharsets.UTF_8); if (!lineSignatureValidator.validateSignature(json, signature)) { throw new LineBotCallbackException("Invalid API signature"); } final CallbackRequest callbackRequest = objectMapper.readValue(json, CallbackRequest.class); if (callbackRequest == null || callbackRequest.getEvents() == null) { throw new LineBotCallbackException("Invalid content"); } return callbackRequest; }
[ "public", "CallbackRequest", "handle", "(", "String", "signature", ",", "String", "payload", ")", "throws", "LineBotCallbackException", ",", "IOException", "{", "// validate signature", "if", "(", "signature", "==", "null", "||", "signature", ".", "length", "(", "...
Parse request. @param signature X-Line-Signature header. @param payload Request body. @return Parsed result. If there's an error, this method sends response. @throws LineBotCallbackException There's an error around signature.
[ "Parse", "request", "." ]
train
https://github.com/line/line-bot-sdk-java/blob/d6d30b19d5b90c2d3269eb9d6f88fe76fb6fcb55/line-bot-servlet/src/main/java/com/linecorp/bot/servlet/LineBotCallbackRequestParser.java#L75-L95
alkacon/opencms-core
src/org/opencms/ade/galleries/A_CmsTreeTabDataPreloader.java
A_CmsTreeTabDataPreloader.createBeans
private T createBeans() throws CmsException { // create the beans for the resources Map<CmsResource, T> beans = new HashMap<CmsResource, T>(); for (CmsResource resource : m_knownResources) { T bean = createEntry(m_cms, resource); if (bean != null) { beans.put(resource, bean); } } // attach beans for child resources to the beans for their parents for (Map.Entry<CmsResource, T> entry : beans.entrySet()) { CmsResource key = entry.getKey(); T bean = entry.getValue(); for (CmsResource child : m_childMap.get(key)) { T childEntry = beans.get(child); if (childEntry != null) { bean.addChild(childEntry); } } } return beans.get(m_rootResource); }
java
private T createBeans() throws CmsException { // create the beans for the resources Map<CmsResource, T> beans = new HashMap<CmsResource, T>(); for (CmsResource resource : m_knownResources) { T bean = createEntry(m_cms, resource); if (bean != null) { beans.put(resource, bean); } } // attach beans for child resources to the beans for their parents for (Map.Entry<CmsResource, T> entry : beans.entrySet()) { CmsResource key = entry.getKey(); T bean = entry.getValue(); for (CmsResource child : m_childMap.get(key)) { T childEntry = beans.get(child); if (childEntry != null) { bean.addChild(childEntry); } } } return beans.get(m_rootResource); }
[ "private", "T", "createBeans", "(", ")", "throws", "CmsException", "{", "// create the beans for the resources\r", "Map", "<", "CmsResource", ",", "T", ">", "beans", "=", "new", "HashMap", "<", "CmsResource", ",", "T", ">", "(", ")", ";", "for", "(", "CmsRes...
Creates the beans for the loaded resources, and returns the root bean.<p> @return the root bean @throws CmsException if something goes wrong
[ "Creates", "the", "beans", "for", "the", "loaded", "resources", "and", "returns", "the", "root", "bean", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/A_CmsTreeTabDataPreloader.java#L218-L241
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/constraints/InheritanceHelper.java
InheritanceHelper.isSameOrSubTypeOf
public boolean isSameOrSubTypeOf(String type, String baseType) throws ClassNotFoundException { return type.replace('$', '.').equals(baseType.replace('$', '.')) ? true : isSameOrSubTypeOf(getClass(type), baseType); }
java
public boolean isSameOrSubTypeOf(String type, String baseType) throws ClassNotFoundException { return type.replace('$', '.').equals(baseType.replace('$', '.')) ? true : isSameOrSubTypeOf(getClass(type), baseType); }
[ "public", "boolean", "isSameOrSubTypeOf", "(", "String", "type", ",", "String", "baseType", ")", "throws", "ClassNotFoundException", "{", "return", "type", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "equals", "(", "baseType", ".", "replace", "...
Determines whether the given type is the same or a sub type of the other type. @param type The type @param baseType The possible base type @return <code>true</code> If <code>type</code> specifies the same or a sub type of <code>baseType</code> @throws ClassNotFoundException If the two classes are not on the classpath
[ "Determines", "whether", "the", "given", "type", "is", "the", "same", "or", "a", "sub", "type", "of", "the", "other", "type", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/InheritanceHelper.java#L134-L137
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.checkAlert
@Conditioned @Lorsque("Je vérifie l'absence d'alerte dans '(.*)'[\\.|\\?]") @Then("I check absence of alert in '(.*)'[\\.|\\?]") public void checkAlert(String page, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { checkAlert(Page.getInstance(page)); }
java
@Conditioned @Lorsque("Je vérifie l'absence d'alerte dans '(.*)'[\\.|\\?]") @Then("I check absence of alert in '(.*)'[\\.|\\?]") public void checkAlert(String page, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { checkAlert(Page.getInstance(page)); }
[ "@", "Conditioned", "@", "Lorsque", "(", "\"Je vérifie l'absence d'alerte dans '(.*)'[\\\\.|\\\\?]\")", "\r", "@", "Then", "(", "\"I check absence of alert in '(.*)'[\\\\.|\\\\?]\"", ")", "public", "void", "checkAlert", "(", "String", "page", ",", "List", "<", "GherkinStepC...
Checks that a given page displays a html alert. This check do not work with IE: https://github.com/SeleniumHQ/selenium/issues/468 @param page The concerned page @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws FailureException if the scenario encounters a functional error @throws TechnicalException is throws if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with message and with screenshot and with exception if functional error but no screenshot and no exception if technical error.
[ "Checks", "that", "a", "given", "page", "displays", "a", "html", "alert", ".", "This", "check", "do", "not", "work", "with", "IE", ":", "https", ":", "//", "github", ".", "com", "/", "SeleniumHQ", "/", "selenium", "/", "issues", "/", "468" ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L798-L803
Samsung/GearVRf
GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java
Cursor.lookAt
protected void lookAt() {mTempPosition.set(getPositionX(), getPositionY(), getPositionZ()); mTempPosition.negate(mDirection); Vector3f up; mDirection.normalize(); if (Math.abs(mDirection.x) < 0.00001 && Math.abs(mDirection.z) < 0.00001) { if (mDirection.y > 0) { up = new Vector3f(0.0f, 0.0f, -1.0f); // if direction points in +y } else { up = new Vector3f(0.0f, 0.0f, 1.0f); // if direction points in -y } } else { up = new Vector3f(0.0f, 1.0f, 0.0f); // y-axis is the general up } up.normalize(); Vector3f right = new Vector3f(); up.cross(mDirection, right); right.normalize(); mDirection.cross(right, up); up.normalize(); float[] matrix = new float[]{right.x, right.y, right.z, 0.0f, up.x, up.y, up.z, 0.0f, mDirection.x, mDirection.y, mDirection.z, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; getOwnerObject().getTransform().setModelMatrix(matrix); }
java
protected void lookAt() {mTempPosition.set(getPositionX(), getPositionY(), getPositionZ()); mTempPosition.negate(mDirection); Vector3f up; mDirection.normalize(); if (Math.abs(mDirection.x) < 0.00001 && Math.abs(mDirection.z) < 0.00001) { if (mDirection.y > 0) { up = new Vector3f(0.0f, 0.0f, -1.0f); // if direction points in +y } else { up = new Vector3f(0.0f, 0.0f, 1.0f); // if direction points in -y } } else { up = new Vector3f(0.0f, 1.0f, 0.0f); // y-axis is the general up } up.normalize(); Vector3f right = new Vector3f(); up.cross(mDirection, right); right.normalize(); mDirection.cross(right, up); up.normalize(); float[] matrix = new float[]{right.x, right.y, right.z, 0.0f, up.x, up.y, up.z, 0.0f, mDirection.x, mDirection.y, mDirection.z, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; getOwnerObject().getTransform().setModelMatrix(matrix); }
[ "protected", "void", "lookAt", "(", ")", "{", "mTempPosition", ".", "set", "(", "getPositionX", "(", ")", ",", "getPositionY", "(", ")", ",", "getPositionZ", "(", ")", ")", ";", "mTempPosition", ".", "negate", "(", "mDirection", ")", ";", "Vector3f", "up...
This method makes sure that the {@link Cursor} is always facing the camera. Lookat implemented using: <p/> http://mmmovania.blogspot.com/2014/03/making-opengl-object-look-at-another.html
[ "This", "method", "makes", "sure", "that", "the", "{", "@link", "Cursor", "}", "is", "always", "facing", "the", "camera", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java#L719-L747
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/dory/DoradusClient.java
DoradusClient.describeCommand
public JsonObject describeCommand(String service, String command) { return Command.matchCommand(restMetadataJson, command, service); }
java
public JsonObject describeCommand(String service, String command) { return Command.matchCommand(restMetadataJson, command, service); }
[ "public", "JsonObject", "describeCommand", "(", "String", "service", ",", "String", "command", ")", "{", "return", "Command", ".", "matchCommand", "(", "restMetadataJson", ",", "command", ",", "service", ")", ";", "}" ]
Describe command that helps give the idea what client needs to build the command @param service service name such as 'SpiderService' for application commands or '_systems' for system commands @param command command name @return JsonObject result in JSON that contains the description of the command
[ "Describe", "command", "that", "helps", "give", "the", "idea", "what", "client", "needs", "to", "build", "the", "command" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/dory/DoradusClient.java#L151-L154
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java
PathNormalizer.createGenerationPath
public static String createGenerationPath(String path, GeneratorRegistry registry, String randomParam) { String requestPath = null; try { requestPath = registry.getDebugModeGenerationPath(path); if (randomParam != null) { requestPath += "?" + randomParam + "&"; } else { requestPath += "?"; } requestPath += JawrRequestHandler.GENERATION_PARAM + "=" + URLEncoder.encode(path, "UTF-8"); } catch (UnsupportedEncodingException neverHappens) { /* URLEncoder:how not to use checked exceptions... */ throw new JawrLinkRenderingException( "Something went unexpectedly wrong while encoding a URL for a generator. ", neverHappens); } return requestPath; }
java
public static String createGenerationPath(String path, GeneratorRegistry registry, String randomParam) { String requestPath = null; try { requestPath = registry.getDebugModeGenerationPath(path); if (randomParam != null) { requestPath += "?" + randomParam + "&"; } else { requestPath += "?"; } requestPath += JawrRequestHandler.GENERATION_PARAM + "=" + URLEncoder.encode(path, "UTF-8"); } catch (UnsupportedEncodingException neverHappens) { /* URLEncoder:how not to use checked exceptions... */ throw new JawrLinkRenderingException( "Something went unexpectedly wrong while encoding a URL for a generator. ", neverHappens); } return requestPath; }
[ "public", "static", "String", "createGenerationPath", "(", "String", "path", ",", "GeneratorRegistry", "registry", ",", "String", "randomParam", ")", "{", "String", "requestPath", "=", "null", ";", "try", "{", "requestPath", "=", "registry", ".", "getDebugModeGene...
converts a generation path (such as jar:/some/path/file) into a request path that the request handler can understand and process. @param path the path @param registry the generator registry @param randomParam the random parameter @return the generation path
[ "converts", "a", "generation", "path", "(", "such", "as", "jar", ":", "/", "some", "/", "path", "/", "file", ")", "into", "a", "request", "path", "that", "the", "request", "handler", "can", "understand", "and", "process", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L403-L421
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java
SnapshotsInner.getByResourceGroup
public SnapshotInner getByResourceGroup(String resourceGroupName, String snapshotName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, snapshotName).toBlocking().single().body(); }
java
public SnapshotInner getByResourceGroup(String resourceGroupName, String snapshotName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, snapshotName).toBlocking().single().body(); }
[ "public", "SnapshotInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "snapshotName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "snapshotName", ")", ".", "toBlocking", "(", ")", ".", "s...
Gets information about a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @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 @return the SnapshotInner object if successful.
[ "Gets", "information", "about", "a", "snapshot", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L487-L489
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/BinaryHeapPriorityQueue.java
BinaryHeapPriorityQueue.changePriority
public boolean changePriority(E key, double priority) { Entry<E> entry = getEntry(key); if (entry == null) { entry = makeEntry(key); } if (compare(priority, entry.priority) == 0) { return false; } entry.priority = priority; heapify(entry); return true; }
java
public boolean changePriority(E key, double priority) { Entry<E> entry = getEntry(key); if (entry == null) { entry = makeEntry(key); } if (compare(priority, entry.priority) == 0) { return false; } entry.priority = priority; heapify(entry); return true; }
[ "public", "boolean", "changePriority", "(", "E", "key", ",", "double", "priority", ")", "{", "Entry", "<", "E", ">", "entry", "=", "getEntry", "(", "key", ")", ";", "if", "(", "entry", "==", "null", ")", "{", "entry", "=", "makeEntry", "(", "key", ...
Changes a priority, either up or down, adding the key it if it wasn't there already. @param key an <code>Object</code> value @return whether the priority actually changed.
[ "Changes", "a", "priority", "either", "up", "or", "down", "adding", "the", "key", "it", "if", "it", "wasn", "t", "there", "already", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/BinaryHeapPriorityQueue.java#L356-L367
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
FaceletViewDeclarationLanguage._getFacelet
private Facelet _getFacelet(FacesContext context, String viewId) throws IOException { // grab our FaceletFactory and create a Facelet FaceletFactory.setInstance(_faceletFactory); try { return _faceletFactory.getFacelet(context, viewId); } finally { FaceletFactory.setInstance(null); } }
java
private Facelet _getFacelet(FacesContext context, String viewId) throws IOException { // grab our FaceletFactory and create a Facelet FaceletFactory.setInstance(_faceletFactory); try { return _faceletFactory.getFacelet(context, viewId); } finally { FaceletFactory.setInstance(null); } }
[ "private", "Facelet", "_getFacelet", "(", "FacesContext", "context", ",", "String", "viewId", ")", "throws", "IOException", "{", "// grab our FaceletFactory and create a Facelet", "FaceletFactory", ".", "setInstance", "(", "_faceletFactory", ")", ";", "try", "{", "retur...
Gets the Facelet representing the specified view identifier. @param viewId the view identifier @return the Facelet representing the specified view identifier @throws IOException if a read or parsing error occurs
[ "Gets", "the", "Facelet", "representing", "the", "specified", "view", "identifier", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java#L2577-L2589
vkostyukov/la4j
src/main/java/org/la4j/Matrices.java
Matrices.asAccumulatorProcedure
public static MatrixProcedure asAccumulatorProcedure(final MatrixAccumulator accumulator) { return new MatrixProcedure() { @Override public void apply(int i, int j, double value) { accumulator.update(i, j, value); } }; }
java
public static MatrixProcedure asAccumulatorProcedure(final MatrixAccumulator accumulator) { return new MatrixProcedure() { @Override public void apply(int i, int j, double value) { accumulator.update(i, j, value); } }; }
[ "public", "static", "MatrixProcedure", "asAccumulatorProcedure", "(", "final", "MatrixAccumulator", "accumulator", ")", "{", "return", "new", "MatrixProcedure", "(", ")", "{", "@", "Override", "public", "void", "apply", "(", "int", "i", ",", "int", "j", ",", "...
Creates an accumulator procedure that adapts a matrix accumulator for procedure interface. This is useful for reusing a single accumulator for multiple fold operations in multiple matrices. @param accumulator the matrix accumulator @return an accumulator procedure
[ "Creates", "an", "accumulator", "procedure", "that", "adapts", "a", "matrix", "accumulator", "for", "procedure", "interface", ".", "This", "is", "useful", "for", "reusing", "a", "single", "accumulator", "for", "multiple", "fold", "operations", "in", "multiple", ...
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L744-L751
OpenLiberty/open-liberty
dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java
AppBndAuthorizationTableService.updateMissingUserAccessId
private String updateMissingUserAccessId(AuthzTableContainer maps, User user, String userNameFromRole) { String accessIdFromRole; accessIdFromRole = getMissingAccessId(user); if (accessIdFromRole != null) { maps.userToAccessIdMap.put(userNameFromRole, accessIdFromRole); } else { // Unable to compute the accessId, store an invalid access ID indicate this maps.userToAccessIdMap.put(userNameFromRole, INVALID_ACCESS_ID); } return accessIdFromRole; }
java
private String updateMissingUserAccessId(AuthzTableContainer maps, User user, String userNameFromRole) { String accessIdFromRole; accessIdFromRole = getMissingAccessId(user); if (accessIdFromRole != null) { maps.userToAccessIdMap.put(userNameFromRole, accessIdFromRole); } else { // Unable to compute the accessId, store an invalid access ID indicate this maps.userToAccessIdMap.put(userNameFromRole, INVALID_ACCESS_ID); } return accessIdFromRole; }
[ "private", "String", "updateMissingUserAccessId", "(", "AuthzTableContainer", "maps", ",", "User", "user", ",", "String", "userNameFromRole", ")", "{", "String", "accessIdFromRole", ";", "accessIdFromRole", "=", "getMissingAccessId", "(", "user", ")", ";", "if", "("...
Update the map for the specified user name. If the accessID is successfully computed, the map will be updated with the accessID. If the accessID can not be computed due to the user not being found, INVALID_ACCESS_ID will be stored. @param maps @param user @param userNameFromRole @return
[ "Update", "the", "map", "for", "the", "specified", "user", "name", ".", "If", "the", "accessID", "is", "successfully", "computed", "the", "map", "will", "be", "updated", "with", "the", "accessID", ".", "If", "the", "accessID", "can", "not", "be", "computed...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java#L385-L395
apache/flink
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/AggregateOperationFactory.java
AggregateOperationFactory.createWindowAggregate
public TableOperation createWindowAggregate( List<Expression> groupings, List<Expression> aggregates, List<Expression> windowProperties, ResolvedGroupWindow window, TableOperation child) { validateGroupings(groupings); validateAggregates(aggregates); validateWindowProperties(windowProperties, window); List<PlannerExpression> convertedGroupings = bridge(groupings); List<PlannerExpression> convertedAggregates = bridge(aggregates); List<PlannerExpression> convertedWindowProperties = bridge(windowProperties); TypeInformation[] fieldTypes = concat( convertedGroupings.stream(), convertedAggregates.stream(), convertedWindowProperties.stream() ).map(PlannerExpression::resultType) .toArray(TypeInformation[]::new); String[] fieldNames = concat( groupings.stream(), aggregates.stream(), windowProperties.stream() ).map(expr -> extractName(expr).orElseGet(expr::toString)) .toArray(String[]::new); TableSchema tableSchema = new TableSchema(fieldNames, fieldTypes); return new WindowAggregateTableOperation( groupings, aggregates, windowProperties, window, child, tableSchema); }
java
public TableOperation createWindowAggregate( List<Expression> groupings, List<Expression> aggregates, List<Expression> windowProperties, ResolvedGroupWindow window, TableOperation child) { validateGroupings(groupings); validateAggregates(aggregates); validateWindowProperties(windowProperties, window); List<PlannerExpression> convertedGroupings = bridge(groupings); List<PlannerExpression> convertedAggregates = bridge(aggregates); List<PlannerExpression> convertedWindowProperties = bridge(windowProperties); TypeInformation[] fieldTypes = concat( convertedGroupings.stream(), convertedAggregates.stream(), convertedWindowProperties.stream() ).map(PlannerExpression::resultType) .toArray(TypeInformation[]::new); String[] fieldNames = concat( groupings.stream(), aggregates.stream(), windowProperties.stream() ).map(expr -> extractName(expr).orElseGet(expr::toString)) .toArray(String[]::new); TableSchema tableSchema = new TableSchema(fieldNames, fieldTypes); return new WindowAggregateTableOperation( groupings, aggregates, windowProperties, window, child, tableSchema); }
[ "public", "TableOperation", "createWindowAggregate", "(", "List", "<", "Expression", ">", "groupings", ",", "List", "<", "Expression", ">", "aggregates", ",", "List", "<", "Expression", ">", "windowProperties", ",", "ResolvedGroupWindow", "window", ",", "TableOperat...
Creates a valid {@link WindowAggregateTableOperation} operation. @param groupings expressions describing grouping key of aggregates @param aggregates expressions describing aggregation functions @param windowProperties expressions describing window properties @param window grouping window of this aggregation @param child relational operation on top of which to apply the aggregation @return valid window aggregate operation
[ "Creates", "a", "valid", "{", "@link", "WindowAggregateTableOperation", "}", "operation", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/AggregateOperationFactory.java#L127-L164
landawn/AbacusUtil
src/com/landawn/abacus/util/Hex.java
Hex.toDigit
protected static int toDigit(final char ch, final int index) throws IllegalArgumentException { final int digit = Character.digit(ch, 16); if (digit == -1) { throw new IllegalArgumentException("Illegal hexadecimal character " + ch + " at index " + index); } return digit; }
java
protected static int toDigit(final char ch, final int index) throws IllegalArgumentException { final int digit = Character.digit(ch, 16); if (digit == -1) { throw new IllegalArgumentException("Illegal hexadecimal character " + ch + " at index " + index); } return digit; }
[ "protected", "static", "int", "toDigit", "(", "final", "char", "ch", ",", "final", "int", "index", ")", "throws", "IllegalArgumentException", "{", "final", "int", "digit", "=", "Character", ".", "digit", "(", "ch", ",", "16", ")", ";", "if", "(", "digit"...
Converts a hexadecimal character to an integer. @param ch A character to convert to an integer digit @param index The index of the character in the source @return An integer @throws DecoderException Thrown if ch is an illegal hex character
[ "Converts", "a", "hexadecimal", "character", "to", "an", "integer", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Hex.java#L170-L176
stephenc/simple-java-mail
src/main/java/org/codemonkey/simplejavamail/Email.java
Email.addEmbeddedImage
public void addEmbeddedImage(final String name, final byte[] data, final String mimetype) { final ByteArrayDataSource dataSource = new ByteArrayDataSource(data, mimetype); dataSource.setName(name); addEmbeddedImage(name, dataSource); }
java
public void addEmbeddedImage(final String name, final byte[] data, final String mimetype) { final ByteArrayDataSource dataSource = new ByteArrayDataSource(data, mimetype); dataSource.setName(name); addEmbeddedImage(name, dataSource); }
[ "public", "void", "addEmbeddedImage", "(", "final", "String", "name", ",", "final", "byte", "[", "]", "data", ",", "final", "String", "mimetype", ")", "{", "final", "ByteArrayDataSource", "dataSource", "=", "new", "ByteArrayDataSource", "(", "data", ",", "mime...
Adds an embedded image (attachment type) to the email message and generates the necessary {@link DataSource} with the given byte data. Then delegates to {@link #addEmbeddedImage(String, DataSource)}. At this point the datasource is actually a {@link ByteArrayDataSource}. @param name The name of the image as being referred to from the message content body (eg. '&lt;cid:signature&gt;'). @param data The byte data of the image to be embedded. @param mimetype The content type of the given data (eg. "image/gif" or "image/jpeg"). @see ByteArrayDataSource @see #addEmbeddedImage(String, DataSource)
[ "Adds", "an", "embedded", "image", "(", "attachment", "type", ")", "to", "the", "email", "message", "and", "generates", "the", "necessary", "{", "@link", "DataSource", "}", "with", "the", "given", "byte", "data", ".", "Then", "delegates", "to", "{", "@link...
train
https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/Email.java#L116-L120
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java
CPDefinitionPersistenceImpl.findByC_ERC
@Override public CPDefinition findByC_ERC(long companyId, String externalReferenceCode) throws NoSuchCPDefinitionException { CPDefinition cpDefinition = fetchByC_ERC(companyId, externalReferenceCode); if (cpDefinition == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", externalReferenceCode="); msg.append(externalReferenceCode); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPDefinitionException(msg.toString()); } return cpDefinition; }
java
@Override public CPDefinition findByC_ERC(long companyId, String externalReferenceCode) throws NoSuchCPDefinitionException { CPDefinition cpDefinition = fetchByC_ERC(companyId, externalReferenceCode); if (cpDefinition == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", externalReferenceCode="); msg.append(externalReferenceCode); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPDefinitionException(msg.toString()); } return cpDefinition; }
[ "@", "Override", "public", "CPDefinition", "findByC_ERC", "(", "long", "companyId", ",", "String", "externalReferenceCode", ")", "throws", "NoSuchCPDefinitionException", "{", "CPDefinition", "cpDefinition", "=", "fetchByC_ERC", "(", "companyId", ",", "externalReferenceCod...
Returns the cp definition where companyId = &#63; and externalReferenceCode = &#63; or throws a {@link NoSuchCPDefinitionException} if it could not be found. @param companyId the company ID @param externalReferenceCode the external reference code @return the matching cp definition @throws NoSuchCPDefinitionException if a matching cp definition could not be found
[ "Returns", "the", "cp", "definition", "where", "companyId", "=", "&#63", ";", "and", "externalReferenceCode", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPDefinitionException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L5196-L5223
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getSummaryTableHeader
public Content getSummaryTableHeader(String[] header, String scope) { Content tr = new HtmlTree(HtmlTag.TR); int size = header.length; Content tableHeader; if (size == 1) { tableHeader = new StringContent(header[0]); tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader)); return tr; } for (int i = 0; i < size; i++) { tableHeader = new StringContent(header[i]); if(i == 0) tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader)); else if(i == (size - 1)) tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader)); else tr.addContent(HtmlTree.TH(scope, tableHeader)); } return tr; }
java
public Content getSummaryTableHeader(String[] header, String scope) { Content tr = new HtmlTree(HtmlTag.TR); int size = header.length; Content tableHeader; if (size == 1) { tableHeader = new StringContent(header[0]); tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader)); return tr; } for (int i = 0; i < size; i++) { tableHeader = new StringContent(header[i]); if(i == 0) tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader)); else if(i == (size - 1)) tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader)); else tr.addContent(HtmlTree.TH(scope, tableHeader)); } return tr; }
[ "public", "Content", "getSummaryTableHeader", "(", "String", "[", "]", "header", ",", "String", "scope", ")", "{", "Content", "tr", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "TR", ")", ";", "int", "size", "=", "header", ".", "length", ";", "Content", ...
Get summary table header. @param header the header for the table @param scope the scope of the headers @return a content tree for the header
[ "Get", "summary", "table", "header", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L765-L784
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/config/copy/DefaultCopyProviderConfiguration.java
DefaultCopyProviderConfiguration.addCopierFor
public <T> DefaultCopyProviderConfiguration addCopierFor(Class<T> clazz, Class<? extends Copier<T>> copierClass, boolean overwrite) { if (clazz == null) { throw new NullPointerException("Copy target class cannot be null"); } if (copierClass == null) { throw new NullPointerException("Copier class cannot be null"); } if (!overwrite && getDefaults().containsKey(clazz)) { throw new IllegalArgumentException("Duplicate copier for class : " + clazz); } getDefaults().put(clazz, new DefaultCopierConfiguration<>(copierClass)); return this; }
java
public <T> DefaultCopyProviderConfiguration addCopierFor(Class<T> clazz, Class<? extends Copier<T>> copierClass, boolean overwrite) { if (clazz == null) { throw new NullPointerException("Copy target class cannot be null"); } if (copierClass == null) { throw new NullPointerException("Copier class cannot be null"); } if (!overwrite && getDefaults().containsKey(clazz)) { throw new IllegalArgumentException("Duplicate copier for class : " + clazz); } getDefaults().put(clazz, new DefaultCopierConfiguration<>(copierClass)); return this; }
[ "public", "<", "T", ">", "DefaultCopyProviderConfiguration", "addCopierFor", "(", "Class", "<", "T", ">", "clazz", ",", "Class", "<", "?", "extends", "Copier", "<", "T", ">", ">", "copierClass", ",", "boolean", "overwrite", ")", "{", "if", "(", "clazz", ...
Adds a new {@code Class} - {@link Copier} pair to this configuration object @param clazz the {@code Class} for which this copier is @param copierClass the {@link Copier} type to use @param overwrite indicates if an existing mapping is to be overwritten @param <T> the type of objects the copier will deal with @return this configuration instance @throws NullPointerException if any argument is null @throws IllegalArgumentException in a case a mapping for {@code clazz} already exists and {@code overwrite} is {@code false}
[ "Adds", "a", "new", "{", "@code", "Class", "}", "-", "{", "@link", "Copier", "}", "pair", "to", "this", "configuration", "object" ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/config/copy/DefaultCopyProviderConfiguration.java#L85-L97