repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/effects/JFXDepthManager.java
JFXDepthManager.createMaterialNode
public static Node createMaterialNode(Node control, int level) { Node container = new Pane(control){ @Override protected double computeMaxWidth(double height) { return computePrefWidth(height); } @Override protected double computeMaxHeight(double width) { return computePrefHeight(width); } @Override protected double computePrefWidth(double height) { return control.prefWidth(height); } @Override protected double computePrefHeight(double width) { return control.prefHeight(width); } }; container.getStyleClass().add("depth-container"); container.setPickOnBounds(false); level = level < 0 ? 0 : level; level = level > 5 ? 5 : level; container.setEffect(new DropShadow(BlurType.GAUSSIAN, depth[level].getColor(), depth[level].getRadius(), depth[level].getSpread(), depth[level].getOffsetX(), depth[level].getOffsetY())); return container; }
java
public static Node createMaterialNode(Node control, int level) { Node container = new Pane(control){ @Override protected double computeMaxWidth(double height) { return computePrefWidth(height); } @Override protected double computeMaxHeight(double width) { return computePrefHeight(width); } @Override protected double computePrefWidth(double height) { return control.prefWidth(height); } @Override protected double computePrefHeight(double width) { return control.prefHeight(width); } }; container.getStyleClass().add("depth-container"); container.setPickOnBounds(false); level = level < 0 ? 0 : level; level = level > 5 ? 5 : level; container.setEffect(new DropShadow(BlurType.GAUSSIAN, depth[level].getColor(), depth[level].getRadius(), depth[level].getSpread(), depth[level].getOffsetX(), depth[level].getOffsetY())); return container; }
[ "public", "static", "Node", "createMaterialNode", "(", "Node", "control", ",", "int", "level", ")", "{", "Node", "container", "=", "new", "Pane", "(", "control", ")", "{", "@", "Override", "protected", "double", "computeMaxWidth", "(", "double", "height", ")...
this method will generate a new container node that prevent control transformation to be applied to the shadow effect (which makes it looks as a real shadow)
[ "this", "method", "will", "generate", "a", "new", "container", "node", "that", "prevent", "control", "transformation", "to", "be", "applied", "to", "the", "shadow", "effect", "(", "which", "makes", "it", "looks", "as", "a", "real", "shadow", ")" ]
train
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/effects/JFXDepthManager.java#L76-L109
iipc/webarchive-commons
src/main/java/org/archive/util/zip/OpenJDK7GZIPInputStream.java
OpenJDK7GZIPInputStream.skipBytes
protected void skipBytes(InputStream in, int n) throws IOException { // IA VISIBILITY CHANGE FOR SUBCLASS USE while (n > 0) { int len = in.read(tmpbuf, 0, n < tmpbuf.length ? n : tmpbuf.length); if (len == -1) { throw new EOFException(); } n -= len; } }
java
protected void skipBytes(InputStream in, int n) throws IOException { // IA VISIBILITY CHANGE FOR SUBCLASS USE while (n > 0) { int len = in.read(tmpbuf, 0, n < tmpbuf.length ? n : tmpbuf.length); if (len == -1) { throw new EOFException(); } n -= len; } }
[ "protected", "void", "skipBytes", "(", "InputStream", "in", ",", "int", "n", ")", "throws", "IOException", "{", "// IA VISIBILITY CHANGE FOR SUBCLASS USE\r", "while", "(", "n", ">", "0", ")", "{", "int", "len", "=", "in", ".", "read", "(", "tmpbuf", ",", "...
/* Skips bytes of input data blocking until all bytes are skipped. Does not assume that the input stream is capable of seeking.
[ "/", "*", "Skips", "bytes", "of", "input", "data", "blocking", "until", "all", "bytes", "are", "skipped", ".", "Does", "not", "assume", "that", "the", "input", "stream", "is", "capable", "of", "seeking", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/zip/OpenJDK7GZIPInputStream.java#L286-L294
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputFormat.java
FileOutputFormat.setOutputPath
public static void setOutputPath(Job job, Path outputDir) { job.getConfiguration().set("mapred.output.dir", outputDir.toString()); }
java
public static void setOutputPath(Job job, Path outputDir) { job.getConfiguration().set("mapred.output.dir", outputDir.toString()); }
[ "public", "static", "void", "setOutputPath", "(", "Job", "job", ",", "Path", "outputDir", ")", "{", "job", ".", "getConfiguration", "(", ")", ".", "set", "(", "\"mapred.output.dir\"", ",", "outputDir", ".", "toString", "(", ")", ")", ";", "}" ]
Set the {@link Path} of the output directory for the map-reduce job. @param job The job to modify @param outputDir the {@link Path} of the output directory for the map-reduce job.
[ "Set", "the", "{", "@link", "Path", "}", "of", "the", "output", "directory", "for", "the", "map", "-", "reduce", "job", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputFormat.java#L135-L137
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/version_recommendations.java
version_recommendations.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { version_recommendations_responses result = (version_recommendations_responses) service.get_payload_formatter().string_to_resource(version_recommendations_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.version_recommendations_response_array); } version_recommendations[] result_version_recommendations = new version_recommendations[result.version_recommendations_response_array.length]; for(int i = 0; i < result.version_recommendations_response_array.length; i++) { result_version_recommendations[i] = result.version_recommendations_response_array[i].version_recommendations[0]; } return result_version_recommendations; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { version_recommendations_responses result = (version_recommendations_responses) service.get_payload_formatter().string_to_resource(version_recommendations_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.version_recommendations_response_array); } version_recommendations[] result_version_recommendations = new version_recommendations[result.version_recommendations_response_array.length]; for(int i = 0; i < result.version_recommendations_response_array.length; i++) { result_version_recommendations[i] = result.version_recommendations_response_array[i].version_recommendations[0]; } return result_version_recommendations; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "version_recommendations_responses", "result", "=", "(", "version_recommendations_responses", ")", "service", "....
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/version_recommendations.java#L329-L346
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.backendHealth
public ApplicationGatewayBackendHealthInner backendHealth(String resourceGroupName, String applicationGatewayName) { return backendHealthWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().last().body(); }
java
public ApplicationGatewayBackendHealthInner backendHealth(String resourceGroupName, String applicationGatewayName) { return backendHealthWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().last().body(); }
[ "public", "ApplicationGatewayBackendHealthInner", "backendHealth", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ")", "{", "return", "backendHealthWithServiceResponseAsync", "(", "resourceGroupName", ",", "applicationGatewayName", ")", ".", "toBlo...
Gets the backend health of the specified application gateway in a resource group. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @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 ApplicationGatewayBackendHealthInner object if successful.
[ "Gets", "the", "backend", "health", "of", "the", "specified", "application", "gateway", "in", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L1405-L1407
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java
DirectedGraph.containsBoth
private boolean containsBoth(N a, N b) { return nodes.containsKey(a) && nodes.containsKey(b); }
java
private boolean containsBoth(N a, N b) { return nodes.containsKey(a) && nodes.containsKey(b); }
[ "private", "boolean", "containsBoth", "(", "N", "a", ",", "N", "b", ")", "{", "return", "nodes", ".", "containsKey", "(", "a", ")", "&&", "nodes", ".", "containsKey", "(", "b", ")", ";", "}" ]
Returns true if both <tt>a</tt> and <tt>b</tt> are nodes in the graph @param a the first value to check for @param b the second value to check for @return true if both <tt>a</tt> and <tt>b</tt> are in the graph, false otherwise
[ "Returns", "true", "if", "both", "<tt", ">", "a<", "/", "tt", ">", "and", "<tt", ">", "b<", "/", "tt", ">", "are", "nodes", "in", "the", "graph" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java#L165-L168
voldemort/voldemort
src/java/voldemort/utils/ByteUtils.java
ByteUtils.readInt
public static int readInt(byte[] bytes, int offset) { return (((bytes[offset + 0] & 0xff) << 24) | ((bytes[offset + 1] & 0xff) << 16) | ((bytes[offset + 2] & 0xff) << 8) | (bytes[offset + 3] & 0xff)); }
java
public static int readInt(byte[] bytes, int offset) { return (((bytes[offset + 0] & 0xff) << 24) | ((bytes[offset + 1] & 0xff) << 16) | ((bytes[offset + 2] & 0xff) << 8) | (bytes[offset + 3] & 0xff)); }
[ "public", "static", "int", "readInt", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "return", "(", "(", "(", "bytes", "[", "offset", "+", "0", "]", "&", "0xff", ")", "<<", "24", ")", "|", "(", "(", "bytes", "[", "offset", "+",...
Read an int from the byte array starting at the given offset @param bytes The byte array to read from @param offset The offset to start reading at @return The int read
[ "Read", "an", "int", "from", "the", "byte", "array", "starting", "at", "the", "given", "offset" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ByteUtils.java#L179-L182
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsTopicConnectionFactoryImpl.java
JmsTopicConnectionFactoryImpl.instantiateConnection
JmsConnectionImpl instantiateConnection(JmsJcaConnection jcaConnection, Map _passThruProps) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConnection", jcaConnection); JmsTopicConnectionImpl jmsTopicConnection = new JmsTopicConnectionImpl(jcaConnection, isManaged(), _passThruProps); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConnection", jmsTopicConnection); return jmsTopicConnection; }
java
JmsConnectionImpl instantiateConnection(JmsJcaConnection jcaConnection, Map _passThruProps) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConnection", jcaConnection); JmsTopicConnectionImpl jmsTopicConnection = new JmsTopicConnectionImpl(jcaConnection, isManaged(), _passThruProps); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConnection", jmsTopicConnection); return jmsTopicConnection; }
[ "JmsConnectionImpl", "instantiateConnection", "(", "JmsJcaConnection", "jcaConnection", ",", "Map", "_passThruProps", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ...
This overrides a superclass method, so that the superclass's createConnection() method can be inherited, but still return an object of this class's type.
[ "This", "overrides", "a", "superclass", "method", "so", "that", "the", "superclass", "s", "createConnection", "()", "method", "can", "be", "inherited", "but", "still", "return", "an", "object", "of", "this", "class", "s", "type", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsTopicConnectionFactoryImpl.java#L78-L83
tvesalainen/util
util/src/main/java/org/vesalainen/util/ArrayHelp.java
ArrayHelp.contains
public static final <T> boolean contains(T[] array, T item) { for (T b : array) { if (b.equals(item)) { return true; } } return false; }
java
public static final <T> boolean contains(T[] array, T item) { for (T b : array) { if (b.equals(item)) { return true; } } return false; }
[ "public", "static", "final", "<", "T", ">", "boolean", "contains", "(", "T", "[", "]", "array", ",", "T", "item", ")", "{", "for", "(", "T", "b", ":", "array", ")", "{", "if", "(", "b", ".", "equals", "(", "item", ")", ")", "{", "return", "tr...
Returns true if one of arr members equals item @param <T> @param array @param item @return
[ "Returns", "true", "if", "one", "of", "arr", "members", "equals", "item" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/ArrayHelp.java#L374-L384
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java
ModbusSerialTransport.writeAsciiBytes
int writeAsciiBytes(byte[] buffer, long bytesToWrite) throws IOException { if (commPort != null && commPort.isOpen()) { int cnt = 0; for (int i = 0; i < bytesToWrite; i++) { if (writeAsciiByte(buffer[i]) != 2) { return cnt; } cnt++; } return cnt; } else { throw new IOException("Comm port is not valid or not open"); } }
java
int writeAsciiBytes(byte[] buffer, long bytesToWrite) throws IOException { if (commPort != null && commPort.isOpen()) { int cnt = 0; for (int i = 0; i < bytesToWrite; i++) { if (writeAsciiByte(buffer[i]) != 2) { return cnt; } cnt++; } return cnt; } else { throw new IOException("Comm port is not valid or not open"); } }
[ "int", "writeAsciiBytes", "(", "byte", "[", "]", "buffer", ",", "long", "bytesToWrite", ")", "throws", "IOException", "{", "if", "(", "commPort", "!=", "null", "&&", "commPort", ".", "isOpen", "(", ")", ")", "{", "int", "cnt", "=", "0", ";", "for", "...
Writes an array of bytes out as a stream of ascii characters @param buffer Buffer of bytes to write @param bytesToWrite Number of characters to write @return Number of bytes written @throws IOException If a problem with the port
[ "Writes", "an", "array", "of", "bytes", "out", "as", "a", "stream", "of", "ascii", "characters" ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java#L538-L552
moparisthebest/beehive
beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/EJBInfo.java
EJBInfo.getRoot
public Class getRoot(Class clazz, HashMap derivesFrom) { while (derivesFrom.containsKey(clazz)) clazz = (Class) derivesFrom.get(clazz); return clazz; }
java
public Class getRoot(Class clazz, HashMap derivesFrom) { while (derivesFrom.containsKey(clazz)) clazz = (Class) derivesFrom.get(clazz); return clazz; }
[ "public", "Class", "getRoot", "(", "Class", "clazz", ",", "HashMap", "derivesFrom", ")", "{", "while", "(", "derivesFrom", ".", "containsKey", "(", "clazz", ")", ")", "clazz", "=", "(", "Class", ")", "derivesFrom", ".", "get", "(", "clazz", ")", ";", "...
Unwinds the results of reflecting through the interface inheritance hierachy to find the original root class from a derived class
[ "Unwinds", "the", "results", "of", "reflecting", "through", "the", "interface", "inheritance", "hierachy", "to", "find", "the", "original", "root", "class", "from", "a", "derived", "class" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/EJBInfo.java#L148-L151
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsImpl.java
StatsImpl.myupdate
private synchronized void myupdate(WSStats newStats, boolean keepOld, boolean recursiveUpdate) { if (newStats == null) return; StatsImpl newStats1 = (StatsImpl) newStats; // update the level and description of this collection this.instrumentationLevel = newStats1.getLevel(); // update data updateMembers(newStats, keepOld); // update subcollections if (recursiveUpdate) updateSubcollection(newStats, keepOld, recursiveUpdate); }
java
private synchronized void myupdate(WSStats newStats, boolean keepOld, boolean recursiveUpdate) { if (newStats == null) return; StatsImpl newStats1 = (StatsImpl) newStats; // update the level and description of this collection this.instrumentationLevel = newStats1.getLevel(); // update data updateMembers(newStats, keepOld); // update subcollections if (recursiveUpdate) updateSubcollection(newStats, keepOld, recursiveUpdate); }
[ "private", "synchronized", "void", "myupdate", "(", "WSStats", "newStats", ",", "boolean", "keepOld", ",", "boolean", "recursiveUpdate", ")", "{", "if", "(", "newStats", "==", "null", ")", "return", ";", "StatsImpl", "newStats1", "=", "(", "StatsImpl", ")", ...
Assume we have verified newStats is the same PMI module as this Stats
[ "Assume", "we", "have", "verified", "newStats", "is", "the", "same", "PMI", "module", "as", "this", "Stats" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsImpl.java#L639-L653
phax/ph-datetime
ph-holiday/src/main/java/com/helger/holiday/parser/AbstractHolidayParser.java
AbstractHolidayParser.isValid
protected static final boolean isValid (final Holiday aHoliday, final int nYear) { return _isValidInYear (aHoliday, nYear) && _isValidForCycle (aHoliday, nYear); }
java
protected static final boolean isValid (final Holiday aHoliday, final int nYear) { return _isValidInYear (aHoliday, nYear) && _isValidForCycle (aHoliday, nYear); }
[ "protected", "static", "final", "boolean", "isValid", "(", "final", "Holiday", "aHoliday", ",", "final", "int", "nYear", ")", "{", "return", "_isValidInYear", "(", "aHoliday", ",", "nYear", ")", "&&", "_isValidForCycle", "(", "aHoliday", ",", "nYear", ")", "...
Evaluates if the provided <code>Holiday</code> instance is valid for the provided year. @param aHoliday The holiday configuration entry to validate @param nYear The year to validate against. @return is valid for the year.
[ "Evaluates", "if", "the", "provided", "<code", ">", "Holiday<", "/", "code", ">", "instance", "is", "valid", "for", "the", "provided", "year", "." ]
train
https://github.com/phax/ph-datetime/blob/cfaff01cb76d9affb934800ff55734b5a7d8983e/ph-holiday/src/main/java/com/helger/holiday/parser/AbstractHolidayParser.java#L53-L56
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/aggregate/CrossTab.java
CrossTab.columnPercents
public static Table columnPercents(Table table, String column1, String column2) { return columnPercents(table, table.categoricalColumn(column1), table.categoricalColumn(column2)); }
java
public static Table columnPercents(Table table, String column1, String column2) { return columnPercents(table, table.categoricalColumn(column1), table.categoricalColumn(column2)); }
[ "public", "static", "Table", "columnPercents", "(", "Table", "table", ",", "String", "column1", ",", "String", "column2", ")", "{", "return", "columnPercents", "(", "table", ",", "table", ".", "categoricalColumn", "(", "column1", ")", ",", "table", ".", "cat...
Returns a table containing the column percents made from a source table, after first calculating the counts cross-tabulated from the given columns
[ "Returns", "a", "table", "containing", "the", "column", "percents", "made", "from", "a", "source", "table", "after", "first", "calculating", "the", "counts", "cross", "-", "tabulated", "from", "the", "given", "columns" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/aggregate/CrossTab.java#L253-L255
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java
SegmentAggregator.checkValidOperation
private void checkValidOperation(SegmentOperation operation) throws DataCorruptionException { // Verify that the SegmentOperation has been routed to the correct SegmentAggregator instance. Preconditions.checkArgument( operation.getStreamSegmentId() == this.metadata.getId(), "Operation '%s' refers to a different Segment than this one (%s).", operation, this.metadata.getId()); // After Sealing, we can only Truncate or Delete a Segment. if (this.hasSealPending.get() && !isTruncateOperation(operation) && !isDeleteOperation(operation)) { throw new DataCorruptionException(String.format("Illegal operation for a sealed Segment; received '%s'.", operation)); } }
java
private void checkValidOperation(SegmentOperation operation) throws DataCorruptionException { // Verify that the SegmentOperation has been routed to the correct SegmentAggregator instance. Preconditions.checkArgument( operation.getStreamSegmentId() == this.metadata.getId(), "Operation '%s' refers to a different Segment than this one (%s).", operation, this.metadata.getId()); // After Sealing, we can only Truncate or Delete a Segment. if (this.hasSealPending.get() && !isTruncateOperation(operation) && !isDeleteOperation(operation)) { throw new DataCorruptionException(String.format("Illegal operation for a sealed Segment; received '%s'.", operation)); } }
[ "private", "void", "checkValidOperation", "(", "SegmentOperation", "operation", ")", "throws", "DataCorruptionException", "{", "// Verify that the SegmentOperation has been routed to the correct SegmentAggregator instance.", "Preconditions", ".", "checkArgument", "(", "operation", "....
Ensures the following conditions are met: * SegmentId matches this SegmentAggregator's SegmentId * If Segment is Sealed, only TruncateSegmentOperations are allowed. * If Segment is deleted, no further operations are allowed. @param operation The operation to check. @throws IllegalArgumentException If any of the validations failed.
[ "Ensures", "the", "following", "conditions", "are", "met", ":", "*", "SegmentId", "matches", "this", "SegmentAggregator", "s", "SegmentId", "*", "If", "Segment", "is", "Sealed", "only", "TruncateSegmentOperations", "are", "allowed", ".", "*", "If", "Segment", "i...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L1526-L1536
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java
PlatformBitmapFactory.createBitmap
public CloseableReference<Bitmap> createBitmap( Bitmap source, int x, int y, int width, int height, @Nullable Matrix matrix, boolean filter, @Nullable Object callerContext) { Preconditions.checkNotNull(source, "Source bitmap cannot be null"); checkXYSign(x, y); checkWidthHeight(width, height); checkFinalImageBounds(source, x, y, width, height); // assigned because matrix can modify the final width, height int newWidth = width; int newHeight = height; Canvas canvas; CloseableReference<Bitmap> bitmapRef; Paint paint; Rect srcRectangle = new Rect(x, y, x + width, y + height); RectF dstRectangle = new RectF(0, 0, width, height); Bitmap.Config newConfig = getSuitableBitmapConfig(source); if (matrix == null || matrix.isIdentity()) { bitmapRef = createBitmap(newWidth, newHeight, newConfig, source.hasAlpha(), callerContext); setPropertyFromSourceBitmap(source, bitmapRef.get()); canvas = new Canvas(bitmapRef.get()); paint = null; // not needed } else { boolean transformed = !matrix.rectStaysRect(); RectF deviceRectangle = new RectF(); matrix.mapRect(deviceRectangle, dstRectangle); newWidth = Math.round(deviceRectangle.width()); newHeight = Math.round(deviceRectangle.height()); bitmapRef = createBitmap( newWidth, newHeight, transformed ? Bitmap.Config.ARGB_8888 : newConfig, transformed || source.hasAlpha(), callerContext); setPropertyFromSourceBitmap(source, bitmapRef.get()); canvas = new Canvas(bitmapRef.get()); canvas.translate(-deviceRectangle.left, -deviceRectangle.top); canvas.concat(matrix); paint = new Paint(); paint.setFilterBitmap(filter); if (transformed) { paint.setAntiAlias(true); } } canvas.drawBitmap(source, srcRectangle, dstRectangle, paint); canvas.setBitmap(null); return bitmapRef; }
java
public CloseableReference<Bitmap> createBitmap( Bitmap source, int x, int y, int width, int height, @Nullable Matrix matrix, boolean filter, @Nullable Object callerContext) { Preconditions.checkNotNull(source, "Source bitmap cannot be null"); checkXYSign(x, y); checkWidthHeight(width, height); checkFinalImageBounds(source, x, y, width, height); // assigned because matrix can modify the final width, height int newWidth = width; int newHeight = height; Canvas canvas; CloseableReference<Bitmap> bitmapRef; Paint paint; Rect srcRectangle = new Rect(x, y, x + width, y + height); RectF dstRectangle = new RectF(0, 0, width, height); Bitmap.Config newConfig = getSuitableBitmapConfig(source); if (matrix == null || matrix.isIdentity()) { bitmapRef = createBitmap(newWidth, newHeight, newConfig, source.hasAlpha(), callerContext); setPropertyFromSourceBitmap(source, bitmapRef.get()); canvas = new Canvas(bitmapRef.get()); paint = null; // not needed } else { boolean transformed = !matrix.rectStaysRect(); RectF deviceRectangle = new RectF(); matrix.mapRect(deviceRectangle, dstRectangle); newWidth = Math.round(deviceRectangle.width()); newHeight = Math.round(deviceRectangle.height()); bitmapRef = createBitmap( newWidth, newHeight, transformed ? Bitmap.Config.ARGB_8888 : newConfig, transformed || source.hasAlpha(), callerContext); setPropertyFromSourceBitmap(source, bitmapRef.get()); canvas = new Canvas(bitmapRef.get()); canvas.translate(-deviceRectangle.left, -deviceRectangle.top); canvas.concat(matrix); paint = new Paint(); paint.setFilterBitmap(filter); if (transformed) { paint.setAntiAlias(true); } } canvas.drawBitmap(source, srcRectangle, dstRectangle, paint); canvas.setBitmap(null); return bitmapRef; }
[ "public", "CloseableReference", "<", "Bitmap", ">", "createBitmap", "(", "Bitmap", "source", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ",", "@", "Nullable", "Matrix", "matrix", ",", "boolean", "filter", ",", "@", "Nulla...
Creates a bitmap from subset of the source bitmap, transformed by the optional matrix. It is initialized with the same density as the original bitmap. @param source The bitmap we are subsetting @param x The x coordinate of the first pixel in source @param y The y coordinate of the first pixel in source @param width The number of pixels in each row @param height The number of rows @param matrix Optional matrix to be applied to the pixels @param filter true if the source should be filtered. Only applies if the matrix contains more than just translation. @param callerContext the Tag to track who create the Bitmap @return a reference to the bitmap @throws IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0 @throws TooManyBitmapsException if the pool is full @throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated
[ "Creates", "a", "bitmap", "from", "subset", "of", "the", "source", "bitmap", "transformed", "by", "the", "optional", "matrix", ".", "It", "is", "initialized", "with", "the", "same", "density", "as", "the", "original", "bitmap", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java#L295-L357
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java
CDKMCS.getMaximum
private static List<IAtomContainer> getMaximum(ArrayList<IAtomContainer> graphList, boolean shouldMatchBonds) throws CDKException { List<IAtomContainer> reducedGraphList = (List<IAtomContainer>) graphList.clone(); for (int i = 0; i < graphList.size(); i++) { IAtomContainer graphI = graphList.get(i); for (int j = i + 1; j < graphList.size(); j++) { IAtomContainer graphJ = graphList.get(j); // Gi included in Gj or Gj included in Gi then // reduce the irrelevant solution if (isSubgraph(graphJ, graphI, shouldMatchBonds)) { reducedGraphList.remove(graphI); } else if (isSubgraph(graphI, graphJ, shouldMatchBonds)) { reducedGraphList.remove(graphJ); } } } return reducedGraphList; }
java
private static List<IAtomContainer> getMaximum(ArrayList<IAtomContainer> graphList, boolean shouldMatchBonds) throws CDKException { List<IAtomContainer> reducedGraphList = (List<IAtomContainer>) graphList.clone(); for (int i = 0; i < graphList.size(); i++) { IAtomContainer graphI = graphList.get(i); for (int j = i + 1; j < graphList.size(); j++) { IAtomContainer graphJ = graphList.get(j); // Gi included in Gj or Gj included in Gi then // reduce the irrelevant solution if (isSubgraph(graphJ, graphI, shouldMatchBonds)) { reducedGraphList.remove(graphI); } else if (isSubgraph(graphI, graphJ, shouldMatchBonds)) { reducedGraphList.remove(graphJ); } } } return reducedGraphList; }
[ "private", "static", "List", "<", "IAtomContainer", ">", "getMaximum", "(", "ArrayList", "<", "IAtomContainer", ">", "graphList", ",", "boolean", "shouldMatchBonds", ")", "throws", "CDKException", "{", "List", "<", "IAtomContainer", ">", "reducedGraphList", "=", "...
Removes all redundant solution. @param graphList the list of structure to clean @return the list cleaned @throws org.openscience.cdk.exception.CDKException if there is atom problem in obtaining subgraphs
[ "Removes", "all", "redundant", "solution", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java#L608-L628
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/Actor.java
Actor.childActorFor
protected <T> T childActorFor(final Class<T> protocol, final Definition definition) { if (definition.supervisor() != null) { return lifeCycle.environment.stage.actorFor(protocol, definition, this, definition.supervisor(), logger()); } else { if (this instanceof Supervisor) { return lifeCycle.environment.stage.actorFor(protocol, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger()); } else { return lifeCycle.environment.stage.actorFor(protocol, definition, this, null, logger()); } } }
java
protected <T> T childActorFor(final Class<T> protocol, final Definition definition) { if (definition.supervisor() != null) { return lifeCycle.environment.stage.actorFor(protocol, definition, this, definition.supervisor(), logger()); } else { if (this instanceof Supervisor) { return lifeCycle.environment.stage.actorFor(protocol, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger()); } else { return lifeCycle.environment.stage.actorFor(protocol, definition, this, null, logger()); } } }
[ "protected", "<", "T", ">", "T", "childActorFor", "(", "final", "Class", "<", "T", ">", "protocol", ",", "final", "Definition", "definition", ")", "{", "if", "(", "definition", ".", "supervisor", "(", ")", "!=", "null", ")", "{", "return", "lifeCycle", ...
Answers the {@code T} protocol for the child {@code Actor} to be created by this parent {@code Actor}. @param <T> the protocol type @param protocol the {@code Class<T>} protocol of the child {@code Actor} @param definition the {@code Definition} of the child {@code Actor} to be created by this parent {@code Actor} @return T
[ "Answers", "the", "{" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Actor.java#L163-L173
Appendium/flatpack
flatpack/src/main/java/net/sf/flatpack/util/FixedWidthParserUtils.java
FixedWidthParserUtils.getCMDKey
public static String getCMDKey(final MetaData columnMD, final String line) { if (!columnMD.isAnyRecordFormatSpecified()) { // no <RECORD> elements were specified for this parse, just return the // detail id return FPConstants.DETAIL_ID; } final Iterator<Entry<String, XMLRecordElement>> mapEntries = columnMD.xmlRecordIterator(); // loop through the XMLRecordElement objects and see if we need a // different MD object while (mapEntries.hasNext()) { final Entry<String, XMLRecordElement> entry = mapEntries.next(); final XMLRecordElement recordXMLElement = entry.getValue(); if (recordXMLElement.getEndPositition() > line.length()) { // make sure our substring is not going to fail continue; } final int subfrm = recordXMLElement.getStartPosition() - 1; // convert // to 0 // based final int subto = recordXMLElement.getEndPositition(); if (line.substring(subfrm, subto).equals(recordXMLElement.getIndicator())) { // we found the MD object we want to return return entry.getKey(); } } // must be a detail line return FPConstants.DETAIL_ID; }
java
public static String getCMDKey(final MetaData columnMD, final String line) { if (!columnMD.isAnyRecordFormatSpecified()) { // no <RECORD> elements were specified for this parse, just return the // detail id return FPConstants.DETAIL_ID; } final Iterator<Entry<String, XMLRecordElement>> mapEntries = columnMD.xmlRecordIterator(); // loop through the XMLRecordElement objects and see if we need a // different MD object while (mapEntries.hasNext()) { final Entry<String, XMLRecordElement> entry = mapEntries.next(); final XMLRecordElement recordXMLElement = entry.getValue(); if (recordXMLElement.getEndPositition() > line.length()) { // make sure our substring is not going to fail continue; } final int subfrm = recordXMLElement.getStartPosition() - 1; // convert // to 0 // based final int subto = recordXMLElement.getEndPositition(); if (line.substring(subfrm, subto).equals(recordXMLElement.getIndicator())) { // we found the MD object we want to return return entry.getKey(); } } // must be a detail line return FPConstants.DETAIL_ID; }
[ "public", "static", "String", "getCMDKey", "(", "final", "MetaData", "columnMD", ",", "final", "String", "line", ")", "{", "if", "(", "!", "columnMD", ".", "isAnyRecordFormatSpecified", "(", ")", ")", "{", "// no <RECORD> elements were specified for this parse, just r...
Returns the key to the list of ColumnMetaData objects. Returns the correct MetaData per the mapping file and the data contained on the line @param columnMD @param line @return List - ColumMetaData
[ "Returns", "the", "key", "to", "the", "list", "of", "ColumnMetaData", "objects", ".", "Returns", "the", "correct", "MetaData", "per", "the", "mapping", "file", "and", "the", "data", "contained", "on", "the", "line" ]
train
https://github.com/Appendium/flatpack/blob/5e09875d97db7038e3ba6af9468f5313d99b0082/flatpack/src/main/java/net/sf/flatpack/util/FixedWidthParserUtils.java#L97-L127
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.orLessEqual
public ZealotKhala orLessEqual(String field, Object value) { return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.LTE_SUFFIX, true); }
java
public ZealotKhala orLessEqual(String field, Object value) { return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.LTE_SUFFIX, true); }
[ "public", "ZealotKhala", "orLessEqual", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "this", ".", "doNormal", "(", "ZealotConst", ".", "OR_PREFIX", ",", "field", ",", "value", ",", "ZealotConst", ".", "LTE_SUFFIX", ",", "true", ")", ...
生成带" OR "前缀小于等于查询的SQL片段. @param field 数据库字段 @param value 值 @return ZealotKhala实例
[ "生成带", "OR", "前缀小于等于查询的SQL片段", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L879-L881
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/Criteria.java
Criteria.addGreaterOrEqualThanField
public void addGreaterOrEqualThanField(String attribute, Object value) { // PAW // addSelectionCriteria(FieldCriteria.buildNotLessCriteria(attribute, value, getAlias())); addSelectionCriteria(FieldCriteria.buildNotLessCriteria(attribute, value, getUserAlias(attribute))); }
java
public void addGreaterOrEqualThanField(String attribute, Object value) { // PAW // addSelectionCriteria(FieldCriteria.buildNotLessCriteria(attribute, value, getAlias())); addSelectionCriteria(FieldCriteria.buildNotLessCriteria(attribute, value, getUserAlias(attribute))); }
[ "public", "void", "addGreaterOrEqualThanField", "(", "String", "attribute", ",", "Object", "value", ")", "{", "// PAW\r", "// addSelectionCriteria(FieldCriteria.buildNotLessCriteria(attribute, value, getAlias()));\r", "addSelectionCriteria", "(", "FieldCriteria", ".", "buildNotLess...
Adds GreaterOrEqual Than (>=) criteria, customer_id >= person_id @param attribute The field name to be used @param value The field name to compare with
[ "Adds", "GreaterOrEqual", "Than", "(", ">", "=", ")", "criteria", "customer_id", ">", "=", "person_id" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L421-L426
wisdom-framework/wisdom
core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java
CryptoServiceSingleton.decryptAESWithCBC
@Override public String decryptAESWithCBC(String value, String salt) { return decryptAESWithCBC(value, getSecretPrefix(), salt, getDefaultIV()); }
java
@Override public String decryptAESWithCBC(String value, String salt) { return decryptAESWithCBC(value, getSecretPrefix(), salt, getDefaultIV()); }
[ "@", "Override", "public", "String", "decryptAESWithCBC", "(", "String", "value", ",", "String", "salt", ")", "{", "return", "decryptAESWithCBC", "(", "value", ",", "getSecretPrefix", "(", ")", ",", "salt", ",", "getDefaultIV", "(", ")", ")", ";", "}" ]
Decrypt a String with the AES encryption advanced using 'AES/CBC/PKCS5Padding'. Unlike the regular encode/decode AES method using ECB (Electronic Codebook), it uses Cipher-block chaining (CBC). The salt and initialization vector must be valid hex Strings. This method use parts of the application secret as private key and the default initialization vector. @param value An encrypted String encoded using Base64. @param salt The salt (hexadecimal String) @return The decrypted String
[ "Decrypt", "a", "String", "with", "the", "AES", "encryption", "advanced", "using", "AES", "/", "CBC", "/", "PKCS5Padding", ".", "Unlike", "the", "regular", "encode", "/", "decode", "AES", "method", "using", "ECB", "(", "Electronic", "Codebook", ")", "it", ...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L153-L156
mangstadt/biweekly
src/main/java/biweekly/io/chain/ChainingXmlWriter.java
ChainingXmlWriter.outputProperty
public ChainingXmlWriter outputProperty(String name, String value) { outputProperties.put(name, value); return this; }
java
public ChainingXmlWriter outputProperty(String name, String value) { outputProperties.put(name, value); return this; }
[ "public", "ChainingXmlWriter", "outputProperty", "(", "String", "name", ",", "String", "value", ")", "{", "outputProperties", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Assigns an output property to the JAXP transformer (see {@link Transformer#setOutputProperty}). @param name the property name @param value the property value @return this
[ "Assigns", "an", "output", "property", "to", "the", "JAXP", "transformer", "(", "see", "{" ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/chain/ChainingXmlWriter.java#L102-L105
att/AAF
cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java
CadiAccess.buildLine
public final static StringBuilder buildLine(Level level, StringBuilder sb, Object[] elements) { sb.append(level.name()); return buildLine(sb,elements); }
java
public final static StringBuilder buildLine(Level level, StringBuilder sb, Object[] elements) { sb.append(level.name()); return buildLine(sb,elements); }
[ "public", "final", "static", "StringBuilder", "buildLine", "(", "Level", "level", ",", "StringBuilder", "sb", ",", "Object", "[", "]", "elements", ")", "{", "sb", ".", "append", "(", "level", ".", "name", "(", ")", ")", ";", "return", "buildLine", "(", ...
Add the "Level" to the Buildline for Logging types that don't specify, or straight Streams, etc. Then buildline Build a line of code onto a StringBuilder based on Objects. Analyze whether spaces need including. @param level @param sb @param elements @return
[ "Add", "the", "Level", "to", "the", "Buildline", "for", "Logging", "types", "that", "don", "t", "specify", "or", "straight", "Streams", "etc", ".", "Then", "buildline" ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java#L80-L83
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/RDBMEntityLockStore.java
RDBMEntityLockStore.primUpdate
private void primUpdate(IEntityLock lock, Date newExpiration, Integer newType, Connection conn) throws SQLException, LockingException { Integer typeID = EntityTypesLocator.getEntityTypes().getEntityIDFromType(lock.getEntityType()); String key = lock.getEntityKey(); int oldLockType = lock.getLockType(); int newLockType = (newType == null) ? oldLockType : newType.intValue(); java.sql.Timestamp oldTs = new java.sql.Timestamp(lock.getExpirationTime().getTime()); java.sql.Timestamp newTs = new java.sql.Timestamp(newExpiration.getTime()); String owner = lock.getLockOwner(); try { PreparedStatement ps = conn.prepareStatement(getUpdateSql()); try { ps.setTimestamp(1, newTs); // new expiration ps.setInt(2, newLockType); // new lock type ps.setInt(3, typeID.intValue()); // entity type ps.setString(4, key); // entity key ps.setString(5, owner); // lock owner ps.setTimestamp(6, oldTs); // old expiration ps.setInt(7, oldLockType); // old lock type; if (log.isDebugEnabled()) log.debug("RDBMEntityLockStore.primUpdate(): " + ps); int rc = ps.executeUpdate(); if (rc != 1) { String errString = "Problem updating " + lock; log.error(errString); throw new LockingException(errString); } } finally { if (ps != null) ps.close(); } } catch (java.sql.SQLException sqle) { log.error(sqle, sqle); throw sqle; } }
java
private void primUpdate(IEntityLock lock, Date newExpiration, Integer newType, Connection conn) throws SQLException, LockingException { Integer typeID = EntityTypesLocator.getEntityTypes().getEntityIDFromType(lock.getEntityType()); String key = lock.getEntityKey(); int oldLockType = lock.getLockType(); int newLockType = (newType == null) ? oldLockType : newType.intValue(); java.sql.Timestamp oldTs = new java.sql.Timestamp(lock.getExpirationTime().getTime()); java.sql.Timestamp newTs = new java.sql.Timestamp(newExpiration.getTime()); String owner = lock.getLockOwner(); try { PreparedStatement ps = conn.prepareStatement(getUpdateSql()); try { ps.setTimestamp(1, newTs); // new expiration ps.setInt(2, newLockType); // new lock type ps.setInt(3, typeID.intValue()); // entity type ps.setString(4, key); // entity key ps.setString(5, owner); // lock owner ps.setTimestamp(6, oldTs); // old expiration ps.setInt(7, oldLockType); // old lock type; if (log.isDebugEnabled()) log.debug("RDBMEntityLockStore.primUpdate(): " + ps); int rc = ps.executeUpdate(); if (rc != 1) { String errString = "Problem updating " + lock; log.error(errString); throw new LockingException(errString); } } finally { if (ps != null) ps.close(); } } catch (java.sql.SQLException sqle) { log.error(sqle, sqle); throw sqle; } }
[ "private", "void", "primUpdate", "(", "IEntityLock", "lock", ",", "Date", "newExpiration", ",", "Integer", "newType", ",", "Connection", "conn", ")", "throws", "SQLException", ",", "LockingException", "{", "Integer", "typeID", "=", "EntityTypesLocator", ".", "getE...
Updates the lock's <code>expiration</code> and <code>lockType</code> in the underlying store. The SQL is over-qualified to make sure the row has not been updated since the lock was last checked. @param lock @param newExpiration java.util.Date @param newType Integer @param conn Connection
[ "Updates", "the", "lock", "s", "<code", ">", "expiration<", "/", "code", ">", "and", "<code", ">", "lockType<", "/", "code", ">", "in", "the", "underlying", "store", ".", "The", "SQL", "is", "over", "-", "qualified", "to", "make", "sure", "the", "row",...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/RDBMEntityLockStore.java#L513-L550
tvesalainen/util
util/src/main/java/org/vesalainen/util/CharSequences.java
CharSequences.indexOf
public static int indexOf(CharSequence seq, CharSequence pattern, int fromIndex) { return indexOf(seq, pattern, (int a, int b)->{return a==b;}, fromIndex); }
java
public static int indexOf(CharSequence seq, CharSequence pattern, int fromIndex) { return indexOf(seq, pattern, (int a, int b)->{return a==b;}, fromIndex); }
[ "public", "static", "int", "indexOf", "(", "CharSequence", "seq", ",", "CharSequence", "pattern", ",", "int", "fromIndex", ")", "{", "return", "indexOf", "(", "seq", ",", "pattern", ",", "(", "int", "a", ",", "int", "b", ")", "->", "{", "return", "a", ...
Returns index of pattern, starting at fromIndex, or -1 if pattern not found @param seq @param pattern @param fromIndex @return @see java.lang.String#indexOf(java.lang.String, int)
[ "Returns", "index", "of", "pattern", "starting", "at", "fromIndex", "or", "-", "1", "if", "pattern", "not", "found" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L221-L224
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java
BitsUtil.cycleLeftC
public static long cycleLeftC(long v, int shift, int len) { return shift == 0 ? v : shift < 0 ? cycleRightC(v, -shift, len) : // (((v) << (shift)) | ((v) >>> ((len) - (shift)))) & ((1 << len) - 1); }
java
public static long cycleLeftC(long v, int shift, int len) { return shift == 0 ? v : shift < 0 ? cycleRightC(v, -shift, len) : // (((v) << (shift)) | ((v) >>> ((len) - (shift)))) & ((1 << len) - 1); }
[ "public", "static", "long", "cycleLeftC", "(", "long", "v", ",", "int", "shift", ",", "int", "len", ")", "{", "return", "shift", "==", "0", "?", "v", ":", "shift", "<", "0", "?", "cycleRightC", "(", "v", ",", "-", "shift", ",", "len", ")", ":", ...
Rotate a long to the left, cyclic with length len @param v Bits @param shift Shift value @param len Length @return cycled bit set
[ "Rotate", "a", "long", "to", "the", "left", "cyclic", "with", "length", "len" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java#L839-L842
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/scanner/ScanUploader.java
ScanUploader.createNewScanFromExistingScan
private ScanStatus createNewScanFromExistingScan(String scanId, ScanOptions scanOptions, ScanStatus existingScanStatus) { List<ScanRangeStatus> pendingScanRangeStatuses = Lists.newArrayList(); Multimap<String, ScanRangeStatus> scanRangeStatusesByPlacement = HashMultimap.create(); for (ScanRangeStatus scanRangeStatus : existingScanStatus.getAllScanRanges()) { scanRangeStatusesByPlacement.put(scanRangeStatus.getPlacement(), new ScanRangeStatus( scanRangeStatus.getTaskId(), scanRangeStatus.getPlacement(), scanRangeStatus.getScanRange(), scanRangeStatus.getBatchId(), scanRangeStatus.getBlockedByBatchId(), scanRangeStatus.getConcurrencyId())); } for (String placement : scanOptions.getPlacements()) { Collection<ScanRangeStatus> scanRangeStatusesForPlacement = scanRangeStatusesByPlacement.get(placement); if (scanRangeStatusesForPlacement.isEmpty()) { throw new IllegalStateException(String.format("Previous scan \"%s\" had no plan for placement \"%s\"", scanId, placement)); } pendingScanRangeStatuses.addAll(scanRangeStatusesForPlacement); } return new ScanStatus(scanId, scanOptions, false, false, new Date(), pendingScanRangeStatuses, ImmutableList.of(), ImmutableList.of()); }
java
private ScanStatus createNewScanFromExistingScan(String scanId, ScanOptions scanOptions, ScanStatus existingScanStatus) { List<ScanRangeStatus> pendingScanRangeStatuses = Lists.newArrayList(); Multimap<String, ScanRangeStatus> scanRangeStatusesByPlacement = HashMultimap.create(); for (ScanRangeStatus scanRangeStatus : existingScanStatus.getAllScanRanges()) { scanRangeStatusesByPlacement.put(scanRangeStatus.getPlacement(), new ScanRangeStatus( scanRangeStatus.getTaskId(), scanRangeStatus.getPlacement(), scanRangeStatus.getScanRange(), scanRangeStatus.getBatchId(), scanRangeStatus.getBlockedByBatchId(), scanRangeStatus.getConcurrencyId())); } for (String placement : scanOptions.getPlacements()) { Collection<ScanRangeStatus> scanRangeStatusesForPlacement = scanRangeStatusesByPlacement.get(placement); if (scanRangeStatusesForPlacement.isEmpty()) { throw new IllegalStateException(String.format("Previous scan \"%s\" had no plan for placement \"%s\"", scanId, placement)); } pendingScanRangeStatuses.addAll(scanRangeStatusesForPlacement); } return new ScanStatus(scanId, scanOptions, false, false, new Date(), pendingScanRangeStatuses, ImmutableList.of(), ImmutableList.of()); }
[ "private", "ScanStatus", "createNewScanFromExistingScan", "(", "String", "scanId", ",", "ScanOptions", "scanOptions", ",", "ScanStatus", "existingScanStatus", ")", "{", "List", "<", "ScanRangeStatus", ">", "pendingScanRangeStatuses", "=", "Lists", ".", "newArrayList", "...
Takes an existing ScanStatus and creates a new plan from it. This method validates that a plan existed for each placement in the existing ScanStatus but otherwise recreates the plan exactly as it ran. This means that any ScanOptions related to generating the plan, such as {@link ScanOptions#getRangeScanSplitSize()} and {@link ScanOptions#isScanByAZ()}, will have no effect.
[ "Takes", "an", "existing", "ScanStatus", "and", "creates", "a", "new", "plan", "from", "it", ".", "This", "method", "validates", "that", "a", "plan", "existed", "for", "each", "placement", "in", "the", "existing", "ScanStatus", "but", "otherwise", "recreates",...
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/scanner/ScanUploader.java#L167-L190
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.emptyConstructorAbsent
public static void emptyConstructorAbsent(Class<?> aClass){ throw new MalformedBeanException(MSG.INSTANCE.message(malformedBeanException1,aClass.getSimpleName())); }
java
public static void emptyConstructorAbsent(Class<?> aClass){ throw new MalformedBeanException(MSG.INSTANCE.message(malformedBeanException1,aClass.getSimpleName())); }
[ "public", "static", "void", "emptyConstructorAbsent", "(", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "MalformedBeanException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "malformedBeanException1", ",", "aClass", ".", "getSimpleName", "("...
Thrown if the class haven't an empty constructor. @param aClass class to analyze
[ "Thrown", "if", "the", "class", "haven", "t", "an", "empty", "constructor", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L632-L634
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/OracleHelper.java
OracleHelper.psSetBytes
@Override public void psSetBytes(PreparedStatement pstmtImpl, int i, byte[] x) throws SQLException { int length = (x == null ? 0 : x.length); if (tc.isDebugEnabled()) Tr.debug(this, tc, "psSetBytes: " + length); if ((x != null) && (length > 2000)) { if (tc.isDebugEnabled()) Tr.debug(this, tc, "ORACLE setBytes byte array length > 2000 workaround."); pstmtImpl.setBinaryStream(i, new ByteArrayInputStream(x), length); } else pstmtImpl.setBytes(i, x); }
java
@Override public void psSetBytes(PreparedStatement pstmtImpl, int i, byte[] x) throws SQLException { int length = (x == null ? 0 : x.length); if (tc.isDebugEnabled()) Tr.debug(this, tc, "psSetBytes: " + length); if ((x != null) && (length > 2000)) { if (tc.isDebugEnabled()) Tr.debug(this, tc, "ORACLE setBytes byte array length > 2000 workaround."); pstmtImpl.setBinaryStream(i, new ByteArrayInputStream(x), length); } else pstmtImpl.setBytes(i, x); }
[ "@", "Override", "public", "void", "psSetBytes", "(", "PreparedStatement", "pstmtImpl", ",", "int", "i", ",", "byte", "[", "]", "x", ")", "throws", "SQLException", "{", "int", "length", "=", "(", "x", "==", "null", "?", "0", ":", "x", ".", "length", ...
- allow for special handling of Oracle prepared statement setBytes If byte[] > 2000 bytes, use setBinaryStream
[ "-", "allow", "for", "special", "handling", "of", "Oracle", "prepared", "statement", "setBytes", "If", "byte", "[]", ">", "2000", "bytes", "use", "setBinaryStream" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/OracleHelper.java#L724-L736
codeprimate-software/cp-elements
src/main/java/org/cp/elements/net/NetworkUtils.java
NetworkUtils.availablePort
public static int availablePort() { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(0); return serverSocket.getLocalPort(); } catch (IOException cause) { throw new NoAvailablePortException("No port available", cause); } finally { close(serverSocket); } }
java
public static int availablePort() { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(0); return serverSocket.getLocalPort(); } catch (IOException cause) { throw new NoAvailablePortException("No port available", cause); } finally { close(serverSocket); } }
[ "public", "static", "int", "availablePort", "(", ")", "{", "ServerSocket", "serverSocket", "=", "null", ";", "try", "{", "serverSocket", "=", "new", "ServerSocket", "(", "0", ")", ";", "return", "serverSocket", ".", "getLocalPort", "(", ")", ";", "}", "cat...
Gets an available network port used by a network service on which to listen for client {@link Socket} connections. @return in integer value indicating an available network port.
[ "Gets", "an", "available", "network", "port", "used", "by", "a", "network", "service", "on", "which", "to", "listen", "for", "client", "{", "@link", "Socket", "}", "connections", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/net/NetworkUtils.java#L49-L62
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONAssert.java
JSONAssert.assertEquals
public static void assertEquals(String expectedStr, String actualStr, JSONCompareMode compareMode) throws JSONException { assertEquals("", expectedStr, actualStr, compareMode); }
java
public static void assertEquals(String expectedStr, String actualStr, JSONCompareMode compareMode) throws JSONException { assertEquals("", expectedStr, actualStr, compareMode); }
[ "public", "static", "void", "assertEquals", "(", "String", "expectedStr", ",", "String", "actualStr", ",", "JSONCompareMode", "compareMode", ")", "throws", "JSONException", "{", "assertEquals", "(", "\"\"", ",", "expectedStr", ",", "actualStr", ",", "compareMode", ...
Asserts that the JSONArray provided matches the expected string. If it isn't it throws an {@link AssertionError}. @param expectedStr Expected JSON string @param actualStr String to compare @param compareMode Specifies which comparison mode to use @throws JSONException JSON parsing error
[ "Asserts", "that", "the", "JSONArray", "provided", "matches", "the", "expected", "string", ".", "If", "it", "isn", "t", "it", "throws", "an", "{", "@link", "AssertionError", "}", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L392-L395
wkgcass/Style
src/main/java/net/cassite/style/IfBlock.java
IfBlock.ElseIf
@SuppressWarnings("unchecked") public IfBlock<T, INIT> ElseIf(RFunc0<INIT> init, VFunc1<INIT> body) { return ElseIf(init, (def<T>) $(body)); }
java
@SuppressWarnings("unchecked") public IfBlock<T, INIT> ElseIf(RFunc0<INIT> init, VFunc1<INIT> body) { return ElseIf(init, (def<T>) $(body)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "IfBlock", "<", "T", ",", "INIT", ">", "ElseIf", "(", "RFunc0", "<", "INIT", ">", "init", ",", "VFunc1", "<", "INIT", ">", "body", ")", "{", "return", "ElseIf", "(", "init", ",", "(", "def...
define an ElseIf block.<br> @param init lambda expression returns an object or boolean value, init==null || init.equals(false) will be considered <b>false</b> in traditional if expression. in other cases, considered true @param body takes in INIT value, and return null if init is considered true @return if body
[ "define", "an", "ElseIf", "block", ".", "<br", ">" ]
train
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/IfBlock.java#L192-L195
passwordmaker/java-passwordmaker-lib
src/main/java/org/daveware/passwordmaker/Database.java
Database.findNearestRelative
public Account findNearestRelative(Account account) { // If it's root, there are no siblings if (account.isRoot()) return null; // If it has no parent, it's not in this tree Account parent = findParent(account); if (parent == null) return null; // It's an only child, return the parent if (parent.getChildren().size() == 1) return parent; // If it doesn't have an index, it's also not in this tree (should not be possible, assume parent) int index = parent.getChildren().indexOf(account); if (index == -1) return parent; // If it's the last node, use the previous node if (index == parent.getChildren().size() - 1) return parent.getChildren().get(index - 1); // Otherwise use the next node return parent.getChildren().get(index + 1); }
java
public Account findNearestRelative(Account account) { // If it's root, there are no siblings if (account.isRoot()) return null; // If it has no parent, it's not in this tree Account parent = findParent(account); if (parent == null) return null; // It's an only child, return the parent if (parent.getChildren().size() == 1) return parent; // If it doesn't have an index, it's also not in this tree (should not be possible, assume parent) int index = parent.getChildren().indexOf(account); if (index == -1) return parent; // If it's the last node, use the previous node if (index == parent.getChildren().size() - 1) return parent.getChildren().get(index - 1); // Otherwise use the next node return parent.getChildren().get(index + 1); }
[ "public", "Account", "findNearestRelative", "(", "Account", "account", ")", "{", "// If it's root, there are no siblings", "if", "(", "account", ".", "isRoot", "(", ")", ")", "return", "null", ";", "// If it has no parent, it's not in this tree", "Account", "parent", "=...
Finds the nearest relative of this node. <p> The nearest relative is either the next sibling, previous sibling, or parent in the case where it is an only child. If it is not found to be a member of this tree, null is returned. If you pass in the root node, null is returned. @param account The account to find the nearest relative of. @return See description.
[ "Finds", "the", "nearest", "relative", "of", "this", "node", ".", "<p", ">", "The", "nearest", "relative", "is", "either", "the", "next", "sibling", "previous", "sibling", "or", "parent", "in", "the", "case", "where", "it", "is", "an", "only", "child", "...
train
https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/Database.java#L471-L496
overturetool/overture
core/pog/src/main/java/org/overture/pog/visitors/PogParamDefinitionVisitor.java
PogParamDefinitionVisitor.collectOpCtxt
protected void collectOpCtxt(AExplicitOperationDefinition node, IPOContextStack question, Boolean precond) throws AnalysisException { question.push(new POOperationDefinitionContext(node, precond, node.getState())); }
java
protected void collectOpCtxt(AExplicitOperationDefinition node, IPOContextStack question, Boolean precond) throws AnalysisException { question.push(new POOperationDefinitionContext(node, precond, node.getState())); }
[ "protected", "void", "collectOpCtxt", "(", "AExplicitOperationDefinition", "node", ",", "IPOContextStack", "question", ",", "Boolean", "precond", ")", "throws", "AnalysisException", "{", "question", ".", "push", "(", "new", "POOperationDefinitionContext", "(", "node", ...
Operation processing is identical in extension except for context generation. So, a quick trick here. @param node @param question @param precond @throws AnalysisException
[ "Operation", "processing", "is", "identical", "in", "extension", "except", "for", "context", "generation", ".", "So", "a", "quick", "trick", "here", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/pog/src/main/java/org/overture/pog/visitors/PogParamDefinitionVisitor.java#L562-L566
geomajas/geomajas-project-server
common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java
CacheFilter.shouldCache
public boolean shouldCache(String requestUri) { String uri = requestUri.toLowerCase(); return checkContains(uri, cacheIdentifiers) || checkSuffixes(uri, cacheSuffixes); }
java
public boolean shouldCache(String requestUri) { String uri = requestUri.toLowerCase(); return checkContains(uri, cacheIdentifiers) || checkSuffixes(uri, cacheSuffixes); }
[ "public", "boolean", "shouldCache", "(", "String", "requestUri", ")", "{", "String", "uri", "=", "requestUri", ".", "toLowerCase", "(", ")", ";", "return", "checkContains", "(", "uri", ",", "cacheIdentifiers", ")", "||", "checkSuffixes", "(", "uri", ",", "ca...
Should the URI be cached? @param requestUri request URI @return true when caching is needed
[ "Should", "the", "URI", "be", "cached?" ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java#L211-L214
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java
CmsPreviewUtil.setLink
public static void setLink(String path, String title, String target) { nativeSetLink(path, CmsStringUtil.escapeHtml(title), target); }
java
public static void setLink(String path, String title, String target) { nativeSetLink(path, CmsStringUtil.escapeHtml(title), target); }
[ "public", "static", "void", "setLink", "(", "String", "path", ",", "String", "title", ",", "String", "target", ")", "{", "nativeSetLink", "(", "path", ",", "CmsStringUtil", ".", "escapeHtml", "(", "title", ")", ",", "target", ")", ";", "}" ]
Sets the resource link within the rich text editor (FCKEditor, CKEditor, ...).<p> @param path the link path @param title the link title @param target the link target attribute
[ "Sets", "the", "resource", "link", "within", "the", "rich", "text", "editor", "(", "FCKEditor", "CKEditor", "...", ")", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java#L255-L258
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java
DrawerUtils.getDrawerItem
public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, long identifier) { if (identifier != -1) { for (IDrawerItem drawerItem : drawerItems) { if (drawerItem.getIdentifier() == identifier) { return drawerItem; } } } return null; }
java
public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, long identifier) { if (identifier != -1) { for (IDrawerItem drawerItem : drawerItems) { if (drawerItem.getIdentifier() == identifier) { return drawerItem; } } } return null; }
[ "public", "static", "IDrawerItem", "getDrawerItem", "(", "List", "<", "IDrawerItem", ">", "drawerItems", ",", "long", "identifier", ")", "{", "if", "(", "identifier", "!=", "-", "1", ")", "{", "for", "(", "IDrawerItem", "drawerItem", ":", "drawerItems", ")",...
gets the drawerItem with the specific identifier from a drawerItem list @param drawerItems @param identifier @return
[ "gets", "the", "drawerItem", "with", "the", "specific", "identifier", "from", "a", "drawerItem", "list" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java#L125-L134
bmwcarit/joynr
java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java
Utilities.getSessionEncodedUrl
public static String getSessionEncodedUrl(String url, String sessionIdName, String sessionId) { return url + getSessionIdSubstring(sessionIdName) + sessionId; }
java
public static String getSessionEncodedUrl(String url, String sessionIdName, String sessionId) { return url + getSessionIdSubstring(sessionIdName) + sessionId; }
[ "public", "static", "String", "getSessionEncodedUrl", "(", "String", "url", ",", "String", "sessionIdName", ",", "String", "sessionId", ")", "{", "return", "url", "+", "getSessionIdSubstring", "(", "sessionIdName", ")", "+", "sessionId", ";", "}" ]
Returns a url with the session encoded into the URL @param url the URL to encode @param sessionIdName the name of the session ID, e.g. jsessionid @param sessionId the session ID @return URL with the session encoded into the URL
[ "Returns", "a", "url", "with", "the", "session", "encoded", "into", "the", "URL" ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java#L181-L183
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java
JavaScriptUtils.getUnencodedJavaScriptHtmlCookieString
public String getUnencodedJavaScriptHtmlCookieString(String name, String value, Map<String, String> cookieProperties) { return createJavaScriptHtmlCookieString(name, value, cookieProperties, false); }
java
public String getUnencodedJavaScriptHtmlCookieString(String name, String value, Map<String, String> cookieProperties) { return createJavaScriptHtmlCookieString(name, value, cookieProperties, false); }
[ "public", "String", "getUnencodedJavaScriptHtmlCookieString", "(", "String", "name", ",", "String", "value", ",", "Map", "<", "String", ",", "String", ">", "cookieProperties", ")", "{", "return", "createJavaScriptHtmlCookieString", "(", "name", ",", "value", ",", ...
Creates and returns a JavaScript line that sets a cookie with the specified name, value, and cookie properties. For example, a cookie name of "test", value of "123", and properties "HttpOnly" and "path=/" would return {@code document.cookie="test=123; HttpOnly; path=/;";}. Note: The specified properties will be HTML-encoded but the cookie name and value will not.
[ "Creates", "and", "returns", "a", "JavaScript", "line", "that", "sets", "a", "cookie", "with", "the", "specified", "name", "value", "and", "cookie", "properties", ".", "For", "example", "a", "cookie", "name", "of", "test", "value", "of", "123", "and", "pro...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L67-L69
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.countByC_S
@Override public int countByC_S(long CPDefinitionId, String sku) { FinderPath finderPath = FINDER_PATH_COUNT_BY_C_S; Object[] finderArgs = new Object[] { CPDefinitionId, sku }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPINSTANCE_WHERE); query.append(_FINDER_COLUMN_C_S_CPDEFINITIONID_2); boolean bindSku = false; if (sku == null) { query.append(_FINDER_COLUMN_C_S_SKU_1); } else if (sku.equals("")) { query.append(_FINDER_COLUMN_C_S_SKU_3); } else { bindSku = true; query.append(_FINDER_COLUMN_C_S_SKU_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(CPDefinitionId); if (bindSku) { qPos.add(sku); } 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 countByC_S(long CPDefinitionId, String sku) { FinderPath finderPath = FINDER_PATH_COUNT_BY_C_S; Object[] finderArgs = new Object[] { CPDefinitionId, sku }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPINSTANCE_WHERE); query.append(_FINDER_COLUMN_C_S_CPDEFINITIONID_2); boolean bindSku = false; if (sku == null) { query.append(_FINDER_COLUMN_C_S_SKU_1); } else if (sku.equals("")) { query.append(_FINDER_COLUMN_C_S_SKU_3); } else { bindSku = true; query.append(_FINDER_COLUMN_C_S_SKU_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(CPDefinitionId); if (bindSku) { qPos.add(sku); } 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", "countByC_S", "(", "long", "CPDefinitionId", ",", "String", "sku", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_C_S", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "CPDefinitio...
Returns the number of cp instances where CPDefinitionId = &#63; and sku = &#63;. @param CPDefinitionId the cp definition ID @param sku the sku @return the number of matching cp instances
[ "Returns", "the", "number", "of", "cp", "instances", "where", "CPDefinitionId", "=", "&#63", ";", "and", "sku", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L4495-L4556
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerActivity.java
FilePickerActivity.setHeaderBackground
private void setHeaderBackground(int colorResId, int drawableResId) { if (drawableResId == -1) { try { header.setBackgroundColor(getResources().getColor(colorResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } else { try { header.setBackgroundDrawable(getResources().getDrawable(drawableResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } }
java
private void setHeaderBackground(int colorResId, int drawableResId) { if (drawableResId == -1) { try { header.setBackgroundColor(getResources().getColor(colorResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } else { try { header.setBackgroundDrawable(getResources().getDrawable(drawableResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } }
[ "private", "void", "setHeaderBackground", "(", "int", "colorResId", ",", "int", "drawableResId", ")", "{", "if", "(", "drawableResId", "==", "-", "1", ")", "{", "try", "{", "header", ".", "setBackgroundColor", "(", "getResources", "(", ")", ".", "getColor", ...
Set the background color of the header @param colorResId Resource Id of the color @param drawableResId Resource Id of the drawable
[ "Set", "the", "background", "color", "of", "the", "header" ]
train
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerActivity.java#L529-L544
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/FileIoUtil.java
FileIoUtil.readPropertiesFromFile
public static Properties readPropertiesFromFile(String _fileName, Properties _props) { Properties props = _props == null ? new Properties() : _props; LOGGER.debug("Trying to read properties from file: " + _fileName); Properties newProperties = readProperties(new File(_fileName)); if (newProperties != null) { LOGGER.debug("Successfully read properties from file: " + _fileName); props.putAll(newProperties); } return props; }
java
public static Properties readPropertiesFromFile(String _fileName, Properties _props) { Properties props = _props == null ? new Properties() : _props; LOGGER.debug("Trying to read properties from file: " + _fileName); Properties newProperties = readProperties(new File(_fileName)); if (newProperties != null) { LOGGER.debug("Successfully read properties from file: " + _fileName); props.putAll(newProperties); } return props; }
[ "public", "static", "Properties", "readPropertiesFromFile", "(", "String", "_fileName", ",", "Properties", "_props", ")", "{", "Properties", "props", "=", "_props", "==", "null", "?", "new", "Properties", "(", ")", ":", "_props", ";", "LOGGER", ".", "debug", ...
Read properties from given filename (returns empty {@link Properties} object on failure). @param _fileName The properties file to read @param _props optional properties object, if null a new object created in the method @return {@link Properties} object
[ "Read", "properties", "from", "given", "filename", "(", "returns", "empty", "{", "@link", "Properties", "}", "object", "on", "failure", ")", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/FileIoUtil.java#L78-L89
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java
Identifiers.createIp4
public static IpAddress createIp4(String value, String admDom) { return createIp(IpAddressType.IPv4, value, admDom); }
java
public static IpAddress createIp4(String value, String admDom) { return createIp(IpAddressType.IPv4, value, admDom); }
[ "public", "static", "IpAddress", "createIp4", "(", "String", "value", ",", "String", "admDom", ")", "{", "return", "createIp", "(", "IpAddressType", ".", "IPv4", ",", "value", ",", "admDom", ")", ";", "}" ]
Create an ip-address identifier for IPv4 with the given value and the given administrative-domain. @param value a {@link String} that represents a valid IPv4 address @param admDom the administrative-domain @return the new ip-address identifier
[ "Create", "an", "ip", "-", "address", "identifier", "for", "IPv4", "with", "the", "given", "value", "and", "the", "given", "administrative", "-", "domain", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java#L616-L618
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/MjdbcLogger.java
MjdbcLogger.getLogger
public static MjdbcLogger getLogger(String name) { MjdbcLogger mjdbcLogger = new MjdbcLogger(name, null); if (isSLF4jAvailable() == true) { try { mjdbcLogger = new MjdbcLogger(name, null); mjdbcLogger.setSlfLogger(MappingUtils.invokeStaticFunction(Class.forName("org.slf4j.LoggerFactory"), "getLogger", new Class[]{String.class}, new Object[]{name})); } catch (MjdbcException e) { setSLF4jAvailable(false); } catch (ClassNotFoundException e) { setSLF4jAvailable(false); } } return mjdbcLogger; }
java
public static MjdbcLogger getLogger(String name) { MjdbcLogger mjdbcLogger = new MjdbcLogger(name, null); if (isSLF4jAvailable() == true) { try { mjdbcLogger = new MjdbcLogger(name, null); mjdbcLogger.setSlfLogger(MappingUtils.invokeStaticFunction(Class.forName("org.slf4j.LoggerFactory"), "getLogger", new Class[]{String.class}, new Object[]{name})); } catch (MjdbcException e) { setSLF4jAvailable(false); } catch (ClassNotFoundException e) { setSLF4jAvailable(false); } } return mjdbcLogger; }
[ "public", "static", "MjdbcLogger", "getLogger", "(", "String", "name", ")", "{", "MjdbcLogger", "mjdbcLogger", "=", "new", "MjdbcLogger", "(", "name", ",", "null", ")", ";", "if", "(", "isSLF4jAvailable", "(", ")", "==", "true", ")", "{", "try", "{", "mj...
Creates new MjdbcLogger instance @param name class name @return MjdbcLogger instance
[ "Creates", "new", "MjdbcLogger", "instance" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/MjdbcLogger.java#L64-L79
cdapio/tephra
tephra-core/src/main/java/co/cask/tephra/util/TxUtils.java
TxUtils.getOldestVisibleTimestamp
public static long getOldestVisibleTimestamp(Map<byte[], Long> ttlByFamily, Transaction tx, boolean readNonTxnData) { if (readNonTxnData) { long maxTTL = getMaxTTL(ttlByFamily); return maxTTL < Long.MAX_VALUE ? System.currentTimeMillis() - maxTTL : 0; } return getOldestVisibleTimestamp(ttlByFamily, tx); }
java
public static long getOldestVisibleTimestamp(Map<byte[], Long> ttlByFamily, Transaction tx, boolean readNonTxnData) { if (readNonTxnData) { long maxTTL = getMaxTTL(ttlByFamily); return maxTTL < Long.MAX_VALUE ? System.currentTimeMillis() - maxTTL : 0; } return getOldestVisibleTimestamp(ttlByFamily, tx); }
[ "public", "static", "long", "getOldestVisibleTimestamp", "(", "Map", "<", "byte", "[", "]", ",", "Long", ">", "ttlByFamily", ",", "Transaction", "tx", ",", "boolean", "readNonTxnData", ")", "{", "if", "(", "readNonTxnData", ")", "{", "long", "maxTTL", "=", ...
Returns the oldest visible timestamp for the given transaction, based on the TTLs configured for each column family. If no TTL is set on any column family, the oldest visible timestamp will be {@code 0}. @param ttlByFamily A map of column family name to TTL value (in milliseconds) @param tx The current transaction @param readNonTxnData indicates that the timestamp returned should allow reading non-transactional data @return The oldest timestamp that will be visible for the given transaction and TTL configuration
[ "Returns", "the", "oldest", "visible", "timestamp", "for", "the", "given", "transaction", "based", "on", "the", "TTLs", "configured", "for", "each", "column", "family", ".", "If", "no", "TTL", "is", "set", "on", "any", "column", "family", "the", "oldest", ...
train
https://github.com/cdapio/tephra/blob/082c56c15c6ece15002631ff6f89206a00d8915c/tephra-core/src/main/java/co/cask/tephra/util/TxUtils.java#L75-L82
jasminb/jsonapi-converter
src/main/java/com/github/jasminb/jsonapi/ValidationUtils.java
ValidationUtils.ensureNotError
public static void ensureNotError(ObjectMapper mapper, JsonNode resourceNode) { if (resourceNode != null && resourceNode.hasNonNull(JSONAPISpecConstants.ERRORS)) { try { throw new ResourceParseException(ErrorUtils.parseError(mapper, resourceNode, Errors.class)); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }
java
public static void ensureNotError(ObjectMapper mapper, JsonNode resourceNode) { if (resourceNode != null && resourceNode.hasNonNull(JSONAPISpecConstants.ERRORS)) { try { throw new ResourceParseException(ErrorUtils.parseError(mapper, resourceNode, Errors.class)); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }
[ "public", "static", "void", "ensureNotError", "(", "ObjectMapper", "mapper", ",", "JsonNode", "resourceNode", ")", "{", "if", "(", "resourceNode", "!=", "null", "&&", "resourceNode", ".", "hasNonNull", "(", "JSONAPISpecConstants", ".", "ERRORS", ")", ")", "{", ...
Ensures that provided node does not hold 'errors' attribute. @param resourceNode resource node @throws ResourceParseException
[ "Ensures", "that", "provided", "node", "does", "not", "hold", "errors", "attribute", "." ]
train
https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/ValidationUtils.java#L46-L54
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.createEvaluateActionForExistingActionState
public Action createEvaluateActionForExistingActionState(final Flow flow, final String actionStateId, final String evaluateActionId) { val action = getState(flow, actionStateId, ActionState.class); val actions = action.getActionList().toArray(); Arrays.stream(actions).forEach(action.getActionList()::remove); val evaluateAction = createEvaluateAction(evaluateActionId); action.getActionList().add(evaluateAction); action.getActionList().addAll(actions); return evaluateAction; }
java
public Action createEvaluateActionForExistingActionState(final Flow flow, final String actionStateId, final String evaluateActionId) { val action = getState(flow, actionStateId, ActionState.class); val actions = action.getActionList().toArray(); Arrays.stream(actions).forEach(action.getActionList()::remove); val evaluateAction = createEvaluateAction(evaluateActionId); action.getActionList().add(evaluateAction); action.getActionList().addAll(actions); return evaluateAction; }
[ "public", "Action", "createEvaluateActionForExistingActionState", "(", "final", "Flow", "flow", ",", "final", "String", "actionStateId", ",", "final", "String", "evaluateActionId", ")", "{", "val", "action", "=", "getState", "(", "flow", ",", "actionStateId", ",", ...
Create evaluate action for action state action. @param flow the flow @param actionStateId the action state id @param evaluateActionId the evaluate action id @return the action
[ "Create", "evaluate", "action", "for", "action", "state", "action", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L694-L702
stripe/stripe-java
src/main/java/com/stripe/model/CreditNote.java
CreditNote.voidCreditNote
public CreditNote voidCreditNote() throws StripeException { return voidCreditNote((Map<String, Object>) null, (RequestOptions) null); }
java
public CreditNote voidCreditNote() throws StripeException { return voidCreditNote((Map<String, Object>) null, (RequestOptions) null); }
[ "public", "CreditNote", "voidCreditNote", "(", ")", "throws", "StripeException", "{", "return", "voidCreditNote", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", "null", ",", "(", "RequestOptions", ")", "null", ")", ";", "}" ]
Marks a credit note as void. Learn more about <a href="/docs/billing/invoices/credit-notes#voiding">voiding credit notes</a>.
[ "Marks", "a", "credit", "note", "as", "void", ".", "Learn", "more", "about", "<a", "href", "=", "/", "docs", "/", "billing", "/", "invoices", "/", "credit", "-", "notes#voiding", ">", "voiding", "credit", "notes<", "/", "a", ">", "." ]
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/CreditNote.java#L368-L370
graknlabs/grakn
server/src/graql/executor/ConceptBuilder.java
ConceptBuilder.setSuper
public static void setSuper(SchemaConcept subConcept, SchemaConcept superConcept) { if (superConcept.isEntityType()) { subConcept.asEntityType().sup(superConcept.asEntityType()); } else if (superConcept.isRelationType()) { subConcept.asRelationType().sup(superConcept.asRelationType()); } else if (superConcept.isRole()) { subConcept.asRole().sup(superConcept.asRole()); } else if (superConcept.isAttributeType()) { subConcept.asAttributeType().sup(superConcept.asAttributeType()); } else if (superConcept.isRule()) { subConcept.asRule().sup(superConcept.asRule()); } else { throw InvalidKBException.insertMetaType(subConcept.label(), superConcept); } }
java
public static void setSuper(SchemaConcept subConcept, SchemaConcept superConcept) { if (superConcept.isEntityType()) { subConcept.asEntityType().sup(superConcept.asEntityType()); } else if (superConcept.isRelationType()) { subConcept.asRelationType().sup(superConcept.asRelationType()); } else if (superConcept.isRole()) { subConcept.asRole().sup(superConcept.asRole()); } else if (superConcept.isAttributeType()) { subConcept.asAttributeType().sup(superConcept.asAttributeType()); } else if (superConcept.isRule()) { subConcept.asRule().sup(superConcept.asRule()); } else { throw InvalidKBException.insertMetaType(subConcept.label(), superConcept); } }
[ "public", "static", "void", "setSuper", "(", "SchemaConcept", "subConcept", ",", "SchemaConcept", "superConcept", ")", "{", "if", "(", "superConcept", ".", "isEntityType", "(", ")", ")", "{", "subConcept", ".", "asEntityType", "(", ")", ".", "sup", "(", "sup...
Make the second argument the super of the first argument @throws GraqlQueryException if the types are different, or setting the super to be a meta-type
[ "Make", "the", "second", "argument", "the", "super", "of", "the", "first", "argument" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/executor/ConceptBuilder.java#L438-L452
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/VersionServiceImpl.java
VersionServiceImpl.remapResourceUris
private RdfStream remapResourceUris(final String resourceUri, final String mementoUri, final RdfStream rdfStream, final IdentifierConverter<Resource, FedoraResource> idTranslator, final Session jcrSession) { final IdentifierConverter<Resource, FedoraResource> internalIdTranslator = new InternalIdentifierTranslator( jcrSession); final org.apache.jena.graph.Node mementoNode = createURI(mementoUri); final Stream<Triple> mappedStream = rdfStream.map(t -> mapSubject(t, resourceUri, mementoUri)) .map(t -> convertToInternalReference(t, idTranslator, internalIdTranslator)); return new DefaultRdfStream(mementoNode, mappedStream); }
java
private RdfStream remapResourceUris(final String resourceUri, final String mementoUri, final RdfStream rdfStream, final IdentifierConverter<Resource, FedoraResource> idTranslator, final Session jcrSession) { final IdentifierConverter<Resource, FedoraResource> internalIdTranslator = new InternalIdentifierTranslator( jcrSession); final org.apache.jena.graph.Node mementoNode = createURI(mementoUri); final Stream<Triple> mappedStream = rdfStream.map(t -> mapSubject(t, resourceUri, mementoUri)) .map(t -> convertToInternalReference(t, idTranslator, internalIdTranslator)); return new DefaultRdfStream(mementoNode, mappedStream); }
[ "private", "RdfStream", "remapResourceUris", "(", "final", "String", "resourceUri", ",", "final", "String", "mementoUri", ",", "final", "RdfStream", "rdfStream", ",", "final", "IdentifierConverter", "<", "Resource", ",", "FedoraResource", ">", "idTranslator", ",", "...
Remaps the subjects of triples in rdfStream from the original resource URL to the URL of the new memento, and converts objects which reference resources to an internal identifier to prevent enforcement of referential integrity constraints. @param resourceUri uri of the original resource @param mementoUri uri of the memento resource @param rdfStream rdf stream @param idTranslator translator for producing URI of resources @param jcrSession jcr session @return RdfStream
[ "Remaps", "the", "subjects", "of", "triples", "in", "rdfStream", "from", "the", "original", "resource", "URL", "to", "the", "URL", "of", "the", "new", "memento", "and", "converts", "objects", "which", "reference", "resources", "to", "an", "internal", "identifi...
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/VersionServiceImpl.java#L213-L225
cogroo/cogroo4
cogroo-ruta/src/main/java/org/cogroo/ruta/uima/AnnotatorUtil.java
AnnotatorUtil.getResourceAsStream
public static InputStream getResourceAsStream(UimaContext context, String name) throws ResourceInitializationException { InputStream inResource = getOptionalResourceAsStream(context, name); if (inResource == null) { throw new ResourceInitializationException( ExceptionMessages.MESSAGE_CATALOG, ExceptionMessages.IO_ERROR_MODEL_READING, new Object[] { name + " could not be found!" }); } return inResource; }
java
public static InputStream getResourceAsStream(UimaContext context, String name) throws ResourceInitializationException { InputStream inResource = getOptionalResourceAsStream(context, name); if (inResource == null) { throw new ResourceInitializationException( ExceptionMessages.MESSAGE_CATALOG, ExceptionMessages.IO_ERROR_MODEL_READING, new Object[] { name + " could not be found!" }); } return inResource; }
[ "public", "static", "InputStream", "getResourceAsStream", "(", "UimaContext", "context", ",", "String", "name", ")", "throws", "ResourceInitializationException", "{", "InputStream", "inResource", "=", "getOptionalResourceAsStream", "(", "context", ",", "name", ")", ";",...
Retrieves a resource as stream from the given context. @param context @param name @return the stream @throws ResourceInitializationException
[ "Retrieves", "a", "resource", "as", "stream", "from", "the", "given", "context", "." ]
train
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-ruta/src/main/java/org/cogroo/ruta/uima/AnnotatorUtil.java#L451-L464
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/SizeUtils.java
SizeUtils.spToPx
public static float spToPx(Context ctx, float spSize){ return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spSize, ctx.getResources().getDisplayMetrics()); }
java
public static float spToPx(Context ctx, float spSize){ return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spSize, ctx.getResources().getDisplayMetrics()); }
[ "public", "static", "float", "spToPx", "(", "Context", "ctx", ",", "float", "spSize", ")", "{", "return", "TypedValue", ".", "applyDimension", "(", "TypedValue", ".", "COMPLEX_UNIT_SP", ",", "spSize", ",", "ctx", ".", "getResources", "(", ")", ".", "getDispl...
Convert Scale-Dependent Pixels to actual pixels @param ctx the application context @param spSize the size in SP units @return the size in Pixel units
[ "Convert", "Scale", "-", "Dependent", "Pixels", "to", "actual", "pixels" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/SizeUtils.java#L61-L63
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java
RedisJobStore.doWithLock
private <T> T doWithLock(LockCallback<T> callback) throws JobPersistenceException { return doWithLock(callback, null); }
java
private <T> T doWithLock(LockCallback<T> callback) throws JobPersistenceException { return doWithLock(callback, null); }
[ "private", "<", "T", ">", "T", "doWithLock", "(", "LockCallback", "<", "T", ">", "callback", ")", "throws", "JobPersistenceException", "{", "return", "doWithLock", "(", "callback", ",", "null", ")", ";", "}" ]
Perform Redis operations while possessing lock @param callback operation(s) to be performed during lock @param <T> return type @return response from callback, if any @throws JobPersistenceException
[ "Perform", "Redis", "operations", "while", "possessing", "lock" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java#L1135-L1137
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java
DatePickerSettings.zApplyAllowKeyboardEditing
void zApplyAllowKeyboardEditing() { if (parentDatePicker == null) { return; } // Set the editability of the date picker text field. parentDatePicker.getComponentDateTextField().setEditable(allowKeyboardEditing); // Set the text field border color based on whether the text field is editable. Color textFieldBorderColor = (allowKeyboardEditing) ? InternalConstants.colorEditableTextFieldBorder : InternalConstants.colorNotEditableTextFieldBorder; parentDatePicker.getComponentDateTextField().setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, textFieldBorderColor), new EmptyBorder(1, 3, 2, 2))); }
java
void zApplyAllowKeyboardEditing() { if (parentDatePicker == null) { return; } // Set the editability of the date picker text field. parentDatePicker.getComponentDateTextField().setEditable(allowKeyboardEditing); // Set the text field border color based on whether the text field is editable. Color textFieldBorderColor = (allowKeyboardEditing) ? InternalConstants.colorEditableTextFieldBorder : InternalConstants.colorNotEditableTextFieldBorder; parentDatePicker.getComponentDateTextField().setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, textFieldBorderColor), new EmptyBorder(1, 3, 2, 2))); }
[ "void", "zApplyAllowKeyboardEditing", "(", ")", "{", "if", "(", "parentDatePicker", "==", "null", ")", "{", "return", ";", "}", "// Set the editability of the date picker text field.", "parentDatePicker", ".", "getComponentDateTextField", "(", ")", ".", "setEditable", "...
zApplyAllowKeyboardEditing, This applies the named setting to the parent component.
[ "zApplyAllowKeyboardEditing", "This", "applies", "the", "named", "setting", "to", "the", "parent", "component", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java#L2205-L2217
thinkaurelius/faunus
src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java
FaunusPipeline.linkOut
public FaunusPipeline linkOut(final String label, final String step) { return this.link(OUT, label, step, null); }
java
public FaunusPipeline linkOut(final String label, final String step) { return this.link(OUT, label, step, null); }
[ "public", "FaunusPipeline", "linkOut", "(", "final", "String", "label", ",", "final", "String", "step", ")", "{", "return", "this", ".", "link", "(", "OUT", ",", "label", ",", "step", ",", "null", ")", ";", "}" ]
Have the elements for the named step previous project an edge from the current vertex with provided label. @param step the name of the step where the source vertices were @param label the label of the edge to project @return the extended FaunusPipeline
[ "Have", "the", "elements", "for", "the", "named", "step", "previous", "project", "an", "edge", "from", "the", "current", "vertex", "with", "provided", "label", "." ]
train
https://github.com/thinkaurelius/faunus/blob/1eb8494eeb3fe3b84a98d810d304ba01d55b0d6e/src/main/java/com/thinkaurelius/faunus/FaunusPipeline.java#L867-L869
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLTransitiveObjectPropertyAxiomImpl_CustomFieldSerializer.java
OWLTransitiveObjectPropertyAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLTransitiveObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLTransitiveObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLTransitiveObjectPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", ...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLTransitiveObjectPropertyAxiomImpl_CustomFieldSerializer.java#L95-L98
optimaize/language-detector
src/main/java/com/optimaize/langdetect/profiles/LanguageProfileWriter.java
LanguageProfileWriter.writeToDirectory
public void writeToDirectory(@NotNull LanguageProfile languageProfile, @NotNull File fullPath) throws IOException { if (!fullPath.exists()) { throw new IOException("Path does not exist: "+fullPath); } if (!fullPath.canWrite()) { throw new IOException("Path not writable: "+fullPath); } File file = new File(fullPath.getAbsolutePath()+"/"+languageProfile.getLocale()); if (file.exists()) { throw new IOException("File exists already, refusing to overwrite: "+file); } try (FileOutputStream output = new FileOutputStream(file)) { write(languageProfile, output); } }
java
public void writeToDirectory(@NotNull LanguageProfile languageProfile, @NotNull File fullPath) throws IOException { if (!fullPath.exists()) { throw new IOException("Path does not exist: "+fullPath); } if (!fullPath.canWrite()) { throw new IOException("Path not writable: "+fullPath); } File file = new File(fullPath.getAbsolutePath()+"/"+languageProfile.getLocale()); if (file.exists()) { throw new IOException("File exists already, refusing to overwrite: "+file); } try (FileOutputStream output = new FileOutputStream(file)) { write(languageProfile, output); } }
[ "public", "void", "writeToDirectory", "(", "@", "NotNull", "LanguageProfile", "languageProfile", ",", "@", "NotNull", "File", "fullPath", ")", "throws", "IOException", "{", "if", "(", "!", "fullPath", ".", "exists", "(", ")", ")", "{", "throw", "new", "IOExc...
Writes a {@link LanguageProfile} to a folder using the language name as the file name. @param fullPath Must be an existing writable directory path. @throws java.io.IOException if such a file name exists already.
[ "Writes", "a", "{", "@link", "LanguageProfile", "}", "to", "a", "folder", "using", "the", "language", "name", "as", "the", "file", "name", "." ]
train
https://github.com/optimaize/language-detector/blob/1a322c462f977b29eca8d3142b816b7111d3fa19/src/main/java/com/optimaize/langdetect/profiles/LanguageProfileWriter.java#L78-L92
Stratio/bdt
src/main/java/com/stratio/qa/utils/ElasticSearchUtils.java
ElasticSearchUtils.createMapping
public void createMapping(String indexName, String mappingName, ArrayList<XContentBuilder> mappingSource) { IndicesExistsResponse existsResponse = this.client.admin().indices().prepareExists(indexName).execute() .actionGet(); //If the index does not exists, it will be created without options if (!existsResponse.isExists()) { if (!createSingleIndex(indexName)) { throw new ElasticsearchException("Failed to create " + indexName + " index."); } } BulkRequestBuilder bulkRequest = this.client.prepareBulk(); for (int i = 0; i < mappingSource.size(); i++) { int aux = i + 1; IndexRequestBuilder res = this.client .prepareIndex(indexName, mappingName, String.valueOf(aux)).setSource(mappingSource.get(i)); bulkRequest.add(res); } bulkRequest.execute(); }
java
public void createMapping(String indexName, String mappingName, ArrayList<XContentBuilder> mappingSource) { IndicesExistsResponse existsResponse = this.client.admin().indices().prepareExists(indexName).execute() .actionGet(); //If the index does not exists, it will be created without options if (!existsResponse.isExists()) { if (!createSingleIndex(indexName)) { throw new ElasticsearchException("Failed to create " + indexName + " index."); } } BulkRequestBuilder bulkRequest = this.client.prepareBulk(); for (int i = 0; i < mappingSource.size(); i++) { int aux = i + 1; IndexRequestBuilder res = this.client .prepareIndex(indexName, mappingName, String.valueOf(aux)).setSource(mappingSource.get(i)); bulkRequest.add(res); } bulkRequest.execute(); }
[ "public", "void", "createMapping", "(", "String", "indexName", ",", "String", "mappingName", ",", "ArrayList", "<", "XContentBuilder", ">", "mappingSource", ")", "{", "IndicesExistsResponse", "existsResponse", "=", "this", ".", "client", ".", "admin", "(", ")", ...
Create a mapping over an index @param indexName @param mappingName @param mappingSource the data that has to be inserted in the mapping.
[ "Create", "a", "mapping", "over", "an", "index" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/ElasticSearchUtils.java#L172-L191
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java
KllFloatsSketch.getMaxSerializedSizeBytes
public static int getMaxSerializedSizeBytes(final int k, final long n) { final int numLevels = KllHelper.ubOnNumLevels(n); final int maxNumItems = KllHelper.computeTotalCapacity(k, DEFAULT_M, numLevels); return getSerializedSizeBytes(numLevels, maxNumItems); }
java
public static int getMaxSerializedSizeBytes(final int k, final long n) { final int numLevels = KllHelper.ubOnNumLevels(n); final int maxNumItems = KllHelper.computeTotalCapacity(k, DEFAULT_M, numLevels); return getSerializedSizeBytes(numLevels, maxNumItems); }
[ "public", "static", "int", "getMaxSerializedSizeBytes", "(", "final", "int", "k", ",", "final", "long", "n", ")", "{", "final", "int", "numLevels", "=", "KllHelper", ".", "ubOnNumLevels", "(", "n", ")", ";", "final", "int", "maxNumItems", "=", "KllHelper", ...
Returns upper bound on the serialized size of a sketch given a parameter <em>k</em> and stream length. The resulting size is an overestimate to make sure actual sketches don't exceed it. This method can be used if allocation of storage is necessary beforehand, but it is not optimal. @param k parameter that controls size of the sketch and accuracy of estimates @param n stream length @return upper bound on the serialized size
[ "Returns", "upper", "bound", "on", "the", "serialized", "size", "of", "a", "sketch", "given", "a", "parameter", "<em", ">", "k<", "/", "em", ">", "and", "stream", "length", ".", "The", "resulting", "size", "is", "an", "overestimate", "to", "make", "sure"...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L683-L687
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java
UCaseProps.getSlotValueAndOffset
private final long getSlotValueAndOffset(int excWord, int index, int excOffset) { long value; if((excWord&EXC_DOUBLE_SLOTS)==0) { excOffset+=slotOffset(excWord, index); value=exceptions.charAt(excOffset); } else { excOffset+=2*slotOffset(excWord, index); value=exceptions.charAt(excOffset++); value=(value<<16)|exceptions.charAt(excOffset); } return value |((long)excOffset<<32); }
java
private final long getSlotValueAndOffset(int excWord, int index, int excOffset) { long value; if((excWord&EXC_DOUBLE_SLOTS)==0) { excOffset+=slotOffset(excWord, index); value=exceptions.charAt(excOffset); } else { excOffset+=2*slotOffset(excWord, index); value=exceptions.charAt(excOffset++); value=(value<<16)|exceptions.charAt(excOffset); } return value |((long)excOffset<<32); }
[ "private", "final", "long", "getSlotValueAndOffset", "(", "int", "excWord", ",", "int", "index", ",", "int", "excOffset", ")", "{", "long", "value", ";", "if", "(", "(", "excWord", "&", "EXC_DOUBLE_SLOTS", ")", "==", "0", ")", "{", "excOffset", "+=", "sl...
/* Get the value of an optional-value slot where hasSlot(excWord, index). @param excWord (in) initial exceptions word @param index (in) desired slot index @param excOffset (in) offset into exceptions[] after excWord=exceptions.charAt(excOffset++); @return bits 31..0: slot value 63..32: modified excOffset, moved to the last char of the value, use +1 for beginning of next slot
[ "/", "*", "Get", "the", "value", "of", "an", "optional", "-", "value", "slot", "where", "hasSlot", "(", "excWord", "index", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java#L162-L173
PvdBerg1998/PNet
src/main/java/nl/pvdberg/pnet/event/PacketDistributer.java
PacketDistributer.onReceive
public synchronized void onReceive(final Packet packet, final Client client) throws IOException { if (globalHandler != null) globalHandler.onReceive(packet, client); final PacketHandler packetHandler = registry.get(packet.getPacketID()); if (packetHandler == null) { if (defaultHandler != null) defaultHandler.handlePacket(packet, client); } else packetHandler.handlePacket(packet, client); }
java
public synchronized void onReceive(final Packet packet, final Client client) throws IOException { if (globalHandler != null) globalHandler.onReceive(packet, client); final PacketHandler packetHandler = registry.get(packet.getPacketID()); if (packetHandler == null) { if (defaultHandler != null) defaultHandler.handlePacket(packet, client); } else packetHandler.handlePacket(packet, client); }
[ "public", "synchronized", "void", "onReceive", "(", "final", "Packet", "packet", ",", "final", "Client", "client", ")", "throws", "IOException", "{", "if", "(", "globalHandler", "!=", "null", ")", "globalHandler", ".", "onReceive", "(", "packet", ",", "client"...
Calls specified handler for Packet ID, or the default handler (if set) @param packet New incoming Packet
[ "Calls", "specified", "handler", "for", "Packet", "ID", "or", "the", "default", "handler", "(", "if", "set", ")" ]
train
https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/event/PacketDistributer.java#L52-L62
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SmUtil.java
SmUtil.rsAsn1ToPlain
public static byte[] rsAsn1ToPlain(byte[] rsDer) { ASN1Sequence seq = ASN1Sequence.getInstance(rsDer); byte[] r = bigIntToFixexLengthBytes(ASN1Integer.getInstance(seq.getObjectAt(0)).getValue()); byte[] s = bigIntToFixexLengthBytes(ASN1Integer.getInstance(seq.getObjectAt(1)).getValue()); byte[] result = new byte[RS_LEN * 2]; System.arraycopy(r, 0, result, 0, r.length); System.arraycopy(s, 0, result, RS_LEN, s.length); return result; }
java
public static byte[] rsAsn1ToPlain(byte[] rsDer) { ASN1Sequence seq = ASN1Sequence.getInstance(rsDer); byte[] r = bigIntToFixexLengthBytes(ASN1Integer.getInstance(seq.getObjectAt(0)).getValue()); byte[] s = bigIntToFixexLengthBytes(ASN1Integer.getInstance(seq.getObjectAt(1)).getValue()); byte[] result = new byte[RS_LEN * 2]; System.arraycopy(r, 0, result, 0, r.length); System.arraycopy(s, 0, result, RS_LEN, s.length); return result; }
[ "public", "static", "byte", "[", "]", "rsAsn1ToPlain", "(", "byte", "[", "]", "rsDer", ")", "{", "ASN1Sequence", "seq", "=", "ASN1Sequence", ".", "getInstance", "(", "rsDer", ")", ";", "byte", "[", "]", "r", "=", "bigIntToFixexLengthBytes", "(", "ASN1Integ...
BC的SM3withSM2签名得到的结果的rs是asn1格式的,这个方法转化成直接拼接r||s<br> 来自:https://blog.csdn.net/pridas/article/details/86118774 @param rsDer rs in asn1 format @return sign result in plain byte array @since 4.5.0
[ "BC的SM3withSM2签名得到的结果的rs是asn1格式的,这个方法转化成直接拼接r||s<br", ">", "来自:https", ":", "//", "blog", ".", "csdn", ".", "net", "/", "pridas", "/", "article", "/", "details", "/", "86118774" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SmUtil.java#L188-L196
zaproxy/zaproxy
src/org/zaproxy/zap/view/JCheckBoxTree.java
JCheckBoxTree.addSubtreeToCheckingStateTracking
private void addSubtreeToCheckingStateTracking(DefaultMutableTreeNode node) { TreeNode[] path = node.getPath(); TreePath tp = new TreePath(path); CheckedNode cn = new CheckedNode(false, node.getChildCount() > 0, false); nodesCheckingState.put(tp, cn); for (int i = 0 ; i < node.getChildCount() ; i++) { addSubtreeToCheckingStateTracking((DefaultMutableTreeNode) tp.pathByAddingChild(node.getChildAt(i)).getLastPathComponent()); } }
java
private void addSubtreeToCheckingStateTracking(DefaultMutableTreeNode node) { TreeNode[] path = node.getPath(); TreePath tp = new TreePath(path); CheckedNode cn = new CheckedNode(false, node.getChildCount() > 0, false); nodesCheckingState.put(tp, cn); for (int i = 0 ; i < node.getChildCount() ; i++) { addSubtreeToCheckingStateTracking((DefaultMutableTreeNode) tp.pathByAddingChild(node.getChildAt(i)).getLastPathComponent()); } }
[ "private", "void", "addSubtreeToCheckingStateTracking", "(", "DefaultMutableTreeNode", "node", ")", "{", "TreeNode", "[", "]", "path", "=", "node", ".", "getPath", "(", ")", ";", "TreePath", "tp", "=", "new", "TreePath", "(", "path", ")", ";", "CheckedNode", ...
Creating data structure of the current model for the checking mechanism
[ "Creating", "data", "structure", "of", "the", "current", "model", "for", "the", "checking", "mechanism" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/JCheckBoxTree.java#L127-L135
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.waitForActivity
public boolean waitForActivity(String name, int timeout) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForActivity(\""+name+"\", "+timeout+")"); } return waiter.waitForActivity(name, timeout); }
java
public boolean waitForActivity(String name, int timeout) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForActivity(\""+name+"\", "+timeout+")"); } return waiter.waitForActivity(name, timeout); }
[ "public", "boolean", "waitForActivity", "(", "String", "name", ",", "int", "timeout", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"waitForActivity(\\\"\"", "+", "name", "+",...
Waits for an Activity matching the specified name. @param name the name of the {@link Activity} to wait for. Example is: {@code "MyActivity"} @param timeout the amount of time in milliseconds to wait @return {@code true} if {@link Activity} appears before the timeout and {@code false} if it does not
[ "Waits", "for", "an", "Activity", "matching", "the", "specified", "name", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L3591-L3598
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/MpscGrowableArrayQueue.java
UnsafeRefArrayAccess.spElement
public static <E> void spElement(E[] buffer, long offset, E e) { UNSAFE.putObject(buffer, offset, e); }
java
public static <E> void spElement(E[] buffer, long offset, E e) { UNSAFE.putObject(buffer, offset, e); }
[ "public", "static", "<", "E", ">", "void", "spElement", "(", "E", "[", "]", "buffer", ",", "long", "offset", ",", "E", "e", ")", "{", "UNSAFE", ".", "putObject", "(", "buffer", ",", "offset", ",", "e", ")", ";", "}" ]
A plain store (no ordering/fences) of an element to a given offset @param buffer this.buffer @param offset computed via {@link UnsafeRefArrayAccess#calcElementOffset(long)} @param e an orderly kitty
[ "A", "plain", "store", "(", "no", "ordering", "/", "fences", ")", "of", "an", "element", "to", "a", "given", "offset" ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/MpscGrowableArrayQueue.java#L618-L620
dnsjava/dnsjava
org/xbill/DNS/Cache.java
Cache.findRecords
public RRset [] findRecords(Name name, int type) { return findRecords(name, type, Credibility.NORMAL); }
java
public RRset [] findRecords(Name name, int type) { return findRecords(name, type, Credibility.NORMAL); }
[ "public", "RRset", "[", "]", "findRecords", "(", "Name", "name", ",", "int", "type", ")", "{", "return", "findRecords", "(", "name", ",", "type", ",", "Credibility", ".", "NORMAL", ")", ";", "}" ]
Looks up credible Records in the Cache (a wrapper around lookupRecords). Unlike lookupRecords, this given no indication of why failure occurred. @param name The name to look up @param type The type to look up @return An array of RRsets, or null @see Credibility
[ "Looks", "up", "credible", "Records", "in", "the", "Cache", "(", "a", "wrapper", "around", "lookupRecords", ")", ".", "Unlike", "lookupRecords", "this", "given", "no", "indication", "of", "why", "failure", "occurred", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Cache.java#L533-L536
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/expression/Uris.java
Uris.escapeQueryParam
public String escapeQueryParam(final String text, final String encoding) { return UriEscape.escapeUriQueryParam(text, encoding); }
java
public String escapeQueryParam(final String text, final String encoding) { return UriEscape.escapeUriQueryParam(text, encoding); }
[ "public", "String", "escapeQueryParam", "(", "final", "String", "text", ",", "final", "String", "encoding", ")", "{", "return", "UriEscape", ".", "escapeUriQueryParam", "(", "text", ",", "encoding", ")", ";", "}" ]
<p> Perform am URI query parameter (name or value) <strong>escape</strong> operation on a {@code String} input. </p> <p> This method simply calls the equivalent method in the {@code UriEscape} class from the <a href="http://www.unbescape.org">Unbescape</a> library. </p> <p> The following are the only allowed chars in an URI query parameter (will not be escaped): </p> <ul> <li>{@code A-Z a-z 0-9}</li> <li>{@code - . _ ~}</li> <li>{@code ! $ ' ( ) * , ;}</li> <li>{@code : @}</li> <li>{@code / ?}</li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified <em>encoding</em> and then representing each byte in {@code %HH} syntax, being {@code HH} the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the {@code String} to be escaped. @param encoding the encoding to be used for escaping. @return The escaped result {@code String}. As a memory-performance improvement, will return the exact same object as the {@code text} input argument if no escaping modifications were required (and no additional {@code String} objects will be created during processing). Will return {@code null} if {@code text} is {@code null}.
[ "<p", ">", "Perform", "am", "URI", "query", "parameter", "(", "name", "or", "value", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "{", "@code", "String", "}", "input", ".", "<", "/", "p", ">", "<p", ">", "This", "meth...
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/expression/Uris.java#L589-L591
Azure/azure-sdk-for-java
authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java
RoleAssignmentsInner.createByIdAsync
public ServiceFuture<RoleAssignmentInner> createByIdAsync(String roleAssignmentId, RoleAssignmentProperties properties, final ServiceCallback<RoleAssignmentInner> serviceCallback) { return ServiceFuture.fromResponse(createByIdWithServiceResponseAsync(roleAssignmentId, properties), serviceCallback); }
java
public ServiceFuture<RoleAssignmentInner> createByIdAsync(String roleAssignmentId, RoleAssignmentProperties properties, final ServiceCallback<RoleAssignmentInner> serviceCallback) { return ServiceFuture.fromResponse(createByIdWithServiceResponseAsync(roleAssignmentId, properties), serviceCallback); }
[ "public", "ServiceFuture", "<", "RoleAssignmentInner", ">", "createByIdAsync", "(", "String", "roleAssignmentId", ",", "RoleAssignmentProperties", "properties", ",", "final", "ServiceCallback", "<", "RoleAssignmentInner", ">", "serviceCallback", ")", "{", "return", "Servi...
Creates a role assignment by ID. @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource name and resource type. Use the format, /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. @param properties Role assignment properties. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Creates", "a", "role", "assignment", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java#L1006-L1008
alkacon/opencms-core
src/org/opencms/acacia/shared/CmsWidgetUtil.java
CmsWidgetUtil.getBooleanOption
public static boolean getBooleanOption(Map<String, String> configOptions, String optionKey) { if (configOptions.containsKey(optionKey)) { String value = configOptions.get(optionKey); if ((value == null) || Boolean.valueOf(value).booleanValue()) { return true; } } return false; }
java
public static boolean getBooleanOption(Map<String, String> configOptions, String optionKey) { if (configOptions.containsKey(optionKey)) { String value = configOptions.get(optionKey); if ((value == null) || Boolean.valueOf(value).booleanValue()) { return true; } } return false; }
[ "public", "static", "boolean", "getBooleanOption", "(", "Map", "<", "String", ",", "String", ">", "configOptions", ",", "String", "optionKey", ")", "{", "if", "(", "configOptions", ".", "containsKey", "(", "optionKey", ")", ")", "{", "String", "value", "=", ...
Returns a flag, indicating if a boolean option is set, i.e., it is in the map and has value null or (case-insensitive) "true". @param configOptions the map with the config options. @param optionKey the boolean option to check. @return a flag, indicating if a boolean option is set
[ "Returns", "a", "flag", "indicating", "if", "a", "boolean", "option", "is", "set", "i", ".", "e", ".", "it", "is", "in", "the", "map", "and", "has", "value", "null", "or", "(", "case", "-", "insensitive", ")", "true", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsWidgetUtil.java#L64-L73
jMotif/SAX
src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java
EuclideanDistance.distance2
public long distance2(int[] point1, int[] point2) throws Exception { if (point1.length == point2.length) { long sum = 0; for (int i = 0; i < point1.length; i++) { sum = sum + (point2[i] - point1[i]) * (point2[i] - point1[i]); } return sum; } else { throw new Exception("Exception in Euclidean distance: array lengths are not equal"); } }
java
public long distance2(int[] point1, int[] point2) throws Exception { if (point1.length == point2.length) { long sum = 0; for (int i = 0; i < point1.length; i++) { sum = sum + (point2[i] - point1[i]) * (point2[i] - point1[i]); } return sum; } else { throw new Exception("Exception in Euclidean distance: array lengths are not equal"); } }
[ "public", "long", "distance2", "(", "int", "[", "]", "point1", ",", "int", "[", "]", "point2", ")", "throws", "Exception", "{", "if", "(", "point1", ".", "length", "==", "point2", ".", "length", ")", "{", "long", "sum", "=", "0", ";", "for", "(", ...
Calculates the square of the Euclidean distance between two multidimensional points represented by integer vectors. @param point1 The first point. @param point2 The second point. @return The Euclidean distance. @throws Exception In the case of error.
[ "Calculates", "the", "square", "of", "the", "Euclidean", "distance", "between", "two", "multidimensional", "points", "represented", "by", "integer", "vectors", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java#L98-L109
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/HashUtils.java
HashUtils.messageDigest
public static byte[] messageDigest(String value) { MessageDigest md5; try { md5 = MessageDigest.getInstance("MD5"); md5.update(value.getBytes("UTF-8")); return md5.digest(); } catch (NoSuchAlgorithmException e) { throw new SofaRpcRuntimeException("No such algorithm named md5", e); } catch (UnsupportedEncodingException e) { throw new SofaRpcRuntimeException("Unsupported encoding of" + value, e); } }
java
public static byte[] messageDigest(String value) { MessageDigest md5; try { md5 = MessageDigest.getInstance("MD5"); md5.update(value.getBytes("UTF-8")); return md5.digest(); } catch (NoSuchAlgorithmException e) { throw new SofaRpcRuntimeException("No such algorithm named md5", e); } catch (UnsupportedEncodingException e) { throw new SofaRpcRuntimeException("Unsupported encoding of" + value, e); } }
[ "public", "static", "byte", "[", "]", "messageDigest", "(", "String", "value", ")", "{", "MessageDigest", "md5", ";", "try", "{", "md5", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "md5", ".", "update", "(", "value", ".", "getByte...
换算法? MD5 SHA-1 MurMurHash??? @param value the value @return the byte []
[ "换算法?", "MD5", "SHA", "-", "1", "MurMurHash???" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/HashUtils.java#L37-L48
Azure/azure-sdk-for-java
cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java
AccountsInner.updateAsync
public Observable<CognitiveServicesAccountInner> updateAsync(String resourceGroupName, String accountName, Sku sku, Map<String, String> tags) { return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags).map(new Func1<ServiceResponse<CognitiveServicesAccountInner>, CognitiveServicesAccountInner>() { @Override public CognitiveServicesAccountInner call(ServiceResponse<CognitiveServicesAccountInner> response) { return response.body(); } }); }
java
public Observable<CognitiveServicesAccountInner> updateAsync(String resourceGroupName, String accountName, Sku sku, Map<String, String> tags) { return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags).map(new Func1<ServiceResponse<CognitiveServicesAccountInner>, CognitiveServicesAccountInner>() { @Override public CognitiveServicesAccountInner call(ServiceResponse<CognitiveServicesAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CognitiveServicesAccountInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "Sku", "sku", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateWithServiceResp...
Updates a Cognitive Services account. @param resourceGroupName The name of the resource group within the user's subscription. @param accountName The name of Cognitive Services account. @param sku Gets or sets the SKU of the resource. @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CognitiveServicesAccountInner object
[ "Updates", "a", "Cognitive", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java#L345-L352
osglworks/java-tool
src/main/java/org/osgl/util/IO.java
IO.registerInputStreamHandler
public static void registerInputStreamHandler(MimeType.Trait trait, InputStreamHandler handler) { $.requireNotNull(handler); List<MimeType> mimeTypes = MimeType.filterByTrait(trait); for (MimeType mimeType : mimeTypes) { registerInputStreamHandler(mimeType, handler); } }
java
public static void registerInputStreamHandler(MimeType.Trait trait, InputStreamHandler handler) { $.requireNotNull(handler); List<MimeType> mimeTypes = MimeType.filterByTrait(trait); for (MimeType mimeType : mimeTypes) { registerInputStreamHandler(mimeType, handler); } }
[ "public", "static", "void", "registerInputStreamHandler", "(", "MimeType", ".", "Trait", "trait", ",", "InputStreamHandler", "handler", ")", "{", "$", ".", "requireNotNull", "(", "handler", ")", ";", "List", "<", "MimeType", ">", "mimeTypes", "=", "MimeType", ...
Register an {@link InputStreamHandler} with all {@link MimeType mime types} by {@link MimeType.Trait}. @param trait the trait of mimetype @param handler the input stream handler
[ "Register", "an", "{", "@link", "InputStreamHandler", "}", "with", "all", "{", "@link", "MimeType", "mime", "types", "}", "by", "{", "@link", "MimeType", ".", "Trait", "}", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/IO.java#L179-L185
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.tagsToString
String tagsToString(Map<String, String> tagMap) { StringBuilder sb = new StringBuilder(); for (String key : tagMap.keySet()) { // Skip some tags if (key.equalsIgnoreCase("created_by")) { continue; } if (sb.length() > 0) { sb.append('\r'); } sb.append(key).append('=').append(tagMap.get(key)); } return sb.toString(); }
java
String tagsToString(Map<String, String> tagMap) { StringBuilder sb = new StringBuilder(); for (String key : tagMap.keySet()) { // Skip some tags if (key.equalsIgnoreCase("created_by")) { continue; } if (sb.length() > 0) { sb.append('\r'); } sb.append(key).append('=').append(tagMap.get(key)); } return sb.toString(); }
[ "String", "tagsToString", "(", "Map", "<", "String", ",", "String", ">", "tagMap", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "key", ":", "tagMap", ".", "keySet", "(", ")", ")", "{", "// Skip some...
Convert tags to a string representation using '\r' delimiter.
[ "Convert", "tags", "to", "a", "string", "representation", "using", "\\", "r", "delimiter", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L597-L610
phoenixnap/springmvc-raml-plugin
src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/SchemaHelper.java
SchemaHelper.resolveSchema
public static String resolveSchema(String schema, RamlRoot document) { if (document == null || schema == null || schema.indexOf("{") != -1) { return null; } if (document.getSchemas() != null && !document.getSchemas().isEmpty()) { for (Map<String, String> map : document.getSchemas()) { if (map.containsKey(schema)) { return map.get(schema); } } } return null; }
java
public static String resolveSchema(String schema, RamlRoot document) { if (document == null || schema == null || schema.indexOf("{") != -1) { return null; } if (document.getSchemas() != null && !document.getSchemas().isEmpty()) { for (Map<String, String> map : document.getSchemas()) { if (map.containsKey(schema)) { return map.get(schema); } } } return null; }
[ "public", "static", "String", "resolveSchema", "(", "String", "schema", ",", "RamlRoot", "document", ")", "{", "if", "(", "document", "==", "null", "||", "schema", "==", "null", "||", "schema", ".", "indexOf", "(", "\"{\"", ")", "!=", "-", "1", ")", "{...
Utility method that will return a schema if the identifier is valid and exists in the raml file definition. @param schema The name of the schema to resolve @param document The Parent Raml Document @return The full schema if contained in the raml document or null if not found
[ "Utility", "method", "that", "will", "return", "a", "schema", "if", "the", "identifier", "is", "valid", "and", "exists", "in", "the", "raml", "file", "definition", "." ]
train
https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/SchemaHelper.java#L68-L80
google/closure-templates
java/src/com/google/template/soy/types/SoyTypeRegistry.java
SoyTypeRegistry.getOrCreateRecordType
public RecordType getOrCreateRecordType(Map<String, SoyType> fields) { return recordTypes.intern(RecordType.of(fields)); }
java
public RecordType getOrCreateRecordType(Map<String, SoyType> fields) { return recordTypes.intern(RecordType.of(fields)); }
[ "public", "RecordType", "getOrCreateRecordType", "(", "Map", "<", "String", ",", "SoyType", ">", "fields", ")", "{", "return", "recordTypes", ".", "intern", "(", "RecordType", ".", "of", "(", "fields", ")", ")", ";", "}" ]
Factory function which creates a record type, given a map of fields. This folds map types with identical key/value types together, so asking for the same key/value type twice will return a pointer to the same type object. @param fields The map containing field names and types. @return The record type.
[ "Factory", "function", "which", "creates", "a", "record", "type", "given", "a", "map", "of", "fields", ".", "This", "folds", "map", "types", "with", "identical", "key", "/", "value", "types", "together", "so", "asking", "for", "the", "same", "key", "/", ...
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypeRegistry.java#L297-L299
NLPchina/ansj_seg
src/main/java/org/ansj/app/extracting/ExtractingTask.java
ExtractingTask._validate
private boolean _validate(Token token, Term term) { if (token == null) { return true; } Set<String> terms = token.getTerms(); if ((!terms.contains(Token.ALL)) && !terms.contains(term.getName()) && !(terms.contains(":" + term.getNatureStr()))) { return true; } boolean flag = token.getRegexs().size() != 0; for (String regex : token.getRegexs()) { if (term.getName().matches(regex)) { flag = false; break; } } return flag; }
java
private boolean _validate(Token token, Term term) { if (token == null) { return true; } Set<String> terms = token.getTerms(); if ((!terms.contains(Token.ALL)) && !terms.contains(term.getName()) && !(terms.contains(":" + term.getNatureStr()))) { return true; } boolean flag = token.getRegexs().size() != 0; for (String regex : token.getRegexs()) { if (term.getName().matches(regex)) { flag = false; break; } } return flag; }
[ "private", "boolean", "_validate", "(", "Token", "token", ",", "Term", "term", ")", "{", "if", "(", "token", "==", "null", ")", "{", "return", "true", ";", "}", "Set", "<", "String", ">", "terms", "=", "token", ".", "getTerms", "(", ")", ";", "if",...
验证term的名字或者词性是否符合条件 @param token @param term @return true, 不符合,false 符合
[ "验证term的名字或者词性是否符合条件" ]
train
https://github.com/NLPchina/ansj_seg/blob/1addfa08c9dc86872fcdb06c7f0955dd5d197585/src/main/java/org/ansj/app/extracting/ExtractingTask.java#L169-L190
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/StreamSet.java
StreamSet.getPersistentData
protected long getPersistentData(int priority, Reliability reliability) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "getPersistentData", new Object[] { new Integer(priority), reliability }); long prefix = getSubset(reliability).getPersistentData(priority); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getPersistentData", new Long(prefix)); return prefix; }
java
protected long getPersistentData(int priority, Reliability reliability) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "getPersistentData", new Object[] { new Integer(priority), reliability }); long prefix = getSubset(reliability).getPersistentData(priority); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getPersistentData", new Long(prefix)); return prefix; }
[ "protected", "long", "getPersistentData", "(", "int", "priority", ",", "Reliability", "reliability", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "...
Get the persistent data for a specific stream @param priority @param reliability @throws SIResourceException
[ "Get", "the", "persistent", "data", "for", "a", "specific", "stream" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/StreamSet.java#L882-L896
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java
GeoPackageOverlayFactory.getCompositeOverlay
public static CompositeOverlay getCompositeOverlay(TileDao tileDao, BoundedOverlay overlay) { List<TileDao> tileDaos = new ArrayList<>(); tileDaos.add(tileDao); return getCompositeOverlay(tileDaos, overlay); }
java
public static CompositeOverlay getCompositeOverlay(TileDao tileDao, BoundedOverlay overlay) { List<TileDao> tileDaos = new ArrayList<>(); tileDaos.add(tileDao); return getCompositeOverlay(tileDaos, overlay); }
[ "public", "static", "CompositeOverlay", "getCompositeOverlay", "(", "TileDao", "tileDao", ",", "BoundedOverlay", "overlay", ")", "{", "List", "<", "TileDao", ">", "tileDaos", "=", "new", "ArrayList", "<>", "(", ")", ";", "tileDaos", ".", "add", "(", "tileDao",...
Create a composite overlay by first adding a tile overlay for the tile DAO followed by the provided overlay @param tileDao tile dao @param overlay bounded overlay @return composite overlay
[ "Create", "a", "composite", "overlay", "by", "first", "adding", "a", "tile", "overlay", "for", "the", "tile", "DAO", "followed", "by", "the", "provided", "overlay" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java#L118-L122
AKSW/RDFUnit
rdfunit-core/src/main/java/org/aksw/rdfunit/utils/StringUtils.java
StringUtils.findLongestOverlap
public static String findLongestOverlap(String first, String second){ if(org.apache.commons.lang3.StringUtils.isEmpty(first) || org.apache.commons.lang3.StringUtils.isEmpty(second)) return ""; int length = Math.min(first.length(), second.length()); for(int i = 0; i < length; i++){ String zw = first.substring(first.length() - length + i); if(second.startsWith(zw)) return zw; } return ""; }
java
public static String findLongestOverlap(String first, String second){ if(org.apache.commons.lang3.StringUtils.isEmpty(first) || org.apache.commons.lang3.StringUtils.isEmpty(second)) return ""; int length = Math.min(first.length(), second.length()); for(int i = 0; i < length; i++){ String zw = first.substring(first.length() - length + i); if(second.startsWith(zw)) return zw; } return ""; }
[ "public", "static", "String", "findLongestOverlap", "(", "String", "first", ",", "String", "second", ")", "{", "if", "(", "org", ".", "apache", ".", "commons", ".", "lang3", ".", "StringUtils", ".", "isEmpty", "(", "first", ")", "||", "org", ".", "apache...
Will find the longest suffix of the first sequence which is a prefix of the second. @param first - first @param second - second @return - the longest overlap
[ "Will", "find", "the", "longest", "suffix", "of", "the", "first", "sequence", "which", "is", "a", "prefix", "of", "the", "second", "." ]
train
https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/utils/StringUtils.java#L43-L53
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.withdrawal_withdrawalId_GET
public OvhWithdrawal withdrawal_withdrawalId_GET(String withdrawalId) throws IOException { String qPath = "/me/withdrawal/{withdrawalId}"; StringBuilder sb = path(qPath, withdrawalId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhWithdrawal.class); }
java
public OvhWithdrawal withdrawal_withdrawalId_GET(String withdrawalId) throws IOException { String qPath = "/me/withdrawal/{withdrawalId}"; StringBuilder sb = path(qPath, withdrawalId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhWithdrawal.class); }
[ "public", "OvhWithdrawal", "withdrawal_withdrawalId_GET", "(", "String", "withdrawalId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/withdrawal/{withdrawalId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "withdrawalId", ")", ";...
Get this object properties REST: GET /me/withdrawal/{withdrawalId} @param withdrawalId [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#L4345-L4350
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/fft/FastFourierTransform.java
FastFourierTransform.bitReverse
private static void bitReverse(DoubleVector vector, int power) { vector.set(0, 0); vector.set(1, 2 << (power - 1)); vector.set(2, 2 << (power - 2)); vector.set(3, 3 * 2 << (power - 2)); int prevN = 3; for (int k = 3; k < power - 2; ++k) { int currN = (2 << k) - 1; vector.set(currN, vector.get(prevN) + (2 << (power - k))); for (int l = 0; l < prevN - 1; ++l) vector.set(currN - l, vector.get(currN) - vector.get(l)); prevN = currN; } }
java
private static void bitReverse(DoubleVector vector, int power) { vector.set(0, 0); vector.set(1, 2 << (power - 1)); vector.set(2, 2 << (power - 2)); vector.set(3, 3 * 2 << (power - 2)); int prevN = 3; for (int k = 3; k < power - 2; ++k) { int currN = (2 << k) - 1; vector.set(currN, vector.get(prevN) + (2 << (power - k))); for (int l = 0; l < prevN - 1; ++l) vector.set(currN - l, vector.get(currN) - vector.get(l)); prevN = currN; } }
[ "private", "static", "void", "bitReverse", "(", "DoubleVector", "vector", ",", "int", "power", ")", "{", "vector", ".", "set", "(", "0", ",", "0", ")", ";", "vector", ".", "set", "(", "1", ",", "2", "<<", "(", "power", "-", "1", ")", ")", ";", ...
Reverses the bits, a step required for doing the FFT in place. This implementation is significantly faster than {@link bitreverse}. This implementation is based on the following paper: </li style="font-family:Garamond, Georgia, serif">M. Rubio, P. Gomez, and K. Drouice. "A new superfast bit reversal algorithm" <i>International Journal of Adaptive Control and Signal Processing</i> @param vector The vector to be permuted according to the bit reversal. This vector's length must be a power of two @param power The log of the vector's length
[ "Reverses", "the", "bits", "a", "step", "required", "for", "doing", "the", "FFT", "in", "place", ".", "This", "implementation", "is", "significantly", "faster", "than", "{", "@link", "bitreverse", "}", ".", "This", "implementation", "is", "based", "on", "the...
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/fft/FastFourierTransform.java#L235-L248
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java
AvatarShell.updateZooKeeper
public void updateZooKeeper(String serviceName, String instance) throws IOException { Avatar avatar = avatarnode.getAvatar(); if (avatar != Avatar.ACTIVE) { throw new IOException("Cannot update ZooKeeper information to point to " + "the AvatarNode in Standby mode"); } AvatarNodeZkUtil.updateZooKeeper(originalConf, conf, true, serviceName, instance); }
java
public void updateZooKeeper(String serviceName, String instance) throws IOException { Avatar avatar = avatarnode.getAvatar(); if (avatar != Avatar.ACTIVE) { throw new IOException("Cannot update ZooKeeper information to point to " + "the AvatarNode in Standby mode"); } AvatarNodeZkUtil.updateZooKeeper(originalConf, conf, true, serviceName, instance); }
[ "public", "void", "updateZooKeeper", "(", "String", "serviceName", ",", "String", "instance", ")", "throws", "IOException", "{", "Avatar", "avatar", "=", "avatarnode", ".", "getAvatar", "(", ")", ";", "if", "(", "avatar", "!=", "Avatar", ".", "ACTIVE", ")", ...
/* This method tries to update the information in ZooKeeper For every address of the NameNode it is being run for (fs.default.name, dfs.namenode.dn-address, dfs.namenode.http.address) if they are present. It also creates information for aliases in ZooKeeper for lists of strings in fs.default.name.aliases, dfs.namenode.dn-address.aliases and dfs.namenode.http.address.aliases Each address it transformed to the address of the zNode to be created by substituting all . and : characters to /. The slash is also added in the front to make it a valid zNode address. So dfs.domain.com:9000 will be /dfs/domain/com/9000 If any part of the path does not exist it is created automatically
[ "/", "*", "This", "method", "tries", "to", "update", "the", "information", "in", "ZooKeeper", "For", "every", "address", "of", "the", "NameNode", "it", "is", "being", "run", "for", "(", "fs", ".", "default", ".", "name", "dfs", ".", "namenode", ".", "d...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java#L692-L699
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractModel.java
AbstractModel.listenObject
protected <T> void listenObject(ObjectProperty<T> objectProperty, Consumer<T> consumeOld, Consumer<T> consumeNew) { objectProperty.addListener( (final ObservableValue<? extends T> ov, final T old_val, final T new_val) -> { if (old_val != null && consumeOld != null) { consumeOld.accept(old_val); } if (new_val != null && consumeNew != null) { consumeNew.accept(new_val); } }); }
java
protected <T> void listenObject(ObjectProperty<T> objectProperty, Consumer<T> consumeOld, Consumer<T> consumeNew) { objectProperty.addListener( (final ObservableValue<? extends T> ov, final T old_val, final T new_val) -> { if (old_val != null && consumeOld != null) { consumeOld.accept(old_val); } if (new_val != null && consumeNew != null) { consumeNew.accept(new_val); } }); }
[ "protected", "<", "T", ">", "void", "listenObject", "(", "ObjectProperty", "<", "T", ">", "objectProperty", ",", "Consumer", "<", "T", ">", "consumeOld", ",", "Consumer", "<", "T", ">", "consumeNew", ")", "{", "objectProperty", ".", "addListener", "(", "("...
Listen object change. @param objectProperty the object to listen @param consumeOld process the old object @param consumeNew process the new object
[ "Listen", "object", "change", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractModel.java#L178-L188
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java
ArrayHelper.contains
public static <ELEMENTTYPE> boolean contains (@Nullable final ELEMENTTYPE [] aValues, @Nullable final ELEMENTTYPE aSearchValue) { return getFirstIndex (aValues, aSearchValue) >= 0; }
java
public static <ELEMENTTYPE> boolean contains (@Nullable final ELEMENTTYPE [] aValues, @Nullable final ELEMENTTYPE aSearchValue) { return getFirstIndex (aValues, aSearchValue) >= 0; }
[ "public", "static", "<", "ELEMENTTYPE", ">", "boolean", "contains", "(", "@", "Nullable", "final", "ELEMENTTYPE", "[", "]", "aValues", ",", "@", "Nullable", "final", "ELEMENTTYPE", "aSearchValue", ")", "{", "return", "getFirstIndex", "(", "aValues", ",", "aSea...
Check if the passed search value is contained in the passed value array. @param <ELEMENTTYPE> Array element type @param aValues The value array to be searched. May be <code>null</code>. @param aSearchValue The value to be searched. May be <code>null</code>. @return <code>true</code> if the value array is not empty and the search value is contained - false otherwise.
[ "Check", "if", "the", "passed", "search", "value", "is", "contained", "in", "the", "passed", "value", "array", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java#L806-L810
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.order_GET
public ArrayList<OvhOrder> order_GET(String planCode) throws IOException { String qPath = "/cloud/order"; StringBuilder sb = path(qPath); query(sb, "planCode", planCode); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t25); }
java
public ArrayList<OvhOrder> order_GET(String planCode) throws IOException { String qPath = "/cloud/order"; StringBuilder sb = path(qPath); query(sb, "planCode", planCode); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t25); }
[ "public", "ArrayList", "<", "OvhOrder", ">", "order_GET", "(", "String", "planCode", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/order\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\...
Get all cloud pending orders REST: GET /cloud/order @param planCode [required] Order plan code API beta
[ "Get", "all", "cloud", "pending", "orders" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2339-L2345
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java
NodeTypes.supertypesFor
protected List<JcrNodeType> supertypesFor( NodeTypeDefinition nodeType, Collection<JcrNodeType> pendingTypes ) throws RepositoryException { assert nodeType != null; List<JcrNodeType> supertypes = new LinkedList<JcrNodeType>(); boolean isMixin = nodeType.isMixin(); boolean needsPrimaryAncestor = !isMixin; String nodeTypeName = nodeType.getName(); for (String supertypeNameStr : nodeType.getDeclaredSupertypeNames()) { Name supertypeName = nameFactory.create(supertypeNameStr); JcrNodeType supertype = findTypeInMapOrList(supertypeName, pendingTypes); if (supertype == null) { throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidSupertypeName.text(supertypeNameStr, nodeTypeName)); } needsPrimaryAncestor &= supertype.isMixin(); supertypes.add(supertype); } // primary types (other than nt:base) always have at least one ancestor that's a primary type - nt:base if (needsPrimaryAncestor) { Name nodeName = nameFactory.create(nodeTypeName); if (!JcrNtLexicon.BASE.equals(nodeName)) { JcrNodeType ntBase = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes); assert ntBase != null; supertypes.add(0, ntBase); } } return supertypes; }
java
protected List<JcrNodeType> supertypesFor( NodeTypeDefinition nodeType, Collection<JcrNodeType> pendingTypes ) throws RepositoryException { assert nodeType != null; List<JcrNodeType> supertypes = new LinkedList<JcrNodeType>(); boolean isMixin = nodeType.isMixin(); boolean needsPrimaryAncestor = !isMixin; String nodeTypeName = nodeType.getName(); for (String supertypeNameStr : nodeType.getDeclaredSupertypeNames()) { Name supertypeName = nameFactory.create(supertypeNameStr); JcrNodeType supertype = findTypeInMapOrList(supertypeName, pendingTypes); if (supertype == null) { throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidSupertypeName.text(supertypeNameStr, nodeTypeName)); } needsPrimaryAncestor &= supertype.isMixin(); supertypes.add(supertype); } // primary types (other than nt:base) always have at least one ancestor that's a primary type - nt:base if (needsPrimaryAncestor) { Name nodeName = nameFactory.create(nodeTypeName); if (!JcrNtLexicon.BASE.equals(nodeName)) { JcrNodeType ntBase = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes); assert ntBase != null; supertypes.add(0, ntBase); } } return supertypes; }
[ "protected", "List", "<", "JcrNodeType", ">", "supertypesFor", "(", "NodeTypeDefinition", "nodeType", ",", "Collection", "<", "JcrNodeType", ">", "pendingTypes", ")", "throws", "RepositoryException", "{", "assert", "nodeType", "!=", "null", ";", "List", "<", "JcrN...
Returns the list of node types for the supertypes defined in the given node type. @param nodeType a node type with a non-null array of supertypes @param pendingTypes the list of types that have been processed in this type batch but not yet committed to the repository's set of types @return a list of node types where each element is the node type for the corresponding element of the array of supertype names @throws RepositoryException if any of the names in the array of supertype names does not correspond to an already-registered node type or a node type that is pending registration
[ "Returns", "the", "list", "of", "node", "types", "for", "the", "supertypes", "defined", "in", "the", "given", "node", "type", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L1899-L1929
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java
BlobContainersInner.updateAsync
public Observable<BlobContainerInner> updateAsync(String resourceGroupName, String accountName, String containerName) { return updateWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1<ServiceResponse<BlobContainerInner>, BlobContainerInner>() { @Override public BlobContainerInner call(ServiceResponse<BlobContainerInner> response) { return response.body(); } }); }
java
public Observable<BlobContainerInner> updateAsync(String resourceGroupName, String accountName, String containerName) { return updateWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1<ServiceResponse<BlobContainerInner>, BlobContainerInner>() { @Override public BlobContainerInner call(ServiceResponse<BlobContainerInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BlobContainerInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "containerName", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", "...
Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BlobContainerInner object
[ "Updates", "container", "properties", "as", "specified", "in", "request", "body", ".", "Properties", "not", "mentioned", "in", "the", "request", "will", "be", "unchanged", ".", "Update", "fails", "if", "the", "specified", "container", "doesn", "t", "already", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L439-L446
Alluxio/alluxio
core/server/common/src/main/java/alluxio/util/TarUtils.java
TarUtils.writeTarGz
public static void writeTarGz(Path dirPath, OutputStream output) throws IOException, InterruptedException { GzipCompressorOutputStream zipStream = new GzipCompressorOutputStream(output); TarArchiveOutputStream archiveStream = new TarArchiveOutputStream(zipStream); for (Path subPath : Files.walk(dirPath).collect(toList())) { if (Thread.interrupted()) { throw new InterruptedException(); } File file = subPath.toFile(); TarArchiveEntry entry = new TarArchiveEntry(file, dirPath.relativize(subPath).toString()); archiveStream.putArchiveEntry(entry); if (file.isFile()) { try (InputStream fileIn = Files.newInputStream(subPath)) { IOUtils.copy(fileIn, archiveStream); } } archiveStream.closeArchiveEntry(); } archiveStream.finish(); zipStream.finish(); }
java
public static void writeTarGz(Path dirPath, OutputStream output) throws IOException, InterruptedException { GzipCompressorOutputStream zipStream = new GzipCompressorOutputStream(output); TarArchiveOutputStream archiveStream = new TarArchiveOutputStream(zipStream); for (Path subPath : Files.walk(dirPath).collect(toList())) { if (Thread.interrupted()) { throw new InterruptedException(); } File file = subPath.toFile(); TarArchiveEntry entry = new TarArchiveEntry(file, dirPath.relativize(subPath).toString()); archiveStream.putArchiveEntry(entry); if (file.isFile()) { try (InputStream fileIn = Files.newInputStream(subPath)) { IOUtils.copy(fileIn, archiveStream); } } archiveStream.closeArchiveEntry(); } archiveStream.finish(); zipStream.finish(); }
[ "public", "static", "void", "writeTarGz", "(", "Path", "dirPath", ",", "OutputStream", "output", ")", "throws", "IOException", ",", "InterruptedException", "{", "GzipCompressorOutputStream", "zipStream", "=", "new", "GzipCompressorOutputStream", "(", "output", ")", ";...
Creates a gzipped tar archive from the given path, streaming the data to the give output stream. @param dirPath the path to archive @param output the output stream to write the data to
[ "Creates", "a", "gzipped", "tar", "archive", "from", "the", "given", "path", "streaming", "the", "data", "to", "the", "give", "output", "stream", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/util/TarUtils.java#L42-L62
rholder/moar-concurrent
src/main/java/com/github/rholder/moar/concurrent/partition/Parts.java
Parts.among
public static List<Part> among(long offset, long totalLength, long chunkSize) { List<Part> parts = new ArrayList<Part>(); int i = 0; long start = 0; long end = Math.min(start + chunkSize, totalLength) - 1; do { parts.add(new Part(start + offset, end + offset)); start = ++i * chunkSize; end = Math.min(start + chunkSize, totalLength) - 1; } while (start < totalLength); return parts; }
java
public static List<Part> among(long offset, long totalLength, long chunkSize) { List<Part> parts = new ArrayList<Part>(); int i = 0; long start = 0; long end = Math.min(start + chunkSize, totalLength) - 1; do { parts.add(new Part(start + offset, end + offset)); start = ++i * chunkSize; end = Math.min(start + chunkSize, totalLength) - 1; } while (start < totalLength); return parts; }
[ "public", "static", "List", "<", "Part", ">", "among", "(", "long", "offset", ",", "long", "totalLength", ",", "long", "chunkSize", ")", "{", "List", "<", "Part", ">", "parts", "=", "new", "ArrayList", "<", "Part", ">", "(", ")", ";", "int", "i", "...
Return a list of {@link Part}'s with the given offset where the total length is split up into equal partitions up to the last chunk that may contain a range of length &lt;= the given chunk size. For instance, an offset of 23 and total length of 21 with a chunkSize of 10 would result in the following list of returned parts: <pre> [23, 32], [33, 42], [43, 43] </pre> Notice that the final chunk contains the same start and end. This should be expected in cases where the last chunk would only contain one value. @param offset add this offset to the start and end of the calculated {@link Part}'s @param totalLength the total length of the range to partition @param chunkSize partition the range in chunks of this size, with the last chunk containing &lt;= this value @return a list of {@link Part}'s
[ "Return", "a", "list", "of", "{", "@link", "Part", "}", "s", "with", "the", "given", "offset", "where", "the", "total", "length", "is", "split", "up", "into", "equal", "partitions", "up", "to", "the", "last", "chunk", "that", "may", "contain", "a", "ra...
train
https://github.com/rholder/moar-concurrent/blob/c28facbf02e628cc37266c051c23d4a7654b4eba/src/main/java/com/github/rholder/moar/concurrent/partition/Parts.java#L91-L102
facebook/fresco
samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/data/impl/ContentProviderSimpleAdapter.java
ContentProviderSimpleAdapter.getInternalPhotoSimpleAdapter
public static ContentProviderSimpleAdapter getInternalPhotoSimpleAdapter(Context context) { return new ContentProviderSimpleAdapter(MediaStore.Images.Media.INTERNAL_CONTENT_URI, context); }
java
public static ContentProviderSimpleAdapter getInternalPhotoSimpleAdapter(Context context) { return new ContentProviderSimpleAdapter(MediaStore.Images.Media.INTERNAL_CONTENT_URI, context); }
[ "public", "static", "ContentProviderSimpleAdapter", "getInternalPhotoSimpleAdapter", "(", "Context", "context", ")", "{", "return", "new", "ContentProviderSimpleAdapter", "(", "MediaStore", ".", "Images", ".", "Media", ".", "INTERNAL_CONTENT_URI", ",", "context", ")", "...
Creates and returns a SimpleAdapter for Internal Photos @param context The Context @return The SimpleAdapter for local photo
[ "Creates", "and", "returns", "a", "SimpleAdapter", "for", "Internal", "Photos" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/data/impl/ContentProviderSimpleAdapter.java#L47-L49
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/HostVsanSystem.java
HostVsanSystem.evacuateVsanNode_Task
public Task evacuateVsanNode_Task(HostMaintenanceSpec maintenanceSpec, int timeout) throws InvalidState, RequestCanceled, RuntimeFault, Timedout, VsanFault, RemoteException { return new Task(getServerConnection(), getVimService().evacuateVsanNode_Task(getMOR(), maintenanceSpec, timeout)); }
java
public Task evacuateVsanNode_Task(HostMaintenanceSpec maintenanceSpec, int timeout) throws InvalidState, RequestCanceled, RuntimeFault, Timedout, VsanFault, RemoteException { return new Task(getServerConnection(), getVimService().evacuateVsanNode_Task(getMOR(), maintenanceSpec, timeout)); }
[ "public", "Task", "evacuateVsanNode_Task", "(", "HostMaintenanceSpec", "maintenanceSpec", ",", "int", "timeout", ")", "throws", "InvalidState", ",", "RequestCanceled", ",", "RuntimeFault", ",", "Timedout", ",", "VsanFault", ",", "RemoteException", "{", "return", "new"...
Evacuate this host from VSAN cluster. The task is cancellable. @param maintenanceSpec - Specifies the data evacuation mode. See {@link com.vmware.vim25.HostMaintenanceSpec HostMaintenanceSpec}. If unspecified, the default mode chosen will be ensureObjectAccessibility. @param timeout - Time to wait for the task to complete in seconds. If the value is less than or equal to zero, there is no timeout. The operation fails with a Timedout exception if it timed out. @return This method returns a Task object with which to monitor the operation. @throws InvalidState @throws RequestCanceled @throws RuntimeFault @throws Timedout @throws VsanFault @throws RemoteException @since 6.0
[ "Evacuate", "this", "host", "from", "VSAN", "cluster", ".", "The", "task", "is", "cancellable", "." ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/HostVsanSystem.java#L139-L141
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java
TransliteratorParser.parseSet
private final char parseSet(String rule, ParsePosition pos) { UnicodeSet set = new UnicodeSet(rule, pos, parseData); if (variableNext >= variableLimit) { throw new RuntimeException("Private use variables exhausted"); } set.compact(); return generateStandInFor(set); }
java
private final char parseSet(String rule, ParsePosition pos) { UnicodeSet set = new UnicodeSet(rule, pos, parseData); if (variableNext >= variableLimit) { throw new RuntimeException("Private use variables exhausted"); } set.compact(); return generateStandInFor(set); }
[ "private", "final", "char", "parseSet", "(", "String", "rule", ",", "ParsePosition", "pos", ")", "{", "UnicodeSet", "set", "=", "new", "UnicodeSet", "(", "rule", ",", "pos", ",", "parseData", ")", ";", "if", "(", "variableNext", ">=", "variableLimit", ")",...
Parse a UnicodeSet out, store it, and return the stand-in character used to represent it.
[ "Parse", "a", "UnicodeSet", "out", "store", "it", "and", "return", "the", "stand", "-", "in", "character", "used", "to", "represent", "it", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java#L1453-L1460
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/SynonymTypesProvider.java
SynonymTypesProvider.announceSynonym
protected final boolean announceSynonym(LightweightTypeReference synonym, int flags, Acceptor acceptor) { if (synonym.isUnknown()) { return true; } return acceptor.accept(synonym, flags | ConformanceFlags.CHECKED_SUCCESS); }
java
protected final boolean announceSynonym(LightweightTypeReference synonym, int flags, Acceptor acceptor) { if (synonym.isUnknown()) { return true; } return acceptor.accept(synonym, flags | ConformanceFlags.CHECKED_SUCCESS); }
[ "protected", "final", "boolean", "announceSynonym", "(", "LightweightTypeReference", "synonym", ",", "int", "flags", ",", "Acceptor", "acceptor", ")", "{", "if", "(", "synonym", ".", "isUnknown", "(", ")", ")", "{", "return", "true", ";", "}", "return", "acc...
Announce a synonym type with the given conformance flags. @see ConformanceFlags
[ "Announce", "a", "synonym", "type", "with", "the", "given", "conformance", "flags", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/SynonymTypesProvider.java#L181-L186
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerClient.java
RegionAutoscalerClient.insertRegionAutoscaler
@BetaApi public final Operation insertRegionAutoscaler(String region, Autoscaler autoscalerResource) { InsertRegionAutoscalerHttpRequest request = InsertRegionAutoscalerHttpRequest.newBuilder() .setRegion(region) .setAutoscalerResource(autoscalerResource) .build(); return insertRegionAutoscaler(request); }
java
@BetaApi public final Operation insertRegionAutoscaler(String region, Autoscaler autoscalerResource) { InsertRegionAutoscalerHttpRequest request = InsertRegionAutoscalerHttpRequest.newBuilder() .setRegion(region) .setAutoscalerResource(autoscalerResource) .build(); return insertRegionAutoscaler(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertRegionAutoscaler", "(", "String", "region", ",", "Autoscaler", "autoscalerResource", ")", "{", "InsertRegionAutoscalerHttpRequest", "request", "=", "InsertRegionAutoscalerHttpRequest", ".", "newBuilder", "(", ")", "."...
Creates an autoscaler in the specified project using the data included in the request. <p>Sample code: <pre><code> try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) { ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); Operation response = regionAutoscalerClient.insertRegionAutoscaler(region.toString(), autoscalerResource); } </code></pre> @param region Name of the region scoping this request. @param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to automatically scale virtual machine instances in managed instance groups according to an autoscaling policy that you define. For more information, read Autoscaling Groups of Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "an", "autoscaler", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionAutoscalerClient.java#L409-L418
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/box/MutableDouble.java
MutableDouble.fromExternal
public static MutableDouble fromExternal(final DoubleSupplier s, final DoubleConsumer c) { return new MutableDouble() { @Override public double getAsDouble() { return s.getAsDouble(); } @Override public Double get() { return getAsDouble(); } @Override public MutableDouble set(final double value) { c.accept(value); return this; } }; }
java
public static MutableDouble fromExternal(final DoubleSupplier s, final DoubleConsumer c) { return new MutableDouble() { @Override public double getAsDouble() { return s.getAsDouble(); } @Override public Double get() { return getAsDouble(); } @Override public MutableDouble set(final double value) { c.accept(value); return this; } }; }
[ "public", "static", "MutableDouble", "fromExternal", "(", "final", "DoubleSupplier", "s", ",", "final", "DoubleConsumer", "c", ")", "{", "return", "new", "MutableDouble", "(", ")", "{", "@", "Override", "public", "double", "getAsDouble", "(", ")", "{", "return...
Construct a MutableDouble that gets and sets an external value using the provided Supplier and Consumer e.g. <pre> {@code MutableDouble mutable = MutableDouble.fromExternal(()->!this.value,val->!this.value); } </pre> @param s Supplier of an external value @param c Consumer that sets an external value @return MutableDouble that gets / sets an external (mutable) value
[ "Construct", "a", "MutableDouble", "that", "gets", "and", "sets", "an", "external", "value", "using", "the", "provided", "Supplier", "and", "Consumer" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableDouble.java#L81-L99
sebastiangraf/treetank
interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java
DatabaseRepresentation.getLastRevision
public long getLastRevision(final String resourceName) throws JaxRxException, TTException { long lastRevision; if (mDatabase.existsResource(resourceName)) { ISession session = null; try { session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); lastRevision = session.getMostRecentVersion(); } catch (final Exception globExcep) { throw new JaxRxException(globExcep); } finally { session.close(); } } else { throw new JaxRxException(404, "Resource not found"); } return lastRevision; }
java
public long getLastRevision(final String resourceName) throws JaxRxException, TTException { long lastRevision; if (mDatabase.existsResource(resourceName)) { ISession session = null; try { session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); lastRevision = session.getMostRecentVersion(); } catch (final Exception globExcep) { throw new JaxRxException(globExcep); } finally { session.close(); } } else { throw new JaxRxException(404, "Resource not found"); } return lastRevision; }
[ "public", "long", "getLastRevision", "(", "final", "String", "resourceName", ")", "throws", "JaxRxException", ",", "TTException", "{", "long", "lastRevision", ";", "if", "(", "mDatabase", ".", "existsResource", "(", "resourceName", ")", ")", "{", "ISession", "se...
This method reads the existing database, and offers the last revision id of the database @param resourceName The name of the existing database. @return The {@link OutputStream} containing the result @throws WebApplicationException The Exception occurred. @throws TTException
[ "This", "method", "reads", "the", "existing", "database", "and", "offers", "the", "last", "revision", "id", "of", "the", "database" ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java#L379-L397
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_install_start_POST
public OvhTask serviceName_install_start_POST(String serviceName, OvhInstallCustom details, String partitionSchemeName, String templateName) throws IOException { String qPath = "/dedicated/server/{serviceName}/install/start"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "details", details); addBody(o, "partitionSchemeName", partitionSchemeName); addBody(o, "templateName", templateName); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_install_start_POST(String serviceName, OvhInstallCustom details, String partitionSchemeName, String templateName) throws IOException { String qPath = "/dedicated/server/{serviceName}/install/start"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "details", details); addBody(o, "partitionSchemeName", partitionSchemeName); addBody(o, "templateName", templateName); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_install_start_POST", "(", "String", "serviceName", ",", "OvhInstallCustom", "details", ",", "String", "partitionSchemeName", ",", "String", "templateName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{s...
Start an install REST: POST /dedicated/server/{serviceName}/install/start @param partitionSchemeName [required] Partition scheme name @param details [required] parameters for default install @param templateName [required] Template name @param serviceName [required] The internal name of your dedicated server
[ "Start", "an", "install" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1641-L1650
pravega/pravega
common/src/main/java/io/pravega/common/util/DelimitedStringParser.java
DelimitedStringParser.extractBoolean
public DelimitedStringParser extractBoolean(String key, Consumer<Boolean> consumer) { this.extractors.put(key, new Extractor<>(consumer, value -> { value = value.trim().toLowerCase(); return value.equals("true") || value.equals("yes") || value.equals("1"); })); return this; }
java
public DelimitedStringParser extractBoolean(String key, Consumer<Boolean> consumer) { this.extractors.put(key, new Extractor<>(consumer, value -> { value = value.trim().toLowerCase(); return value.equals("true") || value.equals("yes") || value.equals("1"); })); return this; }
[ "public", "DelimitedStringParser", "extractBoolean", "(", "String", "key", ",", "Consumer", "<", "Boolean", ">", "consumer", ")", "{", "this", ".", "extractors", ".", "put", "(", "key", ",", "new", "Extractor", "<>", "(", "consumer", ",", "value", "->", "{...
Associates the given consumer with the given key. This consumer will be invoked every time a Key-Value pair with the given key is encountered (argument is the Value of the pair). Note that this may be invoked multiple times or not at all, based on the given input. @param key The key for which to invoke the consumer. @param consumer The consumer to invoke. @return This object instance.
[ "Associates", "the", "given", "consumer", "with", "the", "given", "key", ".", "This", "consumer", "will", "be", "invoked", "every", "time", "a", "Key", "-", "Value", "pair", "with", "the", "given", "key", "is", "encountered", "(", "argument", "is", "the", ...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/DelimitedStringParser.java#L129-L136