repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Mthwate/DatLib | src/main/java/com/mthwate/datlib/PropertyUtils.java | PropertyUtils.getProperty | public static String getProperty(File file, String key) {
"""
Retrieves a value from a properties file.
@since 1.2
@param file the properties file
@param key the property key
@return the value retrieved with the supplied key
"""
return getProperty(file, key, null);
} | java | public static String getProperty(File file, String key) {
return getProperty(file, key, null);
} | [
"public",
"static",
"String",
"getProperty",
"(",
"File",
"file",
",",
"String",
"key",
")",
"{",
"return",
"getProperty",
"(",
"file",
",",
"key",
",",
"null",
")",
";",
"}"
] | Retrieves a value from a properties file.
@since 1.2
@param file the properties file
@param key the property key
@return the value retrieved with the supplied key | [
"Retrieves",
"a",
"value",
"from",
"a",
"properties",
"file",
"."
] | train | https://github.com/Mthwate/DatLib/blob/f0b3a9f9cf6fdc773d4f86234ebd95986c9b6077/src/main/java/com/mthwate/datlib/PropertyUtils.java#L33-L35 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/AbstractResources.java | AbstractResources.attachFile | public <T> Attachment attachFile(String url, T t, String partName, InputStream inputstream, String contentType, String attachmentName)
throws SmartsheetException {
"""
Create a multipart upload request.
@param url the url
@param t the object to create
@param partName the name of the part
@param inputstream the file inputstream
@param contentType the type of the file to be attached
@return the http request
@throws UnsupportedEncodingException the unsupported encoding exception
"""
Util.throwIfNull(inputstream, contentType);
Attachment attachment = null;
final String boundary = "----" + System.currentTimeMillis() ;
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost uploadFile = createHttpPost(this.getSmartsheet().getBaseURI().resolve(url));
try {
uploadFile.setHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
} catch (Exception e) {
throw new RuntimeException(e);
}
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.setBoundary(boundary);
builder.addTextBody(partName, this.getSmartsheet().getJsonSerializer().serialize(t), ContentType.APPLICATION_JSON);
builder.addBinaryBody("file", inputstream, ContentType.create(contentType), attachmentName);
org.apache.http.HttpEntity multipart = builder.build();
uploadFile.setEntity(multipart);
try {
CloseableHttpResponse response = httpClient.execute(uploadFile);
org.apache.http.HttpEntity responseEntity = response.getEntity();
attachment = this.getSmartsheet().getJsonSerializer().deserializeResult(Attachment.class,
responseEntity.getContent()).getResult();
}
catch (Exception e) {
throw new RuntimeException(e);
}
return attachment;
} | java | public <T> Attachment attachFile(String url, T t, String partName, InputStream inputstream, String contentType, String attachmentName)
throws SmartsheetException {
Util.throwIfNull(inputstream, contentType);
Attachment attachment = null;
final String boundary = "----" + System.currentTimeMillis() ;
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost uploadFile = createHttpPost(this.getSmartsheet().getBaseURI().resolve(url));
try {
uploadFile.setHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
} catch (Exception e) {
throw new RuntimeException(e);
}
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.setBoundary(boundary);
builder.addTextBody(partName, this.getSmartsheet().getJsonSerializer().serialize(t), ContentType.APPLICATION_JSON);
builder.addBinaryBody("file", inputstream, ContentType.create(contentType), attachmentName);
org.apache.http.HttpEntity multipart = builder.build();
uploadFile.setEntity(multipart);
try {
CloseableHttpResponse response = httpClient.execute(uploadFile);
org.apache.http.HttpEntity responseEntity = response.getEntity();
attachment = this.getSmartsheet().getJsonSerializer().deserializeResult(Attachment.class,
responseEntity.getContent()).getResult();
}
catch (Exception e) {
throw new RuntimeException(e);
}
return attachment;
} | [
"public",
"<",
"T",
">",
"Attachment",
"attachFile",
"(",
"String",
"url",
",",
"T",
"t",
",",
"String",
"partName",
",",
"InputStream",
"inputstream",
",",
"String",
"contentType",
",",
"String",
"attachmentName",
")",
"throws",
"SmartsheetException",
"{",
"U... | Create a multipart upload request.
@param url the url
@param t the object to create
@param partName the name of the part
@param inputstream the file inputstream
@param contentType the type of the file to be attached
@return the http request
@throws UnsupportedEncodingException the unsupported encoding exception | [
"Create",
"a",
"multipart",
"upload",
"request",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L829-L862 |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.newMessageBuffer | private static MessageBuffer newMessageBuffer(ByteBuffer bb) {
"""
Creates a new MessageBuffer instance backed by ByteBuffer
@param bb
@return
"""
checkNotNull(bb);
if (mbBBConstructor != null) {
return newInstance(mbBBConstructor, bb);
}
return new MessageBuffer(bb);
} | java | private static MessageBuffer newMessageBuffer(ByteBuffer bb)
{
checkNotNull(bb);
if (mbBBConstructor != null) {
return newInstance(mbBBConstructor, bb);
}
return new MessageBuffer(bb);
} | [
"private",
"static",
"MessageBuffer",
"newMessageBuffer",
"(",
"ByteBuffer",
"bb",
")",
"{",
"checkNotNull",
"(",
"bb",
")",
";",
"if",
"(",
"mbBBConstructor",
"!=",
"null",
")",
"{",
"return",
"newInstance",
"(",
"mbBBConstructor",
",",
"bb",
")",
";",
"}",... | Creates a new MessageBuffer instance backed by ByteBuffer
@param bb
@return | [
"Creates",
"a",
"new",
"MessageBuffer",
"instance",
"backed",
"by",
"ByteBuffer"
] | train | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L288-L295 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/progressBar/ProgressBarRenderer.java | ProgressBarRenderer.startColSpanDiv | protected String startColSpanDiv(ResponseWriter rw, ProgressBar progressBar) throws IOException {
"""
Start the column span div (if there's one). This method is protected in
order to allow third-party frameworks to derive from it.
@param rw
the response writer
@throws IOException
may be thrown by the response writer
"""
String clazz = Responsive.getResponsiveStyleClass(progressBar, false);
if (clazz!= null && clazz.trim().length()>0) {
rw.startElement("div", progressBar);
rw.writeAttribute("class", clazz, "class");
}
return clazz;
} | java | protected String startColSpanDiv(ResponseWriter rw, ProgressBar progressBar) throws IOException {
String clazz = Responsive.getResponsiveStyleClass(progressBar, false);
if (clazz!= null && clazz.trim().length()>0) {
rw.startElement("div", progressBar);
rw.writeAttribute("class", clazz, "class");
}
return clazz;
} | [
"protected",
"String",
"startColSpanDiv",
"(",
"ResponseWriter",
"rw",
",",
"ProgressBar",
"progressBar",
")",
"throws",
"IOException",
"{",
"String",
"clazz",
"=",
"Responsive",
".",
"getResponsiveStyleClass",
"(",
"progressBar",
",",
"false",
")",
";",
"if",
"("... | Start the column span div (if there's one). This method is protected in
order to allow third-party frameworks to derive from it.
@param rw
the response writer
@throws IOException
may be thrown by the response writer | [
"Start",
"the",
"column",
"span",
"div",
"(",
"if",
"there",
"s",
"one",
")",
".",
"This",
"method",
"is",
"protected",
"in",
"order",
"to",
"allow",
"third",
"-",
"party",
"frameworks",
"to",
"derive",
"from",
"it",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/progressBar/ProgressBarRenderer.java#L159-L166 |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.prepareComboBox | public static void prepareComboBox(ComboBox box, Map<?, String> options) {
"""
Generates the options items for the combo box using the map entry keys as values and the values as labels.<p>
@param box the combo box to prepare
@param options the box options
"""
IndexedContainer container = new IndexedContainer();
container.addContainerProperty(PROPERTY_VALUE, Object.class, null);
container.addContainerProperty(PROPERTY_LABEL, String.class, "");
for (Entry<?, String> entry : options.entrySet()) {
Item item = container.addItem(entry.getKey());
item.getItemProperty(PROPERTY_VALUE).setValue(entry.getKey());
item.getItemProperty(PROPERTY_LABEL).setValue(entry.getValue());
}
box.setContainerDataSource(container);
box.setItemCaptionPropertyId(PROPERTY_LABEL);
} | java | public static void prepareComboBox(ComboBox box, Map<?, String> options) {
IndexedContainer container = new IndexedContainer();
container.addContainerProperty(PROPERTY_VALUE, Object.class, null);
container.addContainerProperty(PROPERTY_LABEL, String.class, "");
for (Entry<?, String> entry : options.entrySet()) {
Item item = container.addItem(entry.getKey());
item.getItemProperty(PROPERTY_VALUE).setValue(entry.getKey());
item.getItemProperty(PROPERTY_LABEL).setValue(entry.getValue());
}
box.setContainerDataSource(container);
box.setItemCaptionPropertyId(PROPERTY_LABEL);
} | [
"public",
"static",
"void",
"prepareComboBox",
"(",
"ComboBox",
"box",
",",
"Map",
"<",
"?",
",",
"String",
">",
"options",
")",
"{",
"IndexedContainer",
"container",
"=",
"new",
"IndexedContainer",
"(",
")",
";",
"container",
".",
"addContainerProperty",
"(",... | Generates the options items for the combo box using the map entry keys as values and the values as labels.<p>
@param box the combo box to prepare
@param options the box options | [
"Generates",
"the",
"options",
"items",
"for",
"the",
"combo",
"box",
"using",
"the",
"map",
"entry",
"keys",
"as",
"values",
"and",
"the",
"values",
"as",
"labels",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1025-L1037 |
javalite/activejdbc | javalite-common/src/main/java/org/javalite/common/JsonHelper.java | JsonHelper.toJsonString | public static String toJsonString(Object val, boolean pretty) {
"""
Convert Java object to a JSON string.
@param val Java object
@param pretty enable/disable pretty print
@return JSON string.
"""
try {
return pretty ? mapper.writerWithDefaultPrettyPrinter().with(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS).writeValueAsString(val) : mapper.writeValueAsString(val);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static String toJsonString(Object val, boolean pretty) {
try {
return pretty ? mapper.writerWithDefaultPrettyPrinter().with(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS).writeValueAsString(val) : mapper.writeValueAsString(val);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"String",
"toJsonString",
"(",
"Object",
"val",
",",
"boolean",
"pretty",
")",
"{",
"try",
"{",
"return",
"pretty",
"?",
"mapper",
".",
"writerWithDefaultPrettyPrinter",
"(",
")",
".",
"with",
"(",
"SerializationFeature",
".",
"ORDER_MAP_ENTR... | Convert Java object to a JSON string.
@param val Java object
@param pretty enable/disable pretty print
@return JSON string. | [
"Convert",
"Java",
"object",
"to",
"a",
"JSON",
"string",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/JsonHelper.java#L88-L94 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.createNewIndex | public MultiIndex createNewIndex(String suffix) throws IOException {
"""
Create a new index with the same actual context.
@return MultiIndex the actual index.
"""
IndexInfos indexInfos = new IndexInfos();
IndexUpdateMonitor indexUpdateMonitor = new DefaultIndexUpdateMonitor();
IndexerIoModeHandler modeHandler = new IndexerIoModeHandler(IndexerIoMode.READ_WRITE);
MultiIndex newIndex = new MultiIndex(this, getContext().getIndexingTree(), modeHandler,
indexInfos, indexUpdateMonitor, cloneDirectoryManager(this.getDirectoryManager(), suffix));
return newIndex;
} | java | public MultiIndex createNewIndex(String suffix) throws IOException {
IndexInfos indexInfos = new IndexInfos();
IndexUpdateMonitor indexUpdateMonitor = new DefaultIndexUpdateMonitor();
IndexerIoModeHandler modeHandler = new IndexerIoModeHandler(IndexerIoMode.READ_WRITE);
MultiIndex newIndex = new MultiIndex(this, getContext().getIndexingTree(), modeHandler,
indexInfos, indexUpdateMonitor, cloneDirectoryManager(this.getDirectoryManager(), suffix));
return newIndex;
} | [
"public",
"MultiIndex",
"createNewIndex",
"(",
"String",
"suffix",
")",
"throws",
"IOException",
"{",
"IndexInfos",
"indexInfos",
"=",
"new",
"IndexInfos",
"(",
")",
";",
"IndexUpdateMonitor",
"indexUpdateMonitor",
"=",
"new",
"DefaultIndexUpdateMonitor",
"(",
")",
... | Create a new index with the same actual context.
@return MultiIndex the actual index. | [
"Create",
"a",
"new",
"index",
"with",
"the",
"same",
"actual",
"context",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1881-L1891 |
indeedeng/util | io/src/main/java/com/indeed/util/io/Files.java | Files.readObjectFromFile | public static <T> T readObjectFromFile(String file, Class<T> clazz, boolean printException) {
"""
Reads an object of type {@code T} from {@code file}.
@param file file from which the object should be read
@param clazz non-null Class object for {@code T}
@param printException whether or not any stacktraces should be printed
@param <T> the return type
@return possibly null object of type {@code T}.
"""
final FileInputStream fileIn;
try {
fileIn = new FileInputStream(file);
} catch (Exception e) {
printException(e, printException);
return null;
}
final BufferedInputStream bufferedIn = new BufferedInputStream(fileIn);
final ObjectInputStream objIn;
try {
objIn = new ObjectInputStream(bufferedIn);
} catch (Exception e) {
printException(e, printException);
closeInputStream(fileIn, printException);
return null;
}
final Object ret;
try {
ret = objIn.readObject();
} catch (Exception e) {
printException(e, printException);
closeInputStream(objIn, printException); // objIn.close() also closes fileIn
return null;
}
closeInputStream(objIn, printException); // objIn.close() also closes fileIn
return clazz.cast(ret);
} | java | public static <T> T readObjectFromFile(String file, Class<T> clazz, boolean printException) {
final FileInputStream fileIn;
try {
fileIn = new FileInputStream(file);
} catch (Exception e) {
printException(e, printException);
return null;
}
final BufferedInputStream bufferedIn = new BufferedInputStream(fileIn);
final ObjectInputStream objIn;
try {
objIn = new ObjectInputStream(bufferedIn);
} catch (Exception e) {
printException(e, printException);
closeInputStream(fileIn, printException);
return null;
}
final Object ret;
try {
ret = objIn.readObject();
} catch (Exception e) {
printException(e, printException);
closeInputStream(objIn, printException); // objIn.close() also closes fileIn
return null;
}
closeInputStream(objIn, printException); // objIn.close() also closes fileIn
return clazz.cast(ret);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"readObjectFromFile",
"(",
"String",
"file",
",",
"Class",
"<",
"T",
">",
"clazz",
",",
"boolean",
"printException",
")",
"{",
"final",
"FileInputStream",
"fileIn",
";",
"try",
"{",
"fileIn",
"=",
"new",
"FileInputSt... | Reads an object of type {@code T} from {@code file}.
@param file file from which the object should be read
@param clazz non-null Class object for {@code T}
@param printException whether or not any stacktraces should be printed
@param <T> the return type
@return possibly null object of type {@code T}. | [
"Reads",
"an",
"object",
"of",
"type",
"{",
"@code",
"T",
"}",
"from",
"{",
"@code",
"file",
"}",
"."
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/Files.java#L422-L452 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/adapters/StickyHeaderAdapter.java | StickyHeaderAdapter.onCreateViewHolder | @Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
"""
the onCreateViewHolder is managed by the FastAdapter so forward this correctly
@param parent
@param viewType
@return
"""
return mFastAdapter.onCreateViewHolder(parent, viewType);
} | java | @Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return mFastAdapter.onCreateViewHolder(parent, viewType);
} | [
"@",
"Override",
"public",
"RecyclerView",
".",
"ViewHolder",
"onCreateViewHolder",
"(",
"ViewGroup",
"parent",
",",
"int",
"viewType",
")",
"{",
"return",
"mFastAdapter",
".",
"onCreateViewHolder",
"(",
"parent",
",",
"viewType",
")",
";",
"}"
] | the onCreateViewHolder is managed by the FastAdapter so forward this correctly
@param parent
@param viewType
@return | [
"the",
"onCreateViewHolder",
"is",
"managed",
"by",
"the",
"FastAdapter",
"so",
"forward",
"this",
"correctly"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/adapters/StickyHeaderAdapter.java#L179-L182 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.mapToBean | public static <T> T mapToBean(Map<?, ?> map, Class<T> beanClass, CopyOptions copyOptions) {
"""
Map转换为Bean对象
@param <T> Bean类型
@param map {@link Map}
@param beanClass Bean Class
@param copyOptions 转Bean选项
@return Bean
"""
return fillBeanWithMap(map, ReflectUtil.newInstance(beanClass), copyOptions);
} | java | public static <T> T mapToBean(Map<?, ?> map, Class<T> beanClass, CopyOptions copyOptions) {
return fillBeanWithMap(map, ReflectUtil.newInstance(beanClass), copyOptions);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"mapToBean",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"Class",
"<",
"T",
">",
"beanClass",
",",
"CopyOptions",
"copyOptions",
")",
"{",
"return",
"fillBeanWithMap",
"(",
"map",
",",
"ReflectUtil",
".",
... | Map转换为Bean对象
@param <T> Bean类型
@param map {@link Map}
@param beanClass Bean Class
@param copyOptions 转Bean选项
@return Bean | [
"Map转换为Bean对象"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L354-L356 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/util/ReflectionUtil.java | ReflectionUtil.getValue | public static Object getValue(Object instance, String fieldName) {
"""
Retrieves the value of a field of an object instance via reflection
@param instance to inspect
@param fieldName name of field to retrieve
@return a value
"""
Field f = findFieldRecursively(instance.getClass(), fieldName);
if (f == null) throw new CacheException("Could not find field named '" + fieldName + "' on instance " + instance);
try {
f.setAccessible(true);
return f.get(instance);
} catch (IllegalAccessException iae) {
throw new CacheException("Cannot access field " + f, iae);
}
} | java | public static Object getValue(Object instance, String fieldName) {
Field f = findFieldRecursively(instance.getClass(), fieldName);
if (f == null) throw new CacheException("Could not find field named '" + fieldName + "' on instance " + instance);
try {
f.setAccessible(true);
return f.get(instance);
} catch (IllegalAccessException iae) {
throw new CacheException("Cannot access field " + f, iae);
}
} | [
"public",
"static",
"Object",
"getValue",
"(",
"Object",
"instance",
",",
"String",
"fieldName",
")",
"{",
"Field",
"f",
"=",
"findFieldRecursively",
"(",
"instance",
".",
"getClass",
"(",
")",
",",
"fieldName",
")",
";",
"if",
"(",
"f",
"==",
"null",
")... | Retrieves the value of a field of an object instance via reflection
@param instance to inspect
@param fieldName name of field to retrieve
@return a value | [
"Retrieves",
"the",
"value",
"of",
"a",
"field",
"of",
"an",
"object",
"instance",
"via",
"reflection"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/ReflectionUtil.java#L272-L281 |
rythmengine/rythmengine | src/main/java/org/rythmengine/RythmEngine.java | RythmEngine.renderStr | public String renderStr(String key, String template, Object... args) {
"""
Render template by string typed inline template content and an array of
template args. The render result is returned as a String
<p/>
<p>See {@link #getTemplate(java.io.File, Object...)} for note on
render args</p>
@param template the inline template content
@param args the render args array
@return render result
"""
return renderString(key, template, args);
} | java | public String renderStr(String key, String template, Object... args) {
return renderString(key, template, args);
} | [
"public",
"String",
"renderStr",
"(",
"String",
"key",
",",
"String",
"template",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"renderString",
"(",
"key",
",",
"template",
",",
"args",
")",
";",
"}"
] | Render template by string typed inline template content and an array of
template args. The render result is returned as a String
<p/>
<p>See {@link #getTemplate(java.io.File, Object...)} for note on
render args</p>
@param template the inline template content
@param args the render args array
@return render result | [
"Render",
"template",
"by",
"string",
"typed",
"inline",
"template",
"content",
"and",
"an",
"array",
"of",
"template",
"args",
".",
"The",
"render",
"result",
"is",
"returned",
"as",
"a",
"String",
"<p",
"/",
">",
"<p",
">",
"See",
"{",
"@link",
"#getTe... | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/RythmEngine.java#L1130-L1132 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getBackStoryAnswerInfo | public void getBackStoryAnswerInfo(String[] ids, Callback<List<BackStoryAnswer>> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on back story answer API go <a href="https://wiki.guildwars2.com/wiki/API:2/backstory/answers">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of back story answer id(s)
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key
@throws NullPointerException if given {@link Callback} is empty
@see BackStoryAnswer back story answer info
"""
isParamValid(new ParamChecker(ids));
gw2API.getBackStoryAnswerInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getBackStoryAnswerInfo(String[] ids, Callback<List<BackStoryAnswer>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getBackStoryAnswerInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getBackStoryAnswerInfo",
"(",
"String",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"BackStoryAnswer",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecke... | For more info on back story answer API go <a href="https://wiki.guildwars2.com/wiki/API:2/backstory/answers">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of back story answer id(s)
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key
@throws NullPointerException if given {@link Callback} is empty
@see BackStoryAnswer back story answer info | [
"For",
"more",
"info",
"on",
"back",
"story",
"answer",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"backstory",
"/",
"answers",
">",
"here<",
"/",
"a",
">",
"... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L591-L594 |
cdk/cdk | storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java | CDKToBeam.addGeometricConfiguration | private static void addGeometricConfiguration(IDoubleBondStereochemistry dbs, int flavour, GraphBuilder gb, Map<IAtom, Integer> indices) {
"""
Add double-bond stereo configuration to the Beam GraphBuilder.
@param dbs stereo element specifying double-bond configuration
@param gb the current graph builder
@param indices atom indices
"""
IBond db = dbs.getStereoBond();
IBond[] bs = dbs.getBonds();
// don't try to set a configuration on aromatic bonds
if (SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && db.getFlag(CDKConstants.ISAROMATIC)) return;
int u = indices.get(db.getBegin());
int v = indices.get(db.getEnd());
// is bs[0] always connected to db.atom(0)?
int x = indices.get(bs[0].getOther(db.getBegin()));
int y = indices.get(bs[1].getOther(db.getEnd()));
if (dbs.getStereo() == TOGETHER) {
gb.geometric(u, v).together(x, y);
} else {
gb.geometric(u, v).opposite(x, y);
}
} | java | private static void addGeometricConfiguration(IDoubleBondStereochemistry dbs, int flavour, GraphBuilder gb, Map<IAtom, Integer> indices) {
IBond db = dbs.getStereoBond();
IBond[] bs = dbs.getBonds();
// don't try to set a configuration on aromatic bonds
if (SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && db.getFlag(CDKConstants.ISAROMATIC)) return;
int u = indices.get(db.getBegin());
int v = indices.get(db.getEnd());
// is bs[0] always connected to db.atom(0)?
int x = indices.get(bs[0].getOther(db.getBegin()));
int y = indices.get(bs[1].getOther(db.getEnd()));
if (dbs.getStereo() == TOGETHER) {
gb.geometric(u, v).together(x, y);
} else {
gb.geometric(u, v).opposite(x, y);
}
} | [
"private",
"static",
"void",
"addGeometricConfiguration",
"(",
"IDoubleBondStereochemistry",
"dbs",
",",
"int",
"flavour",
",",
"GraphBuilder",
"gb",
",",
"Map",
"<",
"IAtom",
",",
"Integer",
">",
"indices",
")",
"{",
"IBond",
"db",
"=",
"dbs",
".",
"getStereo... | Add double-bond stereo configuration to the Beam GraphBuilder.
@param dbs stereo element specifying double-bond configuration
@param gb the current graph builder
@param indices atom indices | [
"Add",
"double",
"-",
"bond",
"stereo",
"configuration",
"to",
"the",
"Beam",
"GraphBuilder",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java#L309-L329 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java | SftpClient.getFiles | public SftpFile[] getFiles(String remote, String local, boolean resume)
throws FileNotFoundException, SftpStatusException, SshException,
TransferCancelledException {
"""
Download the remote files into the local file.
@param remote
@param local
@param resume
attempt to resume an interrupted download
@return SftpFile[]
@throws FileNotFoundException
@throws SftpStatusException
@throws SshException
@throws TransferCancelledException
"""
return getFiles(remote, local, null, resume);
} | java | public SftpFile[] getFiles(String remote, String local, boolean resume)
throws FileNotFoundException, SftpStatusException, SshException,
TransferCancelledException {
return getFiles(remote, local, null, resume);
} | [
"public",
"SftpFile",
"[",
"]",
"getFiles",
"(",
"String",
"remote",
",",
"String",
"local",
",",
"boolean",
"resume",
")",
"throws",
"FileNotFoundException",
",",
"SftpStatusException",
",",
"SshException",
",",
"TransferCancelledException",
"{",
"return",
"getFile... | Download the remote files into the local file.
@param remote
@param local
@param resume
attempt to resume an interrupted download
@return SftpFile[]
@throws FileNotFoundException
@throws SftpStatusException
@throws SshException
@throws TransferCancelledException | [
"Download",
"the",
"remote",
"files",
"into",
"the",
"local",
"file",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L2993-L2997 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadBitmapOptimized | private static Bitmap loadBitmapOptimized(ImageSource source, int limit) throws ImageLoadException {
"""
Loading bitmap from ImageSource with limit of amout of pixels
@param source image source
@param limit maximum pixels size
@return loaded bitmap
@throws ImageLoadException if it is unable to load image
"""
int scale = getScaleFactor(source.getImageMetadata(), limit);
return loadBitmap(source, scale);
} | java | private static Bitmap loadBitmapOptimized(ImageSource source, int limit) throws ImageLoadException {
int scale = getScaleFactor(source.getImageMetadata(), limit);
return loadBitmap(source, scale);
} | [
"private",
"static",
"Bitmap",
"loadBitmapOptimized",
"(",
"ImageSource",
"source",
",",
"int",
"limit",
")",
"throws",
"ImageLoadException",
"{",
"int",
"scale",
"=",
"getScaleFactor",
"(",
"source",
".",
"getImageMetadata",
"(",
")",
",",
"limit",
")",
";",
... | Loading bitmap from ImageSource with limit of amout of pixels
@param source image source
@param limit maximum pixels size
@return loaded bitmap
@throws ImageLoadException if it is unable to load image | [
"Loading",
"bitmap",
"from",
"ImageSource",
"with",
"limit",
"of",
"amout",
"of",
"pixels"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L384-L387 |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.getInterimCluster | public static Cluster getInterimCluster(Cluster currentCluster, Cluster finalCluster) {
"""
Given the current cluster and final cluster, generates an interim cluster
with empty new nodes (and zones).
@param currentCluster Current cluster metadata
@param finalCluster Final cluster metadata
@return Returns a new interim cluster which contains nodes and zones of
final cluster, but with empty partition lists if they were not
present in current cluster.
"""
List<Node> newNodeList = new ArrayList<Node>(currentCluster.getNodes());
for(Node node: finalCluster.getNodes()) {
if(!currentCluster.hasNodeWithId(node.getId())) {
newNodeList.add(UpdateClusterUtils.updateNode(node, new ArrayList<Integer>()));
}
}
Collections.sort(newNodeList);
return new Cluster(currentCluster.getName(),
newNodeList,
Lists.newArrayList(finalCluster.getZones()));
} | java | public static Cluster getInterimCluster(Cluster currentCluster, Cluster finalCluster) {
List<Node> newNodeList = new ArrayList<Node>(currentCluster.getNodes());
for(Node node: finalCluster.getNodes()) {
if(!currentCluster.hasNodeWithId(node.getId())) {
newNodeList.add(UpdateClusterUtils.updateNode(node, new ArrayList<Integer>()));
}
}
Collections.sort(newNodeList);
return new Cluster(currentCluster.getName(),
newNodeList,
Lists.newArrayList(finalCluster.getZones()));
} | [
"public",
"static",
"Cluster",
"getInterimCluster",
"(",
"Cluster",
"currentCluster",
",",
"Cluster",
"finalCluster",
")",
"{",
"List",
"<",
"Node",
">",
"newNodeList",
"=",
"new",
"ArrayList",
"<",
"Node",
">",
"(",
"currentCluster",
".",
"getNodes",
"(",
")"... | Given the current cluster and final cluster, generates an interim cluster
with empty new nodes (and zones).
@param currentCluster Current cluster metadata
@param finalCluster Final cluster metadata
@return Returns a new interim cluster which contains nodes and zones of
final cluster, but with empty partition lists if they were not
present in current cluster. | [
"Given",
"the",
"current",
"cluster",
"and",
"final",
"cluster",
"generates",
"an",
"interim",
"cluster",
"with",
"empty",
"new",
"nodes",
"(",
"and",
"zones",
")",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L268-L279 |
derari/cthul | strings/src/main/java/org/cthul/strings/plural/RulePluralizer.java | RulePluralizer.transform | protected String transform(String word, List<Rule> rules) {
"""
Converts a word.
<p/>
The first rule that matches is applied to the word.
If no rule matches, returns result of {@link #noMatch(java.lang.String)}.
<p/>
Is used by {@code pluralOf} and {@code singularOf}
@param word
@param rules
@return tranformed word
@see RegexPluralizer#pluralOf(java.lang.String)
@see RegexPluralizer#singularOf(java.lang.String)
"""
String wordLower = lower(word);
for (Rule r: rules) {
String s = r.apply(word, wordLower);
if (s != null) return s;
}
return noMatch(word);
} | java | protected String transform(String word, List<Rule> rules) {
String wordLower = lower(word);
for (Rule r: rules) {
String s = r.apply(word, wordLower);
if (s != null) return s;
}
return noMatch(word);
} | [
"protected",
"String",
"transform",
"(",
"String",
"word",
",",
"List",
"<",
"Rule",
">",
"rules",
")",
"{",
"String",
"wordLower",
"=",
"lower",
"(",
"word",
")",
";",
"for",
"(",
"Rule",
"r",
":",
"rules",
")",
"{",
"String",
"s",
"=",
"r",
".",
... | Converts a word.
<p/>
The first rule that matches is applied to the word.
If no rule matches, returns result of {@link #noMatch(java.lang.String)}.
<p/>
Is used by {@code pluralOf} and {@code singularOf}
@param word
@param rules
@return tranformed word
@see RegexPluralizer#pluralOf(java.lang.String)
@see RegexPluralizer#singularOf(java.lang.String) | [
"Converts",
"a",
"word",
".",
"<p",
"/",
">",
"The",
"first",
"rule",
"that",
"matches",
"is",
"applied",
"to",
"the",
"word",
".",
"If",
"no",
"rule",
"matches",
"returns",
"result",
"of",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/strings/src/main/java/org/cthul/strings/plural/RulePluralizer.java#L181-L188 |
linkhub-sdk/popbill.sdk.java | src/main/java/com/popbill/api/taxinvoice/TaxinvoiceServiceImp.java | TaxinvoiceServiceImp.attachFile | @Override
public Response attachFile(String CorpNum, MgtKeyType KeyType,
String MgtKey, String DisplayName, InputStream FileData)
throws PopbillException {
"""
/* (non-Javadoc)
@see com.popbill.api.TaxinvoiceService#attachFile(java.lang.String, com.popbill.api.taxinvoice.MgtKeyType, java.lang.String, java.lang.String, java.io.InputStream)
"""
return attachFile(CorpNum, KeyType, MgtKey, DisplayName, FileData, null);
} | java | @Override
public Response attachFile(String CorpNum, MgtKeyType KeyType,
String MgtKey, String DisplayName, InputStream FileData)
throws PopbillException {
return attachFile(CorpNum, KeyType, MgtKey, DisplayName, FileData, null);
} | [
"@",
"Override",
"public",
"Response",
"attachFile",
"(",
"String",
"CorpNum",
",",
"MgtKeyType",
"KeyType",
",",
"String",
"MgtKey",
",",
"String",
"DisplayName",
",",
"InputStream",
"FileData",
")",
"throws",
"PopbillException",
"{",
"return",
"attachFile",
"(",... | /* (non-Javadoc)
@see com.popbill.api.TaxinvoiceService#attachFile(java.lang.String, com.popbill.api.taxinvoice.MgtKeyType, java.lang.String, java.lang.String, java.io.InputStream) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/linkhub-sdk/popbill.sdk.java/blob/63a341fefe96d60a368776638f3d4c81888238b7/src/main/java/com/popbill/api/taxinvoice/TaxinvoiceServiceImp.java#L863-L868 |
google/closure-compiler | src/com/google/javascript/jscomp/FileInstrumentationData.java | FileInstrumentationData.addBranches | void addBranches(int lineNumber, int numberOfBranches) {
"""
Add a number of branches to a line.
@param lineNumber the line number that contains the branch statement.
@param numberOfBranches the number of branches to add to the record.
"""
int lineIdx = lineNumber - 1;
Integer currentValue = branchesInLine.get(Integer.valueOf(lineIdx));
if (currentValue == null) {
branchesInLine.put(lineIdx, numberOfBranches);
} else {
branchesInLine.put(lineIdx, currentValue + numberOfBranches);
}
} | java | void addBranches(int lineNumber, int numberOfBranches) {
int lineIdx = lineNumber - 1;
Integer currentValue = branchesInLine.get(Integer.valueOf(lineIdx));
if (currentValue == null) {
branchesInLine.put(lineIdx, numberOfBranches);
} else {
branchesInLine.put(lineIdx, currentValue + numberOfBranches);
}
} | [
"void",
"addBranches",
"(",
"int",
"lineNumber",
",",
"int",
"numberOfBranches",
")",
"{",
"int",
"lineIdx",
"=",
"lineNumber",
"-",
"1",
";",
"Integer",
"currentValue",
"=",
"branchesInLine",
".",
"get",
"(",
"Integer",
".",
"valueOf",
"(",
"lineIdx",
")",
... | Add a number of branches to a line.
@param lineNumber the line number that contains the branch statement.
@param numberOfBranches the number of branches to add to the record. | [
"Add",
"a",
"number",
"of",
"branches",
"to",
"a",
"line",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FileInstrumentationData.java#L214-L222 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ResourceCollection.java | ResourceCollection.addCreatedResource | public void addCreatedResource(Location location, Resource resource) {
"""
Add a resource created within the analyzed method.
@param location
the location
@param resource
the resource created at that location
"""
resourceList.add(resource);
locationToResourceMap.put(location, resource);
} | java | public void addCreatedResource(Location location, Resource resource) {
resourceList.add(resource);
locationToResourceMap.put(location, resource);
} | [
"public",
"void",
"addCreatedResource",
"(",
"Location",
"location",
",",
"Resource",
"resource",
")",
"{",
"resourceList",
".",
"add",
"(",
"resource",
")",
";",
"locationToResourceMap",
".",
"put",
"(",
"location",
",",
"resource",
")",
";",
"}"
] | Add a resource created within the analyzed method.
@param location
the location
@param resource
the resource created at that location | [
"Add",
"a",
"resource",
"created",
"within",
"the",
"analyzed",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ResourceCollection.java#L77-L80 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/TrackMetadata.java | TrackMetadata.buildColorItem | private ColorItem buildColorItem(Message menuItem) {
"""
Creates a color item that represents a color field found for a track based on a dbserver message.
@param menuItem the rendered menu item containing the color metadata field
@return the color metadata field
"""
final int colorId = (int) ((NumberField) menuItem.arguments.get(1)).getValue();
final String label = ((StringField) menuItem.arguments.get(3)).getValue();
return buildColorItem(colorId, label);
} | java | private ColorItem buildColorItem(Message menuItem) {
final int colorId = (int) ((NumberField) menuItem.arguments.get(1)).getValue();
final String label = ((StringField) menuItem.arguments.get(3)).getValue();
return buildColorItem(colorId, label);
} | [
"private",
"ColorItem",
"buildColorItem",
"(",
"Message",
"menuItem",
")",
"{",
"final",
"int",
"colorId",
"=",
"(",
"int",
")",
"(",
"(",
"NumberField",
")",
"menuItem",
".",
"arguments",
".",
"get",
"(",
"1",
")",
")",
".",
"getValue",
"(",
")",
";",... | Creates a color item that represents a color field found for a track based on a dbserver message.
@param menuItem the rendered menu item containing the color metadata field
@return the color metadata field | [
"Creates",
"a",
"color",
"item",
"that",
"represents",
"a",
"color",
"field",
"found",
"for",
"a",
"track",
"based",
"on",
"a",
"dbserver",
"message",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TrackMetadata.java#L168-L172 |
micronaut-projects/micronaut-core | function/src/main/java/io/micronaut/function/executor/FunctionInitializer.java | FunctionInitializer.run | public void run(String[] args, Function<ParseContext, ?> supplier) throws IOException {
"""
This method is designed to be called when using the {@link FunctionInitializer} from a static Application main method.
@param args The arguments passed to main
@param supplier The function that executes this function
@throws IOException If an error occurs
"""
ApplicationContext applicationContext = this.applicationContext;
this.functionExitHandler = applicationContext.findBean(FunctionExitHandler.class).orElse(this.functionExitHandler);
ParseContext context = new ParseContext(args);
try {
Object result = supplier.apply(context);
if (result != null) {
LocalFunctionRegistry bean = applicationContext.getBean(LocalFunctionRegistry.class);
StreamFunctionExecutor.encode(applicationContext.getEnvironment(), bean, result.getClass(), result, System.out);
functionExitHandler.exitWithSuccess();
}
} catch (Exception e) {
functionExitHandler.exitWithError(e, context.debug);
}
} | java | public void run(String[] args, Function<ParseContext, ?> supplier) throws IOException {
ApplicationContext applicationContext = this.applicationContext;
this.functionExitHandler = applicationContext.findBean(FunctionExitHandler.class).orElse(this.functionExitHandler);
ParseContext context = new ParseContext(args);
try {
Object result = supplier.apply(context);
if (result != null) {
LocalFunctionRegistry bean = applicationContext.getBean(LocalFunctionRegistry.class);
StreamFunctionExecutor.encode(applicationContext.getEnvironment(), bean, result.getClass(), result, System.out);
functionExitHandler.exitWithSuccess();
}
} catch (Exception e) {
functionExitHandler.exitWithError(e, context.debug);
}
} | [
"public",
"void",
"run",
"(",
"String",
"[",
"]",
"args",
",",
"Function",
"<",
"ParseContext",
",",
"?",
">",
"supplier",
")",
"throws",
"IOException",
"{",
"ApplicationContext",
"applicationContext",
"=",
"this",
".",
"applicationContext",
";",
"this",
".",
... | This method is designed to be called when using the {@link FunctionInitializer} from a static Application main method.
@param args The arguments passed to main
@param supplier The function that executes this function
@throws IOException If an error occurs | [
"This",
"method",
"is",
"designed",
"to",
"be",
"called",
"when",
"using",
"the",
"{",
"@link",
"FunctionInitializer",
"}",
"from",
"a",
"static",
"Application",
"main",
"method",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/function/src/main/java/io/micronaut/function/executor/FunctionInitializer.java#L90-L105 |
UrielCh/ovh-java-sdk | ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java | ApiOvhMsServices.serviceName_account_userPrincipalName_sharepoint_GET | public OvhSharepointInformation serviceName_account_userPrincipalName_sharepoint_GET(String serviceName, String userPrincipalName) throws IOException {
"""
Get this object properties
REST: GET /msServices/{serviceName}/account/{userPrincipalName}/sharepoint
@param serviceName [required] The internal name of your Active Directory organization
@param userPrincipalName [required] User Principal Name
API beta
"""
String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sharepoint";
StringBuilder sb = path(qPath, serviceName, userPrincipalName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSharepointInformation.class);
} | java | public OvhSharepointInformation serviceName_account_userPrincipalName_sharepoint_GET(String serviceName, String userPrincipalName) throws IOException {
String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sharepoint";
StringBuilder sb = path(qPath, serviceName, userPrincipalName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSharepointInformation.class);
} | [
"public",
"OvhSharepointInformation",
"serviceName_account_userPrincipalName_sharepoint_GET",
"(",
"String",
"serviceName",
",",
"String",
"userPrincipalName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/msServices/{serviceName}/account/{userPrincipalName}/sharepoi... | Get this object properties
REST: GET /msServices/{serviceName}/account/{userPrincipalName}/sharepoint
@param serviceName [required] The internal name of your Active Directory organization
@param userPrincipalName [required] User Principal Name
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L322-L327 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java | DeploymentsInner.exportTemplate | public DeploymentExportResultInner exportTemplate(String resourceGroupName, String deploymentName) {
"""
Exports the template used for specified deployment.
@param resourceGroupName The name of the resource group. The name is case insensitive.
@param deploymentName The name of the deployment from which to get the template.
@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 DeploymentExportResultInner object if successful.
"""
return exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body();
} | java | public DeploymentExportResultInner exportTemplate(String resourceGroupName, String deploymentName) {
return exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body();
} | [
"public",
"DeploymentExportResultInner",
"exportTemplate",
"(",
"String",
"resourceGroupName",
",",
"String",
"deploymentName",
")",
"{",
"return",
"exportTemplateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"deploymentName",
")",
".",
"toBlocking",
"(",
")",
... | Exports the template used for specified deployment.
@param resourceGroupName The name of the resource group. The name is case insensitive.
@param deploymentName The name of the deployment from which to get the template.
@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 DeploymentExportResultInner object if successful. | [
"Exports",
"the",
"template",
"used",
"for",
"specified",
"deployment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java#L830-L832 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/buffer/Buffer.java | Buffer.setVal | public void setVal(int offset, Constant val, long txNum, LogSeqNum lsn) {
"""
Writes a value to the specified offset of this buffer's page. This method
assumes that the transaction has already written an appropriate log
record. The buffer saves the id of the transaction and the LSN of the log
record. A negative lsn value indicates that a log record was not
necessary.
@param offset
the byte offset within the page
@param val
the new value to be written
@param txNum
the id of the transaction performing the modification
@param lsn
the LSN of the corresponding log record
"""
internalLock.writeLock().lock();
try {
modifiedBy.add(txNum);
if (lsn != null && lsn.compareTo(lastLsn) > 0)
lastLsn = lsn;
// Put the last LSN in front of the data
lastLsn.writeToPage(contents, LAST_LSN_OFFSET);
contents.setVal(DATA_START_OFFSET + offset, val);
} finally {
internalLock.writeLock().unlock();
}
} | java | public void setVal(int offset, Constant val, long txNum, LogSeqNum lsn) {
internalLock.writeLock().lock();
try {
modifiedBy.add(txNum);
if (lsn != null && lsn.compareTo(lastLsn) > 0)
lastLsn = lsn;
// Put the last LSN in front of the data
lastLsn.writeToPage(contents, LAST_LSN_OFFSET);
contents.setVal(DATA_START_OFFSET + offset, val);
} finally {
internalLock.writeLock().unlock();
}
} | [
"public",
"void",
"setVal",
"(",
"int",
"offset",
",",
"Constant",
"val",
",",
"long",
"txNum",
",",
"LogSeqNum",
"lsn",
")",
"{",
"internalLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"modifiedBy",
".",
"add",
"(",
"txN... | Writes a value to the specified offset of this buffer's page. This method
assumes that the transaction has already written an appropriate log
record. The buffer saves the id of the transaction and the LSN of the log
record. A negative lsn value indicates that a log record was not
necessary.
@param offset
the byte offset within the page
@param val
the new value to be written
@param txNum
the id of the transaction performing the modification
@param lsn
the LSN of the corresponding log record | [
"Writes",
"a",
"value",
"to",
"the",
"specified",
"offset",
"of",
"this",
"buffer",
"s",
"page",
".",
"This",
"method",
"assumes",
"that",
"the",
"transaction",
"has",
"already",
"written",
"an",
"appropriate",
"log",
"record",
".",
"The",
"buffer",
"saves",... | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/Buffer.java#L121-L134 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.getTagsWithServiceResponseAsync | public Observable<ServiceResponse<List<Tag>>> getTagsWithServiceResponseAsync(UUID projectId, GetTagsOptionalParameter getTagsOptionalParameter) {
"""
Get the tags for a given project and iteration.
@param projectId The project id
@param getTagsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<Tag> object
"""
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final UUID iterationId = getTagsOptionalParameter != null ? getTagsOptionalParameter.iterationId() : null;
return getTagsWithServiceResponseAsync(projectId, iterationId);
} | java | public Observable<ServiceResponse<List<Tag>>> getTagsWithServiceResponseAsync(UUID projectId, GetTagsOptionalParameter getTagsOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final UUID iterationId = getTagsOptionalParameter != null ? getTagsOptionalParameter.iterationId() : null;
return getTagsWithServiceResponseAsync(projectId, iterationId);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"List",
"<",
"Tag",
">",
">",
">",
"getTagsWithServiceResponseAsync",
"(",
"UUID",
"projectId",
",",
"GetTagsOptionalParameter",
"getTagsOptionalParameter",
")",
"{",
"if",
"(",
"projectId",
"==",
"null",
")",
"... | Get the tags for a given project and iteration.
@param projectId The project id
@param getTagsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<Tag> object | [
"Get",
"the",
"tags",
"for",
"a",
"given",
"project",
"and",
"iteration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L495-L505 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/matching/ConsumerMonitorRegistrar.java | ConsumerMonitorRegistrar.deregisterMonitor | public void deregisterMonitor(ConnectionImpl connection,
ConsumerSetChangeCallback callback)
throws SINotPossibleInCurrentConfigurationException {
"""
Method deregisterMonitor
Deregisters a previously registered callback.
@param callback
@throws SINotPossibleInCurrentConfigurationException
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"deregisterMonitor",
new Object[] { connection, callback});
// Retrieve the callback from the index
TopicRecord tRecord = retrieveCallbackFromConnectionIndex(connection, callback);
if(tRecord != null)
{
// Have found the callback in the index, now remove the callback from
// the appropriate registered monitors table.
if(tRecord.isWildcarded)
{
removeCallbackFromRegisteredMonitors(callback,
tRecord.topicExpression,
true, // isWildcarded
_registeredWildcardConsumerMonitors);
}
else
{
// Handle the non-wildcard case
removeCallbackFromRegisteredMonitors(callback,
tRecord.topicExpression,
false, // isWildcarded
_registeredExactConsumerMonitors);
}
}
else
{
// Failed to find any reference to callback
// Build the message for the Exception
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deregisterMonitor", callback);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.ConsumerMonitorRegistrar",
"1:237:1.10",
callback });
throw new SINotPossibleInCurrentConfigurationException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.ConsumerMonitorRegistrar",
"1:244:1.10",
callback },
null));
}
// Now remove the callback from the index
removeCallbackFromConnectionIndex(connection, callback);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deregisterMonitor");
} | java | public void deregisterMonitor(ConnectionImpl connection,
ConsumerSetChangeCallback callback)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"deregisterMonitor",
new Object[] { connection, callback});
// Retrieve the callback from the index
TopicRecord tRecord = retrieveCallbackFromConnectionIndex(connection, callback);
if(tRecord != null)
{
// Have found the callback in the index, now remove the callback from
// the appropriate registered monitors table.
if(tRecord.isWildcarded)
{
removeCallbackFromRegisteredMonitors(callback,
tRecord.topicExpression,
true, // isWildcarded
_registeredWildcardConsumerMonitors);
}
else
{
// Handle the non-wildcard case
removeCallbackFromRegisteredMonitors(callback,
tRecord.topicExpression,
false, // isWildcarded
_registeredExactConsumerMonitors);
}
}
else
{
// Failed to find any reference to callback
// Build the message for the Exception
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deregisterMonitor", callback);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.ConsumerMonitorRegistrar",
"1:237:1.10",
callback });
throw new SINotPossibleInCurrentConfigurationException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.ConsumerMonitorRegistrar",
"1:244:1.10",
callback },
null));
}
// Now remove the callback from the index
removeCallbackFromConnectionIndex(connection, callback);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deregisterMonitor");
} | [
"public",
"void",
"deregisterMonitor",
"(",
"ConnectionImpl",
"connection",
",",
"ConsumerSetChangeCallback",
"callback",
")",
"throws",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
"."... | Method deregisterMonitor
Deregisters a previously registered callback.
@param callback
@throws SINotPossibleInCurrentConfigurationException | [
"Method",
"deregisterMonitor"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/matching/ConsumerMonitorRegistrar.java#L177-L238 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java | GenericAuditEventMessageImpl.setAuditSourceId | public void setAuditSourceId(String sourceId, String enterpriseSiteId) {
"""
Sets a Audit Source Identification block for a given Audit Source ID
and Audit Source Enterprise Site ID
@param sourceId The Audit Source ID to use
@param enterpriseSiteId The Audit Enterprise Site ID to use
"""
setAuditSourceId(sourceId, enterpriseSiteId, (RFC3881AuditSourceTypes[])null);
} | java | public void setAuditSourceId(String sourceId, String enterpriseSiteId)
{
setAuditSourceId(sourceId, enterpriseSiteId, (RFC3881AuditSourceTypes[])null);
} | [
"public",
"void",
"setAuditSourceId",
"(",
"String",
"sourceId",
",",
"String",
"enterpriseSiteId",
")",
"{",
"setAuditSourceId",
"(",
"sourceId",
",",
"enterpriseSiteId",
",",
"(",
"RFC3881AuditSourceTypes",
"[",
"]",
")",
"null",
")",
";",
"}"
] | Sets a Audit Source Identification block for a given Audit Source ID
and Audit Source Enterprise Site ID
@param sourceId The Audit Source ID to use
@param enterpriseSiteId The Audit Enterprise Site ID to use | [
"Sets",
"a",
"Audit",
"Source",
"Identification",
"block",
"for",
"a",
"given",
"Audit",
"Source",
"ID",
"and",
"Audit",
"Source",
"Enterprise",
"Site",
"ID"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java#L77-L80 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanRequest.java | ScanRequest.setExclusiveStartKey | public void setExclusiveStartKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey)
throws IllegalArgumentException {
"""
The primary hash and range keys of the first item that this operation will evaluate. Use the value that was
returned for <i>LastEvaluatedKey</i> in the previous operation.
<p>
The data type for <i>ExclusiveStartKey</i> must be String, Number or Binary. No set data types are allowed.
@param hashKey
a map entry including the name and value of the primary hash key.
@param rangeKey
a map entry including the name and value of the primary range key, or null if it is a hash-only table.
"""
java.util.HashMap<String, AttributeValue> exclusiveStartKey = new java.util.HashMap<String, AttributeValue>();
if (hashKey != null) {
exclusiveStartKey.put(hashKey.getKey(), hashKey.getValue());
} else {
throw new IllegalArgumentException("hashKey must be non-null object.");
}
if (rangeKey != null) {
exclusiveStartKey.put(rangeKey.getKey(), rangeKey.getValue());
}
setExclusiveStartKey(exclusiveStartKey);
} | java | public void setExclusiveStartKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey)
throws IllegalArgumentException {
java.util.HashMap<String, AttributeValue> exclusiveStartKey = new java.util.HashMap<String, AttributeValue>();
if (hashKey != null) {
exclusiveStartKey.put(hashKey.getKey(), hashKey.getValue());
} else {
throw new IllegalArgumentException("hashKey must be non-null object.");
}
if (rangeKey != null) {
exclusiveStartKey.put(rangeKey.getKey(), rangeKey.getValue());
}
setExclusiveStartKey(exclusiveStartKey);
} | [
"public",
"void",
"setExclusiveStartKey",
"(",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
"<",
"String",
",",
"AttributeValue",
">",
"hashKey",
",",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
"<",
"String",
",",
"AttributeValue",
">",
"rangeKey",
... | The primary hash and range keys of the first item that this operation will evaluate. Use the value that was
returned for <i>LastEvaluatedKey</i> in the previous operation.
<p>
The data type for <i>ExclusiveStartKey</i> must be String, Number or Binary. No set data types are allowed.
@param hashKey
a map entry including the name and value of the primary hash key.
@param rangeKey
a map entry including the name and value of the primary range key, or null if it is a hash-only table. | [
"The",
"primary",
"hash",
"and",
"range",
"keys",
"of",
"the",
"first",
"item",
"that",
"this",
"operation",
"will",
"evaluate",
".",
"Use",
"the",
"value",
"that",
"was",
"returned",
"for",
"<i",
">",
"LastEvaluatedKey<",
"/",
"i",
">",
"in",
"the",
"pr... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanRequest.java#L2925-L2937 |
lazy-koala/java-toolkit | fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/ReflectUtil.java | ReflectUtil.getMethod | public static Method getMethod(Class clazz, String methodName, Class<?>... parameterTypes) {
"""
获取指定方法
<p>Function: getMethod</p>
<p>Description: </p>
@param clazz
@param methodName
@param parameterTypes
@return
@author acexy@thankjava.com
@date 2014-12-18 上午9:55:54
@version 1.0
"""
if (clazz == null) {
return null;
}
try {
return clazz.getDeclaredMethod(methodName, parameterTypes);
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
return null;
} | java | public static Method getMethod(Class clazz, String methodName, Class<?>... parameterTypes) {
if (clazz == null) {
return null;
}
try {
return clazz.getDeclaredMethod(methodName, parameterTypes);
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",... | 获取指定方法
<p>Function: getMethod</p>
<p>Description: </p>
@param clazz
@param methodName
@param parameterTypes
@return
@author acexy@thankjava.com
@date 2014-12-18 上午9:55:54
@version 1.0 | [
"获取指定方法",
"<p",
">",
"Function",
":",
"getMethod<",
"/",
"p",
">",
"<p",
">",
"Description",
":",
"<",
"/",
"p",
">"
] | train | https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/ReflectUtil.java#L217-L229 |
real-logic/agrona | agrona/src/main/java/org/agrona/collections/ArrayListUtil.java | ArrayListUtil.fastUnorderedRemove | public static <T> void fastUnorderedRemove(final ArrayList<T> list, final int index) {
"""
Removes element at index, but instead of copying all elements to the left, moves into the same slot the last
element. This avoids the copy costs, but spoils the list order. If index is the last element it is just removed.
@param list to be modified.
@param index to be removed.
@param <T> element type.
@throws IndexOutOfBoundsException if index is out of bounds.
"""
final int lastIndex = list.size() - 1;
if (index != lastIndex)
{
list.set(index, list.remove(lastIndex));
}
else
{
list.remove(index);
}
} | java | public static <T> void fastUnorderedRemove(final ArrayList<T> list, final int index)
{
final int lastIndex = list.size() - 1;
if (index != lastIndex)
{
list.set(index, list.remove(lastIndex));
}
else
{
list.remove(index);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"fastUnorderedRemove",
"(",
"final",
"ArrayList",
"<",
"T",
">",
"list",
",",
"final",
"int",
"index",
")",
"{",
"final",
"int",
"lastIndex",
"=",
"list",
".",
"size",
"(",
")",
"-",
"1",
";",
"if",
"(",
"... | Removes element at index, but instead of copying all elements to the left, moves into the same slot the last
element. This avoids the copy costs, but spoils the list order. If index is the last element it is just removed.
@param list to be modified.
@param index to be removed.
@param <T> element type.
@throws IndexOutOfBoundsException if index is out of bounds. | [
"Removes",
"element",
"at",
"index",
"but",
"instead",
"of",
"copying",
"all",
"elements",
"to",
"the",
"left",
"moves",
"into",
"the",
"same",
"slot",
"the",
"last",
"element",
".",
"This",
"avoids",
"the",
"copy",
"costs",
"but",
"spoils",
"the",
"list",... | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/collections/ArrayListUtil.java#L34-L45 |
lotaris/rox-client-java | rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java | Configuration.writeUid | private void writeUid(File uidFile, String uid) {
"""
Write a UID file
@param uidFile The UID file to write
@param uid The UID to write to the file
"""
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(uidFile));
bw.write(uid);
}
catch (IOException ioe) {}
finally { if (bw != null) { try { bw.close(); } catch (IOException ioe) {} } }
} | java | private void writeUid(File uidFile, String uid) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(uidFile));
bw.write(uid);
}
catch (IOException ioe) {}
finally { if (bw != null) { try { bw.close(); } catch (IOException ioe) {} } }
} | [
"private",
"void",
"writeUid",
"(",
"File",
"uidFile",
",",
"String",
"uid",
")",
"{",
"BufferedWriter",
"bw",
"=",
"null",
";",
"try",
"{",
"bw",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"uidFile",
")",
")",
";",
"bw",
".",
"write"... | Write a UID file
@param uidFile The UID file to write
@param uid The UID to write to the file | [
"Write",
"a",
"UID",
"file"
] | train | https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java#L489-L497 |
apache/groovy | subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java | DateTimeExtensions.leftShift | public static ZonedDateTime leftShift(final LocalDateTime self, ZoneId zone) {
"""
Returns a {@link java.time.OffsetDateTime} of this date/time and the provided {@link java.time.ZoneId}.
@param self a LocalDateTime
@param zone a ZoneId
@return a ZonedDateTime
@since 2.5.0
"""
return ZonedDateTime.of(self, zone);
} | java | public static ZonedDateTime leftShift(final LocalDateTime self, ZoneId zone) {
return ZonedDateTime.of(self, zone);
} | [
"public",
"static",
"ZonedDateTime",
"leftShift",
"(",
"final",
"LocalDateTime",
"self",
",",
"ZoneId",
"zone",
")",
"{",
"return",
"ZonedDateTime",
".",
"of",
"(",
"self",
",",
"zone",
")",
";",
"}"
] | Returns a {@link java.time.OffsetDateTime} of this date/time and the provided {@link java.time.ZoneId}.
@param self a LocalDateTime
@param zone a ZoneId
@return a ZonedDateTime
@since 2.5.0 | [
"Returns",
"a",
"{",
"@link",
"java",
".",
"time",
".",
"OffsetDateTime",
"}",
"of",
"this",
"date",
"/",
"time",
"and",
"the",
"provided",
"{",
"@link",
"java",
".",
"time",
".",
"ZoneId",
"}",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L818-L820 |
tweea/matrixjavalib-main-common | src/main/java/net/matrix/data/DefaultTree.java | DefaultTree.generateSubNode | private static <ID, DATA> void generateSubNode(final TreeSource<ID, DATA> source, final DefaultTree<ID, DATA> node) {
"""
向 TreeSource 增加新的节点。
@param <ID>
数据标识
@param <DATA>
数据
@param source
节点构造源
@param node
父节点
"""
List<ID> items = source.listChildrenId(node.getId());
if (items == null || items.isEmpty()) {
return;
}
for (ID id : items) {
DATA item = source.getItem(id);
node.appendChildNode(id, item);
}
for (DefaultTree<ID, DATA> subNode : new ArrayList<>(node.getChildNodes().values())) {
generateSubNode(source, subNode);
}
} | java | private static <ID, DATA> void generateSubNode(final TreeSource<ID, DATA> source, final DefaultTree<ID, DATA> node) {
List<ID> items = source.listChildrenId(node.getId());
if (items == null || items.isEmpty()) {
return;
}
for (ID id : items) {
DATA item = source.getItem(id);
node.appendChildNode(id, item);
}
for (DefaultTree<ID, DATA> subNode : new ArrayList<>(node.getChildNodes().values())) {
generateSubNode(source, subNode);
}
} | [
"private",
"static",
"<",
"ID",
",",
"DATA",
">",
"void",
"generateSubNode",
"(",
"final",
"TreeSource",
"<",
"ID",
",",
"DATA",
">",
"source",
",",
"final",
"DefaultTree",
"<",
"ID",
",",
"DATA",
">",
"node",
")",
"{",
"List",
"<",
"ID",
">",
"items... | 向 TreeSource 增加新的节点。
@param <ID>
数据标识
@param <DATA>
数据
@param source
节点构造源
@param node
父节点 | [
"向",
"TreeSource",
"增加新的节点。"
] | train | https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/data/DefaultTree.java#L411-L423 |
attribyte/wpdb | src/main/java/org/attribyte/wp/db/DB.java | DB.selectPostMetaValue | public Meta selectPostMetaValue(final long postId, final String metaKey) throws SQLException {
"""
Selects a single post meta value.
@param postId The post id.
@param metaKey The key.
@return The meta value or {@code null} if none.
@throws SQLException on database error.
"""
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
Timer.Context ctx = metrics.selectPostMetaTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(selectPostMetaValueSQL);
stmt.setLong(1, postId);
stmt.setString(2, metaKey);
rs = stmt.executeQuery();
return rs.next() ? new Meta(rs.getLong(1), rs.getString(2), rs.getString(3)) : null;
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt, rs);
}
} | java | public Meta selectPostMetaValue(final long postId, final String metaKey) throws SQLException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
Timer.Context ctx = metrics.selectPostMetaTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(selectPostMetaValueSQL);
stmt.setLong(1, postId);
stmt.setString(2, metaKey);
rs = stmt.executeQuery();
return rs.next() ? new Meta(rs.getLong(1), rs.getString(2), rs.getString(3)) : null;
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt, rs);
}
} | [
"public",
"Meta",
"selectPostMetaValue",
"(",
"final",
"long",
"postId",
",",
"final",
"String",
"metaKey",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"ResultSet",
"rs",
"=",
"null... | Selects a single post meta value.
@param postId The post id.
@param metaKey The key.
@return The meta value or {@code null} if none.
@throws SQLException on database error. | [
"Selects",
"a",
"single",
"post",
"meta",
"value",
"."
] | train | https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L1918-L1935 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/ParseContext.java | ParseContext.renderError | final ParseErrorDetails renderError() {
"""
Only called when rendering the error in {@link ParserException}.
"""
final int errorIndex = toIndex(currentErrorAt);
final String encounteredName = getEncountered();
final ArrayList<String> errorStrings = Lists.arrayList(errors.size());
for (Object error : errors) {
errorStrings.add(String.valueOf(error));
}
switch (currentErrorType) {
case UNEXPECTED :
return new EmptyParseError(errorIndex, encounteredName) {
@Override public String getUnexpected() {
return errorStrings.get(0);
}
};
case FAILURE :
return new EmptyParseError(errorIndex, encounteredName) {
@Override public String getFailureMessage() {
return errorStrings.get(0);
}
};
case EXPECTING:
case MISSING:
case DELIMITING:
return new EmptyParseError(errorIndex, encounteredName) {
@Override public List<String> getExpected() {
return errorStrings;
}
};
default:
return new EmptyParseError(errorIndex, encounteredName);
}
} | java | final ParseErrorDetails renderError() {
final int errorIndex = toIndex(currentErrorAt);
final String encounteredName = getEncountered();
final ArrayList<String> errorStrings = Lists.arrayList(errors.size());
for (Object error : errors) {
errorStrings.add(String.valueOf(error));
}
switch (currentErrorType) {
case UNEXPECTED :
return new EmptyParseError(errorIndex, encounteredName) {
@Override public String getUnexpected() {
return errorStrings.get(0);
}
};
case FAILURE :
return new EmptyParseError(errorIndex, encounteredName) {
@Override public String getFailureMessage() {
return errorStrings.get(0);
}
};
case EXPECTING:
case MISSING:
case DELIMITING:
return new EmptyParseError(errorIndex, encounteredName) {
@Override public List<String> getExpected() {
return errorStrings;
}
};
default:
return new EmptyParseError(errorIndex, encounteredName);
}
} | [
"final",
"ParseErrorDetails",
"renderError",
"(",
")",
"{",
"final",
"int",
"errorIndex",
"=",
"toIndex",
"(",
"currentErrorAt",
")",
";",
"final",
"String",
"encounteredName",
"=",
"getEncountered",
"(",
")",
";",
"final",
"ArrayList",
"<",
"String",
">",
"er... | Only called when rendering the error in {@link ParserException}. | [
"Only",
"called",
"when",
"rendering",
"the",
"error",
"in",
"{"
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/ParseContext.java#L216-L247 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.getPreset | public GetPresetResponse getPreset(GetPresetRequest request) {
"""
Gets a preset with specified name.
@param request The request object containing all options for getting a preset.
@return The information of the preset.
"""
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getPresetName(), "The parameter presetName should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, PRESET, request.getPresetName());
return invokeHttpClient(internalRequest, GetPresetResponse.class);
} | java | public GetPresetResponse getPreset(GetPresetRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getPresetName(), "The parameter presetName should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, PRESET, request.getPresetName());
return invokeHttpClient(internalRequest, GetPresetResponse.class);
} | [
"public",
"GetPresetResponse",
"getPreset",
"(",
"GetPresetRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getPresetName",
"(",
")",
",",
"\"The p... | Gets a preset with specified name.
@param request The request object containing all options for getting a preset.
@return The information of the preset. | [
"Gets",
"a",
"preset",
"with",
"specified",
"name",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L958-L964 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/batch/BatchConnection.java | BatchConnection.prepareBatchStatement | private PreparedStatement prepareBatchStatement(String sql) {
"""
If UPDATE, INSERT or DELETE, return BatchPreparedStatement,
otherwise return null.
"""
String sqlCmd = sql.substring(0, 7);
if (sqlCmd.equals("UPDATE ") || sqlCmd.equals("DELETE ") || (_useBatchInserts && sqlCmd.equals("INSERT ")))
{
PreparedStatement stmt = (PreparedStatement) _statements.get(sql);
if (stmt == null)
{
// [olegnitz] for JDK 1.2 we need to list both PreparedStatement and Statement
// interfaces, otherwise proxy.jar works incorrectly
stmt = (PreparedStatement) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{
PreparedStatement.class, Statement.class, BatchPreparedStatement.class},
new PreparedStatementInvocationHandler(this, sql, m_jcd));
_statements.put(sql, stmt);
}
return stmt;
}
else
{
return null;
}
} | java | private PreparedStatement prepareBatchStatement(String sql)
{
String sqlCmd = sql.substring(0, 7);
if (sqlCmd.equals("UPDATE ") || sqlCmd.equals("DELETE ") || (_useBatchInserts && sqlCmd.equals("INSERT ")))
{
PreparedStatement stmt = (PreparedStatement) _statements.get(sql);
if (stmt == null)
{
// [olegnitz] for JDK 1.2 we need to list both PreparedStatement and Statement
// interfaces, otherwise proxy.jar works incorrectly
stmt = (PreparedStatement) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{
PreparedStatement.class, Statement.class, BatchPreparedStatement.class},
new PreparedStatementInvocationHandler(this, sql, m_jcd));
_statements.put(sql, stmt);
}
return stmt;
}
else
{
return null;
}
} | [
"private",
"PreparedStatement",
"prepareBatchStatement",
"(",
"String",
"sql",
")",
"{",
"String",
"sqlCmd",
"=",
"sql",
".",
"substring",
"(",
"0",
",",
"7",
")",
";",
"if",
"(",
"sqlCmd",
".",
"equals",
"(",
"\"UPDATE \"",
")",
"||",
"sqlCmd",
".",
"eq... | If UPDATE, INSERT or DELETE, return BatchPreparedStatement,
otherwise return null. | [
"If",
"UPDATE",
"INSERT",
"or",
"DELETE",
"return",
"BatchPreparedStatement",
"otherwise",
"return",
"null",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/batch/BatchConnection.java#L247-L269 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java | Disk.createImage | public Operation createImage(String image, OperationOption... options) {
"""
Creates an image for this disk given the image's name.
@return a global operation if the image creation was successfully requested
@throws ComputeException upon failure
"""
ImageInfo imageInfo = ImageInfo.of(ImageId.of(image), DiskImageConfiguration.of(getDiskId()));
return compute.create(imageInfo, options);
} | java | public Operation createImage(String image, OperationOption... options) {
ImageInfo imageInfo = ImageInfo.of(ImageId.of(image), DiskImageConfiguration.of(getDiskId()));
return compute.create(imageInfo, options);
} | [
"public",
"Operation",
"createImage",
"(",
"String",
"image",
",",
"OperationOption",
"...",
"options",
")",
"{",
"ImageInfo",
"imageInfo",
"=",
"ImageInfo",
".",
"of",
"(",
"ImageId",
".",
"of",
"(",
"image",
")",
",",
"DiskImageConfiguration",
".",
"of",
"... | Creates an image for this disk given the image's name.
@return a global operation if the image creation was successfully requested
@throws ComputeException upon failure | [
"Creates",
"an",
"image",
"for",
"this",
"disk",
"given",
"the",
"image",
"s",
"name",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java#L193-L196 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/DirectQuickSelectSketchR.java | DirectQuickSelectSketchR.fastReadOnlyWrap | static DirectQuickSelectSketchR fastReadOnlyWrap(final Memory srcMem, final long seed) {
"""
Fast-wrap a sketch around the given source Memory containing sketch data that originated from
this sketch. This does NO validity checking of the given Memory.
@param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
The given Memory object must be in hash table form and not read only.
@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>
@return instance of this sketch
"""
final int lgNomLongs = srcMem.getByte(LG_NOM_LONGS_BYTE) & 0XFF;
final int lgArrLongs = srcMem.getByte(LG_ARR_LONGS_BYTE) & 0XFF;
final DirectQuickSelectSketchR dqss =
new DirectQuickSelectSketchR(seed, (WritableMemory) srcMem);
dqss.hashTableThreshold_ = setHashTableThreshold(lgNomLongs, lgArrLongs);
return dqss;
} | java | static DirectQuickSelectSketchR fastReadOnlyWrap(final Memory srcMem, final long seed) {
final int lgNomLongs = srcMem.getByte(LG_NOM_LONGS_BYTE) & 0XFF;
final int lgArrLongs = srcMem.getByte(LG_ARR_LONGS_BYTE) & 0XFF;
final DirectQuickSelectSketchR dqss =
new DirectQuickSelectSketchR(seed, (WritableMemory) srcMem);
dqss.hashTableThreshold_ = setHashTableThreshold(lgNomLongs, lgArrLongs);
return dqss;
} | [
"static",
"DirectQuickSelectSketchR",
"fastReadOnlyWrap",
"(",
"final",
"Memory",
"srcMem",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"int",
"lgNomLongs",
"=",
"srcMem",
".",
"getByte",
"(",
"LG_NOM_LONGS_BYTE",
")",
"&",
"0XFF",
";",
"final",
"int",
"l... | Fast-wrap a sketch around the given source Memory containing sketch data that originated from
this sketch. This does NO validity checking of the given Memory.
@param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
The given Memory object must be in hash table form and not read only.
@param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>
@return instance of this sketch | [
"Fast",
"-",
"wrap",
"a",
"sketch",
"around",
"the",
"given",
"source",
"Memory",
"containing",
"sketch",
"data",
"that",
"originated",
"from",
"this",
"sketch",
".",
"This",
"does",
"NO",
"validity",
"checking",
"of",
"the",
"given",
"Memory",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/DirectQuickSelectSketchR.java#L83-L91 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java | SimpleDocTreeVisitor.visitThrows | @Override
public R visitThrows(ThrowsTree node, P p) {
"""
{@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction}
"""
return defaultAction(node, p);
} | java | @Override
public R visitThrows(ThrowsTree node, P p) {
return defaultAction(node, p);
} | [
"@",
"Override",
"public",
"R",
"visitThrows",
"(",
"ThrowsTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"node",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"calls",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L417-L420 |
btrplace/scheduler | btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java | SymbolsTable.declareImmutable | public boolean declareImmutable(String label, BtrpOperand t) {
"""
Declare an immutable variable. The variable must not
has been already declared.
@param label the identifier of the variable
@param t the operand associated to the identifier
@return {@code true} if the variable as been declared. {@code false} otherwise
"""
if (isDeclared(label)) {
return false;
}
level.put(label, -1);
type.put(label, t);
return true;
} | java | public boolean declareImmutable(String label, BtrpOperand t) {
if (isDeclared(label)) {
return false;
}
level.put(label, -1);
type.put(label, t);
return true;
} | [
"public",
"boolean",
"declareImmutable",
"(",
"String",
"label",
",",
"BtrpOperand",
"t",
")",
"{",
"if",
"(",
"isDeclared",
"(",
"label",
")",
")",
"{",
"return",
"false",
";",
"}",
"level",
".",
"put",
"(",
"label",
",",
"-",
"1",
")",
";",
"type",... | Declare an immutable variable. The variable must not
has been already declared.
@param label the identifier of the variable
@param t the operand associated to the identifier
@return {@code true} if the variable as been declared. {@code false} otherwise | [
"Declare",
"an",
"immutable",
"variable",
".",
"The",
"variable",
"must",
"not",
"has",
"been",
"already",
"declared",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/SymbolsTable.java#L73-L80 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/places/PlacesInterface.java | PlacesInterface.getInfo | public Location getInfo(String placeId, String woeId) throws FlickrException {
"""
Get informations about a place.
<p>
This method does not require authentication.
</p>
@param placeId
A Flickr Places ID. Optional, can be null. (While optional, you must pass either a valid Places ID or a WOE ID.)
@param woeId
A Where On Earth (WOE) ID. Optional, can be null. (While optional, you must pass either a valid Places ID or a WOE ID.)
@return A Location
@throws FlickrException
"""
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_INFO);
if (placeId != null) {
parameters.put("place_id", placeId);
}
if (woeId != null) {
parameters.put("woe_id", woeId);
}
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element locationElement = response.getPayload();
return parseLocation(locationElement);
} | java | public Location getInfo(String placeId, String woeId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_INFO);
if (placeId != null) {
parameters.put("place_id", placeId);
}
if (woeId != null) {
parameters.put("woe_id", woeId);
}
Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Element locationElement = response.getPayload();
return parseLocation(locationElement);
} | [
"public",
"Location",
"getInfo",
"(",
"String",
"placeId",
",",
"String",
"woeId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"pa... | Get informations about a place.
<p>
This method does not require authentication.
</p>
@param placeId
A Flickr Places ID. Optional, can be null. (While optional, you must pass either a valid Places ID or a WOE ID.)
@param woeId
A Where On Earth (WOE) ID. Optional, can be null. (While optional, you must pass either a valid Places ID or a WOE ID.)
@return A Location
@throws FlickrException | [
"Get",
"informations",
"about",
"a",
"place",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/places/PlacesInterface.java#L319-L336 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java | PyExpressionGenerator._generate | protected XExpression _generate(XPostfixOperation operation, IAppendable it, IExtraLanguageGeneratorContext context) {
"""
Generate the given object.
@param operation the postfix operator.
@param it the target for the generated content.
@param context the context.
@return the operation.
"""
appendReturnIfExpectedReturnedExpression(it, context);
final String operator = getOperatorSymbol(operation);
if (operator != null) {
it.append("("); //$NON-NLS-1$
switch (operator) {
case "++": //$NON-NLS-1$
generate(operation.getOperand(), it, context);
it.append(" += 1"); //$NON-NLS-1$
break;
case "--": //$NON-NLS-1$
generate(operation.getOperand(), it, context);
it.append(" -= 1"); //$NON-NLS-1$
break;
default:
throw new IllegalArgumentException(MessageFormat.format(Messages.PyExpressionGenerator_0, operator));
}
it.append(")"); //$NON-NLS-1$
}
return operation;
} | java | protected XExpression _generate(XPostfixOperation operation, IAppendable it, IExtraLanguageGeneratorContext context) {
appendReturnIfExpectedReturnedExpression(it, context);
final String operator = getOperatorSymbol(operation);
if (operator != null) {
it.append("("); //$NON-NLS-1$
switch (operator) {
case "++": //$NON-NLS-1$
generate(operation.getOperand(), it, context);
it.append(" += 1"); //$NON-NLS-1$
break;
case "--": //$NON-NLS-1$
generate(operation.getOperand(), it, context);
it.append(" -= 1"); //$NON-NLS-1$
break;
default:
throw new IllegalArgumentException(MessageFormat.format(Messages.PyExpressionGenerator_0, operator));
}
it.append(")"); //$NON-NLS-1$
}
return operation;
} | [
"protected",
"XExpression",
"_generate",
"(",
"XPostfixOperation",
"operation",
",",
"IAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"appendReturnIfExpectedReturnedExpression",
"(",
"it",
",",
"context",
")",
";",
"final",
"String",
"ope... | Generate the given object.
@param operation the postfix operator.
@param it the target for the generated content.
@param context the context.
@return the operation. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L523-L543 |
jbundle/jbundle | base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java | JdbcTable.checkNullableKey | public void checkNullableKey(BaseField field, boolean bFirstFieldOnly) {
"""
This is a special method - If the db doesn't allow null keys,
you must make sure they are not nullable.
<br />This is used on create.
@param field Field to check, if it is in a key and is nullable, set to not nullable.
"""
for (int iKeySeq = 0; iKeySeq < this.getRecord().getKeyAreaCount(); iKeySeq++)
{
KeyArea keyArea = this.getRecord().getKeyArea(iKeySeq);
for (int iKeyFieldSeq = 0; iKeyFieldSeq < keyArea.getKeyFields(); iKeyFieldSeq++)
{
if (keyArea.getField(iKeyFieldSeq) == field)
{
if (field.isNullable() == true)
{ // Don't allow this key to be null
field.setNullable(false);
return;
}
}
if (bFirstFieldOnly)
break;
}
}
} | java | public void checkNullableKey(BaseField field, boolean bFirstFieldOnly)
{
for (int iKeySeq = 0; iKeySeq < this.getRecord().getKeyAreaCount(); iKeySeq++)
{
KeyArea keyArea = this.getRecord().getKeyArea(iKeySeq);
for (int iKeyFieldSeq = 0; iKeyFieldSeq < keyArea.getKeyFields(); iKeyFieldSeq++)
{
if (keyArea.getField(iKeyFieldSeq) == field)
{
if (field.isNullable() == true)
{ // Don't allow this key to be null
field.setNullable(false);
return;
}
}
if (bFirstFieldOnly)
break;
}
}
} | [
"public",
"void",
"checkNullableKey",
"(",
"BaseField",
"field",
",",
"boolean",
"bFirstFieldOnly",
")",
"{",
"for",
"(",
"int",
"iKeySeq",
"=",
"0",
";",
"iKeySeq",
"<",
"this",
".",
"getRecord",
"(",
")",
".",
"getKeyAreaCount",
"(",
")",
";",
"iKeySeq",... | This is a special method - If the db doesn't allow null keys,
you must make sure they are not nullable.
<br />This is used on create.
@param field Field to check, if it is in a key and is nullable, set to not nullable. | [
"This",
"is",
"a",
"special",
"method",
"-",
"If",
"the",
"db",
"doesn",
"t",
"allow",
"null",
"keys",
"you",
"must",
"make",
"sure",
"they",
"are",
"not",
"nullable",
".",
"<br",
"/",
">",
"This",
"is",
"used",
"on",
"create",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java#L1349-L1368 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlSelectBuilder.java | SqlSelectBuilder.convertJQL2SQL | public static String convertJQL2SQL(final SQLiteModelMethod method, final boolean replaceWithQuestion) {
"""
Convert JQL 2 SQL.
@param method
the method
@param replaceWithQuestion
the replace with question
@return the string
"""
JQLChecker jqlChecker = JQLChecker.getInstance();
// convert jql to sql
String sql = jqlChecker.replace(method, method.jql, new JQLReplacerListenerImpl(method) {
@Override
public String onBindParameter(String bindParameterName, boolean inStatement) {
if (replaceWithQuestion) {
return "?";
}
return SqlAnalyzer.PARAM_PREFIX + bindParameterName + SqlAnalyzer.PARAM_SUFFIX;
}
@Override
public String onColumnName(String columnName) {
SQLProperty tempProperty = currentEntity.get(columnName);
AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName);
return tempProperty.columnName;
}
@Override
public String onColumnAlias(String alias) {
SQLProperty tempProperty = currentEntity.get(alias);
AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, alias);
return tempProperty.columnName;
}
});
return sql;
} | java | public static String convertJQL2SQL(final SQLiteModelMethod method, final boolean replaceWithQuestion) {
JQLChecker jqlChecker = JQLChecker.getInstance();
// convert jql to sql
String sql = jqlChecker.replace(method, method.jql, new JQLReplacerListenerImpl(method) {
@Override
public String onBindParameter(String bindParameterName, boolean inStatement) {
if (replaceWithQuestion) {
return "?";
}
return SqlAnalyzer.PARAM_PREFIX + bindParameterName + SqlAnalyzer.PARAM_SUFFIX;
}
@Override
public String onColumnName(String columnName) {
SQLProperty tempProperty = currentEntity.get(columnName);
AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName);
return tempProperty.columnName;
}
@Override
public String onColumnAlias(String alias) {
SQLProperty tempProperty = currentEntity.get(alias);
AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, alias);
return tempProperty.columnName;
}
});
return sql;
} | [
"public",
"static",
"String",
"convertJQL2SQL",
"(",
"final",
"SQLiteModelMethod",
"method",
",",
"final",
"boolean",
"replaceWithQuestion",
")",
"{",
"JQLChecker",
"jqlChecker",
"=",
"JQLChecker",
".",
"getInstance",
"(",
")",
";",
"// convert jql to sql",
"String",
... | Convert JQL 2 SQL.
@param method
the method
@param replaceWithQuestion
the replace with question
@return the string | [
"Convert",
"JQL",
"2",
"SQL",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlSelectBuilder.java#L438-L469 |
HubSpot/Singularity | SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java | SingularityClient.getSingularityRequests | public Collection<SingularityRequestParent> getSingularityRequests() {
"""
Get all singularity requests that their state is either ACTIVE, PAUSED or COOLDOWN
For the requests that are pending to become ACTIVE use:
{@link SingularityClient#getPendingSingularityRequests()}
For the requests that are cleaning up use:
{@link SingularityClient#getCleanupSingularityRequests()}
Use {@link SingularityClient#getActiveSingularityRequests()}, {@link SingularityClient#getPausedSingularityRequests()},
{@link SingularityClient#getCoolDownSingularityRequests()} respectively to get only the ACTIVE, PAUSED or COOLDOWN requests.
@return
returns all the [ACTIVE, PAUSED, COOLDOWN] {@link SingularityRequestParent} instances.
"""
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_FORMAT, getApiBase(host));
return getCollection(requestUri, "[ACTIVE, PAUSED, COOLDOWN] requests", REQUESTS_COLLECTION);
} | java | public Collection<SingularityRequestParent> getSingularityRequests() {
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_FORMAT, getApiBase(host));
return getCollection(requestUri, "[ACTIVE, PAUSED, COOLDOWN] requests", REQUESTS_COLLECTION);
} | [
"public",
"Collection",
"<",
"SingularityRequestParent",
">",
"getSingularityRequests",
"(",
")",
"{",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"requestUri",
"=",
"(",
"host",
")",
"-",
">",
"String",
".",
"format",
"(",
"REQUESTS_FORMAT",
",",
... | Get all singularity requests that their state is either ACTIVE, PAUSED or COOLDOWN
For the requests that are pending to become ACTIVE use:
{@link SingularityClient#getPendingSingularityRequests()}
For the requests that are cleaning up use:
{@link SingularityClient#getCleanupSingularityRequests()}
Use {@link SingularityClient#getActiveSingularityRequests()}, {@link SingularityClient#getPausedSingularityRequests()},
{@link SingularityClient#getCoolDownSingularityRequests()} respectively to get only the ACTIVE, PAUSED or COOLDOWN requests.
@return
returns all the [ACTIVE, PAUSED, COOLDOWN] {@link SingularityRequestParent} instances. | [
"Get",
"all",
"singularity",
"requests",
"that",
"their",
"state",
"is",
"either",
"ACTIVE",
"PAUSED",
"or",
"COOLDOWN"
] | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L753-L757 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/Parser.java | Parser.parse | static Node parse(String expr, JobConf job) throws IOException {
"""
Given an expression and an optional comparator, build a tree of
InputFormats using the comparator to sort keys.
"""
if (null == expr) {
throw new IOException("Expression is null");
}
Class<? extends WritableComparator> cmpcl =
job.getClass("mapred.join.keycomparator", null, WritableComparator.class);
Lexer lex = new Lexer(expr);
Stack<Token> st = new Stack<Token>();
Token tok;
while ((tok = lex.next()) != null) {
if (TType.RPAREN.equals(tok.getType())) {
st.push(reduce(st, job));
} else {
st.push(tok);
}
}
if (st.size() == 1 && TType.CIF.equals(st.peek().getType())) {
Node ret = st.pop().getNode();
if (cmpcl != null) {
ret.setKeyComparator(cmpcl);
}
return ret;
}
throw new IOException("Missing ')'");
} | java | static Node parse(String expr, JobConf job) throws IOException {
if (null == expr) {
throw new IOException("Expression is null");
}
Class<? extends WritableComparator> cmpcl =
job.getClass("mapred.join.keycomparator", null, WritableComparator.class);
Lexer lex = new Lexer(expr);
Stack<Token> st = new Stack<Token>();
Token tok;
while ((tok = lex.next()) != null) {
if (TType.RPAREN.equals(tok.getType())) {
st.push(reduce(st, job));
} else {
st.push(tok);
}
}
if (st.size() == 1 && TType.CIF.equals(st.peek().getType())) {
Node ret = st.pop().getNode();
if (cmpcl != null) {
ret.setKeyComparator(cmpcl);
}
return ret;
}
throw new IOException("Missing ')'");
} | [
"static",
"Node",
"parse",
"(",
"String",
"expr",
",",
"JobConf",
"job",
")",
"throws",
"IOException",
"{",
"if",
"(",
"null",
"==",
"expr",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Expression is null\"",
")",
";",
"}",
"Class",
"<",
"?",
"extend... | Given an expression and an optional comparator, build a tree of
InputFormats using the comparator to sort keys. | [
"Given",
"an",
"expression",
"and",
"an",
"optional",
"comparator",
"build",
"a",
"tree",
"of",
"InputFormats",
"using",
"the",
"comparator",
"to",
"sort",
"keys",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/Parser.java#L461-L485 |
esigate/esigate | esigate-core/src/main/java/org/esigate/util/UriUtils.java | UriUtils.removeSessionId | public static String removeSessionId(String sessionId, String page) {
"""
Removes the jsessionid that may have been added to a URI on a java application server.
@param sessionId
the value of the sessionId that can also be found in a JSESSIONID cookie
@param page
the html code of the page
@return the fixed html
"""
String regexp = ";?jsessionid=" + Pattern.quote(sessionId);
return page.replaceAll(regexp, "");
} | java | public static String removeSessionId(String sessionId, String page) {
String regexp = ";?jsessionid=" + Pattern.quote(sessionId);
return page.replaceAll(regexp, "");
} | [
"public",
"static",
"String",
"removeSessionId",
"(",
"String",
"sessionId",
",",
"String",
"page",
")",
"{",
"String",
"regexp",
"=",
"\";?jsessionid=\"",
"+",
"Pattern",
".",
"quote",
"(",
"sessionId",
")",
";",
"return",
"page",
".",
"replaceAll",
"(",
"r... | Removes the jsessionid that may have been added to a URI on a java application server.
@param sessionId
the value of the sessionId that can also be found in a JSESSIONID cookie
@param page
the html code of the page
@return the fixed html | [
"Removes",
"the",
"jsessionid",
"that",
"may",
"have",
"been",
"added",
"to",
"a",
"URI",
"on",
"a",
"java",
"application",
"server",
"."
] | train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/UriUtils.java#L243-L246 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.escapeUriPathSegment | public static void escapeUriPathSegment(final Reader reader, final Writer writer, final String encoding)
throws IOException {
"""
<p>
Perform am URI path segment <strong>escape</strong> operation
on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
The following are the only allowed chars in an URI path segment (will not be escaped):
</p>
<ul>
<li><tt>A-Z a-z 0-9</tt></li>
<li><tt>- . _ ~</tt></li>
<li><tt>! $ & ' ( ) * + , ; =</tt></li>
<li><tt>: @</tt></li>
</ul>
<p>
All other chars will be escaped by converting them to the sequence of bytes that
represents them in the specified <em>encoding</em> and then representing each byte
in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@param encoding the encoding to be used for escaping.
@throws IOException if an input/output exception occurs
@since 1.1.2
"""
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
UriEscapeUtil.escape(reader, writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding);
} | java | public static void escapeUriPathSegment(final Reader reader, final Writer writer, final String encoding)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
UriEscapeUtil.escape(reader, writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding);
} | [
"public",
"static",
"void",
"escapeUriPathSegment",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
",",
"final",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"throw",
"new",
"Illeg... | <p>
Perform am URI path segment <strong>escape</strong> operation
on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
The following are the only allowed chars in an URI path segment (will not be escaped):
</p>
<ul>
<li><tt>A-Z a-z 0-9</tt></li>
<li><tt>- . _ ~</tt></li>
<li><tt>! $ & ' ( ) * + , ; =</tt></li>
<li><tt>: @</tt></li>
</ul>
<p>
All other chars will be escaped by converting them to the sequence of bytes that
represents them in the specified <em>encoding</em> and then representing each byte
in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@param encoding the encoding to be used for escaping.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"am",
"URI",
"path",
"segment",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
".",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L920-L933 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java | SPSMMappingFilter.isRelated | private boolean isRelated(final INode source, final INode target, final char relation) {
"""
Checks if the given source and target elements are related considering the defined relation and the temp.
@param source source
@param target target
@param relation relation
@return true if the relation holds between source and target, false otherwise.
"""
return relation == defautlMappings.getRelation(source, target);
} | java | private boolean isRelated(final INode source, final INode target, final char relation) {
return relation == defautlMappings.getRelation(source, target);
} | [
"private",
"boolean",
"isRelated",
"(",
"final",
"INode",
"source",
",",
"final",
"INode",
"target",
",",
"final",
"char",
"relation",
")",
"{",
"return",
"relation",
"==",
"defautlMappings",
".",
"getRelation",
"(",
"source",
",",
"target",
")",
";",
"}"
] | Checks if the given source and target elements are related considering the defined relation and the temp.
@param source source
@param target target
@param relation relation
@return true if the relation holds between source and target, false otherwise. | [
"Checks",
"if",
"the",
"given",
"source",
"and",
"target",
"elements",
"are",
"related",
"considering",
"the",
"defined",
"relation",
"and",
"the",
"temp",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L260-L262 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.noNullElements | @GwtIncompatible("incompatible method")
public static <T> T[] noNullElements(final T[] array, final String message, final Object... values) {
"""
<p>Validate that the specified argument array is neither
{@code null} nor contains any elements that are {@code null};
otherwise throwing an exception with the specified message.
<pre>Validate.noNullElements(myArray, "The array contain null at position %d");</pre>
<p>If the array is {@code null}, then the message in the exception
is "The validated object is null".</p>
<p>If the array has a {@code null} element, then the iteration
index of the invalid element is appended to the {@code values}
argument.</p>
@param <T> the array type
@param array the array to check, validated not null by this method
@param message the {@link String#format(String, Object...)} exception message if invalid, not null
@param values the optional values for the formatted exception message, null array not recommended
@return the validated array (never {@code null} method for chaining)
@throws NullPointerException if the array is {@code null}
@throws IllegalArgumentException if an element is {@code null}
@see #noNullElements(Object[])
"""
Validate.notNull(array);
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
final Object[] values2 = ArrayUtils.add(values, Integer.valueOf(i));
throw new IllegalArgumentException(StringUtils.simpleFormat(message, values2));
}
}
return array;
} | java | @GwtIncompatible("incompatible method")
public static <T> T[] noNullElements(final T[] array, final String message, final Object... values) {
Validate.notNull(array);
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
final Object[] values2 = ArrayUtils.add(values, Integer.valueOf(i));
throw new IllegalArgumentException(StringUtils.simpleFormat(message, values2));
}
}
return array;
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"noNullElements",
"(",
"final",
"T",
"[",
"]",
"array",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"... | <p>Validate that the specified argument array is neither
{@code null} nor contains any elements that are {@code null};
otherwise throwing an exception with the specified message.
<pre>Validate.noNullElements(myArray, "The array contain null at position %d");</pre>
<p>If the array is {@code null}, then the message in the exception
is "The validated object is null".</p>
<p>If the array has a {@code null} element, then the iteration
index of the invalid element is appended to the {@code values}
argument.</p>
@param <T> the array type
@param array the array to check, validated not null by this method
@param message the {@link String#format(String, Object...)} exception message if invalid, not null
@param values the optional values for the formatted exception message, null array not recommended
@return the validated array (never {@code null} method for chaining)
@throws NullPointerException if the array is {@code null}
@throws IllegalArgumentException if an element is {@code null}
@see #noNullElements(Object[]) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"array",
"is",
"neither",
"{",
"@code",
"null",
"}",
"nor",
"contains",
"any",
"elements",
"that",
"are",
"{",
"@code",
"null",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"th... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L510-L520 |
actorapp/actor-platform | actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/primitives/curve25519/ge_scalarmult_base.java | ge_scalarmult_base.ge_scalarmult_base | public static void ge_scalarmult_base(ge_p3 h, byte[] a) {
"""
/*
h = a * B
where a = a[0]+256*a[1]+...+256^31 a[31]
B is the Ed25519 base point (x,4/5) with x positive.
Preconditions:
a[31] <= 127
"""
byte[] e = new byte[64];
byte carry;
ge_p1p1 r = new ge_p1p1();
ge_p2 s = new ge_p2();
ge_precomp t = new ge_precomp();
int i;
for (i = 0; i < 32; ++i) {
e[2 * i + 0] = (byte) ((a[i] >>> 0) & 15);
e[2 * i + 1] = (byte) ((a[i] >>> 4) & 15);
}
/* each e[i] is between 0 and 15 */
/* e[63] is between 0 and 7 */
carry = 0;
for (i = 0; i < 63; ++i) {
e[i] += carry;
carry = (byte) (e[i] + 8);
carry >>= 4;
e[i] -= carry << 4;
}
e[63] += carry;
/* each e[i] is between -8 and 8 */
ge_p3_0.ge_p3_0(h);
for (i = 1; i < 64; i += 2) {
select(t, i / 2, e[i]);
ge_madd.ge_madd(r, h, t);
ge_p1p1_to_p3.ge_p1p1_to_p3(h, r);
}
ge_p3_dbl.ge_p3_dbl(r, h);
ge_p1p1_to_p2.ge_p1p1_to_p2(s, r);
ge_p2_dbl.ge_p2_dbl(r, s);
ge_p1p1_to_p2.ge_p1p1_to_p2(s, r);
ge_p2_dbl.ge_p2_dbl(r, s);
ge_p1p1_to_p2.ge_p1p1_to_p2(s, r);
ge_p2_dbl.ge_p2_dbl(r, s);
ge_p1p1_to_p3.ge_p1p1_to_p3(h, r);
for (i = 0; i < 64; i += 2) {
select(t, i / 2, e[i]);
ge_madd.ge_madd(r, h, t);
ge_p1p1_to_p3.ge_p1p1_to_p3(h, r);
}
} | java | public static void ge_scalarmult_base(ge_p3 h, byte[] a) {
byte[] e = new byte[64];
byte carry;
ge_p1p1 r = new ge_p1p1();
ge_p2 s = new ge_p2();
ge_precomp t = new ge_precomp();
int i;
for (i = 0; i < 32; ++i) {
e[2 * i + 0] = (byte) ((a[i] >>> 0) & 15);
e[2 * i + 1] = (byte) ((a[i] >>> 4) & 15);
}
/* each e[i] is between 0 and 15 */
/* e[63] is between 0 and 7 */
carry = 0;
for (i = 0; i < 63; ++i) {
e[i] += carry;
carry = (byte) (e[i] + 8);
carry >>= 4;
e[i] -= carry << 4;
}
e[63] += carry;
/* each e[i] is between -8 and 8 */
ge_p3_0.ge_p3_0(h);
for (i = 1; i < 64; i += 2) {
select(t, i / 2, e[i]);
ge_madd.ge_madd(r, h, t);
ge_p1p1_to_p3.ge_p1p1_to_p3(h, r);
}
ge_p3_dbl.ge_p3_dbl(r, h);
ge_p1p1_to_p2.ge_p1p1_to_p2(s, r);
ge_p2_dbl.ge_p2_dbl(r, s);
ge_p1p1_to_p2.ge_p1p1_to_p2(s, r);
ge_p2_dbl.ge_p2_dbl(r, s);
ge_p1p1_to_p2.ge_p1p1_to_p2(s, r);
ge_p2_dbl.ge_p2_dbl(r, s);
ge_p1p1_to_p3.ge_p1p1_to_p3(h, r);
for (i = 0; i < 64; i += 2) {
select(t, i / 2, e[i]);
ge_madd.ge_madd(r, h, t);
ge_p1p1_to_p3.ge_p1p1_to_p3(h, r);
}
} | [
"public",
"static",
"void",
"ge_scalarmult_base",
"(",
"ge_p3",
"h",
",",
"byte",
"[",
"]",
"a",
")",
"{",
"byte",
"[",
"]",
"e",
"=",
"new",
"byte",
"[",
"64",
"]",
";",
"byte",
"carry",
";",
"ge_p1p1",
"r",
"=",
"new",
"ge_p1p1",
"(",
")",
";",... | /*
h = a * B
where a = a[0]+256*a[1]+...+256^31 a[31]
B is the Ed25519 base point (x,4/5) with x positive.
Preconditions:
a[31] <= 127 | [
"/",
"*",
"h",
"=",
"a",
"*",
"B",
"where",
"a",
"=",
"a",
"[",
"0",
"]",
"+",
"256",
"*",
"a",
"[",
"1",
"]",
"+",
"...",
"+",
"256^31",
"a",
"[",
"31",
"]",
"B",
"is",
"the",
"Ed25519",
"base",
"point",
"(",
"x",
"4",
"/",
"5",
")",
... | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/primitives/curve25519/ge_scalarmult_base.java#L69-L115 |
Alluxio/alluxio | core/client/hdfs/src/main/java/alluxio/hadoop/AbstractFileSystem.java | AbstractFileSystem.mkdirs | @Override
public boolean mkdirs(Path path, FsPermission permission) throws IOException {
"""
Attempts to create a folder with the specified path. Parent directories will be created.
@param path path to create
@param permission permissions to grant the created folder
@return true if the indicated folder is created successfully or already exists
"""
LOG.debug("mkdirs({}, {})", path, permission);
if (mStatistics != null) {
mStatistics.incrementWriteOps(1);
}
AlluxioURI uri = new AlluxioURI(HadoopUtils.getPathWithoutScheme(path));
CreateDirectoryPOptions options = CreateDirectoryPOptions.newBuilder().setRecursive(true)
.setAllowExists(true).setMode(new Mode(permission.toShort()).toProto()).build();
try {
mFileSystem.createDirectory(uri, options);
return true;
} catch (AlluxioException e) {
throw new IOException(e);
}
} | java | @Override
public boolean mkdirs(Path path, FsPermission permission) throws IOException {
LOG.debug("mkdirs({}, {})", path, permission);
if (mStatistics != null) {
mStatistics.incrementWriteOps(1);
}
AlluxioURI uri = new AlluxioURI(HadoopUtils.getPathWithoutScheme(path));
CreateDirectoryPOptions options = CreateDirectoryPOptions.newBuilder().setRecursive(true)
.setAllowExists(true).setMode(new Mode(permission.toShort()).toProto()).build();
try {
mFileSystem.createDirectory(uri, options);
return true;
} catch (AlluxioException e) {
throw new IOException(e);
}
} | [
"@",
"Override",
"public",
"boolean",
"mkdirs",
"(",
"Path",
"path",
",",
"FsPermission",
"permission",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"debug",
"(",
"\"mkdirs({}, {})\"",
",",
"path",
",",
"permission",
")",
";",
"if",
"(",
"mStatistics",
"!=... | Attempts to create a folder with the specified path. Parent directories will be created.
@param path path to create
@param permission permissions to grant the created folder
@return true if the indicated folder is created successfully or already exists | [
"Attempts",
"to",
"create",
"a",
"folder",
"with",
"the",
"specified",
"path",
".",
"Parent",
"directories",
"will",
"be",
"created",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/hdfs/src/main/java/alluxio/hadoop/AbstractFileSystem.java#L637-L652 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Factory.java | Factory.addFeatures | private static void addFeatures(Featurable featurable, Services services, Setup setup) {
"""
Add all features declared in configuration.
@param featurable The featurable to handle.
@param services The services reference.
@param setup The setup reference.
"""
final List<Feature> rawFeatures = FeaturableConfig.getFeatures(services, setup);
final int length = rawFeatures.size();
for (int i = 0; i < length; i++)
{
final Feature feature = rawFeatures.get(i);
featurable.addFeature(feature);
}
featurable.addAfter(services, setup);
} | java | private static void addFeatures(Featurable featurable, Services services, Setup setup)
{
final List<Feature> rawFeatures = FeaturableConfig.getFeatures(services, setup);
final int length = rawFeatures.size();
for (int i = 0; i < length; i++)
{
final Feature feature = rawFeatures.get(i);
featurable.addFeature(feature);
}
featurable.addAfter(services, setup);
} | [
"private",
"static",
"void",
"addFeatures",
"(",
"Featurable",
"featurable",
",",
"Services",
"services",
",",
"Setup",
"setup",
")",
"{",
"final",
"List",
"<",
"Feature",
">",
"rawFeatures",
"=",
"FeaturableConfig",
".",
"getFeatures",
"(",
"services",
",",
"... | Add all features declared in configuration.
@param featurable The featurable to handle.
@param services The services reference.
@param setup The setup reference. | [
"Add",
"all",
"features",
"declared",
"in",
"configuration",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Factory.java#L72-L82 |
line/armeria | grpc/src/main/java/com/linecorp/armeria/server/grpc/GrpcDocStringExtractor.java | GrpcDocStringExtractor.getFullName | private static Optional<String> getFullName(FileDescriptorProto descriptor, List<Integer> path) {
"""
would have path [MESSAGE_TYPE_FIELD_NUMBER, 0, NESTED_TYPE_FIELD_NUMBER, 2, FIELD_FIELD_NUMBER, 1]
"""
String fullNameSoFar = descriptor.getPackage();
switch (path.get(0)) {
case FileDescriptorProto.MESSAGE_TYPE_FIELD_NUMBER:
final DescriptorProto message = descriptor.getMessageType(path.get(1));
return appendMessageToFullName(message, path, fullNameSoFar);
case FileDescriptorProto.ENUM_TYPE_FIELD_NUMBER:
final EnumDescriptorProto enumDescriptor = descriptor.getEnumType(path.get(1));
return Optional.of(appendEnumToFullName(enumDescriptor, path, fullNameSoFar));
case FileDescriptorProto.SERVICE_FIELD_NUMBER:
final ServiceDescriptorProto serviceDescriptor = descriptor.getService(path.get(1));
fullNameSoFar = appendNameComponent(fullNameSoFar, serviceDescriptor.getName());
if (path.size() > 2) {
fullNameSoFar = appendFieldComponent(
fullNameSoFar, serviceDescriptor.getMethod(path.get(3)).getName());
}
return Optional.of(fullNameSoFar);
default:
return Optional.empty();
}
} | java | private static Optional<String> getFullName(FileDescriptorProto descriptor, List<Integer> path) {
String fullNameSoFar = descriptor.getPackage();
switch (path.get(0)) {
case FileDescriptorProto.MESSAGE_TYPE_FIELD_NUMBER:
final DescriptorProto message = descriptor.getMessageType(path.get(1));
return appendMessageToFullName(message, path, fullNameSoFar);
case FileDescriptorProto.ENUM_TYPE_FIELD_NUMBER:
final EnumDescriptorProto enumDescriptor = descriptor.getEnumType(path.get(1));
return Optional.of(appendEnumToFullName(enumDescriptor, path, fullNameSoFar));
case FileDescriptorProto.SERVICE_FIELD_NUMBER:
final ServiceDescriptorProto serviceDescriptor = descriptor.getService(path.get(1));
fullNameSoFar = appendNameComponent(fullNameSoFar, serviceDescriptor.getName());
if (path.size() > 2) {
fullNameSoFar = appendFieldComponent(
fullNameSoFar, serviceDescriptor.getMethod(path.get(3)).getName());
}
return Optional.of(fullNameSoFar);
default:
return Optional.empty();
}
} | [
"private",
"static",
"Optional",
"<",
"String",
">",
"getFullName",
"(",
"FileDescriptorProto",
"descriptor",
",",
"List",
"<",
"Integer",
">",
"path",
")",
"{",
"String",
"fullNameSoFar",
"=",
"descriptor",
".",
"getPackage",
"(",
")",
";",
"switch",
"(",
"... | would have path [MESSAGE_TYPE_FIELD_NUMBER, 0, NESTED_TYPE_FIELD_NUMBER, 2, FIELD_FIELD_NUMBER, 1] | [
"would",
"have",
"path",
"[",
"MESSAGE_TYPE_FIELD_NUMBER",
"0",
"NESTED_TYPE_FIELD_NUMBER",
"2",
"FIELD_FIELD_NUMBER",
"1",
"]"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/grpc/src/main/java/com/linecorp/armeria/server/grpc/GrpcDocStringExtractor.java#L109-L129 |
zk1931/jzab | src/main/java/com/github/zk1931/jzab/MessageBuilder.java | MessageBuilder.buildFlush | public static Message buildFlush(Zxid lastProposedZxid, ByteBuffer body) {
"""
Creates a FLUSH message.
@param lastProposedZxid the last proposed zxid before the FLUSH.
@param body the data of the request.
@return a protobuf message.
"""
ZabMessage.Zxid zxid = toProtoZxid(lastProposedZxid);
ZabMessage.Flush flush = ZabMessage.Flush.newBuilder()
.setZxid(zxid)
.setBody(ByteString.copyFrom(body))
.build();
return Message.newBuilder().setType(MessageType.FLUSH).setFlush(flush)
.build();
} | java | public static Message buildFlush(Zxid lastProposedZxid, ByteBuffer body) {
ZabMessage.Zxid zxid = toProtoZxid(lastProposedZxid);
ZabMessage.Flush flush = ZabMessage.Flush.newBuilder()
.setZxid(zxid)
.setBody(ByteString.copyFrom(body))
.build();
return Message.newBuilder().setType(MessageType.FLUSH).setFlush(flush)
.build();
} | [
"public",
"static",
"Message",
"buildFlush",
"(",
"Zxid",
"lastProposedZxid",
",",
"ByteBuffer",
"body",
")",
"{",
"ZabMessage",
".",
"Zxid",
"zxid",
"=",
"toProtoZxid",
"(",
"lastProposedZxid",
")",
";",
"ZabMessage",
".",
"Flush",
"flush",
"=",
"ZabMessage",
... | Creates a FLUSH message.
@param lastProposedZxid the last proposed zxid before the FLUSH.
@param body the data of the request.
@return a protobuf message. | [
"Creates",
"a",
"FLUSH",
"message",
"."
] | train | https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/MessageBuilder.java#L562-L570 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/io/IOUtils.java | IOUtils.writeObjectToFile | public static File writeObjectToFile(Object o, File file) throws IOException {
"""
Write an object to a specified File.
@param o
object to be written to file
@param file
The temp File
@throws IOException
If File cannot be written
@return File containing the object
"""
return writeObjectToFile(o, file, false);
} | java | public static File writeObjectToFile(Object o, File file) throws IOException {
return writeObjectToFile(o, file, false);
} | [
"public",
"static",
"File",
"writeObjectToFile",
"(",
"Object",
"o",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"return",
"writeObjectToFile",
"(",
"o",
",",
"file",
",",
"false",
")",
";",
"}"
] | Write an object to a specified File.
@param o
object to be written to file
@param file
The temp File
@throws IOException
If File cannot be written
@return File containing the object | [
"Write",
"an",
"object",
"to",
"a",
"specified",
"File",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L60-L62 |
jenkinsci/jenkins | core/src/main/java/hudson/tools/ToolInstaller.java | ToolInstaller.preferredLocation | protected final FilePath preferredLocation(ToolInstallation tool, Node node) {
"""
Convenience method to find a location to install a tool.
@param tool the tool being installed
@param node the computer on which to install the tool
@return {@link ToolInstallation#getHome} if specified, else a path within the local
Jenkins work area named according to {@link ToolInstallation#getName}
@since 1.310
"""
if (node == null) {
throw new IllegalArgumentException("must pass non-null node");
}
String home = Util.fixEmptyAndTrim(tool.getHome());
if (home == null) {
home = sanitize(tool.getDescriptor().getId()) + File.separatorChar + sanitize(tool.getName());
}
FilePath root = node.getRootPath();
if (root == null) {
throw new IllegalArgumentException("Node " + node.getDisplayName() + " seems to be offline");
}
return root.child("tools").child(home);
} | java | protected final FilePath preferredLocation(ToolInstallation tool, Node node) {
if (node == null) {
throw new IllegalArgumentException("must pass non-null node");
}
String home = Util.fixEmptyAndTrim(tool.getHome());
if (home == null) {
home = sanitize(tool.getDescriptor().getId()) + File.separatorChar + sanitize(tool.getName());
}
FilePath root = node.getRootPath();
if (root == null) {
throw new IllegalArgumentException("Node " + node.getDisplayName() + " seems to be offline");
}
return root.child("tools").child(home);
} | [
"protected",
"final",
"FilePath",
"preferredLocation",
"(",
"ToolInstallation",
"tool",
",",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"must pass non-null node\"",
")",
";",
"}",
"Stri... | Convenience method to find a location to install a tool.
@param tool the tool being installed
@param node the computer on which to install the tool
@return {@link ToolInstallation#getHome} if specified, else a path within the local
Jenkins work area named according to {@link ToolInstallation#getName}
@since 1.310 | [
"Convenience",
"method",
"to",
"find",
"a",
"location",
"to",
"install",
"a",
"tool",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tools/ToolInstaller.java#L114-L127 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java | HelpFormatter.appendOption | private void appendOption(StringBuffer buff, Option option, boolean required) {
"""
Appends the usage clause for an Option to a StringBuffer.
@param buff the StringBuffer to append to
@param option the Option to append
@param required whether the Option is required or not
"""
if (!required)
{
buff.append("[");
}
if (option.getOpt() != null)
{
buff.append("-").append(option.getOpt());
}
else
{
buff.append("--").append(option.getLongOpt());
}
// if the Option has a value and a non blank argname
if (option.hasArg() && (option.getArgName() == null || option.getArgName().length() != 0))
{
buff.append(option.getOpt() == null ? longOptSeparator : " ");
buff.append("<").append(option.getArgName() != null ? option.getArgName() : getArgName()).append(">");
}
// if the Option is not a required option
if (!required)
{
buff.append("]");
}
} | java | private void appendOption(StringBuffer buff, Option option, boolean required)
{
if (!required)
{
buff.append("[");
}
if (option.getOpt() != null)
{
buff.append("-").append(option.getOpt());
}
else
{
buff.append("--").append(option.getLongOpt());
}
// if the Option has a value and a non blank argname
if (option.hasArg() && (option.getArgName() == null || option.getArgName().length() != 0))
{
buff.append(option.getOpt() == null ? longOptSeparator : " ");
buff.append("<").append(option.getArgName() != null ? option.getArgName() : getArgName()).append(">");
}
// if the Option is not a required option
if (!required)
{
buff.append("]");
}
} | [
"private",
"void",
"appendOption",
"(",
"StringBuffer",
"buff",
",",
"Option",
"option",
",",
"boolean",
"required",
")",
"{",
"if",
"(",
"!",
"required",
")",
"{",
"buff",
".",
"append",
"(",
"\"[\"",
")",
";",
"}",
"if",
"(",
"option",
".",
"getOpt",... | Appends the usage clause for an Option to a StringBuffer.
@param buff the StringBuffer to append to
@param option the Option to append
@param required whether the Option is required or not | [
"Appends",
"the",
"usage",
"clause",
"for",
"an",
"Option",
"to",
"a",
"StringBuffer",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java#L681-L709 |
opencb/cellbase | cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/CellBaseNormalizerSequenceAdaptor.java | CellBaseNormalizerSequenceAdaptor.query | @Override
public String query(String contig, int start, int end) throws Exception {
"""
Returns sequence from contig "contig" in the range [start, end] (1-based, both inclusive).
For corner cases mimics the behaviour of the org.opencb.biodata.tools.sequence.SamtoolsFastaIndex with one
difference. If chromosome does not exist, start is under the left bound, start AND end are out of the right
bound, then a RunTime exception will be thrown. HOWEVER: if start is within the bounds BUT end is out of the
right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep
returning the exception.
@param contig
@param start
@param end
@return String containing the sequence of contig "contig" in the range [start, end] (1-based, both inclusive).
Throws RunTimeException if contig does not exist, or start is under the left bound, or start AND end are out of the right
bound. If start is within the bounds BUT end is out of the
right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep
returning the exception.
@throws Exception
@throws RuntimeException
"""
Region region = new Region(contig, start, end);
QueryResult<GenomeSequenceFeature> queryResult
= genomeDBAdaptor.getSequence(region, QueryOptions.empty());
// This behaviour mimics the behaviour of the org.opencb.biodata.tools.sequence.SamtoolsFastaIndex with one
// difference. If contig does not exist, start is under the left bound, start AND end are out of the right
// bound, then a RunTime exception will be thrown. HOWEVER: if start is within the bounds BUT end is out of the
// right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep
// returning the exception.
if (queryResult.getResult().size() > 0 && StringUtils.isNotBlank(queryResult.getResult().get(0).getSequence())) {
if (queryResult.getResult().get(0).getSequence().length() < (end - start + 1)) {
logger.warn("End coordinate out of the right bound. Returning available nucleotides.");
}
return queryResult.getResult().get(0).getSequence();
} else {
throw new RuntimeException("Unable to find entry for " + region.toString());
}
} | java | @Override
public String query(String contig, int start, int end) throws Exception {
Region region = new Region(contig, start, end);
QueryResult<GenomeSequenceFeature> queryResult
= genomeDBAdaptor.getSequence(region, QueryOptions.empty());
// This behaviour mimics the behaviour of the org.opencb.biodata.tools.sequence.SamtoolsFastaIndex with one
// difference. If contig does not exist, start is under the left bound, start AND end are out of the right
// bound, then a RunTime exception will be thrown. HOWEVER: if start is within the bounds BUT end is out of the
// right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep
// returning the exception.
if (queryResult.getResult().size() > 0 && StringUtils.isNotBlank(queryResult.getResult().get(0).getSequence())) {
if (queryResult.getResult().get(0).getSequence().length() < (end - start + 1)) {
logger.warn("End coordinate out of the right bound. Returning available nucleotides.");
}
return queryResult.getResult().get(0).getSequence();
} else {
throw new RuntimeException("Unable to find entry for " + region.toString());
}
} | [
"@",
"Override",
"public",
"String",
"query",
"(",
"String",
"contig",
",",
"int",
"start",
",",
"int",
"end",
")",
"throws",
"Exception",
"{",
"Region",
"region",
"=",
"new",
"Region",
"(",
"contig",
",",
"start",
",",
"end",
")",
";",
"QueryResult",
... | Returns sequence from contig "contig" in the range [start, end] (1-based, both inclusive).
For corner cases mimics the behaviour of the org.opencb.biodata.tools.sequence.SamtoolsFastaIndex with one
difference. If chromosome does not exist, start is under the left bound, start AND end are out of the right
bound, then a RunTime exception will be thrown. HOWEVER: if start is within the bounds BUT end is out of the
right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep
returning the exception.
@param contig
@param start
@param end
@return String containing the sequence of contig "contig" in the range [start, end] (1-based, both inclusive).
Throws RunTimeException if contig does not exist, or start is under the left bound, or start AND end are out of the right
bound. If start is within the bounds BUT end is out of the
right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep
returning the exception.
@throws Exception
@throws RuntimeException | [
"Returns",
"sequence",
"from",
"contig",
"contig",
"in",
"the",
"range",
"[",
"start",
"end",
"]",
"(",
"1",
"-",
"based",
"both",
"inclusive",
")",
".",
"For",
"corner",
"cases",
"mimics",
"the",
"behaviour",
"of",
"the",
"org",
".",
"opencb",
".",
"b... | train | https://github.com/opencb/cellbase/blob/70cc3d6ecff747725ade9d051438fc6bf98cae44/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/CellBaseNormalizerSequenceAdaptor.java#L40-L59 |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java | ClientProbeSenders.createProbeSenders | private void createProbeSenders(ArgoClientContext context) throws TransportConfigException {
"""
Create the actual ProbeSender instances given the configuration
information. If the transport depends on Network Interfaces, then create a
ProbeSender for each NI we can find on this machine.
@param context the main client configuration information
@throws TransportConfigException if there is some issue initializing the
transport.
"""
senders = new ArrayList<ProbeSender>();
if (config.usesNetworkInterface()) {
try {
for (String niName : context.getAvailableNetworkInterfaces(config.requiresMulticast())) {
try {
Transport transport = instantiateTransportClass(config.getClassname());
transport.initialize(transportProps, niName);
ProbeSender sender = new ProbeSender(transport);
senders.add(sender);
} catch (TransportConfigException e) {
LOGGER.warn( e.getLocalizedMessage());
}
}
} catch (SocketException e) {
throw new TransportConfigException("Error getting available network interfaces", e);
}
} else {
Transport transport = instantiateTransportClass(config.getClassname());
transport.initialize(transportProps, "");
ProbeSender sender = new ProbeSender(transport);
senders.add(sender);
}
} | java | private void createProbeSenders(ArgoClientContext context) throws TransportConfigException {
senders = new ArrayList<ProbeSender>();
if (config.usesNetworkInterface()) {
try {
for (String niName : context.getAvailableNetworkInterfaces(config.requiresMulticast())) {
try {
Transport transport = instantiateTransportClass(config.getClassname());
transport.initialize(transportProps, niName);
ProbeSender sender = new ProbeSender(transport);
senders.add(sender);
} catch (TransportConfigException e) {
LOGGER.warn( e.getLocalizedMessage());
}
}
} catch (SocketException e) {
throw new TransportConfigException("Error getting available network interfaces", e);
}
} else {
Transport transport = instantiateTransportClass(config.getClassname());
transport.initialize(transportProps, "");
ProbeSender sender = new ProbeSender(transport);
senders.add(sender);
}
} | [
"private",
"void",
"createProbeSenders",
"(",
"ArgoClientContext",
"context",
")",
"throws",
"TransportConfigException",
"{",
"senders",
"=",
"new",
"ArrayList",
"<",
"ProbeSender",
">",
"(",
")",
";",
"if",
"(",
"config",
".",
"usesNetworkInterface",
"(",
")",
... | Create the actual ProbeSender instances given the configuration
information. If the transport depends on Network Interfaces, then create a
ProbeSender for each NI we can find on this machine.
@param context the main client configuration information
@throws TransportConfigException if there is some issue initializing the
transport. | [
"Create",
"the",
"actual",
"ProbeSender",
"instances",
"given",
"the",
"configuration",
"information",
".",
"If",
"the",
"transport",
"depends",
"on",
"Network",
"Interfaces",
"then",
"create",
"a",
"ProbeSender",
"for",
"each",
"NI",
"we",
"can",
"find",
"on",
... | train | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java#L161-L186 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/MessageSerializer.java | MessageSerializer.makeTransaction | public final Transaction makeTransaction(byte[] payloadBytes, int offset) throws ProtocolException {
"""
Make a transaction from the payload. Extension point for alternative
serialization format support.
@throws UnsupportedOperationException if this serializer/deserializer
does not support deserialization. This can occur either because it's a dummy
serializer (i.e. for messages with no network parameters), or because
it does not support deserializing transactions.
"""
return makeTransaction(payloadBytes, offset, payloadBytes.length, null);
} | java | public final Transaction makeTransaction(byte[] payloadBytes, int offset) throws ProtocolException {
return makeTransaction(payloadBytes, offset, payloadBytes.length, null);
} | [
"public",
"final",
"Transaction",
"makeTransaction",
"(",
"byte",
"[",
"]",
"payloadBytes",
",",
"int",
"offset",
")",
"throws",
"ProtocolException",
"{",
"return",
"makeTransaction",
"(",
"payloadBytes",
",",
"offset",
",",
"payloadBytes",
".",
"length",
",",
"... | Make a transaction from the payload. Extension point for alternative
serialization format support.
@throws UnsupportedOperationException if this serializer/deserializer
does not support deserialization. This can occur either because it's a dummy
serializer (i.e. for messages with no network parameters), or because
it does not support deserializing transactions. | [
"Make",
"a",
"transaction",
"from",
"the",
"payload",
".",
"Extension",
"point",
"for",
"alternative",
"serialization",
"format",
"support",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/MessageSerializer.java#L141-L143 |
gallandarakhneorg/afc | core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java | WeakArrayList.assertRange | protected void assertRange(int index, boolean allowLast) {
"""
Verify if the specified index is inside the array.
@param index is the index totest
@param allowLast indicates if the last elements is assumed to be valid or not.
"""
final int csize = expurge();
if (index < 0) {
throw new IndexOutOfBoundsException(Locale.getString("E1", index)); //$NON-NLS-1$
}
if (allowLast && (index > csize)) {
throw new IndexOutOfBoundsException(Locale.getString("E2", csize, index)); //$NON-NLS-1$
}
if (!allowLast && (index >= csize)) {
throw new IndexOutOfBoundsException(Locale.getString("E3", csize, index)); //$NON-NLS-1$
}
} | java | protected void assertRange(int index, boolean allowLast) {
final int csize = expurge();
if (index < 0) {
throw new IndexOutOfBoundsException(Locale.getString("E1", index)); //$NON-NLS-1$
}
if (allowLast && (index > csize)) {
throw new IndexOutOfBoundsException(Locale.getString("E2", csize, index)); //$NON-NLS-1$
}
if (!allowLast && (index >= csize)) {
throw new IndexOutOfBoundsException(Locale.getString("E3", csize, index)); //$NON-NLS-1$
}
} | [
"protected",
"void",
"assertRange",
"(",
"int",
"index",
",",
"boolean",
"allowLast",
")",
"{",
"final",
"int",
"csize",
"=",
"expurge",
"(",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"Locale",
".... | Verify if the specified index is inside the array.
@param index is the index totest
@param allowLast indicates if the last elements is assumed to be valid or not. | [
"Verify",
"if",
"the",
"specified",
"index",
"is",
"inside",
"the",
"array",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java#L271-L282 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/Slice.java | Slice.setBytes | public void setBytes(int index, ByteBuffer source) {
"""
Transfers the specified source buffer's data to this buffer starting at
the specified absolute {@code index} until the source buffer's position
reaches its limit.
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
if {@code index + src.remaining()} is greater than
{@code this.capacity}
"""
checkPositionIndexes(index, index + source.remaining(), this.length);
index += offset;
source.get(data, index, source.remaining());
} | java | public void setBytes(int index, ByteBuffer source)
{
checkPositionIndexes(index, index + source.remaining(), this.length);
index += offset;
source.get(data, index, source.remaining());
} | [
"public",
"void",
"setBytes",
"(",
"int",
"index",
",",
"ByteBuffer",
"source",
")",
"{",
"checkPositionIndexes",
"(",
"index",
",",
"index",
"+",
"source",
".",
"remaining",
"(",
")",
",",
"this",
".",
"length",
")",
";",
"index",
"+=",
"offset",
";",
... | Transfers the specified source buffer's data to this buffer starting at
the specified absolute {@code index} until the source buffer's position
reaches its limit.
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
if {@code index + src.remaining()} is greater than
{@code this.capacity} | [
"Transfers",
"the",
"specified",
"source",
"buffer",
"s",
"data",
"to",
"this",
"buffer",
"starting",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"until",
"the",
"source",
"buffer",
"s",
"position",
"reaches",
"its",
"limit",
"."
] | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L399-L404 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/distort/NarrowToWidePtoP_F64.java | NarrowToWidePtoP_F64.compute | @Override
public void compute(double x, double y, Point2D_F64 out) {
"""
Apply the transformation
@param x x-coordinate of point in pixels. Synthetic narrow FOV camera
@param y y-coordinate of point in pixels. Synthetic narrow FOV camera
@param out Pixel location of point in wide FOV camera.
"""
narrowToNorm.compute(x,y, norm);
// Convert from 2D homogenous to 3D
unit.set( norm.x , norm.y , 1.0);
// Rotate then make it a unit vector
GeometryMath_F64.mult(rotateWideToNarrow,unit,unit);
double n = unit.norm();
unit.x /= n;
unit.y /= n;
unit.z /= n;
unitToWide.compute(unit.x,unit.y,unit.z,out);
} | java | @Override
public void compute(double x, double y, Point2D_F64 out) {
narrowToNorm.compute(x,y, norm);
// Convert from 2D homogenous to 3D
unit.set( norm.x , norm.y , 1.0);
// Rotate then make it a unit vector
GeometryMath_F64.mult(rotateWideToNarrow,unit,unit);
double n = unit.norm();
unit.x /= n;
unit.y /= n;
unit.z /= n;
unitToWide.compute(unit.x,unit.y,unit.z,out);
} | [
"@",
"Override",
"public",
"void",
"compute",
"(",
"double",
"x",
",",
"double",
"y",
",",
"Point2D_F64",
"out",
")",
"{",
"narrowToNorm",
".",
"compute",
"(",
"x",
",",
"y",
",",
"norm",
")",
";",
"// Convert from 2D homogenous to 3D",
"unit",
".",
"set",... | Apply the transformation
@param x x-coordinate of point in pixels. Synthetic narrow FOV camera
@param y y-coordinate of point in pixels. Synthetic narrow FOV camera
@param out Pixel location of point in wide FOV camera. | [
"Apply",
"the",
"transformation"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/NarrowToWidePtoP_F64.java#L74-L89 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Parallelogram2dfx.java | Parallelogram2dfx.secondAxisExtentProperty | @Pure
public DoubleProperty secondAxisExtentProperty() {
"""
Replies the property for the extent of the second axis.
@return the secondAxisExtent property.
"""
if (this.extentS == null) {
this.extentS = new SimpleDoubleProperty(this, MathFXAttributeNames.SECOND_AXIS_EXTENT) {
@Override
protected void invalidated() {
if (get() < 0.) {
set(0.);
}
}
};
}
return this.extentS;
} | java | @Pure
public DoubleProperty secondAxisExtentProperty() {
if (this.extentS == null) {
this.extentS = new SimpleDoubleProperty(this, MathFXAttributeNames.SECOND_AXIS_EXTENT) {
@Override
protected void invalidated() {
if (get() < 0.) {
set(0.);
}
}
};
}
return this.extentS;
} | [
"@",
"Pure",
"public",
"DoubleProperty",
"secondAxisExtentProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"extentS",
"==",
"null",
")",
"{",
"this",
".",
"extentS",
"=",
"new",
"SimpleDoubleProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"SECOND_AX... | Replies the property for the extent of the second axis.
@return the secondAxisExtent property. | [
"Replies",
"the",
"property",
"for",
"the",
"extent",
"of",
"the",
"second",
"axis",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Parallelogram2dfx.java#L340-L353 |
maguro/aunit | junit/src/main/java/com/toolazydogs/aunit/Work.java | Work.withRule | public static SelectedRule withRule(String rule, ArgumentBuilder arguments) throws Exception {
"""
Select a tree rule be used as a starting point in tree walking
@param rule the name of the rule to select
@param arguments arguments to be passed in the invocation of the rule when parsing
@return the selected rule
@throws Exception if no rule can be found
"""
if (AunitRuntime.getTreeParserFactory() == null) throw new IllegalStateException("TreeParser factory not set by configuration");
for (Method method : collectMethods(AunitRuntime.getTreeParserFactory().getTreeParserClass()))
{
if (method.getName().equals(rule))
{
return new SelectedRule(method, arguments.get());
}
}
throw new Exception("Rule " + rule + " not found");
} | java | public static SelectedRule withRule(String rule, ArgumentBuilder arguments) throws Exception
{
if (AunitRuntime.getTreeParserFactory() == null) throw new IllegalStateException("TreeParser factory not set by configuration");
for (Method method : collectMethods(AunitRuntime.getTreeParserFactory().getTreeParserClass()))
{
if (method.getName().equals(rule))
{
return new SelectedRule(method, arguments.get());
}
}
throw new Exception("Rule " + rule + " not found");
} | [
"public",
"static",
"SelectedRule",
"withRule",
"(",
"String",
"rule",
",",
"ArgumentBuilder",
"arguments",
")",
"throws",
"Exception",
"{",
"if",
"(",
"AunitRuntime",
".",
"getTreeParserFactory",
"(",
")",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException... | Select a tree rule be used as a starting point in tree walking
@param rule the name of the rule to select
@param arguments arguments to be passed in the invocation of the rule when parsing
@return the selected rule
@throws Exception if no rule can be found | [
"Select",
"a",
"tree",
"rule",
"be",
"used",
"as",
"a",
"starting",
"point",
"in",
"tree",
"walking"
] | train | https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/Work.java#L163-L176 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DefaultMaven2OsgiConverter.java | DefaultMaven2OsgiConverter.getBundleFileName | public static String getBundleFileName(String groupId, String artifactId, String version) {
"""
Computes the file name of the bundle used in Wisdom distribution for the given Maven coordinates.
This convention is based on the uniqueness at runtime of 'bsn-version' (bsn is the bundle symbolic name).
@param groupId the groupId
@param artifactId the artifactId
@param version the version
@return the computed name, composed by the symbolic name and the version: {@code bsn-version.jar}
"""
return DefaultMaven2OsgiConverter.getBundleSymbolicName(groupId, artifactId) + "-" + version + ".jar";
} | java | public static String getBundleFileName(String groupId, String artifactId, String version) {
return DefaultMaven2OsgiConverter.getBundleSymbolicName(groupId, artifactId) + "-" + version + ".jar";
} | [
"public",
"static",
"String",
"getBundleFileName",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"version",
")",
"{",
"return",
"DefaultMaven2OsgiConverter",
".",
"getBundleSymbolicName",
"(",
"groupId",
",",
"artifactId",
")",
"+",
"\"-\"",
... | Computes the file name of the bundle used in Wisdom distribution for the given Maven coordinates.
This convention is based on the uniqueness at runtime of 'bsn-version' (bsn is the bundle symbolic name).
@param groupId the groupId
@param artifactId the artifactId
@param version the version
@return the computed name, composed by the symbolic name and the version: {@code bsn-version.jar} | [
"Computes",
"the",
"file",
"name",
"of",
"the",
"bundle",
"used",
"in",
"Wisdom",
"distribution",
"for",
"the",
"given",
"Maven",
"coordinates",
".",
"This",
"convention",
"is",
"based",
"on",
"the",
"uniqueness",
"at",
"runtime",
"of",
"bsn",
"-",
"version"... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DefaultMaven2OsgiConverter.java#L48-L50 |
magik6k/JWWF | src/main/java/net/magik6k/jwwf/core/JwwfServer.java | JwwfServer.bindServlet | public JwwfServer bindServlet(ServletHolder servletHolder, String url) {
"""
<p>Binds ServletHolder to URL, this allows creation of REST APIs, etc</p>
<p>PLUGINS: Plugin servlets should have url's like /__jwwf/myplugin/stuff</p>
@param servletHolder Servlet holder
@param url URL to bind servlet to
@return This JwwfServer
"""
context.addServlet(servletHolder, url);
return this;
} | java | public JwwfServer bindServlet(ServletHolder servletHolder, String url) {
context.addServlet(servletHolder, url);
return this;
} | [
"public",
"JwwfServer",
"bindServlet",
"(",
"ServletHolder",
"servletHolder",
",",
"String",
"url",
")",
"{",
"context",
".",
"addServlet",
"(",
"servletHolder",
",",
"url",
")",
";",
"return",
"this",
";",
"}"
] | <p>Binds ServletHolder to URL, this allows creation of REST APIs, etc</p>
<p>PLUGINS: Plugin servlets should have url's like /__jwwf/myplugin/stuff</p>
@param servletHolder Servlet holder
@param url URL to bind servlet to
@return This JwwfServer | [
"<p",
">",
"Binds",
"ServletHolder",
"to",
"URL",
"this",
"allows",
"creation",
"of",
"REST",
"APIs",
"etc<",
"/",
"p",
">",
"<p",
">",
"PLUGINS",
":",
"Plugin",
"servlets",
"should",
"have",
"url",
"s",
"like",
"/",
"__jwwf",
"/",
"myplugin",
"/",
"st... | train | https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/core/JwwfServer.java#L105-L108 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDAvailabilityEstimatePersistenceImpl.java | CPDAvailabilityEstimatePersistenceImpl.fetchByUUID_G | @Override
public CPDAvailabilityEstimate fetchByUUID_G(String uuid, long groupId) {
"""
Returns the cpd availability estimate where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching cpd availability estimate, or <code>null</code> if a matching cpd availability estimate could not be found
"""
return fetchByUUID_G(uuid, groupId, true);
} | java | @Override
public CPDAvailabilityEstimate fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CPDAvailabilityEstimate",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the cpd availability estimate where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching cpd availability estimate, or <code>null</code> if a matching cpd availability estimate could not be found | [
"Returns",
"the",
"cpd",
"availability",
"estimate",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDAvailabilityEstimatePersistenceImpl.java#L705-L708 |
OpenTSDB/opentsdb | src/meta/Annotation.java | Annotation.syncNote | private void syncNote(final Annotation note, final boolean overwrite) {
"""
Syncs the local object with the stored object for atomic writes,
overwriting the stored data if the user issued a PUT request
<b>Note:</b> This method also resets the {@code changed} map to false
for every field
@param meta The stored object to sync from
@param overwrite Whether or not all user mutable data in storage should be
replaced by the local object
"""
if (note.start_time > 0 && (note.start_time < start_time || start_time == 0)) {
start_time = note.start_time;
}
// handle user-accessible stuff
if (!overwrite && !changed.get("end_time")) {
end_time = note.end_time;
}
if (!overwrite && !changed.get("description")) {
description = note.description;
}
if (!overwrite && !changed.get("notes")) {
notes = note.notes;
}
if (!overwrite && !changed.get("custom")) {
custom = note.custom;
}
// reset changed flags
initializeChangedMap();
} | java | private void syncNote(final Annotation note, final boolean overwrite) {
if (note.start_time > 0 && (note.start_time < start_time || start_time == 0)) {
start_time = note.start_time;
}
// handle user-accessible stuff
if (!overwrite && !changed.get("end_time")) {
end_time = note.end_time;
}
if (!overwrite && !changed.get("description")) {
description = note.description;
}
if (!overwrite && !changed.get("notes")) {
notes = note.notes;
}
if (!overwrite && !changed.get("custom")) {
custom = note.custom;
}
// reset changed flags
initializeChangedMap();
} | [
"private",
"void",
"syncNote",
"(",
"final",
"Annotation",
"note",
",",
"final",
"boolean",
"overwrite",
")",
"{",
"if",
"(",
"note",
".",
"start_time",
">",
"0",
"&&",
"(",
"note",
".",
"start_time",
"<",
"start_time",
"||",
"start_time",
"==",
"0",
")"... | Syncs the local object with the stored object for atomic writes,
overwriting the stored data if the user issued a PUT request
<b>Note:</b> This method also resets the {@code changed} map to false
for every field
@param meta The stored object to sync from
@param overwrite Whether or not all user mutable data in storage should be
replaced by the local object | [
"Syncs",
"the",
"local",
"object",
"with",
"the",
"stored",
"object",
"for",
"atomic",
"writes",
"overwriting",
"the",
"stored",
"data",
"if",
"the",
"user",
"issued",
"a",
"PUT",
"request",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"This",
"method",
... | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/Annotation.java#L556-L577 |
google/closure-compiler | src/com/google/javascript/jscomp/PeepholeRemoveDeadCode.java | PeepholeRemoveDeadCode.optimizeSubtree | @Override
Node optimizeSubtree(Node subtree) {
"""
could be changed to use code from CheckUnreachableCode to do this.
"""
switch (subtree.getToken()) {
case ASSIGN:
return tryFoldAssignment(subtree);
case COMMA:
return tryFoldComma(subtree);
case SCRIPT:
case BLOCK:
return tryOptimizeBlock(subtree);
case EXPR_RESULT:
return tryFoldExpr(subtree);
case HOOK:
return tryFoldHook(subtree);
case SWITCH:
return tryOptimizeSwitch(subtree);
case IF:
return tryFoldIf(subtree);
case WHILE:
throw checkNormalization(false, "WHILE");
case FOR:
{
Node condition = NodeUtil.getConditionExpression(subtree);
if (condition != null) {
tryFoldForCondition(condition);
}
return tryFoldFor(subtree);
}
case DO:
Node foldedDo = tryFoldDoAway(subtree);
if (foldedDo.isDo()) {
return tryFoldEmptyDo(foldedDo);
}
return foldedDo;
case TRY:
return tryFoldTry(subtree);
case LABEL:
return tryFoldLabel(subtree);
case ARRAY_PATTERN:
return tryOptimizeArrayPattern(subtree);
case OBJECT_PATTERN:
return tryOptimizeObjectPattern(subtree);
case VAR:
case CONST:
case LET:
return tryOptimizeNameDeclaration(subtree);
default:
return subtree;
}
} | java | @Override
Node optimizeSubtree(Node subtree) {
switch (subtree.getToken()) {
case ASSIGN:
return tryFoldAssignment(subtree);
case COMMA:
return tryFoldComma(subtree);
case SCRIPT:
case BLOCK:
return tryOptimizeBlock(subtree);
case EXPR_RESULT:
return tryFoldExpr(subtree);
case HOOK:
return tryFoldHook(subtree);
case SWITCH:
return tryOptimizeSwitch(subtree);
case IF:
return tryFoldIf(subtree);
case WHILE:
throw checkNormalization(false, "WHILE");
case FOR:
{
Node condition = NodeUtil.getConditionExpression(subtree);
if (condition != null) {
tryFoldForCondition(condition);
}
return tryFoldFor(subtree);
}
case DO:
Node foldedDo = tryFoldDoAway(subtree);
if (foldedDo.isDo()) {
return tryFoldEmptyDo(foldedDo);
}
return foldedDo;
case TRY:
return tryFoldTry(subtree);
case LABEL:
return tryFoldLabel(subtree);
case ARRAY_PATTERN:
return tryOptimizeArrayPattern(subtree);
case OBJECT_PATTERN:
return tryOptimizeObjectPattern(subtree);
case VAR:
case CONST:
case LET:
return tryOptimizeNameDeclaration(subtree);
default:
return subtree;
}
} | [
"@",
"Override",
"Node",
"optimizeSubtree",
"(",
"Node",
"subtree",
")",
"{",
"switch",
"(",
"subtree",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"ASSIGN",
":",
"return",
"tryFoldAssignment",
"(",
"subtree",
")",
";",
"case",
"COMMA",
":",
"return",
"... | could be changed to use code from CheckUnreachableCode to do this. | [
"could",
"be",
"changed",
"to",
"use",
"code",
"from",
"CheckUnreachableCode",
"to",
"do",
"this",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PeepholeRemoveDeadCode.java#L74-L124 |
httl/httl | httl/src/main/java/httl/spi/engines/DefaultEngine.java | DefaultEngine.getProperty | @SuppressWarnings("unchecked")
public <T> T getProperty(String key, Class<T> cls) {
"""
Get config instantiated value.
@param key - config key
@param cls - config value type
@return config value
@see #getEngine()
"""
if (properties != null) {
if (cls != null && cls != Object.class && cls != String.class
&& !cls.isInterface() && !cls.isArray()) {
// engine.getProperty("loaders", ClasspathLoader.class);
key = key + "=" + cls.getName();
}
Object value = properties.get(key);
if (value != null) {
if (cls == String.class && value.getClass() != String.class) {
return (T) value.getClass().getName();
}
return (T) value;
}
}
return null;
} | java | @SuppressWarnings("unchecked")
public <T> T getProperty(String key, Class<T> cls) {
if (properties != null) {
if (cls != null && cls != Object.class && cls != String.class
&& !cls.isInterface() && !cls.isArray()) {
// engine.getProperty("loaders", ClasspathLoader.class);
key = key + "=" + cls.getName();
}
Object value = properties.get(key);
if (value != null) {
if (cls == String.class && value.getClass() != String.class) {
return (T) value.getClass().getName();
}
return (T) value;
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getProperty",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"cls",
")",
"{",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"if",
"(",
"cls",
"!=",
"null",
"&... | Get config instantiated value.
@param key - config key
@param cls - config value type
@return config value
@see #getEngine() | [
"Get",
"config",
"instantiated",
"value",
"."
] | train | https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/spi/engines/DefaultEngine.java#L120-L137 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java | CPMeasurementUnitPersistenceImpl.findByG_K_T | @Override
public CPMeasurementUnit findByG_K_T(long groupId, String key, int type)
throws NoSuchCPMeasurementUnitException {
"""
Returns the cp measurement unit where groupId = ? and key = ? and type = ? or throws a {@link NoSuchCPMeasurementUnitException} if it could not be found.
@param groupId the group ID
@param key the key
@param type the type
@return the matching cp measurement unit
@throws NoSuchCPMeasurementUnitException if a matching cp measurement unit could not be found
"""
CPMeasurementUnit cpMeasurementUnit = fetchByG_K_T(groupId, key, type);
if (cpMeasurementUnit == null) {
StringBundler msg = new StringBundler(8);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("groupId=");
msg.append(groupId);
msg.append(", key=");
msg.append(key);
msg.append(", type=");
msg.append(type);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPMeasurementUnitException(msg.toString());
}
return cpMeasurementUnit;
} | java | @Override
public CPMeasurementUnit findByG_K_T(long groupId, String key, int type)
throws NoSuchCPMeasurementUnitException {
CPMeasurementUnit cpMeasurementUnit = fetchByG_K_T(groupId, key, type);
if (cpMeasurementUnit == null) {
StringBundler msg = new StringBundler(8);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("groupId=");
msg.append(groupId);
msg.append(", key=");
msg.append(key);
msg.append(", type=");
msg.append(type);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPMeasurementUnitException(msg.toString());
}
return cpMeasurementUnit;
} | [
"@",
"Override",
"public",
"CPMeasurementUnit",
"findByG_K_T",
"(",
"long",
"groupId",
",",
"String",
"key",
",",
"int",
"type",
")",
"throws",
"NoSuchCPMeasurementUnitException",
"{",
"CPMeasurementUnit",
"cpMeasurementUnit",
"=",
"fetchByG_K_T",
"(",
"groupId",
",",... | Returns the cp measurement unit where groupId = ? and key = ? and type = ? or throws a {@link NoSuchCPMeasurementUnitException} if it could not be found.
@param groupId the group ID
@param key the key
@param type the type
@return the matching cp measurement unit
@throws NoSuchCPMeasurementUnitException if a matching cp measurement unit could not be found | [
"Returns",
"the",
"cp",
"measurement",
"unit",
"where",
"groupId",
"=",
"?",
";",
"and",
"key",
"=",
"?",
";",
"and",
"type",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPMeasurementUnitException",
"}",
"if",
"it",
"could",
"not",
... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L2567-L2596 |
seedstack/i18n-addon | rest/src/main/java/org/seedstack/i18n/rest/internal/translation/TranslationsResource.java | TranslationsResource.getTranslations | @GET
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.TRANSLATION_READ)
public Response getTranslations(@QueryParam(PAGE_INDEX) Long pageIndex, @QueryParam(PAGE_SIZE) Integer pageSize,
@QueryParam(IS_MISSING) Boolean isMissing, @QueryParam(IS_APPROX) Boolean isApprox,
@QueryParam(IS_OUTDATED) Boolean isOutdated, @QueryParam(SEARCH_NAME) String searchName) {
"""
Returns filtered translation with pagination.
@param pageIndex page index
@param pageSize page size
@param isMissing filter indicator on missing translation
@param isApprox filter indicator on approximate translation
@param isOutdated filter indicator on outdated translation
@param searchName filter on key name
@return status code 200 with filtered translations or 204 if no translation
"""
Response response = Response.noContent().build();
if (pageIndex != null && pageSize != null) {
KeySearchCriteria criteria = new KeySearchCriteria(isMissing, isApprox, isOutdated, searchName, locale);
response = Response.ok(translationFinder.findAllTranslations(new Page(pageIndex, pageSize), criteria))
.build();
} else {
List<TranslationRepresentation> translations = translationFinder.findTranslations(locale);
if (!translations.isEmpty()) {
response = Response.ok(translations).build();
}
}
return response;
} | java | @GET
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.TRANSLATION_READ)
public Response getTranslations(@QueryParam(PAGE_INDEX) Long pageIndex, @QueryParam(PAGE_SIZE) Integer pageSize,
@QueryParam(IS_MISSING) Boolean isMissing, @QueryParam(IS_APPROX) Boolean isApprox,
@QueryParam(IS_OUTDATED) Boolean isOutdated, @QueryParam(SEARCH_NAME) String searchName) {
Response response = Response.noContent().build();
if (pageIndex != null && pageSize != null) {
KeySearchCriteria criteria = new KeySearchCriteria(isMissing, isApprox, isOutdated, searchName, locale);
response = Response.ok(translationFinder.findAllTranslations(new Page(pageIndex, pageSize), criteria))
.build();
} else {
List<TranslationRepresentation> translations = translationFinder.findTranslations(locale);
if (!translations.isEmpty()) {
response = Response.ok(translations).build();
}
}
return response;
} | [
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"TRANSLATION_READ",
")",
"public",
"Response",
"getTranslations",
"(",
"@",
"QueryParam",
"(",
"PAGE_INDEX",
")",
"Long",
"pageInd... | Returns filtered translation with pagination.
@param pageIndex page index
@param pageSize page size
@param isMissing filter indicator on missing translation
@param isApprox filter indicator on approximate translation
@param isOutdated filter indicator on outdated translation
@param searchName filter on key name
@return status code 200 with filtered translations or 204 if no translation | [
"Returns",
"filtered",
"translation",
"with",
"pagination",
"."
] | train | https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/translation/TranslationsResource.java#L72-L92 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/AttributeCollector.java | AttributeCollector.resolveNamespaceDecl | protected Attribute resolveNamespaceDecl(int index, boolean internURI) {
"""
Method called to resolve and initialize specified collected
namespace declaration
@return Attribute that contains specified namespace declaration
"""
Attribute ns = mNamespaces[index];
String full = mNamespaceBuilder.getAllValues();
String uri;
if (mNsCount == 0) {
uri = full;
} else {
++index;
if (index < mNsCount) { // not last
int endOffset = mNamespaces[index].mValueStartOffset;
uri = ns.getValue(full, endOffset);
} else { // is last
uri = ns.getValue(full);
}
}
if (internURI && uri.length() > 0) {
uri = sInternCache.intern(uri);
}
ns.mNamespaceURI = uri;
return ns;
} | java | protected Attribute resolveNamespaceDecl(int index, boolean internURI)
{
Attribute ns = mNamespaces[index];
String full = mNamespaceBuilder.getAllValues();
String uri;
if (mNsCount == 0) {
uri = full;
} else {
++index;
if (index < mNsCount) { // not last
int endOffset = mNamespaces[index].mValueStartOffset;
uri = ns.getValue(full, endOffset);
} else { // is last
uri = ns.getValue(full);
}
}
if (internURI && uri.length() > 0) {
uri = sInternCache.intern(uri);
}
ns.mNamespaceURI = uri;
return ns;
} | [
"protected",
"Attribute",
"resolveNamespaceDecl",
"(",
"int",
"index",
",",
"boolean",
"internURI",
")",
"{",
"Attribute",
"ns",
"=",
"mNamespaces",
"[",
"index",
"]",
";",
"String",
"full",
"=",
"mNamespaceBuilder",
".",
"getAllValues",
"(",
")",
";",
"String... | Method called to resolve and initialize specified collected
namespace declaration
@return Attribute that contains specified namespace declaration | [
"Method",
"called",
"to",
"resolve",
"and",
"initialize",
"specified",
"collected",
"namespace",
"declaration"
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L698-L720 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java | AipImageSearch.productDeleteByUrl | public JSONObject productDeleteByUrl(String url, HashMap<String, String> options) {
"""
商品检索—删除接口
**删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign**
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
@return JSONObject
"""
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.PRODUCT_DELETE);
postOperation(request);
return requestServer(request);
} | java | public JSONObject productDeleteByUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.PRODUCT_DELETE);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"productDeleteByUrl",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"request",... | 商品检索—删除接口
**删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign**
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
@return JSONObject | [
"商品检索—删除接口",
"**",
"删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign",
"**"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java#L982-L993 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.getItem | @SuppressWarnings("unchecked")
public <T> T getItem(String itemName, Class<T> clazz) throws ContextException {
"""
Returns an object of the specified class. The class must have an associated context
serializer registered.
@param <T> The item's class.
@param itemName Item name
@param clazz Class of item to be returned.
@return Deserialized item of specified class.
@throws ContextException If no context serializer found.
"""
String item = getItem(itemName);
if (item == null || item.isEmpty()) {
return null;
}
ISerializer<?> contextSerializer = ContextSerializerRegistry.getInstance().get(clazz);
if (contextSerializer == null) {
throw new ContextException("No serializer found for type " + clazz.getName());
}
return (T) contextSerializer.deserialize(item);
} | java | @SuppressWarnings("unchecked")
public <T> T getItem(String itemName, Class<T> clazz) throws ContextException {
String item = getItem(itemName);
if (item == null || item.isEmpty()) {
return null;
}
ISerializer<?> contextSerializer = ContextSerializerRegistry.getInstance().get(clazz);
if (contextSerializer == null) {
throw new ContextException("No serializer found for type " + clazz.getName());
}
return (T) contextSerializer.deserialize(item);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getItem",
"(",
"String",
"itemName",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"ContextException",
"{",
"String",
"item",
"=",
"getItem",
"(",
"itemName",
")",
... | Returns an object of the specified class. The class must have an associated context
serializer registered.
@param <T> The item's class.
@param itemName Item name
@param clazz Class of item to be returned.
@return Deserialized item of specified class.
@throws ContextException If no context serializer found. | [
"Returns",
"an",
"object",
"of",
"the",
"specified",
"class",
".",
"The",
"class",
"must",
"have",
"an",
"associated",
"context",
"serializer",
"registered",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L209-L224 |
landawn/AbacusUtil | src/com/landawn/abacus/dataSource/PoolableConnection.java | PoolableConnection.prepareStatement | @Override
public PoolablePreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
"""
Method prepareStatement.
@param sql
@param columnNames
@return PreparedStatement
@throws SQLException
@see java.sql.Connection#prepareStatement(String, String[])
"""
return new PoolablePreparedStatement(internalConn.prepareStatement(sql, columnNames), this, null);
} | java | @Override
public PoolablePreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
return new PoolablePreparedStatement(internalConn.prepareStatement(sql, columnNames), this, null);
} | [
"@",
"Override",
"public",
"PoolablePreparedStatement",
"prepareStatement",
"(",
"String",
"sql",
",",
"String",
"[",
"]",
"columnNames",
")",
"throws",
"SQLException",
"{",
"return",
"new",
"PoolablePreparedStatement",
"(",
"internalConn",
".",
"prepareStatement",
"(... | Method prepareStatement.
@param sql
@param columnNames
@return PreparedStatement
@throws SQLException
@see java.sql.Connection#prepareStatement(String, String[]) | [
"Method",
"prepareStatement",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolableConnection.java#L536-L539 |
m-m-m/util | scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java | CharSequenceScanner.getTail | protected String getTail() {
"""
This method gets the tail of this scanner without changing the state.
@return the tail of this scanner.
"""
String tail = "";
if (this.offset < this.limit) {
tail = new String(this.buffer, this.offset, this.limit - this.offset + 1);
}
return tail;
} | java | protected String getTail() {
String tail = "";
if (this.offset < this.limit) {
tail = new String(this.buffer, this.offset, this.limit - this.offset + 1);
}
return tail;
} | [
"protected",
"String",
"getTail",
"(",
")",
"{",
"String",
"tail",
"=",
"\"\"",
";",
"if",
"(",
"this",
".",
"offset",
"<",
"this",
".",
"limit",
")",
"{",
"tail",
"=",
"new",
"String",
"(",
"this",
".",
"buffer",
",",
"this",
".",
"offset",
",",
... | This method gets the tail of this scanner without changing the state.
@return the tail of this scanner. | [
"This",
"method",
"gets",
"the",
"tail",
"of",
"this",
"scanner",
"without",
"changing",
"the",
"state",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java#L335-L342 |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java | FormalParameterBuilderImpl.eInit | public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) {
"""
Initialize the formal parameter.
@param context the context of the formal parameter.
@param name the name of the formal parameter.
"""
setTypeResolutionContext(typeContext);
this.context = context;
this.parameter = SarlFactory.eINSTANCE.createSarlFormalParameter();
this.parameter.setName(name);
this.parameter.setParameterType(newTypeRef(this.context, Object.class.getName()));
this.context.getParameters().add(this.parameter);
} | java | public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) {
setTypeResolutionContext(typeContext);
this.context = context;
this.parameter = SarlFactory.eINSTANCE.createSarlFormalParameter();
this.parameter.setName(name);
this.parameter.setParameterType(newTypeRef(this.context, Object.class.getName()));
this.context.getParameters().add(this.parameter);
} | [
"public",
"void",
"eInit",
"(",
"XtendExecutable",
"context",
",",
"String",
"name",
",",
"IJvmTypeProvider",
"typeContext",
")",
"{",
"setTypeResolutionContext",
"(",
"typeContext",
")",
";",
"this",
".",
"context",
"=",
"context",
";",
"this",
".",
"parameter"... | Initialize the formal parameter.
@param context the context of the formal parameter.
@param name the name of the formal parameter. | [
"Initialize",
"the",
"formal",
"parameter",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java#L71-L78 |
alkacon/opencms-core | src/org/opencms/site/CmsSite.java | CmsSite.setParameters | public void setParameters(SortedMap<String, String> parameters) {
"""
Sets the parameters.<p>
@param parameters the parameters to set
"""
m_parameters = new TreeMap<String, String>(parameters);
} | java | public void setParameters(SortedMap<String, String> parameters) {
m_parameters = new TreeMap<String, String>(parameters);
} | [
"public",
"void",
"setParameters",
"(",
"SortedMap",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"m_parameters",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"String",
">",
"(",
"parameters",
")",
";",
"}"
] | Sets the parameters.<p>
@param parameters the parameters to set | [
"Sets",
"the",
"parameters",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSite.java#L728-L731 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.setText | public void setText(int index, String value) {
"""
Set a text value.
@param index text index (1-30)
@param value text value
"""
set(selectField(TaskFieldLists.CUSTOM_TEXT, index), value);
} | java | public void setText(int index, String value)
{
set(selectField(TaskFieldLists.CUSTOM_TEXT, index), value);
} | [
"public",
"void",
"setText",
"(",
"int",
"index",
",",
"String",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"TaskFieldLists",
".",
"CUSTOM_TEXT",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set a text value.
@param index text index (1-30)
@param value text value | [
"Set",
"a",
"text",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L2595-L2598 |
apiman/apiman | common/net/src/main/java/io/apiman/common/net/hawkular/beans/MetricLongBean.java | MetricLongBean.addDataPoint | public DataPointLongBean addDataPoint(Date timestamp, long value, Map<String, String> tags) {
"""
Adds a single data point to the metric.
@param timestamp
@param value
@param tags
"""
DataPointLongBean point = new DataPointLongBean(timestamp, value);
for (Entry<String, String> entry : tags.entrySet()) {
point.addTag(entry.getKey(), entry.getValue());
}
dataPoints.add(point);
return point;
} | java | public DataPointLongBean addDataPoint(Date timestamp, long value, Map<String, String> tags) {
DataPointLongBean point = new DataPointLongBean(timestamp, value);
for (Entry<String, String> entry : tags.entrySet()) {
point.addTag(entry.getKey(), entry.getValue());
}
dataPoints.add(point);
return point;
} | [
"public",
"DataPointLongBean",
"addDataPoint",
"(",
"Date",
"timestamp",
",",
"long",
"value",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"DataPointLongBean",
"point",
"=",
"new",
"DataPointLongBean",
"(",
"timestamp",
",",
"value",
")",
... | Adds a single data point to the metric.
@param timestamp
@param value
@param tags | [
"Adds",
"a",
"single",
"data",
"point",
"to",
"the",
"metric",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/net/src/main/java/io/apiman/common/net/hawkular/beans/MetricLongBean.java#L101-L108 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/inventory/message/CloseInventoryMessage.java | CloseInventoryMessage.process | @Override
public void process(Packet message, MessageContext ctx) {
"""
Handles the received {@link Packet} on the client. Closes the GUI.
@param message the message
@param ctx the ctx
"""
if (MalisisGui.current() != null)
MalisisGui.current().close();
} | java | @Override
public void process(Packet message, MessageContext ctx)
{
if (MalisisGui.current() != null)
MalisisGui.current().close();
} | [
"@",
"Override",
"public",
"void",
"process",
"(",
"Packet",
"message",
",",
"MessageContext",
"ctx",
")",
"{",
"if",
"(",
"MalisisGui",
".",
"current",
"(",
")",
"!=",
"null",
")",
"MalisisGui",
".",
"current",
"(",
")",
".",
"close",
"(",
")",
";",
... | Handles the received {@link Packet} on the client. Closes the GUI.
@param message the message
@param ctx the ctx | [
"Handles",
"the",
"received",
"{",
"@link",
"Packet",
"}",
"on",
"the",
"client",
".",
"Closes",
"the",
"GUI",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/inventory/message/CloseInventoryMessage.java#L58-L63 |
jbundle/jbundle | main/msg/src/main/java/org/jbundle/main/msg/db/NotifyTimeoutProcessHandler.java | NotifyTimeoutProcessHandler.doRecordChange | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) {
"""
Called when a change is the record status is about to happen/has happened.
@param field If this file change is due to a field, this is the field.
@param iChangeType The type of change that occurred.
@param bDisplayOption If true, display any changes.
@return an error code.
ADD_TYPE - Before a write.
UPDATE_TYPE - Before an update.
DELETE_TYPE - Before a delete.
AFTER_UPDATE_TYPE - After a write or update.
LOCK_TYPE - Before a lock.
SELECT_TYPE - After a select.
DESELECT_TYPE - After a deselect.
MOVE_NEXT_TYPE - After a move.
AFTER_REQUERY_TYPE - Record opened.
SELECT_EOF_TYPE - EOF Hit.
"""
if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
if (!this.getOwner().getField(MessageLog.TIMEOUT_TIME).isNull())
{
Date timeTimeout = ((DateTimeField)this.getOwner().getField(MessageLog.TIMEOUT_TIME)).getDateTime();
Date timeNow = new Date();
if (timeTimeout != null)
{
if ((m_lastTime == null)
|| (m_lastTime.getTime() <= timeNow.getTime() + EXTRA_TIME_MS))
{ // All the waiting tasks have been run, ping the process to start up again.
MessageManager messageManager = ((Application)this.getOwner().getTask().getApplication()).getMessageManager();
Map<String,Object> properties = new Hashtable<String,Object>();
properties.put(PrivateTaskScheduler.TIME_TO_RUN, timeTimeout);
properties.put(PrivateTaskScheduler.NO_DUPLICATE, Constants.TRUE);
properties.put(DBParams.PROCESS, MessageTimeoutProcess.class.getName());
if (messageManager != null)
messageManager.sendMessage(new MapMessage(new BaseMessageHeader(MessageTimeoutProcess.TIMEOUT_QUEUE_NAME, MessageConstants.INTRANET_QUEUE, this, null), properties));
}
}
m_lastTime = timeTimeout;
}
return super.doRecordChange(field, iChangeType, bDisplayOption);
} | java | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
if (!this.getOwner().getField(MessageLog.TIMEOUT_TIME).isNull())
{
Date timeTimeout = ((DateTimeField)this.getOwner().getField(MessageLog.TIMEOUT_TIME)).getDateTime();
Date timeNow = new Date();
if (timeTimeout != null)
{
if ((m_lastTime == null)
|| (m_lastTime.getTime() <= timeNow.getTime() + EXTRA_TIME_MS))
{ // All the waiting tasks have been run, ping the process to start up again.
MessageManager messageManager = ((Application)this.getOwner().getTask().getApplication()).getMessageManager();
Map<String,Object> properties = new Hashtable<String,Object>();
properties.put(PrivateTaskScheduler.TIME_TO_RUN, timeTimeout);
properties.put(PrivateTaskScheduler.NO_DUPLICATE, Constants.TRUE);
properties.put(DBParams.PROCESS, MessageTimeoutProcess.class.getName());
if (messageManager != null)
messageManager.sendMessage(new MapMessage(new BaseMessageHeader(MessageTimeoutProcess.TIMEOUT_QUEUE_NAME, MessageConstants.INTRANET_QUEUE, this, null), properties));
}
}
m_lastTime = timeTimeout;
}
return super.doRecordChange(field, iChangeType, bDisplayOption);
} | [
"public",
"int",
"doRecordChange",
"(",
"FieldInfo",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"{",
"if",
"(",
"(",
"iChangeType",
"==",
"DBConstants",
".",
"AFTER_ADD_TYPE",
")",
"||",
"(",
"iChangeType",
"==",
"DBConstants",
... | Called when a change is the record status is about to happen/has happened.
@param field If this file change is due to a field, this is the field.
@param iChangeType The type of change that occurred.
@param bDisplayOption If true, display any changes.
@return an error code.
ADD_TYPE - Before a write.
UPDATE_TYPE - Before an update.
DELETE_TYPE - Before a delete.
AFTER_UPDATE_TYPE - After a write or update.
LOCK_TYPE - Before a lock.
SELECT_TYPE - After a select.
DESELECT_TYPE - After a deselect.
MOVE_NEXT_TYPE - After a move.
AFTER_REQUERY_TYPE - Record opened.
SELECT_EOF_TYPE - EOF Hit. | [
"Called",
"when",
"a",
"change",
"is",
"the",
"record",
"status",
"is",
"about",
"to",
"happen",
"/",
"has",
"happened",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/NotifyTimeoutProcessHandler.java#L76-L100 |
ical4j/ical4j | src/main/java/net/fortuna/ical4j/util/Calendars.java | Calendars.getContentType | public static String getContentType(Calendar calendar, Charset charset) {
"""
Returns an appropriate MIME Content-Type for the specified calendar object.
@param calendar a calendar instance
@param charset an optional encoding
@return a content type string
"""
final StringBuilder b = new StringBuilder("text/calendar");
final Method method = calendar.getProperty(Property.METHOD);
if (method != null) {
b.append("; method=");
b.append(method.getValue());
}
if (charset != null) {
b.append("; charset=");
b.append(charset);
}
return b.toString();
} | java | public static String getContentType(Calendar calendar, Charset charset) {
final StringBuilder b = new StringBuilder("text/calendar");
final Method method = calendar.getProperty(Property.METHOD);
if (method != null) {
b.append("; method=");
b.append(method.getValue());
}
if (charset != null) {
b.append("; charset=");
b.append(charset);
}
return b.toString();
} | [
"public",
"static",
"String",
"getContentType",
"(",
"Calendar",
"calendar",
",",
"Charset",
"charset",
")",
"{",
"final",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
"\"text/calendar\"",
")",
";",
"final",
"Method",
"method",
"=",
"calendar",
".",
... | Returns an appropriate MIME Content-Type for the specified calendar object.
@param calendar a calendar instance
@param charset an optional encoding
@return a content type string | [
"Returns",
"an",
"appropriate",
"MIME",
"Content",
"-",
"Type",
"for",
"the",
"specified",
"calendar",
"object",
"."
] | train | https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/util/Calendars.java#L204-L218 |
hector-client/hector | core/src/main/java/me/prettyprint/cassandra/service/template/AbstractColumnFamilyTemplate.java | AbstractColumnFamilyTemplate.deleteRow | public void deleteRow(Mutator<K> mutator, K key) {
"""
Stage this deletion into the provided mutator calling {@linkplain #executeIfNotBatched(Mutator)}
@param mutator
@param key
"""
mutator.addDeletion(key, columnFamily, null, topSerializer);
executeIfNotBatched(mutator);
} | java | public void deleteRow(Mutator<K> mutator, K key) {
mutator.addDeletion(key, columnFamily, null, topSerializer);
executeIfNotBatched(mutator);
} | [
"public",
"void",
"deleteRow",
"(",
"Mutator",
"<",
"K",
">",
"mutator",
",",
"K",
"key",
")",
"{",
"mutator",
".",
"addDeletion",
"(",
"key",
",",
"columnFamily",
",",
"null",
",",
"topSerializer",
")",
";",
"executeIfNotBatched",
"(",
"mutator",
")",
"... | Stage this deletion into the provided mutator calling {@linkplain #executeIfNotBatched(Mutator)}
@param mutator
@param key | [
"Stage",
"this",
"deletion",
"into",
"the",
"provided",
"mutator",
"calling",
"{"
] | train | https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/service/template/AbstractColumnFamilyTemplate.java#L181-L184 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/ipc/RPC.java | RPC.waitForProxy | static <V extends VersionedProtocol> V waitForProxy(Class<V> protocol, InetSocketAddress addr,
long timeout) throws IOException {
"""
Get a proxy connection to a remote server
@param protocol
protocol class
@param addr
remote address
@param timeout
time in milliseconds before giving up
@return the proxy
@throws IOException
if the far end through a RemoteException
"""
long startTime = System.currentTimeMillis();
IOException ioe;
while (true) {
try {
return getProxy(protocol, addr);
} catch (ConnectException se) { // namenode has not been started
LOG.info("Server at " + addr + " not available yet, Zzzzz...");
ioe = se;
} catch (SocketTimeoutException te) { // namenode is busy
LOG.info("Problem connecting to server: " + addr);
ioe = te;
}
// check if timed out
if (System.currentTimeMillis() - timeout >= startTime) {
throw ioe;
}
// wait for retry
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
// IGNORE
}
}
} | java | static <V extends VersionedProtocol> V waitForProxy(Class<V> protocol, InetSocketAddress addr,
long timeout) throws IOException {
long startTime = System.currentTimeMillis();
IOException ioe;
while (true) {
try {
return getProxy(protocol, addr);
} catch (ConnectException se) { // namenode has not been started
LOG.info("Server at " + addr + " not available yet, Zzzzz...");
ioe = se;
} catch (SocketTimeoutException te) { // namenode is busy
LOG.info("Problem connecting to server: " + addr);
ioe = te;
}
// check if timed out
if (System.currentTimeMillis() - timeout >= startTime) {
throw ioe;
}
// wait for retry
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
// IGNORE
}
}
} | [
"static",
"<",
"V",
"extends",
"VersionedProtocol",
">",
"V",
"waitForProxy",
"(",
"Class",
"<",
"V",
">",
"protocol",
",",
"InetSocketAddress",
"addr",
",",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"long",
"startTime",
"=",
"System",
".",
"curr... | Get a proxy connection to a remote server
@param protocol
protocol class
@param addr
remote address
@param timeout
time in milliseconds before giving up
@return the proxy
@throws IOException
if the far end through a RemoteException | [
"Get",
"a",
"proxy",
"connection",
"to",
"a",
"remote",
"server"
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/ipc/RPC.java#L283-L309 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java | SparkDl4jMultiLayer.scoreExamples | public JavaDoubleRDD scoreExamples(JavaRDD<DataSet> data, boolean includeRegularizationTerms, int batchSize) {
"""
Score the examples individually, using a specified batch size. Unlike {@link #calculateScore(JavaRDD, boolean)},
this method returns a score for each example separately. If scoring is needed for specific examples use either
{@link #scoreExamples(JavaPairRDD, boolean)} or {@link #scoreExamples(JavaPairRDD, boolean, int)} which can have
a key for each example.
@param data Data to score
@param includeRegularizationTerms If true: include the l1/l2 regularization terms with the score (if any)
@param batchSize Batch size to use when doing scoring
@return A JavaDoubleRDD containing the scores of each example
@see MultiLayerNetwork#scoreExamples(DataSet, boolean)
"""
return data.mapPartitionsToDouble(new ScoreExamplesFunction(sc.broadcast(network.params()),
sc.broadcast(conf.toJson()), includeRegularizationTerms, batchSize));
} | java | public JavaDoubleRDD scoreExamples(JavaRDD<DataSet> data, boolean includeRegularizationTerms, int batchSize) {
return data.mapPartitionsToDouble(new ScoreExamplesFunction(sc.broadcast(network.params()),
sc.broadcast(conf.toJson()), includeRegularizationTerms, batchSize));
} | [
"public",
"JavaDoubleRDD",
"scoreExamples",
"(",
"JavaRDD",
"<",
"DataSet",
">",
"data",
",",
"boolean",
"includeRegularizationTerms",
",",
"int",
"batchSize",
")",
"{",
"return",
"data",
".",
"mapPartitionsToDouble",
"(",
"new",
"ScoreExamplesFunction",
"(",
"sc",
... | Score the examples individually, using a specified batch size. Unlike {@link #calculateScore(JavaRDD, boolean)},
this method returns a score for each example separately. If scoring is needed for specific examples use either
{@link #scoreExamples(JavaPairRDD, boolean)} or {@link #scoreExamples(JavaPairRDD, boolean, int)} which can have
a key for each example.
@param data Data to score
@param includeRegularizationTerms If true: include the l1/l2 regularization terms with the score (if any)
@param batchSize Batch size to use when doing scoring
@return A JavaDoubleRDD containing the scores of each example
@see MultiLayerNetwork#scoreExamples(DataSet, boolean) | [
"Score",
"the",
"examples",
"individually",
"using",
"a",
"specified",
"batch",
"size",
".",
"Unlike",
"{",
"@link",
"#calculateScore",
"(",
"JavaRDD",
"boolean",
")",
"}",
"this",
"method",
"returns",
"a",
"score",
"for",
"each",
"example",
"separately",
".",... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java#L434-L437 |
amzn/ion-java | src/com/amazon/ion/util/IonTextUtils.java | IonTextUtils.printQuotedSymbol | public static void printQuotedSymbol(Appendable out, CharSequence text)
throws IOException {
"""
Prints text as a single-quoted Ion symbol.
If the {@code text} is null, this prints {@code null.symbol}.
@param out the stream to receive the data.
@param text the symbol text; may be {@code null}.
@throws IOException if the {@link Appendable} throws an exception.
@throws IllegalArgumentException
if the text contains invalid UTF-16 surrogates.
"""
if (text == null)
{
out.append("null.symbol");
}
else
{
out.append('\'');
printCodePoints(out, text, EscapeMode.ION_SYMBOL);
out.append('\'');
}
} | java | public static void printQuotedSymbol(Appendable out, CharSequence text)
throws IOException
{
if (text == null)
{
out.append("null.symbol");
}
else
{
out.append('\'');
printCodePoints(out, text, EscapeMode.ION_SYMBOL);
out.append('\'');
}
} | [
"public",
"static",
"void",
"printQuotedSymbol",
"(",
"Appendable",
"out",
",",
"CharSequence",
"text",
")",
"throws",
"IOException",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"out",
".",
"append",
"(",
"\"null.symbol\"",
")",
";",
"}",
"else",
"{",
... | Prints text as a single-quoted Ion symbol.
If the {@code text} is null, this prints {@code null.symbol}.
@param out the stream to receive the data.
@param text the symbol text; may be {@code null}.
@throws IOException if the {@link Appendable} throws an exception.
@throws IllegalArgumentException
if the text contains invalid UTF-16 surrogates. | [
"Prints",
"text",
"as",
"a",
"single",
"-",
"quoted",
"Ion",
"symbol",
".",
"If",
"the",
"{",
"@code",
"text",
"}",
"is",
"null",
"this",
"prints",
"{",
"@code",
"null",
".",
"symbol",
"}",
"."
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonTextUtils.java#L648-L661 |
apiman/apiman | common/util/src/main/java/io/apiman/common/util/AesEncrypter.java | AesEncrypter.keySpecFromSecretKey | private static SecretKeySpec keySpecFromSecretKey(String secretKey) {
"""
Returns a {@link SecretKeySpec} given a secret key.
@param secretKey
"""
if (!keySpecs.containsKey(secretKey)) {
byte[] ivraw = secretKey.getBytes();
SecretKeySpec skeySpec = new SecretKeySpec(ivraw, "AES"); //$NON-NLS-1$
keySpecs.put(secretKey, skeySpec);
}
return keySpecs.get(secretKey);
} | java | private static SecretKeySpec keySpecFromSecretKey(String secretKey) {
if (!keySpecs.containsKey(secretKey)) {
byte[] ivraw = secretKey.getBytes();
SecretKeySpec skeySpec = new SecretKeySpec(ivraw, "AES"); //$NON-NLS-1$
keySpecs.put(secretKey, skeySpec);
}
return keySpecs.get(secretKey);
} | [
"private",
"static",
"SecretKeySpec",
"keySpecFromSecretKey",
"(",
"String",
"secretKey",
")",
"{",
"if",
"(",
"!",
"keySpecs",
".",
"containsKey",
"(",
"secretKey",
")",
")",
"{",
"byte",
"[",
"]",
"ivraw",
"=",
"secretKey",
".",
"getBytes",
"(",
")",
";"... | Returns a {@link SecretKeySpec} given a secret key.
@param secretKey | [
"Returns",
"a",
"{"
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/util/src/main/java/io/apiman/common/util/AesEncrypter.java#L94-L101 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/Utils.java | Utils.formatDate | public static String formatDate(long time) {
"""
Format a Date.getTime() value as "YYYY-MM-DD HH:mm:ss". This method creates a
GregorianCalendar object using the <i>local</i> time zone and then calls
{@link #formatDate(Calendar)}.
@param time Date/time in Date.getTime() format (milliseconds since the epoch).
@return "YYYY-MM-DD HH:mm:ss".
"""
// Map date/time to a GregorianCalendar object (local time zone).
GregorianCalendar date = new GregorianCalendar();
date.setTimeInMillis(time);
return formatDate(date, Calendar.SECOND);
} | java | public static String formatDate(long time) {
// Map date/time to a GregorianCalendar object (local time zone).
GregorianCalendar date = new GregorianCalendar();
date.setTimeInMillis(time);
return formatDate(date, Calendar.SECOND);
} | [
"public",
"static",
"String",
"formatDate",
"(",
"long",
"time",
")",
"{",
"// Map date/time to a GregorianCalendar object (local time zone).\r",
"GregorianCalendar",
"date",
"=",
"new",
"GregorianCalendar",
"(",
")",
";",
"date",
".",
"setTimeInMillis",
"(",
"time",
")... | Format a Date.getTime() value as "YYYY-MM-DD HH:mm:ss". This method creates a
GregorianCalendar object using the <i>local</i> time zone and then calls
{@link #formatDate(Calendar)}.
@param time Date/time in Date.getTime() format (milliseconds since the epoch).
@return "YYYY-MM-DD HH:mm:ss". | [
"Format",
"a",
"Date",
".",
"getTime",
"()",
"value",
"as",
"YYYY",
"-",
"MM",
"-",
"DD",
"HH",
":",
"mm",
":",
"ss",
".",
"This",
"method",
"creates",
"a",
"GregorianCalendar",
"object",
"using",
"the",
"<i",
">",
"local<",
"/",
"i",
">",
"time",
... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L794-L799 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/LocaleData.java | LocaleData.getMap | @SuppressWarnings("rawtypes") public static final Map getMap(Locale locale, String key) {
"""
Convenience method for retrieving a Map resource.
@param locale locale identifier
@param key resource key
@return resource value
"""
ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
return ((Map) bundle.getObject(key));
} | java | @SuppressWarnings("rawtypes") public static final Map getMap(Locale locale, String key)
{
ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
return ((Map) bundle.getObject(key));
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"final",
"Map",
"getMap",
"(",
"Locale",
"locale",
",",
"String",
"key",
")",
"{",
"ResourceBundle",
"bundle",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"LocaleData",
".",
"class",
".",... | Convenience method for retrieving a Map resource.
@param locale locale identifier
@param key resource key
@return resource value | [
"Convenience",
"method",
"for",
"retrieving",
"a",
"Map",
"resource",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/LocaleData.java#L112-L116 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/DateChangedHandler.java | DateChangedHandler.init | public void init(Record record, DateTimeField field, String mainFilesFieldName) {
"""
Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param iMainFilesField The sequence of the date changed field in this record.
@param field The date changed field in this record.
"""
super.init(record);
m_field = field;
if (field != null)
if (field.getRecord() != record)
field.addListener(new FieldRemoveBOnCloseHandler(this));
this.mainFilesFieldName = mainFilesFieldName;
} | java | public void init(Record record, DateTimeField field, String mainFilesFieldName)
{
super.init(record);
m_field = field;
if (field != null)
if (field.getRecord() != record)
field.addListener(new FieldRemoveBOnCloseHandler(this));
this.mainFilesFieldName = mainFilesFieldName;
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"DateTimeField",
"field",
",",
"String",
"mainFilesFieldName",
")",
"{",
"super",
".",
"init",
"(",
"record",
")",
";",
"m_field",
"=",
"field",
";",
"if",
"(",
"field",
"!=",
"null",
")",
"if",
"... | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param iMainFilesField The sequence of the date changed field in this record.
@param field The date changed field in this record. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/DateChangedHandler.java#L71-L79 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/SystemObserver.java | SystemObserver.prefetchGAdsParams | boolean prefetchGAdsParams(Context context, GAdsParamsFetchEvents callback) {
"""
Method to prefetch the GAID and LAT values.
@param context Context.
@param callback {@link GAdsParamsFetchEvents} instance to notify process completion
@return {@link Boolean} with true if GAID fetch process started.
"""
boolean isPrefetchStarted = false;
if (TextUtils.isEmpty(GAIDString_)) {
isPrefetchStarted = true;
new GAdsPrefetchTask(context, callback).executeTask();
}
return isPrefetchStarted;
} | java | boolean prefetchGAdsParams(Context context, GAdsParamsFetchEvents callback) {
boolean isPrefetchStarted = false;
if (TextUtils.isEmpty(GAIDString_)) {
isPrefetchStarted = true;
new GAdsPrefetchTask(context, callback).executeTask();
}
return isPrefetchStarted;
} | [
"boolean",
"prefetchGAdsParams",
"(",
"Context",
"context",
",",
"GAdsParamsFetchEvents",
"callback",
")",
"{",
"boolean",
"isPrefetchStarted",
"=",
"false",
";",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"GAIDString_",
")",
")",
"{",
"isPrefetchStarted",
"=",
... | Method to prefetch the GAID and LAT values.
@param context Context.
@param callback {@link GAdsParamsFetchEvents} instance to notify process completion
@return {@link Boolean} with true if GAID fetch process started. | [
"Method",
"to",
"prefetch",
"the",
"GAID",
"and",
"LAT",
"values",
"."
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/SystemObserver.java#L307-L314 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java | RubyBundleAuditAnalyzer.createDependencyForGem | private Dependency createDependencyForGem(Engine engine, String parentName, String fileName, String filePath, String gem) throws IOException {
"""
Creates the dependency based off of the gem.
@param engine the engine used for scanning
@param parentName the gem parent
@param fileName the file name
@param filePath the file path
@param gem the gem name
@return the dependency to add
@throws IOException thrown if a temporary gem file could not be written
"""
final File gemFile;
try {
gemFile = File.createTempFile(gem, "_Gemfile.lock", getSettings().getTempDirectory());
} catch (IOException ioe) {
throw new IOException("Unable to create temporary gem file");
}
final String displayFileName = String.format("%s%c%s:%s", parentName, File.separatorChar, fileName, gem);
FileUtils.write(gemFile, displayFileName, Charset.defaultCharset()); // unique contents to avoid dependency bundling
final Dependency dependency = new Dependency(gemFile);
dependency.setEcosystem(DEPENDENCY_ECOSYSTEM);
dependency.addEvidence(EvidenceType.PRODUCT, "bundler-audit", "Name", gem, Confidence.HIGHEST);
//TODO add package URL - note, this may require parsing the gemfile.lock and getting the version for each entry
dependency.setDisplayFileName(displayFileName);
dependency.setFileName(fileName);
dependency.setFilePath(filePath);
engine.addDependency(dependency);
return dependency;
} | java | private Dependency createDependencyForGem(Engine engine, String parentName, String fileName, String filePath, String gem) throws IOException {
final File gemFile;
try {
gemFile = File.createTempFile(gem, "_Gemfile.lock", getSettings().getTempDirectory());
} catch (IOException ioe) {
throw new IOException("Unable to create temporary gem file");
}
final String displayFileName = String.format("%s%c%s:%s", parentName, File.separatorChar, fileName, gem);
FileUtils.write(gemFile, displayFileName, Charset.defaultCharset()); // unique contents to avoid dependency bundling
final Dependency dependency = new Dependency(gemFile);
dependency.setEcosystem(DEPENDENCY_ECOSYSTEM);
dependency.addEvidence(EvidenceType.PRODUCT, "bundler-audit", "Name", gem, Confidence.HIGHEST);
//TODO add package URL - note, this may require parsing the gemfile.lock and getting the version for each entry
dependency.setDisplayFileName(displayFileName);
dependency.setFileName(fileName);
dependency.setFilePath(filePath);
engine.addDependency(dependency);
return dependency;
} | [
"private",
"Dependency",
"createDependencyForGem",
"(",
"Engine",
"engine",
",",
"String",
"parentName",
",",
"String",
"fileName",
",",
"String",
"filePath",
",",
"String",
"gem",
")",
"throws",
"IOException",
"{",
"final",
"File",
"gemFile",
";",
"try",
"{",
... | Creates the dependency based off of the gem.
@param engine the engine used for scanning
@param parentName the gem parent
@param fileName the file name
@param filePath the file path
@param gem the gem name
@return the dependency to add
@throws IOException thrown if a temporary gem file could not be written | [
"Creates",
"the",
"dependency",
"based",
"off",
"of",
"the",
"gem",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java#L508-L527 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.showTextAlignedKerned | public void showTextAlignedKerned(int alignment, String text, float x, float y, float rotation) {
"""
Shows text kerned right, left or center aligned with rotation.
@param alignment the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT
@param text the text to show
@param x the x pivot position
@param y the y pivot position
@param rotation the rotation to be applied in degrees counterclockwise
"""
showTextAligned(alignment, text, x, y, rotation, true);
} | java | public void showTextAlignedKerned(int alignment, String text, float x, float y, float rotation) {
showTextAligned(alignment, text, x, y, rotation, true);
} | [
"public",
"void",
"showTextAlignedKerned",
"(",
"int",
"alignment",
",",
"String",
"text",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"rotation",
")",
"{",
"showTextAligned",
"(",
"alignment",
",",
"text",
",",
"x",
",",
"y",
",",
"rotation",
",... | Shows text kerned right, left or center aligned with rotation.
@param alignment the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT
@param text the text to show
@param x the x pivot position
@param y the y pivot position
@param rotation the rotation to be applied in degrees counterclockwise | [
"Shows",
"text",
"kerned",
"right",
"left",
"or",
"center",
"aligned",
"with",
"rotation",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1768-L1770 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.