repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
Axway/Grapes
server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java
OrganizationResource.postOrganization
@POST public Response postOrganization(@Auth final DbCredential credential, final Organization organization){ if(!credential.getRoles().contains(DbCredential.AvailableRoles.DATA_UPDATER)){ throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build()); } LOG.info("Got a post organization request."); // Checks if the data is corrupted DataValidator.validate(organization); final DbOrganization dbOrganization = getModelMapper().getDbOrganization(organization); getOrganizationHandler().store(dbOrganization); return Response.ok().status(HttpStatus.CREATED_201).build(); }
java
@POST public Response postOrganization(@Auth final DbCredential credential, final Organization organization){ if(!credential.getRoles().contains(DbCredential.AvailableRoles.DATA_UPDATER)){ throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build()); } LOG.info("Got a post organization request."); // Checks if the data is corrupted DataValidator.validate(organization); final DbOrganization dbOrganization = getModelMapper().getDbOrganization(organization); getOrganizationHandler().store(dbOrganization); return Response.ok().status(HttpStatus.CREATED_201).build(); }
[ "@", "POST", "public", "Response", "postOrganization", "(", "@", "Auth", "final", "DbCredential", "credential", ",", "final", "Organization", "organization", ")", "{", "if", "(", "!", "credential", ".", "getRoles", "(", ")", ".", "contains", "(", "DbCredential", ".", "AvailableRoles", ".", "DATA_UPDATER", ")", ")", "{", "throw", "new", "WebApplicationException", "(", "Response", ".", "status", "(", "Response", ".", "Status", ".", "UNAUTHORIZED", ")", ".", "build", "(", ")", ")", ";", "}", "LOG", ".", "info", "(", "\"Got a post organization request.\"", ")", ";", "// Checks if the data is corrupted", "DataValidator", ".", "validate", "(", "organization", ")", ";", "final", "DbOrganization", "dbOrganization", "=", "getModelMapper", "(", ")", ".", "getDbOrganization", "(", "organization", ")", ";", "getOrganizationHandler", "(", ")", ".", "store", "(", "dbOrganization", ")", ";", "return", "Response", ".", "ok", "(", ")", ".", "status", "(", "HttpStatus", ".", "CREATED_201", ")", ".", "build", "(", ")", ";", "}" ]
Handle organization posts when the server got a request POST <dm_url>/organization & MIME that contains an organization. @param organization The organization to add to Grapes database @return Response An acknowledgment:<br/>- 400 if the artifact is MIME is malformed<br/>- 500 if internal error<br/>- 201 if ok
[ "Handle", "organization", "posts", "when", "the", "server", "got", "a", "request", "POST", "<dm_url", ">", "/", "organization", "&", "MIME", "that", "contains", "an", "organization", "." ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java#L46-L61
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/PortletExecutionStatisticsController.java
PortletExecutionStatisticsController.getColumnDescriptions
@Override protected List<ColumnDescription> getColumnDescriptions( PortletExecutionAggregationDiscriminator reportColumnDiscriminator, PortletExecutionReportForm form) { int groupSize = form.getGroups().size(); int portletSize = form.getPortlets().size(); int executionTypeSize = form.getExecutionTypeNames().size(); String portletName = reportColumnDiscriminator.getPortletMapping().getFname(); String groupName = reportColumnDiscriminator.getAggregatedGroup().getGroupName(); String executionTypeName = reportColumnDiscriminator.getExecutionType().getName(); TitleAndCount[] items = new TitleAndCount[] { new TitleAndCount(portletName, portletSize), new TitleAndCount(executionTypeName, executionTypeSize), new TitleAndCount(groupName, groupSize) }; return titleAndColumnDescriptionStrategy.getColumnDescriptions( items, showFullColumnHeaderDescriptions(form), form); }
java
@Override protected List<ColumnDescription> getColumnDescriptions( PortletExecutionAggregationDiscriminator reportColumnDiscriminator, PortletExecutionReportForm form) { int groupSize = form.getGroups().size(); int portletSize = form.getPortlets().size(); int executionTypeSize = form.getExecutionTypeNames().size(); String portletName = reportColumnDiscriminator.getPortletMapping().getFname(); String groupName = reportColumnDiscriminator.getAggregatedGroup().getGroupName(); String executionTypeName = reportColumnDiscriminator.getExecutionType().getName(); TitleAndCount[] items = new TitleAndCount[] { new TitleAndCount(portletName, portletSize), new TitleAndCount(executionTypeName, executionTypeSize), new TitleAndCount(groupName, groupSize) }; return titleAndColumnDescriptionStrategy.getColumnDescriptions( items, showFullColumnHeaderDescriptions(form), form); }
[ "@", "Override", "protected", "List", "<", "ColumnDescription", ">", "getColumnDescriptions", "(", "PortletExecutionAggregationDiscriminator", "reportColumnDiscriminator", ",", "PortletExecutionReportForm", "form", ")", "{", "int", "groupSize", "=", "form", ".", "getGroups", "(", ")", ".", "size", "(", ")", ";", "int", "portletSize", "=", "form", ".", "getPortlets", "(", ")", ".", "size", "(", ")", ";", "int", "executionTypeSize", "=", "form", ".", "getExecutionTypeNames", "(", ")", ".", "size", "(", ")", ";", "String", "portletName", "=", "reportColumnDiscriminator", ".", "getPortletMapping", "(", ")", ".", "getFname", "(", ")", ";", "String", "groupName", "=", "reportColumnDiscriminator", ".", "getAggregatedGroup", "(", ")", ".", "getGroupName", "(", ")", ";", "String", "executionTypeName", "=", "reportColumnDiscriminator", ".", "getExecutionType", "(", ")", ".", "getName", "(", ")", ";", "TitleAndCount", "[", "]", "items", "=", "new", "TitleAndCount", "[", "]", "{", "new", "TitleAndCount", "(", "portletName", ",", "portletSize", ")", ",", "new", "TitleAndCount", "(", "executionTypeName", ",", "executionTypeSize", ")", ",", "new", "TitleAndCount", "(", "groupName", ",", "groupSize", ")", "}", ";", "return", "titleAndColumnDescriptionStrategy", ".", "getColumnDescriptions", "(", "items", ",", "showFullColumnHeaderDescriptions", "(", "form", ")", ",", "form", ")", ";", "}" ]
Create column descriptions for the portlet report using the configured report labelling strategy. @param reportColumnDiscriminator @param form The original query form @return
[ "Create", "column", "descriptions", "for", "the", "portlet", "report", "using", "the", "configured", "report", "labelling", "strategy", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/PortletExecutionStatisticsController.java#L274-L295
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java
BaseConvertToMessage.addPayloadProperties
public void addPayloadProperties(Object msg, BaseMessage message) { MessageDataDesc messageDataDesc = message.getMessageDataDesc(null); // Top level only if (messageDataDesc != null) { Map<String,Class<?>> mapPropertyNames = messageDataDesc.getPayloadPropertyNames(null); if (mapPropertyNames != null) { Map<String,Object> properties = this.getPayloadProperties(msg, mapPropertyNames); for (String key : properties.keySet()) { message.put(key, properties.get(key)); } } } }
java
public void addPayloadProperties(Object msg, BaseMessage message) { MessageDataDesc messageDataDesc = message.getMessageDataDesc(null); // Top level only if (messageDataDesc != null) { Map<String,Class<?>> mapPropertyNames = messageDataDesc.getPayloadPropertyNames(null); if (mapPropertyNames != null) { Map<String,Object> properties = this.getPayloadProperties(msg, mapPropertyNames); for (String key : properties.keySet()) { message.put(key, properties.get(key)); } } } }
[ "public", "void", "addPayloadProperties", "(", "Object", "msg", ",", "BaseMessage", "message", ")", "{", "MessageDataDesc", "messageDataDesc", "=", "message", ".", "getMessageDataDesc", "(", "null", ")", ";", "// Top level only", "if", "(", "messageDataDesc", "!=", "null", ")", "{", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "mapPropertyNames", "=", "messageDataDesc", ".", "getPayloadPropertyNames", "(", "null", ")", ";", "if", "(", "mapPropertyNames", "!=", "null", ")", "{", "Map", "<", "String", ",", "Object", ">", "properties", "=", "this", ".", "getPayloadProperties", "(", "msg", ",", "mapPropertyNames", ")", ";", "for", "(", "String", "key", ":", "properties", ".", "keySet", "(", ")", ")", "{", "message", ".", "put", "(", "key", ",", "properties", ".", "get", "(", "key", ")", ")", ";", "}", "}", "}", "}" ]
Utility to add the standard payload properties to the message @param msg @param message
[ "Utility", "to", "add", "the", "standard", "payload", "properties", "to", "the", "message" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java#L161-L177
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/datasource/AppSummaryService.java
AppSummaryService.createQueueListValue
String createQueueListValue(JobDetails jobDetails, String existingQueues) { /* * check if queue already exists append separator at the end to avoid * "false" queue match via substring match */ String queue = jobDetails.getQueue(); queue = queue.concat(Constants.SEP); if (existingQueues == null) { return queue; } if (!existingQueues.contains(queue)) { existingQueues = existingQueues.concat(queue); } return existingQueues; }
java
String createQueueListValue(JobDetails jobDetails, String existingQueues) { /* * check if queue already exists append separator at the end to avoid * "false" queue match via substring match */ String queue = jobDetails.getQueue(); queue = queue.concat(Constants.SEP); if (existingQueues == null) { return queue; } if (!existingQueues.contains(queue)) { existingQueues = existingQueues.concat(queue); } return existingQueues; }
[ "String", "createQueueListValue", "(", "JobDetails", "jobDetails", ",", "String", "existingQueues", ")", "{", "/*\n * check if queue already exists append separator at the end to avoid\n * \"false\" queue match via substring match\n */", "String", "queue", "=", "jobDetails", ".", "getQueue", "(", ")", ";", "queue", "=", "queue", ".", "concat", "(", "Constants", ".", "SEP", ")", ";", "if", "(", "existingQueues", "==", "null", ")", "{", "return", "queue", ";", "}", "if", "(", "!", "existingQueues", ".", "contains", "(", "queue", ")", ")", "{", "existingQueues", "=", "existingQueues", ".", "concat", "(", "queue", ")", ";", "}", "return", "existingQueues", ";", "}" ]
looks at {@Link String} to see if queue name already is stored, if not, adds it @param {@link JobDetails} @param {@link Result} @return queue list
[ "looks", "at", "{" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/AppSummaryService.java#L308-L324
openengsb/openengsb
components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/IndexRecord.java
IndexRecord.extractValue
protected Object extractValue(IndexField<?> field, OpenEngSBModelEntry entry) { Object value = entry.getValue(); if (value == null) { return null; } if (Introspector.isModel(value)) { return ((OpenEngSBModel) value).retrieveInternalModelId(); } // TODO: value mapping return value; }
java
protected Object extractValue(IndexField<?> field, OpenEngSBModelEntry entry) { Object value = entry.getValue(); if (value == null) { return null; } if (Introspector.isModel(value)) { return ((OpenEngSBModel) value).retrieveInternalModelId(); } // TODO: value mapping return value; }
[ "protected", "Object", "extractValue", "(", "IndexField", "<", "?", ">", "field", ",", "OpenEngSBModelEntry", "entry", ")", "{", "Object", "value", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "Introspector", ".", "isModel", "(", "value", ")", ")", "{", "return", "(", "(", "OpenEngSBModel", ")", "value", ")", ".", "retrieveInternalModelId", "(", ")", ";", "}", "// TODO: value mapping", "return", "value", ";", "}" ]
Extracts the value from the given {@code OpenEngSBModelEntry} and maps that value to the given field type. @param field the field to map to @param entry the entry containing the value @return the transformed (possibly) value
[ "Extracts", "the", "value", "from", "the", "given", "{", "@code", "OpenEngSBModelEntry", "}", "and", "maps", "that", "value", "to", "the", "given", "field", "type", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/IndexRecord.java#L69-L83
jbundle/jbundle
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java
HBasePanel.printDataStartField
public void printDataStartField(PrintWriter out, int iPrintOptions) { if ((iPrintOptions & HtmlConstants.MAIN_SCREEN) == HtmlConstants.MAIN_SCREEN) { } else out.println("<tr>"); }
java
public void printDataStartField(PrintWriter out, int iPrintOptions) { if ((iPrintOptions & HtmlConstants.MAIN_SCREEN) == HtmlConstants.MAIN_SCREEN) { } else out.println("<tr>"); }
[ "public", "void", "printDataStartField", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "if", "(", "(", "iPrintOptions", "&", "HtmlConstants", ".", "MAIN_SCREEN", ")", "==", "HtmlConstants", ".", "MAIN_SCREEN", ")", "{", "}", "else", "out", ".", "println", "(", "\"<tr>\"", ")", ";", "}" ]
Display the start form in input format. @param out The out stream. @param iPrintOptions The view specific attributes.
[ "Display", "the", "start", "form", "in", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L574-L581
interedition/collatex
collatex-core/src/main/java/eu/interedition/collatex/suffixarray/BPR.java
BPR.buildSuffixArray
@Override public int[] buildSuffixArray(int[] input, int start, int length) { Tools.assertAlways(input != null, "input must not be null"); Tools.assertAlways(input.length >= start + length + KBS_STRING_EXTENSION_SIZE, "input is too short"); Tools.assertAlways(length >= 2, "input length must be >= 2"); this.start = start; if (preserveInput) { seq = new int[length + KBS_STRING_EXTENSION_SIZE]; this.start = 0; System.arraycopy(input, start, seq, 0, length); } else { seq = input; } this.alphabet = new Alphabet(seq, length); this.length = length; int alphaSize = alphabet.size; int q; if (alphaSize <= 9) { q = 7; } else if (9 < alphaSize && alphaSize <= 13) { q = 6; } else if (13 < alphaSize && alphaSize <= 21) { q = 5; } else if (21 < alphaSize && alphaSize <= 46) { q = 4; } else { q = 3; } kbs_buildDstepUsePrePlusCopyFreqOrder_SuffixArray(q); return suffixArray; }
java
@Override public int[] buildSuffixArray(int[] input, int start, int length) { Tools.assertAlways(input != null, "input must not be null"); Tools.assertAlways(input.length >= start + length + KBS_STRING_EXTENSION_SIZE, "input is too short"); Tools.assertAlways(length >= 2, "input length must be >= 2"); this.start = start; if (preserveInput) { seq = new int[length + KBS_STRING_EXTENSION_SIZE]; this.start = 0; System.arraycopy(input, start, seq, 0, length); } else { seq = input; } this.alphabet = new Alphabet(seq, length); this.length = length; int alphaSize = alphabet.size; int q; if (alphaSize <= 9) { q = 7; } else if (9 < alphaSize && alphaSize <= 13) { q = 6; } else if (13 < alphaSize && alphaSize <= 21) { q = 5; } else if (21 < alphaSize && alphaSize <= 46) { q = 4; } else { q = 3; } kbs_buildDstepUsePrePlusCopyFreqOrder_SuffixArray(q); return suffixArray; }
[ "@", "Override", "public", "int", "[", "]", "buildSuffixArray", "(", "int", "[", "]", "input", ",", "int", "start", ",", "int", "length", ")", "{", "Tools", ".", "assertAlways", "(", "input", "!=", "null", ",", "\"input must not be null\"", ")", ";", "Tools", ".", "assertAlways", "(", "input", ".", "length", ">=", "start", "+", "length", "+", "KBS_STRING_EXTENSION_SIZE", ",", "\"input is too short\"", ")", ";", "Tools", ".", "assertAlways", "(", "length", ">=", "2", ",", "\"input length must be >= 2\"", ")", ";", "this", ".", "start", "=", "start", ";", "if", "(", "preserveInput", ")", "{", "seq", "=", "new", "int", "[", "length", "+", "KBS_STRING_EXTENSION_SIZE", "]", ";", "this", ".", "start", "=", "0", ";", "System", ".", "arraycopy", "(", "input", ",", "start", ",", "seq", ",", "0", ",", "length", ")", ";", "}", "else", "{", "seq", "=", "input", ";", "}", "this", ".", "alphabet", "=", "new", "Alphabet", "(", "seq", ",", "length", ")", ";", "this", ".", "length", "=", "length", ";", "int", "alphaSize", "=", "alphabet", ".", "size", ";", "int", "q", ";", "if", "(", "alphaSize", "<=", "9", ")", "{", "q", "=", "7", ";", "}", "else", "if", "(", "9", "<", "alphaSize", "&&", "alphaSize", "<=", "13", ")", "{", "q", "=", "6", ";", "}", "else", "if", "(", "13", "<", "alphaSize", "&&", "alphaSize", "<=", "21", ")", "{", "q", "=", "5", ";", "}", "else", "if", "(", "21", "<", "alphaSize", "&&", "alphaSize", "<=", "46", ")", "{", "q", "=", "4", ";", "}", "else", "{", "q", "=", "3", ";", "}", "kbs_buildDstepUsePrePlusCopyFreqOrder_SuffixArray", "(", "q", ")", ";", "return", "suffixArray", ";", "}" ]
{@inheritDoc} <p> Additional constraints enforced by BPR algorithm: <ul> <li>input array must contain at least {@link #KBS_STRING_EXTENSION_SIZE} extra cells</li> <li>non-negative (&ge;0) symbols in the input</li> <li>symbols limited by {@link #KBS_MAX_ALPHABET_SIZE} (&lt; <code>KBS_MAX_ALPHABET_SIZE</code>)</li> <li>length &ge; 2</li> </ul> <p>
[ "{" ]
train
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/BPR.java#L99-L135
looly/hutool
hutool-db/src/main/java/cn/hutool/db/Entity.java
Entity.parse
public static <T> Entity parse(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) { return create(null).parseBean(bean, isToUnderlineCase, ignoreNullValue); }
java
public static <T> Entity parse(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) { return create(null).parseBean(bean, isToUnderlineCase, ignoreNullValue); }
[ "public", "static", "<", "T", ">", "Entity", "parse", "(", "T", "bean", ",", "boolean", "isToUnderlineCase", ",", "boolean", "ignoreNullValue", ")", "{", "return", "create", "(", "null", ")", ".", "parseBean", "(", "bean", ",", "isToUnderlineCase", ",", "ignoreNullValue", ")", ";", "}" ]
将PO对象转为Entity @param <T> Bean对象类型 @param bean Bean对象 @param isToUnderlineCase 是否转换为下划线模式 @param ignoreNullValue 是否忽略值为空的字段 @return Entity
[ "将PO对象转为Entity" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Entity.java#L74-L76
h2oai/h2o-2
src/main/java/hex/deeplearning/DeepLearning.java
DeepLearning.computeRowUsageFraction
private static float computeRowUsageFraction(final long numRows, final long train_samples_per_iteration, final boolean replicate_training_data) { float rowUsageFraction = (float)train_samples_per_iteration / numRows; if (replicate_training_data) rowUsageFraction /= H2O.CLOUD.size(); assert(rowUsageFraction > 0); return rowUsageFraction; }
java
private static float computeRowUsageFraction(final long numRows, final long train_samples_per_iteration, final boolean replicate_training_data) { float rowUsageFraction = (float)train_samples_per_iteration / numRows; if (replicate_training_data) rowUsageFraction /= H2O.CLOUD.size(); assert(rowUsageFraction > 0); return rowUsageFraction; }
[ "private", "static", "float", "computeRowUsageFraction", "(", "final", "long", "numRows", ",", "final", "long", "train_samples_per_iteration", ",", "final", "boolean", "replicate_training_data", ")", "{", "float", "rowUsageFraction", "=", "(", "float", ")", "train_samples_per_iteration", "/", "numRows", ";", "if", "(", "replicate_training_data", ")", "rowUsageFraction", "/=", "H2O", ".", "CLOUD", ".", "size", "(", ")", ";", "assert", "(", "rowUsageFraction", ">", "0", ")", ";", "return", "rowUsageFraction", ";", "}" ]
Compute the fraction of rows that need to be used for training during one iteration @param numRows number of training rows @param train_samples_per_iteration number of training rows to be processed per iteration @param replicate_training_data whether of not the training data is replicated on each node @return fraction of rows to be used for training during one iteration
[ "Compute", "the", "fraction", "of", "rows", "that", "need", "to", "be", "used", "for", "training", "during", "one", "iteration" ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L1288-L1293
lmdbjava/lmdbjava
src/main/java/org/lmdbjava/KeyVal.java
KeyVal.valInMulti
Pointer valInMulti(final T val, final int elements) { final long ptrVal2SizeOff = MDB_VAL_STRUCT_SIZE + STRUCT_FIELD_OFFSET_SIZE; ptrArray.putLong(ptrVal2SizeOff, elements); // ptrVal2.size proxy.in(val, ptrVal, ptrValAddr); // ptrVal1.data final long totalBufferSize = ptrVal.getLong(STRUCT_FIELD_OFFSET_SIZE); final long elemSize = totalBufferSize / elements; ptrVal.putLong(STRUCT_FIELD_OFFSET_SIZE, elemSize); // ptrVal1.size return ptrArray; }
java
Pointer valInMulti(final T val, final int elements) { final long ptrVal2SizeOff = MDB_VAL_STRUCT_SIZE + STRUCT_FIELD_OFFSET_SIZE; ptrArray.putLong(ptrVal2SizeOff, elements); // ptrVal2.size proxy.in(val, ptrVal, ptrValAddr); // ptrVal1.data final long totalBufferSize = ptrVal.getLong(STRUCT_FIELD_OFFSET_SIZE); final long elemSize = totalBufferSize / elements; ptrVal.putLong(STRUCT_FIELD_OFFSET_SIZE, elemSize); // ptrVal1.size return ptrArray; }
[ "Pointer", "valInMulti", "(", "final", "T", "val", ",", "final", "int", "elements", ")", "{", "final", "long", "ptrVal2SizeOff", "=", "MDB_VAL_STRUCT_SIZE", "+", "STRUCT_FIELD_OFFSET_SIZE", ";", "ptrArray", ".", "putLong", "(", "ptrVal2SizeOff", ",", "elements", ")", ";", "// ptrVal2.size", "proxy", ".", "in", "(", "val", ",", "ptrVal", ",", "ptrValAddr", ")", ";", "// ptrVal1.data", "final", "long", "totalBufferSize", "=", "ptrVal", ".", "getLong", "(", "STRUCT_FIELD_OFFSET_SIZE", ")", ";", "final", "long", "elemSize", "=", "totalBufferSize", "/", "elements", ";", "ptrVal", ".", "putLong", "(", "STRUCT_FIELD_OFFSET_SIZE", ",", "elemSize", ")", ";", "// ptrVal1.size", "return", "ptrArray", ";", "}" ]
Prepares an array suitable for presentation as the data argument to a <code>MDB_MULTIPLE</code> put. <p> The returned array is equivalent of two <code>MDB_val</code>s as follows: <ul> <li>ptrVal1.data = pointer to the data address of passed buffer</li> <li>ptrVal1.size = size of each individual data element</li> <li>ptrVal2.data = unused</li> <li>ptrVal2.size = number of data elements (as passed to this method)</li> </ul> @param val a user-provided buffer with data elements (required) @param elements number of data elements the user has provided @return a properly-prepared pointer to an array for the operation
[ "Prepares", "an", "array", "suitable", "for", "presentation", "as", "the", "data", "argument", "to", "a", "<code", ">", "MDB_MULTIPLE<", "/", "code", ">", "put", "." ]
train
https://github.com/lmdbjava/lmdbjava/blob/5912beb1037722c71f3ddc05e70fcbe739dfa272/src/main/java/org/lmdbjava/KeyVal.java#L121-L130
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java
IntTrieBuilder.setValue
public boolean setValue(int ch, int value) { // valid, uncompacted trie and valid c? if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) { return false; } int block = getDataBlock(ch); if (block < 0) { return false; } m_data_[block + (ch & MASK_)] = value; return true; }
java
public boolean setValue(int ch, int value) { // valid, uncompacted trie and valid c? if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) { return false; } int block = getDataBlock(ch); if (block < 0) { return false; } m_data_[block + (ch & MASK_)] = value; return true; }
[ "public", "boolean", "setValue", "(", "int", "ch", ",", "int", "value", ")", "{", "// valid, uncompacted trie and valid c? ", "if", "(", "m_isCompacted_", "||", "ch", ">", "UCharacter", ".", "MAX_VALUE", "||", "ch", "<", "0", ")", "{", "return", "false", ";", "}", "int", "block", "=", "getDataBlock", "(", "ch", ")", ";", "if", "(", "block", "<", "0", ")", "{", "return", "false", ";", "}", "m_data_", "[", "block", "+", "(", "ch", "&", "MASK_", ")", "]", "=", "value", ";", "return", "true", ";", "}" ]
Sets a 32 bit data in the table data @param ch codepoint which data is to be set @param value to set @return true if the set is successful, otherwise if the table has been compacted return false
[ "Sets", "a", "32", "bit", "data", "in", "the", "table", "data" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L215-L229
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java
RaCodeGen.writeXAResource
private void writeXAResource(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This method is called by the application server during crash recovery.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param specs An array of ActivationSpec JavaBeans \n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " * @return An array of XAResource objects\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public XAResource[] getXAResources(ActivationSpec[] specs)\n"); writeWithIndent(out, indent + 1, "throws ResourceException"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getXAResources", "specs.toString()"); writeWithIndent(out, indent + 1, "return null;"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeXAResource(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This method is called by the application server during crash recovery.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param specs An array of ActivationSpec JavaBeans \n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " * @return An array of XAResource objects\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public XAResource[] getXAResources(ActivationSpec[] specs)\n"); writeWithIndent(out, indent + 1, "throws ResourceException"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getXAResources", "specs.toString()"); writeWithIndent(out, indent + 1, "return null;"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeXAResource", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * This method is called by the application server during crash recovery.\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" *\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @param specs An array of ActivationSpec JavaBeans \\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @throws ResourceException generic exception \\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @return An array of XAResource objects\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"public XAResource[] getXAResources(ActivationSpec[] specs)\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", "+", "1", ",", "\"throws ResourceException\"", ")", ";", "writeLeftCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeLogging", "(", "def", ",", "out", ",", "indent", "+", "1", ",", "\"trace\"", ",", "\"getXAResources\"", ",", "\"specs.toString()\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", "+", "1", ",", "\"return null;\"", ")", ";", "writeRightCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeEol", "(", "out", ")", ";", "}" ]
Output getXAResources method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "getXAResources", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java#L223-L240
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/io/FileUtils.java
FileUtils.getPropertyAsDouble
public double getPropertyAsDouble(final String bundleName, final String key) { LOG.info("Getting value for key: " + key + " from bundle: " + bundleName); ResourceBundle bundle = bundles.get(bundleName); try { return Double.parseDouble(bundle.getString(key)); } catch (MissingResourceException e) { LOG.info("Resource: " + key + " not found!"); } catch (NumberFormatException e) { return -1d; } return -1d; }
java
public double getPropertyAsDouble(final String bundleName, final String key) { LOG.info("Getting value for key: " + key + " from bundle: " + bundleName); ResourceBundle bundle = bundles.get(bundleName); try { return Double.parseDouble(bundle.getString(key)); } catch (MissingResourceException e) { LOG.info("Resource: " + key + " not found!"); } catch (NumberFormatException e) { return -1d; } return -1d; }
[ "public", "double", "getPropertyAsDouble", "(", "final", "String", "bundleName", ",", "final", "String", "key", ")", "{", "LOG", ".", "info", "(", "\"Getting value for key: \"", "+", "key", "+", "\" from bundle: \"", "+", "bundleName", ")", ";", "ResourceBundle", "bundle", "=", "bundles", ".", "get", "(", "bundleName", ")", ";", "try", "{", "return", "Double", ".", "parseDouble", "(", "bundle", ".", "getString", "(", "key", ")", ")", ";", "}", "catch", "(", "MissingResourceException", "e", ")", "{", "LOG", ".", "info", "(", "\"Resource: \"", "+", "key", "+", "\" not found!\"", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "-", "1d", ";", "}", "return", "-", "1d", ";", "}" ]
Gets the value as double from the resource bundles corresponding to the supplied key. <br/> @param bundleName the name of the bundle to search in @param key the key to search for @return {@code -1} if the property is not found or the value is not a number; the corresponding value otherwise
[ "Gets", "the", "value", "as", "double", "from", "the", "resource", "bundles", "corresponding", "to", "the", "supplied", "key", ".", "<br", "/", ">" ]
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/io/FileUtils.java#L386-L398
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
Enter.topLevelEnv
Env<AttrContext> topLevelEnv(JCCompilationUnit tree) { Env<AttrContext> localEnv = new Env<>(tree, new AttrContext()); localEnv.toplevel = tree; localEnv.enclClass = predefClassDef; tree.toplevelScope = WriteableScope.create(tree.packge); tree.namedImportScope = new NamedImportScope(tree.packge, tree.toplevelScope); tree.starImportScope = new StarImportScope(tree.packge); localEnv.info.scope = tree.toplevelScope; localEnv.info.lint = lint; return localEnv; }
java
Env<AttrContext> topLevelEnv(JCCompilationUnit tree) { Env<AttrContext> localEnv = new Env<>(tree, new AttrContext()); localEnv.toplevel = tree; localEnv.enclClass = predefClassDef; tree.toplevelScope = WriteableScope.create(tree.packge); tree.namedImportScope = new NamedImportScope(tree.packge, tree.toplevelScope); tree.starImportScope = new StarImportScope(tree.packge); localEnv.info.scope = tree.toplevelScope; localEnv.info.lint = lint; return localEnv; }
[ "Env", "<", "AttrContext", ">", "topLevelEnv", "(", "JCCompilationUnit", "tree", ")", "{", "Env", "<", "AttrContext", ">", "localEnv", "=", "new", "Env", "<>", "(", "tree", ",", "new", "AttrContext", "(", ")", ")", ";", "localEnv", ".", "toplevel", "=", "tree", ";", "localEnv", ".", "enclClass", "=", "predefClassDef", ";", "tree", ".", "toplevelScope", "=", "WriteableScope", ".", "create", "(", "tree", ".", "packge", ")", ";", "tree", ".", "namedImportScope", "=", "new", "NamedImportScope", "(", "tree", ".", "packge", ",", "tree", ".", "toplevelScope", ")", ";", "tree", ".", "starImportScope", "=", "new", "StarImportScope", "(", "tree", ".", "packge", ")", ";", "localEnv", ".", "info", ".", "scope", "=", "tree", ".", "toplevelScope", ";", "localEnv", ".", "info", ".", "lint", "=", "lint", ";", "return", "localEnv", ";", "}" ]
Create a fresh environment for toplevels. @param tree The toplevel tree.
[ "Create", "a", "fresh", "environment", "for", "toplevels", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java#L212-L222
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.credit_code_POST
public OvhMovement credit_code_POST(String inputCode) throws IOException { String qPath = "/me/credit/code"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "inputCode", inputCode); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhMovement.class); }
java
public OvhMovement credit_code_POST(String inputCode) throws IOException { String qPath = "/me/credit/code"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "inputCode", inputCode); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhMovement.class); }
[ "public", "OvhMovement", "credit_code_POST", "(", "String", "inputCode", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/credit/code\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"inputCode\"", ",", "inputCode", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhMovement", ".", "class", ")", ";", "}" ]
Validate a code to generate associated credit movement REST: POST /me/credit/code @param inputCode [required] Code to validate
[ "Validate", "a", "code", "to", "generate", "associated", "credit", "movement" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L868-L875
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/ServiceManagementRecord.java
ServiceManagementRecord.isServiceEnabled
public static boolean isServiceEnabled(EntityManager em, Service service) { ServiceManagementRecord record = findServiceManagementRecord(em, service); return record == null ? true : record.isEnabled(); }
java
public static boolean isServiceEnabled(EntityManager em, Service service) { ServiceManagementRecord record = findServiceManagementRecord(em, service); return record == null ? true : record.isEnabled(); }
[ "public", "static", "boolean", "isServiceEnabled", "(", "EntityManager", "em", ",", "Service", "service", ")", "{", "ServiceManagementRecord", "record", "=", "findServiceManagementRecord", "(", "em", ",", "service", ")", ";", "return", "record", "==", "null", "?", "true", ":", "record", ".", "isEnabled", "(", ")", ";", "}" ]
Determine a given service's enability. @param em The EntityManager to use. @param service The service for which to determine enability. @return True or false depending on whether the service is enabled or disabled.
[ "Determine", "a", "given", "service", "s", "enability", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/ServiceManagementRecord.java#L139-L143
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java
RouteDispatcher.onPreDispatch
protected void onPreDispatch(Request request, Response response) { application.getRoutePreDispatchListeners().onPreDispatch(request, response); }
java
protected void onPreDispatch(Request request, Response response) { application.getRoutePreDispatchListeners().onPreDispatch(request, response); }
[ "protected", "void", "onPreDispatch", "(", "Request", "request", ",", "Response", "response", ")", "{", "application", ".", "getRoutePreDispatchListeners", "(", ")", ".", "onPreDispatch", "(", "request", ",", "response", ")", ";", "}" ]
Executes onPreDispatch of registered route pre-dispatch listeners. @param request @param response
[ "Executes", "onPreDispatch", "of", "registered", "route", "pre", "-", "dispatch", "listeners", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java#L111-L113
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/services/task/factory/TaskInstanceStrategyFactory.java
TaskInstanceStrategyFactory.getRoutingStrategy
public static RoutingStrategy getRoutingStrategy(String attributeValue, Long processInstanceId) throws StrategyException { Package packageVO = processInstanceId == null ? null : getPackage(processInstanceId); TaskInstanceStrategyFactory factory = getInstance(); String className = factory.getStrategyClassName(attributeValue, StrategyType.RoutingStrategy); RoutingStrategy strategy = (RoutingStrategy) factory.getStrategyInstance(RoutingStrategy.class, className, packageVO); return strategy; }
java
public static RoutingStrategy getRoutingStrategy(String attributeValue, Long processInstanceId) throws StrategyException { Package packageVO = processInstanceId == null ? null : getPackage(processInstanceId); TaskInstanceStrategyFactory factory = getInstance(); String className = factory.getStrategyClassName(attributeValue, StrategyType.RoutingStrategy); RoutingStrategy strategy = (RoutingStrategy) factory.getStrategyInstance(RoutingStrategy.class, className, packageVO); return strategy; }
[ "public", "static", "RoutingStrategy", "getRoutingStrategy", "(", "String", "attributeValue", ",", "Long", "processInstanceId", ")", "throws", "StrategyException", "{", "Package", "packageVO", "=", "processInstanceId", "==", "null", "?", "null", ":", "getPackage", "(", "processInstanceId", ")", ";", "TaskInstanceStrategyFactory", "factory", "=", "getInstance", "(", ")", ";", "String", "className", "=", "factory", ".", "getStrategyClassName", "(", "attributeValue", ",", "StrategyType", ".", "RoutingStrategy", ")", ";", "RoutingStrategy", "strategy", "=", "(", "RoutingStrategy", ")", "factory", ".", "getStrategyInstance", "(", "RoutingStrategy", ".", "class", ",", "className", ",", "packageVO", ")", ";", "return", "strategy", ";", "}" ]
Returns a workgroup routing strategy instance based on an attribute value and bundle spec which can consist of either the routing strategy logical name, or an xml document. @param attributeValue @param processInstanceId @return @throws StrategyException
[ "Returns", "a", "workgroup", "routing", "strategy", "instance", "based", "on", "an", "attribute", "value", "and", "bundle", "spec", "which", "can", "consist", "of", "either", "the", "routing", "strategy", "logical", "name", "or", "an", "xml", "document", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/task/factory/TaskInstanceStrategyFactory.java#L71-L77
mgm-tp/jfunk
jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java
WebDriverTool.openNewWindow
public String openNewWindow(final By openClickBy, final long timeoutSeconds) { checkTopmostElement(openClickBy); return openNewWindow(() -> sendKeys(openClickBy, Keys.chord(Keys.CONTROL, Keys.RETURN)), timeoutSeconds); }
java
public String openNewWindow(final By openClickBy, final long timeoutSeconds) { checkTopmostElement(openClickBy); return openNewWindow(() -> sendKeys(openClickBy, Keys.chord(Keys.CONTROL, Keys.RETURN)), timeoutSeconds); }
[ "public", "String", "openNewWindow", "(", "final", "By", "openClickBy", ",", "final", "long", "timeoutSeconds", ")", "{", "checkTopmostElement", "(", "openClickBy", ")", ";", "return", "openNewWindow", "(", "(", ")", "->", "sendKeys", "(", "openClickBy", ",", "Keys", ".", "chord", "(", "Keys", ".", "CONTROL", ",", "Keys", ".", "RETURN", ")", ")", ",", "timeoutSeconds", ")", ";", "}" ]
Opens a new window and switches to it. The window to switch to is determined by diffing the given {@code existingWindowHandles} with the current ones. The difference must be exactly one window handle which is then used to switch to. @param openClickBy identifies the element to click on in order to open the new window @param timeoutSeconds the timeout in seconds to wait for the new window to open @return the handle of the window that opened the new window
[ "Opens", "a", "new", "window", "and", "switches", "to", "it", ".", "The", "window", "to", "switch", "to", "is", "determined", "by", "diffing", "the", "given", "{", "@code", "existingWindowHandles", "}", "with", "the", "current", "ones", ".", "The", "difference", "must", "be", "exactly", "one", "window", "handle", "which", "is", "then", "used", "to", "switch", "to", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L765-L768
feedzai/pdb
src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java
AbstractDatabaseEngine.executePSUpdate
@Override public synchronized Integer executePSUpdate(final String name) throws DatabaseEngineException, ConnectionResetException { final PreparedStatementCapsule ps = stmts.get(name); if (ps == null) { throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' does not exist", name)); } try { return ps.ps.executeUpdate(); } catch (final SQLException e) { if (checkConnection(conn) || !properties.isReconnectOnLost()) { throw new DatabaseEngineException(String.format("Something went wrong executing the prepared statement '%s'", name), e); } // At this point maybe it is an error with the connection, so we try to re-establish it. try { getConnection(); } catch (final Exception e2) { throw new DatabaseEngineException("Connection is down", e2); } throw new ConnectionResetException("Connection was lost, you must reset the prepared statement parameters and re-execute the statement"); } }
java
@Override public synchronized Integer executePSUpdate(final String name) throws DatabaseEngineException, ConnectionResetException { final PreparedStatementCapsule ps = stmts.get(name); if (ps == null) { throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' does not exist", name)); } try { return ps.ps.executeUpdate(); } catch (final SQLException e) { if (checkConnection(conn) || !properties.isReconnectOnLost()) { throw new DatabaseEngineException(String.format("Something went wrong executing the prepared statement '%s'", name), e); } // At this point maybe it is an error with the connection, so we try to re-establish it. try { getConnection(); } catch (final Exception e2) { throw new DatabaseEngineException("Connection is down", e2); } throw new ConnectionResetException("Connection was lost, you must reset the prepared statement parameters and re-execute the statement"); } }
[ "@", "Override", "public", "synchronized", "Integer", "executePSUpdate", "(", "final", "String", "name", ")", "throws", "DatabaseEngineException", ",", "ConnectionResetException", "{", "final", "PreparedStatementCapsule", "ps", "=", "stmts", ".", "get", "(", "name", ")", ";", "if", "(", "ps", "==", "null", ")", "{", "throw", "new", "DatabaseEngineRuntimeException", "(", "String", ".", "format", "(", "\"PreparedStatement named '%s' does not exist\"", ",", "name", ")", ")", ";", "}", "try", "{", "return", "ps", ".", "ps", ".", "executeUpdate", "(", ")", ";", "}", "catch", "(", "final", "SQLException", "e", ")", "{", "if", "(", "checkConnection", "(", "conn", ")", "||", "!", "properties", ".", "isReconnectOnLost", "(", ")", ")", "{", "throw", "new", "DatabaseEngineException", "(", "String", ".", "format", "(", "\"Something went wrong executing the prepared statement '%s'\"", ",", "name", ")", ",", "e", ")", ";", "}", "// At this point maybe it is an error with the connection, so we try to re-establish it.", "try", "{", "getConnection", "(", ")", ";", "}", "catch", "(", "final", "Exception", "e2", ")", "{", "throw", "new", "DatabaseEngineException", "(", "\"Connection is down\"", ",", "e2", ")", ";", "}", "throw", "new", "ConnectionResetException", "(", "\"Connection was lost, you must reset the prepared statement parameters and re-execute the statement\"", ")", ";", "}", "}" ]
Executes update on the specified prepared statement. @param name The prepared statement name. @throws DatabaseEngineException If the prepared statement does not exist or something goes wrong while executing. @throws ConnectionResetException If the connection is down and reestablishment occurs. If this happens, the user must reset the parameters and re-execute the query.
[ "Executes", "update", "on", "the", "specified", "prepared", "statement", "." ]
train
https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1801-L1825
apache/groovy
src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java
SortableASTTransformation.compareExpr
private static BinaryExpression compareExpr(Expression lhv, Expression rhv, boolean reversed) { return (reversed) ? cmpX(rhv, lhv) : cmpX(lhv, rhv); }
java
private static BinaryExpression compareExpr(Expression lhv, Expression rhv, boolean reversed) { return (reversed) ? cmpX(rhv, lhv) : cmpX(lhv, rhv); }
[ "private", "static", "BinaryExpression", "compareExpr", "(", "Expression", "lhv", ",", "Expression", "rhv", ",", "boolean", "reversed", ")", "{", "return", "(", "reversed", ")", "?", "cmpX", "(", "rhv", ",", "lhv", ")", ":", "cmpX", "(", "lhv", ",", "rhv", ")", ";", "}" ]
Helper method used to build a binary expression that compares two values with the option to handle reverse order.
[ "Helper", "method", "used", "to", "build", "a", "binary", "expression", "that", "compares", "two", "values", "with", "the", "option", "to", "handle", "reverse", "order", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java#L261-L263
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java
DisksInner.beginUpdate
public DiskInner beginUpdate(String resourceGroupName, String diskName, DiskUpdate disk) { return beginUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).toBlocking().single().body(); }
java
public DiskInner beginUpdate(String resourceGroupName, String diskName, DiskUpdate disk) { return beginUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).toBlocking().single().body(); }
[ "public", "DiskInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "diskName", ",", "DiskUpdate", "disk", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "diskName", ",", "disk", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates (patches) a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @param disk Disk object supplied in the body of the Patch disk operation. @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 DiskInner object if successful.
[ "Updates", "(", "patches", ")", "a", "disk", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L393-L395
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.setWeight
public void setWeight(int i, double w) { if(i >= size() || i < 0) throw new IndexOutOfBoundsException("Dataset has only " + size() + " members, can't access index " + i ); else if(Double.isNaN(w) || Double.isInfinite(w) || w < 0) throw new ArithmeticException("Invalid weight assignment of " + w); if(w == 1 && weights == null) return;//nothing to do, already handled implicitly if(weights == null)//need to init? { weights = new double[size()]; Arrays.fill(weights, 1.0); } //make sure we have enouh space if (weights.length <= i) weights = Arrays.copyOfRange(weights, 0, Math.max(weights.length*2, i+1)); weights[i] = w; }
java
public void setWeight(int i, double w) { if(i >= size() || i < 0) throw new IndexOutOfBoundsException("Dataset has only " + size() + " members, can't access index " + i ); else if(Double.isNaN(w) || Double.isInfinite(w) || w < 0) throw new ArithmeticException("Invalid weight assignment of " + w); if(w == 1 && weights == null) return;//nothing to do, already handled implicitly if(weights == null)//need to init? { weights = new double[size()]; Arrays.fill(weights, 1.0); } //make sure we have enouh space if (weights.length <= i) weights = Arrays.copyOfRange(weights, 0, Math.max(weights.length*2, i+1)); weights[i] = w; }
[ "public", "void", "setWeight", "(", "int", "i", ",", "double", "w", ")", "{", "if", "(", "i", ">=", "size", "(", ")", "||", "i", "<", "0", ")", "throw", "new", "IndexOutOfBoundsException", "(", "\"Dataset has only \"", "+", "size", "(", ")", "+", "\" members, can't access index \"", "+", "i", ")", ";", "else", "if", "(", "Double", ".", "isNaN", "(", "w", ")", "||", "Double", ".", "isInfinite", "(", "w", ")", "||", "w", "<", "0", ")", "throw", "new", "ArithmeticException", "(", "\"Invalid weight assignment of \"", "+", "w", ")", ";", "if", "(", "w", "==", "1", "&&", "weights", "==", "null", ")", "return", ";", "//nothing to do, already handled implicitly\r", "if", "(", "weights", "==", "null", ")", "//need to init?\r", "{", "weights", "=", "new", "double", "[", "size", "(", ")", "]", ";", "Arrays", ".", "fill", "(", "weights", ",", "1.0", ")", ";", "}", "//make sure we have enouh space\r", "if", "(", "weights", ".", "length", "<=", "i", ")", "weights", "=", "Arrays", ".", "copyOfRange", "(", "weights", ",", "0", ",", "Math", ".", "max", "(", "weights", ".", "length", "*", "2", ",", "i", "+", "1", ")", ")", ";", "weights", "[", "i", "]", "=", "w", ";", "}" ]
Sets the weight of a given datapoint within this data set. @param i the index to change the weight of @param w the new weight value.
[ "Sets", "the", "weight", "of", "a", "given", "datapoint", "within", "this", "data", "set", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L832-L853
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java
AOStream.consumeAcceptedTick
public final void consumeAcceptedTick(TransactionCommon t, AOValue storedTick) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "consumeAcceptedTick", storedTick); try { SIMPMessage msg = consumerDispatcher.getMessageByValue(storedTick); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); // PK67067 We may not find a message in the store for this tick, because // it may have been removed using the SIBQueuePoint MBean if (msg != null) { msg.remove(msTran, storedTick.getPLockId()); } storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful storedTick.remove(msTran, controlItemLockID); } catch (Exception e) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "consumeAcceptedTick", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "consumeAcceptedTick"); }
java
public final void consumeAcceptedTick(TransactionCommon t, AOValue storedTick) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "consumeAcceptedTick", storedTick); try { SIMPMessage msg = consumerDispatcher.getMessageByValue(storedTick); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t); // PK67067 We may not find a message in the store for this tick, because // it may have been removed using the SIBQueuePoint MBean if (msg != null) { msg.remove(msTran, storedTick.getPLockId()); } storedTick.lockItemIfAvailable(controlItemLockID); // should always be successful storedTick.remove(msTran, controlItemLockID); } catch (Exception e) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "consumeAcceptedTick", e); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "consumeAcceptedTick"); }
[ "public", "final", "void", "consumeAcceptedTick", "(", "TransactionCommon", "t", ",", "AOValue", "storedTick", ")", "throws", "Exception", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"consumeAcceptedTick\"", ",", "storedTick", ")", ";", "try", "{", "SIMPMessage", "msg", "=", "consumerDispatcher", ".", "getMessageByValue", "(", "storedTick", ")", ";", "Transaction", "msTran", "=", "mp", ".", "resolveAndEnlistMsgStoreTransaction", "(", "t", ")", ";", "// PK67067 We may not find a message in the store for this tick, because", "// it may have been removed using the SIBQueuePoint MBean", "if", "(", "msg", "!=", "null", ")", "{", "msg", ".", "remove", "(", "msTran", ",", "storedTick", ".", "getPLockId", "(", ")", ")", ";", "}", "storedTick", ".", "lockItemIfAvailable", "(", "controlItemLockID", ")", ";", "// should always be successful", "storedTick", ".", "remove", "(", "msTran", ",", "controlItemLockID", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// No FFDC code needed", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"consumeAcceptedTick\"", ",", "e", ")", ";", "throw", "e", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"consumeAcceptedTick\"", ")", ";", "}" ]
Helper method called by the AOStream when a persistent tick representing a persistently locked message should be removed since the message has been accepted. This method will also consume the message @param t the transaction @param stream the stream making this call @param storedTick the persistent tick @throws Exception
[ "Helper", "method", "called", "by", "the", "AOStream", "when", "a", "persistent", "tick", "representing", "a", "persistently", "locked", "message", "should", "be", "removed", "since", "the", "message", "has", "been", "accepted", ".", "This", "method", "will", "also", "consume", "the", "message" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L3184-L3214
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java
Item.withDouble
public Item withDouble(String attrName, double val) { checkInvalidAttrName(attrName); return withNumber(attrName, Double.valueOf(val)); }
java
public Item withDouble(String attrName, double val) { checkInvalidAttrName(attrName); return withNumber(attrName, Double.valueOf(val)); }
[ "public", "Item", "withDouble", "(", "String", "attrName", ",", "double", "val", ")", "{", "checkInvalidAttrName", "(", "attrName", ")", ";", "return", "withNumber", "(", "attrName", ",", "Double", ".", "valueOf", "(", "val", ")", ")", ";", "}" ]
Sets the value of the specified attribute in the current item to the given value.
[ "Sets", "the", "value", "of", "the", "specified", "attribute", "in", "the", "current", "item", "to", "the", "given", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java#L323-L326
CenturyLinkCloud/clc-java-sdk
sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java
GroupService.modify
public OperationFuture<List<Group>> modify(GroupFilter groupFilter, GroupConfig groupConfig) { List<Group> groups = Arrays.asList(getRefsFromFilter(groupFilter)); return modify(groups, groupConfig); }
java
public OperationFuture<List<Group>> modify(GroupFilter groupFilter, GroupConfig groupConfig) { List<Group> groups = Arrays.asList(getRefsFromFilter(groupFilter)); return modify(groups, groupConfig); }
[ "public", "OperationFuture", "<", "List", "<", "Group", ">", ">", "modify", "(", "GroupFilter", "groupFilter", ",", "GroupConfig", "groupConfig", ")", "{", "List", "<", "Group", ">", "groups", "=", "Arrays", ".", "asList", "(", "getRefsFromFilter", "(", "groupFilter", ")", ")", ";", "return", "modify", "(", "groups", ",", "groupConfig", ")", ";", "}" ]
Update provided list of groups @param groupFilter search criteria @param groupConfig group config @return OperationFuture wrapper for list of Group
[ "Update", "provided", "list", "of", "groups" ]
train
https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java#L343-L347
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java
ZipChemCompProvider.finder
static private File[] finder( String dirName, final String suffix){ if (null == dirName || null == suffix) { return null; } final File dir = new File(dirName); return dir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String filename) { return filename.endsWith(suffix); } } ); }
java
static private File[] finder( String dirName, final String suffix){ if (null == dirName || null == suffix) { return null; } final File dir = new File(dirName); return dir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String filename) { return filename.endsWith(suffix); } } ); }
[ "static", "private", "File", "[", "]", "finder", "(", "String", "dirName", ",", "final", "String", "suffix", ")", "{", "if", "(", "null", "==", "dirName", "||", "null", "==", "suffix", ")", "{", "return", "null", ";", "}", "final", "File", "dir", "=", "new", "File", "(", "dirName", ")", ";", "return", "dir", ".", "listFiles", "(", "new", "FilenameFilter", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "File", "dir", ",", "String", "filename", ")", "{", "return", "filename", ".", "endsWith", "(", "suffix", ")", ";", "}", "}", ")", ";", "}" ]
Return File(s) in dirName that match suffix. @param dirName @param suffix @return
[ "Return", "File", "(", "s", ")", "in", "dirName", "that", "match", "suffix", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java#L215-L226
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.getProperty
public String getProperty(String name, String defaultValue) { String value = getProperty(name); return value != null ? value : defaultValue; }
java
public String getProperty(String name, String defaultValue) { String value = getProperty(name); return value != null ? value : defaultValue; }
[ "public", "String", "getProperty", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "String", "value", "=", "getProperty", "(", "name", ")", ";", "return", "value", "!=", "null", "?", "value", ":", "defaultValue", ";", "}" ]
Get value of given property, returning given default value if the property has not been set. @param name name of the property to get @param defaultValue default value to return if propery is not set @return the value of the named property, or the default value if the property has not been set
[ "Get", "value", "of", "given", "property", "returning", "given", "default", "value", "if", "the", "property", "has", "not", "been", "set", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L688-L691
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/platform/GingerbreadPurgeableDecoder.java
GingerbreadPurgeableDecoder.decodeJPEGByteArrayAsPurgeable
@Override protected Bitmap decodeJPEGByteArrayAsPurgeable( CloseableReference<PooledByteBuffer> bytesRef, int length, BitmapFactory.Options options) { byte[] suffix = endsWithEOI(bytesRef, length) ? null : EOI; return decodeFileDescriptorAsPurgeable(bytesRef, length, suffix, options); }
java
@Override protected Bitmap decodeJPEGByteArrayAsPurgeable( CloseableReference<PooledByteBuffer> bytesRef, int length, BitmapFactory.Options options) { byte[] suffix = endsWithEOI(bytesRef, length) ? null : EOI; return decodeFileDescriptorAsPurgeable(bytesRef, length, suffix, options); }
[ "@", "Override", "protected", "Bitmap", "decodeJPEGByteArrayAsPurgeable", "(", "CloseableReference", "<", "PooledByteBuffer", ">", "bytesRef", ",", "int", "length", ",", "BitmapFactory", ".", "Options", "options", ")", "{", "byte", "[", "]", "suffix", "=", "endsWithEOI", "(", "bytesRef", ",", "length", ")", "?", "null", ":", "EOI", ";", "return", "decodeFileDescriptorAsPurgeable", "(", "bytesRef", ",", "length", ",", "suffix", ",", "options", ")", ";", "}" ]
Decodes a byteArray containing jpeg encoded bytes into a purgeable bitmap <p>Adds a JFIF End-Of-Image marker if needed before decoding. @param bytesRef the byte buffer that contains the encoded bytes @param length the length of bytes for decox @param options the options passed to the BitmapFactory @return the decoded bitmap
[ "Decodes", "a", "byteArray", "containing", "jpeg", "encoded", "bytes", "into", "a", "purgeable", "bitmap" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/platform/GingerbreadPurgeableDecoder.java#L71-L76
thorntail/thorntail
plugins/gradle/gradle-plugin/src/main/java/org/wildfly/swarm/plugin/gradle/GradleDependencyResolutionHelper.java
GradleDependencyResolutionHelper.getAllProjects
private static Map<String, Project> getAllProjects(final Project project) { return getCachedReference(project, "thorntail_project_gav_collection", () -> { Map<String, Project> gavMap = new HashMap<>(); project.getRootProject().getAllprojects().forEach(p -> { gavMap.put(p.getGroup() + ":" + p.getName() + ":" + p.getVersion(), p); }); return gavMap; }); }
java
private static Map<String, Project> getAllProjects(final Project project) { return getCachedReference(project, "thorntail_project_gav_collection", () -> { Map<String, Project> gavMap = new HashMap<>(); project.getRootProject().getAllprojects().forEach(p -> { gavMap.put(p.getGroup() + ":" + p.getName() + ":" + p.getVersion(), p); }); return gavMap; }); }
[ "private", "static", "Map", "<", "String", ",", "Project", ">", "getAllProjects", "(", "final", "Project", "project", ")", "{", "return", "getCachedReference", "(", "project", ",", "\"thorntail_project_gav_collection\"", ",", "(", ")", "->", "{", "Map", "<", "String", ",", "Project", ">", "gavMap", "=", "new", "HashMap", "<>", "(", ")", ";", "project", ".", "getRootProject", "(", ")", ".", "getAllprojects", "(", ")", ".", "forEach", "(", "p", "->", "{", "gavMap", ".", "put", "(", "p", ".", "getGroup", "(", ")", "+", "\":\"", "+", "p", ".", "getName", "(", ")", "+", "\":\"", "+", "p", ".", "getVersion", "(", ")", ",", "p", ")", ";", "}", ")", ";", "return", "gavMap", ";", "}", ")", ";", "}" ]
Get the collection of Gradle projects along with their GAV definitions. This collection is used for determining if an artifact specification represents a Gradle project or not. @param project the Gradle project that is being analyzed. @return a map of GAV coordinates for each of the available projects (returned as keys).
[ "Get", "the", "collection", "of", "Gradle", "projects", "along", "with", "their", "GAV", "definitions", ".", "This", "collection", "is", "used", "for", "determining", "if", "an", "artifact", "specification", "represents", "a", "Gradle", "project", "or", "not", "." ]
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/plugins/gradle/gradle-plugin/src/main/java/org/wildfly/swarm/plugin/gradle/GradleDependencyResolutionHelper.java#L321-L329
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.readExcel2List
public List<List<String>> readExcel2List(InputStream is, int offsetLine, int limitLine, int sheetIndex) throws Excel4JException, IOException, InvalidFormatException { try (Workbook workbook = WorkbookFactory.create(is)) { return readExcel2ObjectsHandler(workbook, offsetLine, limitLine, sheetIndex); } }
java
public List<List<String>> readExcel2List(InputStream is, int offsetLine, int limitLine, int sheetIndex) throws Excel4JException, IOException, InvalidFormatException { try (Workbook workbook = WorkbookFactory.create(is)) { return readExcel2ObjectsHandler(workbook, offsetLine, limitLine, sheetIndex); } }
[ "public", "List", "<", "List", "<", "String", ">", ">", "readExcel2List", "(", "InputStream", "is", ",", "int", "offsetLine", ",", "int", "limitLine", ",", "int", "sheetIndex", ")", "throws", "Excel4JException", ",", "IOException", ",", "InvalidFormatException", "{", "try", "(", "Workbook", "workbook", "=", "WorkbookFactory", ".", "create", "(", "is", ")", ")", "{", "return", "readExcel2ObjectsHandler", "(", "workbook", ",", "offsetLine", ",", "limitLine", ",", "sheetIndex", ")", ";", "}", "}" ]
读取Excel表格数据,返回{@code List[List[String]]}类型的数据集合 @param is 待读取Excel的数据流 @param offsetLine Excel表头行(默认是0) @param limitLine 最大读取行数(默认表尾) @param sheetIndex Sheet索引(默认0) @return 返回{@code List<List<String>>}类型的数据集合 @throws Excel4JException 异常 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died
[ "读取Excel表格数据", "返回", "{", "@code", "List", "[", "List", "[", "String", "]]", "}", "类型的数据集合" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L339-L345
arquillian/arquillian-cube
kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/enricher/KuberntesServiceUrlResourceProvider.java
KuberntesServiceUrlResourceProvider.getPath
private static String getPath(Service service, Annotation... qualifiers) { for (Annotation q : qualifiers) { if (q instanceof Scheme) { return ((Scheme) q).value(); } } if (service.getMetadata() != null && service.getMetadata().getAnnotations() != null) { String s = service.getMetadata().getAnnotations().get(SERVICE_SCHEME); if (s != null && s.isEmpty()) { return s; } } return DEFAULT_PATH; }
java
private static String getPath(Service service, Annotation... qualifiers) { for (Annotation q : qualifiers) { if (q instanceof Scheme) { return ((Scheme) q).value(); } } if (service.getMetadata() != null && service.getMetadata().getAnnotations() != null) { String s = service.getMetadata().getAnnotations().get(SERVICE_SCHEME); if (s != null && s.isEmpty()) { return s; } } return DEFAULT_PATH; }
[ "private", "static", "String", "getPath", "(", "Service", "service", ",", "Annotation", "...", "qualifiers", ")", "{", "for", "(", "Annotation", "q", ":", "qualifiers", ")", "{", "if", "(", "q", "instanceof", "Scheme", ")", "{", "return", "(", "(", "Scheme", ")", "q", ")", ".", "value", "(", ")", ";", "}", "}", "if", "(", "service", ".", "getMetadata", "(", ")", "!=", "null", "&&", "service", ".", "getMetadata", "(", ")", ".", "getAnnotations", "(", ")", "!=", "null", ")", "{", "String", "s", "=", "service", ".", "getMetadata", "(", ")", ".", "getAnnotations", "(", ")", ".", "get", "(", "SERVICE_SCHEME", ")", ";", "if", "(", "s", "!=", "null", "&&", "s", ".", "isEmpty", "(", ")", ")", "{", "return", "s", ";", "}", "}", "return", "DEFAULT_PATH", ";", "}" ]
Find the path to use . Uses java annotations first and if not found, uses kubernetes annotations on the service object. @param service The target service. @param qualifiers The set of qualifiers. @return Returns the resolved path of '/' as a fallback.
[ "Find", "the", "path", "to", "use", ".", "Uses", "java", "annotations", "first", "and", "if", "not", "found", "uses", "kubernetes", "annotations", "on", "the", "service", "object", "." ]
train
https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/enricher/KuberntesServiceUrlResourceProvider.java#L212-L226
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/MediaservicesInner.java
MediaservicesInner.createOrUpdateAsync
public Observable<MediaServiceInner> createOrUpdateAsync(String resourceGroupName, String accountName, MediaServiceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() { @Override public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) { return response.body(); } }); }
java
public Observable<MediaServiceInner> createOrUpdateAsync(String resourceGroupName, String accountName, MediaServiceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() { @Override public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "MediaServiceInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "MediaServiceInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "MediaServiceInner", ">", ",", "MediaServiceInner", ">", "(", ")", "{", "@", "Override", "public", "MediaServiceInner", "call", "(", "ServiceResponse", "<", "MediaServiceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update a Media Services account. Creates or updates a Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the MediaServiceInner object
[ "Create", "or", "update", "a", "Media", "Services", "account", ".", "Creates", "or", "updates", "a", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/MediaservicesInner.java#L362-L369
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java
Utils.getFileNamePrefix
public static String getFileNamePrefix(ServiceModel serviceModel, CustomizationConfig customizationConfig) { if (customizationConfig.isUseUidAsFilePrefix() && serviceModel.getMetadata().getUid() != null) { return serviceModel.getMetadata().getUid(); } return String.format("%s-%s", serviceModel.getMetadata().getEndpointPrefix(), serviceModel.getMetadata().getApiVersion()); }
java
public static String getFileNamePrefix(ServiceModel serviceModel, CustomizationConfig customizationConfig) { if (customizationConfig.isUseUidAsFilePrefix() && serviceModel.getMetadata().getUid() != null) { return serviceModel.getMetadata().getUid(); } return String.format("%s-%s", serviceModel.getMetadata().getEndpointPrefix(), serviceModel.getMetadata().getApiVersion()); }
[ "public", "static", "String", "getFileNamePrefix", "(", "ServiceModel", "serviceModel", ",", "CustomizationConfig", "customizationConfig", ")", "{", "if", "(", "customizationConfig", ".", "isUseUidAsFilePrefix", "(", ")", "&&", "serviceModel", ".", "getMetadata", "(", ")", ".", "getUid", "(", ")", "!=", "null", ")", "{", "return", "serviceModel", ".", "getMetadata", "(", ")", ".", "getUid", "(", ")", ";", "}", "return", "String", ".", "format", "(", "\"%s-%s\"", ",", "serviceModel", ".", "getMetadata", "(", ")", ".", "getEndpointPrefix", "(", ")", ",", "serviceModel", ".", "getMetadata", "(", ")", ".", "getApiVersion", "(", ")", ")", ";", "}" ]
* @param serviceModel Service model to get prefix for. * @return Prefix to use when writing model files (service and intermediate).
[ "*" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java#L113-L119
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/audit_log.java
audit_log.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { audit_log_responses result = (audit_log_responses) service.get_payload_formatter().string_to_resource(audit_log_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.audit_log_response_array); } audit_log[] result_audit_log = new audit_log[result.audit_log_response_array.length]; for(int i = 0; i < result.audit_log_response_array.length; i++) { result_audit_log[i] = result.audit_log_response_array[i].audit_log[0]; } return result_audit_log; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { audit_log_responses result = (audit_log_responses) service.get_payload_formatter().string_to_resource(audit_log_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.audit_log_response_array); } audit_log[] result_audit_log = new audit_log[result.audit_log_response_array.length]; for(int i = 0; i < result.audit_log_response_array.length; i++) { result_audit_log[i] = result.audit_log_response_array[i].audit_log[0]; } return result_audit_log; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "audit_log_responses", "result", "=", "(", "audit_log_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "audit_log_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "audit_log_response_array", ")", ";", "}", "audit_log", "[", "]", "result_audit_log", "=", "new", "audit_log", "[", "result", ".", "audit_log_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "audit_log_response_array", ".", "length", ";", "i", "++", ")", "{", "result_audit_log", "[", "i", "]", "=", "result", ".", "audit_log_response_array", "[", "i", "]", ".", "audit_log", "[", "0", "]", ";", "}", "return", "result_audit_log", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/audit_log.java#L317-L334
rhuss/jolokia
agent/core/src/main/java/org/jolokia/backend/Config.java
Config.limitOrNull
private HistoryLimit limitOrNull(int pMaxEntries, long pMaxDuration) { return pMaxEntries != 0 || pMaxDuration != 0 ? new HistoryLimit(pMaxEntries, pMaxDuration) : null; }
java
private HistoryLimit limitOrNull(int pMaxEntries, long pMaxDuration) { return pMaxEntries != 0 || pMaxDuration != 0 ? new HistoryLimit(pMaxEntries, pMaxDuration) : null; }
[ "private", "HistoryLimit", "limitOrNull", "(", "int", "pMaxEntries", ",", "long", "pMaxDuration", ")", "{", "return", "pMaxEntries", "!=", "0", "||", "pMaxDuration", "!=", "0", "?", "new", "HistoryLimit", "(", "pMaxEntries", ",", "pMaxDuration", ")", ":", "null", ";", "}" ]
The limit or null if the entry should be disabled in the history store
[ "The", "limit", "or", "null", "if", "the", "entry", "should", "be", "disabled", "in", "the", "history", "store" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/backend/Config.java#L128-L130
gallandarakhneorg/afc
maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
AbstractArakhneMojo.assertNotNull
protected final void assertNotNull(String message, Object obj) { if (getLog().isDebugEnabled()) { getLog().debug( "\t(" //$NON-NLS-1$ + getLogType(obj) + ") " //$NON-NLS-1$ + message + " = " //$NON-NLS-1$ + obj); } if (obj == null) { throw new AssertionError("assertNotNull: " + message); //$NON-NLS-1$ } }
java
protected final void assertNotNull(String message, Object obj) { if (getLog().isDebugEnabled()) { getLog().debug( "\t(" //$NON-NLS-1$ + getLogType(obj) + ") " //$NON-NLS-1$ + message + " = " //$NON-NLS-1$ + obj); } if (obj == null) { throw new AssertionError("assertNotNull: " + message); //$NON-NLS-1$ } }
[ "protected", "final", "void", "assertNotNull", "(", "String", "message", ",", "Object", "obj", ")", "{", "if", "(", "getLog", "(", ")", ".", "isDebugEnabled", "(", ")", ")", "{", "getLog", "(", ")", ".", "debug", "(", "\"\\t(\"", "//$NON-NLS-1$", "+", "getLogType", "(", "obj", ")", "+", "\") \"", "//$NON-NLS-1$", "+", "message", "+", "\" = \"", "//$NON-NLS-1$", "+", "obj", ")", ";", "}", "if", "(", "obj", "==", "null", ")", "{", "throw", "new", "AssertionError", "(", "\"assertNotNull: \"", "+", "message", ")", ";", "//$NON-NLS-1$", "}", "}" ]
Throw an exception when the given object is null. @param message is the message to put in the exception. @param obj the object to test.
[ "Throw", "an", "exception", "when", "the", "given", "object", "is", "null", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L1081-L1094
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java
JMElasticsearchIndex.sendData
public String sendData(String jsonSource, String index, String type) { return sendData(jsonSource, index, type, null).getId(); }
java
public String sendData(String jsonSource, String index, String type) { return sendData(jsonSource, index, type, null).getId(); }
[ "public", "String", "sendData", "(", "String", "jsonSource", ",", "String", "index", ",", "String", "type", ")", "{", "return", "sendData", "(", "jsonSource", ",", "index", ",", "type", ",", "null", ")", ".", "getId", "(", ")", ";", "}" ]
Send data string. @param jsonSource the json source @param index the index @param type the type @return the string
[ "Send", "data", "string", "." ]
train
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L248-L250
wcm-io/wcm-io-sling
commons/src/main/java/io/wcm/sling/commons/request/QueryStringBuilder.java
QueryStringBuilder.params
public @NotNull QueryStringBuilder params(@NotNull Map<String, Object> values) { for (Map.Entry<String, Object> entry : values.entrySet()) { param(entry.getKey(), entry.getValue()); } return this; }
java
public @NotNull QueryStringBuilder params(@NotNull Map<String, Object> values) { for (Map.Entry<String, Object> entry : values.entrySet()) { param(entry.getKey(), entry.getValue()); } return this; }
[ "public", "@", "NotNull", "QueryStringBuilder", "params", "(", "@", "NotNull", "Map", "<", "String", ",", "Object", ">", "values", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "values", ".", "entrySet", "(", ")", ")", "{", "param", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Add map of parameters to query string. @param values Map with parameter names and values. Values will be converted to strings. If a value is an array or {@link Iterable} the value items will be added as separate parameters. @return this
[ "Add", "map", "of", "parameters", "to", "query", "string", "." ]
train
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/QueryStringBuilder.java#L78-L83
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.handleControlBrowseStatus
private final void handleControlBrowseStatus(SIBUuid8 remoteME, SIBUuid12 gatheringTargetDestUuid, long browseId, int status) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "handleControlBrowseStatus", new Object[] {remoteME, gatheringTargetDestUuid, Long.valueOf(browseId), Integer.valueOf(status)}); // first we see if there is an existing AOBrowseSession AOBrowserSessionKey key = new AOBrowserSessionKey(remoteME, gatheringTargetDestUuid, browseId); AOBrowserSession session = (AOBrowserSession) browserSessionTable.get(key); if (session != null) { if (status == SIMPConstants.BROWSE_CLOSE) { session.close(); browserSessionTable.remove(key); } else if (status == SIMPConstants.BROWSE_ALIVE) { session.keepAlive(); } } else { // session == null. ignore the status message } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleControlBrowseStatus"); }
java
private final void handleControlBrowseStatus(SIBUuid8 remoteME, SIBUuid12 gatheringTargetDestUuid, long browseId, int status) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "handleControlBrowseStatus", new Object[] {remoteME, gatheringTargetDestUuid, Long.valueOf(browseId), Integer.valueOf(status)}); // first we see if there is an existing AOBrowseSession AOBrowserSessionKey key = new AOBrowserSessionKey(remoteME, gatheringTargetDestUuid, browseId); AOBrowserSession session = (AOBrowserSession) browserSessionTable.get(key); if (session != null) { if (status == SIMPConstants.BROWSE_CLOSE) { session.close(); browserSessionTable.remove(key); } else if (status == SIMPConstants.BROWSE_ALIVE) { session.keepAlive(); } } else { // session == null. ignore the status message } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleControlBrowseStatus"); }
[ "private", "final", "void", "handleControlBrowseStatus", "(", "SIBUuid8", "remoteME", ",", "SIBUuid12", "gatheringTargetDestUuid", ",", "long", "browseId", ",", "int", "status", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"handleControlBrowseStatus\"", ",", "new", "Object", "[", "]", "{", "remoteME", ",", "gatheringTargetDestUuid", ",", "Long", ".", "valueOf", "(", "browseId", ")", ",", "Integer", ".", "valueOf", "(", "status", ")", "}", ")", ";", "// first we see if there is an existing AOBrowseSession", "AOBrowserSessionKey", "key", "=", "new", "AOBrowserSessionKey", "(", "remoteME", ",", "gatheringTargetDestUuid", ",", "browseId", ")", ";", "AOBrowserSession", "session", "=", "(", "AOBrowserSession", ")", "browserSessionTable", ".", "get", "(", "key", ")", ";", "if", "(", "session", "!=", "null", ")", "{", "if", "(", "status", "==", "SIMPConstants", ".", "BROWSE_CLOSE", ")", "{", "session", ".", "close", "(", ")", ";", "browserSessionTable", ".", "remove", "(", "key", ")", ";", "}", "else", "if", "(", "status", "==", "SIMPConstants", ".", "BROWSE_ALIVE", ")", "{", "session", ".", "keepAlive", "(", ")", ";", "}", "}", "else", "{", "// session == null. ignore the status message", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"handleControlBrowseStatus\"", ")", ";", "}" ]
Method to handle a ControlBrowseStatus message from an RME @param remoteME The UUID of the RME @param browseId The unique browseId, relative to this RME @param status The status
[ "Method", "to", "handle", "a", "ControlBrowseStatus", "message", "from", "an", "RME" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L1447-L1475
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java
EJBJavaColonNamingHelper.addAppBinding
public synchronized void addAppBinding(ModuleMetaData mmd, String name, EJBBinding bindingObject) { Lock writeLock = javaColonLock.writeLock(); writeLock.lock(); try { JavaColonNamespaceBindings<EJBBinding> bindings = getAppBindingMap(mmd.getApplicationMetaData()); bindings.bind(name, bindingObject); } finally { writeLock.unlock(); } }
java
public synchronized void addAppBinding(ModuleMetaData mmd, String name, EJBBinding bindingObject) { Lock writeLock = javaColonLock.writeLock(); writeLock.lock(); try { JavaColonNamespaceBindings<EJBBinding> bindings = getAppBindingMap(mmd.getApplicationMetaData()); bindings.bind(name, bindingObject); } finally { writeLock.unlock(); } }
[ "public", "synchronized", "void", "addAppBinding", "(", "ModuleMetaData", "mmd", ",", "String", "name", ",", "EJBBinding", "bindingObject", ")", "{", "Lock", "writeLock", "=", "javaColonLock", ".", "writeLock", "(", ")", ";", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "JavaColonNamespaceBindings", "<", "EJBBinding", ">", "bindings", "=", "getAppBindingMap", "(", "mmd", ".", "getApplicationMetaData", "(", ")", ")", ";", "bindings", ".", "bind", "(", "name", ",", "bindingObject", ")", ";", "}", "finally", "{", "writeLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Add a java:app binding object to the mapping. @param name lookup name @param bindingObject object to use to instantiate EJB at lookup time. @return @throws NamingException
[ "Add", "a", "java", ":", "app", "binding", "object", "to", "the", "mapping", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L384-L395
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/AbstractEndpointParser.java
AbstractEndpointParser.parseEndpointConfiguration
protected void parseEndpointConfiguration(BeanDefinitionBuilder endpointConfigurationBuilder, Element element, ParserContext parserContext) { BeanDefinitionParserUtils.setPropertyValue(endpointConfigurationBuilder, element.getAttribute("timeout"), "timeout"); }
java
protected void parseEndpointConfiguration(BeanDefinitionBuilder endpointConfigurationBuilder, Element element, ParserContext parserContext) { BeanDefinitionParserUtils.setPropertyValue(endpointConfigurationBuilder, element.getAttribute("timeout"), "timeout"); }
[ "protected", "void", "parseEndpointConfiguration", "(", "BeanDefinitionBuilder", "endpointConfigurationBuilder", ",", "Element", "element", ",", "ParserContext", "parserContext", ")", "{", "BeanDefinitionParserUtils", ".", "setPropertyValue", "(", "endpointConfigurationBuilder", ",", "element", ".", "getAttribute", "(", "\"timeout\"", ")", ",", "\"timeout\"", ")", ";", "}" ]
Subclasses can override this parsing method in order to provide proper endpoint configuration bean definition properties. @param endpointConfigurationBuilder @param element @param parserContext @return
[ "Subclasses", "can", "override", "this", "parsing", "method", "in", "order", "to", "provide", "proper", "endpoint", "configuration", "bean", "definition", "properties", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/AbstractEndpointParser.java#L74-L76
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/partition/impl/AbstractPartitionPrimaryReplicaAntiEntropyTask.java
AbstractPartitionPrimaryReplicaAntiEntropyTask.retainAndGetNamespaces
final Collection<ServiceNamespace> retainAndGetNamespaces() { PartitionReplicationEvent event = new PartitionReplicationEvent(partitionId, 0); Collection<FragmentedMigrationAwareService> services = nodeEngine.getServices(FragmentedMigrationAwareService.class); Set<ServiceNamespace> namespaces = new HashSet<>(); for (FragmentedMigrationAwareService service : services) { Collection<ServiceNamespace> serviceNamespaces = service.getAllServiceNamespaces(event); if (serviceNamespaces != null) { namespaces.addAll(serviceNamespaces); } } namespaces.add(NonFragmentedServiceNamespace.INSTANCE); PartitionReplicaManager replicaManager = partitionService.getReplicaManager(); replicaManager.retainNamespaces(partitionId, namespaces); return replicaManager.getNamespaces(partitionId); }
java
final Collection<ServiceNamespace> retainAndGetNamespaces() { PartitionReplicationEvent event = new PartitionReplicationEvent(partitionId, 0); Collection<FragmentedMigrationAwareService> services = nodeEngine.getServices(FragmentedMigrationAwareService.class); Set<ServiceNamespace> namespaces = new HashSet<>(); for (FragmentedMigrationAwareService service : services) { Collection<ServiceNamespace> serviceNamespaces = service.getAllServiceNamespaces(event); if (serviceNamespaces != null) { namespaces.addAll(serviceNamespaces); } } namespaces.add(NonFragmentedServiceNamespace.INSTANCE); PartitionReplicaManager replicaManager = partitionService.getReplicaManager(); replicaManager.retainNamespaces(partitionId, namespaces); return replicaManager.getNamespaces(partitionId); }
[ "final", "Collection", "<", "ServiceNamespace", ">", "retainAndGetNamespaces", "(", ")", "{", "PartitionReplicationEvent", "event", "=", "new", "PartitionReplicationEvent", "(", "partitionId", ",", "0", ")", ";", "Collection", "<", "FragmentedMigrationAwareService", ">", "services", "=", "nodeEngine", ".", "getServices", "(", "FragmentedMigrationAwareService", ".", "class", ")", ";", "Set", "<", "ServiceNamespace", ">", "namespaces", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "FragmentedMigrationAwareService", "service", ":", "services", ")", "{", "Collection", "<", "ServiceNamespace", ">", "serviceNamespaces", "=", "service", ".", "getAllServiceNamespaces", "(", "event", ")", ";", "if", "(", "serviceNamespaces", "!=", "null", ")", "{", "namespaces", ".", "addAll", "(", "serviceNamespaces", ")", ";", "}", "}", "namespaces", ".", "add", "(", "NonFragmentedServiceNamespace", ".", "INSTANCE", ")", ";", "PartitionReplicaManager", "replicaManager", "=", "partitionService", ".", "getReplicaManager", "(", ")", ";", "replicaManager", ".", "retainNamespaces", "(", "partitionId", ",", "namespaces", ")", ";", "return", "replicaManager", ".", "getNamespaces", "(", "partitionId", ")", ";", "}" ]
works only on primary. backups are retained in PartitionBackupReplicaAntiEntropyTask
[ "works", "only", "on", "primary", ".", "backups", "are", "retained", "in", "PartitionBackupReplicaAntiEntropyTask" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/impl/AbstractPartitionPrimaryReplicaAntiEntropyTask.java#L66-L82
jayantk/jklol
src/com/jayantkrish/jklol/sequence/ListLocalContext.java
ListLocalContext.getItem
@Override public I getItem(int relativeOffset, Function<? super Integer, I> endFunction) { int index = wordIndex + relativeOffset; if (index < 0) { return endFunction.apply(index); } else if (index >= items.size()) { int endWordIndex = index - (items.size() - 1); return endFunction.apply(endWordIndex); } else { return items.get(index); } }
java
@Override public I getItem(int relativeOffset, Function<? super Integer, I> endFunction) { int index = wordIndex + relativeOffset; if (index < 0) { return endFunction.apply(index); } else if (index >= items.size()) { int endWordIndex = index - (items.size() - 1); return endFunction.apply(endWordIndex); } else { return items.get(index); } }
[ "@", "Override", "public", "I", "getItem", "(", "int", "relativeOffset", ",", "Function", "<", "?", "super", "Integer", ",", "I", ">", "endFunction", ")", "{", "int", "index", "=", "wordIndex", "+", "relativeOffset", ";", "if", "(", "index", "<", "0", ")", "{", "return", "endFunction", ".", "apply", "(", "index", ")", ";", "}", "else", "if", "(", "index", ">=", "items", ".", "size", "(", ")", ")", "{", "int", "endWordIndex", "=", "index", "-", "(", "items", ".", "size", "(", ")", "-", "1", ")", ";", "return", "endFunction", ".", "apply", "(", "endWordIndex", ")", ";", "}", "else", "{", "return", "items", ".", "get", "(", "index", ")", ";", "}", "}" ]
Gets an item to the left or right of the central item in this context. Negative offsets get an item on the left (e.g., -2 gets the second item on the left) and positive offsets get an item on the right. If {@code relativeOffset} refers to a word off the end of the sequence, then {@code endFunction} is invoked to produce the return value. @param relativeOffset @return
[ "Gets", "an", "item", "to", "the", "left", "or", "right", "of", "the", "central", "item", "in", "this", "context", ".", "Negative", "offsets", "get", "an", "item", "on", "the", "left", "(", "e", ".", "g", ".", "-", "2", "gets", "the", "second", "item", "on", "the", "left", ")", "and", "positive", "offsets", "get", "an", "item", "on", "the", "right", ".", "If", "{", "@code", "relativeOffset", "}", "refers", "to", "a", "word", "off", "the", "end", "of", "the", "sequence", "then", "{", "@code", "endFunction", "}", "is", "invoked", "to", "produce", "the", "return", "value", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/sequence/ListLocalContext.java#L40-L52
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/utils/ExamplesUtil.java
ExamplesUtil.generateExampleForRefModel
private static Object generateExampleForRefModel(boolean generateMissingExamples, String simpleRef, Map<String, Model> definitions, DocumentResolver definitionDocumentResolver, MarkupDocBuilder markupDocBuilder, Map<String, Integer> refStack) { Model model = definitions.get(simpleRef); Object example = null; if (model != null) { example = model.getExample(); if (example == null && generateMissingExamples) { if (!refStack.containsKey(simpleRef)) { refStack.put(simpleRef, 1); } else { refStack.put(simpleRef, refStack.get(simpleRef) + 1); } if (refStack.get(simpleRef) <= MAX_RECURSION_TO_DISPLAY) { if (model instanceof ComposedModel) { //FIXME: getProperties() may throw NullPointerException example = exampleMapForProperties(((ObjectType) ModelUtils.getType(model, definitions, definitionDocumentResolver)).getProperties(), definitions, definitionDocumentResolver, markupDocBuilder, new HashMap<>()); } else { example = exampleMapForProperties(model.getProperties(), definitions, definitionDocumentResolver, markupDocBuilder, refStack); } } else { return "..."; } refStack.put(simpleRef, refStack.get(simpleRef) - 1); } } return example; }
java
private static Object generateExampleForRefModel(boolean generateMissingExamples, String simpleRef, Map<String, Model> definitions, DocumentResolver definitionDocumentResolver, MarkupDocBuilder markupDocBuilder, Map<String, Integer> refStack) { Model model = definitions.get(simpleRef); Object example = null; if (model != null) { example = model.getExample(); if (example == null && generateMissingExamples) { if (!refStack.containsKey(simpleRef)) { refStack.put(simpleRef, 1); } else { refStack.put(simpleRef, refStack.get(simpleRef) + 1); } if (refStack.get(simpleRef) <= MAX_RECURSION_TO_DISPLAY) { if (model instanceof ComposedModel) { //FIXME: getProperties() may throw NullPointerException example = exampleMapForProperties(((ObjectType) ModelUtils.getType(model, definitions, definitionDocumentResolver)).getProperties(), definitions, definitionDocumentResolver, markupDocBuilder, new HashMap<>()); } else { example = exampleMapForProperties(model.getProperties(), definitions, definitionDocumentResolver, markupDocBuilder, refStack); } } else { return "..."; } refStack.put(simpleRef, refStack.get(simpleRef) - 1); } } return example; }
[ "private", "static", "Object", "generateExampleForRefModel", "(", "boolean", "generateMissingExamples", ",", "String", "simpleRef", ",", "Map", "<", "String", ",", "Model", ">", "definitions", ",", "DocumentResolver", "definitionDocumentResolver", ",", "MarkupDocBuilder", "markupDocBuilder", ",", "Map", "<", "String", ",", "Integer", ">", "refStack", ")", "{", "Model", "model", "=", "definitions", ".", "get", "(", "simpleRef", ")", ";", "Object", "example", "=", "null", ";", "if", "(", "model", "!=", "null", ")", "{", "example", "=", "model", ".", "getExample", "(", ")", ";", "if", "(", "example", "==", "null", "&&", "generateMissingExamples", ")", "{", "if", "(", "!", "refStack", ".", "containsKey", "(", "simpleRef", ")", ")", "{", "refStack", ".", "put", "(", "simpleRef", ",", "1", ")", ";", "}", "else", "{", "refStack", ".", "put", "(", "simpleRef", ",", "refStack", ".", "get", "(", "simpleRef", ")", "+", "1", ")", ";", "}", "if", "(", "refStack", ".", "get", "(", "simpleRef", ")", "<=", "MAX_RECURSION_TO_DISPLAY", ")", "{", "if", "(", "model", "instanceof", "ComposedModel", ")", "{", "//FIXME: getProperties() may throw NullPointerException", "example", "=", "exampleMapForProperties", "(", "(", "(", "ObjectType", ")", "ModelUtils", ".", "getType", "(", "model", ",", "definitions", ",", "definitionDocumentResolver", ")", ")", ".", "getProperties", "(", ")", ",", "definitions", ",", "definitionDocumentResolver", ",", "markupDocBuilder", ",", "new", "HashMap", "<>", "(", ")", ")", ";", "}", "else", "{", "example", "=", "exampleMapForProperties", "(", "model", ".", "getProperties", "(", ")", ",", "definitions", ",", "definitionDocumentResolver", ",", "markupDocBuilder", ",", "refStack", ")", ";", "}", "}", "else", "{", "return", "\"...\"", ";", "}", "refStack", ".", "put", "(", "simpleRef", ",", "refStack", ".", "get", "(", "simpleRef", ")", "-", "1", ")", ";", "}", "}", "return", "example", ";", "}" ]
Generates an example object from a simple reference @param generateMissingExamples specifies the missing examples should be generated @param simpleRef the simple reference string @param definitions the map of definitions @param markupDocBuilder the markup builder @param refStack map to detect cyclic references @return returns an Object or Map of examples
[ "Generates", "an", "example", "object", "from", "a", "simple", "reference" ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/utils/ExamplesUtil.java#L215-L240
kevinherron/opc-ua-stack
stack-core/src/main/java/com/digitalpetri/opcua/stack/core/types/builtin/DataValue.java
DataValue.derivedValue
public static DataValue derivedValue(DataValue from, TimestampsToReturn timestamps) { boolean includeSource = timestamps == TimestampsToReturn.Source || timestamps == TimestampsToReturn.Both; boolean includeServer = timestamps == TimestampsToReturn.Server || timestamps == TimestampsToReturn.Both; return new DataValue( from.value, from.status, includeSource ? from.sourceTime : null, includeServer ? from.serverTime : null ); }
java
public static DataValue derivedValue(DataValue from, TimestampsToReturn timestamps) { boolean includeSource = timestamps == TimestampsToReturn.Source || timestamps == TimestampsToReturn.Both; boolean includeServer = timestamps == TimestampsToReturn.Server || timestamps == TimestampsToReturn.Both; return new DataValue( from.value, from.status, includeSource ? from.sourceTime : null, includeServer ? from.serverTime : null ); }
[ "public", "static", "DataValue", "derivedValue", "(", "DataValue", "from", ",", "TimestampsToReturn", "timestamps", ")", "{", "boolean", "includeSource", "=", "timestamps", "==", "TimestampsToReturn", ".", "Source", "||", "timestamps", "==", "TimestampsToReturn", ".", "Both", ";", "boolean", "includeServer", "=", "timestamps", "==", "TimestampsToReturn", ".", "Server", "||", "timestamps", "==", "TimestampsToReturn", ".", "Both", ";", "return", "new", "DataValue", "(", "from", ".", "value", ",", "from", ".", "status", ",", "includeSource", "?", "from", ".", "sourceTime", ":", "null", ",", "includeServer", "?", "from", ".", "serverTime", ":", "null", ")", ";", "}" ]
Derive a new {@link DataValue} from a given {@link DataValue}. @param from the {@link DataValue} to derive from. @param timestamps the timestamps to return in the derived value. @return a derived {@link DataValue}.
[ "Derive", "a", "new", "{", "@link", "DataValue", "}", "from", "a", "given", "{", "@link", "DataValue", "}", "." ]
train
https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/types/builtin/DataValue.java#L136-L146
rhuss/jolokia
agent/core/src/main/java/org/jolokia/handler/list/MBeanInfoData.java
MBeanInfoData.addMBeanInfo
public void addMBeanInfo(MBeanInfo mBeanInfo, ObjectName pName) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException { JSONObject mBeansMap = getOrCreateJSONObject(infoMap, pName.getDomain()); JSONObject mBeanMap = getOrCreateJSONObject(mBeansMap, getKeyPropertyString(pName)); // Trim down stack to get rid of domain/property list Stack<String> stack = truncatePathStack(2); if (stack.empty()) { addFullMBeanInfo(mBeanMap, mBeanInfo); } else { addPartialMBeanInfo(mBeanMap, mBeanInfo,stack); } // Trim if required if (mBeanMap.size() == 0) { mBeansMap.remove(getKeyPropertyString(pName)); if (mBeansMap.size() == 0) { infoMap.remove(pName.getDomain()); } } }
java
public void addMBeanInfo(MBeanInfo mBeanInfo, ObjectName pName) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException { JSONObject mBeansMap = getOrCreateJSONObject(infoMap, pName.getDomain()); JSONObject mBeanMap = getOrCreateJSONObject(mBeansMap, getKeyPropertyString(pName)); // Trim down stack to get rid of domain/property list Stack<String> stack = truncatePathStack(2); if (stack.empty()) { addFullMBeanInfo(mBeanMap, mBeanInfo); } else { addPartialMBeanInfo(mBeanMap, mBeanInfo,stack); } // Trim if required if (mBeanMap.size() == 0) { mBeansMap.remove(getKeyPropertyString(pName)); if (mBeansMap.size() == 0) { infoMap.remove(pName.getDomain()); } } }
[ "public", "void", "addMBeanInfo", "(", "MBeanInfo", "mBeanInfo", ",", "ObjectName", "pName", ")", "throws", "InstanceNotFoundException", ",", "IntrospectionException", ",", "ReflectionException", ",", "IOException", "{", "JSONObject", "mBeansMap", "=", "getOrCreateJSONObject", "(", "infoMap", ",", "pName", ".", "getDomain", "(", ")", ")", ";", "JSONObject", "mBeanMap", "=", "getOrCreateJSONObject", "(", "mBeansMap", ",", "getKeyPropertyString", "(", "pName", ")", ")", ";", "// Trim down stack to get rid of domain/property list", "Stack", "<", "String", ">", "stack", "=", "truncatePathStack", "(", "2", ")", ";", "if", "(", "stack", ".", "empty", "(", ")", ")", "{", "addFullMBeanInfo", "(", "mBeanMap", ",", "mBeanInfo", ")", ";", "}", "else", "{", "addPartialMBeanInfo", "(", "mBeanMap", ",", "mBeanInfo", ",", "stack", ")", ";", "}", "// Trim if required", "if", "(", "mBeanMap", ".", "size", "(", ")", "==", "0", ")", "{", "mBeansMap", ".", "remove", "(", "getKeyPropertyString", "(", "pName", ")", ")", ";", "if", "(", "mBeansMap", ".", "size", "(", ")", "==", "0", ")", "{", "infoMap", ".", "remove", "(", "pName", ".", "getDomain", "(", ")", ")", ";", "}", "}", "}" ]
Add information about an MBean as obtained from an {@link MBeanInfo} descriptor. The information added can be restricted by a given path (which has already be prepared as a stack). Also, a max depth as given in the constructor restricts the size of the map from the top. @param mBeanInfo the MBean info @param pName the object name of the MBean
[ "Add", "information", "about", "an", "MBean", "as", "obtained", "from", "an", "{", "@link", "MBeanInfo", "}", "descriptor", ".", "The", "information", "added", "can", "be", "restricted", "by", "a", "given", "path", "(", "which", "has", "already", "be", "prepared", "as", "a", "stack", ")", ".", "Also", "a", "max", "depth", "as", "given", "in", "the", "constructor", "restricts", "the", "size", "of", "the", "map", "from", "the", "top", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/handler/list/MBeanInfoData.java#L171-L190
motown-io/motown
ocpp/view-model/src/main/java/io/motown/ocpp/viewmodel/domain/DomainService.java
DomainService.startTransaction
public void startTransaction(ChargingStationId chargingStationId, EvseId evseId, IdentifyingToken idTag, FutureEventCallback futureEventCallback, AddOnIdentity addOnIdentity) { ChargingStation chargingStation = this.checkChargingStationExistsAndIsRegisteredAndConfigured(chargingStationId); if (evseId.getNumberedId() > chargingStation.getNumberOfEvses()) { throw new IllegalStateException("Cannot start transaction on a unknown evse."); } // authorize the token, the future contains the call to start the transaction authorize(chargingStationId, idTag.getToken(), futureEventCallback, addOnIdentity); }
java
public void startTransaction(ChargingStationId chargingStationId, EvseId evseId, IdentifyingToken idTag, FutureEventCallback futureEventCallback, AddOnIdentity addOnIdentity) { ChargingStation chargingStation = this.checkChargingStationExistsAndIsRegisteredAndConfigured(chargingStationId); if (evseId.getNumberedId() > chargingStation.getNumberOfEvses()) { throw new IllegalStateException("Cannot start transaction on a unknown evse."); } // authorize the token, the future contains the call to start the transaction authorize(chargingStationId, idTag.getToken(), futureEventCallback, addOnIdentity); }
[ "public", "void", "startTransaction", "(", "ChargingStationId", "chargingStationId", ",", "EvseId", "evseId", ",", "IdentifyingToken", "idTag", ",", "FutureEventCallback", "futureEventCallback", ",", "AddOnIdentity", "addOnIdentity", ")", "{", "ChargingStation", "chargingStation", "=", "this", ".", "checkChargingStationExistsAndIsRegisteredAndConfigured", "(", "chargingStationId", ")", ";", "if", "(", "evseId", ".", "getNumberedId", "(", ")", ">", "chargingStation", ".", "getNumberOfEvses", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot start transaction on a unknown evse.\"", ")", ";", "}", "// authorize the token, the future contains the call to start the transaction", "authorize", "(", "chargingStationId", ",", "idTag", ".", "getToken", "(", ")", ",", "futureEventCallback", ",", "addOnIdentity", ")", ";", "}" ]
Generates a transaction identifier and starts a transaction by dispatching a StartTransactionCommand. @param chargingStationId identifier of the charging station. @param evseId evse identifier on which the transaction is started. @param idTag the identification which started the transaction. @param futureEventCallback will be called once the authorize result event occurs. @param addOnIdentity identity of the add on that calls this method.
[ "Generates", "a", "transaction", "identifier", "and", "starts", "a", "transaction", "by", "dispatching", "a", "StartTransactionCommand", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/view-model/src/main/java/io/motown/ocpp/viewmodel/domain/DomainService.java#L216-L226
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java
MultiNormalizerHybrid.minMaxScaleOutput
public MultiNormalizerHybrid minMaxScaleOutput(int output, double rangeFrom, double rangeTo) { perOutputStrategies.put(output, new MinMaxStrategy(rangeFrom, rangeTo)); return this; }
java
public MultiNormalizerHybrid minMaxScaleOutput(int output, double rangeFrom, double rangeTo) { perOutputStrategies.put(output, new MinMaxStrategy(rangeFrom, rangeTo)); return this; }
[ "public", "MultiNormalizerHybrid", "minMaxScaleOutput", "(", "int", "output", ",", "double", "rangeFrom", ",", "double", "rangeTo", ")", "{", "perOutputStrategies", ".", "put", "(", "output", ",", "new", "MinMaxStrategy", "(", "rangeFrom", ",", "rangeTo", ")", ")", ";", "return", "this", ";", "}" ]
Apply min-max scaling to a specific output, overriding the global output strategy if any @param output the index of the input @param rangeFrom lower bound of the target range @param rangeTo upper bound of the target range @return the normalizer
[ "Apply", "min", "-", "max", "scaling", "to", "a", "specific", "output", "overriding", "the", "global", "output", "strategy", "if", "any" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java#L188-L191
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.restartVnfr
@Help(help = "Scales out/add a VNF to a running NetworkServiceRecord with specific id") public void restartVnfr(final String idNsr, final String idVnfr, String imageName) throws SDKException { HashMap<String, Serializable> jsonBody = new HashMap<>(); jsonBody.put("imageName", imageName); String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/restart"; requestPost(url, jsonBody); }
java
@Help(help = "Scales out/add a VNF to a running NetworkServiceRecord with specific id") public void restartVnfr(final String idNsr, final String idVnfr, String imageName) throws SDKException { HashMap<String, Serializable> jsonBody = new HashMap<>(); jsonBody.put("imageName", imageName); String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/restart"; requestPost(url, jsonBody); }
[ "@", "Help", "(", "help", "=", "\"Scales out/add a VNF to a running NetworkServiceRecord with specific id\"", ")", "public", "void", "restartVnfr", "(", "final", "String", "idNsr", ",", "final", "String", "idVnfr", ",", "String", "imageName", ")", "throws", "SDKException", "{", "HashMap", "<", "String", ",", "Serializable", ">", "jsonBody", "=", "new", "HashMap", "<>", "(", ")", ";", "jsonBody", ".", "put", "(", "\"imageName\"", ",", "imageName", ")", ";", "String", "url", "=", "idNsr", "+", "\"/vnfrecords\"", "+", "\"/\"", "+", "idVnfr", "+", "\"/restart\"", ";", "requestPost", "(", "url", ",", "jsonBody", ")", ";", "}" ]
Restarts a VNFR in a running NSR. @param idNsr the ID of the NetworkServiceRecord @param idVnfr the ID of the VNFR to restart @param imageName rebuilding the VNFR with a different image if defined @throws SDKException if the request fails
[ "Restarts", "a", "VNFR", "in", "a", "running", "NSR", "." ]
train
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L674-L681
JOML-CI/JOML
src/org/joml/Matrix3f.java
Matrix3f.obliqueZ
public Matrix3f obliqueZ(float a, float b) { this.m20 = m00 * a + m10 * b + m20; this.m21 = m01 * a + m11 * b + m21; this.m22 = m02 * a + m12 * b + m22; return this; }
java
public Matrix3f obliqueZ(float a, float b) { this.m20 = m00 * a + m10 * b + m20; this.m21 = m01 * a + m11 * b + m21; this.m22 = m02 * a + m12 * b + m22; return this; }
[ "public", "Matrix3f", "obliqueZ", "(", "float", "a", ",", "float", "b", ")", "{", "this", ".", "m20", "=", "m00", "*", "a", "+", "m10", "*", "b", "+", "m20", ";", "this", ".", "m21", "=", "m01", "*", "a", "+", "m11", "*", "b", "+", "m21", ";", "this", ".", "m22", "=", "m02", "*", "a", "+", "m12", "*", "b", "+", "m22", ";", "return", "this", ";", "}" ]
Apply an oblique projection transformation to this matrix with the given values for <code>a</code> and <code>b</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the oblique transformation matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the oblique transformation will be applied first! <p> The oblique transformation is defined as: <pre> x' = x + a*z y' = y + a*z z' = z </pre> or in matrix form: <pre> 1 0 a 0 1 b 0 0 1 </pre> @param a the value for the z factor that applies to x @param b the value for the z factor that applies to y @return this
[ "Apply", "an", "oblique", "projection", "transformation", "to", "this", "matrix", "with", "the", "given", "values", "for", "<code", ">", "a<", "/", "code", ">", "and", "<code", ">", "b<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "O<", "/", "code", ">", "the", "oblique", "transformation", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "O<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "O", "*", "v<", "/", "code", ">", "the", "oblique", "transformation", "will", "be", "applied", "first!", "<p", ">", "The", "oblique", "transformation", "is", "defined", "as", ":", "<pre", ">", "x", "=", "x", "+", "a", "*", "z", "y", "=", "y", "+", "a", "*", "z", "z", "=", "z", "<", "/", "pre", ">", "or", "in", "matrix", "form", ":", "<pre", ">", "1", "0", "a", "0", "1", "b", "0", "0", "1", "<", "/", "pre", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L4143-L4148
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java
UtilReflection.checkInterfaces
private static void checkInterfaces(Class<?> base, Deque<Class<?>> currents, Deque<Class<?>> nexts) { currents.stream() .map(Class::getInterfaces) .forEach(types -> Arrays.asList(types) .stream() .filter(type -> base.isAssignableFrom(type) && !type.equals(base)) .forEach(nexts::add)); }
java
private static void checkInterfaces(Class<?> base, Deque<Class<?>> currents, Deque<Class<?>> nexts) { currents.stream() .map(Class::getInterfaces) .forEach(types -> Arrays.asList(types) .stream() .filter(type -> base.isAssignableFrom(type) && !type.equals(base)) .forEach(nexts::add)); }
[ "private", "static", "void", "checkInterfaces", "(", "Class", "<", "?", ">", "base", ",", "Deque", "<", "Class", "<", "?", ">", ">", "currents", ",", "Deque", "<", "Class", "<", "?", ">", ">", "nexts", ")", "{", "currents", ".", "stream", "(", ")", ".", "map", "(", "Class", "::", "getInterfaces", ")", ".", "forEach", "(", "types", "->", "Arrays", ".", "asList", "(", "types", ")", ".", "stream", "(", ")", ".", "filter", "(", "type", "->", "base", ".", "isAssignableFrom", "(", "type", ")", "&&", "!", "type", ".", "equals", "(", "base", ")", ")", ".", "forEach", "(", "nexts", "::", "add", ")", ")", ";", "}" ]
Store all declared valid interfaces into next. @param base The minimum base interface. @param currents The current interfaces found. @param nexts The next interface to check.
[ "Store", "all", "declared", "valid", "interfaces", "into", "next", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java#L396-L404
UrielCh/ovh-java-sdk
ovh-java-sdk-metrics/src/main/java/net/minidev/ovh/api/ApiOvhMetrics.java
ApiOvhMetrics.serviceName_quota_PUT
public String serviceName_quota_PUT(String serviceName, Long quota) throws IOException { String qPath = "/metrics/{serviceName}/quota"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "quota", quota); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, String.class); }
java
public String serviceName_quota_PUT(String serviceName, Long quota) throws IOException { String qPath = "/metrics/{serviceName}/quota"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "quota", quota); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, String.class); }
[ "public", "String", "serviceName_quota_PUT", "(", "String", "serviceName", ",", "Long", "quota", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/metrics/{serviceName}/quota\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"quota\"", ",", "quota", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "String", ".", "class", ")", ";", "}" ]
Set overquota REST: PUT /metrics/{serviceName}/quota @param serviceName [required] Name of your service @param quota [required] New value for overquota API beta
[ "Set", "overquota" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-metrics/src/main/java/net/minidev/ovh/api/ApiOvhMetrics.java#L284-L291
keyboardsurfer/Crouton
library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java
Crouton.showText
public static void showText(Activity activity, CharSequence text, Style style, int viewGroupResId) { makeText(activity, text, style, (ViewGroup) activity.findViewById(viewGroupResId)).show(); }
java
public static void showText(Activity activity, CharSequence text, Style style, int viewGroupResId) { makeText(activity, text, style, (ViewGroup) activity.findViewById(viewGroupResId)).show(); }
[ "public", "static", "void", "showText", "(", "Activity", "activity", ",", "CharSequence", "text", ",", "Style", "style", ",", "int", "viewGroupResId", ")", "{", "makeText", "(", "activity", ",", "text", ",", "style", ",", "(", "ViewGroup", ")", "activity", ".", "findViewById", "(", "viewGroupResId", ")", ")", ".", "show", "(", ")", ";", "}" ]
Creates a {@link Crouton} with provided text and style for a given activity and displays it directly. @param activity The {@link Activity} that represents the context in which the Crouton should exist. @param text The text you want to display. @param style The style that this {@link Crouton} should be created with. @param viewGroupResId The resource id of the {@link ViewGroup} that this {@link Crouton} should be added to.
[ "Creates", "a", "{", "@link", "Crouton", "}", "with", "provided", "text", "and", "style", "for", "a", "given", "activity", "and", "displays", "it", "directly", "." ]
train
https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java#L411-L413
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/repository/ArtifactNameBuilder.java
ArtifactNameBuilder.forRuntime
public static ArtifactNameBuilder forRuntime(final String artifact) { return new ArtifactNameBuilder(artifact) { @Override public ArtifactName build() { final ArtifactName delegate = super.build(); String groupId = delegate.getGroupId(); if (groupId == null) { groupId = WILDFLY_GROUP_ID; } String artifactId = delegate.getArtifactId(); if (artifactId == null) { artifactId = WILDFLY_ARTIFACT_ID; } String packaging = delegate.getPackaging(); if (packaging == null) { packaging = WILDFLY_PACKAGING; } String version = delegate.getVersion(); if (version == null) { version = Runtimes.getLatestFinal(groupId, artifactId); } return new ArtifactNameImpl(groupId, artifactId, delegate.getClassifier(), packaging, version); } }; }
java
public static ArtifactNameBuilder forRuntime(final String artifact) { return new ArtifactNameBuilder(artifact) { @Override public ArtifactName build() { final ArtifactName delegate = super.build(); String groupId = delegate.getGroupId(); if (groupId == null) { groupId = WILDFLY_GROUP_ID; } String artifactId = delegate.getArtifactId(); if (artifactId == null) { artifactId = WILDFLY_ARTIFACT_ID; } String packaging = delegate.getPackaging(); if (packaging == null) { packaging = WILDFLY_PACKAGING; } String version = delegate.getVersion(); if (version == null) { version = Runtimes.getLatestFinal(groupId, artifactId); } return new ArtifactNameImpl(groupId, artifactId, delegate.getClassifier(), packaging, version); } }; }
[ "public", "static", "ArtifactNameBuilder", "forRuntime", "(", "final", "String", "artifact", ")", "{", "return", "new", "ArtifactNameBuilder", "(", "artifact", ")", "{", "@", "Override", "public", "ArtifactName", "build", "(", ")", "{", "final", "ArtifactName", "delegate", "=", "super", ".", "build", "(", ")", ";", "String", "groupId", "=", "delegate", ".", "getGroupId", "(", ")", ";", "if", "(", "groupId", "==", "null", ")", "{", "groupId", "=", "WILDFLY_GROUP_ID", ";", "}", "String", "artifactId", "=", "delegate", ".", "getArtifactId", "(", ")", ";", "if", "(", "artifactId", "==", "null", ")", "{", "artifactId", "=", "WILDFLY_ARTIFACT_ID", ";", "}", "String", "packaging", "=", "delegate", ".", "getPackaging", "(", ")", ";", "if", "(", "packaging", "==", "null", ")", "{", "packaging", "=", "WILDFLY_PACKAGING", ";", "}", "String", "version", "=", "delegate", ".", "getVersion", "(", ")", ";", "if", "(", "version", "==", "null", ")", "{", "version", "=", "Runtimes", ".", "getLatestFinal", "(", "groupId", ",", "artifactId", ")", ";", "}", "return", "new", "ArtifactNameImpl", "(", "groupId", ",", "artifactId", ",", "delegate", ".", "getClassifier", "(", ")", ",", "packaging", ",", "version", ")", ";", "}", "}", ";", "}" ]
Creates an artifact builder based on the artifact. <p> If the {@link #setGroupId(String) groupId}, {@link #setArtifactId(String) artifactId}, {@link #setPackaging(String) packaging} or {@link #setVersion(String) version} is {@code null} defaults will be used. </p> @param artifact the artifact string in the {@code groupId:artifactId:version[:packaging][:classifier]} format or {@code null} @return a new builder
[ "Creates", "an", "artifact", "builder", "based", "on", "the", "artifact", ".", "<p", ">", "If", "the", "{", "@link", "#setGroupId", "(", "String", ")", "groupId", "}", "{", "@link", "#setArtifactId", "(", "String", ")", "artifactId", "}", "{", "@link", "#setPackaging", "(", "String", ")", "packaging", "}", "or", "{", "@link", "#setVersion", "(", "String", ")", "version", "}", "is", "{", "@code", "null", "}", "defaults", "will", "be", "used", ".", "<", "/", "p", ">" ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/repository/ArtifactNameBuilder.java#L81-L105
javagl/CommonUI
src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java
CustomizedTableHeader.setDefaultRenderer
@Override public void setDefaultRenderer(TableCellRenderer defaultRenderer) { if (spaceRenderer != null) { CompoundTableCellRenderer renderer = new CompoundTableCellRenderer(spaceRenderer, defaultRenderer); super.setDefaultRenderer(renderer); } else { super.setDefaultRenderer(defaultRenderer); } }
java
@Override public void setDefaultRenderer(TableCellRenderer defaultRenderer) { if (spaceRenderer != null) { CompoundTableCellRenderer renderer = new CompoundTableCellRenderer(spaceRenderer, defaultRenderer); super.setDefaultRenderer(renderer); } else { super.setDefaultRenderer(defaultRenderer); } }
[ "@", "Override", "public", "void", "setDefaultRenderer", "(", "TableCellRenderer", "defaultRenderer", ")", "{", "if", "(", "spaceRenderer", "!=", "null", ")", "{", "CompoundTableCellRenderer", "renderer", "=", "new", "CompoundTableCellRenderer", "(", "spaceRenderer", ",", "defaultRenderer", ")", ";", "super", ".", "setDefaultRenderer", "(", "renderer", ")", ";", "}", "else", "{", "super", ".", "setDefaultRenderer", "(", "defaultRenderer", ")", ";", "}", "}" ]
{@inheritDoc} <br> <br> <b>Note:</b> This method is overridden in the CustomizedTableHeader. It will internally combine the given renderer with the one that reserves the space for the custom components. This means that calling {@link #getDefaultRenderer()} will return a different renderer than the one that was passed to this call.
[ "{" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java#L222-L235
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.getBackgroundPainter
public SeaGlassPainter getBackgroundPainter(SynthContext ctx) { Values v = getValues(ctx); int xstate = getExtendedState(ctx, v); SeaGlassPainter p = null; // check the cache tmpKey.init("backgroundPainter$$instance", xstate); p = (SeaGlassPainter) v.cache.get(tmpKey); if (p != null) return p; // not in cache, so lookup and store in cache RuntimeState s = null; int[] lastIndex = new int[] { -1 }; while ((s = getNextState(v.states, lastIndex, xstate)) != null) { if (s.backgroundPainter != null) { p = s.backgroundPainter; break; } } if (p == null) p = (SeaGlassPainter) get(ctx, "backgroundPainter"); if (p != null) { v.cache.put(new CacheKey("backgroundPainter$$instance", xstate), p); } return p; }
java
public SeaGlassPainter getBackgroundPainter(SynthContext ctx) { Values v = getValues(ctx); int xstate = getExtendedState(ctx, v); SeaGlassPainter p = null; // check the cache tmpKey.init("backgroundPainter$$instance", xstate); p = (SeaGlassPainter) v.cache.get(tmpKey); if (p != null) return p; // not in cache, so lookup and store in cache RuntimeState s = null; int[] lastIndex = new int[] { -1 }; while ((s = getNextState(v.states, lastIndex, xstate)) != null) { if (s.backgroundPainter != null) { p = s.backgroundPainter; break; } } if (p == null) p = (SeaGlassPainter) get(ctx, "backgroundPainter"); if (p != null) { v.cache.put(new CacheKey("backgroundPainter$$instance", xstate), p); } return p; }
[ "public", "SeaGlassPainter", "getBackgroundPainter", "(", "SynthContext", "ctx", ")", "{", "Values", "v", "=", "getValues", "(", "ctx", ")", ";", "int", "xstate", "=", "getExtendedState", "(", "ctx", ",", "v", ")", ";", "SeaGlassPainter", "p", "=", "null", ";", "// check the cache", "tmpKey", ".", "init", "(", "\"backgroundPainter$$instance\"", ",", "xstate", ")", ";", "p", "=", "(", "SeaGlassPainter", ")", "v", ".", "cache", ".", "get", "(", "tmpKey", ")", ";", "if", "(", "p", "!=", "null", ")", "return", "p", ";", "// not in cache, so lookup and store in cache", "RuntimeState", "s", "=", "null", ";", "int", "[", "]", "lastIndex", "=", "new", "int", "[", "]", "{", "-", "1", "}", ";", "while", "(", "(", "s", "=", "getNextState", "(", "v", ".", "states", ",", "lastIndex", ",", "xstate", ")", ")", "!=", "null", ")", "{", "if", "(", "s", ".", "backgroundPainter", "!=", "null", ")", "{", "p", "=", "s", ".", "backgroundPainter", ";", "break", ";", "}", "}", "if", "(", "p", "==", "null", ")", "p", "=", "(", "SeaGlassPainter", ")", "get", "(", "ctx", ",", "\"backgroundPainter\"", ")", ";", "if", "(", "p", "!=", "null", ")", "{", "v", ".", "cache", ".", "put", "(", "new", "CacheKey", "(", "\"backgroundPainter$$instance\"", ",", "xstate", ")", ",", "p", ")", ";", "}", "return", "p", ";", "}" ]
Gets the appropriate background Painter, if there is one, for the state specified in the given SynthContext. This method does appropriate fallback searching, as described in #get. @param ctx The SynthContext. Must not be null. @return The background painter associated for the given state, or null if none could be found.
[ "Gets", "the", "appropriate", "background", "Painter", "if", "there", "is", "one", "for", "the", "state", "specified", "in", "the", "given", "SynthContext", ".", "This", "method", "does", "appropriate", "fallback", "searching", "as", "described", "in", "#get", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L1047-L1080
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.getCvsAsListMap
public static List<Map<String, String>> getCvsAsListMap(final File input) throws IOException { return getCvsAsListMap(input, "ISO-8859-1"); }
java
public static List<Map<String, String>> getCvsAsListMap(final File input) throws IOException { return getCvsAsListMap(input, "ISO-8859-1"); }
[ "public", "static", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "getCvsAsListMap", "(", "final", "File", "input", ")", "throws", "IOException", "{", "return", "getCvsAsListMap", "(", "input", ",", "\"ISO-8859-1\"", ")", ";", "}" ]
Gets the given cvs file as list of maps. Every map has as key the header from the column and the corresponding value for this line. @param input the input @return the cvs as list map @throws IOException Signals that an I/O exception has occurred.
[ "Gets", "the", "given", "cvs", "file", "as", "list", "of", "maps", ".", "Every", "map", "has", "as", "key", "the", "header", "from", "the", "column", "and", "the", "corresponding", "value", "for", "this", "line", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L161-L164
voldemort/voldemort
src/java/voldemort/server/protocol/admin/AdminServiceRequestHandler.java
AdminServiceRequestHandler.swapStore
private String swapStore(String storeName, String directory) throws VoldemortException { ReadOnlyStorageEngine store = getReadOnlyStorageEngine(metadataStore, storeRepository, storeName); if(!Utils.isReadableDir(directory)) throw new VoldemortException("Store directory '" + directory + "' is not a readable directory."); String currentDirPath = store.getCurrentDirPath(); logger.info("Swapping RO store '" + storeName + "' to version directory '" + directory + "'"); store.swapFiles(directory); logger.info("Swapping swapped RO store '" + storeName + "' to version directory '" + directory + "'"); return currentDirPath; }
java
private String swapStore(String storeName, String directory) throws VoldemortException { ReadOnlyStorageEngine store = getReadOnlyStorageEngine(metadataStore, storeRepository, storeName); if(!Utils.isReadableDir(directory)) throw new VoldemortException("Store directory '" + directory + "' is not a readable directory."); String currentDirPath = store.getCurrentDirPath(); logger.info("Swapping RO store '" + storeName + "' to version directory '" + directory + "'"); store.swapFiles(directory); logger.info("Swapping swapped RO store '" + storeName + "' to version directory '" + directory + "'"); return currentDirPath; }
[ "private", "String", "swapStore", "(", "String", "storeName", ",", "String", "directory", ")", "throws", "VoldemortException", "{", "ReadOnlyStorageEngine", "store", "=", "getReadOnlyStorageEngine", "(", "metadataStore", ",", "storeRepository", ",", "storeName", ")", ";", "if", "(", "!", "Utils", ".", "isReadableDir", "(", "directory", ")", ")", "throw", "new", "VoldemortException", "(", "\"Store directory '\"", "+", "directory", "+", "\"' is not a readable directory.\"", ")", ";", "String", "currentDirPath", "=", "store", ".", "getCurrentDirPath", "(", ")", ";", "logger", ".", "info", "(", "\"Swapping RO store '\"", "+", "storeName", "+", "\"' to version directory '\"", "+", "directory", "+", "\"'\"", ")", ";", "store", ".", "swapFiles", "(", "directory", ")", ";", "logger", ".", "info", "(", "\"Swapping swapped RO store '\"", "+", "storeName", "+", "\"' to version directory '\"", "+", "directory", "+", "\"'\"", ")", ";", "return", "currentDirPath", ";", "}" ]
Given a read-only store name and a directory, swaps it in while returning the directory path being swapped out @param storeName The name of the read-only store @param directory The directory being swapped in @return The directory path which was swapped out @throws VoldemortException
[ "Given", "a", "read", "-", "only", "store", "name", "and", "a", "directory", "swaps", "it", "in", "while", "returning", "the", "directory", "path", "being", "swapped", "out" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/AdminServiceRequestHandler.java#L996-L1015
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java
VirtualFile.writeView
ByteBuffer writeView(int position, int needs) throws IOException { int waterMark = position+needs; if (waterMark > content.capacity()) { if (refSet.containsKey(content)) { throw new IOException("cannot grow file because of writable mapping for content. (non carbage collected mapping?)"); } int blockSize = fileStore.getBlockSize(); int newCapacity = Math.max(((waterMark / blockSize) + 1) * blockSize, 2*content.capacity()); ByteBuffer newBB = ByteBuffer.allocateDirect(newCapacity); newBB.put(content); newBB.flip(); content = newBB; } ByteBuffer bb = content.duplicate(); refSet.add(content, bb); bb.limit(waterMark).position(position); return bb; }
java
ByteBuffer writeView(int position, int needs) throws IOException { int waterMark = position+needs; if (waterMark > content.capacity()) { if (refSet.containsKey(content)) { throw new IOException("cannot grow file because of writable mapping for content. (non carbage collected mapping?)"); } int blockSize = fileStore.getBlockSize(); int newCapacity = Math.max(((waterMark / blockSize) + 1) * blockSize, 2*content.capacity()); ByteBuffer newBB = ByteBuffer.allocateDirect(newCapacity); newBB.put(content); newBB.flip(); content = newBB; } ByteBuffer bb = content.duplicate(); refSet.add(content, bb); bb.limit(waterMark).position(position); return bb; }
[ "ByteBuffer", "writeView", "(", "int", "position", ",", "int", "needs", ")", "throws", "IOException", "{", "int", "waterMark", "=", "position", "+", "needs", ";", "if", "(", "waterMark", ">", "content", ".", "capacity", "(", ")", ")", "{", "if", "(", "refSet", ".", "containsKey", "(", "content", ")", ")", "{", "throw", "new", "IOException", "(", "\"cannot grow file because of writable mapping for content. (non carbage collected mapping?)\"", ")", ";", "}", "int", "blockSize", "=", "fileStore", ".", "getBlockSize", "(", ")", ";", "int", "newCapacity", "=", "Math", ".", "max", "(", "(", "(", "waterMark", "/", "blockSize", ")", "+", "1", ")", "*", "blockSize", ",", "2", "*", "content", ".", "capacity", "(", ")", ")", ";", "ByteBuffer", "newBB", "=", "ByteBuffer", ".", "allocateDirect", "(", "newCapacity", ")", ";", "newBB", ".", "put", "(", "content", ")", ";", "newBB", ".", "flip", "(", ")", ";", "content", "=", "newBB", ";", "}", "ByteBuffer", "bb", "=", "content", ".", "duplicate", "(", ")", ";", "refSet", ".", "add", "(", "content", ",", "bb", ")", ";", "bb", ".", "limit", "(", "waterMark", ")", ".", "position", "(", "position", ")", ";", "return", "bb", ";", "}" ]
Returns view of content. @return ByteBuffer position set to given position limit is position+needs.
[ "Returns", "view", "of", "content", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java#L336-L356
vkostyukov/la4j
src/main/java/org/la4j/vector/dense/BasicVector.java
BasicVector.fromMap
public static BasicVector fromMap(Map<Integer, ? extends Number> map, int length) { return Vector.fromMap(map, length).to(Vectors.BASIC); }
java
public static BasicVector fromMap(Map<Integer, ? extends Number> map, int length) { return Vector.fromMap(map, length).to(Vectors.BASIC); }
[ "public", "static", "BasicVector", "fromMap", "(", "Map", "<", "Integer", ",", "?", "extends", "Number", ">", "map", ",", "int", "length", ")", "{", "return", "Vector", ".", "fromMap", "(", "map", ",", "length", ")", ".", "to", "(", "Vectors", ".", "BASIC", ")", ";", "}" ]
Creates new {@link BasicVector} from index-value map @param map index-value map @param length vector length @return created vector
[ "Creates", "new", "{", "@link", "BasicVector", "}", "from", "index", "-", "value", "map" ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/vector/dense/BasicVector.java#L189-L191
m-m-m/util
exception/src/main/java/net/sf/mmm/util/exception/api/NlsNullPointerException.java
NlsNullPointerException.checkNotNull
public static void checkNotNull(String objectName, Object object) throws NlsNullPointerException { if (object == null) { throw new NlsNullPointerException(objectName); } }
java
public static void checkNotNull(String objectName, Object object) throws NlsNullPointerException { if (object == null) { throw new NlsNullPointerException(objectName); } }
[ "public", "static", "void", "checkNotNull", "(", "String", "objectName", ",", "Object", "object", ")", "throws", "NlsNullPointerException", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NlsNullPointerException", "(", "objectName", ")", ";", "}", "}" ]
This method checks if the given {@code object} is {@code null}. <br> Look at the following example: <pre> {@link NlsNullPointerException}.checkNotNull("someParameter", someParameter); </pre> This is equivalent to this code: <pre> if (someParameter == null) { throw new {@link NlsNullPointerException}("someParameter"); } </pre> @param objectName is the (argument-)name of the given {@code object}. @param object is the object that is checked and should NOT be {@code null}. @throws NlsNullPointerException if the given {@code object} is {@code null}. @since 2.0.0
[ "This", "method", "checks", "if", "the", "given", "{", "@code", "object", "}", "is", "{", "@code", "null", "}", ".", "<br", ">", "Look", "at", "the", "following", "example", ":" ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/exception/src/main/java/net/sf/mmm/util/exception/api/NlsNullPointerException.java#L102-L107
lucee/Lucee
core/src/main/java/lucee/runtime/converter/JSConverter.java
JSConverter._serializeQuery
private void _serializeQuery(String name, Query query, StringBuilder sb, Set<Object> done) throws ConverterException { if (useWDDX) _serializeWDDXQuery(name, query, sb, done); else _serializeASQuery(name, query, sb, done); }
java
private void _serializeQuery(String name, Query query, StringBuilder sb, Set<Object> done) throws ConverterException { if (useWDDX) _serializeWDDXQuery(name, query, sb, done); else _serializeASQuery(name, query, sb, done); }
[ "private", "void", "_serializeQuery", "(", "String", "name", ",", "Query", "query", ",", "StringBuilder", "sb", ",", "Set", "<", "Object", ">", "done", ")", "throws", "ConverterException", "{", "if", "(", "useWDDX", ")", "_serializeWDDXQuery", "(", "name", ",", "query", ",", "sb", ",", "done", ")", ";", "else", "_serializeASQuery", "(", "name", ",", "query", ",", "sb", ",", "done", ")", ";", "}" ]
serialize a Query @param query Query to serialize @param done @return serialized query @throws ConverterException
[ "serialize", "a", "Query" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/JSConverter.java#L267-L270
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/dialogs/ListSelectDialog.java
ListSelectDialog.showDialog
public static <T> T showDialog(WindowBasedTextGUI textGUI, String title, String description, TerminalSize listBoxSize, T... items) { ListSelectDialog<T> listSelectDialog = new ListSelectDialogBuilder<T>() .setTitle(title) .setDescription(description) .setListBoxSize(listBoxSize) .addListItems(items) .build(); return listSelectDialog.showDialog(textGUI); }
java
public static <T> T showDialog(WindowBasedTextGUI textGUI, String title, String description, TerminalSize listBoxSize, T... items) { ListSelectDialog<T> listSelectDialog = new ListSelectDialogBuilder<T>() .setTitle(title) .setDescription(description) .setListBoxSize(listBoxSize) .addListItems(items) .build(); return listSelectDialog.showDialog(textGUI); }
[ "public", "static", "<", "T", ">", "T", "showDialog", "(", "WindowBasedTextGUI", "textGUI", ",", "String", "title", ",", "String", "description", ",", "TerminalSize", "listBoxSize", ",", "T", "...", "items", ")", "{", "ListSelectDialog", "<", "T", ">", "listSelectDialog", "=", "new", "ListSelectDialogBuilder", "<", "T", ">", "(", ")", ".", "setTitle", "(", "title", ")", ".", "setDescription", "(", "description", ")", ".", "setListBoxSize", "(", "listBoxSize", ")", ".", "addListItems", "(", "items", ")", ".", "build", "(", ")", ";", "return", "listSelectDialog", ".", "showDialog", "(", "textGUI", ")", ";", "}" ]
Shortcut for quickly creating a new dialog @param textGUI Text GUI to add the dialog to @param title Title of the dialog @param description Description of the dialog @param listBoxSize Maximum size of the list box, scrollbars will be used if the items cannot fit @param items Items in the dialog @param <T> Type of items in the dialog @return The selected item or {@code null} if cancelled
[ "Shortcut", "for", "quickly", "creating", "a", "new", "dialog" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/dialogs/ListSelectDialog.java#L161-L169
filestack/filestack-android
filestack/src/main/java/com/filestack/android/internal/Util.java
Util.initializeClient
public static void initializeClient(Config config, String sessionToken) { // Override returnUrl until introduction of FilestackUi class which will allow to set this // all up manually. Config overridenConfig = new Config(config.getApiKey(), "filestack://done", config.getPolicy(), config.getSignature()); client = new Client(overridenConfig); client.setSessionToken(sessionToken); }
java
public static void initializeClient(Config config, String sessionToken) { // Override returnUrl until introduction of FilestackUi class which will allow to set this // all up manually. Config overridenConfig = new Config(config.getApiKey(), "filestack://done", config.getPolicy(), config.getSignature()); client = new Client(overridenConfig); client.setSessionToken(sessionToken); }
[ "public", "static", "void", "initializeClient", "(", "Config", "config", ",", "String", "sessionToken", ")", "{", "// Override returnUrl until introduction of FilestackUi class which will allow to set this", "// all up manually.", "Config", "overridenConfig", "=", "new", "Config", "(", "config", ".", "getApiKey", "(", ")", ",", "\"filestack://done\"", ",", "config", ".", "getPolicy", "(", ")", ",", "config", ".", "getSignature", "(", ")", ")", ";", "client", "=", "new", "Client", "(", "overridenConfig", ")", ";", "client", ".", "setSessionToken", "(", "sessionToken", ")", ";", "}" ]
Create the Java SDK client and set a session token. The token maintains cloud auth state.
[ "Create", "the", "Java", "SDK", "client", "and", "set", "a", "session", "token", ".", "The", "token", "maintains", "cloud", "auth", "state", "." ]
train
https://github.com/filestack/filestack-android/blob/8dafa1cb5c77542c351d631be0742717b5a9d45d/filestack/src/main/java/com/filestack/android/internal/Util.java#L206-L214
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java
JacksonUtils.readJson
public static JsonNode readJson(String source, ClassLoader classLoader) { return SerializationUtils.readJson(source, classLoader); }
java
public static JsonNode readJson(String source, ClassLoader classLoader) { return SerializationUtils.readJson(source, classLoader); }
[ "public", "static", "JsonNode", "readJson", "(", "String", "source", ",", "ClassLoader", "classLoader", ")", "{", "return", "SerializationUtils", ".", "readJson", "(", "source", ",", "classLoader", ")", ";", "}" ]
Read a JSON string and parse to {@link JsonNode} instance, with a custom class loader. @param source @param classLoader @return
[ "Read", "a", "JSON", "string", "and", "parse", "to", "{", "@link", "JsonNode", "}", "instance", "with", "a", "custom", "class", "loader", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L117-L119
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatStreamReader.java
MapFlatStreamReader.copyStreamDescriptorWithSequence
private static StreamDescriptor copyStreamDescriptorWithSequence(StreamDescriptor streamDescriptor, int sequence) { List<StreamDescriptor> streamDescriptors = streamDescriptor.getNestedStreams().stream() .map(stream -> copyStreamDescriptorWithSequence(stream, sequence)) .collect(toImmutableList()); return new StreamDescriptor( streamDescriptor.getStreamName(), streamDescriptor.getStreamId(), streamDescriptor.getFieldName(), streamDescriptor.getStreamType(), streamDescriptor.getOrcDataSource(), streamDescriptors, sequence); }
java
private static StreamDescriptor copyStreamDescriptorWithSequence(StreamDescriptor streamDescriptor, int sequence) { List<StreamDescriptor> streamDescriptors = streamDescriptor.getNestedStreams().stream() .map(stream -> copyStreamDescriptorWithSequence(stream, sequence)) .collect(toImmutableList()); return new StreamDescriptor( streamDescriptor.getStreamName(), streamDescriptor.getStreamId(), streamDescriptor.getFieldName(), streamDescriptor.getStreamType(), streamDescriptor.getOrcDataSource(), streamDescriptors, sequence); }
[ "private", "static", "StreamDescriptor", "copyStreamDescriptorWithSequence", "(", "StreamDescriptor", "streamDescriptor", ",", "int", "sequence", ")", "{", "List", "<", "StreamDescriptor", ">", "streamDescriptors", "=", "streamDescriptor", ".", "getNestedStreams", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "stream", "->", "copyStreamDescriptorWithSequence", "(", "stream", ",", "sequence", ")", ")", ".", "collect", "(", "toImmutableList", "(", ")", ")", ";", "return", "new", "StreamDescriptor", "(", "streamDescriptor", ".", "getStreamName", "(", ")", ",", "streamDescriptor", ".", "getStreamId", "(", ")", ",", "streamDescriptor", ".", "getFieldName", "(", ")", ",", "streamDescriptor", ".", "getStreamType", "(", ")", ",", "streamDescriptor", ".", "getOrcDataSource", "(", ")", ",", "streamDescriptors", ",", "sequence", ")", ";", "}" ]
Creates StreamDescriptor which is a copy of this one with the value of sequence changed to the value passed in. Recursively calls itself on the nested streams.
[ "Creates", "StreamDescriptor", "which", "is", "a", "copy", "of", "this", "one", "with", "the", "value", "of", "sequence", "changed", "to", "the", "value", "passed", "in", ".", "Recursively", "calls", "itself", "on", "the", "nested", "streams", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatStreamReader.java#L263-L277
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.getHybridConnection
public HybridConnectionInner getHybridConnection(String resourceGroupName, String name, String namespaceName, String relayName) { return getHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).toBlocking().single().body(); }
java
public HybridConnectionInner getHybridConnection(String resourceGroupName, String name, String namespaceName, String relayName) { return getHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).toBlocking().single().body(); }
[ "public", "HybridConnectionInner", "getHybridConnection", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "namespaceName", ",", "String", "relayName", ")", "{", "return", "getHybridConnectionWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "namespaceName", ",", "relayName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Retrieve a Hybrid Connection in use in an App Service plan. Retrieve a Hybrid Connection in use in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param namespaceName Name of the Service Bus namespace. @param relayName Name of the Service Bus relay. @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 HybridConnectionInner object if successful.
[ "Retrieve", "a", "Hybrid", "Connection", "in", "use", "in", "an", "App", "Service", "plan", ".", "Retrieve", "a", "Hybrid", "Connection", "in", "use", "in", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1135-L1137
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
TransactionableDataManager.getItemData
public ItemData getItemData(String identifier, boolean checkChangesLogOnly) throws RepositoryException { if (txStarted()) { ItemState state = transactionLog.getItemState(identifier); if (state != null) { return state.isDeleted() ? null : state.getData(); } } return (checkChangesLogOnly) ? null: storageDataManager.getItemData(identifier); }
java
public ItemData getItemData(String identifier, boolean checkChangesLogOnly) throws RepositoryException { if (txStarted()) { ItemState state = transactionLog.getItemState(identifier); if (state != null) { return state.isDeleted() ? null : state.getData(); } } return (checkChangesLogOnly) ? null: storageDataManager.getItemData(identifier); }
[ "public", "ItemData", "getItemData", "(", "String", "identifier", ",", "boolean", "checkChangesLogOnly", ")", "throws", "RepositoryException", "{", "if", "(", "txStarted", "(", ")", ")", "{", "ItemState", "state", "=", "transactionLog", ".", "getItemState", "(", "identifier", ")", ";", "if", "(", "state", "!=", "null", ")", "{", "return", "state", ".", "isDeleted", "(", ")", "?", "null", ":", "state", ".", "getData", "(", ")", ";", "}", "}", "return", "(", "checkChangesLogOnly", ")", "?", "null", ":", "storageDataManager", ".", "getItemData", "(", "identifier", ")", ";", "}" ]
Return item data by identifier in this transient storage then in storage container. @param identifier @param checkChangesLogOnly @return existed item data or null if not found @throws RepositoryException @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getItemData(java.lang.String)
[ "Return", "item", "data", "by", "identifier", "in", "this", "transient", "storage", "then", "in", "storage", "container", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java#L389-L402
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/cp/CPSubsystemConfig.java
CPSubsystemConfig.setSemaphoreConfigs
public CPSubsystemConfig setSemaphoreConfigs(Map<String, CPSemaphoreConfig> cpSemaphoreConfigs) { this.semaphoreConfigs.clear(); this.semaphoreConfigs.putAll(cpSemaphoreConfigs); for (Entry<String, CPSemaphoreConfig> entry : this.semaphoreConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public CPSubsystemConfig setSemaphoreConfigs(Map<String, CPSemaphoreConfig> cpSemaphoreConfigs) { this.semaphoreConfigs.clear(); this.semaphoreConfigs.putAll(cpSemaphoreConfigs); for (Entry<String, CPSemaphoreConfig> entry : this.semaphoreConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "CPSubsystemConfig", "setSemaphoreConfigs", "(", "Map", "<", "String", ",", "CPSemaphoreConfig", ">", "cpSemaphoreConfigs", ")", "{", "this", ".", "semaphoreConfigs", ".", "clear", "(", ")", ";", "this", ".", "semaphoreConfigs", ".", "putAll", "(", "cpSemaphoreConfigs", ")", ";", "for", "(", "Entry", "<", "String", ",", "CPSemaphoreConfig", ">", "entry", ":", "this", ".", "semaphoreConfigs", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setName", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Sets the map of CP {@link ISemaphore} configurations, mapped by config name. Names could optionally contain a {@link CPGroup} name, such as "mySemaphore@group1". @param cpSemaphoreConfigs the CP {@link ISemaphore} config map to set @return this config instance
[ "Sets", "the", "map", "of", "CP", "{", "@link", "ISemaphore", "}", "configurations", "mapped", "by", "config", "name", ".", "Names", "could", "optionally", "contain", "a", "{", "@link", "CPGroup", "}", "name", "such", "as", "mySemaphore@group1", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/cp/CPSubsystemConfig.java#L491-L498
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsADEManager.java
CmsADEManager.getRootPath
protected String getRootPath(CmsUUID structureId, boolean online) throws CmsException { CmsConfigurationCache cache = online ? m_onlineCache : m_offlineCache; return cache.getPathForStructureId(structureId); }
java
protected String getRootPath(CmsUUID structureId, boolean online) throws CmsException { CmsConfigurationCache cache = online ? m_onlineCache : m_offlineCache; return cache.getPathForStructureId(structureId); }
[ "protected", "String", "getRootPath", "(", "CmsUUID", "structureId", ",", "boolean", "online", ")", "throws", "CmsException", "{", "CmsConfigurationCache", "cache", "=", "online", "?", "m_onlineCache", ":", "m_offlineCache", ";", "return", "cache", ".", "getPathForStructureId", "(", "structureId", ")", ";", "}" ]
Gets the root path for a given resource structure id.<p> @param structureId the structure id @param online if true, the resource will be looked up in the online project ,else in the offline project @return the root path for the given structure id @throws CmsException if something goes wrong
[ "Gets", "the", "root", "path", "for", "a", "given", "resource", "structure", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L1426-L1430
thombergs/docx-stamper
src/main/java/org/wickedsource/docxstamper/DocxStamperConfiguration.java
DocxStamperConfiguration.addTypeResolver
public <T> DocxStamperConfiguration addTypeResolver(Class<T> resolvedType, ITypeResolver resolver) { this.typeResolvers.put(resolvedType, resolver); return this; }
java
public <T> DocxStamperConfiguration addTypeResolver(Class<T> resolvedType, ITypeResolver resolver) { this.typeResolvers.put(resolvedType, resolver); return this; }
[ "public", "<", "T", ">", "DocxStamperConfiguration", "addTypeResolver", "(", "Class", "<", "T", ">", "resolvedType", ",", "ITypeResolver", "resolver", ")", "{", "this", ".", "typeResolvers", ".", "put", "(", "resolvedType", ",", "resolver", ")", ";", "return", "this", ";", "}" ]
<p> Registers the given ITypeResolver for the given class. The registered ITypeResolver's resolve() method will only be called with objects of the specified class. </p> <p> Note that each type can only be resolved by ONE ITypeResolver implementation. Multiple calls to addTypeResolver() with the same resolvedType parameter will override earlier calls. </p> @param resolvedType the class whose objects are to be passed to the given ITypeResolver. @param resolver the resolver to resolve objects of the given type. @param <T> the type resolved by the ITypeResolver.
[ "<p", ">", "Registers", "the", "given", "ITypeResolver", "for", "the", "given", "class", ".", "The", "registered", "ITypeResolver", "s", "resolve", "()", "method", "will", "only", "be", "called", "with", "objects", "of", "the", "specified", "class", ".", "<", "/", "p", ">", "<p", ">", "Note", "that", "each", "type", "can", "only", "be", "resolved", "by", "ONE", "ITypeResolver", "implementation", ".", "Multiple", "calls", "to", "addTypeResolver", "()", "with", "the", "same", "resolvedType", "parameter", "will", "override", "earlier", "calls", ".", "<", "/", "p", ">" ]
train
https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/DocxStamperConfiguration.java#L95-L98
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateIntent
public OperationStatus updateIntent(UUID appId, String versionId, UUID intentId, UpdateIntentOptionalParameter updateIntentOptionalParameter) { return updateIntentWithServiceResponseAsync(appId, versionId, intentId, updateIntentOptionalParameter).toBlocking().single().body(); }
java
public OperationStatus updateIntent(UUID appId, String versionId, UUID intentId, UpdateIntentOptionalParameter updateIntentOptionalParameter) { return updateIntentWithServiceResponseAsync(appId, versionId, intentId, updateIntentOptionalParameter).toBlocking().single().body(); }
[ "public", "OperationStatus", "updateIntent", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "intentId", ",", "UpdateIntentOptionalParameter", "updateIntentOptionalParameter", ")", "{", "return", "updateIntentWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "intentId", ",", "updateIntentOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates the name of an intent classifier. @param appId The application ID. @param versionId The version ID. @param intentId The intent classifier ID. @param updateIntentOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Updates", "the", "name", "of", "an", "intent", "classifier", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2911-L2913
headius/invokebinder
src/main/java/com/headius/invokebinder/Binder.java
Binder.collect
public Binder collect(int index, Class<?> type) { return new Binder(this, new Collect(type(), index, type)); }
java
public Binder collect(int index, Class<?> type) { return new Binder(this, new Collect(type(), index, type)); }
[ "public", "Binder", "collect", "(", "int", "index", ",", "Class", "<", "?", ">", "type", ")", "{", "return", "new", "Binder", "(", "this", ",", "new", "Collect", "(", "type", "(", ")", ",", "index", ",", "type", ")", ")", ";", "}" ]
Box all incoming arguments from the given position onward into the given array type. @param index the index from which to start boxing args @param type the array type into which the args will be boxed @return a new Binder
[ "Box", "all", "incoming", "arguments", "from", "the", "given", "position", "onward", "into", "the", "given", "array", "type", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L879-L881
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/v1/DbxClientV1.java
DbxClientV1.getMetadataWithChildrenIfChangedC
public <C> Maybe<DbxEntry./*@Nullable*/WithChildrenC<C>> getMetadataWithChildrenIfChangedC( String path, boolean includeMediaInfo, /*@Nullable*/String previousFolderHash, Collector<DbxEntry,? extends C> collector) throws DbxException { return getMetadataWithChildrenIfChangedBase(path, includeMediaInfo, previousFolderHash, new DbxEntry.WithChildrenC.ReaderMaybeDeleted<C>(collector)); }
java
public <C> Maybe<DbxEntry./*@Nullable*/WithChildrenC<C>> getMetadataWithChildrenIfChangedC( String path, boolean includeMediaInfo, /*@Nullable*/String previousFolderHash, Collector<DbxEntry,? extends C> collector) throws DbxException { return getMetadataWithChildrenIfChangedBase(path, includeMediaInfo, previousFolderHash, new DbxEntry.WithChildrenC.ReaderMaybeDeleted<C>(collector)); }
[ "public", "<", "C", ">", "Maybe", "<", "DbxEntry", ".", "/*@Nullable*/", "WithChildrenC", "<", "C", ">", ">", "getMetadataWithChildrenIfChangedC", "(", "String", "path", ",", "boolean", "includeMediaInfo", ",", "/*@Nullable*/", "String", "previousFolderHash", ",", "Collector", "<", "DbxEntry", ",", "?", "extends", "C", ">", "collector", ")", "throws", "DbxException", "{", "return", "getMetadataWithChildrenIfChangedBase", "(", "path", ",", "includeMediaInfo", ",", "previousFolderHash", ",", "new", "DbxEntry", ".", "WithChildrenC", ".", "ReaderMaybeDeleted", "<", "C", ">", "(", "collector", ")", ")", ";", "}" ]
Same as {@link #getMetadataWithChildrenIfChanged} except instead of always returning a list of {@link DbxEntry} objects, you specify a {@link Collector} that processes the {@link DbxEntry} objects one by one and aggregates them however you want. <p> This allows your to process the {@link DbxEntry} values as they arrive, instead of having to wait for the entire API call to finish before processing the first one. Be careful, though, because the API call may fail in the middle (after you've already processed some entries). Make sure your code can handle that situation. For example, if you're inserting stuff into a database as they arrive, you might want do everything in a transaction and commit only if the entire call succeeds. </p>
[ "Same", "as", "{", "@link", "#getMetadataWithChildrenIfChanged", "}", "except", "instead", "of", "always", "returning", "a", "list", "of", "{", "@link", "DbxEntry", "}", "objects", "you", "specify", "a", "{", "@link", "Collector", "}", "that", "processes", "the", "{", "@link", "DbxEntry", "}", "objects", "one", "by", "one", "and", "aggregates", "them", "however", "you", "want", "." ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L294-L299
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.spare_spare_GET
public OvhXdslSpare spare_spare_GET(String spare) throws IOException { String qPath = "/xdsl/spare/{spare}"; StringBuilder sb = path(qPath, spare); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhXdslSpare.class); }
java
public OvhXdslSpare spare_spare_GET(String spare) throws IOException { String qPath = "/xdsl/spare/{spare}"; StringBuilder sb = path(qPath, spare); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhXdslSpare.class); }
[ "public", "OvhXdslSpare", "spare_spare_GET", "(", "String", "spare", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/spare/{spare}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "spare", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhXdslSpare", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /xdsl/spare/{spare} @param spare [required] The internal name of your spare
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L2083-L2088
protostuff/protostuff
protostuff-core/src/main/java/io/protostuff/CodedInput.java
CodedInput.readRawVarint32
static int readRawVarint32(final InputStream input) throws IOException { final int firstByte = input.read(); if (firstByte == -1) { throw ProtobufException.truncatedMessage(); } if ((firstByte & 0x80) == 0) { return firstByte; } return readRawVarint32(input, firstByte); }
java
static int readRawVarint32(final InputStream input) throws IOException { final int firstByte = input.read(); if (firstByte == -1) { throw ProtobufException.truncatedMessage(); } if ((firstByte & 0x80) == 0) { return firstByte; } return readRawVarint32(input, firstByte); }
[ "static", "int", "readRawVarint32", "(", "final", "InputStream", "input", ")", "throws", "IOException", "{", "final", "int", "firstByte", "=", "input", ".", "read", "(", ")", ";", "if", "(", "firstByte", "==", "-", "1", ")", "{", "throw", "ProtobufException", ".", "truncatedMessage", "(", ")", ";", "}", "if", "(", "(", "firstByte", "&", "0x80", ")", "==", "0", ")", "{", "return", "firstByte", ";", "}", "return", "readRawVarint32", "(", "input", ",", "firstByte", ")", ";", "}" ]
Reads a varint from the input one byte at a time, so that it does not read any bytes after the end of the varint. If you simply wrapped the stream in a CodedInput and used {@link #readRawVarint32(InputStream)} then you would probably end up reading past the end of the varint since CodedInput buffers its input.
[ "Reads", "a", "varint", "from", "the", "input", "one", "byte", "at", "a", "time", "so", "that", "it", "does", "not", "read", "any", "bytes", "after", "the", "end", "of", "the", "varint", ".", "If", "you", "simply", "wrapped", "the", "stream", "in", "a", "CodedInput", "and", "used", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-core/src/main/java/io/protostuff/CodedInput.java#L529-L542
VoltDB/voltdb
src/frontend/org/voltdb/compiler/ClassMatcher.java
ClassMatcher.processPathPart
private static void processPathPart(String path, Set<String> classes) { File rootFile = new File(path); if (rootFile.isDirectory() == false) { return; } File[] files = rootFile.listFiles(); for (File f : files) { // classes in the anonymous package if (f.getName().endsWith(".class")) { String className = f.getName(); // trim the trailing .class from the end className = className.substring(0, className.length() - ".class".length()); classes.add(className); } if (f.isDirectory()) { Package p = new Package(null, f); p.process(classes); } } }
java
private static void processPathPart(String path, Set<String> classes) { File rootFile = new File(path); if (rootFile.isDirectory() == false) { return; } File[] files = rootFile.listFiles(); for (File f : files) { // classes in the anonymous package if (f.getName().endsWith(".class")) { String className = f.getName(); // trim the trailing .class from the end className = className.substring(0, className.length() - ".class".length()); classes.add(className); } if (f.isDirectory()) { Package p = new Package(null, f); p.process(classes); } } }
[ "private", "static", "void", "processPathPart", "(", "String", "path", ",", "Set", "<", "String", ">", "classes", ")", "{", "File", "rootFile", "=", "new", "File", "(", "path", ")", ";", "if", "(", "rootFile", ".", "isDirectory", "(", ")", "==", "false", ")", "{", "return", ";", "}", "File", "[", "]", "files", "=", "rootFile", ".", "listFiles", "(", ")", ";", "for", "(", "File", "f", ":", "files", ")", "{", "// classes in the anonymous package", "if", "(", "f", ".", "getName", "(", ")", ".", "endsWith", "(", "\".class\"", ")", ")", "{", "String", "className", "=", "f", ".", "getName", "(", ")", ";", "// trim the trailing .class from the end", "className", "=", "className", ".", "substring", "(", "0", ",", "className", ".", "length", "(", ")", "-", "\".class\"", ".", "length", "(", ")", ")", ";", "classes", ".", "add", "(", "className", ")", ";", "}", "if", "(", "f", ".", "isDirectory", "(", ")", ")", "{", "Package", "p", "=", "new", "Package", "(", "null", ",", "f", ")", ";", "p", ".", "process", "(", "classes", ")", ";", "}", "}", "}" ]
For a given classpath root, scan it for packages and classes, adding all found classnames to the given "classes" param.
[ "For", "a", "given", "classpath", "root", "scan", "it", "for", "packages", "and", "classes", "adding", "all", "found", "classnames", "to", "the", "given", "classes", "param", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/ClassMatcher.java#L177-L197
alkacon/opencms-core
src/org/opencms/ui/apps/searchindex/CmsSearchIndexTable.java
CmsSearchIndexTable.onItemClick
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) { if (!event.isCtrlKey() && !event.isShiftKey()) { changeValueIfNotMultiSelect(itemId); // don't interfere with multi-selection using control key if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) { m_menu.setEntries(getMenuEntries(), getSearchIndexNames()); m_menu.openForTable(event, itemId, propertyId, this); } else if (event.getButton().equals(MouseButton.LEFT) && TableProperty.Name.equals(propertyId)) { showSourcesWindow(((I_CmsSearchIndex)((Set<?>)getValue()).iterator().next()).getName()); } } }
java
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) { if (!event.isCtrlKey() && !event.isShiftKey()) { changeValueIfNotMultiSelect(itemId); // don't interfere with multi-selection using control key if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) { m_menu.setEntries(getMenuEntries(), getSearchIndexNames()); m_menu.openForTable(event, itemId, propertyId, this); } else if (event.getButton().equals(MouseButton.LEFT) && TableProperty.Name.equals(propertyId)) { showSourcesWindow(((I_CmsSearchIndex)((Set<?>)getValue()).iterator().next()).getName()); } } }
[ "void", "onItemClick", "(", "MouseEvents", ".", "ClickEvent", "event", ",", "Object", "itemId", ",", "Object", "propertyId", ")", "{", "if", "(", "!", "event", ".", "isCtrlKey", "(", ")", "&&", "!", "event", ".", "isShiftKey", "(", ")", ")", "{", "changeValueIfNotMultiSelect", "(", "itemId", ")", ";", "// don't interfere with multi-selection using control key", "if", "(", "event", ".", "getButton", "(", ")", ".", "equals", "(", "MouseButton", ".", "RIGHT", ")", "||", "(", "propertyId", "==", "null", ")", ")", "{", "m_menu", ".", "setEntries", "(", "getMenuEntries", "(", ")", ",", "getSearchIndexNames", "(", ")", ")", ";", "m_menu", ".", "openForTable", "(", "event", ",", "itemId", ",", "propertyId", ",", "this", ")", ";", "}", "else", "if", "(", "event", ".", "getButton", "(", ")", ".", "equals", "(", "MouseButton", ".", "LEFT", ")", "&&", "TableProperty", ".", "Name", ".", "equals", "(", "propertyId", ")", ")", "{", "showSourcesWindow", "(", "(", "(", "I_CmsSearchIndex", ")", "(", "(", "Set", "<", "?", ">", ")", "getValue", "(", ")", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ")", ".", "getName", "(", ")", ")", ";", "}", "}", "}" ]
Handles the table item clicks, including clicks on images inside of a table item.<p> @param event the click event @param itemId of the clicked row @param propertyId column id
[ "Handles", "the", "table", "item", "clicks", "including", "clicks", "on", "images", "inside", "of", "a", "table", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/searchindex/CmsSearchIndexTable.java#L387-L401
VoltDB/voltdb
src/frontend/org/voltdb/compiler/VoltDDLElementTracker.java
VoltDDLElementTracker.removeProcedure
public void removeProcedure(String procName, boolean ifExists) throws VoltCompilerException { assert procName != null && ! procName.trim().isEmpty(); String shortName = deriveShortProcedureName(procName); if( m_procedureMap.containsKey(shortName)) { m_procedureMap.remove(shortName); } else if (!ifExists) { throw m_compiler.new VoltCompilerException(String.format( "Dropped Procedure \"%s\" is not defined", procName)); } }
java
public void removeProcedure(String procName, boolean ifExists) throws VoltCompilerException { assert procName != null && ! procName.trim().isEmpty(); String shortName = deriveShortProcedureName(procName); if( m_procedureMap.containsKey(shortName)) { m_procedureMap.remove(shortName); } else if (!ifExists) { throw m_compiler.new VoltCompilerException(String.format( "Dropped Procedure \"%s\" is not defined", procName)); } }
[ "public", "void", "removeProcedure", "(", "String", "procName", ",", "boolean", "ifExists", ")", "throws", "VoltCompilerException", "{", "assert", "procName", "!=", "null", "&&", "!", "procName", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ";", "String", "shortName", "=", "deriveShortProcedureName", "(", "procName", ")", ";", "if", "(", "m_procedureMap", ".", "containsKey", "(", "shortName", ")", ")", "{", "m_procedureMap", ".", "remove", "(", "shortName", ")", ";", "}", "else", "if", "(", "!", "ifExists", ")", "{", "throw", "m_compiler", ".", "new", "VoltCompilerException", "(", "String", ".", "format", "(", "\"Dropped Procedure \\\"%s\\\" is not defined\"", ",", "procName", ")", ")", ";", "}", "}" ]
Searches for and removes the Procedure provided in prior DDL statements @param Name of procedure being removed @throws VoltCompilerException if the procedure does not exist
[ "Searches", "for", "and", "removes", "the", "Procedure", "provided", "in", "prior", "DDL", "statements" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltDDLElementTracker.java#L129-L142
geomajas/geomajas-project-client-gwt2
common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImpl.java
DomImpl.disAssembleId
public String disAssembleId(String id, String... suffixes) { int count = 0; for (String s : suffixes) { count += s.length() + Dom.ID_SEPARATOR.length(); } return id.substring(0, id.length() - count); }
java
public String disAssembleId(String id, String... suffixes) { int count = 0; for (String s : suffixes) { count += s.length() + Dom.ID_SEPARATOR.length(); } return id.substring(0, id.length() - count); }
[ "public", "String", "disAssembleId", "(", "String", "id", ",", "String", "...", "suffixes", ")", "{", "int", "count", "=", "0", ";", "for", "(", "String", "s", ":", "suffixes", ")", "{", "count", "+=", "s", ".", "length", "(", ")", "+", "Dom", ".", "ID_SEPARATOR", ".", "length", "(", ")", ";", "}", "return", "id", ".", "substring", "(", "0", ",", "id", ".", "length", "(", ")", "-", "count", ")", ";", "}" ]
Disassemble an DOM id, removing suffixes. @param id base id @param suffixes suffixes to remove @return id
[ "Disassemble", "an", "DOM", "id", "removing", "suffixes", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImpl.java#L70-L76
Red5/red5-server-common
src/main/java/org/red5/server/api/persistence/PersistenceUtils.java
PersistenceUtils.getPersistenceStore
public static IPersistenceStore getPersistenceStore(ResourcePatternResolver resolver, String className) throws Exception { Class<?> persistenceClass = Class.forName(className); Constructor<?> constructor = getPersistenceStoreConstructor(persistenceClass, resolver.getClass().getInterfaces()); if (constructor == null) { // Search in superclasses of the object. Class<?> superClass = resolver.getClass().getSuperclass(); while (superClass != null) { constructor = getPersistenceStoreConstructor(persistenceClass, superClass.getInterfaces()); if (constructor != null) { break; } superClass = superClass.getSuperclass(); } } if (constructor == null) { throw new NoSuchMethodException(); } return (IPersistenceStore) constructor.newInstance(new Object[] { resolver }); }
java
public static IPersistenceStore getPersistenceStore(ResourcePatternResolver resolver, String className) throws Exception { Class<?> persistenceClass = Class.forName(className); Constructor<?> constructor = getPersistenceStoreConstructor(persistenceClass, resolver.getClass().getInterfaces()); if (constructor == null) { // Search in superclasses of the object. Class<?> superClass = resolver.getClass().getSuperclass(); while (superClass != null) { constructor = getPersistenceStoreConstructor(persistenceClass, superClass.getInterfaces()); if (constructor != null) { break; } superClass = superClass.getSuperclass(); } } if (constructor == null) { throw new NoSuchMethodException(); } return (IPersistenceStore) constructor.newInstance(new Object[] { resolver }); }
[ "public", "static", "IPersistenceStore", "getPersistenceStore", "(", "ResourcePatternResolver", "resolver", ",", "String", "className", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "persistenceClass", "=", "Class", ".", "forName", "(", "className", ")", ";", "Constructor", "<", "?", ">", "constructor", "=", "getPersistenceStoreConstructor", "(", "persistenceClass", ",", "resolver", ".", "getClass", "(", ")", ".", "getInterfaces", "(", ")", ")", ";", "if", "(", "constructor", "==", "null", ")", "{", "// Search in superclasses of the object.\r", "Class", "<", "?", ">", "superClass", "=", "resolver", ".", "getClass", "(", ")", ".", "getSuperclass", "(", ")", ";", "while", "(", "superClass", "!=", "null", ")", "{", "constructor", "=", "getPersistenceStoreConstructor", "(", "persistenceClass", ",", "superClass", ".", "getInterfaces", "(", ")", ")", ";", "if", "(", "constructor", "!=", "null", ")", "{", "break", ";", "}", "superClass", "=", "superClass", ".", "getSuperclass", "(", ")", ";", "}", "}", "if", "(", "constructor", "==", "null", ")", "{", "throw", "new", "NoSuchMethodException", "(", ")", ";", "}", "return", "(", "IPersistenceStore", ")", "constructor", ".", "newInstance", "(", "new", "Object", "[", "]", "{", "resolver", "}", ")", ";", "}" ]
Returns persistence store object. Persistence store is a special object that stores persistence objects and provides methods to manipulate them (save, load, remove, list). @param resolver Resolves connection pattern into Resource object @param className Name of persistence class @return IPersistence store object that provides methods for persistence object handling @throws Exception if error
[ "Returns", "persistence", "store", "object", ".", "Persistence", "store", "is", "a", "special", "object", "that", "stores", "persistence", "objects", "and", "provides", "methods", "to", "manipulate", "them", "(", "save", "load", "remove", "list", ")", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/api/persistence/PersistenceUtils.java#L73-L91
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/KnapsackDecorator.java
KnapsackDecorator.postAssignItem
public void postAssignItem(int item, int bin) throws ContradictionException { if (!candidate.get(bin).get(item)) { return; } candidate.get(bin).clear(item); for (int d = 0; d < prop.nbDims; d++) { knapsack(bin, d); // The bin is full. We get rid of every candidate and set the bin load. if (prop.loads[d][bin].getUB() == prop.assignedLoad[d][bin].get()) { filterFullDim(bin, d); if (candidate.get(bin).isEmpty()) { for (int d2 = 0; d2 < prop.nbDims; d2++) { prop.potentialLoad[d2][bin].set(prop.assignedLoad[d2][bin].get()); prop.filterLoadSup(d2, bin, prop.potentialLoad[d2][bin].get()); } return; } return; } } }
java
public void postAssignItem(int item, int bin) throws ContradictionException { if (!candidate.get(bin).get(item)) { return; } candidate.get(bin).clear(item); for (int d = 0; d < prop.nbDims; d++) { knapsack(bin, d); // The bin is full. We get rid of every candidate and set the bin load. if (prop.loads[d][bin].getUB() == prop.assignedLoad[d][bin].get()) { filterFullDim(bin, d); if (candidate.get(bin).isEmpty()) { for (int d2 = 0; d2 < prop.nbDims; d2++) { prop.potentialLoad[d2][bin].set(prop.assignedLoad[d2][bin].get()); prop.filterLoadSup(d2, bin, prop.potentialLoad[d2][bin].get()); } return; } return; } } }
[ "public", "void", "postAssignItem", "(", "int", "item", ",", "int", "bin", ")", "throws", "ContradictionException", "{", "if", "(", "!", "candidate", ".", "get", "(", "bin", ")", ".", "get", "(", "item", ")", ")", "{", "return", ";", "}", "candidate", ".", "get", "(", "bin", ")", ".", "clear", "(", "item", ")", ";", "for", "(", "int", "d", "=", "0", ";", "d", "<", "prop", ".", "nbDims", ";", "d", "++", ")", "{", "knapsack", "(", "bin", ",", "d", ")", ";", "// The bin is full. We get rid of every candidate and set the bin load.", "if", "(", "prop", ".", "loads", "[", "d", "]", "[", "bin", "]", ".", "getUB", "(", ")", "==", "prop", ".", "assignedLoad", "[", "d", "]", "[", "bin", "]", ".", "get", "(", ")", ")", "{", "filterFullDim", "(", "bin", ",", "d", ")", ";", "if", "(", "candidate", ".", "get", "(", "bin", ")", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "int", "d2", "=", "0", ";", "d2", "<", "prop", ".", "nbDims", ";", "d2", "++", ")", "{", "prop", ".", "potentialLoad", "[", "d2", "]", "[", "bin", "]", ".", "set", "(", "prop", ".", "assignedLoad", "[", "d2", "]", "[", "bin", "]", ".", "get", "(", ")", ")", ";", "prop", ".", "filterLoadSup", "(", "d2", ",", "bin", ",", "prop", ".", "potentialLoad", "[", "d2", "]", "[", "bin", "]", ".", "get", "(", ")", ")", ";", "}", "return", ";", "}", "return", ";", "}", "}", "}" ]
update the candidate list of a bin when an item is assigned then apply the full bin filter if sup(binLoad) is reached this function may be recursive @param item the assigned item @param bin the bin @throws ContradictionException
[ "update", "the", "candidate", "list", "of", "a", "bin", "when", "an", "item", "is", "assigned", "then", "apply", "the", "full", "bin", "filter", "if", "sup", "(", "binLoad", ")", "is", "reached", "this", "function", "may", "be", "recursive" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/KnapsackDecorator.java#L163-L186
buschmais/jqa-core-framework
shared/src/main/java/com/buschmais/jqassistant/core/shared/option/OptionHelper.java
OptionHelper.verifyDeprecatedOption
public static <T> void verifyDeprecatedOption(String deprecatedOption, T value, String option) { if (value != null) { LOGGER.warn("The option '" + deprecatedOption + "' is deprecated, use '" + option + "' instead."); } }
java
public static <T> void verifyDeprecatedOption(String deprecatedOption, T value, String option) { if (value != null) { LOGGER.warn("The option '" + deprecatedOption + "' is deprecated, use '" + option + "' instead."); } }
[ "public", "static", "<", "T", ">", "void", "verifyDeprecatedOption", "(", "String", "deprecatedOption", ",", "T", "value", ",", "String", "option", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "LOGGER", ".", "warn", "(", "\"The option '\"", "+", "deprecatedOption", "+", "\"' is deprecated, use '\"", "+", "option", "+", "\"' instead.\"", ")", ";", "}", "}" ]
Verify if a deprecated option has been used and emit a warning. @param deprecatedOption The name of the deprecated option. @param value The provided value. @param option The option to use. @param <T> The value type.
[ "Verify", "if", "a", "deprecated", "option", "has", "been", "used", "and", "emit", "a", "warning", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/shared/src/main/java/com/buschmais/jqassistant/core/shared/option/OptionHelper.java#L46-L50
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPOutputStream.java
GZIPOutputStream.writeInt
private void writeInt(int i, byte[] buf, int offset) throws IOException { writeShort(i & 0xffff, buf, offset); writeShort((i >> 16) & 0xffff, buf, offset + 2); }
java
private void writeInt(int i, byte[] buf, int offset) throws IOException { writeShort(i & 0xffff, buf, offset); writeShort((i >> 16) & 0xffff, buf, offset + 2); }
[ "private", "void", "writeInt", "(", "int", "i", ",", "byte", "[", "]", "buf", ",", "int", "offset", ")", "throws", "IOException", "{", "writeShort", "(", "i", "&", "0xffff", ",", "buf", ",", "offset", ")", ";", "writeShort", "(", "(", "i", ">>", "16", ")", "&", "0xffff", ",", "buf", ",", "offset", "+", "2", ")", ";", "}" ]
/* Writes integer in Intel byte order to a byte array, starting at a given offset.
[ "/", "*", "Writes", "integer", "in", "Intel", "byte", "order", "to", "a", "byte", "array", "starting", "at", "a", "given", "offset", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPOutputStream.java#L209-L212
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/CollidableUpdater.java
CollidableUpdater.checkCollide
private static boolean checkCollide(Area area, Collidable other) { final List<Rectangle> others = other.getCollisionBounds(); final int size = others.size(); for (int i = 0; i < size; i++) { final Area current = others.get(i); if (area.intersects(current)) { return true; } } return false; }
java
private static boolean checkCollide(Area area, Collidable other) { final List<Rectangle> others = other.getCollisionBounds(); final int size = others.size(); for (int i = 0; i < size; i++) { final Area current = others.get(i); if (area.intersects(current)) { return true; } } return false; }
[ "private", "static", "boolean", "checkCollide", "(", "Area", "area", ",", "Collidable", "other", ")", "{", "final", "List", "<", "Rectangle", ">", "others", "=", "other", ".", "getCollisionBounds", "(", ")", ";", "final", "int", "size", "=", "others", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "final", "Area", "current", "=", "others", ".", "get", "(", "i", ")", ";", "if", "(", "area", ".", "intersects", "(", "current", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if current area collides other collidable area. @param area The current area. @param other The other collidable. @return <code>true</code> if collide, <code>false</code> else.
[ "Check", "if", "current", "area", "collides", "other", "collidable", "area", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/CollidableUpdater.java#L102-L115
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/JsonReader.java
JsonReader.readMultiple
public DocumentSequence readMultiple( Reader reader, boolean introspectStringValues ) { // Create an object so that this reader is thread safe ... final Tokenizer tokenizer = new Tokenizer(reader); ValueMatcher matcher = introspectStringValues ? DATE_VALUE_MATCHER : SIMPLE_VALUE_MATCHER; final Parser parser = new Parser(tokenizer, VALUE_FACTORY, matcher); return () -> { if (tokenizer.isFinished()) return null; Document doc = parser.parseDocument(false); // System.out.println(Json.writePretty(doc)); return doc; }; }
java
public DocumentSequence readMultiple( Reader reader, boolean introspectStringValues ) { // Create an object so that this reader is thread safe ... final Tokenizer tokenizer = new Tokenizer(reader); ValueMatcher matcher = introspectStringValues ? DATE_VALUE_MATCHER : SIMPLE_VALUE_MATCHER; final Parser parser = new Parser(tokenizer, VALUE_FACTORY, matcher); return () -> { if (tokenizer.isFinished()) return null; Document doc = parser.parseDocument(false); // System.out.println(Json.writePretty(doc)); return doc; }; }
[ "public", "DocumentSequence", "readMultiple", "(", "Reader", "reader", ",", "boolean", "introspectStringValues", ")", "{", "// Create an object so that this reader is thread safe ...", "final", "Tokenizer", "tokenizer", "=", "new", "Tokenizer", "(", "reader", ")", ";", "ValueMatcher", "matcher", "=", "introspectStringValues", "?", "DATE_VALUE_MATCHER", ":", "SIMPLE_VALUE_MATCHER", ";", "final", "Parser", "parser", "=", "new", "Parser", "(", "tokenizer", ",", "VALUE_FACTORY", ",", "matcher", ")", ";", "return", "(", ")", "->", "{", "if", "(", "tokenizer", ".", "isFinished", "(", ")", ")", "return", "null", ";", "Document", "doc", "=", "parser", ".", "parseDocument", "(", "false", ")", ";", "// System.out.println(Json.writePretty(doc));", "return", "doc", ";", "}", ";", "}" ]
Return a {@link DocumentSequence} that can be used to pull multiple documents from the stream. @param reader the IO reader; may not be null @param introspectStringValues true if the string values should be examined for common patterns, or false otherwise @return the sequence that can be used to get one or more Document instances from a single input
[ "Return", "a", "{", "@link", "DocumentSequence", "}", "that", "can", "be", "used", "to", "pull", "multiple", "documents", "from", "the", "stream", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/JsonReader.java#L260-L272
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/MergeRequestApi.java
MergeRequestApi.updateMergeRequest
public MergeRequest updateMergeRequest(Object projectIdOrPath, Integer mergeRequestIid, String targetBranch, String title, Integer assigneeId, String description, StateEvent stateEvent, String labels, Integer milestoneId, Boolean removeSourceBranch, Boolean squash, Boolean discussionLocked, Boolean allowCollaboration) throws GitLabApiException { Form formData = new GitLabApiForm() .withParam("target_branch", targetBranch) .withParam("title", title) .withParam("assignee_id", assigneeId) .withParam("description", description) .withParam("state_event", stateEvent) .withParam("labels", labels) .withParam("milestone_id", milestoneId) .withParam("remove_source_branch", removeSourceBranch) .withParam("squash", squash) .withParam("discussion_locked", discussionLocked) .withParam("allow_collaboration", allowCollaboration); return updateMergeRequest(projectIdOrPath, mergeRequestIid, formData); }
java
public MergeRequest updateMergeRequest(Object projectIdOrPath, Integer mergeRequestIid, String targetBranch, String title, Integer assigneeId, String description, StateEvent stateEvent, String labels, Integer milestoneId, Boolean removeSourceBranch, Boolean squash, Boolean discussionLocked, Boolean allowCollaboration) throws GitLabApiException { Form formData = new GitLabApiForm() .withParam("target_branch", targetBranch) .withParam("title", title) .withParam("assignee_id", assigneeId) .withParam("description", description) .withParam("state_event", stateEvent) .withParam("labels", labels) .withParam("milestone_id", milestoneId) .withParam("remove_source_branch", removeSourceBranch) .withParam("squash", squash) .withParam("discussion_locked", discussionLocked) .withParam("allow_collaboration", allowCollaboration); return updateMergeRequest(projectIdOrPath, mergeRequestIid, formData); }
[ "public", "MergeRequest", "updateMergeRequest", "(", "Object", "projectIdOrPath", ",", "Integer", "mergeRequestIid", ",", "String", "targetBranch", ",", "String", "title", ",", "Integer", "assigneeId", ",", "String", "description", ",", "StateEvent", "stateEvent", ",", "String", "labels", ",", "Integer", "milestoneId", ",", "Boolean", "removeSourceBranch", ",", "Boolean", "squash", ",", "Boolean", "discussionLocked", ",", "Boolean", "allowCollaboration", ")", "throws", "GitLabApiException", "{", "Form", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"target_branch\"", ",", "targetBranch", ")", ".", "withParam", "(", "\"title\"", ",", "title", ")", ".", "withParam", "(", "\"assignee_id\"", ",", "assigneeId", ")", ".", "withParam", "(", "\"description\"", ",", "description", ")", ".", "withParam", "(", "\"state_event\"", ",", "stateEvent", ")", ".", "withParam", "(", "\"labels\"", ",", "labels", ")", ".", "withParam", "(", "\"milestone_id\"", ",", "milestoneId", ")", ".", "withParam", "(", "\"remove_source_branch\"", ",", "removeSourceBranch", ")", ".", "withParam", "(", "\"squash\"", ",", "squash", ")", ".", "withParam", "(", "\"discussion_locked\"", ",", "discussionLocked", ")", ".", "withParam", "(", "\"allow_collaboration\"", ",", "allowCollaboration", ")", ";", "return", "updateMergeRequest", "(", "projectIdOrPath", ",", "mergeRequestIid", ",", "formData", ")", ";", "}" ]
Updates an existing merge request. You can change branches, title, or even close the MR. <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p> <pre><code>GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param mergeRequestIid the internal ID of the merge request to update @param targetBranch the target branch, optional @param title the title for the merge request @param assigneeId the Assignee user ID, optional @param description the description of the merge request, optional @param stateEvent new state for the merge request, optional @param labels comma separated list of labels, optional @param milestoneId the ID of a milestone, optional @param removeSourceBranch Flag indicating if a merge request should remove the source branch when merging, optional @param squash Squash commits into a single commit when merging, optional @param discussionLocked Flag indicating if the merge request's discussion is locked, optional @param allowCollaboration Allow commits from members who can merge to the target branch, optional @return the updated merge request @throws GitLabApiException if any exception occurs
[ "Updates", "an", "existing", "merge", "request", ".", "You", "can", "change", "branches", "title", "or", "even", "close", "the", "MR", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/MergeRequestApi.java#L445-L465
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnnotationsInner.java
AnnotationsInner.getAsync
public Observable<List<AnnotationInner>> getAsync(String resourceGroupName, String resourceName, String annotationId) { return getWithServiceResponseAsync(resourceGroupName, resourceName, annotationId).map(new Func1<ServiceResponse<List<AnnotationInner>>, List<AnnotationInner>>() { @Override public List<AnnotationInner> call(ServiceResponse<List<AnnotationInner>> response) { return response.body(); } }); }
java
public Observable<List<AnnotationInner>> getAsync(String resourceGroupName, String resourceName, String annotationId) { return getWithServiceResponseAsync(resourceGroupName, resourceName, annotationId).map(new Func1<ServiceResponse<List<AnnotationInner>>, List<AnnotationInner>>() { @Override public List<AnnotationInner> call(ServiceResponse<List<AnnotationInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "AnnotationInner", ">", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "annotationId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "annotationId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "AnnotationInner", ">", ">", ",", "List", "<", "AnnotationInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "AnnotationInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "AnnotationInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get the annotation for given id. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param annotationId The unique annotation ID. This is unique within a Application Insights component. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;AnnotationInner&gt; object
[ "Get", "the", "annotation", "for", "given", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnnotationsInner.java#L408-L415
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java
AnnotationUtility.extractAsClassName
public static String extractAsClassName(Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attributeName) { final Elements elementUtils=BindDataSourceSubProcessor.elementUtils; final One<String> result = new One<String>(); extractString(elementUtils, item, annotationClass, attributeName, new OnAttributeFoundListener() { @Override public void onFound(String value) { result.value0 = AnnotationUtility.extractAsArrayOfClassName(value).get(0); } }); return result.value0; }
java
public static String extractAsClassName(Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attributeName) { final Elements elementUtils=BindDataSourceSubProcessor.elementUtils; final One<String> result = new One<String>(); extractString(elementUtils, item, annotationClass, attributeName, new OnAttributeFoundListener() { @Override public void onFound(String value) { result.value0 = AnnotationUtility.extractAsArrayOfClassName(value).get(0); } }); return result.value0; }
[ "public", "static", "String", "extractAsClassName", "(", "Element", "item", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ",", "AnnotationAttributeType", "attributeName", ")", "{", "final", "Elements", "elementUtils", "=", "BindDataSourceSubProcessor", ".", "elementUtils", ";", "final", "One", "<", "String", ">", "result", "=", "new", "One", "<", "String", ">", "(", ")", ";", "extractString", "(", "elementUtils", ",", "item", ",", "annotationClass", ",", "attributeName", ",", "new", "OnAttributeFoundListener", "(", ")", "{", "@", "Override", "public", "void", "onFound", "(", "String", "value", ")", "{", "result", ".", "value0", "=", "AnnotationUtility", ".", "extractAsArrayOfClassName", "(", "value", ")", ".", "get", "(", "0", ")", ";", "}", "}", ")", ";", "return", "result", ".", "value0", ";", "}" ]
Extract from an annotation of a method the attribute value specified. @param item the item @param annotationClass the annotation class @param attributeName the attribute name @return attribute value extracted as class typeName
[ "Extract", "from", "an", "annotation", "of", "a", "method", "the", "attribute", "value", "specified", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java#L217-L230
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectHasSelfImpl_CustomFieldSerializer.java
OWLObjectHasSelfImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectHasSelfImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectHasSelfImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLObjectHasSelfImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectHasSelfImpl_CustomFieldSerializer.java#L89-L92
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java
Assertions.assertEquals
public static <T> T assertEquals(@Nullable final T etalon, @Nullable final T value) { if (etalon == null) { assertNull(value); } else { if (!(etalon == value || etalon.equals(value))) { final AssertionError error = new AssertionError("Value is not equal to etalon"); MetaErrorListeners.fireError(error.getMessage(), error); throw error; } } return value; }
java
public static <T> T assertEquals(@Nullable final T etalon, @Nullable final T value) { if (etalon == null) { assertNull(value); } else { if (!(etalon == value || etalon.equals(value))) { final AssertionError error = new AssertionError("Value is not equal to etalon"); MetaErrorListeners.fireError(error.getMessage(), error); throw error; } } return value; }
[ "public", "static", "<", "T", ">", "T", "assertEquals", "(", "@", "Nullable", "final", "T", "etalon", ",", "@", "Nullable", "final", "T", "value", ")", "{", "if", "(", "etalon", "==", "null", ")", "{", "assertNull", "(", "value", ")", ";", "}", "else", "{", "if", "(", "!", "(", "etalon", "==", "value", "||", "etalon", ".", "equals", "(", "value", ")", ")", ")", "{", "final", "AssertionError", "error", "=", "new", "AssertionError", "(", "\"Value is not equal to etalon\"", ")", ";", "MetaErrorListeners", ".", "fireError", "(", "error", ".", "getMessage", "(", ")", ",", "error", ")", ";", "throw", "error", ";", "}", "}", "return", "value", ";", "}" ]
Assert that value is equal to some etalon value. @param <T> type of object to be checked. @param etalon etalon value @param value value to check @return value if it is equal to etalon @throws AssertionError if the value id not equal to the etalon @since 1.1.1
[ "Assert", "that", "value", "is", "equal", "to", "some", "etalon", "value", "." ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java#L183-L194
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_abbreviatedNumber_abbreviatedNumber_DELETE
public void billingAccount_abbreviatedNumber_abbreviatedNumber_DELETE(String billingAccount, Long abbreviatedNumber) throws IOException { String qPath = "/telephony/{billingAccount}/abbreviatedNumber/{abbreviatedNumber}"; StringBuilder sb = path(qPath, billingAccount, abbreviatedNumber); exec(qPath, "DELETE", sb.toString(), null); }
java
public void billingAccount_abbreviatedNumber_abbreviatedNumber_DELETE(String billingAccount, Long abbreviatedNumber) throws IOException { String qPath = "/telephony/{billingAccount}/abbreviatedNumber/{abbreviatedNumber}"; StringBuilder sb = path(qPath, billingAccount, abbreviatedNumber); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "billingAccount_abbreviatedNumber_abbreviatedNumber_DELETE", "(", "String", "billingAccount", ",", "Long", "abbreviatedNumber", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/abbreviatedNumber/{abbreviatedNumber}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "abbreviatedNumber", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete the given abbreviated number REST: DELETE /telephony/{billingAccount}/abbreviatedNumber/{abbreviatedNumber} @param billingAccount [required] The name of your billingAccount @param abbreviatedNumber [required] The abbreviated number which must start with "7" and must have a length of 3 or 4 digits
[ "Delete", "the", "given", "abbreviated", "number" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4573-L4577
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java
DecodedBitStreamParser.textCompaction
private static int textCompaction(int[] codewords, int codeIndex, StringBuilder result) { // 2 character per codeword int[] textCompactionData = new int[(codewords[0] - codeIndex) * 2]; // Used to hold the byte compaction value if there is a mode shift int[] byteCompactionData = new int[(codewords[0] - codeIndex) * 2]; int index = 0; boolean end = false; while ((codeIndex < codewords[0]) && !end) { int code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { textCompactionData[index] = code / 30; textCompactionData[index + 1] = code % 30; index += 2; } else { switch (code) { case TEXT_COMPACTION_MODE_LATCH: // reinitialize text compaction mode to alpha sub mode textCompactionData[index++] = TEXT_COMPACTION_MODE_LATCH; break; case BYTE_COMPACTION_MODE_LATCH: case BYTE_COMPACTION_MODE_LATCH_6: case NUMERIC_COMPACTION_MODE_LATCH: case BEGIN_MACRO_PDF417_CONTROL_BLOCK: case BEGIN_MACRO_PDF417_OPTIONAL_FIELD: case MACRO_PDF417_TERMINATOR: codeIndex--; end = true; break; case MODE_SHIFT_TO_BYTE_COMPACTION_MODE: // The Mode Shift codeword 913 shall cause a temporary // switch from Text Compaction mode to Byte Compaction mode. // This switch shall be in effect for only the next codeword, // after which the mode shall revert to the prevailing sub-mode // of the Text Compaction mode. Codeword 913 is only available // in Text Compaction mode; its use is described in 5.4.2.4. textCompactionData[index] = MODE_SHIFT_TO_BYTE_COMPACTION_MODE; code = codewords[codeIndex++]; byteCompactionData[index] = code; index++; break; } } } decodeTextCompaction(textCompactionData, byteCompactionData, index, result); return codeIndex; }
java
private static int textCompaction(int[] codewords, int codeIndex, StringBuilder result) { // 2 character per codeword int[] textCompactionData = new int[(codewords[0] - codeIndex) * 2]; // Used to hold the byte compaction value if there is a mode shift int[] byteCompactionData = new int[(codewords[0] - codeIndex) * 2]; int index = 0; boolean end = false; while ((codeIndex < codewords[0]) && !end) { int code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { textCompactionData[index] = code / 30; textCompactionData[index + 1] = code % 30; index += 2; } else { switch (code) { case TEXT_COMPACTION_MODE_LATCH: // reinitialize text compaction mode to alpha sub mode textCompactionData[index++] = TEXT_COMPACTION_MODE_LATCH; break; case BYTE_COMPACTION_MODE_LATCH: case BYTE_COMPACTION_MODE_LATCH_6: case NUMERIC_COMPACTION_MODE_LATCH: case BEGIN_MACRO_PDF417_CONTROL_BLOCK: case BEGIN_MACRO_PDF417_OPTIONAL_FIELD: case MACRO_PDF417_TERMINATOR: codeIndex--; end = true; break; case MODE_SHIFT_TO_BYTE_COMPACTION_MODE: // The Mode Shift codeword 913 shall cause a temporary // switch from Text Compaction mode to Byte Compaction mode. // This switch shall be in effect for only the next codeword, // after which the mode shall revert to the prevailing sub-mode // of the Text Compaction mode. Codeword 913 is only available // in Text Compaction mode; its use is described in 5.4.2.4. textCompactionData[index] = MODE_SHIFT_TO_BYTE_COMPACTION_MODE; code = codewords[codeIndex++]; byteCompactionData[index] = code; index++; break; } } } decodeTextCompaction(textCompactionData, byteCompactionData, index, result); return codeIndex; }
[ "private", "static", "int", "textCompaction", "(", "int", "[", "]", "codewords", ",", "int", "codeIndex", ",", "StringBuilder", "result", ")", "{", "// 2 character per codeword", "int", "[", "]", "textCompactionData", "=", "new", "int", "[", "(", "codewords", "[", "0", "]", "-", "codeIndex", ")", "*", "2", "]", ";", "// Used to hold the byte compaction value if there is a mode shift", "int", "[", "]", "byteCompactionData", "=", "new", "int", "[", "(", "codewords", "[", "0", "]", "-", "codeIndex", ")", "*", "2", "]", ";", "int", "index", "=", "0", ";", "boolean", "end", "=", "false", ";", "while", "(", "(", "codeIndex", "<", "codewords", "[", "0", "]", ")", "&&", "!", "end", ")", "{", "int", "code", "=", "codewords", "[", "codeIndex", "++", "]", ";", "if", "(", "code", "<", "TEXT_COMPACTION_MODE_LATCH", ")", "{", "textCompactionData", "[", "index", "]", "=", "code", "/", "30", ";", "textCompactionData", "[", "index", "+", "1", "]", "=", "code", "%", "30", ";", "index", "+=", "2", ";", "}", "else", "{", "switch", "(", "code", ")", "{", "case", "TEXT_COMPACTION_MODE_LATCH", ":", "// reinitialize text compaction mode to alpha sub mode", "textCompactionData", "[", "index", "++", "]", "=", "TEXT_COMPACTION_MODE_LATCH", ";", "break", ";", "case", "BYTE_COMPACTION_MODE_LATCH", ":", "case", "BYTE_COMPACTION_MODE_LATCH_6", ":", "case", "NUMERIC_COMPACTION_MODE_LATCH", ":", "case", "BEGIN_MACRO_PDF417_CONTROL_BLOCK", ":", "case", "BEGIN_MACRO_PDF417_OPTIONAL_FIELD", ":", "case", "MACRO_PDF417_TERMINATOR", ":", "codeIndex", "--", ";", "end", "=", "true", ";", "break", ";", "case", "MODE_SHIFT_TO_BYTE_COMPACTION_MODE", ":", "// The Mode Shift codeword 913 shall cause a temporary", "// switch from Text Compaction mode to Byte Compaction mode.", "// This switch shall be in effect for only the next codeword,", "// after which the mode shall revert to the prevailing sub-mode", "// of the Text Compaction mode. Codeword 913 is only available", "// in Text Compaction mode; its use is described in 5.4.2.4.", "textCompactionData", "[", "index", "]", "=", "MODE_SHIFT_TO_BYTE_COMPACTION_MODE", ";", "code", "=", "codewords", "[", "codeIndex", "++", "]", ";", "byteCompactionData", "[", "index", "]", "=", "code", ";", "index", "++", ";", "break", ";", "}", "}", "}", "decodeTextCompaction", "(", "textCompactionData", ",", "byteCompactionData", ",", "index", ",", "result", ")", ";", "return", "codeIndex", ";", "}" ]
Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters. @param codewords The array of codewords (data + error) @param codeIndex The current index into the codeword array. @param result The decoded data is appended to the result. @return The next index into the codeword array.
[ "Text", "Compaction", "mode", "(", "see", "5", ".", "4", ".", "1", ".", "5", ")", "permits", "all", "printable", "ASCII", "characters", "to", "be", "encoded", "i", ".", "e", ".", "values", "32", "-", "126", "inclusive", "in", "accordance", "with", "ISO", "/", "IEC", "646", "(", "IRV", ")", "as", "well", "as", "selected", "control", "characters", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java#L266-L312
nextreports/nextreports-engine
src/ro/nextreports/engine/exporter/util/XlsUtil.java
XlsUtil.copyToSheet
public static int copyToSheet(HSSFSheet parentSheet, int parentSheetRow, int parentSheetColumn, HSSFSheet sheet) { return copyToSheet(parentSheet, parentSheetRow, parentSheetColumn, sheet, true); }
java
public static int copyToSheet(HSSFSheet parentSheet, int parentSheetRow, int parentSheetColumn, HSSFSheet sheet) { return copyToSheet(parentSheet, parentSheetRow, parentSheetColumn, sheet, true); }
[ "public", "static", "int", "copyToSheet", "(", "HSSFSheet", "parentSheet", ",", "int", "parentSheetRow", ",", "int", "parentSheetColumn", ",", "HSSFSheet", "sheet", ")", "{", "return", "copyToSheet", "(", "parentSheet", ",", "parentSheetRow", ",", "parentSheetColumn", ",", "sheet", ",", "true", ")", ";", "}" ]
Copy a sheet to another sheet at a specific (row, column) position @param parentSheet the sheet to copy into @param parentSheetRow the row inside parentSheet where we start to copy @param parentSheetColumn the column inside parentSheet where we start to copy @param sheet the sheet that is copied @return column number
[ "Copy", "a", "sheet", "to", "another", "sheet", "at", "a", "specific", "(", "row", "column", ")", "position" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/exporter/util/XlsUtil.java#L47-L49
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Path3ifx.java
Path3ifx.isMultiPartsProperty
public BooleanProperty isMultiPartsProperty() { if (this.isMultipart == null) { this.isMultipart = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_MULTIPARTS, false); this.isMultipart.bind(Bindings.createBooleanBinding(() -> { boolean foundOne = false; for (final PathElementType type : innerTypesProperty()) { if (type == PathElementType.MOVE_TO) { if (foundOne) { return true; } foundOne = true; } } return false; }, innerTypesProperty())); } return this.isMultipart; }
java
public BooleanProperty isMultiPartsProperty() { if (this.isMultipart == null) { this.isMultipart = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_MULTIPARTS, false); this.isMultipart.bind(Bindings.createBooleanBinding(() -> { boolean foundOne = false; for (final PathElementType type : innerTypesProperty()) { if (type == PathElementType.MOVE_TO) { if (foundOne) { return true; } foundOne = true; } } return false; }, innerTypesProperty())); } return this.isMultipart; }
[ "public", "BooleanProperty", "isMultiPartsProperty", "(", ")", "{", "if", "(", "this", ".", "isMultipart", "==", "null", ")", "{", "this", ".", "isMultipart", "=", "new", "ReadOnlyBooleanWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "IS_MULTIPARTS", ",", "false", ")", ";", "this", ".", "isMultipart", ".", "bind", "(", "Bindings", ".", "createBooleanBinding", "(", "(", ")", "->", "{", "boolean", "foundOne", "=", "false", ";", "for", "(", "final", "PathElementType", "type", ":", "innerTypesProperty", "(", ")", ")", "{", "if", "(", "type", "==", "PathElementType", ".", "MOVE_TO", ")", "{", "if", "(", "foundOne", ")", "{", "return", "true", ";", "}", "foundOne", "=", "true", ";", "}", "}", "return", "false", ";", "}", ",", "innerTypesProperty", "(", ")", ")", ")", ";", "}", "return", "this", ".", "isMultipart", ";", "}" ]
Replies the isMultiParts property. @return the isMultiParts property.
[ "Replies", "the", "isMultiParts", "property", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Path3ifx.java#L388-L406
hdbeukel/james-core
src/main/java/org/jamesframework/core/problems/GenericProblem.java
GenericProblem.setObjective
public void setObjective(Objective<? super SolutionType, ? super DataType> objective) { // check not null if(objective == null){ throw new NullPointerException("Error while setting objective: null is not allowed."); } this.objective = objective; }
java
public void setObjective(Objective<? super SolutionType, ? super DataType> objective) { // check not null if(objective == null){ throw new NullPointerException("Error while setting objective: null is not allowed."); } this.objective = objective; }
[ "public", "void", "setObjective", "(", "Objective", "<", "?", "super", "SolutionType", ",", "?", "super", "DataType", ">", "objective", ")", "{", "// check not null", "if", "(", "objective", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Error while setting objective: null is not allowed.\"", ")", ";", "}", "this", ".", "objective", "=", "objective", ";", "}" ]
Set the objective function. Any objective designed for the solution and data types of the problem, or more general types, is accepted. The objective can not be <code>null</code>. @param objective objective function @throws NullPointerException if <code>objective</code> is <code>null</code>
[ "Set", "the", "objective", "function", ".", "Any", "objective", "designed", "for", "the", "solution", "and", "data", "types", "of", "the", "problem", "or", "more", "general", "types", "is", "accepted", ".", "The", "objective", "can", "not", "be", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/problems/GenericProblem.java#L146-L152
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.createCertificateAsync
public ServiceFuture<CertificateOperation> createCertificateAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateOperation> serviceCallback) { return ServiceFuture.fromResponse(createCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy, certificateAttributes, tags), serviceCallback); }
java
public ServiceFuture<CertificateOperation> createCertificateAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateOperation> serviceCallback) { return ServiceFuture.fromResponse(createCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy, certificateAttributes, tags), serviceCallback); }
[ "public", "ServiceFuture", "<", "CertificateOperation", ">", "createCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "CertificatePolicy", "certificatePolicy", ",", "CertificateAttributes", "certificateAttributes", ",", "Map", "<", "String", ",", "String", ">", "tags", ",", "final", "ServiceCallback", "<", "CertificateOperation", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "createCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ",", "certificatePolicy", ",", "certificateAttributes", ",", "tags", ")", ",", "serviceCallback", ")", ";", "}" ]
Creates a new certificate. If this is the first version, the certificate resource is created. This operation requires the certificates/create permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param certificatePolicy The management policy for the certificate. @param certificateAttributes The attributes of the certificate (optional). @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Creates", "a", "new", "certificate", ".", "If", "this", "is", "the", "first", "version", "the", "certificate", "resource", "is", "created", ".", "This", "operation", "requires", "the", "certificates", "/", "create", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6596-L6598
Red5/red5-io
src/main/java/org/red5/io/flv/meta/MetaService.java
MetaService.injectMetaCue
private static ITag injectMetaCue(IMetaCue meta, ITag tag) { // IMeta meta = (MetaCue) cue; Output out = new Output(IoBuffer.allocate(1000)); Serializer.serialize(out, "onCuePoint"); Serializer.serialize(out, meta); IoBuffer tmpBody = out.buf().flip(); int tmpBodySize = out.buf().limit(); int tmpPreviousTagSize = tag.getPreviousTagSize(); int tmpTimestamp = getTimeInMilliseconds(meta); return new Tag(IoConstants.TYPE_METADATA, tmpTimestamp, tmpBodySize, tmpBody, tmpPreviousTagSize); }
java
private static ITag injectMetaCue(IMetaCue meta, ITag tag) { // IMeta meta = (MetaCue) cue; Output out = new Output(IoBuffer.allocate(1000)); Serializer.serialize(out, "onCuePoint"); Serializer.serialize(out, meta); IoBuffer tmpBody = out.buf().flip(); int tmpBodySize = out.buf().limit(); int tmpPreviousTagSize = tag.getPreviousTagSize(); int tmpTimestamp = getTimeInMilliseconds(meta); return new Tag(IoConstants.TYPE_METADATA, tmpTimestamp, tmpBodySize, tmpBody, tmpPreviousTagSize); }
[ "private", "static", "ITag", "injectMetaCue", "(", "IMetaCue", "meta", ",", "ITag", "tag", ")", "{", "// IMeta meta = (MetaCue) cue;", "Output", "out", "=", "new", "Output", "(", "IoBuffer", ".", "allocate", "(", "1000", ")", ")", ";", "Serializer", ".", "serialize", "(", "out", ",", "\"onCuePoint\"", ")", ";", "Serializer", ".", "serialize", "(", "out", ",", "meta", ")", ";", "IoBuffer", "tmpBody", "=", "out", ".", "buf", "(", ")", ".", "flip", "(", ")", ";", "int", "tmpBodySize", "=", "out", ".", "buf", "(", ")", ".", "limit", "(", ")", ";", "int", "tmpPreviousTagSize", "=", "tag", ".", "getPreviousTagSize", "(", ")", ";", "int", "tmpTimestamp", "=", "getTimeInMilliseconds", "(", "meta", ")", ";", "return", "new", "Tag", "(", "IoConstants", ".", "TYPE_METADATA", ",", "tmpTimestamp", ",", "tmpBodySize", ",", "tmpBody", ",", "tmpPreviousTagSize", ")", ";", "}" ]
Injects metadata (Cue Points) into a tag @param meta Metadata (cue points) @param tag Tag @return ITag tag New tag with injected metadata
[ "Injects", "metadata", "(", "Cue", "Points", ")", "into", "a", "tag" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/meta/MetaService.java#L232-L244
wisdom-framework/wisdom
extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java
ControllerModel.from
public static JsonNode from(Controller controller, Router router, Json json) { ObjectNode node = json.newObject(); node.put("classname", controller.getClass().getName()) .put("invalid", false) .put("routes", getRoutes(controller, router, json)); return node; }
java
public static JsonNode from(Controller controller, Router router, Json json) { ObjectNode node = json.newObject(); node.put("classname", controller.getClass().getName()) .put("invalid", false) .put("routes", getRoutes(controller, router, json)); return node; }
[ "public", "static", "JsonNode", "from", "(", "Controller", "controller", ",", "Router", "router", ",", "Json", "json", ")", "{", "ObjectNode", "node", "=", "json", ".", "newObject", "(", ")", ";", "node", ".", "put", "(", "\"classname\"", ",", "controller", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ".", "put", "(", "\"invalid\"", ",", "false", ")", ".", "put", "(", "\"routes\"", ",", "getRoutes", "(", "controller", ",", "router", ",", "json", ")", ")", ";", "return", "node", ";", "}" ]
Creates the Json representation for a valid (exposed) controller. @param controller the controller @param router the router @param json the json service @return the json representation
[ "Creates", "the", "Json", "representation", "for", "a", "valid", "(", "exposed", ")", "controller", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java#L79-L85