repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/InventoryData.java
InventoryData.addFilter
public void addFilter(String name, String value) { if(this.filters == null) this.filters = new HashMap<String,String>(); this.filters.put(name, value); }
java
public void addFilter(String name, String value) { if(this.filters == null) this.filters = new HashMap<String,String>(); this.filters.put(name, value); }
[ "public", "void", "addFilter", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "this", ".", "filters", "==", "null", ")", "this", ".", "filters", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "this", "...
Adds the given filter to the list of filters for the widget. @param name The name of the filter to add @param value The value of the filter to add
[ "Adds", "the", "given", "filter", "to", "the", "list", "of", "filters", "for", "the", "widget", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/InventoryData.java#L89-L94
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.readCSV2Objects
public <T> List<T> readCSV2Objects(String path, Class<T> clazz) { try (InputStream is = new FileInputStream(new File(path))) { return readCSVByMapHandler(is, clazz); } catch (IOException | Excel4JException e) { throw new Excel4jReadException("read [" + path + "] CSV Error: ", e); } }
java
public <T> List<T> readCSV2Objects(String path, Class<T> clazz) { try (InputStream is = new FileInputStream(new File(path))) { return readCSVByMapHandler(is, clazz); } catch (IOException | Excel4JException e) { throw new Excel4jReadException("read [" + path + "] CSV Error: ", e); } }
[ "public", "<", "T", ">", "List", "<", "T", ">", "readCSV2Objects", "(", "String", "path", ",", "Class", "<", "T", ">", "clazz", ")", "{", "try", "(", "InputStream", "is", "=", "new", "FileInputStream", "(", "new", "File", "(", "path", ")", ")", ")"...
基于注解读取CSV文件 @param path 待读取文件路径 @param clazz 待绑定的类(绑定属性注解{@link com.github.crab2died.annotation.ExcelField}) @return 返回转换为设置绑定的java对象集合 @throws Excel4jReadException exception
[ "基于注解读取CSV文件" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L1512-L1519
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Server.java
Server.call
@SuppressWarnings("unchecked") public void call(Serializer ser, InputStream is, OutputStream os) throws IOException { Object obj = null; try { obj = ser.readMapOrList(is); } catch (Exception e) { String msg = "Unable to deserialize request: " + e.getMessage(); ser.write(new RpcResponse(null, RpcException.Error.PARSE.exc(msg)).marshal(), os); return; } if (obj instanceof List) { List list = (List)obj; List respList = new ArrayList(); for (Object o : list) { RpcRequest rpcReq = new RpcRequest((Map)o); respList.add(call(rpcReq).marshal()); } ser.write(respList, os); } else if (obj instanceof Map) { RpcRequest rpcReq = new RpcRequest((Map)obj); ser.write(call(rpcReq).marshal(), os); } else { ser.write(new RpcResponse(null, RpcException.Error.INVALID_REQ.exc("Invalid Request")).marshal(), os); } }
java
@SuppressWarnings("unchecked") public void call(Serializer ser, InputStream is, OutputStream os) throws IOException { Object obj = null; try { obj = ser.readMapOrList(is); } catch (Exception e) { String msg = "Unable to deserialize request: " + e.getMessage(); ser.write(new RpcResponse(null, RpcException.Error.PARSE.exc(msg)).marshal(), os); return; } if (obj instanceof List) { List list = (List)obj; List respList = new ArrayList(); for (Object o : list) { RpcRequest rpcReq = new RpcRequest((Map)o); respList.add(call(rpcReq).marshal()); } ser.write(respList, os); } else if (obj instanceof Map) { RpcRequest rpcReq = new RpcRequest((Map)obj); ser.write(call(rpcReq).marshal(), os); } else { ser.write(new RpcResponse(null, RpcException.Error.INVALID_REQ.exc("Invalid Request")).marshal(), os); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "call", "(", "Serializer", "ser", ",", "InputStream", "is", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "Object", "obj", "=", "null", ";", "try", "{", "obj", "=", "ser"...
Reads a RpcRequest from the input stream, deserializes it, invokes the matching handler method, serializes the result, and writes it to the output stream. @param ser Serializer to use to decode the request from the input stream, and serialize the result to the the output stream @param is InputStream to read the request from @param os OutputStream to write the response to @throws IOException If there is a problem reading or writing to either stream, or if the request cannot be deserialized.
[ "Reads", "a", "RpcRequest", "from", "the", "input", "stream", "deserializes", "it", "invokes", "the", "matching", "handler", "method", "serializes", "the", "result", "and", "writes", "it", "to", "the", "output", "stream", "." ]
train
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Server.java#L121-L151
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/MapUtils.java
MapUtils.getDate
public static Date getDate(Map<String, Object> map, String key, String dateTimeFormat) { Object obj = map.get(key); return obj instanceof Number ? new Date(((Number) obj).longValue()) : (obj instanceof String ? DateFormatUtils.fromString(obj.toString(), dateTimeFormat) : (obj instanceof Date ? (Date) obj : null)); }
java
public static Date getDate(Map<String, Object> map, String key, String dateTimeFormat) { Object obj = map.get(key); return obj instanceof Number ? new Date(((Number) obj).longValue()) : (obj instanceof String ? DateFormatUtils.fromString(obj.toString(), dateTimeFormat) : (obj instanceof Date ? (Date) obj : null)); }
[ "public", "static", "Date", "getDate", "(", "Map", "<", "String", ",", "Object", ">", "map", ",", "String", "key", ",", "String", "dateTimeFormat", ")", "{", "Object", "obj", "=", "map", ".", "get", "(", "key", ")", ";", "return", "obj", "instanceof", ...
Extract a date value from the map. If the extracted value is a string, parse it as a {@link Date} using the specified date-time format. @param map @param key @param dateTimeFormat @return @since 0.6.3.1
[ "Extract", "a", "date", "value", "from", "the", "map", ".", "If", "the", "extracted", "value", "is", "a", "string", "parse", "it", "as", "a", "{", "@link", "Date", "}", "using", "the", "specified", "date", "-", "time", "format", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/MapUtils.java#L24-L30
Nordstrom/JUnit-Foundation
src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java
LifecycleHooks.getFieldValue
@SuppressWarnings("unchecked") static <T> T getFieldValue(Object target, String name) throws IllegalAccessException, NoSuchFieldException, SecurityException { Field field = getDeclaredField(target, name); field.setAccessible(true); return (T) field.get(target); }
java
@SuppressWarnings("unchecked") static <T> T getFieldValue(Object target, String name) throws IllegalAccessException, NoSuchFieldException, SecurityException { Field field = getDeclaredField(target, name); field.setAccessible(true); return (T) field.get(target); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "<", "T", ">", "T", "getFieldValue", "(", "Object", "target", ",", "String", "name", ")", "throws", "IllegalAccessException", ",", "NoSuchFieldException", ",", "SecurityException", "{", "Field", "field"...
Get the value of the specified field from the supplied object. @param <T> field value type @param target target object @param name field name @return {@code anything} - the value of the specified field in the supplied object @throws IllegalAccessException if the {@code Field} object is enforcing access control for an inaccessible field @throws NoSuchFieldException if a field with the specified name is not found @throws SecurityException if the request is denied
[ "Get", "the", "value", "of", "the", "specified", "field", "from", "the", "supplied", "object", "." ]
train
https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L320-L325
nohana/Amalgam
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
CursorUtils.getDouble
public static double getDouble(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getDouble(cursor.getColumnIndex(columnName)); }
java
public static double getDouble(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getDouble(cursor.getColumnIndex(columnName)); }
[ "public", "static", "double", "getDouble", "(", "Cursor", "cursor", ",", "String", "columnName", ")", "{", "if", "(", "cursor", "==", "null", ")", "{", "return", "-", "1", ";", "}", "return", "cursor", ".", "getDouble", "(", "cursor", ".", "getColumnInde...
Read the double data for the column. @see android.database.Cursor#getDouble(int). @see android.database.Cursor#getColumnIndex(String). @param cursor the cursor. @param columnName the column name. @return the double value.
[ "Read", "the", "double", "data", "for", "the", "column", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L128-L134
spacecowboy/NoNonsense-FilePicker
sample/src/main/java/com/nononsenseapps/filepicker/sample/multimedia/MultimediaPickerFragment.java
MultimediaPickerFragment.getItemViewType
@Override public int getItemViewType(int position, @NonNull File file) { if (isMultimedia(file)) { if (isCheckable(file)) { return VIEWTYPE_IMAGE_CHECKABLE; } else { return VIEWTYPE_IMAGE; } } else { return super.getItemViewType(position, file); } }
java
@Override public int getItemViewType(int position, @NonNull File file) { if (isMultimedia(file)) { if (isCheckable(file)) { return VIEWTYPE_IMAGE_CHECKABLE; } else { return VIEWTYPE_IMAGE; } } else { return super.getItemViewType(position, file); } }
[ "@", "Override", "public", "int", "getItemViewType", "(", "int", "position", ",", "@", "NonNull", "File", "file", ")", "{", "if", "(", "isMultimedia", "(", "file", ")", ")", "{", "if", "(", "isCheckable", "(", "file", ")", ")", "{", "return", "VIEWTYPE...
Here we check if the file is an image, and if thus if we should create views corresponding to our image layouts. @param position 0 - n, where the header has been subtracted @param file to check type of @return the viewtype of the item
[ "Here", "we", "check", "if", "the", "file", "is", "an", "image", "and", "if", "thus", "if", "we", "should", "create", "views", "corresponding", "to", "our", "image", "layouts", "." ]
train
https://github.com/spacecowboy/NoNonsense-FilePicker/blob/396ef7fa5e87791170791f9d94c78f6e42a7679a/sample/src/main/java/com/nononsenseapps/filepicker/sample/multimedia/MultimediaPickerFragment.java#L75-L86
sputnikdev/bluetooth-utils
src/main/java/org/sputnikdev/bluetooth/URL.java
URL.copyWithDevice
public URL copyWithDevice(String deviceAddress, String attrName, String attrValue) { return new URL(this.protocol, this.adapterAddress, deviceAddress, Collections.singletonMap(attrName, attrValue), this.serviceUUID, this.characteristicUUID, this.fieldName); }
java
public URL copyWithDevice(String deviceAddress, String attrName, String attrValue) { return new URL(this.protocol, this.adapterAddress, deviceAddress, Collections.singletonMap(attrName, attrValue), this.serviceUUID, this.characteristicUUID, this.fieldName); }
[ "public", "URL", "copyWithDevice", "(", "String", "deviceAddress", ",", "String", "attrName", ",", "String", "attrValue", ")", "{", "return", "new", "URL", "(", "this", ".", "protocol", ",", "this", ".", "adapterAddress", ",", "deviceAddress", ",", "Collection...
Makes a copy of a given URL with a new device name and a single attribute. @param deviceAddress bluetooth device MAC address @param attrName attribute name @param attrValue attribute value @return a copy of a given URL with some additional components
[ "Makes", "a", "copy", "of", "a", "given", "URL", "with", "a", "new", "device", "name", "and", "a", "single", "attribute", "." ]
train
https://github.com/sputnikdev/bluetooth-utils/blob/794e4a8644c1eed54cd043de2bc967f4ef58acca/src/main/java/org/sputnikdev/bluetooth/URL.java#L278-L281
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/Node.java
Node.getLoad
public int getLoad() { final int status = this.state; if (anyAreSet(status, ERROR)) { return -1; } else if (anyAreSet(status, HOT_STANDBY)) { return 0; } else { return lbStatus.getLbFactor(); } }
java
public int getLoad() { final int status = this.state; if (anyAreSet(status, ERROR)) { return -1; } else if (anyAreSet(status, HOT_STANDBY)) { return 0; } else { return lbStatus.getLbFactor(); } }
[ "public", "int", "getLoad", "(", ")", "{", "final", "int", "status", "=", "this", ".", "state", ";", "if", "(", "anyAreSet", "(", "status", ",", "ERROR", ")", ")", "{", "return", "-", "1", ";", "}", "else", "if", "(", "anyAreSet", "(", "status", ...
Get the load information. Add the error information for clients. @return the node load
[ "Get", "the", "load", "information", ".", "Add", "the", "error", "information", "for", "clients", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/Node.java#L140-L149
neo4j-contrib/neo4j-apoc-procedures
src/main/java/apoc/schema/Schemas.java
Schemas.nodeInfoFromIndexDefinition
private IndexConstraintNodeInfo nodeInfoFromIndexDefinition(IndexReference indexReference, SchemaRead schemaRead, TokenNameLookup tokens){ int[] labelIds = indexReference.schema().getEntityTokenIds(); if (labelIds.length != 1) throw new IllegalStateException("Index with more than one label"); String labelName = tokens.labelGetName(labelIds[0]); List<String> properties = new ArrayList<>(); Arrays.stream(indexReference.properties()).forEach((i) -> properties.add(tokens.propertyKeyGetName(i))); try { return new IndexConstraintNodeInfo( // Pretty print for index name String.format(":%s(%s)", labelName, StringUtils.join(properties, ",")), labelName, properties, schemaRead.indexGetState(indexReference).toString(), !indexReference.isUnique() ? "INDEX" : "UNIQUENESS", schemaRead.indexGetState(indexReference).equals(InternalIndexState.FAILED) ? schemaRead.indexGetFailure(indexReference) : "NO FAILURE", schemaRead.indexGetPopulationProgress(indexReference).getCompleted() / schemaRead.indexGetPopulationProgress(indexReference).getTotal() * 100, schemaRead.indexSize(indexReference), schemaRead.indexUniqueValuesSelectivity(indexReference), indexReference.userDescription(tokens) ); } catch(IndexNotFoundKernelException e) { return new IndexConstraintNodeInfo( // Pretty print for index name String.format(":%s(%s)", labelName, StringUtils.join(properties, ",")), labelName, properties, "NOT_FOUND", !indexReference.isUnique() ? "INDEX" : "UNIQUENESS", "NOT_FOUND", 0,0,0, indexReference.userDescription(tokens) ); } }
java
private IndexConstraintNodeInfo nodeInfoFromIndexDefinition(IndexReference indexReference, SchemaRead schemaRead, TokenNameLookup tokens){ int[] labelIds = indexReference.schema().getEntityTokenIds(); if (labelIds.length != 1) throw new IllegalStateException("Index with more than one label"); String labelName = tokens.labelGetName(labelIds[0]); List<String> properties = new ArrayList<>(); Arrays.stream(indexReference.properties()).forEach((i) -> properties.add(tokens.propertyKeyGetName(i))); try { return new IndexConstraintNodeInfo( // Pretty print for index name String.format(":%s(%s)", labelName, StringUtils.join(properties, ",")), labelName, properties, schemaRead.indexGetState(indexReference).toString(), !indexReference.isUnique() ? "INDEX" : "UNIQUENESS", schemaRead.indexGetState(indexReference).equals(InternalIndexState.FAILED) ? schemaRead.indexGetFailure(indexReference) : "NO FAILURE", schemaRead.indexGetPopulationProgress(indexReference).getCompleted() / schemaRead.indexGetPopulationProgress(indexReference).getTotal() * 100, schemaRead.indexSize(indexReference), schemaRead.indexUniqueValuesSelectivity(indexReference), indexReference.userDescription(tokens) ); } catch(IndexNotFoundKernelException e) { return new IndexConstraintNodeInfo( // Pretty print for index name String.format(":%s(%s)", labelName, StringUtils.join(properties, ",")), labelName, properties, "NOT_FOUND", !indexReference.isUnique() ? "INDEX" : "UNIQUENESS", "NOT_FOUND", 0,0,0, indexReference.userDescription(tokens) ); } }
[ "private", "IndexConstraintNodeInfo", "nodeInfoFromIndexDefinition", "(", "IndexReference", "indexReference", ",", "SchemaRead", "schemaRead", ",", "TokenNameLookup", "tokens", ")", "{", "int", "[", "]", "labelIds", "=", "indexReference", ".", "schema", "(", ")", ".",...
Index info from IndexDefinition @param indexReference @param schemaRead @param tokens @return
[ "Index", "info", "from", "IndexDefinition" ]
train
https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/schema/Schemas.java#L413-L446
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionWriter.java
BinaryExpressionWriter.writeBitwiseOp
protected boolean writeBitwiseOp(int type, boolean simulate) { type = type-BITWISE_OR; if (type<0 || type>2) return false; if (!simulate) { int bytecode = getBitwiseOperationBytecode(type); controller.getMethodVisitor().visitInsn(bytecode); controller.getOperandStack().replace(getNormalOpResultType(), 2); } return true; }
java
protected boolean writeBitwiseOp(int type, boolean simulate) { type = type-BITWISE_OR; if (type<0 || type>2) return false; if (!simulate) { int bytecode = getBitwiseOperationBytecode(type); controller.getMethodVisitor().visitInsn(bytecode); controller.getOperandStack().replace(getNormalOpResultType(), 2); } return true; }
[ "protected", "boolean", "writeBitwiseOp", "(", "int", "type", ",", "boolean", "simulate", ")", "{", "type", "=", "type", "-", "BITWISE_OR", ";", "if", "(", "type", "<", "0", "||", "type", ">", "2", ")", "return", "false", ";", "if", "(", "!", "simula...
writes some the bitwise operations. type is one of BITWISE_OR, BITWISE_AND, BITWISE_XOR @param type the token type @return true if a successful bitwise operation write
[ "writes", "some", "the", "bitwise", "operations", ".", "type", "is", "one", "of", "BITWISE_OR", "BITWISE_AND", "BITWISE_XOR" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/BinaryExpressionWriter.java#L238-L248
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsEditorBase.java
CmsEditorBase.getMessageForKey
public static String getMessageForKey(String key, Object... args) { String result = null; if (hasDictionary()) { result = m_dictionary.get(key); if ((result != null) && (args != null) && (args.length > 0)) { for (int i = 0; i < args.length; i++) { result = result.replace("{" + i + "}", String.valueOf(args[i])); } } } if (result == null) { result = ""; } return result; }
java
public static String getMessageForKey(String key, Object... args) { String result = null; if (hasDictionary()) { result = m_dictionary.get(key); if ((result != null) && (args != null) && (args.length > 0)) { for (int i = 0; i < args.length; i++) { result = result.replace("{" + i + "}", String.valueOf(args[i])); } } } if (result == null) { result = ""; } return result; }
[ "public", "static", "String", "getMessageForKey", "(", "String", "key", ",", "Object", "...", "args", ")", "{", "String", "result", "=", "null", ";", "if", "(", "hasDictionary", "(", ")", ")", "{", "result", "=", "m_dictionary", ".", "get", "(", "key", ...
Returns the formated message.<p> @param key the message key @param args the parameters to insert into the placeholders @return the formated message
[ "Returns", "the", "formated", "message", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsEditorBase.java#L202-L217
alkacon/opencms-core
src-setup/org/opencms/setup/db/CmsUpdateDBManager.java
CmsUpdateDBManager.getInstanceForDb
protected I_CmsUpdateDBPart getInstanceForDb(I_CmsUpdateDBPart dbUpdater, String dbName) { String clazz = dbUpdater.getClass().getName(); int pos = clazz.lastIndexOf('.'); clazz = clazz.substring(0, pos) + "." + dbName + clazz.substring(pos); try { return (I_CmsUpdateDBPart)Class.forName(clazz).newInstance(); } catch (Exception e) { e.printStackTrace(); return null; } }
java
protected I_CmsUpdateDBPart getInstanceForDb(I_CmsUpdateDBPart dbUpdater, String dbName) { String clazz = dbUpdater.getClass().getName(); int pos = clazz.lastIndexOf('.'); clazz = clazz.substring(0, pos) + "." + dbName + clazz.substring(pos); try { return (I_CmsUpdateDBPart)Class.forName(clazz).newInstance(); } catch (Exception e) { e.printStackTrace(); return null; } }
[ "protected", "I_CmsUpdateDBPart", "getInstanceForDb", "(", "I_CmsUpdateDBPart", "dbUpdater", ",", "String", "dbName", ")", "{", "String", "clazz", "=", "dbUpdater", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "int", "pos", "=", "clazz", ".", "l...
Creates a new instance for the given database and setting the db pool data.<p> @param dbUpdater the generic updater part @param dbName the database to get a new instance for @return right instance instance for the given database
[ "Creates", "a", "new", "instance", "for", "the", "given", "database", "and", "setting", "the", "db", "pool", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/CmsUpdateDBManager.java#L371-L382
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.refund_refundId_payment_GET
public OvhPayment refund_refundId_payment_GET(String refundId) throws IOException { String qPath = "/me/refund/{refundId}/payment"; StringBuilder sb = path(qPath, refundId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPayment.class); }
java
public OvhPayment refund_refundId_payment_GET(String refundId) throws IOException { String qPath = "/me/refund/{refundId}/payment"; StringBuilder sb = path(qPath, refundId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPayment.class); }
[ "public", "OvhPayment", "refund_refundId_payment_GET", "(", "String", "refundId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/refund/{refundId}/payment\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "refundId", ")", ";", "Strin...
Get this object properties REST: GET /me/refund/{refundId}/payment @param refundId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1436-L1441
domaframework/doma-gen
src/main/java/org/seasar/doma/extension/gen/EntityDescFactory.java
EntityDescFactory.createEntityDesc
public EntityDesc createEntityDesc( TableMeta tableMeta, String entityPrefix, String entitySuffix) { String name = StringUtil.fromSnakeCaseToCamelCase(tableMeta.getName()); return createEntityDesc(tableMeta, entityPrefix, entitySuffix, StringUtil.capitalize(name)); }
java
public EntityDesc createEntityDesc( TableMeta tableMeta, String entityPrefix, String entitySuffix) { String name = StringUtil.fromSnakeCaseToCamelCase(tableMeta.getName()); return createEntityDesc(tableMeta, entityPrefix, entitySuffix, StringUtil.capitalize(name)); }
[ "public", "EntityDesc", "createEntityDesc", "(", "TableMeta", "tableMeta", ",", "String", "entityPrefix", ",", "String", "entitySuffix", ")", "{", "String", "name", "=", "StringUtil", ".", "fromSnakeCaseToCamelCase", "(", "tableMeta", ".", "getName", "(", ")", ")"...
エンティティ記述を作成します。 @param tableMeta テーブルメタデータ @param entityPrefix エンティティクラスのプリフィックス @param entitySuffix エンティティクラスのサフィックス @return エンティティ記述
[ "エンティティ記述を作成します。" ]
train
https://github.com/domaframework/doma-gen/blob/8046e0b28d2167d444125f206ce36e554b3ee616/src/main/java/org/seasar/doma/extension/gen/EntityDescFactory.java#L129-L133
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/decompose/hessenberg/TridiagonalDecompositionHouseholder_ZDRM.java
TridiagonalDecompositionHouseholder_ZDRM.getQ
@Override public ZMatrixRMaj getQ(ZMatrixRMaj Q , boolean transposed ) { Q = UtilDecompositons_ZDRM.checkIdentity(Q,N,N); Arrays.fill(w,0,N*2,0); if( transposed ) { for( int j = N-2; j >= 0; j-- ) { QrHelperFunctions_ZDRM.extractHouseholderRow(QT,j,j+1,N,w,0); QrHelperFunctions_ZDRM.rank1UpdateMultL(Q, w, 0, gammas[j], j+1, j+1 , N); } } else { for( int j = N-2; j >= 0; j-- ) { QrHelperFunctions_ZDRM.extractHouseholderRow(QT,j,j+1,N,w,0); QrHelperFunctions_ZDRM.rank1UpdateMultR(Q, w, 0, gammas[j], j+1, j+1 , N, b); } } return Q; }
java
@Override public ZMatrixRMaj getQ(ZMatrixRMaj Q , boolean transposed ) { Q = UtilDecompositons_ZDRM.checkIdentity(Q,N,N); Arrays.fill(w,0,N*2,0); if( transposed ) { for( int j = N-2; j >= 0; j-- ) { QrHelperFunctions_ZDRM.extractHouseholderRow(QT,j,j+1,N,w,0); QrHelperFunctions_ZDRM.rank1UpdateMultL(Q, w, 0, gammas[j], j+1, j+1 , N); } } else { for( int j = N-2; j >= 0; j-- ) { QrHelperFunctions_ZDRM.extractHouseholderRow(QT,j,j+1,N,w,0); QrHelperFunctions_ZDRM.rank1UpdateMultR(Q, w, 0, gammas[j], j+1, j+1 , N, b); } } return Q; }
[ "@", "Override", "public", "ZMatrixRMaj", "getQ", "(", "ZMatrixRMaj", "Q", ",", "boolean", "transposed", ")", "{", "Q", "=", "UtilDecompositons_ZDRM", ".", "checkIdentity", "(", "Q", ",", "N", ",", "N", ")", ";", "Arrays", ".", "fill", "(", "w", ",", "...
An orthogonal matrix that has the following property: T = Q<sup>H</sup>AQ @param Q If not null then the results will be stored here. Otherwise a new matrix will be created. @return The extracted Q matrix.
[ "An", "orthogonal", "matrix", "that", "has", "the", "following", "property", ":", "T", "=", "Q<sup", ">", "H<", "/", "sup", ">", "AQ" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/hessenberg/TridiagonalDecompositionHouseholder_ZDRM.java#L129-L148
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/AddToListRepairer.java
AddToListRepairer.repairCommand
public AddToList repairCommand(final AddToList toRepair, final RemoveFromList repairAgainst) { final int indicesBefore = toRepair.getPosition() - repairAgainst.getStartPosition(); if (indicesBefore <= 0) { return toRepair; } final int indicesToDecrese = indicesBefore < repairAgainst.getRemoveCount() ? indicesBefore : repairAgainst .getRemoveCount(); return createCommand(toRepair, toRepair.getPosition() - indicesToDecrese); }
java
public AddToList repairCommand(final AddToList toRepair, final RemoveFromList repairAgainst) { final int indicesBefore = toRepair.getPosition() - repairAgainst.getStartPosition(); if (indicesBefore <= 0) { return toRepair; } final int indicesToDecrese = indicesBefore < repairAgainst.getRemoveCount() ? indicesBefore : repairAgainst .getRemoveCount(); return createCommand(toRepair, toRepair.getPosition() - indicesToDecrese); }
[ "public", "AddToList", "repairCommand", "(", "final", "AddToList", "toRepair", ",", "final", "RemoveFromList", "repairAgainst", ")", "{", "final", "int", "indicesBefore", "=", "toRepair", ".", "getPosition", "(", ")", "-", "repairAgainst", ".", "getStartPosition", ...
Repairs an {@link AddToList} in relation to a {@link RemoveFromList} command. @param toRepair The command to repair. @param repairAgainst The command to repair against. @return The repaired command.
[ "Repairs", "an", "{", "@link", "AddToList", "}", "in", "relation", "to", "a", "{", "@link", "RemoveFromList", "}", "command", "." ]
train
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/AddToListRepairer.java#L76-L84
greese/dasein-persist
src/main/java/org/dasein/persist/PersistentFactory.java
PersistentFactory.find
public Collection<T> find(Class<? extends Execution> cls, Map<String,Object> criteria) throws PersistenceException { logger.debug("enter - find(Class,Map)"); try { Collection<String> keys = criteria.keySet(); SearchTerm[] terms = new SearchTerm[keys.size()]; int i = 0; for( String key : keys ) { terms[i++] = new SearchTerm(key, Operator.EQUALS, criteria.get(key)); } return load(cls, null, terms); } finally { logger.debug("exit - find(Class,Map)"); } }
java
public Collection<T> find(Class<? extends Execution> cls, Map<String,Object> criteria) throws PersistenceException { logger.debug("enter - find(Class,Map)"); try { Collection<String> keys = criteria.keySet(); SearchTerm[] terms = new SearchTerm[keys.size()]; int i = 0; for( String key : keys ) { terms[i++] = new SearchTerm(key, Operator.EQUALS, criteria.get(key)); } return load(cls, null, terms); } finally { logger.debug("exit - find(Class,Map)"); } }
[ "public", "Collection", "<", "T", ">", "find", "(", "Class", "<", "?", "extends", "Execution", ">", "cls", ",", "Map", "<", "String", ",", "Object", ">", "criteria", ")", "throws", "PersistenceException", "{", "logger", ".", "debug", "(", "\"enter - find(C...
Executes an arbitrary search using the passed in search class and criteria. This is useful for searches that simply do not fit well into the rest of the API. @param cls the class to perform the search @param criteria the search criteria @return the results of the search @throws PersistenceException an error occurred performing the search
[ "Executes", "an", "arbitrary", "search", "using", "the", "passed", "in", "search", "class", "and", "criteria", ".", "This", "is", "useful", "for", "searches", "that", "simply", "do", "not", "fit", "well", "into", "the", "rest", "of", "the", "API", "." ]
train
https://github.com/greese/dasein-persist/blob/1104621ad1670a45488b093b984ec1db4c7be781/src/main/java/org/dasein/persist/PersistentFactory.java#L1456-L1471
primefaces/primefaces
src/main/java/org/primefaces/component/imagecropper/ImageCropperRenderer.java
ImageCropperRenderer.guessImageFormat
private String guessImageFormat(String contentType, String imagePath) throws IOException { String format = "png"; if (contentType == null) { contentType = URLConnection.guessContentTypeFromName(imagePath); } if (contentType != null) { format = contentType.replaceFirst("^image/([^;]+)[;]?.*$", "$1"); } else { int queryStringIndex = imagePath.indexOf('?'); if (queryStringIndex != -1) { imagePath = imagePath.substring(0, queryStringIndex); } String[] pathTokens = imagePath.split("\\."); if (pathTokens.length > 1) { format = pathTokens[pathTokens.length - 1]; } } return format; }
java
private String guessImageFormat(String contentType, String imagePath) throws IOException { String format = "png"; if (contentType == null) { contentType = URLConnection.guessContentTypeFromName(imagePath); } if (contentType != null) { format = contentType.replaceFirst("^image/([^;]+)[;]?.*$", "$1"); } else { int queryStringIndex = imagePath.indexOf('?'); if (queryStringIndex != -1) { imagePath = imagePath.substring(0, queryStringIndex); } String[] pathTokens = imagePath.split("\\."); if (pathTokens.length > 1) { format = pathTokens[pathTokens.length - 1]; } } return format; }
[ "private", "String", "guessImageFormat", "(", "String", "contentType", ",", "String", "imagePath", ")", "throws", "IOException", "{", "String", "format", "=", "\"png\"", ";", "if", "(", "contentType", "==", "null", ")", "{", "contentType", "=", "URLConnection", ...
Attempt to obtain the image format used to write the image from the contentType or the image's file extension.
[ "Attempt", "to", "obtain", "the", "image", "format", "used", "to", "write", "the", "image", "from", "the", "contentType", "or", "the", "image", "s", "file", "extension", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/component/imagecropper/ImageCropperRenderer.java#L281-L307
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/PlattSMO.java
PlattSMO.updateSetsLabeled
private void updateSetsLabeled(int i1, final double a1, final double C) { final double y_i = label[i1]; I1[i1] = a1 == 0 && y_i == 1; I2[i1] = a1 == C && y_i == -1; I3[i1] = a1 == C && y_i == 1; I4[i1] = a1 == 0 && y_i == -1; }
java
private void updateSetsLabeled(int i1, final double a1, final double C) { final double y_i = label[i1]; I1[i1] = a1 == 0 && y_i == 1; I2[i1] = a1 == C && y_i == -1; I3[i1] = a1 == C && y_i == 1; I4[i1] = a1 == 0 && y_i == -1; }
[ "private", "void", "updateSetsLabeled", "(", "int", "i1", ",", "final", "double", "a1", ",", "final", "double", "C", ")", "{", "final", "double", "y_i", "=", "label", "[", "i1", "]", ";", "I1", "[", "i1", "]", "=", "a1", "==", "0", "&&", "y_i", "...
Updates the index sets @param i1 the index to update for @param a1 the alphas value for the index @param C the regularization value to use for this datum
[ "Updates", "the", "index", "sets" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/PlattSMO.java#L469-L476
dihedron/dihedron-commons
src/main/java/org/dihedron/patterns/concurrent/TaskExecutor.java
TaskExecutor.waitForAny
public T waitForAny(List<Future<T>> futures, @SuppressWarnings("unchecked") TaskObserver<T>... observers) throws InterruptedException, ExecutionException { int count = futures.size(); while(count-- > 0) { int id = queue.take(); logger.debug("task '{}' complete (count: {}, queue: {})", id, count, queue.size()); T result = futures.get(id).get(); for(TaskObserver<T> observer : observers) { observer.onTaskComplete(tasks.get(id), result); } return result; } return null; }
java
public T waitForAny(List<Future<T>> futures, @SuppressWarnings("unchecked") TaskObserver<T>... observers) throws InterruptedException, ExecutionException { int count = futures.size(); while(count-- > 0) { int id = queue.take(); logger.debug("task '{}' complete (count: {}, queue: {})", id, count, queue.size()); T result = futures.get(id).get(); for(TaskObserver<T> observer : observers) { observer.onTaskComplete(tasks.get(id), result); } return result; } return null; }
[ "public", "T", "waitForAny", "(", "List", "<", "Future", "<", "T", ">", ">", "futures", ",", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "TaskObserver", "<", "T", ">", "...", "observers", ")", "throws", "InterruptedException", ",", "ExecutionException"...
Waits until the first task completes, then calls the (optional) observers to notify the completion and returns the result. @param futures the list of futures to wait for. @param observers an optional set of observers. @return the result of the first task to complete. @throws InterruptedException @throws ExecutionException
[ "Waits", "until", "the", "first", "task", "completes", "then", "calls", "the", "(", "optional", ")", "observers", "to", "notify", "the", "completion", "and", "returns", "the", "result", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/concurrent/TaskExecutor.java#L210-L222
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ValidIdentifiers.java
ValidIdentifiers.isValid
public static Datasubtype isValid(Datatype datatype, Set<Datasubtype> datasubtypes, String code) { Map<Datasubtype, ValiditySet> subtable = ValidityData.data.get(datatype); if (subtable != null) { for (Datasubtype datasubtype : datasubtypes) { ValiditySet validitySet = subtable.get(datasubtype); if (validitySet != null) { if (validitySet.contains(AsciiUtil.toLowerString(code))) { return datasubtype; } } } } return null; }
java
public static Datasubtype isValid(Datatype datatype, Set<Datasubtype> datasubtypes, String code) { Map<Datasubtype, ValiditySet> subtable = ValidityData.data.get(datatype); if (subtable != null) { for (Datasubtype datasubtype : datasubtypes) { ValiditySet validitySet = subtable.get(datasubtype); if (validitySet != null) { if (validitySet.contains(AsciiUtil.toLowerString(code))) { return datasubtype; } } } } return null; }
[ "public", "static", "Datasubtype", "isValid", "(", "Datatype", "datatype", ",", "Set", "<", "Datasubtype", ">", "datasubtypes", ",", "String", "code", ")", "{", "Map", "<", "Datasubtype", ",", "ValiditySet", ">", "subtable", "=", "ValidityData", ".", "data", ...
Returns the Datasubtype containing the code, or null if there is none.
[ "Returns", "the", "Datasubtype", "containing", "the", "code", "or", "null", "if", "there", "is", "none", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ValidIdentifiers.java#L172-L185
igniterealtime/Smack
smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java
AudioChannel.getPacketSize
private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException { String encoding = codecFormat.getEncoding(); if (encoding.equalsIgnoreCase(AudioFormat.GSM) || encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) { return milliseconds * 4; // 1 byte per millisec } else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) || encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) { return milliseconds * 8; } else { throw new IllegalArgumentException("Unknown codec type"); } }
java
private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException { String encoding = codecFormat.getEncoding(); if (encoding.equalsIgnoreCase(AudioFormat.GSM) || encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) { return milliseconds * 4; // 1 byte per millisec } else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) || encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) { return milliseconds * 8; } else { throw new IllegalArgumentException("Unknown codec type"); } }
[ "private", "int", "getPacketSize", "(", "Format", "codecFormat", ",", "int", "milliseconds", ")", "throws", "IllegalArgumentException", "{", "String", "encoding", "=", "codecFormat", ".", "getEncoding", "(", ")", ";", "if", "(", "encoding", ".", "equalsIgnoreCase"...
Get the best stanza size for a given codec and a codec rate @param codecFormat @param milliseconds @return the best stanza size @throws IllegalArgumentException
[ "Get", "the", "best", "stanza", "size", "for", "a", "given", "codec", "and", "a", "codec", "rate" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java#L320-L333
aspectran/aspectran
core/src/main/java/com/aspectran/core/support/i18n/message/AbstractMessageSource.java
AbstractMessageSource.getMessageFromParent
protected String getMessageFromParent(String code, Object[] args, Locale locale) { MessageSource parent = getParentMessageSource(); if (parent != null) { if (parent instanceof AbstractMessageSource) { // Call internal method to avoid getting the default code back // in case of "useCodeAsDefaultMessage" being activated. return ((AbstractMessageSource) parent).getMessageInternal(code, args, locale); } else { // Check parent MessageSource, returning null if not found there. return parent.getMessage(code, args, null, locale); } } // Not found in parent either. return null; }
java
protected String getMessageFromParent(String code, Object[] args, Locale locale) { MessageSource parent = getParentMessageSource(); if (parent != null) { if (parent instanceof AbstractMessageSource) { // Call internal method to avoid getting the default code back // in case of "useCodeAsDefaultMessage" being activated. return ((AbstractMessageSource) parent).getMessageInternal(code, args, locale); } else { // Check parent MessageSource, returning null if not found there. return parent.getMessage(code, args, null, locale); } } // Not found in parent either. return null; }
[ "protected", "String", "getMessageFromParent", "(", "String", "code", ",", "Object", "[", "]", "args", ",", "Locale", "locale", ")", "{", "MessageSource", "parent", "=", "getParentMessageSource", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", ...
Try to retrieve the given message from the parent MessageSource, if any. @param code the code to lookup up, such as 'calculator.noRateSet' @param args array of arguments that will be filled in for params within the message @param locale the Locale in which to do the lookup @return the resolved message, or {@code null} if not found @see #getParentMessageSource() #getParentMessageSource()
[ "Try", "to", "retrieve", "the", "given", "message", "from", "the", "parent", "MessageSource", "if", "any", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/AbstractMessageSource.java#L208-L222
raydac/netbeans-mmd-plugin
mind-map/mind-map-ide-common/src/main/java/com/igormaznitsa/mindmap/ide/commons/Misc.java
Misc.string2pattern
@Nonnull public static Pattern string2pattern(@Nonnull final String text, final int patternFlags) { final StringBuilder result = new StringBuilder(); for (final char c : text.toCharArray()) { result.append("\\u"); //NOI18N final String code = Integer.toHexString(c).toUpperCase(Locale.ENGLISH); result.append("0000", 0, 4 - code.length()).append(code); //NOI18N } return Pattern.compile(result.toString(), patternFlags); }
java
@Nonnull public static Pattern string2pattern(@Nonnull final String text, final int patternFlags) { final StringBuilder result = new StringBuilder(); for (final char c : text.toCharArray()) { result.append("\\u"); //NOI18N final String code = Integer.toHexString(c).toUpperCase(Locale.ENGLISH); result.append("0000", 0, 4 - code.length()).append(code); //NOI18N } return Pattern.compile(result.toString(), patternFlags); }
[ "@", "Nonnull", "public", "static", "Pattern", "string2pattern", "(", "@", "Nonnull", "final", "String", "text", ",", "final", "int", "patternFlags", ")", "{", "final", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "final...
Create pattern from string. @param text text to be converted into pattern. @param patternFlags flags to be used @return formed pattern
[ "Create", "pattern", "from", "string", "." ]
train
https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/mind-map-ide-common/src/main/java/com/igormaznitsa/mindmap/ide/commons/Misc.java#L54-L65
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/QueryRecord.java
QueryRecord.addSortParams
public String addSortParams(boolean bIncludeFileName, boolean bForceUniqueKey) { String strSort = super.addSortParams(bIncludeFileName, bForceUniqueKey); if (strSort.length() > 0) return strSort; // Sort string was specified for this "QueryRecord" Record stmtTable = this.getRecordlistAt(0); if (stmtTable != null) strSort += stmtTable.addSortParams(bIncludeFileName, bForceUniqueKey); return strSort; }
java
public String addSortParams(boolean bIncludeFileName, boolean bForceUniqueKey) { String strSort = super.addSortParams(bIncludeFileName, bForceUniqueKey); if (strSort.length() > 0) return strSort; // Sort string was specified for this "QueryRecord" Record stmtTable = this.getRecordlistAt(0); if (stmtTable != null) strSort += stmtTable.addSortParams(bIncludeFileName, bForceUniqueKey); return strSort; }
[ "public", "String", "addSortParams", "(", "boolean", "bIncludeFileName", ",", "boolean", "bForceUniqueKey", ")", "{", "String", "strSort", "=", "super", ".", "addSortParams", "(", "bIncludeFileName", ",", "bForceUniqueKey", ")", ";", "if", "(", "strSort", ".", "...
Setup the SQL Sort String. @param bIncludeFileName If true, include the filename with the fieldname in the string. @param bForceUniqueKey If params must be unique, if they aren't, add the unique key to the end. @return The SQL sort string.
[ "Setup", "the", "SQL", "Sort", "String", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/QueryRecord.java#L210-L219
mnlipp/jgrapes
org.jgrapes.http/src/org/jgrapes/http/StaticContentDispatcher.java
StaticContentDispatcher.onGet
@RequestHandler(dynamic = true) public void onGet(Request.In.Get event, IOSubchannel channel) throws ParseException, IOException { int prefixSegs = resourcePattern.matches(event.requestUri()); if (prefixSegs < 0) { return; } if (contentDirectory == null) { getFromUri(event, channel, prefixSegs); } else { getFromFileSystem(event, channel, prefixSegs); } }
java
@RequestHandler(dynamic = true) public void onGet(Request.In.Get event, IOSubchannel channel) throws ParseException, IOException { int prefixSegs = resourcePattern.matches(event.requestUri()); if (prefixSegs < 0) { return; } if (contentDirectory == null) { getFromUri(event, channel, prefixSegs); } else { getFromFileSystem(event, channel, prefixSegs); } }
[ "@", "RequestHandler", "(", "dynamic", "=", "true", ")", "public", "void", "onGet", "(", "Request", ".", "In", ".", "Get", "event", ",", "IOSubchannel", "channel", ")", "throws", "ParseException", ",", "IOException", "{", "int", "prefixSegs", "=", "resourceP...
Handles a `GET` request. @param event the event @param channel the channel @throws ParseException the parse exception @throws IOException Signals that an I/O exception has occurred.
[ "Handles", "a", "GET", "request", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/StaticContentDispatcher.java#L135-L147
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.isXMLName
protected boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if (!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
java
protected boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if (!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
[ "protected", "boolean", "isXMLName", "(", "String", "s", ",", "boolean", "xml11Version", ")", "{", "if", "(", "s", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "!", "xml11Version", ")", "return", "XMLChar", ".", "isValidName", "(", "...
Taken from org.apache.xerces.dom.CoreDocumentImpl Check the string against XML's definition of acceptable names for elements and attributes and so on using the XMLCharacterProperties utility class
[ "Taken", "from", "org", ".", "apache", ".", "xerces", ".", "dom", ".", "CoreDocumentImpl" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1108-L1117
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/SegwitAddress.java
SegwitAddress.fromKey
public static SegwitAddress fromKey(NetworkParameters params, ECKey key) { checkArgument(key.isCompressed(), "only compressed keys allowed"); return fromHash(params, key.getPubKeyHash()); }
java
public static SegwitAddress fromKey(NetworkParameters params, ECKey key) { checkArgument(key.isCompressed(), "only compressed keys allowed"); return fromHash(params, key.getPubKeyHash()); }
[ "public", "static", "SegwitAddress", "fromKey", "(", "NetworkParameters", "params", ",", "ECKey", "key", ")", "{", "checkArgument", "(", "key", ".", "isCompressed", "(", ")", ",", "\"only compressed keys allowed\"", ")", ";", "return", "fromHash", "(", "params", ...
Construct a {@link SegwitAddress} that represents the public part of the given {@link ECKey}. Note that an address is derived from a hash of the public key and is not the public key itself. @param params network this address is valid for @param key only the public part is used @return constructed address
[ "Construct", "a", "{", "@link", "SegwitAddress", "}", "that", "represents", "the", "public", "part", "of", "the", "given", "{", "@link", "ECKey", "}", ".", "Note", "that", "an", "address", "is", "derived", "from", "a", "hash", "of", "the", "public", "key...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/SegwitAddress.java#L205-L208
box/box-java-sdk
src/main/java/com/box/sdk/BoxFolder.java
BoxFolder.collaborate
public BoxCollaboration.Info collaborate(String email, BoxCollaboration.Role role) { JsonObject accessibleByField = new JsonObject(); accessibleByField.add("login", email); accessibleByField.add("type", "user"); return this.collaborate(accessibleByField, role, null, null); }
java
public BoxCollaboration.Info collaborate(String email, BoxCollaboration.Role role) { JsonObject accessibleByField = new JsonObject(); accessibleByField.add("login", email); accessibleByField.add("type", "user"); return this.collaborate(accessibleByField, role, null, null); }
[ "public", "BoxCollaboration", ".", "Info", "collaborate", "(", "String", "email", ",", "BoxCollaboration", ".", "Role", "role", ")", "{", "JsonObject", "accessibleByField", "=", "new", "JsonObject", "(", ")", ";", "accessibleByField", ".", "add", "(", "\"login\"...
Adds a collaborator to this folder. An email will be sent to the collaborator if they don't already have a Box account. @param email the email address of the collaborator to add. @param role the role of the collaborator. @return info about the new collaboration.
[ "Adds", "a", "collaborator", "to", "this", "folder", ".", "An", "email", "will", "be", "sent", "to", "the", "collaborator", "if", "they", "don", "t", "already", "have", "a", "Box", "account", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L160-L166
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.setOWLObjectListAttribute
public void setOWLObjectListAttribute(String name, List<OWLObject> value) { if(value == null) { throw new NullPointerException("value must not be null"); } List<OWLObject> valueCopy = new ArrayList<OWLObject>(value); setValue(owlObjectAttributes, name, valueCopy); }
java
public void setOWLObjectListAttribute(String name, List<OWLObject> value) { if(value == null) { throw new NullPointerException("value must not be null"); } List<OWLObject> valueCopy = new ArrayList<OWLObject>(value); setValue(owlObjectAttributes, name, valueCopy); }
[ "public", "void", "setOWLObjectListAttribute", "(", "String", "name", ",", "List", "<", "OWLObject", ">", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"value must not be null\"", ")", ";", "}", ...
Sets the {@link OWLObject} list values for an attribute. @param name The name of the attribute. Not null. @param value The value of the attribute. Not null. @throws NullPointerException if name is null or value is null.
[ "Sets", "the", "{" ]
train
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L471-L477
dashorst/wicket-stuff-markup-validator
isorelax/src/main/java/org/iso_relax/dispatcher/impl/AbstractSchemaProviderImpl.java
AbstractSchemaProviderImpl.addSchema
public void addSchema( String uri, IslandSchema s ) { if( schemata.containsKey(uri) ) throw new IllegalArgumentException(); schemata.put( uri, s ); }
java
public void addSchema( String uri, IslandSchema s ) { if( schemata.containsKey(uri) ) throw new IllegalArgumentException(); schemata.put( uri, s ); }
[ "public", "void", "addSchema", "(", "String", "uri", ",", "IslandSchema", "s", ")", "{", "if", "(", "schemata", ".", "containsKey", "(", "uri", ")", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "schemata", ".", "put", "(", "uri", ",", ...
adds a new IslandSchema. the caller should make sure that the given uri is not defined already.
[ "adds", "a", "new", "IslandSchema", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/isorelax/src/main/java/org/iso_relax/dispatcher/impl/AbstractSchemaProviderImpl.java#L49-L53
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java
BaseProfile.generateMavenXml
void generateMavenXml(Definition def, String outputDir) { try { FileWriter pomfw = Utils.createFile("pom.xml", outputDir); PomXmlGen pxGen = new PomXmlGen(); pxGen.generate(def, pomfw); pomfw.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
java
void generateMavenXml(Definition def, String outputDir) { try { FileWriter pomfw = Utils.createFile("pom.xml", outputDir); PomXmlGen pxGen = new PomXmlGen(); pxGen.generate(def, pomfw); pomfw.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
[ "void", "generateMavenXml", "(", "Definition", "def", ",", "String", "outputDir", ")", "{", "try", "{", "FileWriter", "pomfw", "=", "Utils", ".", "createFile", "(", "\"pom.xml\"", ",", "outputDir", ")", ";", "PomXmlGen", "pxGen", "=", "new", "PomXmlGen", "("...
generate ant build.xml @param def Definition @param outputDir output directory
[ "generate", "ant", "build", ".", "xml" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java#L389-L402
spring-projects/spring-hateoas
src/main/java/org/springframework/hateoas/mediatype/hal/HalLinkRelation.java
HalLinkRelation.of
@JsonCreator private static HalLinkRelation of(String relation) { String[] split = relation.split(":"); String curie = split.length == 1 ? null : split[0]; String localPart = split.length == 1 ? split[0] : split[1]; return new HalLinkRelation(curie, localPart); }
java
@JsonCreator private static HalLinkRelation of(String relation) { String[] split = relation.split(":"); String curie = split.length == 1 ? null : split[0]; String localPart = split.length == 1 ? split[0] : split[1]; return new HalLinkRelation(curie, localPart); }
[ "@", "JsonCreator", "private", "static", "HalLinkRelation", "of", "(", "String", "relation", ")", "{", "String", "[", "]", "split", "=", "relation", ".", "split", "(", "\":\"", ")", ";", "String", "curie", "=", "split", ".", "length", "==", "1", "?", "...
Creates a new {@link HalLinkRelation} from the given link relation {@link String}. @param relation must not be {@literal null}. @return
[ "Creates", "a", "new", "{", "@link", "HalLinkRelation", "}", "from", "the", "given", "link", "relation", "{", "@link", "String", "}", "." ]
train
https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/mediatype/hal/HalLinkRelation.java#L74-L83
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/StrMinMax.java
StrMinMax.execute
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final String stringValue = value.toString(); final int length = stringValue.length(); if( length < min || length > max ) { throw new SuperCsvConstraintViolationException(String.format( "the length (%d) of value '%s' does not lie between the min (%d) and max (%d) values (inclusive)", length, stringValue, min, max), context, this); } return next.execute(stringValue, context); }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final String stringValue = value.toString(); final int length = stringValue.length(); if( length < min || length > max ) { throw new SuperCsvConstraintViolationException(String.format( "the length (%d) of value '%s' does not lie between the min (%d) and max (%d) values (inclusive)", length, stringValue, min, max), context, this); } return next.execute(stringValue, context); }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "final", "String", "stringValue", "=", "value", ".", "toString", "(", ")", ";", ...
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null @throws SuperCsvConstraintViolationException if {@code length < min} or {@code length > max}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/StrMinMax.java#L105-L117
googleapis/google-cloud-java
google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystem.java
CloudStorageFileSystem.forBucket
@CheckReturnValue public static CloudStorageFileSystem forBucket(String bucket, CloudStorageConfiguration config) { checkArgument( !bucket.startsWith(URI_SCHEME + ":"), "Bucket name must not have schema: %s", bucket); checkNotNull(config); return new CloudStorageFileSystem( new CloudStorageFileSystemProvider(config.userProject()), bucket, config); }
java
@CheckReturnValue public static CloudStorageFileSystem forBucket(String bucket, CloudStorageConfiguration config) { checkArgument( !bucket.startsWith(URI_SCHEME + ":"), "Bucket name must not have schema: %s", bucket); checkNotNull(config); return new CloudStorageFileSystem( new CloudStorageFileSystemProvider(config.userProject()), bucket, config); }
[ "@", "CheckReturnValue", "public", "static", "CloudStorageFileSystem", "forBucket", "(", "String", "bucket", ",", "CloudStorageConfiguration", "config", ")", "{", "checkArgument", "(", "!", "bucket", ".", "startsWith", "(", "URI_SCHEME", "+", "\":\"", ")", ",", "\...
Creates new file system instance for {@code bucket}, with customizable settings. @see #forBucket(String)
[ "Creates", "new", "file", "system", "instance", "for", "{", "@code", "bucket", "}", "with", "customizable", "settings", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystem.java#L142-L149
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java
EventHubConnectionsInner.beginCreateOrUpdate
public EventHubConnectionInner beginCreateOrUpdate(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).toBlocking().single().body(); }
java
public EventHubConnectionInner beginCreateOrUpdate(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).toBlocking().single().body(); }
[ "public", "EventHubConnectionInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "String", "eventHubConnectionName", ",", "EventHubConnectionInner", "parameters", ")", "{", "return", "beginCrea...
Creates or updates a Event Hub connection. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param eventHubConnectionName The name of the event hub connection. @param parameters The Event Hub connection parameters supplied to the CreateOrUpdate 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 EventHubConnectionInner object if successful.
[ "Creates", "or", "updates", "a", "Event", "Hub", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L504-L506
baratine/baratine
web/src/main/java/com/caucho/v5/log/impl/RolloverLogBase.java
RolloverLogBase.getFormatName
protected String getFormatName(String format, long time) { if (time <= 0) { time = CurrentTime.currentTime(); } if (true) throw new UnsupportedOperationException(); /* if (format != null) return QDate.formatLocal(time, format); else if (_rolloverCron != null) return _rolloverPrefix + "." + QDate.formatLocal(time, "%Y%m%d.%H"); else if (getRolloverPeriod() % (24 * 3600 * 1000L) == 0) return _rolloverPrefix + "." + QDate.formatLocal(time, "%Y%m%d"); else return _rolloverPrefix + "." + QDate.formatLocal(time, "%Y%m%d.%H"); */ return _rolloverPrefix + ".date"; }
java
protected String getFormatName(String format, long time) { if (time <= 0) { time = CurrentTime.currentTime(); } if (true) throw new UnsupportedOperationException(); /* if (format != null) return QDate.formatLocal(time, format); else if (_rolloverCron != null) return _rolloverPrefix + "." + QDate.formatLocal(time, "%Y%m%d.%H"); else if (getRolloverPeriod() % (24 * 3600 * 1000L) == 0) return _rolloverPrefix + "." + QDate.formatLocal(time, "%Y%m%d"); else return _rolloverPrefix + "." + QDate.formatLocal(time, "%Y%m%d.%H"); */ return _rolloverPrefix + ".date"; }
[ "protected", "String", "getFormatName", "(", "String", "format", ",", "long", "time", ")", "{", "if", "(", "time", "<=", "0", ")", "{", "time", "=", "CurrentTime", ".", "currentTime", "(", ")", ";", "}", "if", "(", "true", ")", "throw", "new", "Unsup...
Returns the name of the archived file @param time the archive date
[ "Returns", "the", "name", "of", "the", "archived", "file" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/log/impl/RolloverLogBase.java#L827-L847
TGIO/RNCryptorNative
jncryptor/src/main/java/org/cryptonode/jncryptor/Validate.java
Validate.isCorrectLength
static void isCorrectLength(byte[] object, int length, String name) { Validate.notNull(object, "%s cannot be null.", name); Validate.isTrue(object.length == length, "%s should be %d bytes, found %d bytes.", name, length, object.length); }
java
static void isCorrectLength(byte[] object, int length, String name) { Validate.notNull(object, "%s cannot be null.", name); Validate.isTrue(object.length == length, "%s should be %d bytes, found %d bytes.", name, length, object.length); }
[ "static", "void", "isCorrectLength", "(", "byte", "[", "]", "object", ",", "int", "length", ",", "String", "name", ")", "{", "Validate", ".", "notNull", "(", "object", ",", "\"%s cannot be null.\"", ",", "name", ")", ";", "Validate", ".", "isTrue", "(", ...
Tests object is not null and is of correct length. @param object @param length @param name
[ "Tests", "object", "is", "not", "null", "and", "is", "of", "correct", "length", "." ]
train
https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/Validate.java#L44-L49
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/context/ExternalContext.java
ExternalContext.responseSendError
public void responseSendError(int statusCode, String message) throws IOException { if (defaultExternalContext != null) { defaultExternalContext.responseSendError(statusCode, message); } else { throw new UnsupportedOperationException(); } }
java
public void responseSendError(int statusCode, String message) throws IOException { if (defaultExternalContext != null) { defaultExternalContext.responseSendError(statusCode, message); } else { throw new UnsupportedOperationException(); } }
[ "public", "void", "responseSendError", "(", "int", "statusCode", ",", "String", "message", ")", "throws", "IOException", "{", "if", "(", "defaultExternalContext", "!=", "null", ")", "{", "defaultExternalContext", ".", "responseSendError", "(", "statusCode", ",", "...
<p class="changed_added_2_0">Sends an HTTP status code with message.</p> <p><em>Servlet:</em> This must be performed by calling the <code>javax.servlet.http.HttpServletResponse</code> <code>sendError</code> method.</p> <p>The default implementation throws <code>UnsupportedOperationException</code> and is provided for the sole purpose of not breaking existing applications that extend this class.</p> @param statusCode an HTTP status code @param message an option message to detail the cause of the code @since 2.0
[ "<p", "class", "=", "changed_added_2_0", ">", "Sends", "an", "HTTP", "status", "code", "with", "message", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/context/ExternalContext.java#L1819-L1827
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java
MapDotApi.dotGetNullableString
public static String dotGetNullableString(final Map map, final String pathString) { return dotGetNullable(map, String.class, pathString); }
java
public static String dotGetNullableString(final Map map, final String pathString) { return dotGetNullable(map, String.class, pathString); }
[ "public", "static", "String", "dotGetNullableString", "(", "final", "Map", "map", ",", "final", "String", "pathString", ")", "{", "return", "dotGetNullable", "(", "map", ",", "String", ".", "class", ",", "pathString", ")", ";", "}" ]
Get string value by path. @param map subject @param pathString nodes to walk in map @return value
[ "Get", "string", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L146-L148
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/birch/CFTree.java
CFTree.rebuildTree
protected void rebuildTree() { final int dim = root.getDimensionality(); double t = estimateThreshold(root) / leaves; t *= t; // Never decrease the threshold. thresholdsq = t > thresholdsq ? t : thresholdsq; LOG.debug("New squared threshold: " + thresholdsq); LeafIterator iter = new LeafIterator(root); // Will keep the old root. assert (iter.valid()); ClusteringFeature first = iter.get(); leaves = 0; // Make a new root node: root = new TreeNode(dim, capacity); root.children[0] = first; root.addToStatistics(first); ++leaves; for(iter.advance(); iter.valid(); iter.advance()) { TreeNode other = insert(root, iter.get()); // Handle root overflow: if(other != null) { TreeNode newnode = new TreeNode(dim, capacity); newnode.addToStatistics(newnode.children[0] = root); newnode.addToStatistics(newnode.children[1] = other); root = newnode; } } }
java
protected void rebuildTree() { final int dim = root.getDimensionality(); double t = estimateThreshold(root) / leaves; t *= t; // Never decrease the threshold. thresholdsq = t > thresholdsq ? t : thresholdsq; LOG.debug("New squared threshold: " + thresholdsq); LeafIterator iter = new LeafIterator(root); // Will keep the old root. assert (iter.valid()); ClusteringFeature first = iter.get(); leaves = 0; // Make a new root node: root = new TreeNode(dim, capacity); root.children[0] = first; root.addToStatistics(first); ++leaves; for(iter.advance(); iter.valid(); iter.advance()) { TreeNode other = insert(root, iter.get()); // Handle root overflow: if(other != null) { TreeNode newnode = new TreeNode(dim, capacity); newnode.addToStatistics(newnode.children[0] = root); newnode.addToStatistics(newnode.children[1] = other); root = newnode; } } }
[ "protected", "void", "rebuildTree", "(", ")", "{", "final", "int", "dim", "=", "root", ".", "getDimensionality", "(", ")", ";", "double", "t", "=", "estimateThreshold", "(", "root", ")", "/", "leaves", ";", "t", "*=", "t", ";", "// Never decrease the thres...
Rebuild the CFTree to condense it to approximately half the size.
[ "Rebuild", "the", "CFTree", "to", "condense", "it", "to", "approximately", "half", "the", "size", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/birch/CFTree.java#L168-L196
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java
DatabaseVulnerabilityAssessmentScansInner.listByDatabaseAsync
public Observable<Page<VulnerabilityAssessmentScanRecordInner>> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) .map(new Func1<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>, Page<VulnerabilityAssessmentScanRecordInner>>() { @Override public Page<VulnerabilityAssessmentScanRecordInner> call(ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>> response) { return response.body(); } }); }
java
public Observable<Page<VulnerabilityAssessmentScanRecordInner>> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) .map(new Func1<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>, Page<VulnerabilityAssessmentScanRecordInner>>() { @Override public Page<VulnerabilityAssessmentScanRecordInner> call(ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "VulnerabilityAssessmentScanRecordInner", ">", ">", "listByDatabaseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ",", "final", "String", "databaseName", ")", "{", "return", "listByD...
Lists the vulnerability assessment scans of a database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VulnerabilityAssessmentScanRecordInner&gt; object
[ "Lists", "the", "vulnerability", "assessment", "scans", "of", "a", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java#L139-L147
liyiorg/weixin-popular
src/main/java/weixin/popular/util/SignatureUtil.java
SignatureUtil.validateSign
public static boolean validateSign(Map<String,String> map,String sign_type,String key){ if(map.get("sign") == null){ return false; } return map.get("sign").equals(generateSign(map,sign_type,key)); }
java
public static boolean validateSign(Map<String,String> map,String sign_type,String key){ if(map.get("sign") == null){ return false; } return map.get("sign").equals(generateSign(map,sign_type,key)); }
[ "public", "static", "boolean", "validateSign", "(", "Map", "<", "String", ",", "String", ">", "map", ",", "String", "sign_type", ",", "String", "key", ")", "{", "if", "(", "map", ".", "get", "(", "\"sign\"", ")", "==", "null", ")", "{", "return", "fa...
mch 支付、代扣API调用签名验证 @param map 参与签名的参数 @param sign_type HMAC-SHA256 或 MD5 @param key mch key @return boolean
[ "mch", "支付、代扣API调用签名验证" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/SignatureUtil.java#L91-L96
Hygieia/Hygieia
api-audit/src/main/java/com/capitalone/dashboard/service/DashboardAuditServiceImpl.java
DashboardAuditServiceImpl.getDashboardReviewResponse
@SuppressWarnings("PMD.NPathComplexity") @Override public DashboardReviewResponse getDashboardReviewResponse(String dashboardTitle, DashboardType dashboardType, String businessService, String businessApp, long beginDate, long endDate, Set<AuditType> auditTypes) throws AuditException { validateParameters(dashboardTitle,dashboardType, businessService, businessApp, beginDate, endDate); DashboardReviewResponse dashboardReviewResponse = new DashboardReviewResponse(); Dashboard dashboard = getDashboard(dashboardTitle, dashboardType, businessService, businessApp); if (dashboard == null) { dashboardReviewResponse.addAuditStatus(DashboardAuditStatus.DASHBOARD_NOT_REGISTERED); return dashboardReviewResponse; } dashboardReviewResponse.setDashboardTitle(dashboard.getTitle()); dashboardReviewResponse.setBusinessApplication(StringUtils.isEmpty(businessApp) ? dashboard.getConfigurationItemBusAppName() : businessApp); dashboardReviewResponse.setBusinessService(StringUtils.isEmpty(businessService) ? dashboard.getConfigurationItemBusServName() : businessService); if (auditTypes.contains(AuditType.ALL)) { auditTypes.addAll(Sets.newHashSet(AuditType.values())); auditTypes.remove(AuditType.ALL); } auditTypes.forEach(auditType -> { Evaluator evaluator = auditModel.evaluatorMap().get(auditType); try { Collection<AuditReviewResponse> auditResponse = evaluator.evaluate(dashboard, beginDate, endDate, null); dashboardReviewResponse.addReview(auditType, auditResponse); dashboardReviewResponse.addAuditStatus(auditModel.successStatusMap().get(auditType)); } catch (AuditException e) { if (e.getErrorCode() == AuditException.NO_COLLECTOR_ITEM_CONFIGURED) { dashboardReviewResponse.addAuditStatus(auditModel.errorStatusMap().get(auditType)); } } }); return dashboardReviewResponse; }
java
@SuppressWarnings("PMD.NPathComplexity") @Override public DashboardReviewResponse getDashboardReviewResponse(String dashboardTitle, DashboardType dashboardType, String businessService, String businessApp, long beginDate, long endDate, Set<AuditType> auditTypes) throws AuditException { validateParameters(dashboardTitle,dashboardType, businessService, businessApp, beginDate, endDate); DashboardReviewResponse dashboardReviewResponse = new DashboardReviewResponse(); Dashboard dashboard = getDashboard(dashboardTitle, dashboardType, businessService, businessApp); if (dashboard == null) { dashboardReviewResponse.addAuditStatus(DashboardAuditStatus.DASHBOARD_NOT_REGISTERED); return dashboardReviewResponse; } dashboardReviewResponse.setDashboardTitle(dashboard.getTitle()); dashboardReviewResponse.setBusinessApplication(StringUtils.isEmpty(businessApp) ? dashboard.getConfigurationItemBusAppName() : businessApp); dashboardReviewResponse.setBusinessService(StringUtils.isEmpty(businessService) ? dashboard.getConfigurationItemBusServName() : businessService); if (auditTypes.contains(AuditType.ALL)) { auditTypes.addAll(Sets.newHashSet(AuditType.values())); auditTypes.remove(AuditType.ALL); } auditTypes.forEach(auditType -> { Evaluator evaluator = auditModel.evaluatorMap().get(auditType); try { Collection<AuditReviewResponse> auditResponse = evaluator.evaluate(dashboard, beginDate, endDate, null); dashboardReviewResponse.addReview(auditType, auditResponse); dashboardReviewResponse.addAuditStatus(auditModel.successStatusMap().get(auditType)); } catch (AuditException e) { if (e.getErrorCode() == AuditException.NO_COLLECTOR_ITEM_CONFIGURED) { dashboardReviewResponse.addAuditStatus(auditModel.errorStatusMap().get(auditType)); } } }); return dashboardReviewResponse; }
[ "@", "SuppressWarnings", "(", "\"PMD.NPathComplexity\"", ")", "@", "Override", "public", "DashboardReviewResponse", "getDashboardReviewResponse", "(", "String", "dashboardTitle", ",", "DashboardType", "dashboardType", ",", "String", "businessService", ",", "String", "busine...
Calculates audit response for a given dashboard @param dashboardTitle @param dashboardType @param businessService @param businessApp @param beginDate @param endDate @param auditTypes @return @DashboardReviewResponse for a given dashboard @throws AuditException
[ "Calculates", "audit", "response", "for", "a", "given", "dashboard" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api-audit/src/main/java/com/capitalone/dashboard/service/DashboardAuditServiceImpl.java#L65-L102
elki-project/elki
elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java
AbstractRStarTree.initializeFromFile
@Override public void initializeFromFile(TreeIndexHeader header, PageFile<N> file) { super.initializeFromFile(header, file); // compute height this.height = computeHeight(); if(getLogger().isDebugging()) { getLogger().debugFine(new StringBuilder(100).append(getClass()) // .append("\n height = ").append(height).toString()); } }
java
@Override public void initializeFromFile(TreeIndexHeader header, PageFile<N> file) { super.initializeFromFile(header, file); // compute height this.height = computeHeight(); if(getLogger().isDebugging()) { getLogger().debugFine(new StringBuilder(100).append(getClass()) // .append("\n height = ").append(height).toString()); } }
[ "@", "Override", "public", "void", "initializeFromFile", "(", "TreeIndexHeader", "header", ",", "PageFile", "<", "N", ">", "file", ")", "{", "super", ".", "initializeFromFile", "(", "header", ",", "file", ")", ";", "// compute height", "this", ".", "height", ...
Initializes this R*-Tree from an existing persistent file. {@inheritDoc}
[ "Initializes", "this", "R", "*", "-", "Tree", "from", "an", "existing", "persistent", "file", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java#L242-L252
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java
RuleBasedCollator.setVariableTop
@Override @Deprecated public int setVariableTop(String varTop) { checkNotFrozen(); if (varTop == null || varTop.length() == 0) { throw new IllegalArgumentException("Variable top argument string can not be null or zero in length."); } boolean numeric = settings.readOnly().isNumeric(); long ce1, ce2; if(settings.readOnly().dontCheckFCD()) { UTF16CollationIterator ci = new UTF16CollationIterator(data, numeric, varTop, 0); ce1 = ci.nextCE(); ce2 = ci.nextCE(); } else { FCDUTF16CollationIterator ci = new FCDUTF16CollationIterator(data, numeric, varTop, 0); ce1 = ci.nextCE(); ce2 = ci.nextCE(); } if(ce1 == Collation.NO_CE || ce2 != Collation.NO_CE) { throw new IllegalArgumentException("Variable top argument string must map to exactly one collation element"); } internalSetVariableTop(ce1 >>> 32); return (int)settings.readOnly().variableTop; }
java
@Override @Deprecated public int setVariableTop(String varTop) { checkNotFrozen(); if (varTop == null || varTop.length() == 0) { throw new IllegalArgumentException("Variable top argument string can not be null or zero in length."); } boolean numeric = settings.readOnly().isNumeric(); long ce1, ce2; if(settings.readOnly().dontCheckFCD()) { UTF16CollationIterator ci = new UTF16CollationIterator(data, numeric, varTop, 0); ce1 = ci.nextCE(); ce2 = ci.nextCE(); } else { FCDUTF16CollationIterator ci = new FCDUTF16CollationIterator(data, numeric, varTop, 0); ce1 = ci.nextCE(); ce2 = ci.nextCE(); } if(ce1 == Collation.NO_CE || ce2 != Collation.NO_CE) { throw new IllegalArgumentException("Variable top argument string must map to exactly one collation element"); } internalSetVariableTop(ce1 >>> 32); return (int)settings.readOnly().variableTop; }
[ "@", "Override", "@", "Deprecated", "public", "int", "setVariableTop", "(", "String", "varTop", ")", "{", "checkNotFrozen", "(", ")", ";", "if", "(", "varTop", "==", "null", "||", "varTop", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", ...
<strong>[icu]</strong> Sets the variable top to the primary weight of the specified string. <p>Beginning with ICU 53, the variable top is pinned to the top of one of the supported reordering groups, and it must not be beyond the last of those groups. See {@link #setMaxVariable(int)}. @param varTop one or more (if contraction) characters to which the variable top should be set @return variable top primary weight @exception IllegalArgumentException is thrown if varTop argument is not a valid variable top element. A variable top element is invalid when <ul> <li>it is a contraction that does not exist in the Collation order <li>the variable top is beyond the last reordering group supported by setMaxVariable() <li>when the varTop argument is null or zero in length. </ul> @see #getVariableTop @see RuleBasedCollator#setAlternateHandlingShifted @deprecated ICU 53 Call {@link #setMaxVariable(int)} instead. @hide original deprecated declaration
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Sets", "the", "variable", "top", "to", "the", "primary", "weight", "of", "the", "specified", "string", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L778-L801
tvesalainen/util
util/src/main/java/org/vesalainen/util/CharSequences.java
CharSequences.startsWith
public static boolean startsWith(CharSequence seq, CharSequence pattern) { return startsWith(seq, pattern, Funcs::same); }
java
public static boolean startsWith(CharSequence seq, CharSequence pattern) { return startsWith(seq, pattern, Funcs::same); }
[ "public", "static", "boolean", "startsWith", "(", "CharSequence", "seq", ",", "CharSequence", "pattern", ")", "{", "return", "startsWith", "(", "seq", ",", "pattern", ",", "Funcs", "::", "same", ")", ";", "}" ]
Return true if seq start match pattern exactly. @param seq @param pattern @return
[ "Return", "true", "if", "seq", "start", "match", "pattern", "exactly", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L69-L72
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java
CPOptionPersistenceImpl.countByG_K
@Override public int countByG_K(long groupId, String key) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_K; Object[] finderArgs = new Object[] { groupId, key }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPOPTION_WHERE); query.append(_FINDER_COLUMN_G_K_GROUPID_2); boolean bindKey = false; if (key == null) { query.append(_FINDER_COLUMN_G_K_KEY_1); } else if (key.equals("")) { query.append(_FINDER_COLUMN_G_K_KEY_3); } else { bindKey = true; query.append(_FINDER_COLUMN_G_K_KEY_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindKey) { qPos.add(key); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_K(long groupId, String key) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_K; Object[] finderArgs = new Object[] { groupId, key }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPOPTION_WHERE); query.append(_FINDER_COLUMN_G_K_GROUPID_2); boolean bindKey = false; if (key == null) { query.append(_FINDER_COLUMN_G_K_KEY_1); } else if (key.equals("")) { query.append(_FINDER_COLUMN_G_K_KEY_3); } else { bindKey = true; query.append(_FINDER_COLUMN_G_K_KEY_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindKey) { qPos.add(key); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_K", "(", "long", "groupId", ",", "String", "key", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_K", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "groupId", ",", ...
Returns the number of cp options where groupId = &#63; and key = &#63;. @param groupId the group ID @param key the key @return the number of matching cp options
[ "Returns", "the", "number", "of", "cp", "options", "where", "groupId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L2153-L2214
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/validation/RelsValidator.java
RelsValidator.checkResourceURI
private void checkResourceURI(String resourceURI, String relName) throws SAXException { URI uri; try { uri = new URI(resourceURI); } catch (Exception e) { throw new SAXException("RelsExtValidator:" + "Error in relationship '" + relName + "'." + " The RDF 'resource' is not a valid URI."); } if (!uri.isAbsolute()) { throw new SAXException("RelsValidator:" + "Error in relationship '" + relName + "'." + " The specified RDF 'resource' is not an absolute URI."); } }
java
private void checkResourceURI(String resourceURI, String relName) throws SAXException { URI uri; try { uri = new URI(resourceURI); } catch (Exception e) { throw new SAXException("RelsExtValidator:" + "Error in relationship '" + relName + "'." + " The RDF 'resource' is not a valid URI."); } if (!uri.isAbsolute()) { throw new SAXException("RelsValidator:" + "Error in relationship '" + relName + "'." + " The specified RDF 'resource' is not an absolute URI."); } }
[ "private", "void", "checkResourceURI", "(", "String", "resourceURI", ",", "String", "relName", ")", "throws", "SAXException", "{", "URI", "uri", ";", "try", "{", "uri", "=", "new", "URI", "(", "resourceURI", ")", ";", "}", "catch", "(", "Exception", "e", ...
checkResourceURI: ensure that the target resource is a proper URI. @param resourceURI the URI value of the RDF 'resource' attribute @param relName the name of the relationship property being evaluated @throws SAXException
[ "checkResourceURI", ":", "ensure", "that", "the", "target", "resource", "is", "a", "proper", "URI", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/validation/RelsValidator.java#L432-L449
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.moveFromLocalFile
public void moveFromLocalFile(Path[] srcs, Path dst) throws IOException { copyFromLocalFile(true, true, false, srcs, dst); }
java
public void moveFromLocalFile(Path[] srcs, Path dst) throws IOException { copyFromLocalFile(true, true, false, srcs, dst); }
[ "public", "void", "moveFromLocalFile", "(", "Path", "[", "]", "srcs", ",", "Path", "dst", ")", "throws", "IOException", "{", "copyFromLocalFile", "(", "true", ",", "true", ",", "false", ",", "srcs", ",", "dst", ")", ";", "}" ]
The src files is on the local disk. Add it to FS at the given dst name, removing the source afterwards.
[ "The", "src", "files", "is", "on", "the", "local", "disk", ".", "Add", "it", "to", "FS", "at", "the", "given", "dst", "name", "removing", "the", "source", "afterwards", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1632-L1635
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/jmx/JmxManagementService.java
JmxManagementService.handleNotification
@Override public void handleNotification(Notification notification, Object handback) { String notificationType = notification.getType(); if (notificationType.equals(JMXConnectionNotification.OPENED)) { managementContext.incrementManagementSessionCount(); } else if (notificationType.equals(JMXConnectionNotification.CLOSED)) { managementContext.decrementManagementSessionCount(); } }
java
@Override public void handleNotification(Notification notification, Object handback) { String notificationType = notification.getType(); if (notificationType.equals(JMXConnectionNotification.OPENED)) { managementContext.incrementManagementSessionCount(); } else if (notificationType.equals(JMXConnectionNotification.CLOSED)) { managementContext.decrementManagementSessionCount(); } }
[ "@", "Override", "public", "void", "handleNotification", "(", "Notification", "notification", ",", "Object", "handback", ")", "{", "String", "notificationType", "=", "notification", ".", "getType", "(", ")", ";", "if", "(", "notificationType", ".", "equals", "("...
NotificationListener support for connection open and closed notifications
[ "NotificationListener", "support", "for", "connection", "open", "and", "closed", "notifications" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/jmx/JmxManagementService.java#L230-L238
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java
Aggregations.bigDecimalMin
public static <Key, Value> Aggregation<Key, BigDecimal, BigDecimal> bigDecimalMin() { return new AggregationAdapter(new BigDecimalMinAggregation<Key, Value>()); }
java
public static <Key, Value> Aggregation<Key, BigDecimal, BigDecimal> bigDecimalMin() { return new AggregationAdapter(new BigDecimalMinAggregation<Key, Value>()); }
[ "public", "static", "<", "Key", ",", "Value", ">", "Aggregation", "<", "Key", ",", "BigDecimal", ",", "BigDecimal", ">", "bigDecimalMin", "(", ")", "{", "return", "new", "AggregationAdapter", "(", "new", "BigDecimalMinAggregation", "<", "Key", ",", "Value", ...
Returns an aggregation to find the {@link java.math.BigDecimal} minimum of all supplied values.<br/> This aggregation is similar to: <pre>SELECT MIN(value) FROM x</pre> @param <Key> the input key type @param <Value> the supplied value type @return the minimum value over all supplied values
[ "Returns", "an", "aggregation", "to", "find", "the", "{", "@link", "java", ".", "math", ".", "BigDecimal", "}", "minimum", "of", "all", "supplied", "values", ".", "<br", "/", ">", "This", "aggregation", "is", "similar", "to", ":", "<pre", ">", "SELECT", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L273-L275
jbundle/jbundle
base/message/service/src/main/java/org/jbundle/base/message/service/BaseServiceMessageTransport.java
BaseServiceMessageTransport.processMessage
public Object processMessage(Object message) { Utility.getLogger().info("processMessage called in service message"); BaseMessage msgReplyInternal = null; try { BaseMessage messageIn = new TreeMessage(null, null); new ServiceTrxMessageIn(messageIn, message); msgReplyInternal = this.processIncomingMessage(messageIn, null); Utility.getLogger().info("msgReplyInternal: " + msgReplyInternal); int iErrorCode = this.convertToExternal(msgReplyInternal, null); Utility.getLogger().info("externalMessageReply: " + msgReplyInternal); Object msg = null;//fac.createMessage(); if (iErrorCode == DBConstants.NORMAL_RETURN) { msg = msgReplyInternal.getExternalMessage().getRawData(); String strTrxID = (String)msgReplyInternal.getMessageHeader().get(TrxMessageHeader.LOG_TRX_ID); this.logMessage(strTrxID, msgReplyInternal, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.SENTOK, null, null); // Sent (no reply required) } return msg; } catch (Throwable ex) { ex.printStackTrace(); String strError = "Error in processing or replying to a message"; Utility.getLogger().warning(strError); if (msgReplyInternal != null) { String strTrxID = (String)msgReplyInternal.getMessageHeader().get(TrxMessageHeader.LOG_TRX_ID); this.logMessage(strTrxID, msgReplyInternal, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.ERROR, strError, null); } return null; } }
java
public Object processMessage(Object message) { Utility.getLogger().info("processMessage called in service message"); BaseMessage msgReplyInternal = null; try { BaseMessage messageIn = new TreeMessage(null, null); new ServiceTrxMessageIn(messageIn, message); msgReplyInternal = this.processIncomingMessage(messageIn, null); Utility.getLogger().info("msgReplyInternal: " + msgReplyInternal); int iErrorCode = this.convertToExternal(msgReplyInternal, null); Utility.getLogger().info("externalMessageReply: " + msgReplyInternal); Object msg = null;//fac.createMessage(); if (iErrorCode == DBConstants.NORMAL_RETURN) { msg = msgReplyInternal.getExternalMessage().getRawData(); String strTrxID = (String)msgReplyInternal.getMessageHeader().get(TrxMessageHeader.LOG_TRX_ID); this.logMessage(strTrxID, msgReplyInternal, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.SENTOK, null, null); // Sent (no reply required) } return msg; } catch (Throwable ex) { ex.printStackTrace(); String strError = "Error in processing or replying to a message"; Utility.getLogger().warning(strError); if (msgReplyInternal != null) { String strTrxID = (String)msgReplyInternal.getMessageHeader().get(TrxMessageHeader.LOG_TRX_ID); this.logMessage(strTrxID, msgReplyInternal, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.ERROR, strError, null); } return null; } }
[ "public", "Object", "processMessage", "(", "Object", "message", ")", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"processMessage called in service message\"", ")", ";", "BaseMessage", "msgReplyInternal", "=", "null", ";", "try", "{", "BaseMessa...
This is the application code for handling the message.. Once the message is received the application can retrieve the soap part, the attachment part if there are any, or any other information from the message. @param message The incoming message to process.
[ "This", "is", "the", "application", "code", "for", "handling", "the", "message", "..", "Once", "the", "message", "is", "received", "the", "application", "can", "retrieve", "the", "soap", "part", "the", "attachment", "part", "if", "there", "are", "any", "or",...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/service/src/main/java/org/jbundle/base/message/service/BaseServiceMessageTransport.java#L63-L97
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java
CalcPoint.TMScore
public static double TMScore(Point3d[] x, Point3d[] y, int lengthNative) { if (x.length != y.length) { throw new IllegalArgumentException( "Point arrays are not of the same length."); } double d0 = 1.24 * Math.cbrt(x.length - 15.0) - 1.8; double d0Sq = d0 * d0; double sum = 0; for (int i = 0; i < x.length; i++) { sum += 1.0 / (1.0 + x[i].distanceSquared(y[i]) / d0Sq); } return sum / lengthNative; }
java
public static double TMScore(Point3d[] x, Point3d[] y, int lengthNative) { if (x.length != y.length) { throw new IllegalArgumentException( "Point arrays are not of the same length."); } double d0 = 1.24 * Math.cbrt(x.length - 15.0) - 1.8; double d0Sq = d0 * d0; double sum = 0; for (int i = 0; i < x.length; i++) { sum += 1.0 / (1.0 + x[i].distanceSquared(y[i]) / d0Sq); } return sum / lengthNative; }
[ "public", "static", "double", "TMScore", "(", "Point3d", "[", "]", "x", ",", "Point3d", "[", "]", "y", ",", "int", "lengthNative", ")", "{", "if", "(", "x", ".", "length", "!=", "y", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", ...
Returns the TM-Score for two superimposed sets of coordinates Yang Zhang and Jeffrey Skolnick, PROTEINS: Structure, Function, and Bioinformatics 57:702–710 (2004) @param x coordinate set 1 @param y coordinate set 2 @param lengthNative total length of native sequence @return
[ "Returns", "the", "TM", "-", "Score", "for", "two", "superimposed", "sets", "of", "coordinates", "Yang", "Zhang", "and", "Jeffrey", "Skolnick", "PROTEINS", ":", "Structure", "Function", "and", "Bioinformatics", "57", ":", "702–710", "(", "2004", ")" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java#L172-L188
gresrun/jesque
src/main/java/net/greghaines/jesque/utils/JesqueUtils.java
JesqueUtils.addCauseToBacktrace
private static void addCauseToBacktrace(final Throwable cause, final List<String> bTrace) { if (cause.getMessage() == null) { bTrace.add(BT_CAUSED_BY_PREFIX + cause.getClass().getName()); } else { bTrace.add(BT_CAUSED_BY_PREFIX + cause.getClass().getName() + ": " + cause.getMessage()); } for (final StackTraceElement ste : cause.getStackTrace()) { bTrace.add(BT_PREFIX + ste.toString()); } if (cause.getCause() != null) { addCauseToBacktrace(cause.getCause(), bTrace); } }
java
private static void addCauseToBacktrace(final Throwable cause, final List<String> bTrace) { if (cause.getMessage() == null) { bTrace.add(BT_CAUSED_BY_PREFIX + cause.getClass().getName()); } else { bTrace.add(BT_CAUSED_BY_PREFIX + cause.getClass().getName() + ": " + cause.getMessage()); } for (final StackTraceElement ste : cause.getStackTrace()) { bTrace.add(BT_PREFIX + ste.toString()); } if (cause.getCause() != null) { addCauseToBacktrace(cause.getCause(), bTrace); } }
[ "private", "static", "void", "addCauseToBacktrace", "(", "final", "Throwable", "cause", ",", "final", "List", "<", "String", ">", "bTrace", ")", "{", "if", "(", "cause", ".", "getMessage", "(", ")", "==", "null", ")", "{", "bTrace", ".", "add", "(", "B...
Add a cause to the backtrace. @param cause the cause @param bTrace the backtrace list
[ "Add", "a", "cause", "to", "the", "backtrace", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/JesqueUtils.java#L150-L162
jhunters/jprotobuf
android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java
StringUtils.removeEndIgnoreCase
public static String removeEndIgnoreCase(String str, String remove) { if (isEmpty(str) || isEmpty(remove)) { return str; } if (endsWithIgnoreCase(str, remove)) { return str.substring(0, str.length() - remove.length()); } return str; }
java
public static String removeEndIgnoreCase(String str, String remove) { if (isEmpty(str) || isEmpty(remove)) { return str; } if (endsWithIgnoreCase(str, remove)) { return str.substring(0, str.length() - remove.length()); } return str; }
[ "public", "static", "String", "removeEndIgnoreCase", "(", "String", "str", ",", "String", "remove", ")", "{", "if", "(", "isEmpty", "(", "str", ")", "||", "isEmpty", "(", "remove", ")", ")", "{", "return", "str", ";", "}", "if", "(", "endsWithIgnoreCase"...
<p> Case insensitive removal of a substring if it is at the end of a source string, otherwise returns the source string. </p> <p> A <code>null</code> source string will return <code>null</code>. An empty ("") source string will return the empty string. A <code>null</code> search string will return the source string. </p> <pre> StringUtils.removeEnd(null, *) = null StringUtils.removeEnd("", *) = "" StringUtils.removeEnd(*, null) = * StringUtils.removeEnd("www.domain.com", ".com.") = "www.domain.com." StringUtils.removeEnd("www.domain.com", ".com") = "www.domain" StringUtils.removeEnd("www.domain.com", "domain") = "www.domain.com" StringUtils.removeEnd("abc", "") = "abc" </pre> @param str the source String to search, may be null @param remove the String to search for (case insensitive) and remove, may be null @return the substring with the string removed if found, <code>null</code> if null String input @since 2.4
[ "<p", ">", "Case", "insensitive", "removal", "of", "a", "substring", "if", "it", "is", "at", "the", "end", "of", "a", "source", "string", "otherwise", "returns", "the", "source", "string", ".", "<", "/", "p", ">" ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java#L199-L207
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java
JobHistoryService.getFlowSeries
public List<Flow> getFlowSeries(String cluster, String user, String appId, String version, boolean populateTasks, int limit) throws IOException { // TODO: use RunMatchFilter to limit scan on the server side byte[] rowPrefix = Bytes.toBytes( cluster + Constants.SEP + user + Constants.SEP + appId + Constants.SEP); Scan scan = createFlowScan(rowPrefix, limit, version); return createFromResults(scan, populateTasks, limit); }
java
public List<Flow> getFlowSeries(String cluster, String user, String appId, String version, boolean populateTasks, int limit) throws IOException { // TODO: use RunMatchFilter to limit scan on the server side byte[] rowPrefix = Bytes.toBytes( cluster + Constants.SEP + user + Constants.SEP + appId + Constants.SEP); Scan scan = createFlowScan(rowPrefix, limit, version); return createFromResults(scan, populateTasks, limit); }
[ "public", "List", "<", "Flow", ">", "getFlowSeries", "(", "String", "cluster", ",", "String", "user", ",", "String", "appId", ",", "String", "version", ",", "boolean", "populateTasks", ",", "int", "limit", ")", "throws", "IOException", "{", "// TODO: use RunMa...
Returns the most recent {@link Flow} runs, up to {@code limit} instances. If the {@code version} parameter is non-null, the returned results will be restricted to those matching this app version. @param cluster the cluster where the jobs were run @param user the user running the jobs @param appId the application identifier for the jobs @param version if non-null, only flows matching this application version will be returned @param populateTasks if {@code true}, then TaskDetails will be populated for each job @param limit the maximum number of flows to return @return
[ "Returns", "the", "most", "recent", "{", "@link", "Flow", "}", "runs", "up", "to", "{", "@code", "limit", "}", "instances", ".", "If", "the", "{", "@code", "version", "}", "parameter", "is", "non", "-", "null", "the", "returned", "results", "will", "be...
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java#L263-L270
unbescape/unbescape
src/main/java/org/unbescape/html/HtmlEscape.java
HtmlEscape.escapeHtml
public static String escapeHtml(final String text, final HtmlEscapeType type, final HtmlEscapeLevel level) { if (type == null) { throw new IllegalArgumentException("The 'type' argument cannot be null"); } if (level == null) { throw new IllegalArgumentException("The 'level' argument cannot be null"); } return HtmlEscapeUtil.escape(text, type, level); }
java
public static String escapeHtml(final String text, final HtmlEscapeType type, final HtmlEscapeLevel level) { if (type == null) { throw new IllegalArgumentException("The 'type' argument cannot be null"); } if (level == null) { throw new IllegalArgumentException("The 'level' argument cannot be null"); } return HtmlEscapeUtil.escape(text, type, level); }
[ "public", "static", "String", "escapeHtml", "(", "final", "String", "text", ",", "final", "HtmlEscapeType", "type", ",", "final", "HtmlEscapeLevel", "level", ")", "{", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ...
<p> Perform a (configurable) HTML <strong>escape</strong> operation on a <tt>String</tt> input. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.html.HtmlEscapeType} and {@link org.unbescape.html.HtmlEscapeLevel} argument values. </p> <p> All other <tt>String</tt>-based <tt>escapeHtml*(...)</tt> methods call this one with preconfigured <tt>type</tt> and <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param type the type of escape operation to be performed, see {@link org.unbescape.html.HtmlEscapeType}. @param level the escape level to be applied, see {@link org.unbescape.html.HtmlEscapeLevel}. @return The escaped result <tt>String</tt>. As a memory-performance improvement, will return the exact same object as the <tt>text</tt> input argument if no escaping modifications were required (and no additional <tt>String</tt> objects will be created during processing). Will return <tt>null</tt> if input is <tt>null</tt>.
[ "<p", ">", "Perform", "a", "(", "configurable", ")", "HTML", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "perfo...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L346-L358
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsyncThrowing
public static <T1, T2, T3, T4, T5, R> Func5<T1, T2, T3, T4, T5, Observable<R>> toAsyncThrowing(final ThrowingFunc5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> func, final Scheduler scheduler) { return new Func5<T1, T2, T3, T4, T5, Observable<R>>() { @Override public Observable<R> call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) { return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3, t4, t5), scheduler); } }; }
java
public static <T1, T2, T3, T4, T5, R> Func5<T1, T2, T3, T4, T5, Observable<R>> toAsyncThrowing(final ThrowingFunc5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> func, final Scheduler scheduler) { return new Func5<T1, T2, T3, T4, T5, Observable<R>>() { @Override public Observable<R> call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) { return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3, t4, t5), scheduler); } }; }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "R", ">", "Func5", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "Observable", "<", "R", ">", ">", "toAsyncThrowing", "(", "final", "ThrowingFunc5", "...
Convert a synchronous function call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.png" alt=""> @param <T1> the first parameter type @param <T2> the second parameter type @param <T3> the third parameter type @param <T4> the fourth parameter type @param <T5> the fifth parameter type @param <R> the result type @param func the function to convert @return a function that returns an Observable that executes the {@code func} and emits its returned value @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh229571.aspx">MSDN: Observable.ToAsync</a>
[ "Convert", "a", "synchronous", "function", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki"...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1219-L1226
jenkinsci/jenkins
core/src/main/java/hudson/model/ParametersAction.java
ParametersAction.merge
@Nonnull public ParametersAction merge(@CheckForNull ParametersAction overrides) { if (overrides == null) { return new ParametersAction(parameters, this.safeParameters); } ParametersAction parametersAction = createUpdated(overrides.parameters); Set<String> safe = new TreeSet<>(); if (parametersAction.safeParameters != null && this.safeParameters != null) { safe.addAll(this.safeParameters); } if (overrides.safeParameters != null) { safe.addAll(overrides.safeParameters); } parametersAction.safeParameters = safe; return parametersAction; }
java
@Nonnull public ParametersAction merge(@CheckForNull ParametersAction overrides) { if (overrides == null) { return new ParametersAction(parameters, this.safeParameters); } ParametersAction parametersAction = createUpdated(overrides.parameters); Set<String> safe = new TreeSet<>(); if (parametersAction.safeParameters != null && this.safeParameters != null) { safe.addAll(this.safeParameters); } if (overrides.safeParameters != null) { safe.addAll(overrides.safeParameters); } parametersAction.safeParameters = safe; return parametersAction; }
[ "@", "Nonnull", "public", "ParametersAction", "merge", "(", "@", "CheckForNull", "ParametersAction", "overrides", ")", "{", "if", "(", "overrides", "==", "null", ")", "{", "return", "new", "ParametersAction", "(", "parameters", ",", "this", ".", "safeParameters"...
/* Creates a new {@link ParametersAction} that contains all the parameters in this action with the overrides / new values given as another {@link ParametersAction}. @return New {@link ParametersAction}. The result may contain null {@link ParameterValue}s
[ "/", "*", "Creates", "a", "new", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ParametersAction.java#L268-L283
rzwitserloot/lombok
src/core/lombok/core/handlers/HandlerUtil.java
HandlerUtil.toAllWitherNames
public static List<String> toAllWitherNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) { return toAllAccessorNames(ast, accessors, fieldName, isBoolean, "with", "with", false); }
java
public static List<String> toAllWitherNames(AST<?, ?, ?> ast, AnnotationValues<Accessors> accessors, CharSequence fieldName, boolean isBoolean) { return toAllAccessorNames(ast, accessors, fieldName, isBoolean, "with", "with", false); }
[ "public", "static", "List", "<", "String", ">", "toAllWitherNames", "(", "AST", "<", "?", ",", "?", ",", "?", ">", "ast", ",", "AnnotationValues", "<", "Accessors", ">", "accessors", ",", "CharSequence", "fieldName", ",", "boolean", "isBoolean", ")", "{", ...
Returns all names of methods that would represent the wither for a field with the provided name. For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:<br /> {@code [withRunning, withIsRunning]} @param accessors Accessors configuration. @param fieldName the name of the field. @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}.
[ "Returns", "all", "names", "of", "methods", "that", "would", "represent", "the", "wither", "for", "a", "field", "with", "the", "provided", "name", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L590-L592
gallandarakhneorg/afc
advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeCollection.java
AbstractAttributeCollection.fireAttributeChangedEvent
protected synchronized void fireAttributeChangedEvent(String name, AttributeValue oldValue, AttributeValue currentValue) { if (this.listenerList != null && isEventFirable()) { final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()]; this.listenerList.toArray(list); final AttributeChangeEvent event = new AttributeChangeEvent( this, Type.VALUE_UPDATE, name, oldValue, name, currentValue); for (final AttributeChangeListener listener : list) { listener.onAttributeChangeEvent(event); } } }
java
protected synchronized void fireAttributeChangedEvent(String name, AttributeValue oldValue, AttributeValue currentValue) { if (this.listenerList != null && isEventFirable()) { final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()]; this.listenerList.toArray(list); final AttributeChangeEvent event = new AttributeChangeEvent( this, Type.VALUE_UPDATE, name, oldValue, name, currentValue); for (final AttributeChangeListener listener : list) { listener.onAttributeChangeEvent(event); } } }
[ "protected", "synchronized", "void", "fireAttributeChangedEvent", "(", "String", "name", ",", "AttributeValue", "oldValue", ",", "AttributeValue", "currentValue", ")", "{", "if", "(", "this", ".", "listenerList", "!=", "null", "&&", "isEventFirable", "(", ")", ")"...
Fire the attribute change event. @param name is the name of the attribute for which the event occured. @param oldValue is the previous value of the attribute @param currentValue is the current value of the attribute
[ "Fire", "the", "attribute", "change", "event", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeCollection.java#L98-L113
pushtorefresh/storio
storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/Changes.java
Changes.newInstance
@NonNull public static Changes newInstance( @NonNull Set<String> affectedTables, @Nullable Collection<String> affectedTags ) { return new Changes(affectedTables, nonNullSet(affectedTags)); }
java
@NonNull public static Changes newInstance( @NonNull Set<String> affectedTables, @Nullable Collection<String> affectedTags ) { return new Changes(affectedTables, nonNullSet(affectedTags)); }
[ "@", "NonNull", "public", "static", "Changes", "newInstance", "(", "@", "NonNull", "Set", "<", "String", ">", "affectedTables", ",", "@", "Nullable", "Collection", "<", "String", ">", "affectedTags", ")", "{", "return", "new", "Changes", "(", "affectedTables",...
Creates new instance of {@link Changes}. @param affectedTables non-null set of affected tables. @param affectedTags nullable set of affected tags. @return new immutable instance of {@link Changes}.
[ "Creates", "new", "instance", "of", "{", "@link", "Changes", "}", "." ]
train
https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/Changes.java#L57-L63
h2oai/h2o-3
h2o-core/src/main/java/water/H2ONode.java
H2ONode.openChan
public static ByteChannel openChan(byte tcpType, SocketChannelFactory socketFactory, InetAddress originAddr, int originPort, short nodeTimeStamp) throws IOException { // This method can't internally use static fields which depends on initialized H2O cluster in case of //communication to the external H2O cluster // Must make a fresh socket SocketChannel sock = SocketChannel.open(); sock.socket().setReuseAddress(true); sock.socket().setSendBufferSize(AutoBuffer.BBP_BIG._size); InetSocketAddress isa = new InetSocketAddress(originAddr, originPort); boolean res = sock.connect(isa); // Can toss IOEx, esp if other node is still booting up assert res : "Should be already connected, but connection is in non-blocking mode and the connection operation is in progress!"; sock.configureBlocking(true); assert !sock.isConnectionPending() && sock.isBlocking() && sock.isConnected() && sock.isOpen(); sock.socket().setTcpNoDelay(true); ByteBuffer bb = ByteBuffer.allocate(6).order(ByteOrder.nativeOrder()); // In Case of tcpType == TCPReceiverThread.TCP_EXTERNAL, H2O.H2O_PORT is 0 as it is undefined, because // H2O cluster is not running in this case. However, // it is fine as the receiver of the external backend does not use this value. bb.put(tcpType).putShort(nodeTimeStamp).putChar((char)H2O.H2O_PORT).put((byte) 0xef).flip(); ByteChannel wrappedSocket = socketFactory.clientChannel(sock, isa.getHostName(), isa.getPort()); while (bb.hasRemaining()) { // Write out magic startup sequence wrappedSocket.write(bb); } return wrappedSocket; }
java
public static ByteChannel openChan(byte tcpType, SocketChannelFactory socketFactory, InetAddress originAddr, int originPort, short nodeTimeStamp) throws IOException { // This method can't internally use static fields which depends on initialized H2O cluster in case of //communication to the external H2O cluster // Must make a fresh socket SocketChannel sock = SocketChannel.open(); sock.socket().setReuseAddress(true); sock.socket().setSendBufferSize(AutoBuffer.BBP_BIG._size); InetSocketAddress isa = new InetSocketAddress(originAddr, originPort); boolean res = sock.connect(isa); // Can toss IOEx, esp if other node is still booting up assert res : "Should be already connected, but connection is in non-blocking mode and the connection operation is in progress!"; sock.configureBlocking(true); assert !sock.isConnectionPending() && sock.isBlocking() && sock.isConnected() && sock.isOpen(); sock.socket().setTcpNoDelay(true); ByteBuffer bb = ByteBuffer.allocate(6).order(ByteOrder.nativeOrder()); // In Case of tcpType == TCPReceiverThread.TCP_EXTERNAL, H2O.H2O_PORT is 0 as it is undefined, because // H2O cluster is not running in this case. However, // it is fine as the receiver of the external backend does not use this value. bb.put(tcpType).putShort(nodeTimeStamp).putChar((char)H2O.H2O_PORT).put((byte) 0xef).flip(); ByteChannel wrappedSocket = socketFactory.clientChannel(sock, isa.getHostName(), isa.getPort()); while (bb.hasRemaining()) { // Write out magic startup sequence wrappedSocket.write(bb); } return wrappedSocket; }
[ "public", "static", "ByteChannel", "openChan", "(", "byte", "tcpType", ",", "SocketChannelFactory", "socketFactory", ",", "InetAddress", "originAddr", ",", "int", "originPort", ",", "short", "nodeTimeStamp", ")", "throws", "IOException", "{", "// This method can't inter...
Returns a new connection of type {@code tcpType}, the type can be either TCPReceiverThread.TCP_SMALL, TCPReceiverThread.TCP_BIG or TCPReceiverThread.TCP_EXTERNAL. In case of TCPReceiverThread.TCP_EXTERNAL, we need to keep in mind that this method is executed in environment where H2O is not running, but it is just on the classpath so users can establish connection with the external H2O cluster. If socket channel factory is set, the communication will considered to be secured - this depends on the configuration of the {@link SocketChannelFactory}. In case of the factory is null, the communication won't be secured. @return new socket channel
[ "Returns", "a", "new", "connection", "of", "type", "{", "@code", "tcpType", "}", "the", "type", "can", "be", "either", "TCPReceiverThread", ".", "TCP_SMALL", "TCPReceiverThread", ".", "TCP_BIG", "or", "TCPReceiverThread", ".", "TCP_EXTERNAL", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/H2ONode.java#L449-L474
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java
ChargingStationEventListener.updateEvseStatus
private void updateEvseStatus(ChargingStation chargingStation, String componentId, ComponentStatus status) { for (Evse evse : chargingStation.getEvses()) { if (evse.getEvseId().equals(componentId)) { evse.setStatus(status); } } }
java
private void updateEvseStatus(ChargingStation chargingStation, String componentId, ComponentStatus status) { for (Evse evse : chargingStation.getEvses()) { if (evse.getEvseId().equals(componentId)) { evse.setStatus(status); } } }
[ "private", "void", "updateEvseStatus", "(", "ChargingStation", "chargingStation", ",", "String", "componentId", ",", "ComponentStatus", "status", ")", "{", "for", "(", "Evse", "evse", ":", "chargingStation", ".", "getEvses", "(", ")", ")", "{", "if", "(", "evs...
Updates the status of a Evse in the charging station object if the evse id matches the component id. @param chargingStation charging stationidentifier. @param componentId component identifier. @param status new status.
[ "Updates", "the", "status", "of", "a", "Evse", "in", "the", "charging", "station", "object", "if", "the", "evse", "id", "matches", "the", "component", "id", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L352-L358
googleads/googleads-java-lib
modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/utils/v201808/Pql.java
Pql.combineResultSets
public static ResultSet combineResultSets(ResultSet first, ResultSet second) { Function<ColumnType, String> columnTypeToString = new Function<ColumnType, String>() { public String apply(ColumnType input) { return input.getLabelName(); } }; List<String> firstColumns = Lists.transform(Lists.newArrayList(first.getColumnTypes()), columnTypeToString); List<String> secondColumns = Lists.transform(Lists.newArrayList(second.getColumnTypes()), columnTypeToString); if (!firstColumns.equals(secondColumns)) { throw new IllegalArgumentException(String.format( "First result set columns [%s] do not match second columns [%s]", Joiner.on(",").join(firstColumns), Joiner.on(",").join(secondColumns))); } List<Row> combinedRows = Lists.newArrayList(first.getRows()); if (second.getRows() != null) { combinedRows.addAll(Lists.newArrayList(second.getRows())); } ResultSet combinedResultSet = new ResultSet(); combinedResultSet.getColumnTypes().addAll(first.getColumnTypes()); combinedResultSet.getRows().addAll(combinedRows); return combinedResultSet; }
java
public static ResultSet combineResultSets(ResultSet first, ResultSet second) { Function<ColumnType, String> columnTypeToString = new Function<ColumnType, String>() { public String apply(ColumnType input) { return input.getLabelName(); } }; List<String> firstColumns = Lists.transform(Lists.newArrayList(first.getColumnTypes()), columnTypeToString); List<String> secondColumns = Lists.transform(Lists.newArrayList(second.getColumnTypes()), columnTypeToString); if (!firstColumns.equals(secondColumns)) { throw new IllegalArgumentException(String.format( "First result set columns [%s] do not match second columns [%s]", Joiner.on(",").join(firstColumns), Joiner.on(",").join(secondColumns))); } List<Row> combinedRows = Lists.newArrayList(first.getRows()); if (second.getRows() != null) { combinedRows.addAll(Lists.newArrayList(second.getRows())); } ResultSet combinedResultSet = new ResultSet(); combinedResultSet.getColumnTypes().addAll(first.getColumnTypes()); combinedResultSet.getRows().addAll(combinedRows); return combinedResultSet; }
[ "public", "static", "ResultSet", "combineResultSets", "(", "ResultSet", "first", ",", "ResultSet", "second", ")", "{", "Function", "<", "ColumnType", ",", "String", ">", "columnTypeToString", "=", "new", "Function", "<", "ColumnType", ",", "String", ">", "(", ...
Combines the first and second result sets, if and only if, the columns of both result sets match. @throws IllegalArgumentException if the columns of the first result set don't match the second
[ "Combines", "the", "first", "and", "second", "result", "sets", "if", "and", "only", "if", "the", "columns", "of", "both", "result", "sets", "match", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/utils/v201808/Pql.java#L452-L476
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/HydrogenPlacer.java
HydrogenPlacer.placeHydrogens2D
public void placeHydrogens2D(IAtomContainer container, IAtom atom) { double bondLength = GeometryUtil.getBondLengthAverage(container); placeHydrogens2D(container, atom, bondLength); }
java
public void placeHydrogens2D(IAtomContainer container, IAtom atom) { double bondLength = GeometryUtil.getBondLengthAverage(container); placeHydrogens2D(container, atom, bondLength); }
[ "public", "void", "placeHydrogens2D", "(", "IAtomContainer", "container", ",", "IAtom", "atom", ")", "{", "double", "bondLength", "=", "GeometryUtil", ".", "getBondLengthAverage", "(", "container", ")", ";", "placeHydrogens2D", "(", "container", ",", "atom", ",", ...
Place hydrogens connected to the given atom using the average bond length in the container. @param container atom container of which <i>atom</i> is a member @param atom the atom of which to place connected hydrogens @throws IllegalArgumentException if the <i>atom</i> does not have 2d coordinates @see #placeHydrogens2D(org.openscience.cdk.interfaces.IAtomContainer, double)
[ "Place", "hydrogens", "connected", "to", "the", "given", "atom", "using", "the", "average", "bond", "length", "in", "the", "container", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/HydrogenPlacer.java#L84-L87
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.loadBitmapReuseExact
private static ReuseResult loadBitmapReuseExact(ImageSource source, Bitmap dest) throws ImageLoadException { ImageMetadata metadata = source.getImageMetadata(); boolean tryReuse = false; if (dest.isMutable() && dest.getWidth() == metadata.getW() && dest.getHeight() == metadata.getH()) { if (Build.VERSION.SDK_INT >= 19) { tryReuse = true; } else if (Build.VERSION.SDK_INT >= 11) { if (metadata.getFormat() == ImageFormat.JPEG || metadata.getFormat() == ImageFormat.PNG) { tryReuse = true; } } } if (tryReuse) { return source.loadBitmap(dest); } else { return new ReuseResult(loadBitmap(source), false); } }
java
private static ReuseResult loadBitmapReuseExact(ImageSource source, Bitmap dest) throws ImageLoadException { ImageMetadata metadata = source.getImageMetadata(); boolean tryReuse = false; if (dest.isMutable() && dest.getWidth() == metadata.getW() && dest.getHeight() == metadata.getH()) { if (Build.VERSION.SDK_INT >= 19) { tryReuse = true; } else if (Build.VERSION.SDK_INT >= 11) { if (metadata.getFormat() == ImageFormat.JPEG || metadata.getFormat() == ImageFormat.PNG) { tryReuse = true; } } } if (tryReuse) { return source.loadBitmap(dest); } else { return new ReuseResult(loadBitmap(source), false); } }
[ "private", "static", "ReuseResult", "loadBitmapReuseExact", "(", "ImageSource", "source", ",", "Bitmap", "dest", ")", "throws", "ImageLoadException", "{", "ImageMetadata", "metadata", "=", "source", ".", "getImageMetadata", "(", ")", ";", "boolean", "tryReuse", "=",...
Loading image with reuse bitmap of same size as source @param source image source @param dest destination bitmap @return loaded bitmap result @throws ImageLoadException if it is unable to load image
[ "Loading", "image", "with", "reuse", "bitmap", "of", "same", "size", "as", "source" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L424-L444
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/query/values/JcValue.java
JcValue.asString
public JcString asString() { JcString ret = new JcString(null, this, null); QueryRecorder.recordInvocationConditional(this, "asString", ret); return ret; }
java
public JcString asString() { JcString ret = new JcString(null, this, null); QueryRecorder.recordInvocationConditional(this, "asString", ret); return ret; }
[ "public", "JcString", "asString", "(", ")", "{", "JcString", "ret", "=", "new", "JcString", "(", "null", ",", "this", ",", "null", ")", ";", "QueryRecorder", ".", "recordInvocationConditional", "(", "this", ",", "\"asString\"", ",", "ret", ")", ";", "retur...
<div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div> <div color='red' style="font-size:18px;color:red"><i>return the receiver as a JcString</i></div> <br/>
[ "<div", "color", "=", "red", "style", "=", "font", "-", "size", ":", "24px", ";", "color", ":", "red", ">", "<b", ">", "<i", ">", "<u", ">", "JCYPHER<", "/", "u", ">", "<", "/", "i", ">", "<", "/", "b", ">", "<", "/", "div", ">", "<div", ...
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcValue.java#L70-L74
kirgor/enklib
rest/src/main/java/com/kirgor/enklib/rest/RESTClient.java
RESTClient.getWithListResult
public <T> EntityResponse<List<T>> getWithListResult(Class<T> entityClass, String path, Map<String, String> params, Map<String, String> headers) throws IOException, RESTException { HttpGet httpGet = buildHttpGet(path, params); return parseListEntityResponse(entityClass, getHttpResponse(httpGet, headers)); }
java
public <T> EntityResponse<List<T>> getWithListResult(Class<T> entityClass, String path, Map<String, String> params, Map<String, String> headers) throws IOException, RESTException { HttpGet httpGet = buildHttpGet(path, params); return parseListEntityResponse(entityClass, getHttpResponse(httpGet, headers)); }
[ "public", "<", "T", ">", "EntityResponse", "<", "List", "<", "T", ">", ">", "getWithListResult", "(", "Class", "<", "T", ">", "entityClass", ",", "String", "path", ",", "Map", "<", "String", ",", "String", ">", "params", ",", "Map", "<", "String", ",...
Performs GET request, while expected response entity is a list of specified type. @param entityClass Class, which contains expected response entity fields. @param path Request path. @param params Map of URL query params. @param headers Map of HTTP request headers. @param <T> Type of class, which contains expected response entity fields. @throws IOException If error during HTTP connection or entity parsing occurs. @throws RESTException If HTTP response code is non OK.
[ "Performs", "GET", "request", "while", "expected", "response", "entity", "is", "a", "list", "of", "specified", "type", "." ]
train
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/rest/src/main/java/com/kirgor/enklib/rest/RESTClient.java#L106-L109
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbWrapper.java
RocksDbWrapper.openReadOnly
public static RocksDbWrapper openReadOnly(String dirPath) throws RocksDbException, IOException { RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(dirPath, true); rocksDbWrapper.init(); return rocksDbWrapper; }
java
public static RocksDbWrapper openReadOnly(String dirPath) throws RocksDbException, IOException { RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(dirPath, true); rocksDbWrapper.init(); return rocksDbWrapper; }
[ "public", "static", "RocksDbWrapper", "openReadOnly", "(", "String", "dirPath", ")", "throws", "RocksDbException", ",", "IOException", "{", "RocksDbWrapper", "rocksDbWrapper", "=", "new", "RocksDbWrapper", "(", "dirPath", ",", "true", ")", ";", "rocksDbWrapper", "."...
Open a {@link RocksDB} with default options in read-only mode. @param dirPath existing {@link RocksDB} data directory @return @throws RocksDbException @throws IOException
[ "Open", "a", "{", "@link", "RocksDB", "}", "with", "default", "options", "in", "read", "-", "only", "mode", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbWrapper.java#L68-L72
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java
NNStorageDirectoryRetentionManager.getBackups
static String[] getBackups(File origin) { File root = origin.getParentFile(); final String originName = origin.getName(); String[] backups = root.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (!name.startsWith(originName + File.pathSeparator) || name.equals(originName)) return false; try { dateForm.get().parse(name.substring(name.indexOf(File.pathSeparator) + 1)); } catch (ParseException pex) { return false; } return true; } }); if (backups == null) return new String[0]; Arrays.sort(backups, new Comparator<String>() { @Override public int compare(String back1, String back2) { try { Date date1 = dateForm.get().parse(back1.substring(back1 .indexOf(File.pathSeparator) + 1)); Date date2 = dateForm.get().parse(back2.substring(back2 .indexOf(File.pathSeparator) + 1)); // Sorting in reverse order, from later dates to earlier return -1 * date2.compareTo(date1); } catch (ParseException pex) { return 0; } } }); return backups; }
java
static String[] getBackups(File origin) { File root = origin.getParentFile(); final String originName = origin.getName(); String[] backups = root.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (!name.startsWith(originName + File.pathSeparator) || name.equals(originName)) return false; try { dateForm.get().parse(name.substring(name.indexOf(File.pathSeparator) + 1)); } catch (ParseException pex) { return false; } return true; } }); if (backups == null) return new String[0]; Arrays.sort(backups, new Comparator<String>() { @Override public int compare(String back1, String back2) { try { Date date1 = dateForm.get().parse(back1.substring(back1 .indexOf(File.pathSeparator) + 1)); Date date2 = dateForm.get().parse(back2.substring(back2 .indexOf(File.pathSeparator) + 1)); // Sorting in reverse order, from later dates to earlier return -1 * date2.compareTo(date1); } catch (ParseException pex) { return 0; } } }); return backups; }
[ "static", "String", "[", "]", "getBackups", "(", "File", "origin", ")", "{", "File", "root", "=", "origin", ".", "getParentFile", "(", ")", ";", "final", "String", "originName", "=", "origin", ".", "getName", "(", ")", ";", "String", "[", "]", "backups...
List all directories that match the backup pattern. Sort from oldest to newest.
[ "List", "all", "directories", "that", "match", "the", "backup", "pattern", ".", "Sort", "from", "oldest", "to", "newest", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java#L203-L241
infinispan/infinispan
cdi/common/src/main/java/org/infinispan/cdi/common/util/BeanManagerProvider.java
BeanManagerProvider.setBeanManager
public void setBeanManager(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) { setBeanManagerProvider(this); BeanManagerInfo bmi = getBeanManagerInfo(getClassLoader(null)); bmi.loadTimeBm = beanManager; }
java
public void setBeanManager(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) { setBeanManagerProvider(this); BeanManagerInfo bmi = getBeanManagerInfo(getClassLoader(null)); bmi.loadTimeBm = beanManager; }
[ "public", "void", "setBeanManager", "(", "@", "Observes", "AfterBeanDiscovery", "afterBeanDiscovery", ",", "BeanManager", "beanManager", ")", "{", "setBeanManagerProvider", "(", "this", ")", ";", "BeanManagerInfo", "bmi", "=", "getBeanManagerInfo", "(", "getClassLoader"...
It basically doesn't matter which of the system events we use, but basically we use the {@link AfterBeanDiscovery} event since it allows to use the {@link BeanManagerProvider} for all events which occur after the {@link AfterBeanDiscovery} event. @param afterBeanDiscovery event which we don't actually use ;) @param beanManager the BeanManager we store and make available.
[ "It", "basically", "doesn", "t", "matter", "which", "of", "the", "system", "events", "we", "use", "but", "basically", "we", "use", "the", "{", "@link", "AfterBeanDiscovery", "}", "event", "since", "it", "allows", "to", "use", "the", "{", "@link", "BeanMana...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/BeanManagerProvider.java#L131-L137
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/BoundedBuffer.java
BoundedBuffer.poll
@Override public T poll(long timeout, TimeUnit unit) throws InterruptedException { T old = poll(); long endTimeMillis = System.currentTimeMillis() + unit.toMillis(timeout); long timeLeftMillis = endTimeMillis - System.currentTimeMillis(); int spinctr = SPINS_TAKE_; while (old == null && timeLeftMillis > 0) { while (size() <= 0 && timeLeftMillis > 0) { if (spinctr > 0) { // busy wait if (YIELD_TAKE_) Thread.yield(); spinctr--; } else { // block on lock waitGet_(timeLeftMillis); } timeLeftMillis = endTimeMillis - System.currentTimeMillis(); } old = poll(); timeLeftMillis = endTimeMillis - System.currentTimeMillis(); } return old; }
java
@Override public T poll(long timeout, TimeUnit unit) throws InterruptedException { T old = poll(); long endTimeMillis = System.currentTimeMillis() + unit.toMillis(timeout); long timeLeftMillis = endTimeMillis - System.currentTimeMillis(); int spinctr = SPINS_TAKE_; while (old == null && timeLeftMillis > 0) { while (size() <= 0 && timeLeftMillis > 0) { if (spinctr > 0) { // busy wait if (YIELD_TAKE_) Thread.yield(); spinctr--; } else { // block on lock waitGet_(timeLeftMillis); } timeLeftMillis = endTimeMillis - System.currentTimeMillis(); } old = poll(); timeLeftMillis = endTimeMillis - System.currentTimeMillis(); } return old; }
[ "@", "Override", "public", "T", "poll", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "T", "old", "=", "poll", "(", ")", ";", "long", "endTimeMillis", "=", "System", ".", "currentTimeMillis", "(", ")", "+", ...
Removes an object from the buffer. If the buffer is empty, the call blocks for up to a specified amount of time before it gives up. @param timeout - the amount of time, that the caller is willing to wait in the event of an empty buffer. @param unit - the unit of time
[ "Removes", "an", "object", "from", "the", "buffer", ".", "If", "the", "buffer", "is", "empty", "the", "call", "blocks", "for", "up", "to", "a", "specified", "amount", "of", "time", "before", "it", "gives", "up", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/BoundedBuffer.java#L664-L690
googleapis/google-cloud-java
google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java
KeyManagementServiceClient.updateCryptoKey
public final CryptoKey updateCryptoKey(CryptoKey cryptoKey, FieldMask updateMask) { UpdateCryptoKeyRequest request = UpdateCryptoKeyRequest.newBuilder() .setCryptoKey(cryptoKey) .setUpdateMask(updateMask) .build(); return updateCryptoKey(request); }
java
public final CryptoKey updateCryptoKey(CryptoKey cryptoKey, FieldMask updateMask) { UpdateCryptoKeyRequest request = UpdateCryptoKeyRequest.newBuilder() .setCryptoKey(cryptoKey) .setUpdateMask(updateMask) .build(); return updateCryptoKey(request); }
[ "public", "final", "CryptoKey", "updateCryptoKey", "(", "CryptoKey", "cryptoKey", ",", "FieldMask", "updateMask", ")", "{", "UpdateCryptoKeyRequest", "request", "=", "UpdateCryptoKeyRequest", ".", "newBuilder", "(", ")", ".", "setCryptoKey", "(", "cryptoKey", ")", "...
Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. <p>Sample code: <pre><code> try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) { CryptoKey cryptoKey = CryptoKey.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); CryptoKey response = keyManagementServiceClient.updateCryptoKey(cryptoKey, updateMask); } </code></pre> @param cryptoKey [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values. @param updateMask Required list of fields to be updated in this request. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Update", "a", "[", "CryptoKey", "]", "[", "google", ".", "cloud", ".", "kms", ".", "v1", ".", "CryptoKey", "]", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java#L1324-L1332
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsDynamicFunctionParser.java
CmsDynamicFunctionParser.getStringValue
protected String getStringValue(CmsObject cms, I_CmsXmlContentValueLocation location, String defaultValue) { if (location == null) { return defaultValue; } return location.asString(cms); }
java
protected String getStringValue(CmsObject cms, I_CmsXmlContentValueLocation location, String defaultValue) { if (location == null) { return defaultValue; } return location.asString(cms); }
[ "protected", "String", "getStringValue", "(", "CmsObject", "cms", ",", "I_CmsXmlContentValueLocation", "location", ",", "String", "defaultValue", ")", "{", "if", "(", "location", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "return", "location", "...
Converts a (possibly null) content value location to a string.<p> @param cms the current CMS context @param location the content value location @param defaultValue the value to return if the location is null @return the string value of the content value location
[ "Converts", "a", "(", "possibly", "null", ")", "content", "value", "location", "to", "a", "string", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsDynamicFunctionParser.java#L227-L233
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/injection/resolvers/ResourceReferenceResolver.java
ResourceReferenceResolver.getName
private static String getName(final String resourceName, final String fallBackName) { return resourceName.length() > 0 ? resourceName : fallBackName; }
java
private static String getName(final String resourceName, final String fallBackName) { return resourceName.length() > 0 ? resourceName : fallBackName; }
[ "private", "static", "String", "getName", "(", "final", "String", "resourceName", ",", "final", "String", "fallBackName", ")", "{", "return", "resourceName", ".", "length", "(", ")", ">", "0", "?", "resourceName", ":", "fallBackName", ";", "}" ]
Returns JNDI resource name. @param resourceName to use if specified @param fallBackName fall back bean name otherwise @return JNDI resource name
[ "Returns", "JNDI", "resource", "name", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/resolvers/ResourceReferenceResolver.java#L77-L80
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableDocument.java
MutableDocument.setString
@NonNull @Override public MutableDocument setString(@NonNull String key, String value) { return setValue(key, value); }
java
@NonNull @Override public MutableDocument setString(@NonNull String key, String value) { return setValue(key, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableDocument", "setString", "(", "@", "NonNull", "String", "key", ",", "String", "value", ")", "{", "return", "setValue", "(", "key", ",", "value", ")", ";", "}" ]
Set a String value for the given key @param key the key. @param key the String value. @return this MutableDocument instance
[ "Set", "a", "String", "value", "for", "the", "given", "key" ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDocument.java#L158-L162
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java
JobsInner.listRemoteLoginInformationWithServiceResponseAsync
public Observable<ServiceResponse<Page<RemoteLoginInformationInner>>> listRemoteLoginInformationWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final String jobName) { return listRemoteLoginInformationSinglePageAsync(resourceGroupName, workspaceName, experimentName, jobName) .concatMap(new Func1<ServiceResponse<Page<RemoteLoginInformationInner>>, Observable<ServiceResponse<Page<RemoteLoginInformationInner>>>>() { @Override public Observable<ServiceResponse<Page<RemoteLoginInformationInner>>> call(ServiceResponse<Page<RemoteLoginInformationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listRemoteLoginInformationNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<RemoteLoginInformationInner>>> listRemoteLoginInformationWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final String jobName) { return listRemoteLoginInformationSinglePageAsync(resourceGroupName, workspaceName, experimentName, jobName) .concatMap(new Func1<ServiceResponse<Page<RemoteLoginInformationInner>>, Observable<ServiceResponse<Page<RemoteLoginInformationInner>>>>() { @Override public Observable<ServiceResponse<Page<RemoteLoginInformationInner>>> call(ServiceResponse<Page<RemoteLoginInformationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listRemoteLoginInformationNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "RemoteLoginInformationInner", ">", ">", ">", "listRemoteLoginInformationWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "workspaceName", ",", "final", "Strin...
Gets a list of currently existing nodes which were used for the Job execution. The returned information contains the node ID, its public IP and SSH port. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;RemoteLoginInformationInner&gt; object
[ "Gets", "a", "list", "of", "currently", "existing", "nodes", "which", "were", "used", "for", "the", "Job", "execution", ".", "The", "returned", "information", "contains", "the", "node", "ID", "its", "public", "IP", "and", "SSH", "port", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java#L1099-L1111
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java
KeysAndAttributes.withKeys
public KeysAndAttributes withKeys(java.util.Collection<java.util.Map<String, AttributeValue>> keys) { setKeys(keys); return this; }
java
public KeysAndAttributes withKeys(java.util.Collection<java.util.Map<String, AttributeValue>> keys) { setKeys(keys); return this; }
[ "public", "KeysAndAttributes", "withKeys", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", ">", "keys", ")", "{", "setKeys", "(", "keys", ")", ";", "return", "this", ";", "}"...
<p> The primary key attribute values that define the items and the attributes associated with the items. </p> @param keys The primary key attribute values that define the items and the attributes associated with the items. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "primary", "key", "attribute", "values", "that", "define", "the", "items", "and", "the", "attributes", "associated", "with", "the", "items", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java#L210-L213
mnlipp/jgrapes
examples/src/org/jgrapes/http/demo/httpserver/FormProcessor.java
FormProcessor.onGet
@RequestHandler(patterns = "/form,/form/**") public void onGet(Request.In.Get event, IOSubchannel channel) throws ParseException { ResponseCreationSupport.sendStaticContent(event, channel, path -> FormProcessor.class.getResource( ResourcePattern.removeSegments(path, 1)), null); }
java
@RequestHandler(patterns = "/form,/form/**") public void onGet(Request.In.Get event, IOSubchannel channel) throws ParseException { ResponseCreationSupport.sendStaticContent(event, channel, path -> FormProcessor.class.getResource( ResourcePattern.removeSegments(path, 1)), null); }
[ "@", "RequestHandler", "(", "patterns", "=", "\"/form,/form/**\"", ")", "public", "void", "onGet", "(", "Request", ".", "In", ".", "Get", "event", ",", "IOSubchannel", "channel", ")", "throws", "ParseException", "{", "ResponseCreationSupport", ".", "sendStaticCont...
Handle a `GET` request. @param event the event @param channel the channel @throws ParseException the parse exception
[ "Handle", "a", "GET", "request", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/examples/src/org/jgrapes/http/demo/httpserver/FormProcessor.java#L75-L82
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.getAdminListByAppkey
public UserListResult getAdminListByAppkey(int start, int count) throws APIConnectionException, APIRequestException { return _userClient.getAdminListByAppkey(start, count); }
java
public UserListResult getAdminListByAppkey(int start, int count) throws APIConnectionException, APIRequestException { return _userClient.getAdminListByAppkey(start, count); }
[ "public", "UserListResult", "getAdminListByAppkey", "(", "int", "start", ",", "int", "count", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_userClient", ".", "getAdminListByAppkey", "(", "start", ",", "count", ")", ";", "}" ]
Get admins by appkey @param start The start index of the list @param count The number that how many you want to get from list @return admin user info list @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Get", "admins", "by", "appkey" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L216-L219
spring-projects/spring-mobile
spring-mobile-device/src/main/java/org/springframework/mobile/device/LiteDeviceResolver.java
LiteDeviceResolver.resolveWithPlatform
protected Device resolveWithPlatform(DeviceType deviceType, DevicePlatform devicePlatform) { return LiteDevice.from(deviceType, devicePlatform); }
java
protected Device resolveWithPlatform(DeviceType deviceType, DevicePlatform devicePlatform) { return LiteDevice.from(deviceType, devicePlatform); }
[ "protected", "Device", "resolveWithPlatform", "(", "DeviceType", "deviceType", ",", "DevicePlatform", "devicePlatform", ")", "{", "return", "LiteDevice", ".", "from", "(", "deviceType", ",", "devicePlatform", ")", ";", "}" ]
Wrapper method for allow subclassing platform based resolution
[ "Wrapper", "method", "for", "allow", "subclassing", "platform", "based", "resolution" ]
train
https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/LiteDeviceResolver.java#L158-L160
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java
ApplicationUrl.upsertPackageFileUrl
public static MozuUrl upsertPackageFileUrl(String applicationKey, String filepath, String lastModifiedTime, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/developer/packages/{applicationKey}/files/{filepath}?lastModifiedTime={lastModifiedTime}&responseFields={responseFields}"); formatter.formatUrl("applicationKey", applicationKey); formatter.formatUrl("filepath", filepath); formatter.formatUrl("lastModifiedTime", lastModifiedTime); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
java
public static MozuUrl upsertPackageFileUrl(String applicationKey, String filepath, String lastModifiedTime, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/developer/packages/{applicationKey}/files/{filepath}?lastModifiedTime={lastModifiedTime}&responseFields={responseFields}"); formatter.formatUrl("applicationKey", applicationKey); formatter.formatUrl("filepath", filepath); formatter.formatUrl("lastModifiedTime", lastModifiedTime); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
[ "public", "static", "MozuUrl", "upsertPackageFileUrl", "(", "String", "applicationKey", ",", "String", "filepath", ",", "String", "lastModifiedTime", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platf...
Get Resource Url for UpsertPackageFile @param applicationKey The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}. @param filepath The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}. @param lastModifiedTime The date and time of the last file insert or update. This parameter is optional. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpsertPackageFile" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java#L82-L90
shrinkwrap/resolver
maven/api-maven/src/main/java/org/jboss/shrinkwrap/resolver/api/maven/coordinate/MavenDependencies.java
MavenDependencies.createDependency
public static MavenDependency createDependency(final String canonicalForm, final ScopeType scope, final boolean optional, final MavenDependencyExclusion... exclusions) throws IllegalArgumentException, CoordinateParseException { if (canonicalForm == null || canonicalForm.length() == 0) { throw new IllegalArgumentException("canonical form is required"); } final MavenCoordinate delegate = MavenCoordinates.createCoordinate(canonicalForm); return createDependency(delegate, scope, optional, exclusions); }
java
public static MavenDependency createDependency(final String canonicalForm, final ScopeType scope, final boolean optional, final MavenDependencyExclusion... exclusions) throws IllegalArgumentException, CoordinateParseException { if (canonicalForm == null || canonicalForm.length() == 0) { throw new IllegalArgumentException("canonical form is required"); } final MavenCoordinate delegate = MavenCoordinates.createCoordinate(canonicalForm); return createDependency(delegate, scope, optional, exclusions); }
[ "public", "static", "MavenDependency", "createDependency", "(", "final", "String", "canonicalForm", ",", "final", "ScopeType", "scope", ",", "final", "boolean", "optional", ",", "final", "MavenDependencyExclusion", "...", "exclusions", ")", "throws", "IllegalArgumentExc...
Creates a new {@link MavenDependency} instance from the specified, required canonical form in format {@code <groupId>:<artifactId>[:<packagingType>[:<classifier>]][:<version>]}, with the additional, optional properties. If no {@link ScopeType} is specified, default will be {@link ScopeType#COMPILE}. @param canonicalForm A canonical form in format {@code <groupId>:<artifactId>[:<packagingType>[:<classifier>]][:<version>]} of the new {@link MavenDependency} instance. @param scope A scope of the new {@link MavenDependency} instance. Default will be {@link ScopeType#COMPILE}. @param optional Whether or not this {@link MavenDependency} has been marked as optional; defaults to <code>false</code>. @param exclusions Exclusions of the new {@link MavenDependency} instance. @return The new {@link MavenDependency} instance. @throws IllegalArgumentException If the canonical form is not supplied @throws CoordinateParseException If the specified canonical form is not valid
[ "Creates", "a", "new", "{", "@link", "MavenDependency", "}", "instance", "from", "the", "specified", "required", "canonical", "form", "in", "format", "{", "@code", "<groupId", ">", ":", "<artifactId", ">", "[", ":", "<packagingType", ">", "[", ":", "<classif...
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/api-maven/src/main/java/org/jboss/shrinkwrap/resolver/api/maven/coordinate/MavenDependencies.java#L70-L78
apache/groovy
src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java
MetaClassRegistryImpl.installMetaClassCreationHandle
private void installMetaClassCreationHandle() { try { final Class customMetaClassHandle = Class.forName("groovy.runtime.metaclass.CustomMetaClassCreationHandle"); final Constructor customMetaClassHandleConstructor = customMetaClassHandle.getConstructor(); this.metaClassCreationHandle = (MetaClassCreationHandle)customMetaClassHandleConstructor.newInstance(); } catch (final ClassNotFoundException e) { this.metaClassCreationHandle = new MetaClassCreationHandle(); } catch (final Exception e) { throw new GroovyRuntimeException("Could not instantiate custom Metaclass creation handle: "+ e, e); } }
java
private void installMetaClassCreationHandle() { try { final Class customMetaClassHandle = Class.forName("groovy.runtime.metaclass.CustomMetaClassCreationHandle"); final Constructor customMetaClassHandleConstructor = customMetaClassHandle.getConstructor(); this.metaClassCreationHandle = (MetaClassCreationHandle)customMetaClassHandleConstructor.newInstance(); } catch (final ClassNotFoundException e) { this.metaClassCreationHandle = new MetaClassCreationHandle(); } catch (final Exception e) { throw new GroovyRuntimeException("Could not instantiate custom Metaclass creation handle: "+ e, e); } }
[ "private", "void", "installMetaClassCreationHandle", "(", ")", "{", "try", "{", "final", "Class", "customMetaClassHandle", "=", "Class", ".", "forName", "(", "\"groovy.runtime.metaclass.CustomMetaClassCreationHandle\"", ")", ";", "final", "Constructor", "customMetaClassHand...
Looks for a class called 'groovy.runtime.metaclass.CustomMetaClassCreationHandle' and if it exists uses it as the MetaClassCreationHandle otherwise uses the default @see groovy.lang.MetaClassRegistry.MetaClassCreationHandle
[ "Looks", "for", "a", "class", "called", "groovy", ".", "runtime", ".", "metaclass", ".", "CustomMetaClassCreationHandle", "and", "if", "it", "exists", "uses", "it", "as", "the", "MetaClassCreationHandle", "otherwise", "uses", "the", "default" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java#L182-L192
syphr42/prom
src/main/java/org/syphr/prom/PropertiesManagers.java
PropertiesManagers.newManager
public static <T extends Enum<T>> PropertiesManager<T> newManager(File file, File defaultFile, Class<T> keyType, ExecutorService executor, final Retriever... retrievers) throws IOException { return new PropertiesManager<T>(file, getProperties(defaultFile), getEnumTranslator(keyType), new DefaultEvaluator(), executor) { @Override protected Retriever createRetriever() { return new AddOnRetriever(true, super.createRetriever(), retrievers); } }; }
java
public static <T extends Enum<T>> PropertiesManager<T> newManager(File file, File defaultFile, Class<T> keyType, ExecutorService executor, final Retriever... retrievers) throws IOException { return new PropertiesManager<T>(file, getProperties(defaultFile), getEnumTranslator(keyType), new DefaultEvaluator(), executor) { @Override protected Retriever createRetriever() { return new AddOnRetriever(true, super.createRetriever(), retrievers); } }; }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "PropertiesManager", "<", "T", ">", "newManager", "(", "File", "file", ",", "File", "defaultFile", ",", "Class", "<", "T", ">", "keyType", ",", "ExecutorService", "executor", ",", "fina...
Build a new manager for the given properties file. @param <T> the type of key used for the new manager @param file the file system location of the properties represented by the new manager @param defaultFile a file containing default values for the properties represented by the new manager @param keyType the enumeration of keys in the properties file @param executor a service to handle potentially long running tasks, such as interacting with the file system @param retrievers a set of retrievers that will be used to resolve extra property references (i.e. if a nested value reference is found in a properties file and there is no property to match it, the given retrievers will be used) @return a new manager @throws IOException if there is an error while reading the default properties
[ "Build", "a", "new", "manager", "for", "the", "given", "properties", "file", "." ]
train
https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManagers.java#L146-L164
morimekta/utils
io-util/src/main/java/net/morimekta/util/FileWatcher.java
FileWatcher.weakAddWatcher
@Deprecated public void weakAddWatcher(Path file, Watcher watcher) { weakAddWatcher(file, (Listener) watcher); }
java
@Deprecated public void weakAddWatcher(Path file, Watcher watcher) { weakAddWatcher(file, (Listener) watcher); }
[ "@", "Deprecated", "public", "void", "weakAddWatcher", "(", "Path", "file", ",", "Watcher", "watcher", ")", "{", "weakAddWatcher", "(", "file", ",", "(", "Listener", ")", "watcher", ")", ";", "}" ]
Start watching file path and notify watcher for updates on that file. The watcher will be kept in a weak reference and will allow GC to delete the instance. @param file The file path to watch. @param watcher The watcher to be notified.
[ "Start", "watching", "file", "path", "and", "notify", "watcher", "for", "updates", "on", "that", "file", ".", "The", "watcher", "will", "be", "kept", "in", "a", "weak", "reference", "and", "will", "allow", "GC", "to", "delete", "the", "instance", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/FileWatcher.java#L277-L280
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Dispatching.java
Dispatching.curry
public static <T> Runnable curry(Consumer<T> consumer, T value) { dbc.precondition(consumer != null, "cannot bind parameter of a null consumer"); return () -> consumer.accept(value); }
java
public static <T> Runnable curry(Consumer<T> consumer, T value) { dbc.precondition(consumer != null, "cannot bind parameter of a null consumer"); return () -> consumer.accept(value); }
[ "public", "static", "<", "T", ">", "Runnable", "curry", "(", "Consumer", "<", "T", ">", "consumer", ",", "T", "value", ")", "{", "dbc", ".", "precondition", "(", "consumer", "!=", "null", ",", "\"cannot bind parameter of a null consumer\"", ")", ";", "return...
Partial application of the first parameter to an consumer. @param <T> the consumer parameter type @param consumer the consumer to be curried @param value the value to be curried @return the curried runnable
[ "Partial", "application", "of", "the", "first", "parameter", "to", "an", "consumer", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L35-L38
graknlabs/grakn
server/src/graql/reasoner/cache/QueryCacheBase.java
QueryCacheBase.putEntry
CacheEntry<Q, SE> putEntry(Q query, SE answers) { return putEntry(new CacheEntry<>(query, answers)); }
java
CacheEntry<Q, SE> putEntry(Q query, SE answers) { return putEntry(new CacheEntry<>(query, answers)); }
[ "CacheEntry", "<", "Q", ",", "SE", ">", "putEntry", "(", "Q", "query", ",", "SE", "answers", ")", "{", "return", "putEntry", "(", "new", "CacheEntry", "<>", "(", "query", ",", "answers", ")", ")", ";", "}" ]
Associates the specified answers with the specified query in this cache adding an (query) -> (answers) entry @param query of the association @param answers of the association @return previous value if any or null
[ "Associates", "the", "specified", "answers", "with", "the", "specified", "query", "in", "this", "cache", "adding", "an", "(", "query", ")", "-", ">", "(", "answers", ")", "entry" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/cache/QueryCacheBase.java#L129-L131
Erudika/para
para-server/src/main/java/com/erudika/para/rest/RestUtils.java
RestUtils.createLinksHandler
public static Response createLinksHandler(ParaObject pobj, String id2) { try (final Metrics.Context context = Metrics.time(null, RestUtils.class, "links", "create")) { if (id2 != null && pobj != null) { String linkid = pobj.link(id2); if (linkid == null) { return getStatusResponse(Response.Status.BAD_REQUEST, "Failed to create link."); } else { return Response.ok(linkid, MediaType.TEXT_PLAIN_TYPE).build(); } } else { return getStatusResponse(Response.Status.BAD_REQUEST, "Parameters 'type' and 'id' are missing."); } } }
java
public static Response createLinksHandler(ParaObject pobj, String id2) { try (final Metrics.Context context = Metrics.time(null, RestUtils.class, "links", "create")) { if (id2 != null && pobj != null) { String linkid = pobj.link(id2); if (linkid == null) { return getStatusResponse(Response.Status.BAD_REQUEST, "Failed to create link."); } else { return Response.ok(linkid, MediaType.TEXT_PLAIN_TYPE).build(); } } else { return getStatusResponse(Response.Status.BAD_REQUEST, "Parameters 'type' and 'id' are missing."); } } }
[ "public", "static", "Response", "createLinksHandler", "(", "ParaObject", "pobj", ",", "String", "id2", ")", "{", "try", "(", "final", "Metrics", ".", "Context", "context", "=", "Metrics", ".", "time", "(", "null", ",", "RestUtils", ".", "class", ",", "\"li...
Handles requests to link an object to other objects. @param pobj the object to operate on @param id2 the id of the second object (optional) @return a Response
[ "Handles", "requests", "to", "link", "an", "object", "to", "other", "objects", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L702-L715
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.iterFilesRecursive
public static Iterable<File> iterFilesRecursive(final File dir, final String ext) { return iterFilesRecursive(dir, Pattern.compile(Pattern.quote(ext) + "$")); }
java
public static Iterable<File> iterFilesRecursive(final File dir, final String ext) { return iterFilesRecursive(dir, Pattern.compile(Pattern.quote(ext) + "$")); }
[ "public", "static", "Iterable", "<", "File", ">", "iterFilesRecursive", "(", "final", "File", "dir", ",", "final", "String", "ext", ")", "{", "return", "iterFilesRecursive", "(", "dir", ",", "Pattern", ".", "compile", "(", "Pattern", ".", "quote", "(", "ex...
Iterate over all the files in the directory, recursively. @param dir The root directory. @param ext A string that must be at the end of all files (e.g. ".txt") @return All files within the directory ending in the given extension.
[ "Iterate", "over", "all", "the", "files", "in", "the", "directory", "recursively", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L622-L625
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.sms_sendResponse
public void sms_sendResponse(Integer userId, CharSequence response, Integer mobileSessionId) throws FacebookException, IOException { this.callMethod(FacebookMethod.SMS_SEND_MESSAGE, new Pair<String, CharSequence>("uid", userId.toString()), new Pair<String, CharSequence>("message", response), new Pair<String, CharSequence>("session_id", mobileSessionId.toString())); }
java
public void sms_sendResponse(Integer userId, CharSequence response, Integer mobileSessionId) throws FacebookException, IOException { this.callMethod(FacebookMethod.SMS_SEND_MESSAGE, new Pair<String, CharSequence>("uid", userId.toString()), new Pair<String, CharSequence>("message", response), new Pair<String, CharSequence>("session_id", mobileSessionId.toString())); }
[ "public", "void", "sms_sendResponse", "(", "Integer", "userId", ",", "CharSequence", "response", ",", "Integer", "mobileSessionId", ")", "throws", "FacebookException", ",", "IOException", "{", "this", ".", "callMethod", "(", "FacebookMethod", ".", "SMS_SEND_MESSAGE", ...
Sends a message via SMS to the user identified by <code>userId</code> in response to a user query associated with <code>mobileSessionId</code>. @param userId a user ID @param response the message to be sent via SMS @param mobileSessionId the mobile session @throws FacebookException in case of error @throws IOException @see FacebookExtendedPerm#SMS @see <a href="http://wiki.developers.facebook.com/index.php/Mobile#Application_generated_messages"> Developers Wiki: Mobile: Application Generated Messages</a> @see <a href="http://wiki.developers.facebook.com/index.php/Mobile#Workflow"> Developers Wiki: Mobile: Workflow</a>
[ "Sends", "a", "message", "via", "SMS", "to", "the", "user", "identified", "by", "<code", ">", "userId<", "/", "code", ">", "in", "response", "to", "a", "user", "query", "associated", "with", "<code", ">", "mobileSessionId<", "/", "code", ">", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1635-L1641
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/Util.java
Util.pwr2LawNext
public static final int pwr2LawNext(final int ppo, final int curPoint) { final int cur = (curPoint < 1) ? 1 : curPoint; int gi = (int)round(log2(cur) * ppo); //current generating index int next; do { next = (int)round(pow(2.0, (double) ++gi / ppo)); } while ( next <= curPoint); return next; }
java
public static final int pwr2LawNext(final int ppo, final int curPoint) { final int cur = (curPoint < 1) ? 1 : curPoint; int gi = (int)round(log2(cur) * ppo); //current generating index int next; do { next = (int)round(pow(2.0, (double) ++gi / ppo)); } while ( next <= curPoint); return next; }
[ "public", "static", "final", "int", "pwr2LawNext", "(", "final", "int", "ppo", ",", "final", "int", "curPoint", ")", "{", "final", "int", "cur", "=", "(", "curPoint", "<", "1", ")", "?", "1", ":", "curPoint", ";", "int", "gi", "=", "(", "int", ")",...
Computes the next larger integer point in the power series <i>point = 2<sup>( i / ppo )</sup></i> given the current point in the series. For illustration, this can be used in a loop as follows: <pre>{@code int maxP = 1024; int minP = 1; int ppo = 2; for (int p = minP; p <= maxP; p = pwr2LawNext(ppo, p)) { System.out.print(p + " "); } //generates the following series: //1 2 3 4 6 8 11 16 23 32 45 64 91 128 181 256 362 512 724 1024 }</pre> @param ppo Points-Per-Octave, or the number of points per integer powers of 2 in the series. @param curPoint the current point of the series. Must be &ge; 1. @return the next point in the power series.
[ "Computes", "the", "next", "larger", "integer", "point", "in", "the", "power", "series", "<i", ">", "point", "=", "2<sup", ">", "(", "i", "/", "ppo", ")", "<", "/", "sup", ">", "<", "/", "i", ">", "given", "the", "current", "point", "in", "the", ...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L486-L494
VoltDB/voltdb
src/frontend/org/voltcore/agreement/MeshArbiter.java
MeshArbiter.reconfigureOnFault
Map<Long, Long> reconfigureOnFault(Set<Long> hsIds, FaultMessage fm) { return reconfigureOnFault(hsIds, fm, new HashSet<Long>()); }
java
Map<Long, Long> reconfigureOnFault(Set<Long> hsIds, FaultMessage fm) { return reconfigureOnFault(hsIds, fm, new HashSet<Long>()); }
[ "Map", "<", "Long", ",", "Long", ">", "reconfigureOnFault", "(", "Set", "<", "Long", ">", "hsIds", ",", "FaultMessage", "fm", ")", "{", "return", "reconfigureOnFault", "(", "hsIds", ",", "fm", ",", "new", "HashSet", "<", "Long", ">", "(", ")", ")", "...
Convenience wrapper for tests that don't care about unknown sites
[ "Convenience", "wrapper", "for", "tests", "that", "don", "t", "care", "about", "unknown", "sites" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/MeshArbiter.java#L259-L261
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/ReactiveTypes.java
ReactiveTypes.isAvailable
public static boolean isAvailable(ReactiveLibrary reactiveLibrary) { LettuceAssert.notNull(reactiveLibrary, "ReactiveLibrary must not be null!"); switch (reactiveLibrary) { case PROJECT_REACTOR: return PROJECT_REACTOR_PRESENT; case RXJAVA1: return RXJAVA1_PRESENT; case RXJAVA2: return RXJAVA2_PRESENT; } throw new IllegalArgumentException(String.format("ReactiveLibrary %s not supported", reactiveLibrary)); }
java
public static boolean isAvailable(ReactiveLibrary reactiveLibrary) { LettuceAssert.notNull(reactiveLibrary, "ReactiveLibrary must not be null!"); switch (reactiveLibrary) { case PROJECT_REACTOR: return PROJECT_REACTOR_PRESENT; case RXJAVA1: return RXJAVA1_PRESENT; case RXJAVA2: return RXJAVA2_PRESENT; } throw new IllegalArgumentException(String.format("ReactiveLibrary %s not supported", reactiveLibrary)); }
[ "public", "static", "boolean", "isAvailable", "(", "ReactiveLibrary", "reactiveLibrary", ")", "{", "LettuceAssert", ".", "notNull", "(", "reactiveLibrary", ",", "\"ReactiveLibrary must not be null!\"", ")", ";", "switch", "(", "reactiveLibrary", ")", "{", "case", "PRO...
Returns {@literal true} if the {@link ReactiveLibrary} is available. @param reactiveLibrary must not be {@literal null}. @return {@literal true} if the {@link ReactiveLibrary} is available.
[ "Returns", "{", "@literal", "true", "}", "if", "the", "{", "@link", "ReactiveLibrary", "}", "is", "available", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/ReactiveTypes.java#L108-L122
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/random/RandomDateTime.java
RandomDateTime.nextDate
public static ZonedDateTime nextDate(int minYear, int maxYear) { int currentYear = ZonedDateTime.now().getYear(); minYear = minYear == 0 ? currentYear - RandomInteger.nextInteger(10) : minYear; maxYear = maxYear == 0 ? currentYear : maxYear; int year = RandomInteger.nextInteger(minYear, maxYear); int month = RandomInteger.nextInteger(1, 13); int day = RandomInteger.nextInteger(1, 32); if (month == 2) day = Math.min(28, day); else if (month == 4 || month == 6 || month == 9 || month == 11) day = Math.min(30, day); return ZonedDateTime.of(year, month, day, 0, 0, 0, 0, ZoneId.of("UTC")); }
java
public static ZonedDateTime nextDate(int minYear, int maxYear) { int currentYear = ZonedDateTime.now().getYear(); minYear = minYear == 0 ? currentYear - RandomInteger.nextInteger(10) : minYear; maxYear = maxYear == 0 ? currentYear : maxYear; int year = RandomInteger.nextInteger(minYear, maxYear); int month = RandomInteger.nextInteger(1, 13); int day = RandomInteger.nextInteger(1, 32); if (month == 2) day = Math.min(28, day); else if (month == 4 || month == 6 || month == 9 || month == 11) day = Math.min(30, day); return ZonedDateTime.of(year, month, day, 0, 0, 0, 0, ZoneId.of("UTC")); }
[ "public", "static", "ZonedDateTime", "nextDate", "(", "int", "minYear", ",", "int", "maxYear", ")", "{", "int", "currentYear", "=", "ZonedDateTime", ".", "now", "(", ")", ".", "getYear", "(", ")", ";", "minYear", "=", "minYear", "==", "0", "?", "currentY...
Generates a random ZonedDateTime in the range ['minYear', 'maxYear']. This method generate dates without time (or time set to 00:00:00) @param minYear (optional) minimum range value @param maxYear max range value @return a random ZonedDateTime value.
[ "Generates", "a", "random", "ZonedDateTime", "in", "the", "range", "[", "minYear", "maxYear", "]", ".", "This", "method", "generate", "dates", "without", "time", "(", "or", "time", "set", "to", "00", ":", "00", ":", "00", ")" ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/random/RandomDateTime.java#L25-L39
box/box-java-sdk
src/main/java/com/box/sdk/MetadataTemplate.java
MetadataTemplate.deleteMetadataTemplate
public static void deleteMetadataTemplate(BoxAPIConnection api, String scope, String template) { URL url = METADATA_TEMPLATE_URL_TEMPLATE.build(api.getBaseURL(), scope, template); BoxJSONRequest request = new BoxJSONRequest(api, url, "DELETE"); request.send(); }
java
public static void deleteMetadataTemplate(BoxAPIConnection api, String scope, String template) { URL url = METADATA_TEMPLATE_URL_TEMPLATE.build(api.getBaseURL(), scope, template); BoxJSONRequest request = new BoxJSONRequest(api, url, "DELETE"); request.send(); }
[ "public", "static", "void", "deleteMetadataTemplate", "(", "BoxAPIConnection", "api", ",", "String", "scope", ",", "String", "template", ")", "{", "URL", "url", "=", "METADATA_TEMPLATE_URL_TEMPLATE", ".", "build", "(", "api", ".", "getBaseURL", "(", ")", ",", ...
Deletes the schema of an existing metadata template. @param api the API connection to be used @param scope the scope of the object @param template Unique identifier of the template
[ "Deletes", "the", "schema", "of", "an", "existing", "metadata", "template", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/MetadataTemplate.java#L304-L310
Alluxio/alluxio
shell/src/main/java/alluxio/cli/fsadmin/report/UfsCommand.java
UfsCommand.printMountInfo
public static void printMountInfo(Map<String, MountPointInfo> mountTable) { for (Map.Entry<String, MountPointInfo> entry : mountTable.entrySet()) { String mMountPoint = entry.getKey(); MountPointInfo mountPointInfo = entry.getValue(); long capacityBytes = mountPointInfo.getUfsCapacityBytes(); long usedBytes = mountPointInfo.getUfsUsedBytes(); String usedPercentageInfo = ""; if (capacityBytes > 0) { int usedPercentage = (int) (100L * usedBytes / capacityBytes); usedPercentageInfo = String.format("(%s%%)", usedPercentage); } String leftAlignFormat = getAlignFormat(mountTable); System.out.format(leftAlignFormat, mountPointInfo.getUfsUri(), mMountPoint, mountPointInfo.getUfsType(), FormatUtils.getSizeFromBytes(capacityBytes), FormatUtils.getSizeFromBytes(usedBytes) + usedPercentageInfo, mountPointInfo.getReadOnly() ? "" : "not ", mountPointInfo.getShared() ? "" : "not "); System.out.println("properties=" + mountPointInfo.getProperties() + ")"); } }
java
public static void printMountInfo(Map<String, MountPointInfo> mountTable) { for (Map.Entry<String, MountPointInfo> entry : mountTable.entrySet()) { String mMountPoint = entry.getKey(); MountPointInfo mountPointInfo = entry.getValue(); long capacityBytes = mountPointInfo.getUfsCapacityBytes(); long usedBytes = mountPointInfo.getUfsUsedBytes(); String usedPercentageInfo = ""; if (capacityBytes > 0) { int usedPercentage = (int) (100L * usedBytes / capacityBytes); usedPercentageInfo = String.format("(%s%%)", usedPercentage); } String leftAlignFormat = getAlignFormat(mountTable); System.out.format(leftAlignFormat, mountPointInfo.getUfsUri(), mMountPoint, mountPointInfo.getUfsType(), FormatUtils.getSizeFromBytes(capacityBytes), FormatUtils.getSizeFromBytes(usedBytes) + usedPercentageInfo, mountPointInfo.getReadOnly() ? "" : "not ", mountPointInfo.getShared() ? "" : "not "); System.out.println("properties=" + mountPointInfo.getProperties() + ")"); } }
[ "public", "static", "void", "printMountInfo", "(", "Map", "<", "String", ",", "MountPointInfo", ">", "mountTable", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "MountPointInfo", ">", "entry", ":", "mountTable", ".", "entrySet", "(", ")", ...
Prints mount information for a mount table. @param mountTable the mount table to get information from
[ "Prints", "mount", "information", "for", "a", "mount", "table", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/UfsCommand.java#L54-L77