repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/SequenceFile.java
SequenceFile.createWriter
private static Writer createWriter(Configuration conf, FSDataOutputStream out, Class keyClass, Class valClass, boolean compress, boolean blockCompress, CompressionCodec codec, Metadata metadata) throws IOException { """ Construct the preferred type of 'raw' SequenceFile Writer. @param out The stream on top which the writer is to be constructed. @param keyClass The 'key' type. @param valClass The 'value' type. @param compress Compress data? @param blockCompress Compress blocks? @param metadata The metadata of the file. @return Returns the handle to the constructed SequenceFile Writer. @throws IOException """ if (codec != null && (codec instanceof GzipCodec) && !NativeCodeLoader.isNativeCodeLoaded() && !ZlibFactory.isNativeZlibLoaded(conf)) { throw new IllegalArgumentException("SequenceFile doesn't work with " + "GzipCodec without native-hadoop code!"); } Writer writer = null; if (!compress) { writer = new Writer(conf, out, keyClass, valClass, metadata); } else if (compress && !blockCompress) { writer = new RecordCompressWriter(conf, out, keyClass, valClass, codec, metadata); } else { writer = new BlockCompressWriter(conf, out, keyClass, valClass, codec, metadata); } return writer; }
java
private static Writer createWriter(Configuration conf, FSDataOutputStream out, Class keyClass, Class valClass, boolean compress, boolean blockCompress, CompressionCodec codec, Metadata metadata) throws IOException { if (codec != null && (codec instanceof GzipCodec) && !NativeCodeLoader.isNativeCodeLoaded() && !ZlibFactory.isNativeZlibLoaded(conf)) { throw new IllegalArgumentException("SequenceFile doesn't work with " + "GzipCodec without native-hadoop code!"); } Writer writer = null; if (!compress) { writer = new Writer(conf, out, keyClass, valClass, metadata); } else if (compress && !blockCompress) { writer = new RecordCompressWriter(conf, out, keyClass, valClass, codec, metadata); } else { writer = new BlockCompressWriter(conf, out, keyClass, valClass, codec, metadata); } return writer; }
[ "private", "static", "Writer", "createWriter", "(", "Configuration", "conf", ",", "FSDataOutputStream", "out", ",", "Class", "keyClass", ",", "Class", "valClass", ",", "boolean", "compress", ",", "boolean", "blockCompress", ",", "CompressionCodec", "codec", ",", "Metadata", "metadata", ")", "throws", "IOException", "{", "if", "(", "codec", "!=", "null", "&&", "(", "codec", "instanceof", "GzipCodec", ")", "&&", "!", "NativeCodeLoader", ".", "isNativeCodeLoaded", "(", ")", "&&", "!", "ZlibFactory", ".", "isNativeZlibLoaded", "(", "conf", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"SequenceFile doesn't work with \"", "+", "\"GzipCodec without native-hadoop code!\"", ")", ";", "}", "Writer", "writer", "=", "null", ";", "if", "(", "!", "compress", ")", "{", "writer", "=", "new", "Writer", "(", "conf", ",", "out", ",", "keyClass", ",", "valClass", ",", "metadata", ")", ";", "}", "else", "if", "(", "compress", "&&", "!", "blockCompress", ")", "{", "writer", "=", "new", "RecordCompressWriter", "(", "conf", ",", "out", ",", "keyClass", ",", "valClass", ",", "codec", ",", "metadata", ")", ";", "}", "else", "{", "writer", "=", "new", "BlockCompressWriter", "(", "conf", ",", "out", ",", "keyClass", ",", "valClass", ",", "codec", ",", "metadata", ")", ";", "}", "return", "writer", ";", "}" ]
Construct the preferred type of 'raw' SequenceFile Writer. @param out The stream on top which the writer is to be constructed. @param keyClass The 'key' type. @param valClass The 'value' type. @param compress Compress data? @param blockCompress Compress blocks? @param metadata The metadata of the file. @return Returns the handle to the constructed SequenceFile Writer. @throws IOException
[ "Construct", "the", "preferred", "type", "of", "raw", "SequenceFile", "Writer", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/SequenceFile.java#L571-L594
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java
ReflectionUtils.assertNotVoidType
public static void assertNotVoidType(final Field field, Class<? extends Annotation> annotation) { """ Asserts field isn't of void type. @param field to validate @param annotation annotation to propagate in exception message """ if ((field.getClass().equals(Void.class)) && (field.getClass().equals(Void.TYPE))) { throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation); } }
java
public static void assertNotVoidType(final Field field, Class<? extends Annotation> annotation) { if ((field.getClass().equals(Void.class)) && (field.getClass().equals(Void.TYPE))) { throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation); } }
[ "public", "static", "void", "assertNotVoidType", "(", "final", "Field", "field", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "if", "(", "(", "field", ".", "getClass", "(", ")", ".", "equals", "(", "Void", ".", "class", ")", ")", "&&", "(", "field", ".", "getClass", "(", ")", ".", "equals", "(", "Void", ".", "TYPE", ")", ")", ")", "{", "throw", "annotation", "==", "null", "?", "MESSAGES", ".", "fieldCannotBeOfPrimitiveOrVoidType", "(", "field", ")", ":", "MESSAGES", ".", "fieldCannotBeOfPrimitiveOrVoidType2", "(", "field", ",", "annotation", ")", ";", "}", "}" ]
Asserts field isn't of void type. @param field to validate @param annotation annotation to propagate in exception message
[ "Asserts", "field", "isn", "t", "of", "void", "type", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L152-L158
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/text/StringRandomizer.java
StringRandomizer.aNewStringRandomizer
public static StringRandomizer aNewStringRandomizer(final int minLength, final int maxLength, final long seed) { """ Create a new {@link StringRandomizer}. @param maxLength of the String to generate @param minLength of the String to generate @param seed initial seed @return a new {@link StringRandomizer}. """ if (minLength > maxLength) { throw new IllegalArgumentException("minLength should be less than or equal to maxLength"); } return new StringRandomizer(minLength, maxLength, seed); }
java
public static StringRandomizer aNewStringRandomizer(final int minLength, final int maxLength, final long seed) { if (minLength > maxLength) { throw new IllegalArgumentException("minLength should be less than or equal to maxLength"); } return new StringRandomizer(minLength, maxLength, seed); }
[ "public", "static", "StringRandomizer", "aNewStringRandomizer", "(", "final", "int", "minLength", ",", "final", "int", "maxLength", ",", "final", "long", "seed", ")", "{", "if", "(", "minLength", ">", "maxLength", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"minLength should be less than or equal to maxLength\"", ")", ";", "}", "return", "new", "StringRandomizer", "(", "minLength", ",", "maxLength", ",", "seed", ")", ";", "}" ]
Create a new {@link StringRandomizer}. @param maxLength of the String to generate @param minLength of the String to generate @param seed initial seed @return a new {@link StringRandomizer}.
[ "Create", "a", "new", "{", "@link", "StringRandomizer", "}", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/text/StringRandomizer.java#L218-L223
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.validBatchGetRequest
private boolean validBatchGetRequest(Map<Class<?>, List<KeyPair>> itemsToGet) { """ Check whether the batchGetRequest meet all the constraints. @param itemsToGet """ if (itemsToGet == null || itemsToGet.size() == 0) { return false; } for (Class<?> clazz : itemsToGet.keySet()) { if (itemsToGet.get(clazz) != null && itemsToGet.get(clazz).size() > 0) { return true; } } return false; }
java
private boolean validBatchGetRequest(Map<Class<?>, List<KeyPair>> itemsToGet) { if (itemsToGet == null || itemsToGet.size() == 0) { return false; } for (Class<?> clazz : itemsToGet.keySet()) { if (itemsToGet.get(clazz) != null && itemsToGet.get(clazz).size() > 0) { return true; } } return false; }
[ "private", "boolean", "validBatchGetRequest", "(", "Map", "<", "Class", "<", "?", ">", ",", "List", "<", "KeyPair", ">", ">", "itemsToGet", ")", "{", "if", "(", "itemsToGet", "==", "null", "||", "itemsToGet", ".", "size", "(", ")", "==", "0", ")", "{", "return", "false", ";", "}", "for", "(", "Class", "<", "?", ">", "clazz", ":", "itemsToGet", ".", "keySet", "(", ")", ")", "{", "if", "(", "itemsToGet", ".", "get", "(", "clazz", ")", "!=", "null", "&&", "itemsToGet", ".", "get", "(", "clazz", ")", ".", "size", "(", ")", ">", "0", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check whether the batchGetRequest meet all the constraints. @param itemsToGet
[ "Check", "whether", "the", "batchGetRequest", "meet", "all", "the", "constraints", "." ]
train
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L950-L961
geomajas/geomajas-project-server
plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HibernateLayerUtil.java
HibernateLayerUtil.setSessionFactory
public void setSessionFactory(SessionFactory sessionFactory) throws HibernateLayerException { """ Set session factory. @param sessionFactory session factory @throws HibernateLayerException could not get class metadata for data source """ try { this.sessionFactory = sessionFactory; if (null != layerInfo) { entityMetadata = sessionFactory.getClassMetadata(layerInfo.getFeatureInfo().getDataSourceName()); } } catch (Exception e) { // NOSONAR throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_NO_SESSION_FACTORY); } }
java
public void setSessionFactory(SessionFactory sessionFactory) throws HibernateLayerException { try { this.sessionFactory = sessionFactory; if (null != layerInfo) { entityMetadata = sessionFactory.getClassMetadata(layerInfo.getFeatureInfo().getDataSourceName()); } } catch (Exception e) { // NOSONAR throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_NO_SESSION_FACTORY); } }
[ "public", "void", "setSessionFactory", "(", "SessionFactory", "sessionFactory", ")", "throws", "HibernateLayerException", "{", "try", "{", "this", ".", "sessionFactory", "=", "sessionFactory", ";", "if", "(", "null", "!=", "layerInfo", ")", "{", "entityMetadata", "=", "sessionFactory", ".", "getClassMetadata", "(", "layerInfo", ".", "getFeatureInfo", "(", ")", ".", "getDataSourceName", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "// NOSONAR", "throw", "new", "HibernateLayerException", "(", "e", ",", "ExceptionCode", ".", "HIBERNATE_NO_SESSION_FACTORY", ")", ";", "}", "}" ]
Set session factory. @param sessionFactory session factory @throws HibernateLayerException could not get class metadata for data source
[ "Set", "session", "factory", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HibernateLayerUtil.java#L145-L154
lets-blade/blade
src/main/java/com/blade/kit/ReflectKit.java
ReflectKit.getMethod
public static Method getMethod(Class<?> cls, String methodName, Class<?>... types) { """ Get cls method name by name and parameter types @param cls @param methodName @param types @return """ try { return cls.getMethod(methodName, types); } catch (Exception e) { return null; } }
java
public static Method getMethod(Class<?> cls, String methodName, Class<?>... types) { try { return cls.getMethod(methodName, types); } catch (Exception e) { return null; } }
[ "public", "static", "Method", "getMethod", "(", "Class", "<", "?", ">", "cls", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "types", ")", "{", "try", "{", "return", "cls", ".", "getMethod", "(", "methodName", ",", "types", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "null", ";", "}", "}" ]
Get cls method name by name and parameter types @param cls @param methodName @param types @return
[ "Get", "cls", "method", "name", "by", "name", "and", "parameter", "types" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L252-L258
JOML-CI/JOML
src/org/joml/Matrix3f.java
Matrix3f.rotateLocalZ
public Matrix3f rotateLocalZ(float ang, Matrix3f dest) { """ Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationZ(float) rotationZ()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationZ(float) @param ang the angle in radians to rotate about the Z axis @param dest will hold the result @return dest """ float sin = (float) Math.sin(ang); float cos = (float) Math.cosFromSin(sin, ang); float nm00 = cos * m00 - sin * m01; float nm01 = sin * m00 + cos * m01; float nm10 = cos * m10 - sin * m11; float nm11 = sin * m10 + cos * m11; float nm20 = cos * m20 - sin * m21; float nm21 = sin * m20 + cos * m21; dest.m00 = nm00; dest.m01 = nm01; dest.m02 = m02; dest.m10 = nm10; dest.m11 = nm11; dest.m12 = m12; dest.m20 = nm20; dest.m21 = nm21; dest.m22 = m22; return dest; }
java
public Matrix3f rotateLocalZ(float ang, Matrix3f dest) { float sin = (float) Math.sin(ang); float cos = (float) Math.cosFromSin(sin, ang); float nm00 = cos * m00 - sin * m01; float nm01 = sin * m00 + cos * m01; float nm10 = cos * m10 - sin * m11; float nm11 = sin * m10 + cos * m11; float nm20 = cos * m20 - sin * m21; float nm21 = sin * m20 + cos * m21; dest.m00 = nm00; dest.m01 = nm01; dest.m02 = m02; dest.m10 = nm10; dest.m11 = nm11; dest.m12 = m12; dest.m20 = nm20; dest.m21 = nm21; dest.m22 = m22; return dest; }
[ "public", "Matrix3f", "rotateLocalZ", "(", "float", "ang", ",", "Matrix3f", "dest", ")", "{", "float", "sin", "=", "(", "float", ")", "Math", ".", "sin", "(", "ang", ")", ";", "float", "cos", "=", "(", "float", ")", "Math", ".", "cosFromSin", "(", "sin", ",", "ang", ")", ";", "float", "nm00", "=", "cos", "*", "m00", "-", "sin", "*", "m01", ";", "float", "nm01", "=", "sin", "*", "m00", "+", "cos", "*", "m01", ";", "float", "nm10", "=", "cos", "*", "m10", "-", "sin", "*", "m11", ";", "float", "nm11", "=", "sin", "*", "m10", "+", "cos", "*", "m11", ";", "float", "nm20", "=", "cos", "*", "m20", "-", "sin", "*", "m21", ";", "float", "nm21", "=", "sin", "*", "m20", "+", "cos", "*", "m21", ";", "dest", ".", "m00", "=", "nm00", ";", "dest", ".", "m01", "=", "nm01", ";", "dest", ".", "m02", "=", "m02", ";", "dest", ".", "m10", "=", "nm10", ";", "dest", ".", "m11", "=", "nm11", ";", "dest", ".", "m12", "=", "m12", ";", "dest", ".", "m20", "=", "nm20", ";", "dest", ".", "m21", "=", "nm21", ";", "dest", ".", "m22", "=", "m22", ";", "return", "dest", ";", "}" ]
Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationZ(float) rotationZ()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationZ(float) @param ang the angle in radians to rotate about the Z axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "around", "the", "Z", "axis", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "Z", "axis", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">", "When", "used", "with", "a", "right", "-", "handed", "coordinate", "system", "the", "produced", "rotation", "will", "rotate", "a", "vector", "counter", "-", "clockwise", "around", "the", "rotation", "axis", "when", "viewing", "along", "the", "negative", "axis", "direction", "towards", "the", "origin", ".", "When", "used", "with", "a", "left", "-", "handed", "coordinate", "system", "the", "rotation", "is", "clockwise", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "R<", "/", "code", ">", "the", "rotation", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "R", "*", "M<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "R", "*", "M", "*", "v<", "/", "code", ">", "the", "rotation", "will", "be", "applied", "last!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "rotation", "matrix", "without", "pre", "-", "multiplying", "the", "rotation", "transformation", "use", "{", "@link", "#rotationZ", "(", "float", ")", "rotationZ", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Rotation_matrix#Rotation_matrix_from_axis_and_angle", ">", "http", ":", "//", "en", ".", "wikipedia", ".", "org<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L2621-L2640
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/crf/FactorTable.java
FactorTable.conditionalLogProbGivenNext
public double conditionalLogProbGivenNext(int[] given, int of) { """ Computes the probability of the tag OF being at the beginning of the table given that the tag sequence GIVEN is at the end of the table. given is at the end, of is at the beginning @return the probability of the tag of being at the beginning of the table """ if (given.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbGivenNext requires given one less than clique size (" + windowSize + ") but was " + Arrays.toString(given)); } int[] label = indicesEnd(given); double[] masses = new double[label.length]; for (int i = 0; i < masses.length; i++) { masses[i] = table[label[i]]; } double z = ArrayMath.logSum(masses); return table[indexOf(of, given)] - z; }
java
public double conditionalLogProbGivenNext(int[] given, int of) { if (given.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbGivenNext requires given one less than clique size (" + windowSize + ") but was " + Arrays.toString(given)); } int[] label = indicesEnd(given); double[] masses = new double[label.length]; for (int i = 0; i < masses.length; i++) { masses[i] = table[label[i]]; } double z = ArrayMath.logSum(masses); return table[indexOf(of, given)] - z; }
[ "public", "double", "conditionalLogProbGivenNext", "(", "int", "[", "]", "given", ",", "int", "of", ")", "{", "if", "(", "given", ".", "length", "!=", "windowSize", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"conditionalLogProbGivenNext requires given one less than clique size (\"", "+", "windowSize", "+", "\") but was \"", "+", "Arrays", ".", "toString", "(", "given", ")", ")", ";", "}", "int", "[", "]", "label", "=", "indicesEnd", "(", "given", ")", ";", "double", "[", "]", "masses", "=", "new", "double", "[", "label", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "masses", ".", "length", ";", "i", "++", ")", "{", "masses", "[", "i", "]", "=", "table", "[", "label", "[", "i", "]", "]", ";", "}", "double", "z", "=", "ArrayMath", ".", "logSum", "(", "masses", ")", ";", "return", "table", "[", "indexOf", "(", "of", ",", "given", ")", "]", "-", "z", ";", "}" ]
Computes the probability of the tag OF being at the beginning of the table given that the tag sequence GIVEN is at the end of the table. given is at the end, of is at the beginning @return the probability of the tag of being at the beginning of the table
[ "Computes", "the", "probability", "of", "the", "tag", "OF", "being", "at", "the", "beginning", "of", "the", "table", "given", "that", "the", "tag", "sequence", "GIVEN", "is", "at", "the", "end", "of", "the", "table", ".", "given", "is", "at", "the", "end", "of", "is", "at", "the", "beginning" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/crf/FactorTable.java#L338-L351
optimaize/anythingworks
server/implgrizzly/src/main/java/com/optimaize/anythingworks/server/implgrizzly/GrizzlyHttpServer.java
GrizzlyHttpServer.getSoapWebServicePublisher
public synchronized GrizzlySoapWebServicePublisher getSoapWebServicePublisher(@NotNull TransportInfo transportInfo) { """ Overloaded method that gives you full control over the host instead of using the one given in the constructor. This way you can publish to multiple host names, or different port numbers or protocols. @return The publisher where you can add services. """ GrizzlySoapWebServicePublisher publisher = soapPublishers.get(transportInfo); if (publisher==null) { publisher = new GrizzlySoapWebServicePublisher(httpServer, transportInfo); soapPublishers.put(transportInfo, publisher); } return publisher; }
java
public synchronized GrizzlySoapWebServicePublisher getSoapWebServicePublisher(@NotNull TransportInfo transportInfo) { GrizzlySoapWebServicePublisher publisher = soapPublishers.get(transportInfo); if (publisher==null) { publisher = new GrizzlySoapWebServicePublisher(httpServer, transportInfo); soapPublishers.put(transportInfo, publisher); } return publisher; }
[ "public", "synchronized", "GrizzlySoapWebServicePublisher", "getSoapWebServicePublisher", "(", "@", "NotNull", "TransportInfo", "transportInfo", ")", "{", "GrizzlySoapWebServicePublisher", "publisher", "=", "soapPublishers", ".", "get", "(", "transportInfo", ")", ";", "if", "(", "publisher", "==", "null", ")", "{", "publisher", "=", "new", "GrizzlySoapWebServicePublisher", "(", "httpServer", ",", "transportInfo", ")", ";", "soapPublishers", ".", "put", "(", "transportInfo", ",", "publisher", ")", ";", "}", "return", "publisher", ";", "}" ]
Overloaded method that gives you full control over the host instead of using the one given in the constructor. This way you can publish to multiple host names, or different port numbers or protocols. @return The publisher where you can add services.
[ "Overloaded", "method", "that", "gives", "you", "full", "control", "over", "the", "host", "instead", "of", "using", "the", "one", "given", "in", "the", "constructor", ".", "This", "way", "you", "can", "publish", "to", "multiple", "host", "names", "or", "different", "port", "numbers", "or", "protocols", "." ]
train
https://github.com/optimaize/anythingworks/blob/23e5f1c63cd56d935afaac4ad033c7996b32a1f2/server/implgrizzly/src/main/java/com/optimaize/anythingworks/server/implgrizzly/GrizzlyHttpServer.java#L68-L75
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_storage_POST
public OvhContainer project_serviceName_storage_POST(String serviceName, Boolean archive, String containerName, String region) throws IOException { """ Create container REST: POST /cloud/project/{serviceName}/storage @param archive [required] Archive container flag @param containerName [required] Container name @param region [required] Region @param serviceName [required] Service name """ String qPath = "/cloud/project/{serviceName}/storage"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "archive", archive); addBody(o, "containerName", containerName); addBody(o, "region", region); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhContainer.class); }
java
public OvhContainer project_serviceName_storage_POST(String serviceName, Boolean archive, String containerName, String region) throws IOException { String qPath = "/cloud/project/{serviceName}/storage"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "archive", archive); addBody(o, "containerName", containerName); addBody(o, "region", region); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhContainer.class); }
[ "public", "OvhContainer", "project_serviceName_storage_POST", "(", "String", "serviceName", ",", "Boolean", "archive", ",", "String", "containerName", ",", "String", "region", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/storage\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"archive\"", ",", "archive", ")", ";", "addBody", "(", "o", ",", "\"containerName\"", ",", "containerName", ")", ";", "addBody", "(", "o", ",", "\"region\"", ",", "region", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhContainer", ".", "class", ")", ";", "}" ]
Create container REST: POST /cloud/project/{serviceName}/storage @param archive [required] Archive container flag @param containerName [required] Container name @param region [required] Region @param serviceName [required] Service name
[ "Create", "container" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L569-L578
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java
CPFriendlyURLEntryPersistenceImpl.countByG_C_U
@Override public int countByG_C_U(long groupId, long classNameId, String urlTitle) { """ Returns the number of cp friendly url entries where groupId = &#63; and classNameId = &#63; and urlTitle = &#63;. @param groupId the group ID @param classNameId the class name ID @param urlTitle the url title @return the number of matching cp friendly url entries """ FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C_U; Object[] finderArgs = new Object[] { groupId, classNameId, urlTitle }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_CPFRIENDLYURLENTRY_WHERE); query.append(_FINDER_COLUMN_G_C_U_GROUPID_2); query.append(_FINDER_COLUMN_G_C_U_CLASSNAMEID_2); boolean bindUrlTitle = false; if (urlTitle == null) { query.append(_FINDER_COLUMN_G_C_U_URLTITLE_1); } else if (urlTitle.equals("")) { query.append(_FINDER_COLUMN_G_C_U_URLTITLE_3); } else { bindUrlTitle = true; query.append(_FINDER_COLUMN_G_C_U_URLTITLE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(classNameId); if (bindUrlTitle) { qPos.add(urlTitle); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_C_U(long groupId, long classNameId, String urlTitle) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C_U; Object[] finderArgs = new Object[] { groupId, classNameId, urlTitle }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_CPFRIENDLYURLENTRY_WHERE); query.append(_FINDER_COLUMN_G_C_U_GROUPID_2); query.append(_FINDER_COLUMN_G_C_U_CLASSNAMEID_2); boolean bindUrlTitle = false; if (urlTitle == null) { query.append(_FINDER_COLUMN_G_C_U_URLTITLE_1); } else if (urlTitle.equals("")) { query.append(_FINDER_COLUMN_G_C_U_URLTITLE_3); } else { bindUrlTitle = true; query.append(_FINDER_COLUMN_G_C_U_URLTITLE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(classNameId); if (bindUrlTitle) { qPos.add(urlTitle); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_C_U", "(", "long", "groupId", ",", "long", "classNameId", ",", "String", "urlTitle", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_C_U", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "groupId", ",", "classNameId", ",", "urlTitle", "}", ";", "Long", "count", "=", "(", "Long", ")", "finderCache", ".", "getResult", "(", "finderPath", ",", "finderArgs", ",", "this", ")", ";", "if", "(", "count", "==", "null", ")", "{", "StringBundler", "query", "=", "new", "StringBundler", "(", "4", ")", ";", "query", ".", "append", "(", "_SQL_COUNT_CPFRIENDLYURLENTRY_WHERE", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_GROUPID_2", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_CLASSNAMEID_2", ")", ";", "boolean", "bindUrlTitle", "=", "false", ";", "if", "(", "urlTitle", "==", "null", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_URLTITLE_1", ")", ";", "}", "else", "if", "(", "urlTitle", ".", "equals", "(", "\"\"", ")", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_URLTITLE_3", ")", ";", "}", "else", "{", "bindUrlTitle", "=", "true", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_C_U_URLTITLE_2", ")", ";", "}", "String", "sql", "=", "query", ".", "toString", "(", ")", ";", "Session", "session", "=", "null", ";", "try", "{", "session", "=", "openSession", "(", ")", ";", "Query", "q", "=", "session", ".", "createQuery", "(", "sql", ")", ";", "QueryPos", "qPos", "=", "QueryPos", ".", "getInstance", "(", "q", ")", ";", "qPos", ".", "add", "(", "groupId", ")", ";", "qPos", ".", "add", "(", "classNameId", ")", ";", "if", "(", "bindUrlTitle", ")", "{", "qPos", ".", "add", "(", "urlTitle", ")", ";", "}", "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", "(", ")", ";", "}" ]
Returns the number of cp friendly url entries where groupId = &#63; and classNameId = &#63; and urlTitle = &#63;. @param groupId the group ID @param classNameId the class name ID @param urlTitle the url title @return the number of matching cp friendly url entries
[ "Returns", "the", "number", "of", "cp", "friendly", "url", "entries", "where", "groupId", "=", "&#63", ";", "and", "classNameId", "=", "&#63", ";", "and", "urlTitle", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L3191-L3256
antopen/alipay-sdk-java
src/main/java/com/alipay/api/internal/util/XmlUtils.java
XmlUtils.getEncoding
private static String getEncoding(String text) { """ Gets the encoding pattern from given XML file. @param text the context of the XML file @return the encoding pattern string of given XML file """ String result = "UTF-8";//默认编码格式 String xml = text.trim(); if (xml.startsWith("<?xml")) { int end = xml.indexOf("?>"); String sub = xml.substring(0, end); StringTokenizer tokens = new StringTokenizer(sub, " =\"\'"); while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); if ("encoding".equals(token)) { if (tokens.hasMoreTokens()) { result = tokens.nextToken(); } break; } } } return result; }
java
private static String getEncoding(String text) { String result = "UTF-8";//默认编码格式 String xml = text.trim(); if (xml.startsWith("<?xml")) { int end = xml.indexOf("?>"); String sub = xml.substring(0, end); StringTokenizer tokens = new StringTokenizer(sub, " =\"\'"); while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); if ("encoding".equals(token)) { if (tokens.hasMoreTokens()) { result = tokens.nextToken(); } break; } } } return result; }
[ "private", "static", "String", "getEncoding", "(", "String", "text", ")", "{", "String", "result", "=", "\"UTF-8\"", ";", "//默认编码格式", "String", "xml", "=", "text", ".", "trim", "(", ")", ";", "if", "(", "xml", ".", "startsWith", "(", "\"<?xml\"", ")", ")", "{", "int", "end", "=", "xml", ".", "indexOf", "(", "\"?>\"", ")", ";", "String", "sub", "=", "xml", ".", "substring", "(", "0", ",", "end", ")", ";", "StringTokenizer", "tokens", "=", "new", "StringTokenizer", "(", "sub", ",", "\" =\\\"\\'\"", ")", ";", "while", "(", "tokens", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "token", "=", "tokens", ".", "nextToken", "(", ")", ";", "if", "(", "\"encoding\"", ".", "equals", "(", "token", ")", ")", "{", "if", "(", "tokens", ".", "hasMoreTokens", "(", ")", ")", "{", "result", "=", "tokens", ".", "nextToken", "(", ")", ";", "}", "break", ";", "}", "}", "}", "return", "result", ";", "}" ]
Gets the encoding pattern from given XML file. @param text the context of the XML file @return the encoding pattern string of given XML file
[ "Gets", "the", "encoding", "pattern", "from", "given", "XML", "file", "." ]
train
https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L166-L189
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/KeyPointsCircleRegularGrid.java
KeyPointsCircleRegularGrid.addTangents
private boolean addTangents(Grid grid, int rowA, int colA, int rowB, int colB) { """ Computes tangent points to the two ellipses specified by the grid coordinates """ EllipseRotated_F64 a = grid.get(rowA,colA); EllipseRotated_F64 b = grid.get(rowB,colB); if( !tangentFinder.process(a,b, A0, A1, A2, A3, B0, B1, B2, B3) ) { return false; } Tangents ta = tangents.get(grid.getIndexOfRegEllipse(rowA,colA)); Tangents tb = tangents.get(grid.getIndexOfRegEllipse(rowB,colB)); // Which point is 0 or 3 is not defined and can swap arbitrarily. To fix this problem // 0 will be defined as on the 'positive side' of the line connecting the ellipse centers double slopeX = b.center.x-a.center.x; double slopeY = b.center.y-a.center.y; double dx0 = A0.x-a.center.x; double dy0 = A0.y-a.center.y; double z = slopeX*dy0 - slopeY*dx0; if( z < 0 == (rowA == rowB)) { Point2D_F64 tmp = A0; A0 = A3; A3 = tmp; tmp = B0; B0 = B3; B3 = tmp; } // add tangent points from the two lines which do not cross the center line if( rowA == rowB ) { ta.t[ta.countT++].set(A0); ta.b[ta.countB++].set(A3); tb.t[tb.countT++].set(B0); tb.b[tb.countB++].set(B3); } else { ta.r[ta.countL++].set(A0); ta.l[ta.countR++].set(A3); tb.r[tb.countL++].set(B0); tb.l[tb.countR++].set(B3); } return true; }
java
private boolean addTangents(Grid grid, int rowA, int colA, int rowB, int colB) { EllipseRotated_F64 a = grid.get(rowA,colA); EllipseRotated_F64 b = grid.get(rowB,colB); if( !tangentFinder.process(a,b, A0, A1, A2, A3, B0, B1, B2, B3) ) { return false; } Tangents ta = tangents.get(grid.getIndexOfRegEllipse(rowA,colA)); Tangents tb = tangents.get(grid.getIndexOfRegEllipse(rowB,colB)); // Which point is 0 or 3 is not defined and can swap arbitrarily. To fix this problem // 0 will be defined as on the 'positive side' of the line connecting the ellipse centers double slopeX = b.center.x-a.center.x; double slopeY = b.center.y-a.center.y; double dx0 = A0.x-a.center.x; double dy0 = A0.y-a.center.y; double z = slopeX*dy0 - slopeY*dx0; if( z < 0 == (rowA == rowB)) { Point2D_F64 tmp = A0; A0 = A3; A3 = tmp; tmp = B0; B0 = B3; B3 = tmp; } // add tangent points from the two lines which do not cross the center line if( rowA == rowB ) { ta.t[ta.countT++].set(A0); ta.b[ta.countB++].set(A3); tb.t[tb.countT++].set(B0); tb.b[tb.countB++].set(B3); } else { ta.r[ta.countL++].set(A0); ta.l[ta.countR++].set(A3); tb.r[tb.countL++].set(B0); tb.l[tb.countR++].set(B3); } return true; }
[ "private", "boolean", "addTangents", "(", "Grid", "grid", ",", "int", "rowA", ",", "int", "colA", ",", "int", "rowB", ",", "int", "colB", ")", "{", "EllipseRotated_F64", "a", "=", "grid", ".", "get", "(", "rowA", ",", "colA", ")", ";", "EllipseRotated_F64", "b", "=", "grid", ".", "get", "(", "rowB", ",", "colB", ")", ";", "if", "(", "!", "tangentFinder", ".", "process", "(", "a", ",", "b", ",", "A0", ",", "A1", ",", "A2", ",", "A3", ",", "B0", ",", "B1", ",", "B2", ",", "B3", ")", ")", "{", "return", "false", ";", "}", "Tangents", "ta", "=", "tangents", ".", "get", "(", "grid", ".", "getIndexOfRegEllipse", "(", "rowA", ",", "colA", ")", ")", ";", "Tangents", "tb", "=", "tangents", ".", "get", "(", "grid", ".", "getIndexOfRegEllipse", "(", "rowB", ",", "colB", ")", ")", ";", "// Which point is 0 or 3 is not defined and can swap arbitrarily. To fix this problem", "// 0 will be defined as on the 'positive side' of the line connecting the ellipse centers", "double", "slopeX", "=", "b", ".", "center", ".", "x", "-", "a", ".", "center", ".", "x", ";", "double", "slopeY", "=", "b", ".", "center", ".", "y", "-", "a", ".", "center", ".", "y", ";", "double", "dx0", "=", "A0", ".", "x", "-", "a", ".", "center", ".", "x", ";", "double", "dy0", "=", "A0", ".", "y", "-", "a", ".", "center", ".", "y", ";", "double", "z", "=", "slopeX", "*", "dy0", "-", "slopeY", "*", "dx0", ";", "if", "(", "z", "<", "0", "==", "(", "rowA", "==", "rowB", ")", ")", "{", "Point2D_F64", "tmp", "=", "A0", ";", "A0", "=", "A3", ";", "A3", "=", "tmp", ";", "tmp", "=", "B0", ";", "B0", "=", "B3", ";", "B3", "=", "tmp", ";", "}", "// add tangent points from the two lines which do not cross the center line", "if", "(", "rowA", "==", "rowB", ")", "{", "ta", ".", "t", "[", "ta", ".", "countT", "++", "]", ".", "set", "(", "A0", ")", ";", "ta", ".", "b", "[", "ta", ".", "countB", "++", "]", ".", "set", "(", "A3", ")", ";", "tb", ".", "t", "[", "tb", ".", "countT", "++", "]", ".", "set", "(", "B0", ")", ";", "tb", ".", "b", "[", "tb", ".", "countB", "++", "]", ".", "set", "(", "B3", ")", ";", "}", "else", "{", "ta", ".", "r", "[", "ta", ".", "countL", "++", "]", ".", "set", "(", "A0", ")", ";", "ta", ".", "l", "[", "ta", ".", "countR", "++", "]", ".", "set", "(", "A3", ")", ";", "tb", ".", "r", "[", "tb", ".", "countL", "++", "]", ".", "set", "(", "B0", ")", ";", "tb", ".", "l", "[", "tb", ".", "countR", "++", "]", ".", "set", "(", "B3", ")", ";", "}", "return", "true", ";", "}" ]
Computes tangent points to the two ellipses specified by the grid coordinates
[ "Computes", "tangent", "points", "to", "the", "two", "ellipses", "specified", "by", "the", "grid", "coordinates" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/KeyPointsCircleRegularGrid.java#L117-L155
wisdom-framework/wisdom
core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/cookies/CookieHelper.java
CookieHelper.getCookieValue
public static String getCookieValue(String name, Cookies cookies) { """ Gets the value of the cookie having the given name. The cookie is looked from the given cookies set. @param name the name of the cookie @param cookies the set of cookie @return the value of the cookie, {@literal null} if there are no cookie with the given name in the cookies set. """ Cookie c = cookies.get(name); if (c != null) { return c.value(); } return null; }
java
public static String getCookieValue(String name, Cookies cookies) { Cookie c = cookies.get(name); if (c != null) { return c.value(); } return null; }
[ "public", "static", "String", "getCookieValue", "(", "String", "name", ",", "Cookies", "cookies", ")", "{", "Cookie", "c", "=", "cookies", ".", "get", "(", "name", ")", ";", "if", "(", "c", "!=", "null", ")", "{", "return", "c", ".", "value", "(", ")", ";", "}", "return", "null", ";", "}" ]
Gets the value of the cookie having the given name. The cookie is looked from the given cookies set. @param name the name of the cookie @param cookies the set of cookie @return the value of the cookie, {@literal null} if there are no cookie with the given name in the cookies set.
[ "Gets", "the", "value", "of", "the", "cookie", "having", "the", "given", "name", ".", "The", "cookie", "is", "looked", "from", "the", "given", "cookies", "set", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/cookies/CookieHelper.java#L107-L113
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.listStorageAccountsWithServiceResponseAsync
public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> listStorageAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName) { """ Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param accountName The name of the Data Lake Analytics account for which to list Azure Storage accounts. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StorageAccountInfoInner&gt; object """ return listStorageAccountsSinglePageAsync(resourceGroupName, accountName) .concatMap(new Func1<ServiceResponse<Page<StorageAccountInfoInner>>, Observable<ServiceResponse<Page<StorageAccountInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> call(ServiceResponse<Page<StorageAccountInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listStorageAccountsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> listStorageAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName) { return listStorageAccountsSinglePageAsync(resourceGroupName, accountName) .concatMap(new Func1<ServiceResponse<Page<StorageAccountInfoInner>>, Observable<ServiceResponse<Page<StorageAccountInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> call(ServiceResponse<Page<StorageAccountInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listStorageAccountsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "StorageAccountInfoInner", ">", ">", ">", "listStorageAccountsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ")", "{", "return", "listStorageAccountsSinglePageAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "StorageAccountInfoInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "StorageAccountInfoInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "StorageAccountInfoInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "StorageAccountInfoInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listStorageAccountsNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param accountName The name of the Data Lake Analytics account for which to list Azure Storage accounts. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StorageAccountInfoInner&gt; object
[ "Gets", "the", "first", "page", "of", "Azure", "Storage", "accounts", "if", "any", "linked", "to", "the", "specified", "Data", "Lake", "Analytics", "account", ".", "The", "response", "includes", "a", "link", "to", "the", "next", "page", "if", "any", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1288-L1300
OpenLiberty/open-liberty
dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLogSet.java
FileLogSet.createNewUniqueFile
private File createNewUniqueFile(File srcFile) throws IOException { """ Create a new unique file name. If the source file is specified, the new file should be created by renaming the source file as the unique file. @param srcFile the file to rename, or null to create a new file @return the newly created file, or null if the could not be created @throws IOException if an unexpected I/O error occurs """ String dateString = getDateString(); int index = findFileIndexAndUpdateCounter(dateString); String destFileName; File destFile; do { int counter = lastCounter++; destFileName = fileName + dateString + '.' + counter + fileExtension; destFile = new File(directory, destFileName); boolean success; if (srcFile == null) { success = destFile.createNewFile(); } else { // We don't want to rename over an existing file, so try to // avoid doing so with a racy exists() check. if (!destFile.exists()) { success = srcFile.renameTo(destFile); } else { success = false; } } if (success) { // Add the file to our list, which will cause old files to be // deleted if we've reached the max. addFile(index, destFileName); return destFile; } } while (destFile.isFile()); if (srcFile != null && copyFileTo(srcFile, destFile)) { addFile(index, destFileName); return FileLogUtils.deleteFile(srcFile) ? destFile : null; } Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE_NOEX", new Object[] { destFile }); return null; }
java
private File createNewUniqueFile(File srcFile) throws IOException { String dateString = getDateString(); int index = findFileIndexAndUpdateCounter(dateString); String destFileName; File destFile; do { int counter = lastCounter++; destFileName = fileName + dateString + '.' + counter + fileExtension; destFile = new File(directory, destFileName); boolean success; if (srcFile == null) { success = destFile.createNewFile(); } else { // We don't want to rename over an existing file, so try to // avoid doing so with a racy exists() check. if (!destFile.exists()) { success = srcFile.renameTo(destFile); } else { success = false; } } if (success) { // Add the file to our list, which will cause old files to be // deleted if we've reached the max. addFile(index, destFileName); return destFile; } } while (destFile.isFile()); if (srcFile != null && copyFileTo(srcFile, destFile)) { addFile(index, destFileName); return FileLogUtils.deleteFile(srcFile) ? destFile : null; } Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE_NOEX", new Object[] { destFile }); return null; }
[ "private", "File", "createNewUniqueFile", "(", "File", "srcFile", ")", "throws", "IOException", "{", "String", "dateString", "=", "getDateString", "(", ")", ";", "int", "index", "=", "findFileIndexAndUpdateCounter", "(", "dateString", ")", ";", "String", "destFileName", ";", "File", "destFile", ";", "do", "{", "int", "counter", "=", "lastCounter", "++", ";", "destFileName", "=", "fileName", "+", "dateString", "+", "'", "'", "+", "counter", "+", "fileExtension", ";", "destFile", "=", "new", "File", "(", "directory", ",", "destFileName", ")", ";", "boolean", "success", ";", "if", "(", "srcFile", "==", "null", ")", "{", "success", "=", "destFile", ".", "createNewFile", "(", ")", ";", "}", "else", "{", "// We don't want to rename over an existing file, so try to", "// avoid doing so with a racy exists() check.", "if", "(", "!", "destFile", ".", "exists", "(", ")", ")", "{", "success", "=", "srcFile", ".", "renameTo", "(", "destFile", ")", ";", "}", "else", "{", "success", "=", "false", ";", "}", "}", "if", "(", "success", ")", "{", "// Add the file to our list, which will cause old files to be", "// deleted if we've reached the max.", "addFile", "(", "index", ",", "destFileName", ")", ";", "return", "destFile", ";", "}", "}", "while", "(", "destFile", ".", "isFile", "(", ")", ")", ";", "if", "(", "srcFile", "!=", "null", "&&", "copyFileTo", "(", "srcFile", ",", "destFile", ")", ")", "{", "addFile", "(", "index", ",", "destFileName", ")", ";", "return", "FileLogUtils", ".", "deleteFile", "(", "srcFile", ")", "?", "destFile", ":", "null", ";", "}", "Tr", ".", "error", "(", "tc", ",", "\"UNABLE_TO_DELETE_RESOURCE_NOEX\"", ",", "new", "Object", "[", "]", "{", "destFile", "}", ")", ";", "return", "null", ";", "}" ]
Create a new unique file name. If the source file is specified, the new file should be created by renaming the source file as the unique file. @param srcFile the file to rename, or null to create a new file @return the newly created file, or null if the could not be created @throws IOException if an unexpected I/O error occurs
[ "Create", "a", "new", "unique", "file", "name", ".", "If", "the", "source", "file", "is", "specified", "the", "new", "file", "should", "be", "created", "by", "renaming", "the", "source", "file", "as", "the", "unique", "file", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLogSet.java#L240-L279
Red5/red5-server-common
src/main/java/org/red5/server/stream/StreamService.java
StreamService.sendNetStreamStatus
public static void sendNetStreamStatus(IConnection conn, String statusCode, String description, String name, String status, Number streamId) { """ Send NetStream.Status to the client. @param conn connection @param statusCode NetStream status code @param description description @param name name @param status The status - error, warning, or status @param streamId stream id """ if (conn instanceof RTMPConnection) { Status s = new Status(statusCode); s.setClientid(streamId); s.setDesciption(description); s.setDetails(name); s.setLevel(status); // get the channel RTMPConnection rtmpConn = (RTMPConnection) conn; Channel channel = rtmpConn.getChannel(rtmpConn.getChannelIdForStreamId(streamId)); channel.sendStatus(s); } else { throw new RuntimeException("Connection is not RTMPConnection: " + conn); } }
java
public static void sendNetStreamStatus(IConnection conn, String statusCode, String description, String name, String status, Number streamId) { if (conn instanceof RTMPConnection) { Status s = new Status(statusCode); s.setClientid(streamId); s.setDesciption(description); s.setDetails(name); s.setLevel(status); // get the channel RTMPConnection rtmpConn = (RTMPConnection) conn; Channel channel = rtmpConn.getChannel(rtmpConn.getChannelIdForStreamId(streamId)); channel.sendStatus(s); } else { throw new RuntimeException("Connection is not RTMPConnection: " + conn); } }
[ "public", "static", "void", "sendNetStreamStatus", "(", "IConnection", "conn", ",", "String", "statusCode", ",", "String", "description", ",", "String", "name", ",", "String", "status", ",", "Number", "streamId", ")", "{", "if", "(", "conn", "instanceof", "RTMPConnection", ")", "{", "Status", "s", "=", "new", "Status", "(", "statusCode", ")", ";", "s", ".", "setClientid", "(", "streamId", ")", ";", "s", ".", "setDesciption", "(", "description", ")", ";", "s", ".", "setDetails", "(", "name", ")", ";", "s", ".", "setLevel", "(", "status", ")", ";", "// get the channel\r", "RTMPConnection", "rtmpConn", "=", "(", "RTMPConnection", ")", "conn", ";", "Channel", "channel", "=", "rtmpConn", ".", "getChannel", "(", "rtmpConn", ".", "getChannelIdForStreamId", "(", "streamId", ")", ")", ";", "channel", ".", "sendStatus", "(", "s", ")", ";", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"Connection is not RTMPConnection: \"", "+", "conn", ")", ";", "}", "}" ]
Send NetStream.Status to the client. @param conn connection @param statusCode NetStream status code @param description description @param name name @param status The status - error, warning, or status @param streamId stream id
[ "Send", "NetStream", ".", "Status", "to", "the", "client", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/StreamService.java#L834-L848
biezhi/anima
src/main/java/io/github/biezhi/anima/Anima.java
Anima.open
public static Anima open(String url, String user, String pass) { """ Create anima with url and db info @param url jdbc url @param user database username @param pass database password @return Anima """ return open(url, user, pass, QuirksDetector.forURL(url)); }
java
public static Anima open(String url, String user, String pass) { return open(url, user, pass, QuirksDetector.forURL(url)); }
[ "public", "static", "Anima", "open", "(", "String", "url", ",", "String", "user", ",", "String", "pass", ")", "{", "return", "open", "(", "url", ",", "user", ",", "pass", ",", "QuirksDetector", ".", "forURL", "(", "url", ")", ")", ";", "}" ]
Create anima with url and db info @param url jdbc url @param user database username @param pass database password @return Anima
[ "Create", "anima", "with", "url", "and", "db", "info" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/Anima.java#L199-L201
casmi/casmi
src/main/java/casmi/graphics/Graphics.java
Graphics.setPerspective
public void setPerspective(double fov, double aspect, double zNear, double zFar) { """ Sets a perspective projection applying foreshortening, making distant objects appear smaller than closer ones. The parameters define a viewing volume with the shape of truncated pyramid. Objects near to the front of the volume appear their actual size, while farther objects appear smaller. This projection simulates the perspective of the world more accurately than orthographic projection. @param fov field-of-view angle for vertical direction @param aspect ratio of width to height @param zNear z-position of nearest clipping plane @param zFar z-position of nearest farthest plane """ matrixMode(MatrixMode.PROJECTION); resetMatrix(); glu.gluPerspective(fov, aspect, zNear, zFar); matrixMode(MatrixMode.MODELVIEW); resetMatrix(); }
java
public void setPerspective(double fov, double aspect, double zNear, double zFar) { matrixMode(MatrixMode.PROJECTION); resetMatrix(); glu.gluPerspective(fov, aspect, zNear, zFar); matrixMode(MatrixMode.MODELVIEW); resetMatrix(); }
[ "public", "void", "setPerspective", "(", "double", "fov", ",", "double", "aspect", ",", "double", "zNear", ",", "double", "zFar", ")", "{", "matrixMode", "(", "MatrixMode", ".", "PROJECTION", ")", ";", "resetMatrix", "(", ")", ";", "glu", ".", "gluPerspective", "(", "fov", ",", "aspect", ",", "zNear", ",", "zFar", ")", ";", "matrixMode", "(", "MatrixMode", ".", "MODELVIEW", ")", ";", "resetMatrix", "(", ")", ";", "}" ]
Sets a perspective projection applying foreshortening, making distant objects appear smaller than closer ones. The parameters define a viewing volume with the shape of truncated pyramid. Objects near to the front of the volume appear their actual size, while farther objects appear smaller. This projection simulates the perspective of the world more accurately than orthographic projection. @param fov field-of-view angle for vertical direction @param aspect ratio of width to height @param zNear z-position of nearest clipping plane @param zFar z-position of nearest farthest plane
[ "Sets", "a", "perspective", "projection", "applying", "foreshortening", "making", "distant", "objects", "appear", "smaller", "than", "closer", "ones", ".", "The", "parameters", "define", "a", "viewing", "volume", "with", "the", "shape", "of", "truncated", "pyramid", ".", "Objects", "near", "to", "the", "front", "of", "the", "volume", "appear", "their", "actual", "size", "while", "farther", "objects", "appear", "smaller", ".", "This", "projection", "simulates", "the", "perspective", "of", "the", "world", "more", "accurately", "than", "orthographic", "projection", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/Graphics.java#L730-L736
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java
ClustersInner.rotateDiskEncryptionKeyAsync
public Observable<Void> rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { """ Rotate disk encryption key of the specified HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The parameters for the disk encryption operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return rotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { return rotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "rotateDiskEncryptionKeyAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "ClusterDiskEncryptionParameters", "parameters", ")", "{", "return", "rotateDiskEncryptionKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Rotate disk encryption key of the specified HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The parameters for the disk encryption operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Rotate", "disk", "encryption", "key", "of", "the", "specified", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1320-L1327
molgenis/molgenis
molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/importer/repository/OntologyRepositoryCollection.java
OntologyRepositoryCollection.createNodePaths
private void createNodePaths() { """ Creates {@link OntologyTermNodePathMetadata} {@link Entity}s for an entire ontology tree and writes them to the {@link #nodePathsPerOntologyTerm} {@link Multimap}. """ TreeTraverser<OWLClassContainer> traverser = new TreeTraverser<OWLClassContainer>() { @Override public Iterable<OWLClassContainer> children(OWLClassContainer container) { int count = 0; List<OWLClassContainer> containers = new ArrayList<>(); for (OWLClass childClass : loader.getChildClass(container.getOwlClass())) { containers.add( new OWLClassContainer( childClass, constructNodePath(container.getNodePath(), count), false)); count++; } return containers; } }; OWLClass pseudoRootClass = loader.createClass(PSEUDO_ROOT_CLASS_LABEL, loader.getRootClasses()); for (OWLClassContainer container : traverser.preOrderTraversal( new OWLClassContainer(pseudoRootClass, PSEUDO_ROOT_CLASS_NODEPATH, true))) { OWLClass ontologyTerm = container.getOwlClass(); String ontologyTermNodePath = container.getNodePath(); String ontologyTermIRI = ontologyTerm.getIRI().toString(); OntologyTermNodePath nodePathEntity = createNodePathEntity(container, ontologyTermNodePath); nodePathsPerOntologyTerm.put(ontologyTermIRI, nodePathEntity); } }
java
private void createNodePaths() { TreeTraverser<OWLClassContainer> traverser = new TreeTraverser<OWLClassContainer>() { @Override public Iterable<OWLClassContainer> children(OWLClassContainer container) { int count = 0; List<OWLClassContainer> containers = new ArrayList<>(); for (OWLClass childClass : loader.getChildClass(container.getOwlClass())) { containers.add( new OWLClassContainer( childClass, constructNodePath(container.getNodePath(), count), false)); count++; } return containers; } }; OWLClass pseudoRootClass = loader.createClass(PSEUDO_ROOT_CLASS_LABEL, loader.getRootClasses()); for (OWLClassContainer container : traverser.preOrderTraversal( new OWLClassContainer(pseudoRootClass, PSEUDO_ROOT_CLASS_NODEPATH, true))) { OWLClass ontologyTerm = container.getOwlClass(); String ontologyTermNodePath = container.getNodePath(); String ontologyTermIRI = ontologyTerm.getIRI().toString(); OntologyTermNodePath nodePathEntity = createNodePathEntity(container, ontologyTermNodePath); nodePathsPerOntologyTerm.put(ontologyTermIRI, nodePathEntity); } }
[ "private", "void", "createNodePaths", "(", ")", "{", "TreeTraverser", "<", "OWLClassContainer", ">", "traverser", "=", "new", "TreeTraverser", "<", "OWLClassContainer", ">", "(", ")", "{", "@", "Override", "public", "Iterable", "<", "OWLClassContainer", ">", "children", "(", "OWLClassContainer", "container", ")", "{", "int", "count", "=", "0", ";", "List", "<", "OWLClassContainer", ">", "containers", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "OWLClass", "childClass", ":", "loader", ".", "getChildClass", "(", "container", ".", "getOwlClass", "(", ")", ")", ")", "{", "containers", ".", "add", "(", "new", "OWLClassContainer", "(", "childClass", ",", "constructNodePath", "(", "container", ".", "getNodePath", "(", ")", ",", "count", ")", ",", "false", ")", ")", ";", "count", "++", ";", "}", "return", "containers", ";", "}", "}", ";", "OWLClass", "pseudoRootClass", "=", "loader", ".", "createClass", "(", "PSEUDO_ROOT_CLASS_LABEL", ",", "loader", ".", "getRootClasses", "(", ")", ")", ";", "for", "(", "OWLClassContainer", "container", ":", "traverser", ".", "preOrderTraversal", "(", "new", "OWLClassContainer", "(", "pseudoRootClass", ",", "PSEUDO_ROOT_CLASS_NODEPATH", ",", "true", ")", ")", ")", "{", "OWLClass", "ontologyTerm", "=", "container", ".", "getOwlClass", "(", ")", ";", "String", "ontologyTermNodePath", "=", "container", ".", "getNodePath", "(", ")", ";", "String", "ontologyTermIRI", "=", "ontologyTerm", ".", "getIRI", "(", ")", ".", "toString", "(", ")", ";", "OntologyTermNodePath", "nodePathEntity", "=", "createNodePathEntity", "(", "container", ",", "ontologyTermNodePath", ")", ";", "nodePathsPerOntologyTerm", ".", "put", "(", "ontologyTermIRI", ",", "nodePathEntity", ")", ";", "}", "}" ]
Creates {@link OntologyTermNodePathMetadata} {@link Entity}s for an entire ontology tree and writes them to the {@link #nodePathsPerOntologyTerm} {@link Multimap}.
[ "Creates", "{" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/importer/repository/OntologyRepositoryCollection.java#L166-L194
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java
FineUploader5Session.setCustomHeaders
@Nonnull public FineUploader5Session setCustomHeaders (@Nullable final Map <String, String> aCustomHeaders) { """ Any additional headers you would like included with the GET request sent to your server. Ignored in IE9 and IE8 if the endpoint is cross-origin. @param aCustomHeaders Custom headers to be set. @return this """ m_aSessionCustomHeaders.setAll (aCustomHeaders); return this; }
java
@Nonnull public FineUploader5Session setCustomHeaders (@Nullable final Map <String, String> aCustomHeaders) { m_aSessionCustomHeaders.setAll (aCustomHeaders); return this; }
[ "@", "Nonnull", "public", "FineUploader5Session", "setCustomHeaders", "(", "@", "Nullable", "final", "Map", "<", "String", ",", "String", ">", "aCustomHeaders", ")", "{", "m_aSessionCustomHeaders", ".", "setAll", "(", "aCustomHeaders", ")", ";", "return", "this", ";", "}" ]
Any additional headers you would like included with the GET request sent to your server. Ignored in IE9 and IE8 if the endpoint is cross-origin. @param aCustomHeaders Custom headers to be set. @return this
[ "Any", "additional", "headers", "you", "would", "like", "included", "with", "the", "GET", "request", "sent", "to", "your", "server", ".", "Ignored", "in", "IE9", "and", "IE8", "if", "the", "endpoint", "is", "cross", "-", "origin", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java#L64-L69
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/helper/CheckPointHelper.java
CheckPointHelper.replaceExceptionCallback
public CheckPointHelper replaceExceptionCallback(BasicCheckRule checkRule, ValidationInvalidCallback cb) { """ Replace the callback to be used basic exception. @param checkRule basic rule type ex,, BasicCheckRule.Mandatory @param cb callback class with implement ValidationInvalidCallback @return CheckPointHeler check point helper """ this.msgChecker.replaceCallback(checkRule, cb); return this; }
java
public CheckPointHelper replaceExceptionCallback(BasicCheckRule checkRule, ValidationInvalidCallback cb) { this.msgChecker.replaceCallback(checkRule, cb); return this; }
[ "public", "CheckPointHelper", "replaceExceptionCallback", "(", "BasicCheckRule", "checkRule", ",", "ValidationInvalidCallback", "cb", ")", "{", "this", ".", "msgChecker", ".", "replaceCallback", "(", "checkRule", ",", "cb", ")", ";", "return", "this", ";", "}" ]
Replace the callback to be used basic exception. @param checkRule basic rule type ex,, BasicCheckRule.Mandatory @param cb callback class with implement ValidationInvalidCallback @return CheckPointHeler check point helper
[ "Replace", "the", "callback", "to", "be", "used", "basic", "exception", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/helper/CheckPointHelper.java#L49-L52
zaproxy/zaproxy
src/org/zaproxy/zap/extension/authentication/ExtensionAuthentication.java
ExtensionAuthentication.getPopupFlagLoggedOutIndicatorMenu
private PopupContextMenuItemFactory getPopupFlagLoggedOutIndicatorMenu() { """ Gets the popup menu for flagging the "Logged out" pattern. @return the popup menu """ if (this.popupFlagLoggedOutIndicatorMenuFactory == null) { popupFlagLoggedOutIndicatorMenuFactory = new PopupContextMenuItemFactory("dd - " + Constant.messages.getString("context.flag.popup")) { private static final long serialVersionUID = 2453839120088204123L; @Override public ExtensionPopupMenuItem getContextMenu(Context context, String parentMenu) { return new PopupFlagLoggedOutIndicatorMenu(context); } }; } return this.popupFlagLoggedOutIndicatorMenuFactory; }
java
private PopupContextMenuItemFactory getPopupFlagLoggedOutIndicatorMenu() { if (this.popupFlagLoggedOutIndicatorMenuFactory == null) { popupFlagLoggedOutIndicatorMenuFactory = new PopupContextMenuItemFactory("dd - " + Constant.messages.getString("context.flag.popup")) { private static final long serialVersionUID = 2453839120088204123L; @Override public ExtensionPopupMenuItem getContextMenu(Context context, String parentMenu) { return new PopupFlagLoggedOutIndicatorMenu(context); } }; } return this.popupFlagLoggedOutIndicatorMenuFactory; }
[ "private", "PopupContextMenuItemFactory", "getPopupFlagLoggedOutIndicatorMenu", "(", ")", "{", "if", "(", "this", ".", "popupFlagLoggedOutIndicatorMenuFactory", "==", "null", ")", "{", "popupFlagLoggedOutIndicatorMenuFactory", "=", "new", "PopupContextMenuItemFactory", "(", "\"dd - \"", "+", "Constant", ".", "messages", ".", "getString", "(", "\"context.flag.popup\"", ")", ")", "{", "private", "static", "final", "long", "serialVersionUID", "=", "2453839120088204123L", ";", "@", "Override", "public", "ExtensionPopupMenuItem", "getContextMenu", "(", "Context", "context", ",", "String", "parentMenu", ")", "{", "return", "new", "PopupFlagLoggedOutIndicatorMenu", "(", "context", ")", ";", "}", "}", ";", "}", "return", "this", ".", "popupFlagLoggedOutIndicatorMenuFactory", ";", "}" ]
Gets the popup menu for flagging the "Logged out" pattern. @return the popup menu
[ "Gets", "the", "popup", "menu", "for", "flagging", "the", "Logged", "out", "pattern", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/authentication/ExtensionAuthentication.java#L178-L193
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java
DeprecatedAPIListBuilder.composeDeprecatedList
private void composeDeprecatedList(SortedSet<Element> rset, SortedSet<Element> sset, List<? extends Element> members) { """ Add the members into a single list of deprecated members. @param rset set of elements deprecated for removal. @param sset set of deprecated elements. @param list List of all the particular deprecated members, e.g. methods. @param members members to be added in the list. """ for (Element member : members) { if (utils.isDeprecatedForRemoval(member)) { rset.add(member); } if (utils.isDeprecated(member)) { sset.add(member); } } }
java
private void composeDeprecatedList(SortedSet<Element> rset, SortedSet<Element> sset, List<? extends Element> members) { for (Element member : members) { if (utils.isDeprecatedForRemoval(member)) { rset.add(member); } if (utils.isDeprecated(member)) { sset.add(member); } } }
[ "private", "void", "composeDeprecatedList", "(", "SortedSet", "<", "Element", ">", "rset", ",", "SortedSet", "<", "Element", ">", "sset", ",", "List", "<", "?", "extends", "Element", ">", "members", ")", "{", "for", "(", "Element", "member", ":", "members", ")", "{", "if", "(", "utils", ".", "isDeprecatedForRemoval", "(", "member", ")", ")", "{", "rset", ".", "add", "(", "member", ")", ";", "}", "if", "(", "utils", ".", "isDeprecated", "(", "member", ")", ")", "{", "sset", ".", "add", "(", "member", ")", ";", "}", "}", "}" ]
Add the members into a single list of deprecated members. @param rset set of elements deprecated for removal. @param sset set of deprecated elements. @param list List of all the particular deprecated members, e.g. methods. @param members members to be added in the list.
[ "Add", "the", "members", "into", "a", "single", "list", "of", "deprecated", "members", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java#L173-L182
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java
RepositoryResolver.createInstallList
List<RepositoryResource> createInstallList(String featureName) { """ Create a list of resources which should be installed in order to install the given featutre. <p> The install list consists of all the dependencies which are needed by {@code esa}, ordered so that each resource in the list comes after its dependencies. @param featureName the feature name (as provided to {@link #resolve(Collection)}) for which to create an install list @return the ordered list of resources to install, will be empty if the feature cannot be found or is already installed """ ProvisioningFeatureDefinition feature = resolverRepository.getFeature(featureName); if (feature == null) { // Feature missing missingTopLevelRequirements.add(featureName); // If we didn't find this feature in another product, we need to record it as missing if (!requirementsFoundForOtherProducts.contains(featureName)) { missingRequirements.add(new MissingRequirement(featureName, null)); } return Collections.emptyList(); } if (!(feature instanceof KernelResolverEsa)) { // Feature already installed return Collections.emptyList(); } EsaResource esa = ((KernelResolverEsa) feature).getResource(); Map<String, Integer> maxDistanceMap = new HashMap<>(); List<MissingRequirement> missingRequirements = new ArrayList<>(); boolean foundAllDependencies = populateMaxDistanceMap(maxDistanceMap, esa.getProvideFeature(), 0, new HashSet<ProvisioningFeatureDefinition>(), missingRequirements); if (!foundAllDependencies) { missingTopLevelRequirements.add(featureName); this.missingRequirements.addAll(missingRequirements); } ArrayList<RepositoryResource> installList = new ArrayList<>(); installList.addAll(convertFeatureNamesToResources(maxDistanceMap.keySet())); Collections.sort(installList, byMaxDistance(maxDistanceMap)); return installList; }
java
List<RepositoryResource> createInstallList(String featureName) { ProvisioningFeatureDefinition feature = resolverRepository.getFeature(featureName); if (feature == null) { // Feature missing missingTopLevelRequirements.add(featureName); // If we didn't find this feature in another product, we need to record it as missing if (!requirementsFoundForOtherProducts.contains(featureName)) { missingRequirements.add(new MissingRequirement(featureName, null)); } return Collections.emptyList(); } if (!(feature instanceof KernelResolverEsa)) { // Feature already installed return Collections.emptyList(); } EsaResource esa = ((KernelResolverEsa) feature).getResource(); Map<String, Integer> maxDistanceMap = new HashMap<>(); List<MissingRequirement> missingRequirements = new ArrayList<>(); boolean foundAllDependencies = populateMaxDistanceMap(maxDistanceMap, esa.getProvideFeature(), 0, new HashSet<ProvisioningFeatureDefinition>(), missingRequirements); if (!foundAllDependencies) { missingTopLevelRequirements.add(featureName); this.missingRequirements.addAll(missingRequirements); } ArrayList<RepositoryResource> installList = new ArrayList<>(); installList.addAll(convertFeatureNamesToResources(maxDistanceMap.keySet())); Collections.sort(installList, byMaxDistance(maxDistanceMap)); return installList; }
[ "List", "<", "RepositoryResource", ">", "createInstallList", "(", "String", "featureName", ")", "{", "ProvisioningFeatureDefinition", "feature", "=", "resolverRepository", ".", "getFeature", "(", "featureName", ")", ";", "if", "(", "feature", "==", "null", ")", "{", "// Feature missing", "missingTopLevelRequirements", ".", "add", "(", "featureName", ")", ";", "// If we didn't find this feature in another product, we need to record it as missing", "if", "(", "!", "requirementsFoundForOtherProducts", ".", "contains", "(", "featureName", ")", ")", "{", "missingRequirements", ".", "add", "(", "new", "MissingRequirement", "(", "featureName", ",", "null", ")", ")", ";", "}", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "if", "(", "!", "(", "feature", "instanceof", "KernelResolverEsa", ")", ")", "{", "// Feature already installed", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "EsaResource", "esa", "=", "(", "(", "KernelResolverEsa", ")", "feature", ")", ".", "getResource", "(", ")", ";", "Map", "<", "String", ",", "Integer", ">", "maxDistanceMap", "=", "new", "HashMap", "<>", "(", ")", ";", "List", "<", "MissingRequirement", ">", "missingRequirements", "=", "new", "ArrayList", "<>", "(", ")", ";", "boolean", "foundAllDependencies", "=", "populateMaxDistanceMap", "(", "maxDistanceMap", ",", "esa", ".", "getProvideFeature", "(", ")", ",", "0", ",", "new", "HashSet", "<", "ProvisioningFeatureDefinition", ">", "(", ")", ",", "missingRequirements", ")", ";", "if", "(", "!", "foundAllDependencies", ")", "{", "missingTopLevelRequirements", ".", "add", "(", "featureName", ")", ";", "this", ".", "missingRequirements", ".", "addAll", "(", "missingRequirements", ")", ";", "}", "ArrayList", "<", "RepositoryResource", ">", "installList", "=", "new", "ArrayList", "<>", "(", ")", ";", "installList", ".", "addAll", "(", "convertFeatureNamesToResources", "(", "maxDistanceMap", ".", "keySet", "(", ")", ")", ")", ";", "Collections", ".", "sort", "(", "installList", ",", "byMaxDistance", "(", "maxDistanceMap", ")", ")", ";", "return", "installList", ";", "}" ]
Create a list of resources which should be installed in order to install the given featutre. <p> The install list consists of all the dependencies which are needed by {@code esa}, ordered so that each resource in the list comes after its dependencies. @param featureName the feature name (as provided to {@link #resolve(Collection)}) for which to create an install list @return the ordered list of resources to install, will be empty if the feature cannot be found or is already installed
[ "Create", "a", "list", "of", "resources", "which", "should", "be", "installed", "in", "order", "to", "install", "the", "given", "featutre", ".", "<p", ">", "The", "install", "list", "consists", "of", "all", "the", "dependencies", "which", "are", "needed", "by", "{", "@code", "esa", "}", "ordered", "so", "that", "each", "resource", "in", "the", "list", "comes", "after", "its", "dependencies", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java#L545-L579
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/FullMappingPropertiesBasedBundlesHandlerFactory.java
FullMappingPropertiesBasedBundlesHandlerFactory.getResourceBundles
public List<JoinableResourceBundle> getResourceBundles(Properties properties) { """ Returns the list of joinable resource bundle @param properties the properties @return the list of joinable resource bundle """ PropertiesConfigHelper props = new PropertiesConfigHelper(properties, resourceType); String fileExtension = "." + resourceType; // Initialize custom bundles List<JoinableResourceBundle> customBundles = new ArrayList<>(); // Check if we should use the bundle names property or // find the bundle name using the bundle id declaration : // jawr.<type>.bundle.<name>.id if (null != props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES)) { StringTokenizer tk = new StringTokenizer( props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES), ","); while (tk.hasMoreTokens()) { customBundles .add(buildJoinableResourceBundle(props, tk.nextToken().trim(), fileExtension, rsReaderHandler)); } } else { Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator(); while (bundleNames.hasNext()) { customBundles .add(buildJoinableResourceBundle(props, bundleNames.next(), fileExtension, rsReaderHandler)); } } // Initialize the bundles dependencies Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator(); while (bundleNames.hasNext()) { String bundleName = (String) bundleNames.next(); List<String> bundleNameDependencies = props.getCustomBundlePropertyAsList(bundleName, PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_DEPENDENCIES); if (!bundleNameDependencies.isEmpty()) { JoinableResourceBundle bundle = getBundleFromName(bundleName, customBundles); List<JoinableResourceBundle> bundleDependencies = getBundlesFromName(bundleNameDependencies, customBundles); bundle.setDependencies(bundleDependencies); } } return customBundles; }
java
public List<JoinableResourceBundle> getResourceBundles(Properties properties) { PropertiesConfigHelper props = new PropertiesConfigHelper(properties, resourceType); String fileExtension = "." + resourceType; // Initialize custom bundles List<JoinableResourceBundle> customBundles = new ArrayList<>(); // Check if we should use the bundle names property or // find the bundle name using the bundle id declaration : // jawr.<type>.bundle.<name>.id if (null != props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES)) { StringTokenizer tk = new StringTokenizer( props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES), ","); while (tk.hasMoreTokens()) { customBundles .add(buildJoinableResourceBundle(props, tk.nextToken().trim(), fileExtension, rsReaderHandler)); } } else { Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator(); while (bundleNames.hasNext()) { customBundles .add(buildJoinableResourceBundle(props, bundleNames.next(), fileExtension, rsReaderHandler)); } } // Initialize the bundles dependencies Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator(); while (bundleNames.hasNext()) { String bundleName = (String) bundleNames.next(); List<String> bundleNameDependencies = props.getCustomBundlePropertyAsList(bundleName, PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_DEPENDENCIES); if (!bundleNameDependencies.isEmpty()) { JoinableResourceBundle bundle = getBundleFromName(bundleName, customBundles); List<JoinableResourceBundle> bundleDependencies = getBundlesFromName(bundleNameDependencies, customBundles); bundle.setDependencies(bundleDependencies); } } return customBundles; }
[ "public", "List", "<", "JoinableResourceBundle", ">", "getResourceBundles", "(", "Properties", "properties", ")", "{", "PropertiesConfigHelper", "props", "=", "new", "PropertiesConfigHelper", "(", "properties", ",", "resourceType", ")", ";", "String", "fileExtension", "=", "\".\"", "+", "resourceType", ";", "// Initialize custom bundles", "List", "<", "JoinableResourceBundle", ">", "customBundles", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Check if we should use the bundle names property or", "// find the bundle name using the bundle id declaration :", "// jawr.<type>.bundle.<name>.id", "if", "(", "null", "!=", "props", ".", "getProperty", "(", "PropertiesBundleConstant", ".", "BUNDLE_FACTORY_CUSTOM_NAMES", ")", ")", "{", "StringTokenizer", "tk", "=", "new", "StringTokenizer", "(", "props", ".", "getProperty", "(", "PropertiesBundleConstant", ".", "BUNDLE_FACTORY_CUSTOM_NAMES", ")", ",", "\",\"", ")", ";", "while", "(", "tk", ".", "hasMoreTokens", "(", ")", ")", "{", "customBundles", ".", "add", "(", "buildJoinableResourceBundle", "(", "props", ",", "tk", ".", "nextToken", "(", ")", ".", "trim", "(", ")", ",", "fileExtension", ",", "rsReaderHandler", ")", ")", ";", "}", "}", "else", "{", "Iterator", "<", "String", ">", "bundleNames", "=", "props", ".", "getPropertyBundleNameSet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "bundleNames", ".", "hasNext", "(", ")", ")", "{", "customBundles", ".", "add", "(", "buildJoinableResourceBundle", "(", "props", ",", "bundleNames", ".", "next", "(", ")", ",", "fileExtension", ",", "rsReaderHandler", ")", ")", ";", "}", "}", "// Initialize the bundles dependencies", "Iterator", "<", "String", ">", "bundleNames", "=", "props", ".", "getPropertyBundleNameSet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "bundleNames", ".", "hasNext", "(", ")", ")", "{", "String", "bundleName", "=", "(", "String", ")", "bundleNames", ".", "next", "(", ")", ";", "List", "<", "String", ">", "bundleNameDependencies", "=", "props", ".", "getCustomBundlePropertyAsList", "(", "bundleName", ",", "PropertiesBundleConstant", ".", "BUNDLE_FACTORY_CUSTOM_DEPENDENCIES", ")", ";", "if", "(", "!", "bundleNameDependencies", ".", "isEmpty", "(", ")", ")", "{", "JoinableResourceBundle", "bundle", "=", "getBundleFromName", "(", "bundleName", ",", "customBundles", ")", ";", "List", "<", "JoinableResourceBundle", ">", "bundleDependencies", "=", "getBundlesFromName", "(", "bundleNameDependencies", ",", "customBundles", ")", ";", "bundle", ".", "setDependencies", "(", "bundleDependencies", ")", ";", "}", "}", "return", "customBundles", ";", "}" ]
Returns the list of joinable resource bundle @param properties the properties @return the list of joinable resource bundle
[ "Returns", "the", "list", "of", "joinable", "resource", "bundle" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/FullMappingPropertiesBasedBundlesHandlerFactory.java#L97-L137
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java
CmsContainerpageHandler.createElementViewSelectionMenuEntry
protected I_CmsContextMenuEntry createElementViewSelectionMenuEntry() { """ Creates the element view selection menu entry, returns <code>null</code> in case no other views available.<p> @return the menu entry """ List<CmsElementViewInfo> elementViews = m_controller.getData().getElementViews(); if (elementViews.size() > 1) { CmsContextMenuEntry parentEntry = new CmsContextMenuEntry(this, null, new I_CmsContextMenuCommand() { public void execute( CmsUUID innerStructureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { // do nothing } public A_CmsContextMenuItem getItemWidget( CmsUUID innerStructureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { return null; } public boolean hasItemWidget() { return false; } }); CmsContextMenuEntryBean parentBean = new CmsContextMenuEntryBean(); parentBean.setLabel(Messages.get().key(Messages.GUI_SELECT_ELEMENT_VIEW_0)); parentBean.setActive(true); parentBean.setVisible(true); parentEntry.setBean(parentBean); List<I_CmsContextMenuEntry> viewEntries = new ArrayList<I_CmsContextMenuEntry>(); for (CmsElementViewInfo viewInfo : elementViews) { if (viewInfo.isRoot()) { viewEntries.add( createMenuEntryForElementView( viewInfo, m_controller.matchRootView(viewInfo.getElementViewId()), this)); } } parentEntry.setSubMenu(viewEntries); return parentEntry; } else { return null; } }
java
protected I_CmsContextMenuEntry createElementViewSelectionMenuEntry() { List<CmsElementViewInfo> elementViews = m_controller.getData().getElementViews(); if (elementViews.size() > 1) { CmsContextMenuEntry parentEntry = new CmsContextMenuEntry(this, null, new I_CmsContextMenuCommand() { public void execute( CmsUUID innerStructureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { // do nothing } public A_CmsContextMenuItem getItemWidget( CmsUUID innerStructureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { return null; } public boolean hasItemWidget() { return false; } }); CmsContextMenuEntryBean parentBean = new CmsContextMenuEntryBean(); parentBean.setLabel(Messages.get().key(Messages.GUI_SELECT_ELEMENT_VIEW_0)); parentBean.setActive(true); parentBean.setVisible(true); parentEntry.setBean(parentBean); List<I_CmsContextMenuEntry> viewEntries = new ArrayList<I_CmsContextMenuEntry>(); for (CmsElementViewInfo viewInfo : elementViews) { if (viewInfo.isRoot()) { viewEntries.add( createMenuEntryForElementView( viewInfo, m_controller.matchRootView(viewInfo.getElementViewId()), this)); } } parentEntry.setSubMenu(viewEntries); return parentEntry; } else { return null; } }
[ "protected", "I_CmsContextMenuEntry", "createElementViewSelectionMenuEntry", "(", ")", "{", "List", "<", "CmsElementViewInfo", ">", "elementViews", "=", "m_controller", ".", "getData", "(", ")", ".", "getElementViews", "(", ")", ";", "if", "(", "elementViews", ".", "size", "(", ")", ">", "1", ")", "{", "CmsContextMenuEntry", "parentEntry", "=", "new", "CmsContextMenuEntry", "(", "this", ",", "null", ",", "new", "I_CmsContextMenuCommand", "(", ")", "{", "public", "void", "execute", "(", "CmsUUID", "innerStructureId", ",", "I_CmsContextMenuHandler", "handler", ",", "CmsContextMenuEntryBean", "bean", ")", "{", "// do nothing", "}", "public", "A_CmsContextMenuItem", "getItemWidget", "(", "CmsUUID", "innerStructureId", ",", "I_CmsContextMenuHandler", "handler", ",", "CmsContextMenuEntryBean", "bean", ")", "{", "return", "null", ";", "}", "public", "boolean", "hasItemWidget", "(", ")", "{", "return", "false", ";", "}", "}", ")", ";", "CmsContextMenuEntryBean", "parentBean", "=", "new", "CmsContextMenuEntryBean", "(", ")", ";", "parentBean", ".", "setLabel", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_SELECT_ELEMENT_VIEW_0", ")", ")", ";", "parentBean", ".", "setActive", "(", "true", ")", ";", "parentBean", ".", "setVisible", "(", "true", ")", ";", "parentEntry", ".", "setBean", "(", "parentBean", ")", ";", "List", "<", "I_CmsContextMenuEntry", ">", "viewEntries", "=", "new", "ArrayList", "<", "I_CmsContextMenuEntry", ">", "(", ")", ";", "for", "(", "CmsElementViewInfo", "viewInfo", ":", "elementViews", ")", "{", "if", "(", "viewInfo", ".", "isRoot", "(", ")", ")", "{", "viewEntries", ".", "add", "(", "createMenuEntryForElementView", "(", "viewInfo", ",", "m_controller", ".", "matchRootView", "(", "viewInfo", ".", "getElementViewId", "(", ")", ")", ",", "this", ")", ")", ";", "}", "}", "parentEntry", ".", "setSubMenu", "(", "viewEntries", ")", ";", "return", "parentEntry", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Creates the element view selection menu entry, returns <code>null</code> in case no other views available.<p> @return the menu entry
[ "Creates", "the", "element", "view", "selection", "menu", "entry", "returns", "<code", ">", "null<", "/", "code", ">", "in", "case", "no", "other", "views", "available", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java#L1206-L1256
Stratio/bdt
src/main/java/com/stratio/qa/specs/CommandExecutionSpec.java
CommandExecutionSpec.openSSHConnection
@Given("^I open a ssh connection to '(.+?)'( in port '(.+?)')? with user '(.+?)'( and password '(.+?)')?( using pem file '(.+?)')?$") public void openSSHConnection(String remoteHost, String tmp, String remotePort, String user, String foo, String password, String bar, String pemFile) throws Exception { """ Opens a ssh connection to remote host @param remoteHost remote host @param user remote user @param password (required if pemFile null) @param pemFile (required if password null) @throws Exception exception """ if ((pemFile == null) || (pemFile.equals("none"))) { if (password == null) { throw new Exception("You have to provide a password or a pem file to be used for connection"); } commonspec.setRemoteSSHConnection(new RemoteSSHConnection(user, password, remoteHost, remotePort, null)); commonspec.getLogger().debug("Opening ssh connection with password: { " + password + "}", commonspec.getRemoteSSHConnection()); } else { File pem = new File(pemFile); if (!pem.exists()) { throw new Exception("Pem file: " + pemFile + " does not exist"); } commonspec.setRemoteSSHConnection(new RemoteSSHConnection(user, null, remoteHost, remotePort, pemFile)); commonspec.getLogger().debug("Opening ssh connection with pemFile: {}", commonspec.getRemoteSSHConnection()); } }
java
@Given("^I open a ssh connection to '(.+?)'( in port '(.+?)')? with user '(.+?)'( and password '(.+?)')?( using pem file '(.+?)')?$") public void openSSHConnection(String remoteHost, String tmp, String remotePort, String user, String foo, String password, String bar, String pemFile) throws Exception { if ((pemFile == null) || (pemFile.equals("none"))) { if (password == null) { throw new Exception("You have to provide a password or a pem file to be used for connection"); } commonspec.setRemoteSSHConnection(new RemoteSSHConnection(user, password, remoteHost, remotePort, null)); commonspec.getLogger().debug("Opening ssh connection with password: { " + password + "}", commonspec.getRemoteSSHConnection()); } else { File pem = new File(pemFile); if (!pem.exists()) { throw new Exception("Pem file: " + pemFile + " does not exist"); } commonspec.setRemoteSSHConnection(new RemoteSSHConnection(user, null, remoteHost, remotePort, pemFile)); commonspec.getLogger().debug("Opening ssh connection with pemFile: {}", commonspec.getRemoteSSHConnection()); } }
[ "@", "Given", "(", "\"^I open a ssh connection to '(.+?)'( in port '(.+?)')? with user '(.+?)'( and password '(.+?)')?( using pem file '(.+?)')?$\"", ")", "public", "void", "openSSHConnection", "(", "String", "remoteHost", ",", "String", "tmp", ",", "String", "remotePort", ",", "String", "user", ",", "String", "foo", ",", "String", "password", ",", "String", "bar", ",", "String", "pemFile", ")", "throws", "Exception", "{", "if", "(", "(", "pemFile", "==", "null", ")", "||", "(", "pemFile", ".", "equals", "(", "\"none\"", ")", ")", ")", "{", "if", "(", "password", "==", "null", ")", "{", "throw", "new", "Exception", "(", "\"You have to provide a password or a pem file to be used for connection\"", ")", ";", "}", "commonspec", ".", "setRemoteSSHConnection", "(", "new", "RemoteSSHConnection", "(", "user", ",", "password", ",", "remoteHost", ",", "remotePort", ",", "null", ")", ")", ";", "commonspec", ".", "getLogger", "(", ")", ".", "debug", "(", "\"Opening ssh connection with password: { \"", "+", "password", "+", "\"}\"", ",", "commonspec", ".", "getRemoteSSHConnection", "(", ")", ")", ";", "}", "else", "{", "File", "pem", "=", "new", "File", "(", "pemFile", ")", ";", "if", "(", "!", "pem", ".", "exists", "(", ")", ")", "{", "throw", "new", "Exception", "(", "\"Pem file: \"", "+", "pemFile", "+", "\" does not exist\"", ")", ";", "}", "commonspec", ".", "setRemoteSSHConnection", "(", "new", "RemoteSSHConnection", "(", "user", ",", "null", ",", "remoteHost", ",", "remotePort", ",", "pemFile", ")", ")", ";", "commonspec", ".", "getLogger", "(", ")", ".", "debug", "(", "\"Opening ssh connection with pemFile: {}\"", ",", "commonspec", ".", "getRemoteSSHConnection", "(", ")", ")", ";", "}", "}" ]
Opens a ssh connection to remote host @param remoteHost remote host @param user remote user @param password (required if pemFile null) @param pemFile (required if password null) @throws Exception exception
[ "Opens", "a", "ssh", "connection", "to", "remote", "host" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommandExecutionSpec.java#L52-L68
voldemort/voldemort
src/java/voldemort/client/scheduler/AsyncMetadataVersionManager.java
AsyncMetadataVersionManager.fetchNewVersion
public Long fetchNewVersion(String versionKey, Long curVersion, Properties versionProps) { """ /* This method checks for any update in the version for 'versionKey'. If there is any change, it returns the new version. Otherwise it will return a null. """ try { Long newVersion = getCurrentVersion(versionKey, versionProps); // If version obtained is null, the store is untouched. Continue if(newVersion != null) { logger.debug("MetadataVersion check => Obtained " + versionKey + " version : " + newVersion); /* * Check if the new version is greater than the current one. We * should not re-bootstrap on a stale version. */ if(curVersion == null || newVersion > curVersion) { return newVersion; } } else { logger.debug("Metadata unchanged after creation ..."); } } // Swallow all exceptions here (we don't want to fail the client). catch(Exception e) { logger.debug("Could not retrieve Metadata Version. Exception : " + e); } return null; }
java
public Long fetchNewVersion(String versionKey, Long curVersion, Properties versionProps) { try { Long newVersion = getCurrentVersion(versionKey, versionProps); // If version obtained is null, the store is untouched. Continue if(newVersion != null) { logger.debug("MetadataVersion check => Obtained " + versionKey + " version : " + newVersion); /* * Check if the new version is greater than the current one. We * should not re-bootstrap on a stale version. */ if(curVersion == null || newVersion > curVersion) { return newVersion; } } else { logger.debug("Metadata unchanged after creation ..."); } } // Swallow all exceptions here (we don't want to fail the client). catch(Exception e) { logger.debug("Could not retrieve Metadata Version. Exception : " + e); } return null; }
[ "public", "Long", "fetchNewVersion", "(", "String", "versionKey", ",", "Long", "curVersion", ",", "Properties", "versionProps", ")", "{", "try", "{", "Long", "newVersion", "=", "getCurrentVersion", "(", "versionKey", ",", "versionProps", ")", ";", "// If version obtained is null, the store is untouched. Continue", "if", "(", "newVersion", "!=", "null", ")", "{", "logger", ".", "debug", "(", "\"MetadataVersion check => Obtained \"", "+", "versionKey", "+", "\" version : \"", "+", "newVersion", ")", ";", "/*\n * Check if the new version is greater than the current one. We\n * should not re-bootstrap on a stale version.\n */", "if", "(", "curVersion", "==", "null", "||", "newVersion", ">", "curVersion", ")", "{", "return", "newVersion", ";", "}", "}", "else", "{", "logger", ".", "debug", "(", "\"Metadata unchanged after creation ...\"", ")", ";", "}", "}", "// Swallow all exceptions here (we don't want to fail the client).", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "debug", "(", "\"Could not retrieve Metadata Version. Exception : \"", "+", "e", ")", ";", "}", "return", "null", ";", "}" ]
/* This method checks for any update in the version for 'versionKey'. If there is any change, it returns the new version. Otherwise it will return a null.
[ "/", "*", "This", "method", "checks", "for", "any", "update", "in", "the", "version", "for", "versionKey", ".", "If", "there", "is", "any", "change", "it", "returns", "the", "new", "version", ".", "Otherwise", "it", "will", "return", "a", "null", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/scheduler/AsyncMetadataVersionManager.java#L111-L138
jsurfer/JsonSurfer
jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java
JsonSurfer.collectAll
public Collection<Object> collectAll(InputStream inputStream, String... paths) { """ Collect all matched value into a collection @param inputStream Json reader @param paths JsonPath @return values """ return collectAll(inputStream, compile(paths)); }
java
public Collection<Object> collectAll(InputStream inputStream, String... paths) { return collectAll(inputStream, compile(paths)); }
[ "public", "Collection", "<", "Object", ">", "collectAll", "(", "InputStream", "inputStream", ",", "String", "...", "paths", ")", "{", "return", "collectAll", "(", "inputStream", ",", "compile", "(", "paths", ")", ")", ";", "}" ]
Collect all matched value into a collection @param inputStream Json reader @param paths JsonPath @return values
[ "Collect", "all", "matched", "value", "into", "a", "collection" ]
train
https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L347-L349
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java
BoxApiMetadata.getAddFolderMetadataRequest
public BoxRequestsMetadata.AddItemMetadata getAddFolderMetadataRequest(String id, LinkedHashMap<String, Object> values, String scope, String template) { """ Gets a request that adds metadata to a folder @param id id of the folder to add metadata to @param values mapping of the template keys to their values @param scope currently only global and enterprise scopes are supported @param template metadata template to use @return request to add metadata to a folder """ BoxRequestsMetadata.AddItemMetadata request = new BoxRequestsMetadata.AddItemMetadata(values, getFolderMetadataUrl(id, scope, template), mSession); return request; }
java
public BoxRequestsMetadata.AddItemMetadata getAddFolderMetadataRequest(String id, LinkedHashMap<String, Object> values, String scope, String template) { BoxRequestsMetadata.AddItemMetadata request = new BoxRequestsMetadata.AddItemMetadata(values, getFolderMetadataUrl(id, scope, template), mSession); return request; }
[ "public", "BoxRequestsMetadata", ".", "AddItemMetadata", "getAddFolderMetadataRequest", "(", "String", "id", ",", "LinkedHashMap", "<", "String", ",", "Object", ">", "values", ",", "String", "scope", ",", "String", "template", ")", "{", "BoxRequestsMetadata", ".", "AddItemMetadata", "request", "=", "new", "BoxRequestsMetadata", ".", "AddItemMetadata", "(", "values", ",", "getFolderMetadataUrl", "(", "id", ",", "scope", ",", "template", ")", ",", "mSession", ")", ";", "return", "request", ";", "}" ]
Gets a request that adds metadata to a folder @param id id of the folder to add metadata to @param values mapping of the template keys to their values @param scope currently only global and enterprise scopes are supported @param template metadata template to use @return request to add metadata to a folder
[ "Gets", "a", "request", "that", "adds", "metadata", "to", "a", "folder" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java#L129-L132
koendeschacht/bow-utils
src/main/java/be/bagofwords/util/SerializationUtils.java
SerializationUtils.writeObject
public static void writeObject(Object object, OutputStream outputStream) { """ Careful! Not compatible with above method to convert objects to byte arrays! """ try { if (object instanceof Compactable) { ((Compactable) object).compact(); } defaultObjectMapper.writeValue(outputStream, object); } catch (IOException exp) { throw new RuntimeException("Failed to write object to outputstream", exp); } }
java
public static void writeObject(Object object, OutputStream outputStream) { try { if (object instanceof Compactable) { ((Compactable) object).compact(); } defaultObjectMapper.writeValue(outputStream, object); } catch (IOException exp) { throw new RuntimeException("Failed to write object to outputstream", exp); } }
[ "public", "static", "void", "writeObject", "(", "Object", "object", ",", "OutputStream", "outputStream", ")", "{", "try", "{", "if", "(", "object", "instanceof", "Compactable", ")", "{", "(", "(", "Compactable", ")", "object", ")", ".", "compact", "(", ")", ";", "}", "defaultObjectMapper", ".", "writeValue", "(", "outputStream", ",", "object", ")", ";", "}", "catch", "(", "IOException", "exp", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failed to write object to outputstream\"", ",", "exp", ")", ";", "}", "}" ]
Careful! Not compatible with above method to convert objects to byte arrays!
[ "Careful!", "Not", "compatible", "with", "above", "method", "to", "convert", "objects", "to", "byte", "arrays!" ]
train
https://github.com/koendeschacht/bow-utils/blob/f599da17cb7a40b8ffc5610a9761fa922e99d7cb/src/main/java/be/bagofwords/util/SerializationUtils.java#L352-L361
alkacon/opencms-core
src-modules/org/opencms/workplace/list/A_CmsListDialog.java
A_CmsListDialog.setListObject
public void setListObject(Class<?> listDialog, CmsHtmlList listObject) { """ Stores the given object as "list object" for the given list dialog in the current users session.<p> @param listDialog the list dialog class @param listObject the list to store """ if (listObject == null) { // null object: remove the entry from the map getListObjectMap(getSettings()).remove(listDialog.getName()); } else { if ((listObject.getMetadata() != null) && listObject.getMetadata().isVolatile()) { listObject.setMetadata(null); } getListObjectMap(getSettings()).put(listDialog.getName(), listObject); } }
java
public void setListObject(Class<?> listDialog, CmsHtmlList listObject) { if (listObject == null) { // null object: remove the entry from the map getListObjectMap(getSettings()).remove(listDialog.getName()); } else { if ((listObject.getMetadata() != null) && listObject.getMetadata().isVolatile()) { listObject.setMetadata(null); } getListObjectMap(getSettings()).put(listDialog.getName(), listObject); } }
[ "public", "void", "setListObject", "(", "Class", "<", "?", ">", "listDialog", ",", "CmsHtmlList", "listObject", ")", "{", "if", "(", "listObject", "==", "null", ")", "{", "// null object: remove the entry from the map", "getListObjectMap", "(", "getSettings", "(", ")", ")", ".", "remove", "(", "listDialog", ".", "getName", "(", ")", ")", ";", "}", "else", "{", "if", "(", "(", "listObject", ".", "getMetadata", "(", ")", "!=", "null", ")", "&&", "listObject", ".", "getMetadata", "(", ")", ".", "isVolatile", "(", ")", ")", "{", "listObject", ".", "setMetadata", "(", "null", ")", ";", "}", "getListObjectMap", "(", "getSettings", "(", ")", ")", ".", "put", "(", "listDialog", ".", "getName", "(", ")", ",", "listObject", ")", ";", "}", "}" ]
Stores the given object as "list object" for the given list dialog in the current users session.<p> @param listDialog the list dialog class @param listObject the list to store
[ "Stores", "the", "given", "object", "as", "list", "object", "for", "the", "given", "list", "dialog", "in", "the", "current", "users", "session", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/A_CmsListDialog.java#L728-L739
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_dynHost_login_login_PUT
public void zone_zoneName_dynHost_login_login_PUT(String zoneName, String login, OvhDynHostLogin body) throws IOException { """ Alter this object properties REST: PUT /domain/zone/{zoneName}/dynHost/login/{login} @param body [required] New object properties @param zoneName [required] The internal name of your zone @param login [required] Login """ String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}"; StringBuilder sb = path(qPath, zoneName, login); exec(qPath, "PUT", sb.toString(), body); }
java
public void zone_zoneName_dynHost_login_login_PUT(String zoneName, String login, OvhDynHostLogin body) throws IOException { String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}"; StringBuilder sb = path(qPath, zoneName, login); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "zone_zoneName_dynHost_login_login_PUT", "(", "String", "zoneName", ",", "String", "login", ",", "OvhDynHostLogin", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/dynHost/login/{login}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "zoneName", ",", "login", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /domain/zone/{zoneName}/dynHost/login/{login} @param body [required] New object properties @param zoneName [required] The internal name of your zone @param login [required] Login
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L453-L457
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java
HelpDoclet.processIndexTemplate
protected void processIndexTemplate( final Configuration cfg, final List<DocWorkUnit> workUnitList, final List<Map<String, String>> groupMaps ) throws IOException { """ Create the php index listing all of the Docs features @param cfg @param workUnitList @param groupMaps @throws IOException """ // Get or create a template and merge in the data final Template template = cfg.getTemplate(getIndexTemplateName()); final File indexFile = new File(getDestinationDir(), getIndexBaseFileName() + '.' + getIndexFileExtension() ); try (final FileOutputStream fileOutStream = new FileOutputStream(indexFile); final OutputStreamWriter outWriter = new OutputStreamWriter(fileOutStream)) { template.process(groupIndexMap(workUnitList, groupMaps), outWriter); } catch (TemplateException e) { throw new DocException("Freemarker Template Exception during documentation index creation", e); } }
java
protected void processIndexTemplate( final Configuration cfg, final List<DocWorkUnit> workUnitList, final List<Map<String, String>> groupMaps ) throws IOException { // Get or create a template and merge in the data final Template template = cfg.getTemplate(getIndexTemplateName()); final File indexFile = new File(getDestinationDir(), getIndexBaseFileName() + '.' + getIndexFileExtension() ); try (final FileOutputStream fileOutStream = new FileOutputStream(indexFile); final OutputStreamWriter outWriter = new OutputStreamWriter(fileOutStream)) { template.process(groupIndexMap(workUnitList, groupMaps), outWriter); } catch (TemplateException e) { throw new DocException("Freemarker Template Exception during documentation index creation", e); } }
[ "protected", "void", "processIndexTemplate", "(", "final", "Configuration", "cfg", ",", "final", "List", "<", "DocWorkUnit", ">", "workUnitList", ",", "final", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "groupMaps", ")", "throws", "IOException", "{", "// Get or create a template and merge in the data", "final", "Template", "template", "=", "cfg", ".", "getTemplate", "(", "getIndexTemplateName", "(", ")", ")", ";", "final", "File", "indexFile", "=", "new", "File", "(", "getDestinationDir", "(", ")", ",", "getIndexBaseFileName", "(", ")", "+", "'", "'", "+", "getIndexFileExtension", "(", ")", ")", ";", "try", "(", "final", "FileOutputStream", "fileOutStream", "=", "new", "FileOutputStream", "(", "indexFile", ")", ";", "final", "OutputStreamWriter", "outWriter", "=", "new", "OutputStreamWriter", "(", "fileOutStream", ")", ")", "{", "template", ".", "process", "(", "groupIndexMap", "(", "workUnitList", ",", "groupMaps", ")", ",", "outWriter", ")", ";", "}", "catch", "(", "TemplateException", "e", ")", "{", "throw", "new", "DocException", "(", "\"Freemarker Template Exception during documentation index creation\"", ",", "e", ")", ";", "}", "}" ]
Create the php index listing all of the Docs features @param cfg @param workUnitList @param groupMaps @throws IOException
[ "Create", "the", "php", "index", "listing", "all", "of", "the", "Docs", "features" ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java#L464-L482
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_udp_farm_POST
public OvhBackendUdp serviceName_udp_farm_POST(String serviceName, String displayName, Long port, Long vrackNetworkId, String zone) throws IOException { """ Add a new UDP Farm on your IP Load Balancing REST: POST /ipLoadbalancing/{serviceName}/udp/farm @param zone [required] Zone of your farm @param vrackNetworkId [required] Internal Load Balancer identifier of the vRack private network to attach to your farm, mandatory when your Load Balancer is attached to a vRack @param displayName [required] Human readable name for your backend, this field is for you @param port [required] Port attached to your farm ([1..49151]). Inherited from frontend if null @param serviceName [required] The internal name of your IP load balancing API beta """ String qPath = "/ipLoadbalancing/{serviceName}/udp/farm"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "displayName", displayName); addBody(o, "port", port); addBody(o, "vrackNetworkId", vrackNetworkId); addBody(o, "zone", zone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhBackendUdp.class); }
java
public OvhBackendUdp serviceName_udp_farm_POST(String serviceName, String displayName, Long port, Long vrackNetworkId, String zone) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/udp/farm"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "displayName", displayName); addBody(o, "port", port); addBody(o, "vrackNetworkId", vrackNetworkId); addBody(o, "zone", zone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhBackendUdp.class); }
[ "public", "OvhBackendUdp", "serviceName_udp_farm_POST", "(", "String", "serviceName", ",", "String", "displayName", ",", "Long", "port", ",", "Long", "vrackNetworkId", ",", "String", "zone", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/udp/farm\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"displayName\"", ",", "displayName", ")", ";", "addBody", "(", "o", ",", "\"port\"", ",", "port", ")", ";", "addBody", "(", "o", ",", "\"vrackNetworkId\"", ",", "vrackNetworkId", ")", ";", "addBody", "(", "o", ",", "\"zone\"", ",", "zone", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhBackendUdp", ".", "class", ")", ";", "}" ]
Add a new UDP Farm on your IP Load Balancing REST: POST /ipLoadbalancing/{serviceName}/udp/farm @param zone [required] Zone of your farm @param vrackNetworkId [required] Internal Load Balancer identifier of the vRack private network to attach to your farm, mandatory when your Load Balancer is attached to a vRack @param displayName [required] Human readable name for your backend, this field is for you @param port [required] Port attached to your farm ([1..49151]). Inherited from frontend if null @param serviceName [required] The internal name of your IP load balancing API beta
[ "Add", "a", "new", "UDP", "Farm", "on", "your", "IP", "Load", "Balancing" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L874-L884
akquinet/needle
src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java
ReflectionUtil.invokeMethod
public static Object invokeMethod(final Object object, final Class<?> clazz, final String methodName, final Object... arguments) throws Exception { """ Invoke a given method with given arguments on a given object via reflection. @param object -- target object of invocation @param clazz -- type of argument object @param methodName -- name of method to be invoked @param arguments -- arguments for method invocation @return -- method object to which invocation is actually dispatched @throws Exception - operation exception """ Class<?> superClazz = clazz; while (superClazz != null) { for (final Method declaredMethod : superClazz.getDeclaredMethods()) { if (declaredMethod.getName().equals(methodName)) { final Class<?>[] parameterTypes = declaredMethod.getParameterTypes(); if (parameterTypes.length == arguments.length && checkArguments(parameterTypes, arguments)) { return invokeMethod(declaredMethod, object, arguments); } } } superClazz = superClazz.getSuperclass(); } throw new IllegalArgumentException("Method " + methodName + ":" + Arrays.toString(arguments) + " not found"); }
java
public static Object invokeMethod(final Object object, final Class<?> clazz, final String methodName, final Object... arguments) throws Exception { Class<?> superClazz = clazz; while (superClazz != null) { for (final Method declaredMethod : superClazz.getDeclaredMethods()) { if (declaredMethod.getName().equals(methodName)) { final Class<?>[] parameterTypes = declaredMethod.getParameterTypes(); if (parameterTypes.length == arguments.length && checkArguments(parameterTypes, arguments)) { return invokeMethod(declaredMethod, object, arguments); } } } superClazz = superClazz.getSuperclass(); } throw new IllegalArgumentException("Method " + methodName + ":" + Arrays.toString(arguments) + " not found"); }
[ "public", "static", "Object", "invokeMethod", "(", "final", "Object", "object", ",", "final", "Class", "<", "?", ">", "clazz", ",", "final", "String", "methodName", ",", "final", "Object", "...", "arguments", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "superClazz", "=", "clazz", ";", "while", "(", "superClazz", "!=", "null", ")", "{", "for", "(", "final", "Method", "declaredMethod", ":", "superClazz", ".", "getDeclaredMethods", "(", ")", ")", "{", "if", "(", "declaredMethod", ".", "getName", "(", ")", ".", "equals", "(", "methodName", ")", ")", "{", "final", "Class", "<", "?", ">", "[", "]", "parameterTypes", "=", "declaredMethod", ".", "getParameterTypes", "(", ")", ";", "if", "(", "parameterTypes", ".", "length", "==", "arguments", ".", "length", "&&", "checkArguments", "(", "parameterTypes", ",", "arguments", ")", ")", "{", "return", "invokeMethod", "(", "declaredMethod", ",", "object", ",", "arguments", ")", ";", "}", "}", "}", "superClazz", "=", "superClazz", ".", "getSuperclass", "(", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Method \"", "+", "methodName", "+", "\":\"", "+", "Arrays", ".", "toString", "(", "arguments", ")", "+", "\" not found\"", ")", ";", "}" ]
Invoke a given method with given arguments on a given object via reflection. @param object -- target object of invocation @param clazz -- type of argument object @param methodName -- name of method to be invoked @param arguments -- arguments for method invocation @return -- method object to which invocation is actually dispatched @throws Exception - operation exception
[ "Invoke", "a", "given", "method", "with", "given", "arguments", "on", "a", "given", "object", "via", "reflection", "." ]
train
https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java#L296-L316
j256/ormlite-core
src/main/java/com/j256/ormlite/dao/DaoManager.java
DaoManager.createDao
public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException { """ Helper method to create a DAO object without having to define a class. This checks to see if the DAO has already been created. If not then it is a call through to {@link BaseDaoImpl#createDao(ConnectionSource, DatabaseTableConfig)}. """ if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } return doCreateDao(connectionSource, tableConfig); }
java
public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } return doCreateDao(connectionSource, tableConfig); }
[ "public", "synchronized", "static", "<", "D", "extends", "Dao", "<", "T", ",", "?", ">", ",", "T", ">", "D", "createDao", "(", "ConnectionSource", "connectionSource", ",", "DatabaseTableConfig", "<", "T", ">", "tableConfig", ")", "throws", "SQLException", "{", "if", "(", "connectionSource", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"connectionSource argument cannot be null\"", ")", ";", "}", "return", "doCreateDao", "(", "connectionSource", ",", "tableConfig", ")", ";", "}" ]
Helper method to create a DAO object without having to define a class. This checks to see if the DAO has already been created. If not then it is a call through to {@link BaseDaoImpl#createDao(ConnectionSource, DatabaseTableConfig)}.
[ "Helper", "method", "to", "create", "a", "DAO", "object", "without", "having", "to", "define", "a", "class", ".", "This", "checks", "to", "see", "if", "the", "DAO", "has", "already", "been", "created", ".", "If", "not", "then", "it", "is", "a", "call", "through", "to", "{" ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L125-L131
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
AbstractModuleIndexWriter.addModulePackagesIndex
protected void addModulePackagesIndex(Content body, ModuleElement mdle) { """ Adds the frame or non-frame module packages index to the documentation tree. @param body the document tree to which the index will be added @param mdle the module being documented """ addModulePackagesIndexContents("doclet.Module_Summary", configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Module_Summary"), configuration.getText("doclet.modules")), body, mdle); }
java
protected void addModulePackagesIndex(Content body, ModuleElement mdle) { addModulePackagesIndexContents("doclet.Module_Summary", configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Module_Summary"), configuration.getText("doclet.modules")), body, mdle); }
[ "protected", "void", "addModulePackagesIndex", "(", "Content", "body", ",", "ModuleElement", "mdle", ")", "{", "addModulePackagesIndexContents", "(", "\"doclet.Module_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Module_Summary\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.modules\"", ")", ")", ",", "body", ",", "mdle", ")", ";", "}" ]
Adds the frame or non-frame module packages index to the documentation tree. @param body the document tree to which the index will be added @param mdle the module being documented
[ "Adds", "the", "frame", "or", "non", "-", "frame", "module", "packages", "index", "to", "the", "documentation", "tree", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java#L189-L194
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTextFieldRenderer.java
WTextFieldRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WTextField. @param component the WTextField to paint. @param renderContext the RenderContext to paint to. """ WTextField textField = (WTextField) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = textField.isReadOnly(); xml.appendTagOpen("ui:textfield"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { int cols = textField.getColumns(); int minLength = textField.getMinLength(); int maxLength = textField.getMaxLength(); String pattern = textField.getPattern(); WSuggestions suggestions = textField.getSuggestions(); String suggestionsId = suggestions == null ? null : suggestions.getId(); WComponent submitControl = textField.getDefaultSubmitButton(); String submitControlId = submitControl == null ? null : submitControl.getId(); xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true"); xml.appendOptionalAttribute("required", textField.isMandatory(), "true"); xml.appendOptionalAttribute("minLength", minLength > 0, minLength); xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength); xml.appendOptionalAttribute("toolTip", textField.getToolTip()); xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText()); xml.appendOptionalAttribute("size", cols > 0, cols); xml.appendOptionalAttribute("buttonId", submitControlId); xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern); xml.appendOptionalAttribute("list", suggestionsId); String placeholder = textField.getPlaceholder(); xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder); String autocomplete = textField.getAutocomplete(); xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete); } xml.appendClose(); xml.appendEscaped(textField.getText()); if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(textField, renderContext); } xml.appendEndTag("ui:textfield"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WTextField textField = (WTextField) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = textField.isReadOnly(); xml.appendTagOpen("ui:textfield"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { int cols = textField.getColumns(); int minLength = textField.getMinLength(); int maxLength = textField.getMaxLength(); String pattern = textField.getPattern(); WSuggestions suggestions = textField.getSuggestions(); String suggestionsId = suggestions == null ? null : suggestions.getId(); WComponent submitControl = textField.getDefaultSubmitButton(); String submitControlId = submitControl == null ? null : submitControl.getId(); xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true"); xml.appendOptionalAttribute("required", textField.isMandatory(), "true"); xml.appendOptionalAttribute("minLength", minLength > 0, minLength); xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength); xml.appendOptionalAttribute("toolTip", textField.getToolTip()); xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText()); xml.appendOptionalAttribute("size", cols > 0, cols); xml.appendOptionalAttribute("buttonId", submitControlId); xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern); xml.appendOptionalAttribute("list", suggestionsId); String placeholder = textField.getPlaceholder(); xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder); String autocomplete = textField.getAutocomplete(); xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete); } xml.appendClose(); xml.appendEscaped(textField.getText()); if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(textField, renderContext); } xml.appendEndTag("ui:textfield"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WTextField", "textField", "=", "(", "WTextField", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "boolean", "readOnly", "=", "textField", ".", "isReadOnly", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:textfield\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hidden\"", ",", "component", ".", "isHidden", "(", ")", ",", "\"true\"", ")", ";", "if", "(", "readOnly", ")", "{", "xml", ".", "appendAttribute", "(", "\"readOnly\"", ",", "\"true\"", ")", ";", "}", "else", "{", "int", "cols", "=", "textField", ".", "getColumns", "(", ")", ";", "int", "minLength", "=", "textField", ".", "getMinLength", "(", ")", ";", "int", "maxLength", "=", "textField", ".", "getMaxLength", "(", ")", ";", "String", "pattern", "=", "textField", ".", "getPattern", "(", ")", ";", "WSuggestions", "suggestions", "=", "textField", ".", "getSuggestions", "(", ")", ";", "String", "suggestionsId", "=", "suggestions", "==", "null", "?", "null", ":", "suggestions", ".", "getId", "(", ")", ";", "WComponent", "submitControl", "=", "textField", ".", "getDefaultSubmitButton", "(", ")", ";", "String", "submitControlId", "=", "submitControl", "==", "null", "?", "null", ":", "submitControl", ".", "getId", "(", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"disabled\"", ",", "textField", ".", "isDisabled", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"required\"", ",", "textField", ".", "isMandatory", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"minLength\"", ",", "minLength", ">", "0", ",", "minLength", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"maxLength\"", ",", "maxLength", ">", "0", ",", "maxLength", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"toolTip\"", ",", "textField", ".", "getToolTip", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"accessibleText\"", ",", "textField", ".", "getAccessibleText", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"size\"", ",", "cols", ">", "0", ",", "cols", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"buttonId\"", ",", "submitControlId", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"pattern\"", ",", "!", "Util", ".", "empty", "(", "pattern", ")", ",", "pattern", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"list\"", ",", "suggestionsId", ")", ";", "String", "placeholder", "=", "textField", ".", "getPlaceholder", "(", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"placeholder\"", ",", "!", "Util", ".", "empty", "(", "placeholder", ")", ",", "placeholder", ")", ";", "String", "autocomplete", "=", "textField", ".", "getAutocomplete", "(", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"autocomplete\"", ",", "!", "Util", ".", "empty", "(", "autocomplete", ")", ",", "autocomplete", ")", ";", "}", "xml", ".", "appendClose", "(", ")", ";", "xml", ".", "appendEscaped", "(", "textField", ".", "getText", "(", ")", ")", ";", "if", "(", "!", "readOnly", ")", "{", "DiagnosticRenderUtil", ".", "renderDiagnostics", "(", "textField", ",", "renderContext", ")", ";", "}", "xml", ".", "appendEndTag", "(", "\"ui:textfield\"", ")", ";", "}" ]
Paints the given WTextField. @param component the WTextField to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WTextField", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTextFieldRenderer.java#L25-L73
steveash/jopenfst
src/main/java/com/github/steveash/jopenfst/operations/Compose.java
Compose.makeFilter
private static MutableFst makeFilter(WriteableSymbolTable table, Semiring semiring, String eps1, String eps2) { """ Get a filter to use for avoiding multiple epsilon paths in the resulting Fst See: M. Mohri, "Weighted automata algorithms", Handbook of Weighted Automata. Springer, pp. 213-250, 2009. @param table the filter's input/output symbols @param semiring the semiring to use in the operation """ MutableFst filter = new MutableFst(semiring, table, table); // State 0 MutableState s0 = filter.newStartState(); s0.setFinalWeight(semiring.one()); MutableState s1 = filter.newState(); s1.setFinalWeight(semiring.one()); MutableState s2 = filter.newState(); s2.setFinalWeight(semiring.one()); filter.addArc(s0, eps2, eps1, s0, semiring.one()); filter.addArc(s0, eps1, eps1, s1, semiring.one()); filter.addArc(s0, eps2, eps2, s2, semiring.one()); // self loops filter.addArc(s1, eps1, eps1, s1, semiring.one()); filter.addArc(s2, eps2, eps2, s2, semiring.one()); for (ObjectIntCursor<String> cursor : table) { int i = cursor.value; String key = cursor.key; if (key.equals(Fst.EPS) || key.equals(eps1) || key.equals(eps2)) { continue; } filter.addArc(s0, i, i, s0, semiring.one()); filter.addArc(s1, i, i, s0, semiring.one()); filter.addArc(s2, i, i, s0, semiring.one()); } return filter; }
java
private static MutableFst makeFilter(WriteableSymbolTable table, Semiring semiring, String eps1, String eps2) { MutableFst filter = new MutableFst(semiring, table, table); // State 0 MutableState s0 = filter.newStartState(); s0.setFinalWeight(semiring.one()); MutableState s1 = filter.newState(); s1.setFinalWeight(semiring.one()); MutableState s2 = filter.newState(); s2.setFinalWeight(semiring.one()); filter.addArc(s0, eps2, eps1, s0, semiring.one()); filter.addArc(s0, eps1, eps1, s1, semiring.one()); filter.addArc(s0, eps2, eps2, s2, semiring.one()); // self loops filter.addArc(s1, eps1, eps1, s1, semiring.one()); filter.addArc(s2, eps2, eps2, s2, semiring.one()); for (ObjectIntCursor<String> cursor : table) { int i = cursor.value; String key = cursor.key; if (key.equals(Fst.EPS) || key.equals(eps1) || key.equals(eps2)) { continue; } filter.addArc(s0, i, i, s0, semiring.one()); filter.addArc(s1, i, i, s0, semiring.one()); filter.addArc(s2, i, i, s0, semiring.one()); } return filter; }
[ "private", "static", "MutableFst", "makeFilter", "(", "WriteableSymbolTable", "table", ",", "Semiring", "semiring", ",", "String", "eps1", ",", "String", "eps2", ")", "{", "MutableFst", "filter", "=", "new", "MutableFst", "(", "semiring", ",", "table", ",", "table", ")", ";", "// State 0", "MutableState", "s0", "=", "filter", ".", "newStartState", "(", ")", ";", "s0", ".", "setFinalWeight", "(", "semiring", ".", "one", "(", ")", ")", ";", "MutableState", "s1", "=", "filter", ".", "newState", "(", ")", ";", "s1", ".", "setFinalWeight", "(", "semiring", ".", "one", "(", ")", ")", ";", "MutableState", "s2", "=", "filter", ".", "newState", "(", ")", ";", "s2", ".", "setFinalWeight", "(", "semiring", ".", "one", "(", ")", ")", ";", "filter", ".", "addArc", "(", "s0", ",", "eps2", ",", "eps1", ",", "s0", ",", "semiring", ".", "one", "(", ")", ")", ";", "filter", ".", "addArc", "(", "s0", ",", "eps1", ",", "eps1", ",", "s1", ",", "semiring", ".", "one", "(", ")", ")", ";", "filter", ".", "addArc", "(", "s0", ",", "eps2", ",", "eps2", ",", "s2", ",", "semiring", ".", "one", "(", ")", ")", ";", "// self loops", "filter", ".", "addArc", "(", "s1", ",", "eps1", ",", "eps1", ",", "s1", ",", "semiring", ".", "one", "(", ")", ")", ";", "filter", ".", "addArc", "(", "s2", ",", "eps2", ",", "eps2", ",", "s2", ",", "semiring", ".", "one", "(", ")", ")", ";", "for", "(", "ObjectIntCursor", "<", "String", ">", "cursor", ":", "table", ")", "{", "int", "i", "=", "cursor", ".", "value", ";", "String", "key", "=", "cursor", ".", "key", ";", "if", "(", "key", ".", "equals", "(", "Fst", ".", "EPS", ")", "||", "key", ".", "equals", "(", "eps1", ")", "||", "key", ".", "equals", "(", "eps2", ")", ")", "{", "continue", ";", "}", "filter", ".", "addArc", "(", "s0", ",", "i", ",", "i", ",", "s0", ",", "semiring", ".", "one", "(", ")", ")", ";", "filter", ".", "addArc", "(", "s1", ",", "i", ",", "i", ",", "s0", ",", "semiring", ".", "one", "(", ")", ")", ";", "filter", ".", "addArc", "(", "s2", ",", "i", ",", "i", ",", "s0", ",", "semiring", ".", "one", "(", ")", ")", ";", "}", "return", "filter", ";", "}" ]
Get a filter to use for avoiding multiple epsilon paths in the resulting Fst See: M. Mohri, "Weighted automata algorithms", Handbook of Weighted Automata. Springer, pp. 213-250, 2009. @param table the filter's input/output symbols @param semiring the semiring to use in the operation
[ "Get", "a", "filter", "to", "use", "for", "avoiding", "multiple", "epsilon", "paths", "in", "the", "resulting", "Fst" ]
train
https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/operations/Compose.java#L190-L219
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java
SwaptionDataLattice.containsEntryFor
public boolean containsEntryFor(int maturityInMonths, int tenorInMonths, int moneynessBP) { """ Returns true if the lattice contains an entry at the specified location. @param maturityInMonths The maturity in months to check. @param tenorInMonths The tenor in months to check. @param moneynessBP The moneyness in bp to check. @return True iff there is an entry at the specified location. """ return entryMap.containsKey(new DataKey(maturityInMonths, tenorInMonths, moneynessBP)); }
java
public boolean containsEntryFor(int maturityInMonths, int tenorInMonths, int moneynessBP) { return entryMap.containsKey(new DataKey(maturityInMonths, tenorInMonths, moneynessBP)); }
[ "public", "boolean", "containsEntryFor", "(", "int", "maturityInMonths", ",", "int", "tenorInMonths", ",", "int", "moneynessBP", ")", "{", "return", "entryMap", ".", "containsKey", "(", "new", "DataKey", "(", "maturityInMonths", ",", "tenorInMonths", ",", "moneynessBP", ")", ")", ";", "}" ]
Returns true if the lattice contains an entry at the specified location. @param maturityInMonths The maturity in months to check. @param tenorInMonths The tenor in months to check. @param moneynessBP The moneyness in bp to check. @return True iff there is an entry at the specified location.
[ "Returns", "true", "if", "the", "lattice", "contains", "an", "entry", "at", "the", "specified", "location", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L547-L549
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.firstRow
public GroovyRowResult firstRow(String sql, Object[] params) throws SQLException { """ Performs the given SQL query and return the first row of the result set. <p> An Object array variant of {@link #firstRow(String, List)}. <p> This method supports named and named ordinal parameters by supplying such parameters in the <code>params</code> array. See the class Javadoc for more details. @param sql the SQL statement @param params an array of parameters @return a GroovyRowResult object or <code>null</code> if no row is found @throws SQLException if a database access error occurs """ return firstRow(sql, Arrays.asList(params)); }
java
public GroovyRowResult firstRow(String sql, Object[] params) throws SQLException { return firstRow(sql, Arrays.asList(params)); }
[ "public", "GroovyRowResult", "firstRow", "(", "String", "sql", ",", "Object", "[", "]", "params", ")", "throws", "SQLException", "{", "return", "firstRow", "(", "sql", ",", "Arrays", ".", "asList", "(", "params", ")", ")", ";", "}" ]
Performs the given SQL query and return the first row of the result set. <p> An Object array variant of {@link #firstRow(String, List)}. <p> This method supports named and named ordinal parameters by supplying such parameters in the <code>params</code> array. See the class Javadoc for more details. @param sql the SQL statement @param params an array of parameters @return a GroovyRowResult object or <code>null</code> if no row is found @throws SQLException if a database access error occurs
[ "Performs", "the", "given", "SQL", "query", "and", "return", "the", "first", "row", "of", "the", "result", "set", ".", "<p", ">", "An", "Object", "array", "variant", "of", "{", "@link", "#firstRow", "(", "String", "List", ")", "}", ".", "<p", ">", "This", "method", "supports", "named", "and", "named", "ordinal", "parameters", "by", "supplying", "such", "parameters", "in", "the", "<code", ">", "params<", "/", "code", ">", "array", ".", "See", "the", "class", "Javadoc", "for", "more", "details", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2289-L2291
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addIdNotInCollectionCondition
protected void addIdNotInCollectionCondition(final String propertyName, final Collection<Integer> values) { """ Add a Field Search Condition that will check if the id field does not exist in an array of values. eg. {@code field NOT IN (values)} @param propertyName The name of the field id as defined in the Entity mapping class. @param values The List of Ids to be compared to. """ if (values != null && !values.isEmpty()) { fieldConditions.add(getCriteriaBuilder().not(getRootPath().get(propertyName).in(values))); } }
java
protected void addIdNotInCollectionCondition(final String propertyName, final Collection<Integer> values) { if (values != null && !values.isEmpty()) { fieldConditions.add(getCriteriaBuilder().not(getRootPath().get(propertyName).in(values))); } }
[ "protected", "void", "addIdNotInCollectionCondition", "(", "final", "String", "propertyName", ",", "final", "Collection", "<", "Integer", ">", "values", ")", "{", "if", "(", "values", "!=", "null", "&&", "!", "values", ".", "isEmpty", "(", ")", ")", "{", "fieldConditions", ".", "add", "(", "getCriteriaBuilder", "(", ")", ".", "not", "(", "getRootPath", "(", ")", ".", "get", "(", "propertyName", ")", ".", "in", "(", "values", ")", ")", ")", ";", "}", "}" ]
Add a Field Search Condition that will check if the id field does not exist in an array of values. eg. {@code field NOT IN (values)} @param propertyName The name of the field id as defined in the Entity mapping class. @param values The List of Ids to be compared to.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "check", "if", "the", "id", "field", "does", "not", "exist", "in", "an", "array", "of", "values", ".", "eg", ".", "{", "@code", "field", "NOT", "IN", "(", "values", ")", "}" ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L370-L374
Azure/azure-sdk-for-java
mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/queue/QueueService.java
QueueService.create
public static QueueContract create(String profile, Configuration config) { """ A static factory method that returns an instance implementing {@link com.microsoft.windowsazure.services.queue.QueueContract} using the specified {@link Configuration} instance and profile prefix for service settings. The {@link Configuration} instance must have storage account information and credentials set with the specified profile prefix before this method is called for the returned interface to work. @param profile A string prefix for the account name and credentials settings in the {@link Configuration} instance. @param config A {@link Configuration} instance configured with storage account information and credentials. @return An instance implementing {@link com.microsoft.windowsazure.services.queue.QueueContract} for interacting with the queue service. """ return config.create(profile, QueueContract.class); }
java
public static QueueContract create(String profile, Configuration config) { return config.create(profile, QueueContract.class); }
[ "public", "static", "QueueContract", "create", "(", "String", "profile", ",", "Configuration", "config", ")", "{", "return", "config", ".", "create", "(", "profile", ",", "QueueContract", ".", "class", ")", ";", "}" ]
A static factory method that returns an instance implementing {@link com.microsoft.windowsazure.services.queue.QueueContract} using the specified {@link Configuration} instance and profile prefix for service settings. The {@link Configuration} instance must have storage account information and credentials set with the specified profile prefix before this method is called for the returned interface to work. @param profile A string prefix for the account name and credentials settings in the {@link Configuration} instance. @param config A {@link Configuration} instance configured with storage account information and credentials. @return An instance implementing {@link com.microsoft.windowsazure.services.queue.QueueContract} for interacting with the queue service.
[ "A", "static", "factory", "method", "that", "returns", "an", "instance", "implementing", "{", "@link", "com", ".", "microsoft", ".", "windowsazure", ".", "services", ".", "queue", ".", "QueueContract", "}", "using", "the", "specified", "{", "@link", "Configuration", "}", "instance", "and", "profile", "prefix", "for", "service", "settings", ".", "The", "{", "@link", "Configuration", "}", "instance", "must", "have", "storage", "account", "information", "and", "credentials", "set", "with", "the", "specified", "profile", "prefix", "before", "this", "method", "is", "called", "for", "the", "returned", "interface", "to", "work", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/queue/QueueService.java#L99-L101
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.generateSuperclassPattern
public static String generateSuperclassPattern(URI origin, String matchVariable) { """ Generate a pattern for matching var to the superclasses of clazz @param origin @param matchVariable @return """ return new StringBuilder() .append(sparqlWrapUri(origin)).append(" ") .append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ") .append("?").append(matchVariable).append(" .") .toString(); }
java
public static String generateSuperclassPattern(URI origin, String matchVariable) { return new StringBuilder() .append(sparqlWrapUri(origin)).append(" ") .append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ") .append("?").append(matchVariable).append(" .") .toString(); }
[ "public", "static", "String", "generateSuperclassPattern", "(", "URI", "origin", ",", "String", "matchVariable", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "sparqlWrapUri", "(", "origin", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "sparqlWrapUri", "(", "RDFS", ".", "subClassOf", ".", "getURI", "(", ")", ")", ")", ".", "append", "(", "\"+ \"", ")", ".", "append", "(", "\"?\"", ")", ".", "append", "(", "matchVariable", ")", ".", "append", "(", "\" .\"", ")", ".", "toString", "(", ")", ";", "}" ]
Generate a pattern for matching var to the superclasses of clazz @param origin @param matchVariable @return
[ "Generate", "a", "pattern", "for", "matching", "var", "to", "the", "superclasses", "of", "clazz" ]
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L248-L254
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/metrics/export/TimeSeries.java
TimeSeries.createWithOnePoint
public static TimeSeries createWithOnePoint( List<LabelValue> labelValues, Point point, @Nullable Timestamp startTimestamp) { """ Creates a {@link TimeSeries}. @param labelValues the {@code LabelValue}s that uniquely identify this {@code TimeSeries}. @param point the single data {@code Point} of this {@code TimeSeries}. @param startTimestamp the start {@code Timestamp} of this {@code TimeSeries}. Must be non-null for cumulative {@code Point}s. @return a {@code TimeSeries}. @since 0.17 """ Utils.checkNotNull(point, "point"); return createInternal(labelValues, Collections.singletonList(point), startTimestamp); }
java
public static TimeSeries createWithOnePoint( List<LabelValue> labelValues, Point point, @Nullable Timestamp startTimestamp) { Utils.checkNotNull(point, "point"); return createInternal(labelValues, Collections.singletonList(point), startTimestamp); }
[ "public", "static", "TimeSeries", "createWithOnePoint", "(", "List", "<", "LabelValue", ">", "labelValues", ",", "Point", "point", ",", "@", "Nullable", "Timestamp", "startTimestamp", ")", "{", "Utils", ".", "checkNotNull", "(", "point", ",", "\"point\"", ")", ";", "return", "createInternal", "(", "labelValues", ",", "Collections", ".", "singletonList", "(", "point", ")", ",", "startTimestamp", ")", ";", "}" ]
Creates a {@link TimeSeries}. @param labelValues the {@code LabelValue}s that uniquely identify this {@code TimeSeries}. @param point the single data {@code Point} of this {@code TimeSeries}. @param startTimestamp the start {@code Timestamp} of this {@code TimeSeries}. Must be non-null for cumulative {@code Point}s. @return a {@code TimeSeries}. @since 0.17
[ "Creates", "a", "{", "@link", "TimeSeries", "}", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/metrics/export/TimeSeries.java#L81-L85
sarxos/v4l4j
src/main/java/au/edu/jcu/v4l4j/AbstractGrabber.java
AbstractGrabber.getAvailableVideoFrame
private BaseVideoFrame getAvailableVideoFrame() { """ This method is called as part of {@link #getVideoFrame()}. It retrieves a video frame marked as available (recycled). if no frame is available, this method will block. If interrupted while waiting, a {@link StateException} will be thrown @return an available video frame. @thrown {@link StateException} if interrupted while waiting. """ BaseVideoFrame frame = null; // block until a video frame is available synchronized (availableVideoFrames) { while (availableVideoFrames.size() == 0) try { availableVideoFrames.wait(); } catch (InterruptedException e) { throw new StateException("Interrupted while waiting for a video frame", e); } // get the video frame frame = availableVideoFrames.remove(0); } return frame; }
java
private BaseVideoFrame getAvailableVideoFrame() { BaseVideoFrame frame = null; // block until a video frame is available synchronized (availableVideoFrames) { while (availableVideoFrames.size() == 0) try { availableVideoFrames.wait(); } catch (InterruptedException e) { throw new StateException("Interrupted while waiting for a video frame", e); } // get the video frame frame = availableVideoFrames.remove(0); } return frame; }
[ "private", "BaseVideoFrame", "getAvailableVideoFrame", "(", ")", "{", "BaseVideoFrame", "frame", "=", "null", ";", "// block until a video frame is available", "synchronized", "(", "availableVideoFrames", ")", "{", "while", "(", "availableVideoFrames", ".", "size", "(", ")", "==", "0", ")", "try", "{", "availableVideoFrames", ".", "wait", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "StateException", "(", "\"Interrupted while waiting for a video frame\"", ",", "e", ")", ";", "}", "// get the video frame", "frame", "=", "availableVideoFrames", ".", "remove", "(", "0", ")", ";", "}", "return", "frame", ";", "}" ]
This method is called as part of {@link #getVideoFrame()}. It retrieves a video frame marked as available (recycled). if no frame is available, this method will block. If interrupted while waiting, a {@link StateException} will be thrown @return an available video frame. @thrown {@link StateException} if interrupted while waiting.
[ "This", "method", "is", "called", "as", "part", "of", "{" ]
train
https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/AbstractGrabber.java#L364-L381
zandero/rest.vertx
src/main/java/com/zandero/rest/RestBuilder.java
RestBuilder.enableCors
public RestBuilder enableCors() { """ Enables CORS for all methods and headers / intended for testing purposes only - not recommended for production use @return self """ Set<String> allowedHeaders = new HashSet<>(); allowedHeaders.add("Access-Control-Allow-Origin"); //allowedHeaders.add("Access-Control-Allow-Credentials"); allowedHeaders.add("Access-Control-Allow-Headers"); allowedHeaders.add("Access-Control-Allow-Methods"); allowedHeaders.add("Access-Control-Expose-Headers"); allowedHeaders.add("Access-Control-Request-Method"); allowedHeaders.add("Access-Control-Request-Headers"); //allowedHeaders.add("Access-Control-Max-Age"); allowedHeaders.add("Origin"); return enableCors("*", false, -1, allowedHeaders); }
java
public RestBuilder enableCors() { Set<String> allowedHeaders = new HashSet<>(); allowedHeaders.add("Access-Control-Allow-Origin"); //allowedHeaders.add("Access-Control-Allow-Credentials"); allowedHeaders.add("Access-Control-Allow-Headers"); allowedHeaders.add("Access-Control-Allow-Methods"); allowedHeaders.add("Access-Control-Expose-Headers"); allowedHeaders.add("Access-Control-Request-Method"); allowedHeaders.add("Access-Control-Request-Headers"); //allowedHeaders.add("Access-Control-Max-Age"); allowedHeaders.add("Origin"); return enableCors("*", false, -1, allowedHeaders); }
[ "public", "RestBuilder", "enableCors", "(", ")", "{", "Set", "<", "String", ">", "allowedHeaders", "=", "new", "HashSet", "<>", "(", ")", ";", "allowedHeaders", ".", "add", "(", "\"Access-Control-Allow-Origin\"", ")", ";", "//allowedHeaders.add(\"Access-Control-Allow-Credentials\");", "allowedHeaders", ".", "add", "(", "\"Access-Control-Allow-Headers\"", ")", ";", "allowedHeaders", ".", "add", "(", "\"Access-Control-Allow-Methods\"", ")", ";", "allowedHeaders", ".", "add", "(", "\"Access-Control-Expose-Headers\"", ")", ";", "allowedHeaders", ".", "add", "(", "\"Access-Control-Request-Method\"", ")", ";", "allowedHeaders", ".", "add", "(", "\"Access-Control-Request-Headers\"", ")", ";", "//allowedHeaders.add(\"Access-Control-Max-Age\");", "allowedHeaders", ".", "add", "(", "\"Origin\"", ")", ";", "return", "enableCors", "(", "\"*\"", ",", "false", ",", "-", "1", ",", "allowedHeaders", ")", ";", "}" ]
Enables CORS for all methods and headers / intended for testing purposes only - not recommended for production use @return self
[ "Enables", "CORS", "for", "all", "methods", "and", "headers", "/", "intended", "for", "testing", "purposes", "only", "-", "not", "recommended", "for", "production", "use" ]
train
https://github.com/zandero/rest.vertx/blob/ba458720cf59e076953eab9dac7227eeaf9e58ce/src/main/java/com/zandero/rest/RestBuilder.java#L121-L134
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolableConnection.java
PoolableConnection.prepareStatement
@Override public PoolablePreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { """ Method prepareStatement. @param sql @param columnIndexes @return PreparedStatement @throws SQLException @see java.sql.Connection#prepareStatement(String, int[]) """ return new PoolablePreparedStatement(internalConn.prepareStatement(sql, columnIndexes), this, null); }
java
@Override public PoolablePreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { return new PoolablePreparedStatement(internalConn.prepareStatement(sql, columnIndexes), this, null); }
[ "@", "Override", "public", "PoolablePreparedStatement", "prepareStatement", "(", "String", "sql", ",", "int", "[", "]", "columnIndexes", ")", "throws", "SQLException", "{", "return", "new", "PoolablePreparedStatement", "(", "internalConn", ".", "prepareStatement", "(", "sql", ",", "columnIndexes", ")", ",", "this", ",", "null", ")", ";", "}" ]
Method prepareStatement. @param sql @param columnIndexes @return PreparedStatement @throws SQLException @see java.sql.Connection#prepareStatement(String, int[])
[ "Method", "prepareStatement", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolableConnection.java#L522-L525
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/access/ecr/AwsSigner4Request.java
AwsSigner4Request.canonicalHeaders
private static String canonicalHeaders(Map<String, String> headers) { """ Create canonical header set. The headers are ordered by name. @param headers The set of headers to sign @return The signing value from headers. Headers are separated with newline. Each header is formatted name:value with each header value whitespace trimmed and minimized """ StringBuilder canonical = new StringBuilder(); for (Map.Entry<String, String> header : headers.entrySet()) { canonical.append(header.getKey()).append(':').append(header.getValue()).append('\n'); } return canonical.toString(); }
java
private static String canonicalHeaders(Map<String, String> headers) { StringBuilder canonical = new StringBuilder(); for (Map.Entry<String, String> header : headers.entrySet()) { canonical.append(header.getKey()).append(':').append(header.getValue()).append('\n'); } return canonical.toString(); }
[ "private", "static", "String", "canonicalHeaders", "(", "Map", "<", "String", ",", "String", ">", "headers", ")", "{", "StringBuilder", "canonical", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "header", ":", "headers", ".", "entrySet", "(", ")", ")", "{", "canonical", ".", "append", "(", "header", ".", "getKey", "(", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "header", ".", "getValue", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "}", "return", "canonical", ".", "toString", "(", ")", ";", "}" ]
Create canonical header set. The headers are ordered by name. @param headers The set of headers to sign @return The signing value from headers. Headers are separated with newline. Each header is formatted name:value with each header value whitespace trimmed and minimized
[ "Create", "canonical", "header", "set", ".", "The", "headers", "are", "ordered", "by", "name", "." ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/ecr/AwsSigner4Request.java#L193-L199
osglworks/java-tool
src/main/java/org/osgl/Lang.java
F2.applyOrElse
public R applyOrElse(P1 p1, P2 p2, F2<? super P1, ? super P2, ? extends R> fallback) { """ Applies this partial function to the given argument when it is contained in the function domain. Applies fallback function where this partial function is not defined. @param p1 the first param with type P1 @param p2 the second param with type P2 @param fallback the function to be called when an {@link RuntimeException} caught @return the result of this function or the fallback function application """ try { return apply(p1, p2); } catch (RuntimeException e) { return fallback.apply(p1, p2); } }
java
public R applyOrElse(P1 p1, P2 p2, F2<? super P1, ? super P2, ? extends R> fallback) { try { return apply(p1, p2); } catch (RuntimeException e) { return fallback.apply(p1, p2); } }
[ "public", "R", "applyOrElse", "(", "P1", "p1", ",", "P2", "p2", ",", "F2", "<", "?", "super", "P1", ",", "?", "super", "P2", ",", "?", "extends", "R", ">", "fallback", ")", "{", "try", "{", "return", "apply", "(", "p1", ",", "p2", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "return", "fallback", ".", "apply", "(", "p1", ",", "p2", ")", ";", "}", "}" ]
Applies this partial function to the given argument when it is contained in the function domain. Applies fallback function where this partial function is not defined. @param p1 the first param with type P1 @param p2 the second param with type P2 @param fallback the function to be called when an {@link RuntimeException} caught @return the result of this function or the fallback function application
[ "Applies", "this", "partial", "function", "to", "the", "given", "argument", "when", "it", "is", "contained", "in", "the", "function", "domain", ".", "Applies", "fallback", "function", "where", "this", "partial", "function", "is", "not", "defined", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L945-L951
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cdn_dedicated_serviceName_quota_GET
public ArrayList<String> cdn_dedicated_serviceName_quota_GET(String serviceName, OvhOrderQuotaEnum quota) throws IOException { """ Get allowed durations for 'quota' option REST: GET /order/cdn/dedicated/{serviceName}/quota @param quota [required] quota number in TB that will be added to the CDN service @param serviceName [required] The internal name of your CDN offer """ String qPath = "/order/cdn/dedicated/{serviceName}/quota"; StringBuilder sb = path(qPath, serviceName); query(sb, "quota", quota); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> cdn_dedicated_serviceName_quota_GET(String serviceName, OvhOrderQuotaEnum quota) throws IOException { String qPath = "/order/cdn/dedicated/{serviceName}/quota"; StringBuilder sb = path(qPath, serviceName); query(sb, "quota", quota); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "cdn_dedicated_serviceName_quota_GET", "(", "String", "serviceName", ",", "OvhOrderQuotaEnum", "quota", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cdn/dedicated/{serviceName}/quota\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"quota\"", ",", "quota", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
Get allowed durations for 'quota' option REST: GET /order/cdn/dedicated/{serviceName}/quota @param quota [required] quota number in TB that will be added to the CDN service @param serviceName [required] The internal name of your CDN offer
[ "Get", "allowed", "durations", "for", "quota", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5337-L5343
structr/structr
structr-core/src/main/java/org/structr/core/auth/HashHelper.java
HashHelper.getHash
public static String getHash(final String password, final String salt) { """ Calculate a SHA-512 hash of the given password string. If salt is given, use salt. @param password @param salt @return hash """ if (StringUtils.isEmpty(salt)) { return getSimpleHash(password); } return DigestUtils.sha512Hex(DigestUtils.sha512Hex(password).concat(salt)); }
java
public static String getHash(final String password, final String salt) { if (StringUtils.isEmpty(salt)) { return getSimpleHash(password); } return DigestUtils.sha512Hex(DigestUtils.sha512Hex(password).concat(salt)); }
[ "public", "static", "String", "getHash", "(", "final", "String", "password", ",", "final", "String", "salt", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "salt", ")", ")", "{", "return", "getSimpleHash", "(", "password", ")", ";", "}", "return", "DigestUtils", ".", "sha512Hex", "(", "DigestUtils", ".", "sha512Hex", "(", "password", ")", ".", "concat", "(", "salt", ")", ")", ";", "}" ]
Calculate a SHA-512 hash of the given password string. If salt is given, use salt. @param password @param salt @return hash
[ "Calculate", "a", "SHA", "-", "512", "hash", "of", "the", "given", "password", "string", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/auth/HashHelper.java#L38-L48
alibaba/otter
shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java
ZkClientx.watchForChilds
public List<String> watchForChilds(final String path) { """ Installs a child watch for the given path. @param path @return the current children of the path or null if the zk node with the given path doesn't exist. """ if (_zookeeperEventThread != null && Thread.currentThread() == _zookeeperEventThread) { throw new IllegalArgumentException("Must not be done in the zookeeper event thread."); } return retryUntilConnected(new Callable<List<String>>() { @Override public List<String> call() throws Exception { exists(path, true); try { return getChildren(path, true); } catch (ZkNoNodeException e) { // ignore, the "exists" watch will listen for the parent node to appear } return null; } }); }
java
public List<String> watchForChilds(final String path) { if (_zookeeperEventThread != null && Thread.currentThread() == _zookeeperEventThread) { throw new IllegalArgumentException("Must not be done in the zookeeper event thread."); } return retryUntilConnected(new Callable<List<String>>() { @Override public List<String> call() throws Exception { exists(path, true); try { return getChildren(path, true); } catch (ZkNoNodeException e) { // ignore, the "exists" watch will listen for the parent node to appear } return null; } }); }
[ "public", "List", "<", "String", ">", "watchForChilds", "(", "final", "String", "path", ")", "{", "if", "(", "_zookeeperEventThread", "!=", "null", "&&", "Thread", ".", "currentThread", "(", ")", "==", "_zookeeperEventThread", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Must not be done in the zookeeper event thread.\"", ")", ";", "}", "return", "retryUntilConnected", "(", "new", "Callable", "<", "List", "<", "String", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "String", ">", "call", "(", ")", "throws", "Exception", "{", "exists", "(", "path", ",", "true", ")", ";", "try", "{", "return", "getChildren", "(", "path", ",", "true", ")", ";", "}", "catch", "(", "ZkNoNodeException", "e", ")", "{", "// ignore, the \"exists\" watch will listen for the parent node to appear", "}", "return", "null", ";", "}", "}", ")", ";", "}" ]
Installs a child watch for the given path. @param path @return the current children of the path or null if the zk node with the given path doesn't exist.
[ "Installs", "a", "child", "watch", "for", "the", "given", "path", "." ]
train
https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java#L934-L951
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java
PixelMath.boundImage
public static void boundImage( GrayF64 img , double min , double max ) { """ Bounds image pixels to be between these two values @param img Image @param min minimum value. @param max maximum value. """ ImplPixelMath.boundImage(img,min,max); }
java
public static void boundImage( GrayF64 img , double min , double max ) { ImplPixelMath.boundImage(img,min,max); }
[ "public", "static", "void", "boundImage", "(", "GrayF64", "img", ",", "double", "min", ",", "double", "max", ")", "{", "ImplPixelMath", ".", "boundImage", "(", "img", ",", "min", ",", "max", ")", ";", "}" ]
Bounds image pixels to be between these two values @param img Image @param min minimum value. @param max maximum value.
[ "Bounds", "image", "pixels", "to", "be", "between", "these", "two", "values" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L4515-L4517
virgo47/javasimon
core/src/main/java/org/javasimon/utils/bean/ClassUtils.java
ClassUtils.getField
static Field getField(Class<?> targetClass, String fieldName) { """ Get field with the specified name. @param targetClass class for which a field will be returned @param fieldName name of the field that should be returned @return field with the specified name if one exists, null otherwise """ while (targetClass != null) { try { Field field = targetClass.getDeclaredField(fieldName); logger.debug("Found field {} in class {}", fieldName, targetClass.getName()); return field; } catch (NoSuchFieldException e) { logger.debug("Failed to find field {} in class {}", fieldName, targetClass.getName()); } targetClass = targetClass.getSuperclass(); } return null; }
java
static Field getField(Class<?> targetClass, String fieldName) { while (targetClass != null) { try { Field field = targetClass.getDeclaredField(fieldName); logger.debug("Found field {} in class {}", fieldName, targetClass.getName()); return field; } catch (NoSuchFieldException e) { logger.debug("Failed to find field {} in class {}", fieldName, targetClass.getName()); } targetClass = targetClass.getSuperclass(); } return null; }
[ "static", "Field", "getField", "(", "Class", "<", "?", ">", "targetClass", ",", "String", "fieldName", ")", "{", "while", "(", "targetClass", "!=", "null", ")", "{", "try", "{", "Field", "field", "=", "targetClass", ".", "getDeclaredField", "(", "fieldName", ")", ";", "logger", ".", "debug", "(", "\"Found field {} in class {}\"", ",", "fieldName", ",", "targetClass", ".", "getName", "(", ")", ")", ";", "return", "field", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", "logger", ".", "debug", "(", "\"Failed to find field {} in class {}\"", ",", "fieldName", ",", "targetClass", ".", "getName", "(", ")", ")", ";", "}", "targetClass", "=", "targetClass", ".", "getSuperclass", "(", ")", ";", "}", "return", "null", ";", "}" ]
Get field with the specified name. @param targetClass class for which a field will be returned @param fieldName name of the field that should be returned @return field with the specified name if one exists, null otherwise
[ "Get", "field", "with", "the", "specified", "name", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/bean/ClassUtils.java#L31-L44
jmxtrans/jmxtrans
jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/StackdriverWriter.java
StackdriverWriter.validateSetup
@Override public void validateSetup(Server server, Query query) throws ValidationException { """ Sets up the object and makes sure all the required parameters are available<br/> Minimally a Stackdriver API key must be provided using the token setting """ logger.info("Starting Stackdriver writer connected to '{}', proxy {} ...", gatewayUrl, proxy); }
java
@Override public void validateSetup(Server server, Query query) throws ValidationException { logger.info("Starting Stackdriver writer connected to '{}', proxy {} ...", gatewayUrl, proxy); }
[ "@", "Override", "public", "void", "validateSetup", "(", "Server", "server", ",", "Query", "query", ")", "throws", "ValidationException", "{", "logger", ".", "info", "(", "\"Starting Stackdriver writer connected to '{}', proxy {} ...\"", ",", "gatewayUrl", ",", "proxy", ")", ";", "}" ]
Sets up the object and makes sure all the required parameters are available<br/> Minimally a Stackdriver API key must be provided using the token setting
[ "Sets", "up", "the", "object", "and", "makes", "sure", "all", "the", "required", "parameters", "are", "available<br", "/", ">", "Minimally", "a", "Stackdriver", "API", "key", "must", "be", "provided", "using", "the", "token", "setting" ]
train
https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/StackdriverWriter.java#L216-L219
kubernetes-client/java
kubernetes/src/main/java/io/kubernetes/client/apis/CoreV1Api.java
CoreV1Api.readNamespacedPodLogAsync
public com.squareup.okhttp.Call readNamespacedPodLogAsync(String name, String namespace, String container, Boolean follow, Integer limitBytes, String pretty, Boolean previous, Integer sinceSeconds, Integer tailLines, Boolean timestamps, final ApiCallback<String> callback) throws ApiException { """ (asynchronously) read log of the specified Pod @param name name of the Pod (required) @param namespace object name and auth scope, such as for teams and projects (required) @param container The container for which to stream logs. Defaults to only container if there is one container in the pod. (optional) @param follow Follow the log stream of the pod. Defaults to false. (optional) @param limitBytes If set, the number of bytes to read from the server before terminating the log output. This may not display a complete final line of logging, and may return slightly more or slightly less than the specified limit. (optional) @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) @param previous Return previous terminated container logs. Defaults to false. (optional) @param sinceSeconds A relative time in seconds before the current time from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified. (optional) @param tailLines If set, the number of lines from the end of the logs to show. If not specified, logs are shown from the creation of the container or sinceSeconds or sinceTime (optional) @param timestamps If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line of log output. Defaults to false. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = readNamespacedPodLogValidateBeforeCall(name, namespace, container, follow, limitBytes, pretty, previous, sinceSeconds, tailLines, timestamps, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call readNamespacedPodLogAsync(String name, String namespace, String container, Boolean follow, Integer limitBytes, String pretty, Boolean previous, Integer sinceSeconds, Integer tailLines, Boolean timestamps, final ApiCallback<String> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = readNamespacedPodLogValidateBeforeCall(name, namespace, container, follow, limitBytes, pretty, previous, sinceSeconds, tailLines, timestamps, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "readNamespacedPodLogAsync", "(", "String", "name", ",", "String", "namespace", ",", "String", "container", ",", "Boolean", "follow", ",", "Integer", "limitBytes", ",", "String", "pretty", ",", "Boolean", "previous", ",", "Integer", "sinceSeconds", ",", "Integer", "tailLines", ",", "Boolean", "timestamps", ",", "final", "ApiCallback", "<", "String", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "readNamespacedPodLogValidateBeforeCall", "(", "name", ",", "namespace", ",", "container", ",", "follow", ",", "limitBytes", ",", "pretty", ",", "previous", ",", "sinceSeconds", ",", "tailLines", ",", "timestamps", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "String", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
(asynchronously) read log of the specified Pod @param name name of the Pod (required) @param namespace object name and auth scope, such as for teams and projects (required) @param container The container for which to stream logs. Defaults to only container if there is one container in the pod. (optional) @param follow Follow the log stream of the pod. Defaults to false. (optional) @param limitBytes If set, the number of bytes to read from the server before terminating the log output. This may not display a complete final line of logging, and may return slightly more or slightly less than the specified limit. (optional) @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) @param previous Return previous terminated container logs. Defaults to false. (optional) @param sinceSeconds A relative time in seconds before the current time from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified. (optional) @param tailLines If set, the number of lines from the end of the logs to show. If not specified, logs are shown from the creation of the container or sinceSeconds or sinceTime (optional) @param timestamps If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line of log output. Defaults to false. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "(", "asynchronously", ")", "read", "log", "of", "the", "specified", "Pod" ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/apis/CoreV1Api.java#L25166-L25191
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java
PipelineBuilder.addUnionExpression
public void addUnionExpression(final INodeReadTrx mTransaction) { """ Adds a union expression to the pipeline. @param mTransaction Transaction to operate with. """ assert getPipeStack().size() >= 2; final AbsAxis mOperand2 = getPipeStack().pop().getExpr(); final AbsAxis mOperand1 = getPipeStack().pop().getExpr(); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add( new DupFilterAxis(mTransaction, new UnionAxis(mTransaction, mOperand1, mOperand2))); }
java
public void addUnionExpression(final INodeReadTrx mTransaction) { assert getPipeStack().size() >= 2; final AbsAxis mOperand2 = getPipeStack().pop().getExpr(); final AbsAxis mOperand1 = getPipeStack().pop().getExpr(); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add( new DupFilterAxis(mTransaction, new UnionAxis(mTransaction, mOperand1, mOperand2))); }
[ "public", "void", "addUnionExpression", "(", "final", "INodeReadTrx", "mTransaction", ")", "{", "assert", "getPipeStack", "(", ")", ".", "size", "(", ")", ">=", "2", ";", "final", "AbsAxis", "mOperand2", "=", "getPipeStack", "(", ")", ".", "pop", "(", ")", ".", "getExpr", "(", ")", ";", "final", "AbsAxis", "mOperand1", "=", "getPipeStack", "(", ")", ".", "pop", "(", ")", ".", "getExpr", "(", ")", ";", "if", "(", "getPipeStack", "(", ")", ".", "empty", "(", ")", "||", "getExpression", "(", ")", ".", "getSize", "(", ")", "!=", "0", ")", "{", "addExpressionSingle", "(", ")", ";", "}", "getExpression", "(", ")", ".", "add", "(", "new", "DupFilterAxis", "(", "mTransaction", ",", "new", "UnionAxis", "(", "mTransaction", ",", "mOperand1", ",", "mOperand2", ")", ")", ")", ";", "}" ]
Adds a union expression to the pipeline. @param mTransaction Transaction to operate with.
[ "Adds", "a", "union", "expression", "to", "the", "pipeline", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L401-L412
real-logic/agrona
agrona/src/main/java/org/agrona/concurrent/status/AtomicCounter.java
AtomicCounter.compareAndSet
public boolean compareAndSet(final long expectedValue, final long updateValue) { """ Compare the current value to expected and if true then set to the update value atomically. @param expectedValue for the counter. @param updateValue for the counter. @return true if successful otherwise false. """ return UnsafeAccess.UNSAFE.compareAndSwapLong(byteArray, addressOffset, expectedValue, updateValue); }
java
public boolean compareAndSet(final long expectedValue, final long updateValue) { return UnsafeAccess.UNSAFE.compareAndSwapLong(byteArray, addressOffset, expectedValue, updateValue); }
[ "public", "boolean", "compareAndSet", "(", "final", "long", "expectedValue", ",", "final", "long", "updateValue", ")", "{", "return", "UnsafeAccess", ".", "UNSAFE", ".", "compareAndSwapLong", "(", "byteArray", ",", "addressOffset", ",", "expectedValue", ",", "updateValue", ")", ";", "}" ]
Compare the current value to expected and if true then set to the update value atomically. @param expectedValue for the counter. @param updateValue for the counter. @return true if successful otherwise false.
[ "Compare", "the", "current", "value", "to", "expected", "and", "if", "true", "then", "set", "to", "the", "update", "value", "atomically", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/concurrent/status/AtomicCounter.java#L185-L188
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/maven2/MavenDependenciesRecorder.java
MavenDependenciesRecorder.postBuild
@Override public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws InterruptedException, IOException { """ Sends the collected dependencies over to the master and record them. """ build.executeAsync(new BuildCallable<Void, IOException>() { // record is transient, so needs to make a copy first private final Set<MavenDependency> d = dependencies; public Void call(MavenBuild build) throws IOException, InterruptedException { // add the action //TODO: [by yl] These actions are persisted into the build.xml of each build run - we need another //context to store these actions build.getActions().add(new MavenDependenciesRecord(build, d)); return null; } }); return true; }
java
@Override public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws InterruptedException, IOException { build.executeAsync(new BuildCallable<Void, IOException>() { // record is transient, so needs to make a copy first private final Set<MavenDependency> d = dependencies; public Void call(MavenBuild build) throws IOException, InterruptedException { // add the action //TODO: [by yl] These actions are persisted into the build.xml of each build run - we need another //context to store these actions build.getActions().add(new MavenDependenciesRecord(build, d)); return null; } }); return true; }
[ "@", "Override", "public", "boolean", "postBuild", "(", "MavenBuildProxy", "build", ",", "MavenProject", "pom", ",", "BuildListener", "listener", ")", "throws", "InterruptedException", ",", "IOException", "{", "build", ".", "executeAsync", "(", "new", "BuildCallable", "<", "Void", ",", "IOException", ">", "(", ")", "{", "// record is transient, so needs to make a copy first", "private", "final", "Set", "<", "MavenDependency", ">", "d", "=", "dependencies", ";", "public", "Void", "call", "(", "MavenBuild", "build", ")", "throws", "IOException", ",", "InterruptedException", "{", "// add the action", "//TODO: [by yl] These actions are persisted into the build.xml of each build run - we need another", "//context to store these actions", "build", ".", "getActions", "(", ")", ".", "add", "(", "new", "MavenDependenciesRecord", "(", "build", ",", "d", ")", ")", ";", "return", "null", ";", "}", "}", ")", ";", "return", "true", ";", "}" ]
Sends the collected dependencies over to the master and record them.
[ "Sends", "the", "collected", "dependencies", "over", "to", "the", "master", "and", "record", "them", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/maven2/MavenDependenciesRecorder.java#L66-L82
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
Settings.getDouble
@CheckForNull public Double getDouble(String key) { """ Effective value as {@code Double}. @return the value as {@code Double}. If the property does not have value nor default value, then {@code null} is returned. @throws NumberFormatException if value is not empty and is not a parsable number """ String value = getString(key); if (StringUtils.isNotEmpty(value)) { try { return Double.valueOf(value); } catch (NumberFormatException e) { throw new IllegalStateException(String.format("The property '%s' is not a double value", key)); } } return null; }
java
@CheckForNull public Double getDouble(String key) { String value = getString(key); if (StringUtils.isNotEmpty(value)) { try { return Double.valueOf(value); } catch (NumberFormatException e) { throw new IllegalStateException(String.format("The property '%s' is not a double value", key)); } } return null; }
[ "@", "CheckForNull", "public", "Double", "getDouble", "(", "String", "key", ")", "{", "String", "value", "=", "getString", "(", "key", ")", ";", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "value", ")", ")", "{", "try", "{", "return", "Double", ".", "valueOf", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "\"The property '%s' is not a double value\"", ",", "key", ")", ")", ";", "}", "}", "return", "null", ";", "}" ]
Effective value as {@code Double}. @return the value as {@code Double}. If the property does not have value nor default value, then {@code null} is returned. @throws NumberFormatException if value is not empty and is not a parsable number
[ "Effective", "value", "as", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java#L249-L260
alkacon/opencms-core
src/org/opencms/db/generic/CmsProjectDriver.java
CmsProjectDriver.internalReadLogEntry
protected CmsLogEntry internalReadLogEntry(ResultSet res) throws SQLException { """ Creates a new {@link CmsLogEntry} object from the given result set entry.<p> @param res the result set @return the new {@link CmsLogEntry} object @throws SQLException if something goes wrong """ CmsUUID userId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_LOG_USER_ID"))); long date = res.getLong(m_sqlManager.readQuery("C_LOG_DATE")); CmsUUID structureId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_LOG_STRUCTURE_ID"))); CmsLogEntryType type = CmsLogEntryType.valueOf(res.getInt(m_sqlManager.readQuery("C_LOG_TYPE"))); String[] data = CmsStringUtil.splitAsArray(res.getString(m_sqlManager.readQuery("C_LOG_DATA")), '|'); return new CmsLogEntry(userId, date, structureId, type, data); }
java
protected CmsLogEntry internalReadLogEntry(ResultSet res) throws SQLException { CmsUUID userId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_LOG_USER_ID"))); long date = res.getLong(m_sqlManager.readQuery("C_LOG_DATE")); CmsUUID structureId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_LOG_STRUCTURE_ID"))); CmsLogEntryType type = CmsLogEntryType.valueOf(res.getInt(m_sqlManager.readQuery("C_LOG_TYPE"))); String[] data = CmsStringUtil.splitAsArray(res.getString(m_sqlManager.readQuery("C_LOG_DATA")), '|'); return new CmsLogEntry(userId, date, structureId, type, data); }
[ "protected", "CmsLogEntry", "internalReadLogEntry", "(", "ResultSet", "res", ")", "throws", "SQLException", "{", "CmsUUID", "userId", "=", "new", "CmsUUID", "(", "res", ".", "getString", "(", "m_sqlManager", ".", "readQuery", "(", "\"C_LOG_USER_ID\"", ")", ")", ")", ";", "long", "date", "=", "res", ".", "getLong", "(", "m_sqlManager", ".", "readQuery", "(", "\"C_LOG_DATE\"", ")", ")", ";", "CmsUUID", "structureId", "=", "new", "CmsUUID", "(", "res", ".", "getString", "(", "m_sqlManager", ".", "readQuery", "(", "\"C_LOG_STRUCTURE_ID\"", ")", ")", ")", ";", "CmsLogEntryType", "type", "=", "CmsLogEntryType", ".", "valueOf", "(", "res", ".", "getInt", "(", "m_sqlManager", ".", "readQuery", "(", "\"C_LOG_TYPE\"", ")", ")", ")", ";", "String", "[", "]", "data", "=", "CmsStringUtil", ".", "splitAsArray", "(", "res", ".", "getString", "(", "m_sqlManager", ".", "readQuery", "(", "\"C_LOG_DATA\"", ")", ")", ",", "'", "'", ")", ";", "return", "new", "CmsLogEntry", "(", "userId", ",", "date", ",", "structureId", ",", "type", ",", "data", ")", ";", "}" ]
Creates a new {@link CmsLogEntry} object from the given result set entry.<p> @param res the result set @return the new {@link CmsLogEntry} object @throws SQLException if something goes wrong
[ "Creates", "a", "new", "{", "@link", "CmsLogEntry", "}", "object", "from", "the", "given", "result", "set", "entry", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsProjectDriver.java#L3164-L3172
VoltDB/voltdb
src/frontend/org/voltdb/utils/CatalogUtil.java
CatalogUtil.getBuildInfoFromJar
public static String[] getBuildInfoFromJar(InMemoryJarfile jarfile) throws IOException { """ Get the catalog build info from the jar bytes. Performs sanity checks on the build info and version strings. @param jarfile in-memory catalog jar file @return build info lines @throws IOException If the catalog or the version string cannot be loaded. """ // Read the raw build info bytes. byte[] buildInfoBytes = jarfile.get(CATALOG_BUILDINFO_FILENAME); if (buildInfoBytes == null) { throw new IOException("Catalog build information not found - please build your application using the current version of VoltDB."); } // Convert the bytes to a string and split by lines. String buildInfo; buildInfo = new String(buildInfoBytes, Constants.UTF8ENCODING); String[] buildInfoLines = buildInfo.split("\n"); // Sanity check the number of lines and the version string. if (buildInfoLines.length < 1) { throw new IOException("Catalog build info has no version string."); } String versionFromCatalog = buildInfoLines[0].trim(); if (!CatalogUtil.isCatalogVersionValid(versionFromCatalog)) { throw new IOException(String.format( "Catalog build info version (%s) is bad.", versionFromCatalog)); } // Trim leading/trailing whitespace. for (int i = 0; i < buildInfoLines.length; ++i) { buildInfoLines[i] = buildInfoLines[i].trim(); } return buildInfoLines; }
java
public static String[] getBuildInfoFromJar(InMemoryJarfile jarfile) throws IOException { // Read the raw build info bytes. byte[] buildInfoBytes = jarfile.get(CATALOG_BUILDINFO_FILENAME); if (buildInfoBytes == null) { throw new IOException("Catalog build information not found - please build your application using the current version of VoltDB."); } // Convert the bytes to a string and split by lines. String buildInfo; buildInfo = new String(buildInfoBytes, Constants.UTF8ENCODING); String[] buildInfoLines = buildInfo.split("\n"); // Sanity check the number of lines and the version string. if (buildInfoLines.length < 1) { throw new IOException("Catalog build info has no version string."); } String versionFromCatalog = buildInfoLines[0].trim(); if (!CatalogUtil.isCatalogVersionValid(versionFromCatalog)) { throw new IOException(String.format( "Catalog build info version (%s) is bad.", versionFromCatalog)); } // Trim leading/trailing whitespace. for (int i = 0; i < buildInfoLines.length; ++i) { buildInfoLines[i] = buildInfoLines[i].trim(); } return buildInfoLines; }
[ "public", "static", "String", "[", "]", "getBuildInfoFromJar", "(", "InMemoryJarfile", "jarfile", ")", "throws", "IOException", "{", "// Read the raw build info bytes.", "byte", "[", "]", "buildInfoBytes", "=", "jarfile", ".", "get", "(", "CATALOG_BUILDINFO_FILENAME", ")", ";", "if", "(", "buildInfoBytes", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Catalog build information not found - please build your application using the current version of VoltDB.\"", ")", ";", "}", "// Convert the bytes to a string and split by lines.", "String", "buildInfo", ";", "buildInfo", "=", "new", "String", "(", "buildInfoBytes", ",", "Constants", ".", "UTF8ENCODING", ")", ";", "String", "[", "]", "buildInfoLines", "=", "buildInfo", ".", "split", "(", "\"\\n\"", ")", ";", "// Sanity check the number of lines and the version string.", "if", "(", "buildInfoLines", ".", "length", "<", "1", ")", "{", "throw", "new", "IOException", "(", "\"Catalog build info has no version string.\"", ")", ";", "}", "String", "versionFromCatalog", "=", "buildInfoLines", "[", "0", "]", ".", "trim", "(", ")", ";", "if", "(", "!", "CatalogUtil", ".", "isCatalogVersionValid", "(", "versionFromCatalog", ")", ")", "{", "throw", "new", "IOException", "(", "String", ".", "format", "(", "\"Catalog build info version (%s) is bad.\"", ",", "versionFromCatalog", ")", ")", ";", "}", "// Trim leading/trailing whitespace.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buildInfoLines", ".", "length", ";", "++", "i", ")", "{", "buildInfoLines", "[", "i", "]", "=", "buildInfoLines", "[", "i", "]", ".", "trim", "(", ")", ";", "}", "return", "buildInfoLines", ";", "}" ]
Get the catalog build info from the jar bytes. Performs sanity checks on the build info and version strings. @param jarfile in-memory catalog jar file @return build info lines @throws IOException If the catalog or the version string cannot be loaded.
[ "Get", "the", "catalog", "build", "info", "from", "the", "jar", "bytes", ".", "Performs", "sanity", "checks", "on", "the", "build", "info", "and", "version", "strings", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogUtil.java#L298-L328
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.rotate
public static BufferedImage rotate(Image image, int degree) { """ 旋转图片为指定角度<br> 来自:http://blog.51cto.com/cping1982/130066 @param image 目标图像 @param degree 旋转角度 @return 旋转后的图片 @since 3.2.2 """ return Img.from(image).rotate(degree).getImg(); }
java
public static BufferedImage rotate(Image image, int degree) { return Img.from(image).rotate(degree).getImg(); }
[ "public", "static", "BufferedImage", "rotate", "(", "Image", "image", ",", "int", "degree", ")", "{", "return", "Img", ".", "from", "(", "image", ")", ".", "rotate", "(", "degree", ")", ".", "getImg", "(", ")", ";", "}" ]
旋转图片为指定角度<br> 来自:http://blog.51cto.com/cping1982/130066 @param image 目标图像 @param degree 旋转角度 @return 旋转后的图片 @since 3.2.2
[ "旋转图片为指定角度<br", ">", "来自:http", ":", "//", "blog", ".", "51cto", ".", "com", "/", "cping1982", "/", "130066" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1057-L1059
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByLongitude
public Iterable<DContact> queryByLongitude(Object parent, java.lang.Float longitude) { """ query-by method for field longitude @param longitude the specified attribute @return an Iterable of DContacts for the specified longitude """ return queryByField(parent, DContactMapper.Field.LONGITUDE.getFieldName(), longitude); }
java
public Iterable<DContact> queryByLongitude(Object parent, java.lang.Float longitude) { return queryByField(parent, DContactMapper.Field.LONGITUDE.getFieldName(), longitude); }
[ "public", "Iterable", "<", "DContact", ">", "queryByLongitude", "(", "Object", "parent", ",", "java", ".", "lang", ".", "Float", "longitude", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "LONGITUDE", ".", "getFieldName", "(", ")", ",", "longitude", ")", ";", "}" ]
query-by method for field longitude @param longitude the specified attribute @return an Iterable of DContacts for the specified longitude
[ "query", "-", "by", "method", "for", "field", "longitude" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L214-L216
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/validator/CacheValidator.java
CacheValidator.check
public static void check(LinkedHashMap<String, Object> nameExpectedValues, long timeout, String failMessagePrefix) throws QTasteTestFailException { """ Note that since nameExpectedValues is a map, it can only contain one expected value per name. """ CacheValidator validator = new CacheValidator(nameExpectedValues, timeout); validator.validate(failMessagePrefix); }
java
public static void check(LinkedHashMap<String, Object> nameExpectedValues, long timeout, String failMessagePrefix) throws QTasteTestFailException { CacheValidator validator = new CacheValidator(nameExpectedValues, timeout); validator.validate(failMessagePrefix); }
[ "public", "static", "void", "check", "(", "LinkedHashMap", "<", "String", ",", "Object", ">", "nameExpectedValues", ",", "long", "timeout", ",", "String", "failMessagePrefix", ")", "throws", "QTasteTestFailException", "{", "CacheValidator", "validator", "=", "new", "CacheValidator", "(", "nameExpectedValues", ",", "timeout", ")", ";", "validator", ".", "validate", "(", "failMessagePrefix", ")", ";", "}" ]
Note that since nameExpectedValues is a map, it can only contain one expected value per name.
[ "Note", "that", "since", "nameExpectedValues", "is", "a", "map", "it", "can", "only", "contain", "one", "expected", "value", "per", "name", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/validator/CacheValidator.java#L66-L70
DavidPizarro/PinView
library/src/main/java/com/dpizarro/pinview/library/PinViewUtils.java
PinViewUtils.convertPixelToDp
public static float convertPixelToDp(Context context, float px) { """ This method converts device specific pixels to density independent pixels. @param px A value in px (pixels) unit. Which we need to convert into db @param context Context to get resources and device specific display metrics @return A float value to represent dp equivalent to px value """ Resources resources = context.getResources(); DisplayMetrics metrics = resources.getDisplayMetrics(); return px / (metrics.densityDpi / 160f); }
java
public static float convertPixelToDp(Context context, float px) { Resources resources = context.getResources(); DisplayMetrics metrics = resources.getDisplayMetrics(); return px / (metrics.densityDpi / 160f); }
[ "public", "static", "float", "convertPixelToDp", "(", "Context", "context", ",", "float", "px", ")", "{", "Resources", "resources", "=", "context", ".", "getResources", "(", ")", ";", "DisplayMetrics", "metrics", "=", "resources", ".", "getDisplayMetrics", "(", ")", ";", "return", "px", "/", "(", "metrics", ".", "densityDpi", "/", "160f", ")", ";", "}" ]
This method converts device specific pixels to density independent pixels. @param px A value in px (pixels) unit. Which we need to convert into db @param context Context to get resources and device specific display metrics @return A float value to represent dp equivalent to px value
[ "This", "method", "converts", "device", "specific", "pixels", "to", "density", "independent", "pixels", "." ]
train
https://github.com/DavidPizarro/PinView/blob/b171a89694921475b5442585810b8475ef1cfe35/library/src/main/java/com/dpizarro/pinview/library/PinViewUtils.java#L83-L87
box/box-java-sdk
src/main/java/com/box/sdk/BoxJSONObject.java
BoxJSONObject.addPendingChange
private void addPendingChange(String key, JsonValue value) { """ Adds a pending field change that needs to be sent to the API. It will be included in the JSON string the next time {@link #getPendingChanges} is called. @param key the name of the field. @param value the JsonValue of the field. """ if (this.pendingChanges == null) { this.pendingChanges = new JsonObject(); } this.pendingChanges.set(key, value); }
java
private void addPendingChange(String key, JsonValue value) { if (this.pendingChanges == null) { this.pendingChanges = new JsonObject(); } this.pendingChanges.set(key, value); }
[ "private", "void", "addPendingChange", "(", "String", "key", ",", "JsonValue", "value", ")", "{", "if", "(", "this", ".", "pendingChanges", "==", "null", ")", "{", "this", ".", "pendingChanges", "=", "new", "JsonObject", "(", ")", ";", "}", "this", ".", "pendingChanges", ".", "set", "(", "key", ",", "value", ")", ";", "}" ]
Adds a pending field change that needs to be sent to the API. It will be included in the JSON string the next time {@link #getPendingChanges} is called. @param key the name of the field. @param value the JsonValue of the field.
[ "Adds", "a", "pending", "field", "change", "that", "needs", "to", "be", "sent", "to", "the", "API", ".", "It", "will", "be", "included", "in", "the", "JSON", "string", "the", "next", "time", "{" ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxJSONObject.java#L169-L175
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/processor/MetaModelBuilder.java
MetaModelBuilder.processInternal
private AbstractManagedType<X> processInternal(Class<X> clazz, boolean isIdClass) { """ Process. @param clazz the clazz @return the abstract managed type """ if (managedTypes.get(clazz) == null) { return buildManagedType(clazz, isIdClass); } else { return (AbstractManagedType<X>) managedTypes.get(clazz); } }
java
private AbstractManagedType<X> processInternal(Class<X> clazz, boolean isIdClass) { if (managedTypes.get(clazz) == null) { return buildManagedType(clazz, isIdClass); } else { return (AbstractManagedType<X>) managedTypes.get(clazz); } }
[ "private", "AbstractManagedType", "<", "X", ">", "processInternal", "(", "Class", "<", "X", ">", "clazz", ",", "boolean", "isIdClass", ")", "{", "if", "(", "managedTypes", ".", "get", "(", "clazz", ")", "==", "null", ")", "{", "return", "buildManagedType", "(", "clazz", ",", "isIdClass", ")", ";", "}", "else", "{", "return", "(", "AbstractManagedType", "<", "X", ">", ")", "managedTypes", ".", "get", "(", "clazz", ")", ";", "}", "}" ]
Process. @param clazz the clazz @return the abstract managed type
[ "Process", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/processor/MetaModelBuilder.java#L817-L827
google/closure-compiler
src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java
FixedPointGraphTraversal.computeFixedPoint
public void computeFixedPoint(DiGraph<N, E> graph) { """ Compute a fixed point for the given graph. @param graph The graph to traverse. """ Set<N> nodes = new LinkedHashSet<>(); for (DiGraphNode<N, E> node : graph.getDirectedGraphNodes()) { nodes.add(node.getValue()); } computeFixedPoint(graph, nodes); }
java
public void computeFixedPoint(DiGraph<N, E> graph) { Set<N> nodes = new LinkedHashSet<>(); for (DiGraphNode<N, E> node : graph.getDirectedGraphNodes()) { nodes.add(node.getValue()); } computeFixedPoint(graph, nodes); }
[ "public", "void", "computeFixedPoint", "(", "DiGraph", "<", "N", ",", "E", ">", "graph", ")", "{", "Set", "<", "N", ">", "nodes", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "for", "(", "DiGraphNode", "<", "N", ",", "E", ">", "node", ":", "graph", ".", "getDirectedGraphNodes", "(", ")", ")", "{", "nodes", ".", "add", "(", "node", ".", "getValue", "(", ")", ")", ";", "}", "computeFixedPoint", "(", "graph", ",", "nodes", ")", ";", "}" ]
Compute a fixed point for the given graph. @param graph The graph to traverse.
[ "Compute", "a", "fixed", "point", "for", "the", "given", "graph", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java#L67-L73
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/MapcodeCodec.java
MapcodeCodec.decodeToRectangle
@Nonnull public static Rectangle decodeToRectangle(@Nonnull final String mapcode, @Nullable final Territory defaultTerritoryContext) throws UnknownMapcodeException, IllegalArgumentException, UnknownPrecisionFormatException { """ Decode a mapcode to a Rectangle, which defines the valid zone for a mapcode. The boundaries of the mapcode zone are inclusive for the South and West borders and exclusive for the North and East borders. This is essentially the same call as a 'decode', except it returns a rectangle, rather than its center point. @param mapcode Mapcode. @param defaultTerritoryContext Default territory context for disambiguation purposes. May be null. @return Rectangle Mapcode zone. South/West borders are inclusive, North/East borders exclusive. @throws UnknownMapcodeException Thrown if the mapcode has the correct syntax, but cannot be decoded into a point. @throws UnknownPrecisionFormatException Thrown if the precision format is incorrect. @throws IllegalArgumentException Thrown if arguments are null, or if the syntax of the mapcode is incorrect. """ checkNonnull("mapcode", mapcode); final MapcodeZone mapcodeZone = decodeToMapcodeZone(mapcode, defaultTerritoryContext); final Point southWest = Point.fromLatLonFractions(mapcodeZone.getLatFractionMin(), mapcodeZone.getLonFractionMin()); final Point northEast = Point.fromLatLonFractions(mapcodeZone.getLatFractionMax(), mapcodeZone.getLonFractionMax()); final Rectangle rectangle = new Rectangle(southWest, northEast); assert rectangle.isDefined(); return rectangle; }
java
@Nonnull public static Rectangle decodeToRectangle(@Nonnull final String mapcode, @Nullable final Territory defaultTerritoryContext) throws UnknownMapcodeException, IllegalArgumentException, UnknownPrecisionFormatException { checkNonnull("mapcode", mapcode); final MapcodeZone mapcodeZone = decodeToMapcodeZone(mapcode, defaultTerritoryContext); final Point southWest = Point.fromLatLonFractions(mapcodeZone.getLatFractionMin(), mapcodeZone.getLonFractionMin()); final Point northEast = Point.fromLatLonFractions(mapcodeZone.getLatFractionMax(), mapcodeZone.getLonFractionMax()); final Rectangle rectangle = new Rectangle(southWest, northEast); assert rectangle.isDefined(); return rectangle; }
[ "@", "Nonnull", "public", "static", "Rectangle", "decodeToRectangle", "(", "@", "Nonnull", "final", "String", "mapcode", ",", "@", "Nullable", "final", "Territory", "defaultTerritoryContext", ")", "throws", "UnknownMapcodeException", ",", "IllegalArgumentException", ",", "UnknownPrecisionFormatException", "{", "checkNonnull", "(", "\"mapcode\"", ",", "mapcode", ")", ";", "final", "MapcodeZone", "mapcodeZone", "=", "decodeToMapcodeZone", "(", "mapcode", ",", "defaultTerritoryContext", ")", ";", "final", "Point", "southWest", "=", "Point", ".", "fromLatLonFractions", "(", "mapcodeZone", ".", "getLatFractionMin", "(", ")", ",", "mapcodeZone", ".", "getLonFractionMin", "(", ")", ")", ";", "final", "Point", "northEast", "=", "Point", ".", "fromLatLonFractions", "(", "mapcodeZone", ".", "getLatFractionMax", "(", ")", ",", "mapcodeZone", ".", "getLonFractionMax", "(", ")", ")", ";", "final", "Rectangle", "rectangle", "=", "new", "Rectangle", "(", "southWest", ",", "northEast", ")", ";", "assert", "rectangle", ".", "isDefined", "(", ")", ";", "return", "rectangle", ";", "}" ]
Decode a mapcode to a Rectangle, which defines the valid zone for a mapcode. The boundaries of the mapcode zone are inclusive for the South and West borders and exclusive for the North and East borders. This is essentially the same call as a 'decode', except it returns a rectangle, rather than its center point. @param mapcode Mapcode. @param defaultTerritoryContext Default territory context for disambiguation purposes. May be null. @return Rectangle Mapcode zone. South/West borders are inclusive, North/East borders exclusive. @throws UnknownMapcodeException Thrown if the mapcode has the correct syntax, but cannot be decoded into a point. @throws UnknownPrecisionFormatException Thrown if the precision format is incorrect. @throws IllegalArgumentException Thrown if arguments are null, or if the syntax of the mapcode is incorrect.
[ "Decode", "a", "mapcode", "to", "a", "Rectangle", "which", "defines", "the", "valid", "zone", "for", "a", "mapcode", ".", "The", "boundaries", "of", "the", "mapcode", "zone", "are", "inclusive", "for", "the", "South", "and", "West", "borders", "and", "exclusive", "for", "the", "North", "and", "East", "borders", ".", "This", "is", "essentially", "the", "same", "call", "as", "a", "decode", "except", "it", "returns", "a", "rectangle", "rather", "than", "its", "center", "point", "." ]
train
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/MapcodeCodec.java#L369-L379
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/NodeSchema.java
NodeSchema.resetTableName
public NodeSchema resetTableName(String tbName, String tbAlias) { """ Substitute table name only for all schema columns and map entries """ m_columns.forEach(sc -> sc.reset(tbName, tbAlias, sc.getColumnName(), sc.getColumnAlias())); m_columnsMapHelper.forEach((k, v) -> k.reset(tbName, tbAlias, k.getColumnName(), k.getColumnAlias())); return this; }
java
public NodeSchema resetTableName(String tbName, String tbAlias) { m_columns.forEach(sc -> sc.reset(tbName, tbAlias, sc.getColumnName(), sc.getColumnAlias())); m_columnsMapHelper.forEach((k, v) -> k.reset(tbName, tbAlias, k.getColumnName(), k.getColumnAlias())); return this; }
[ "public", "NodeSchema", "resetTableName", "(", "String", "tbName", ",", "String", "tbAlias", ")", "{", "m_columns", ".", "forEach", "(", "sc", "->", "sc", ".", "reset", "(", "tbName", ",", "tbAlias", ",", "sc", ".", "getColumnName", "(", ")", ",", "sc", ".", "getColumnAlias", "(", ")", ")", ")", ";", "m_columnsMapHelper", ".", "forEach", "(", "(", "k", ",", "v", ")", "->", "k", ".", "reset", "(", "tbName", ",", "tbAlias", ",", "k", ".", "getColumnName", "(", ")", ",", "k", ".", "getColumnAlias", "(", ")", ")", ")", ";", "return", "this", ";", "}" ]
Substitute table name only for all schema columns and map entries
[ "Substitute", "table", "name", "only", "for", "all", "schema", "columns", "and", "map", "entries" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/NodeSchema.java#L74-L80
git-commit-id/maven-git-commit-id-plugin
src/main/java/pl/project13/maven/git/GitDirLocator.java
GitDirLocator.findProjectGitDirectory
@Nullable private File findProjectGitDirectory() { """ Search up all the maven parent project hierarchy until a .git directory is found. @return File which represents the location of the .git directory or NULL if none found. """ if (this.mavenProject == null) { return null; } File basedir = mavenProject.getBasedir(); while (basedir != null) { File gitdir = new File(basedir, Constants.DOT_GIT); if (gitdir.exists()) { if (gitdir.isDirectory()) { return gitdir; } else if (gitdir.isFile()) { return processGitDirFile(gitdir); } else { return null; } } basedir = basedir.getParentFile(); } return null; }
java
@Nullable private File findProjectGitDirectory() { if (this.mavenProject == null) { return null; } File basedir = mavenProject.getBasedir(); while (basedir != null) { File gitdir = new File(basedir, Constants.DOT_GIT); if (gitdir.exists()) { if (gitdir.isDirectory()) { return gitdir; } else if (gitdir.isFile()) { return processGitDirFile(gitdir); } else { return null; } } basedir = basedir.getParentFile(); } return null; }
[ "@", "Nullable", "private", "File", "findProjectGitDirectory", "(", ")", "{", "if", "(", "this", ".", "mavenProject", "==", "null", ")", "{", "return", "null", ";", "}", "File", "basedir", "=", "mavenProject", ".", "getBasedir", "(", ")", ";", "while", "(", "basedir", "!=", "null", ")", "{", "File", "gitdir", "=", "new", "File", "(", "basedir", ",", "Constants", ".", "DOT_GIT", ")", ";", "if", "(", "gitdir", ".", "exists", "(", ")", ")", "{", "if", "(", "gitdir", ".", "isDirectory", "(", ")", ")", "{", "return", "gitdir", ";", "}", "else", "if", "(", "gitdir", ".", "isFile", "(", ")", ")", "{", "return", "processGitDirFile", "(", "gitdir", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "basedir", "=", "basedir", ".", "getParentFile", "(", ")", ";", "}", "return", "null", ";", "}" ]
Search up all the maven parent project hierarchy until a .git directory is found. @return File which represents the location of the .git directory or NULL if none found.
[ "Search", "up", "all", "the", "maven", "parent", "project", "hierarchy", "until", "a", ".", "git", "directory", "is", "found", "." ]
train
https://github.com/git-commit-id/maven-git-commit-id-plugin/blob/a276551fb043d1b7fc4c890603f6ea0c79dc729a/src/main/java/pl/project13/maven/git/GitDirLocator.java#L73-L94
googleapis/google-cloud-java
google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java
SubscriptionAdminClient.modifyPushConfig
public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig) { """ Modifies the `PushConfig` for a specified subscription. <p>This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`. <p>Sample code: <pre><code> try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); PushConfig pushConfig = PushConfig.newBuilder().build(); subscriptionAdminClient.modifyPushConfig(subscription, pushConfig); } </code></pre> @param subscription The name of the subscription. Format is `projects/{project}/subscriptions/{sub}`. @param pushConfig The push configuration for future deliveries. <p>An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` or `StreamingPull` is not called. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder() .setSubscription(subscription == null ? null : subscription.toString()) .setPushConfig(pushConfig) .build(); modifyPushConfig(request); }
java
public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig) { ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder() .setSubscription(subscription == null ? null : subscription.toString()) .setPushConfig(pushConfig) .build(); modifyPushConfig(request); }
[ "public", "final", "void", "modifyPushConfig", "(", "ProjectSubscriptionName", "subscription", ",", "PushConfig", "pushConfig", ")", "{", "ModifyPushConfigRequest", "request", "=", "ModifyPushConfigRequest", ".", "newBuilder", "(", ")", ".", "setSubscription", "(", "subscription", "==", "null", "?", "null", ":", "subscription", ".", "toString", "(", ")", ")", ".", "setPushConfig", "(", "pushConfig", ")", ".", "build", "(", ")", ";", "modifyPushConfig", "(", "request", ")", ";", "}" ]
Modifies the `PushConfig` for a specified subscription. <p>This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`. <p>Sample code: <pre><code> try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); PushConfig pushConfig = PushConfig.newBuilder().build(); subscriptionAdminClient.modifyPushConfig(subscription, pushConfig); } </code></pre> @param subscription The name of the subscription. Format is `projects/{project}/subscriptions/{sub}`. @param pushConfig The push configuration for future deliveries. <p>An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` or `StreamingPull` is not called. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Modifies", "the", "PushConfig", "for", "a", "specified", "subscription", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java#L1254-L1262
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java
ContinuousDistributions.gSer
private static double gSer(double x, double A) { """ Internal function used by gammaCdf @param x @param A @return """ // Good for X<A+1. double T9=1/A; double G=T9; double I=1; while (T9>G*0.00001) { T9=T9*x/(A+I); G=G+T9; ++I; } G=G*Math.exp(A*Math.log(x)-x-logGamma(A)); return G; }
java
private static double gSer(double x, double A) { // Good for X<A+1. double T9=1/A; double G=T9; double I=1; while (T9>G*0.00001) { T9=T9*x/(A+I); G=G+T9; ++I; } G=G*Math.exp(A*Math.log(x)-x-logGamma(A)); return G; }
[ "private", "static", "double", "gSer", "(", "double", "x", ",", "double", "A", ")", "{", "// Good for X<A+1.", "double", "T9", "=", "1", "/", "A", ";", "double", "G", "=", "T9", ";", "double", "I", "=", "1", ";", "while", "(", "T9", ">", "G", "*", "0.00001", ")", "{", "T9", "=", "T9", "*", "x", "/", "(", "A", "+", "I", ")", ";", "G", "=", "G", "+", "T9", ";", "++", "I", ";", "}", "G", "=", "G", "*", "Math", ".", "exp", "(", "A", "*", "Math", ".", "log", "(", "x", ")", "-", "x", "-", "logGamma", "(", "A", ")", ")", ";", "return", "G", ";", "}" ]
Internal function used by gammaCdf @param x @param A @return
[ "Internal", "function", "used", "by", "gammaCdf" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java#L299-L312
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockMetadataHeader.java
BlockMetadataHeader.writeHeader
static void writeHeader(DataOutputStream out, DataChecksum checksum) throws IOException { """ Writes all the fields till the beginning of checksum. @param out @param checksum @throws IOException """ writeHeader(out, new BlockMetadataHeader(METADATA_VERSION, checksum)); }
java
static void writeHeader(DataOutputStream out, DataChecksum checksum) throws IOException { writeHeader(out, new BlockMetadataHeader(METADATA_VERSION, checksum)); }
[ "static", "void", "writeHeader", "(", "DataOutputStream", "out", ",", "DataChecksum", "checksum", ")", "throws", "IOException", "{", "writeHeader", "(", "out", ",", "new", "BlockMetadataHeader", "(", "METADATA_VERSION", ",", "checksum", ")", ")", ";", "}" ]
Writes all the fields till the beginning of checksum. @param out @param checksum @throws IOException
[ "Writes", "all", "the", "fields", "till", "the", "beginning", "of", "checksum", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockMetadataHeader.java#L143-L146
aws/aws-sdk-java
aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/PlacementTemplate.java
PlacementTemplate.withDeviceTemplates
public PlacementTemplate withDeviceTemplates(java.util.Map<String, DeviceTemplate> deviceTemplates) { """ <p> An object specifying the <a>DeviceTemplate</a> for all placements using this (<a>PlacementTemplate</a>) template. </p> @param deviceTemplates An object specifying the <a>DeviceTemplate</a> for all placements using this (<a>PlacementTemplate</a>) template. @return Returns a reference to this object so that method calls can be chained together. """ setDeviceTemplates(deviceTemplates); return this; }
java
public PlacementTemplate withDeviceTemplates(java.util.Map<String, DeviceTemplate> deviceTemplates) { setDeviceTemplates(deviceTemplates); return this; }
[ "public", "PlacementTemplate", "withDeviceTemplates", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "DeviceTemplate", ">", "deviceTemplates", ")", "{", "setDeviceTemplates", "(", "deviceTemplates", ")", ";", "return", "this", ";", "}" ]
<p> An object specifying the <a>DeviceTemplate</a> for all placements using this (<a>PlacementTemplate</a>) template. </p> @param deviceTemplates An object specifying the <a>DeviceTemplate</a> for all placements using this (<a>PlacementTemplate</a>) template. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "An", "object", "specifying", "the", "<a", ">", "DeviceTemplate<", "/", "a", ">", "for", "all", "placements", "using", "this", "(", "<a", ">", "PlacementTemplate<", "/", "a", ">", ")", "template", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/PlacementTemplate.java#L143-L146
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/ServiceTaskBase.java
ServiceTaskBase.sendReturnWave
@SuppressWarnings("unchecked") private void sendReturnWave(final T res) throws CoreException { """ Send a wave that will carry the service result. 2 Kinds of wave can be sent according to service configuration @param res the service result @throws CoreException if the wave generation has failed """ Wave returnWave = null; // Try to retrieve the return Wave type, could be null final WaveType responseWaveType = this.wave.waveType().returnWaveType(); final Class<? extends Command> responseCommandClass = this.wave.waveType().returnCommandClass(); if (responseWaveType != null) { final WaveItemBase<T> resultWaveItem; // No service result type defined into a WaveItem if (responseWaveType != JRebirthWaves.RETURN_VOID_WT && responseWaveType.items().isEmpty()) { LOGGER.log(NO_RETURNED_WAVE_ITEM); throw new CoreException(NO_RETURNED_WAVE_ITEM); } else { // Get the first (and unique) WaveItem used to define the service result type resultWaveItem = (WaveItemBase<T>) responseWaveType.items().get(0); } // Try to retrieve the command class, could be null // final Class<? extends Command> responseCommandClass = this.service.getReturnCommand(this.wave.waveType()); if (responseCommandClass != null) { // If a Command Class is provided, call it with the right WaveItem to get the real result type returnWave = WBuilder.wave() .waveGroup(WaveGroup.CALL_COMMAND) .fromClass(this.service.getClass()) .componentClass(responseCommandClass); } else { // Otherwise send a generic wave that can be handled by any component returnWave = WBuilder.wave() .waveType(responseWaveType) .fromClass(this.service.getClass()); } // Add the result wrapped into a WaveData with the right WaveItem if (resultWaveItem != null) { returnWave.addDatas(WBuilder.waveData(resultWaveItem, res)); } // Don't add data when method has returned VOID returnWave.relatedWave(this.wave); returnWave.addWaveListener(new RelatedWaveListener()); // Send the return wave to interested components this.service.sendWave(returnWave); } else { // No service return wave Type defined LOGGER.log(NO_RETURNED_WAVE_TYPE_DEFINED, this.wave.waveType()); throw new CoreException(NO_RETURNED_WAVE_ITEM, this.wave.waveType()); } }
java
@SuppressWarnings("unchecked") private void sendReturnWave(final T res) throws CoreException { Wave returnWave = null; // Try to retrieve the return Wave type, could be null final WaveType responseWaveType = this.wave.waveType().returnWaveType(); final Class<? extends Command> responseCommandClass = this.wave.waveType().returnCommandClass(); if (responseWaveType != null) { final WaveItemBase<T> resultWaveItem; // No service result type defined into a WaveItem if (responseWaveType != JRebirthWaves.RETURN_VOID_WT && responseWaveType.items().isEmpty()) { LOGGER.log(NO_RETURNED_WAVE_ITEM); throw new CoreException(NO_RETURNED_WAVE_ITEM); } else { // Get the first (and unique) WaveItem used to define the service result type resultWaveItem = (WaveItemBase<T>) responseWaveType.items().get(0); } // Try to retrieve the command class, could be null // final Class<? extends Command> responseCommandClass = this.service.getReturnCommand(this.wave.waveType()); if (responseCommandClass != null) { // If a Command Class is provided, call it with the right WaveItem to get the real result type returnWave = WBuilder.wave() .waveGroup(WaveGroup.CALL_COMMAND) .fromClass(this.service.getClass()) .componentClass(responseCommandClass); } else { // Otherwise send a generic wave that can be handled by any component returnWave = WBuilder.wave() .waveType(responseWaveType) .fromClass(this.service.getClass()); } // Add the result wrapped into a WaveData with the right WaveItem if (resultWaveItem != null) { returnWave.addDatas(WBuilder.waveData(resultWaveItem, res)); } // Don't add data when method has returned VOID returnWave.relatedWave(this.wave); returnWave.addWaveListener(new RelatedWaveListener()); // Send the return wave to interested components this.service.sendWave(returnWave); } else { // No service return wave Type defined LOGGER.log(NO_RETURNED_WAVE_TYPE_DEFINED, this.wave.waveType()); throw new CoreException(NO_RETURNED_WAVE_ITEM, this.wave.waveType()); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "sendReturnWave", "(", "final", "T", "res", ")", "throws", "CoreException", "{", "Wave", "returnWave", "=", "null", ";", "// Try to retrieve the return Wave type, could be null", "final", "WaveType", "responseWaveType", "=", "this", ".", "wave", ".", "waveType", "(", ")", ".", "returnWaveType", "(", ")", ";", "final", "Class", "<", "?", "extends", "Command", ">", "responseCommandClass", "=", "this", ".", "wave", ".", "waveType", "(", ")", ".", "returnCommandClass", "(", ")", ";", "if", "(", "responseWaveType", "!=", "null", ")", "{", "final", "WaveItemBase", "<", "T", ">", "resultWaveItem", ";", "// No service result type defined into a WaveItem", "if", "(", "responseWaveType", "!=", "JRebirthWaves", ".", "RETURN_VOID_WT", "&&", "responseWaveType", ".", "items", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ".", "log", "(", "NO_RETURNED_WAVE_ITEM", ")", ";", "throw", "new", "CoreException", "(", "NO_RETURNED_WAVE_ITEM", ")", ";", "}", "else", "{", "// Get the first (and unique) WaveItem used to define the service result type", "resultWaveItem", "=", "(", "WaveItemBase", "<", "T", ">", ")", "responseWaveType", ".", "items", "(", ")", ".", "get", "(", "0", ")", ";", "}", "// Try to retrieve the command class, could be null", "// final Class<? extends Command> responseCommandClass = this.service.getReturnCommand(this.wave.waveType());", "if", "(", "responseCommandClass", "!=", "null", ")", "{", "// If a Command Class is provided, call it with the right WaveItem to get the real result type", "returnWave", "=", "WBuilder", ".", "wave", "(", ")", ".", "waveGroup", "(", "WaveGroup", ".", "CALL_COMMAND", ")", ".", "fromClass", "(", "this", ".", "service", ".", "getClass", "(", ")", ")", ".", "componentClass", "(", "responseCommandClass", ")", ";", "}", "else", "{", "// Otherwise send a generic wave that can be handled by any component", "returnWave", "=", "WBuilder", ".", "wave", "(", ")", ".", "waveType", "(", "responseWaveType", ")", ".", "fromClass", "(", "this", ".", "service", ".", "getClass", "(", ")", ")", ";", "}", "// Add the result wrapped into a WaveData with the right WaveItem", "if", "(", "resultWaveItem", "!=", "null", ")", "{", "returnWave", ".", "addDatas", "(", "WBuilder", ".", "waveData", "(", "resultWaveItem", ",", "res", ")", ")", ";", "}", "// Don't add data when method has returned VOID", "returnWave", ".", "relatedWave", "(", "this", ".", "wave", ")", ";", "returnWave", ".", "addWaveListener", "(", "new", "RelatedWaveListener", "(", ")", ")", ";", "// Send the return wave to interested components", "this", ".", "service", ".", "sendWave", "(", "returnWave", ")", ";", "}", "else", "{", "// No service return wave Type defined", "LOGGER", ".", "log", "(", "NO_RETURNED_WAVE_TYPE_DEFINED", ",", "this", ".", "wave", ".", "waveType", "(", ")", ")", ";", "throw", "new", "CoreException", "(", "NO_RETURNED_WAVE_ITEM", ",", "this", ".", "wave", ".", "waveType", "(", ")", ")", ";", "}", "}" ]
Send a wave that will carry the service result. 2 Kinds of wave can be sent according to service configuration @param res the service result @throws CoreException if the wave generation has failed
[ "Send", "a", "wave", "that", "will", "carry", "the", "service", "result", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/ServiceTaskBase.java#L239-L297
demidenko05/beigesoft-accounting
src/main/java/org/beigesoft/accounting/service/SrvLedger.java
SrvLedger.loadString
public final String loadString(final String pFileName) throws IOException { """ <p>Load string file (usually SQL query).</p> @param pFileName file name @return String usually SQL query @throws IOException - IO exception """ URL urlFile = SrvLedger.class .getResource(pFileName); if (urlFile != null) { InputStream inputStream = null; try { inputStream = SrvLedger.class.getResourceAsStream(pFileName); byte[] bArray = new byte[inputStream.available()]; inputStream.read(bArray, 0, inputStream.available()); return new String(bArray, "UTF-8"); } finally { if (inputStream != null) { inputStream.close(); } } } return null; }
java
public final String loadString(final String pFileName) throws IOException { URL urlFile = SrvLedger.class .getResource(pFileName); if (urlFile != null) { InputStream inputStream = null; try { inputStream = SrvLedger.class.getResourceAsStream(pFileName); byte[] bArray = new byte[inputStream.available()]; inputStream.read(bArray, 0, inputStream.available()); return new String(bArray, "UTF-8"); } finally { if (inputStream != null) { inputStream.close(); } } } return null; }
[ "public", "final", "String", "loadString", "(", "final", "String", "pFileName", ")", "throws", "IOException", "{", "URL", "urlFile", "=", "SrvLedger", ".", "class", ".", "getResource", "(", "pFileName", ")", ";", "if", "(", "urlFile", "!=", "null", ")", "{", "InputStream", "inputStream", "=", "null", ";", "try", "{", "inputStream", "=", "SrvLedger", ".", "class", ".", "getResourceAsStream", "(", "pFileName", ")", ";", "byte", "[", "]", "bArray", "=", "new", "byte", "[", "inputStream", ".", "available", "(", ")", "]", ";", "inputStream", ".", "read", "(", "bArray", ",", "0", ",", "inputStream", ".", "available", "(", ")", ")", ";", "return", "new", "String", "(", "bArray", ",", "\"UTF-8\"", ")", ";", "}", "finally", "{", "if", "(", "inputStream", "!=", "null", ")", "{", "inputStream", ".", "close", "(", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
<p>Load string file (usually SQL query).</p> @param pFileName file name @return String usually SQL query @throws IOException - IO exception
[ "<p", ">", "Load", "string", "file", "(", "usually", "SQL", "query", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/demidenko05/beigesoft-accounting/blob/e6f423949008218ddd05953b078f1ea8805095c1/src/main/java/org/beigesoft/accounting/service/SrvLedger.java#L282-L300
lessthanoptimal/ddogleg
src/org/ddogleg/solver/impl/FindRealRootsSturm.java
FindRealRootsSturm.bisectionRoot
private void bisectionRoot( double l , double u , int index ) { """ Searches for a single real root inside the range. Only one root is assumed to be inside @param l lower value of search range @param u upper value of search range @param index """ // use bisection until there is an estimate within tolerance int iter = 0; while( u-l > boundTolerance*Math.abs(l) && iter++ < maxBoundIterations) { double m = (l+u)/2.0; int numRoots = sturm.countRealRoots(m,u); if( numRoots == 1 ) { l = m; } else { // In systems where some coefficients are close to zero the Sturm sequence starts to yield erratic results. // In this case, certain basic assumptions are broken and a garbage solution is returned. The EVD method // still seems to yield a solution in these cases. Maybe a different formulation would improve its numerical // stability? The problem seems to lie with polynomial division by very small coefficients // if( sturm.countRealRoots(l,m) != 1 ) { // throw new RuntimeException("Oh Crap"); // } u = m; } } // assign the root to the mid point between the bounds roots[index] = (l+u)/2.0; }
java
private void bisectionRoot( double l , double u , int index ) { // use bisection until there is an estimate within tolerance int iter = 0; while( u-l > boundTolerance*Math.abs(l) && iter++ < maxBoundIterations) { double m = (l+u)/2.0; int numRoots = sturm.countRealRoots(m,u); if( numRoots == 1 ) { l = m; } else { // In systems where some coefficients are close to zero the Sturm sequence starts to yield erratic results. // In this case, certain basic assumptions are broken and a garbage solution is returned. The EVD method // still seems to yield a solution in these cases. Maybe a different formulation would improve its numerical // stability? The problem seems to lie with polynomial division by very small coefficients // if( sturm.countRealRoots(l,m) != 1 ) { // throw new RuntimeException("Oh Crap"); // } u = m; } } // assign the root to the mid point between the bounds roots[index] = (l+u)/2.0; }
[ "private", "void", "bisectionRoot", "(", "double", "l", ",", "double", "u", ",", "int", "index", ")", "{", "// use bisection until there is an estimate within tolerance", "int", "iter", "=", "0", ";", "while", "(", "u", "-", "l", ">", "boundTolerance", "*", "Math", ".", "abs", "(", "l", ")", "&&", "iter", "++", "<", "maxBoundIterations", ")", "{", "double", "m", "=", "(", "l", "+", "u", ")", "/", "2.0", ";", "int", "numRoots", "=", "sturm", ".", "countRealRoots", "(", "m", ",", "u", ")", ";", "if", "(", "numRoots", "==", "1", ")", "{", "l", "=", "m", ";", "}", "else", "{", "// In systems where some coefficients are close to zero the Sturm sequence starts to yield erratic results.", "// In this case, certain basic assumptions are broken and a garbage solution is returned. The EVD method", "// still seems to yield a solution in these cases. Maybe a different formulation would improve its numerical", "// stability? The problem seems to lie with polynomial division by very small coefficients", "//\t\t\t\tif( sturm.countRealRoots(l,m) != 1 ) {", "//\t\t\t\t\tthrow new RuntimeException(\"Oh Crap\");", "//\t\t\t\t}", "u", "=", "m", ";", "}", "}", "// assign the root to the mid point between the bounds", "roots", "[", "index", "]", "=", "(", "l", "+", "u", ")", "/", "2.0", ";", "}" ]
Searches for a single real root inside the range. Only one root is assumed to be inside @param l lower value of search range @param u upper value of search range @param index
[ "Searches", "for", "a", "single", "real", "root", "inside", "the", "range", ".", "Only", "one", "root", "is", "assumed", "to", "be", "inside" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/impl/FindRealRootsSturm.java#L204-L226
stevespringett/Alpine
alpine/src/main/java/alpine/crypto/KeyManager.java
KeyManager.loadKeyPair
private KeyPair loadKeyPair() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { """ Loads a key pair. @return a KeyPair @throws IOException if the file cannot be read @throws NoSuchAlgorithmException if the algorithm cannot be found @throws InvalidKeySpecException if the algorithm's key spec is incorrect """ // Read Private Key final File filePrivateKey = getKeyPath(KeyType.PRIVATE); // Read Public Key final File filePublicKey = getKeyPath(KeyType.PUBLIC); byte[] encodedPrivateKey; byte[] encodedPublicKey; try (InputStream pvtfis = Files.newInputStream(filePrivateKey.toPath()); InputStream pubfis = Files.newInputStream(filePublicKey.toPath())) { encodedPrivateKey = new byte[(int) filePrivateKey.length()]; pvtfis.read(encodedPrivateKey); encodedPublicKey = new byte[(int) filePublicKey.length()]; pubfis.read(encodedPublicKey); } // Generate KeyPair final KeyFactory keyFactory = KeyFactory.getInstance("RSA"); final X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(encodedPublicKey); final PublicKey publicKey = keyFactory.generatePublic(publicKeySpec); final PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(encodedPrivateKey); final PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec); return this.keyPair = new KeyPair(publicKey, privateKey); }
java
private KeyPair loadKeyPair() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { // Read Private Key final File filePrivateKey = getKeyPath(KeyType.PRIVATE); // Read Public Key final File filePublicKey = getKeyPath(KeyType.PUBLIC); byte[] encodedPrivateKey; byte[] encodedPublicKey; try (InputStream pvtfis = Files.newInputStream(filePrivateKey.toPath()); InputStream pubfis = Files.newInputStream(filePublicKey.toPath())) { encodedPrivateKey = new byte[(int) filePrivateKey.length()]; pvtfis.read(encodedPrivateKey); encodedPublicKey = new byte[(int) filePublicKey.length()]; pubfis.read(encodedPublicKey); } // Generate KeyPair final KeyFactory keyFactory = KeyFactory.getInstance("RSA"); final X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(encodedPublicKey); final PublicKey publicKey = keyFactory.generatePublic(publicKeySpec); final PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(encodedPrivateKey); final PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec); return this.keyPair = new KeyPair(publicKey, privateKey); }
[ "private", "KeyPair", "loadKeyPair", "(", ")", "throws", "IOException", ",", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", "{", "// Read Private Key", "final", "File", "filePrivateKey", "=", "getKeyPath", "(", "KeyType", ".", "PRIVATE", ")", ";", "// Read Public Key", "final", "File", "filePublicKey", "=", "getKeyPath", "(", "KeyType", ".", "PUBLIC", ")", ";", "byte", "[", "]", "encodedPrivateKey", ";", "byte", "[", "]", "encodedPublicKey", ";", "try", "(", "InputStream", "pvtfis", "=", "Files", ".", "newInputStream", "(", "filePrivateKey", ".", "toPath", "(", ")", ")", ";", "InputStream", "pubfis", "=", "Files", ".", "newInputStream", "(", "filePublicKey", ".", "toPath", "(", ")", ")", ")", "{", "encodedPrivateKey", "=", "new", "byte", "[", "(", "int", ")", "filePrivateKey", ".", "length", "(", ")", "]", ";", "pvtfis", ".", "read", "(", "encodedPrivateKey", ")", ";", "encodedPublicKey", "=", "new", "byte", "[", "(", "int", ")", "filePublicKey", ".", "length", "(", ")", "]", ";", "pubfis", ".", "read", "(", "encodedPublicKey", ")", ";", "}", "// Generate KeyPair", "final", "KeyFactory", "keyFactory", "=", "KeyFactory", ".", "getInstance", "(", "\"RSA\"", ")", ";", "final", "X509EncodedKeySpec", "publicKeySpec", "=", "new", "X509EncodedKeySpec", "(", "encodedPublicKey", ")", ";", "final", "PublicKey", "publicKey", "=", "keyFactory", ".", "generatePublic", "(", "publicKeySpec", ")", ";", "final", "PKCS8EncodedKeySpec", "privateKeySpec", "=", "new", "PKCS8EncodedKeySpec", "(", "encodedPrivateKey", ")", ";", "final", "PrivateKey", "privateKey", "=", "keyFactory", ".", "generatePrivate", "(", "privateKeySpec", ")", ";", "return", "this", ".", "keyPair", "=", "new", "KeyPair", "(", "publicKey", ",", "privateKey", ")", ";", "}" ]
Loads a key pair. @return a KeyPair @throws IOException if the file cannot be read @throws NoSuchAlgorithmException if the algorithm cannot be found @throws InvalidKeySpecException if the algorithm's key spec is incorrect
[ "Loads", "a", "key", "pair", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/KeyManager.java#L245-L273
line/armeria
core/src/main/java/com/linecorp/armeria/server/cors/CorsServiceBuilder.java
CorsServiceBuilder.preflightResponseHeader
public CorsServiceBuilder preflightResponseHeader(CharSequence name, Iterable<?> values) { """ Returns HTTP response headers that should be added to a CORS preflight response. <p>An intermediary like a load balancer might require that a CORS preflight request have certain headers set. This enables such headers to be added. @param name the name of the HTTP header. @param values the values for the HTTP header. @return {@link CorsServiceBuilder} to support method chaining. """ firstPolicyBuilder.preflightResponseHeader(name, values); return this; }
java
public CorsServiceBuilder preflightResponseHeader(CharSequence name, Iterable<?> values) { firstPolicyBuilder.preflightResponseHeader(name, values); return this; }
[ "public", "CorsServiceBuilder", "preflightResponseHeader", "(", "CharSequence", "name", ",", "Iterable", "<", "?", ">", "values", ")", "{", "firstPolicyBuilder", ".", "preflightResponseHeader", "(", "name", ",", "values", ")", ";", "return", "this", ";", "}" ]
Returns HTTP response headers that should be added to a CORS preflight response. <p>An intermediary like a load balancer might require that a CORS preflight request have certain headers set. This enables such headers to be added. @param name the name of the HTTP header. @param values the values for the HTTP header. @return {@link CorsServiceBuilder} to support method chaining.
[ "Returns", "HTTP", "response", "headers", "that", "should", "be", "added", "to", "a", "CORS", "preflight", "response", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/cors/CorsServiceBuilder.java#L316-L319
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
BeanUtil.toBean
public static <T> T toBean(Object source, Class<T> clazz) { """ 对象或Map转Bean @param source Bean对象或Map @param clazz 目标的Bean类型 @return Bean对象 @since 4.1.20 """ final T target = ReflectUtil.newInstance(clazz); copyProperties(source, target); return target; }
java
public static <T> T toBean(Object source, Class<T> clazz) { final T target = ReflectUtil.newInstance(clazz); copyProperties(source, target); return target; }
[ "public", "static", "<", "T", ">", "T", "toBean", "(", "Object", "source", ",", "Class", "<", "T", ">", "clazz", ")", "{", "final", "T", "target", "=", "ReflectUtil", ".", "newInstance", "(", "clazz", ")", ";", "copyProperties", "(", "source", ",", "target", ")", ";", "return", "target", ";", "}" ]
对象或Map转Bean @param source Bean对象或Map @param clazz 目标的Bean类型 @return Bean对象 @since 4.1.20
[ "对象或Map转Bean" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L442-L446
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRRenderData.java
GVRRenderData.setMaterial
public void setMaterial(GVRMaterial material, int passIndex) { """ Set the {@link GVRMaterial material} this pass will be rendered with. @param material The {@link GVRMaterial material} for rendering. @param passIndex The rendering pass this material will be assigned to. """ if (passIndex < mRenderPassList.size()) { mRenderPassList.get(passIndex).setMaterial(material); } else { Log.e(TAG, "Trying to set material from invalid pass. Pass " + passIndex + " was not created."); } }
java
public void setMaterial(GVRMaterial material, int passIndex) { if (passIndex < mRenderPassList.size()) { mRenderPassList.get(passIndex).setMaterial(material); } else { Log.e(TAG, "Trying to set material from invalid pass. Pass " + passIndex + " was not created."); } }
[ "public", "void", "setMaterial", "(", "GVRMaterial", "material", ",", "int", "passIndex", ")", "{", "if", "(", "passIndex", "<", "mRenderPassList", ".", "size", "(", ")", ")", "{", "mRenderPassList", ".", "get", "(", "passIndex", ")", ".", "setMaterial", "(", "material", ")", ";", "}", "else", "{", "Log", ".", "e", "(", "TAG", ",", "\"Trying to set material from invalid pass. Pass \"", "+", "passIndex", "+", "\" was not created.\"", ")", ";", "}", "}" ]
Set the {@link GVRMaterial material} this pass will be rendered with. @param material The {@link GVRMaterial material} for rendering. @param passIndex The rendering pass this material will be assigned to.
[ "Set", "the", "{", "@link", "GVRMaterial", "material", "}", "this", "pass", "will", "be", "rendered", "with", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRRenderData.java#L233-L243
geomajas/geomajas-project-server
plugin/reporting/reporting/src/main/java/org/geomajas/plugin/reporting/command/reporting/PrepareReportingCommand.java
PrepareReportingCommand.getFilter
private Filter getFilter(String layerFilter, String[] featureIds) throws GeomajasException { """ Build filter for the request. @param layerFilter layer filter @param featureIds features to include in report (null for all) @return filter @throws GeomajasException filter could not be parsed/created """ Filter filter = null; if (null != layerFilter) { filter = filterService.parseFilter(layerFilter); } if (null != featureIds) { Filter fidFilter = filterService.createFidFilter(featureIds); if (null == filter) { filter = fidFilter; } else { filter = filterService.createAndFilter(filter, fidFilter); } } return filter; }
java
private Filter getFilter(String layerFilter, String[] featureIds) throws GeomajasException { Filter filter = null; if (null != layerFilter) { filter = filterService.parseFilter(layerFilter); } if (null != featureIds) { Filter fidFilter = filterService.createFidFilter(featureIds); if (null == filter) { filter = fidFilter; } else { filter = filterService.createAndFilter(filter, fidFilter); } } return filter; }
[ "private", "Filter", "getFilter", "(", "String", "layerFilter", ",", "String", "[", "]", "featureIds", ")", "throws", "GeomajasException", "{", "Filter", "filter", "=", "null", ";", "if", "(", "null", "!=", "layerFilter", ")", "{", "filter", "=", "filterService", ".", "parseFilter", "(", "layerFilter", ")", ";", "}", "if", "(", "null", "!=", "featureIds", ")", "{", "Filter", "fidFilter", "=", "filterService", ".", "createFidFilter", "(", "featureIds", ")", ";", "if", "(", "null", "==", "filter", ")", "{", "filter", "=", "fidFilter", ";", "}", "else", "{", "filter", "=", "filterService", ".", "createAndFilter", "(", "filter", ",", "fidFilter", ")", ";", "}", "}", "return", "filter", ";", "}" ]
Build filter for the request. @param layerFilter layer filter @param featureIds features to include in report (null for all) @return filter @throws GeomajasException filter could not be parsed/created
[ "Build", "filter", "for", "the", "request", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/reporting/reporting/src/main/java/org/geomajas/plugin/reporting/command/reporting/PrepareReportingCommand.java#L190-L204
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPSpecificationOptionUtil.java
CPSpecificationOptionUtil.findByUUID_G
public static CPSpecificationOption findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPSpecificationOptionException { """ Returns the cp specification option where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPSpecificationOptionException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp specification option @throws NoSuchCPSpecificationOptionException if a matching cp specification option could not be found """ return getPersistence().findByUUID_G(uuid, groupId); }
java
public static CPSpecificationOption findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPSpecificationOptionException { return getPersistence().findByUUID_G(uuid, groupId); }
[ "public", "static", "CPSpecificationOption", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "product", ".", "exception", ".", "NoSuchCPSpecificationOptionException", "{", "return", "getPersistence", "(", ")", ".", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "}" ]
Returns the cp specification option where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPSpecificationOptionException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp specification option @throws NoSuchCPSpecificationOptionException if a matching cp specification option could not be found
[ "Returns", "the", "cp", "specification", "option", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPSpecificationOptionException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPSpecificationOptionUtil.java#L283-L286
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Img.java
Img.getValue
public int getValue(int x, int y, final int boundaryMode) { """ Returns the value of this Img at the specified position. Bounds checks will be performed and positions outside of this image's dimensions will be handled according to the specified boundary mode. <p> <b><u>Boundary Modes</u></b><br> {@link #boundary_mode_zero} <br> will return 0 for out of bounds positions. <br> -{@link #boundary_mode_repeat_edge} <br> will return the same value as the nearest edge value. <br> -{@link #boundary_mode_repeat_image} <br> will return a value of the image as if the if the image was repeated on all sides. <br> -{@link #boundary_mode_mirror} <br> will return a value of the image as if the image was mirrored on all sides. <br> -<u>other values for boundary mode </u><br> will be used as default color for out of bounds positions. It is safe to use opaque colors (0xff000000 - 0xffffffff) and transparent colors above 0x0000000f which will not collide with one of the boundary modes (number of boundary modes is limited to 16 for the future). @param x coordinate @param y coordinate @param boundaryMode one of the boundary modes e.g. boundary_mode_mirror @return value at specified position or a value depending on the boundary mode for out of bounds positions. @since 1.0 """ if(x < 0 || y < 0 || x >= this.width || y >= this.height){ switch (boundaryMode) { case boundary_mode_zero: return 0; case boundary_mode_repeat_edge: x = (x < 0 ? 0: (x >= this.width ? this.width-1:x)); y = (y < 0 ? 0: (y >= this.height ? this.height-1:y)); return getValue(x, y); case boundary_mode_repeat_image: x = (this.width + (x % this.width)) % this.width; y = (this.height + (y % this.height)) % this.height; return getValue(x,y); case boundary_mode_mirror: if(x < 0){ // mirror x to right side of image x = -x - 1; } if(y < 0 ){ // mirror y to bottom side of image y = -y - 1; } x = (x/this.width) % 2 == 0 ? (x%this.width) : (this.width-1)-(x%this.width); y = (y/this.height) % 2 == 0 ? (y%this.height) : (this.height-1)-(y%this.height); return getValue(x, y); default: return boundaryMode; // boundary mode can be default color } } else { return getValue(x, y); } }
java
public int getValue(int x, int y, final int boundaryMode){ if(x < 0 || y < 0 || x >= this.width || y >= this.height){ switch (boundaryMode) { case boundary_mode_zero: return 0; case boundary_mode_repeat_edge: x = (x < 0 ? 0: (x >= this.width ? this.width-1:x)); y = (y < 0 ? 0: (y >= this.height ? this.height-1:y)); return getValue(x, y); case boundary_mode_repeat_image: x = (this.width + (x % this.width)) % this.width; y = (this.height + (y % this.height)) % this.height; return getValue(x,y); case boundary_mode_mirror: if(x < 0){ // mirror x to right side of image x = -x - 1; } if(y < 0 ){ // mirror y to bottom side of image y = -y - 1; } x = (x/this.width) % 2 == 0 ? (x%this.width) : (this.width-1)-(x%this.width); y = (y/this.height) % 2 == 0 ? (y%this.height) : (this.height-1)-(y%this.height); return getValue(x, y); default: return boundaryMode; // boundary mode can be default color } } else { return getValue(x, y); } }
[ "public", "int", "getValue", "(", "int", "x", ",", "int", "y", ",", "final", "int", "boundaryMode", ")", "{", "if", "(", "x", "<", "0", "||", "y", "<", "0", "||", "x", ">=", "this", ".", "width", "||", "y", ">=", "this", ".", "height", ")", "{", "switch", "(", "boundaryMode", ")", "{", "case", "boundary_mode_zero", ":", "return", "0", ";", "case", "boundary_mode_repeat_edge", ":", "x", "=", "(", "x", "<", "0", "?", "0", ":", "(", "x", ">=", "this", ".", "width", "?", "this", ".", "width", "-", "1", ":", "x", ")", ")", ";", "y", "=", "(", "y", "<", "0", "?", "0", ":", "(", "y", ">=", "this", ".", "height", "?", "this", ".", "height", "-", "1", ":", "y", ")", ")", ";", "return", "getValue", "(", "x", ",", "y", ")", ";", "case", "boundary_mode_repeat_image", ":", "x", "=", "(", "this", ".", "width", "+", "(", "x", "%", "this", ".", "width", ")", ")", "%", "this", ".", "width", ";", "y", "=", "(", "this", ".", "height", "+", "(", "y", "%", "this", ".", "height", ")", ")", "%", "this", ".", "height", ";", "return", "getValue", "(", "x", ",", "y", ")", ";", "case", "boundary_mode_mirror", ":", "if", "(", "x", "<", "0", ")", "{", "// mirror x to right side of image", "x", "=", "-", "x", "-", "1", ";", "}", "if", "(", "y", "<", "0", ")", "{", "// mirror y to bottom side of image", "y", "=", "-", "y", "-", "1", ";", "}", "x", "=", "(", "x", "/", "this", ".", "width", ")", "%", "2", "==", "0", "?", "(", "x", "%", "this", ".", "width", ")", ":", "(", "this", ".", "width", "-", "1", ")", "-", "(", "x", "%", "this", ".", "width", ")", ";", "y", "=", "(", "y", "/", "this", ".", "height", ")", "%", "2", "==", "0", "?", "(", "y", "%", "this", ".", "height", ")", ":", "(", "this", ".", "height", "-", "1", ")", "-", "(", "y", "%", "this", ".", "height", ")", ";", "return", "getValue", "(", "x", ",", "y", ")", ";", "default", ":", "return", "boundaryMode", ";", "// boundary mode can be default color", "}", "}", "else", "{", "return", "getValue", "(", "x", ",", "y", ")", ";", "}", "}" ]
Returns the value of this Img at the specified position. Bounds checks will be performed and positions outside of this image's dimensions will be handled according to the specified boundary mode. <p> <b><u>Boundary Modes</u></b><br> {@link #boundary_mode_zero} <br> will return 0 for out of bounds positions. <br> -{@link #boundary_mode_repeat_edge} <br> will return the same value as the nearest edge value. <br> -{@link #boundary_mode_repeat_image} <br> will return a value of the image as if the if the image was repeated on all sides. <br> -{@link #boundary_mode_mirror} <br> will return a value of the image as if the image was mirrored on all sides. <br> -<u>other values for boundary mode </u><br> will be used as default color for out of bounds positions. It is safe to use opaque colors (0xff000000 - 0xffffffff) and transparent colors above 0x0000000f which will not collide with one of the boundary modes (number of boundary modes is limited to 16 for the future). @param x coordinate @param y coordinate @param boundaryMode one of the boundary modes e.g. boundary_mode_mirror @return value at specified position or a value depending on the boundary mode for out of bounds positions. @since 1.0
[ "Returns", "the", "value", "of", "this", "Img", "at", "the", "specified", "position", ".", "Bounds", "checks", "will", "be", "performed", "and", "positions", "outside", "of", "this", "image", "s", "dimensions", "will", "be", "handled", "according", "to", "the", "specified", "boundary", "mode", ".", "<p", ">", "<b", ">", "<u", ">", "Boundary", "Modes<", "/", "u", ">", "<", "/", "b", ">", "<br", ">", "{" ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Img.java#L283-L312
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java
CommonsOJBLockManager.mapLockLevelDependendOnIsolationLevel
int mapLockLevelDependendOnIsolationLevel(Integer isolationId, int lockLevel) { """ Helper method to map the specified common lock level (e.g like {@link #COMMON_READ_LOCK}, {@link #COMMON_UPGRADE_LOCK, ...}) based on the isolation level to the internal used lock level value by the {@link org.apache.commons.transaction.locking.MultiLevelLock2} implementation. @param isolationId @param lockLevel @return """ int result = 0; switch(isolationId.intValue()) { case LockManager.IL_READ_UNCOMMITTED: result = ReadUncommittedLock.mapLockLevel(lockLevel); break; case LockManager.IL_READ_COMMITTED: result = ReadCommitedLock.mapLockLevel(lockLevel); break; case LockManager.IL_REPEATABLE_READ: result = RepeadableReadsLock.mapLockLevel(lockLevel); break; case LockManager.IL_SERIALIZABLE: result = SerializeableLock.mapLockLevel(lockLevel); break; case LockManager.IL_OPTIMISTIC: throw new LockRuntimeException("Optimistic locking must be handled on top of this class"); default: throw new LockRuntimeException("Unknown lock isolation level specified"); } return result; }
java
int mapLockLevelDependendOnIsolationLevel(Integer isolationId, int lockLevel) { int result = 0; switch(isolationId.intValue()) { case LockManager.IL_READ_UNCOMMITTED: result = ReadUncommittedLock.mapLockLevel(lockLevel); break; case LockManager.IL_READ_COMMITTED: result = ReadCommitedLock.mapLockLevel(lockLevel); break; case LockManager.IL_REPEATABLE_READ: result = RepeadableReadsLock.mapLockLevel(lockLevel); break; case LockManager.IL_SERIALIZABLE: result = SerializeableLock.mapLockLevel(lockLevel); break; case LockManager.IL_OPTIMISTIC: throw new LockRuntimeException("Optimistic locking must be handled on top of this class"); default: throw new LockRuntimeException("Unknown lock isolation level specified"); } return result; }
[ "int", "mapLockLevelDependendOnIsolationLevel", "(", "Integer", "isolationId", ",", "int", "lockLevel", ")", "{", "int", "result", "=", "0", ";", "switch", "(", "isolationId", ".", "intValue", "(", ")", ")", "{", "case", "LockManager", ".", "IL_READ_UNCOMMITTED", ":", "result", "=", "ReadUncommittedLock", ".", "mapLockLevel", "(", "lockLevel", ")", ";", "break", ";", "case", "LockManager", ".", "IL_READ_COMMITTED", ":", "result", "=", "ReadCommitedLock", ".", "mapLockLevel", "(", "lockLevel", ")", ";", "break", ";", "case", "LockManager", ".", "IL_REPEATABLE_READ", ":", "result", "=", "RepeadableReadsLock", ".", "mapLockLevel", "(", "lockLevel", ")", ";", "break", ";", "case", "LockManager", ".", "IL_SERIALIZABLE", ":", "result", "=", "SerializeableLock", ".", "mapLockLevel", "(", "lockLevel", ")", ";", "break", ";", "case", "LockManager", ".", "IL_OPTIMISTIC", ":", "throw", "new", "LockRuntimeException", "(", "\"Optimistic locking must be handled on top of this class\"", ")", ";", "default", ":", "throw", "new", "LockRuntimeException", "(", "\"Unknown lock isolation level specified\"", ")", ";", "}", "return", "result", ";", "}" ]
Helper method to map the specified common lock level (e.g like {@link #COMMON_READ_LOCK}, {@link #COMMON_UPGRADE_LOCK, ...}) based on the isolation level to the internal used lock level value by the {@link org.apache.commons.transaction.locking.MultiLevelLock2} implementation. @param isolationId @param lockLevel @return
[ "Helper", "method", "to", "map", "the", "specified", "common", "lock", "level", "(", "e", ".", "g", "like", "{", "@link", "#COMMON_READ_LOCK", "}", "{", "@link", "#COMMON_UPGRADE_LOCK", "...", "}", ")", "based", "on", "the", "isolation", "level", "to", "the", "internal", "used", "lock", "level", "value", "by", "the", "{", "@link", "org", ".", "apache", ".", "commons", ".", "transaction", ".", "locking", ".", "MultiLevelLock2", "}", "implementation", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java#L228-L251
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java
HttpRequestFactory.buildDeleteRequest
public HttpRequest buildDeleteRequest(GenericUrl url) throws IOException { """ Builds a {@code DELETE} request for the given URL. @param url HTTP request URL or {@code null} for none @return new HTTP request """ return buildRequest(HttpMethods.DELETE, url, null); }
java
public HttpRequest buildDeleteRequest(GenericUrl url) throws IOException { return buildRequest(HttpMethods.DELETE, url, null); }
[ "public", "HttpRequest", "buildDeleteRequest", "(", "GenericUrl", "url", ")", "throws", "IOException", "{", "return", "buildRequest", "(", "HttpMethods", ".", "DELETE", ",", "url", ",", "null", ")", ";", "}" ]
Builds a {@code DELETE} request for the given URL. @param url HTTP request URL or {@code null} for none @return new HTTP request
[ "Builds", "a", "{", "@code", "DELETE", "}", "request", "for", "the", "given", "URL", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java#L106-L108
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/JSONNavi.java
JSONNavi.set
public JSONNavi<T> set(String key, int value) { """ write an value in the current object @param key key to access @param value new value @return this """ return set(key, Integer.valueOf(value)); }
java
public JSONNavi<T> set(String key, int value) { return set(key, Integer.valueOf(value)); }
[ "public", "JSONNavi", "<", "T", ">", "set", "(", "String", "key", ",", "int", "value", ")", "{", "return", "set", "(", "key", ",", "Integer", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
write an value in the current object @param key key to access @param value new value @return this
[ "write", "an", "value", "in", "the", "current", "object" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/JSONNavi.java#L252-L254
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java
RouteFiltersInner.beginCreateOrUpdate
public RouteFilterInner beginCreateOrUpdate(String resourceGroupName, String routeFilterName, RouteFilterInner routeFilterParameters) { """ Creates or updates a route filter in a specified resource group. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param routeFilterParameters Parameters supplied to the create or update route filter operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RouteFilterInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).toBlocking().single().body(); }
java
public RouteFilterInner beginCreateOrUpdate(String resourceGroupName, String routeFilterName, RouteFilterInner routeFilterParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).toBlocking().single().body(); }
[ "public", "RouteFilterInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "routeFilterName", ",", "RouteFilterInner", "routeFilterParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "routeFilterName", ",", "routeFilterParameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a route filter in a specified resource group. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param routeFilterParameters Parameters supplied to the create or update route filter operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RouteFilterInner object if successful.
[ "Creates", "or", "updates", "a", "route", "filter", "in", "a", "specified", "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/RouteFiltersInner.java#L518-L520
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java
ObjectCacheTwoLevelImpl.afterCommit
public void afterCommit(PBStateEvent event) { """ After committing the transaction push the object from session cache ( 1st level cache) to the application cache (2d level cache). Finally, clear the session cache. """ if(log.isDebugEnabled()) log.debug("afterCommit() call, push objects to application cache"); if(invokeCounter != 0) { log.error("** Please check method calls of ObjectCacheTwoLevelImpl#enableMaterialization and" + " ObjectCacheTwoLevelImpl#disableMaterialization, number of calls have to be equals **"); } try { // we only push "really modified objects" to the application cache pushToApplicationCache(TYPE_WRITE, TYPE_CACHED_READ); } finally { resetSessionCache(); } }
java
public void afterCommit(PBStateEvent event) { if(log.isDebugEnabled()) log.debug("afterCommit() call, push objects to application cache"); if(invokeCounter != 0) { log.error("** Please check method calls of ObjectCacheTwoLevelImpl#enableMaterialization and" + " ObjectCacheTwoLevelImpl#disableMaterialization, number of calls have to be equals **"); } try { // we only push "really modified objects" to the application cache pushToApplicationCache(TYPE_WRITE, TYPE_CACHED_READ); } finally { resetSessionCache(); } }
[ "public", "void", "afterCommit", "(", "PBStateEvent", "event", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "log", ".", "debug", "(", "\"afterCommit() call, push objects to application cache\"", ")", ";", "if", "(", "invokeCounter", "!=", "0", ")", "{", "log", ".", "error", "(", "\"** Please check method calls of ObjectCacheTwoLevelImpl#enableMaterialization and\"", "+", "\" ObjectCacheTwoLevelImpl#disableMaterialization, number of calls have to be equals **\"", ")", ";", "}", "try", "{", "// we only push \"really modified objects\" to the application cache\r", "pushToApplicationCache", "(", "TYPE_WRITE", ",", "TYPE_CACHED_READ", ")", ";", "}", "finally", "{", "resetSessionCache", "(", ")", ";", "}", "}" ]
After committing the transaction push the object from session cache ( 1st level cache) to the application cache (2d level cache). Finally, clear the session cache.
[ "After", "committing", "the", "transaction", "push", "the", "object", "from", "session", "cache", "(", "1st", "level", "cache", ")", "to", "the", "application", "cache", "(", "2d", "level", "cache", ")", ".", "Finally", "clear", "the", "session", "cache", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java#L495-L512
dustin/java-memcached-client
src/main/java/net/spy/memcached/KetamaNodeKeyFormatter.java
KetamaNodeKeyFormatter.getKeyForNode
public String getKeyForNode(MemcachedNode node, int repetition) { """ Returns a uniquely identifying key, suitable for hashing by the KetamaNodeLocator algorithm. @param node The MemcachedNode to use to form the unique identifier @param repetition The repetition number for the particular node in question (0 is the first repetition) @return The key that represents the specific repetition of the node """ // Carrried over from the DefaultKetamaNodeLocatorConfiguration: // Internal Using the internal map retrieve the socket addresses // for given nodes. // I'm aware that this code is inherently thread-unsafe as // I'm using a HashMap implementation of the map, but the worst // case ( I believe) is we're slightly in-efficient when // a node has never been seen before concurrently on two different // threads, so it the socketaddress will be requested multiple times! // all other cases should be as fast as possible. String nodeKey = nodeKeys.get(node); if (nodeKey == null) { switch(this.format) { case LIBMEMCACHED: InetSocketAddress address = (InetSocketAddress)node.getSocketAddress(); nodeKey = address.getHostName(); if (address.getPort() != 11211) { nodeKey += ":" + address.getPort(); } break; case SPYMEMCACHED: nodeKey = String.valueOf(node.getSocketAddress()); if (nodeKey.startsWith("/")) { nodeKey = nodeKey.substring(1); } break; default: assert false; } nodeKeys.put(node, nodeKey); } return nodeKey + "-" + repetition; }
java
public String getKeyForNode(MemcachedNode node, int repetition) { // Carrried over from the DefaultKetamaNodeLocatorConfiguration: // Internal Using the internal map retrieve the socket addresses // for given nodes. // I'm aware that this code is inherently thread-unsafe as // I'm using a HashMap implementation of the map, but the worst // case ( I believe) is we're slightly in-efficient when // a node has never been seen before concurrently on two different // threads, so it the socketaddress will be requested multiple times! // all other cases should be as fast as possible. String nodeKey = nodeKeys.get(node); if (nodeKey == null) { switch(this.format) { case LIBMEMCACHED: InetSocketAddress address = (InetSocketAddress)node.getSocketAddress(); nodeKey = address.getHostName(); if (address.getPort() != 11211) { nodeKey += ":" + address.getPort(); } break; case SPYMEMCACHED: nodeKey = String.valueOf(node.getSocketAddress()); if (nodeKey.startsWith("/")) { nodeKey = nodeKey.substring(1); } break; default: assert false; } nodeKeys.put(node, nodeKey); } return nodeKey + "-" + repetition; }
[ "public", "String", "getKeyForNode", "(", "MemcachedNode", "node", ",", "int", "repetition", ")", "{", "// Carrried over from the DefaultKetamaNodeLocatorConfiguration:", "// Internal Using the internal map retrieve the socket addresses", "// for given nodes.", "// I'm aware that this code is inherently thread-unsafe as", "// I'm using a HashMap implementation of the map, but the worst", "// case ( I believe) is we're slightly in-efficient when", "// a node has never been seen before concurrently on two different", "// threads, so it the socketaddress will be requested multiple times!", "// all other cases should be as fast as possible.", "String", "nodeKey", "=", "nodeKeys", ".", "get", "(", "node", ")", ";", "if", "(", "nodeKey", "==", "null", ")", "{", "switch", "(", "this", ".", "format", ")", "{", "case", "LIBMEMCACHED", ":", "InetSocketAddress", "address", "=", "(", "InetSocketAddress", ")", "node", ".", "getSocketAddress", "(", ")", ";", "nodeKey", "=", "address", ".", "getHostName", "(", ")", ";", "if", "(", "address", ".", "getPort", "(", ")", "!=", "11211", ")", "{", "nodeKey", "+=", "\":\"", "+", "address", ".", "getPort", "(", ")", ";", "}", "break", ";", "case", "SPYMEMCACHED", ":", "nodeKey", "=", "String", ".", "valueOf", "(", "node", ".", "getSocketAddress", "(", ")", ")", ";", "if", "(", "nodeKey", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "nodeKey", "=", "nodeKey", ".", "substring", "(", "1", ")", ";", "}", "break", ";", "default", ":", "assert", "false", ";", "}", "nodeKeys", ".", "put", "(", "node", ",", "nodeKey", ")", ";", "}", "return", "nodeKey", "+", "\"-\"", "+", "repetition", ";", "}" ]
Returns a uniquely identifying key, suitable for hashing by the KetamaNodeLocator algorithm. @param node The MemcachedNode to use to form the unique identifier @param repetition The repetition number for the particular node in question (0 is the first repetition) @return The key that represents the specific repetition of the node
[ "Returns", "a", "uniquely", "identifying", "key", "suitable", "for", "hashing", "by", "the", "KetamaNodeLocator", "algorithm", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/KetamaNodeKeyFormatter.java#L105-L137
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java
EventServiceImpl.executeLocal
private void executeLocal(String serviceName, Object event, EventRegistration registration, int orderKey) { """ Processes the {@code event} on this node. If the event is not accepted to the executor in {@link #eventQueueTimeoutMs}, it will be rejected and not processed. This means that we increase the rejected count and log the failure. @param serviceName the name of the service responsible for this event @param event the event @param registration the listener registration responsible for this event @param orderKey the key defining the thread on which the event is processed. Events with the same key maintain order. @see LocalEventDispatcher """ if (!nodeEngine.isRunning()) { return; } Registration reg = (Registration) registration; try { if (reg.getListener() != null) { eventExecutor.execute(new LocalEventDispatcher(this, serviceName, event, reg.getListener() , orderKey, eventQueueTimeoutMs)); } else { logger.warning("Something seems wrong! Listener instance is null! -> " + reg); } } catch (RejectedExecutionException e) { rejectedCount.inc(); if (eventExecutor.isLive()) { logFailure("EventQueue overloaded! %s failed to publish to %s:%s", event, reg.getServiceName(), reg.getTopic()); } } }
java
private void executeLocal(String serviceName, Object event, EventRegistration registration, int orderKey) { if (!nodeEngine.isRunning()) { return; } Registration reg = (Registration) registration; try { if (reg.getListener() != null) { eventExecutor.execute(new LocalEventDispatcher(this, serviceName, event, reg.getListener() , orderKey, eventQueueTimeoutMs)); } else { logger.warning("Something seems wrong! Listener instance is null! -> " + reg); } } catch (RejectedExecutionException e) { rejectedCount.inc(); if (eventExecutor.isLive()) { logFailure("EventQueue overloaded! %s failed to publish to %s:%s", event, reg.getServiceName(), reg.getTopic()); } } }
[ "private", "void", "executeLocal", "(", "String", "serviceName", ",", "Object", "event", ",", "EventRegistration", "registration", ",", "int", "orderKey", ")", "{", "if", "(", "!", "nodeEngine", ".", "isRunning", "(", ")", ")", "{", "return", ";", "}", "Registration", "reg", "=", "(", "Registration", ")", "registration", ";", "try", "{", "if", "(", "reg", ".", "getListener", "(", ")", "!=", "null", ")", "{", "eventExecutor", ".", "execute", "(", "new", "LocalEventDispatcher", "(", "this", ",", "serviceName", ",", "event", ",", "reg", ".", "getListener", "(", ")", ",", "orderKey", ",", "eventQueueTimeoutMs", ")", ")", ";", "}", "else", "{", "logger", ".", "warning", "(", "\"Something seems wrong! Listener instance is null! -> \"", "+", "reg", ")", ";", "}", "}", "catch", "(", "RejectedExecutionException", "e", ")", "{", "rejectedCount", ".", "inc", "(", ")", ";", "if", "(", "eventExecutor", ".", "isLive", "(", ")", ")", "{", "logFailure", "(", "\"EventQueue overloaded! %s failed to publish to %s:%s\"", ",", "event", ",", "reg", ".", "getServiceName", "(", ")", ",", "reg", ".", "getTopic", "(", ")", ")", ";", "}", "}", "}" ]
Processes the {@code event} on this node. If the event is not accepted to the executor in {@link #eventQueueTimeoutMs}, it will be rejected and not processed. This means that we increase the rejected count and log the failure. @param serviceName the name of the service responsible for this event @param event the event @param registration the listener registration responsible for this event @param orderKey the key defining the thread on which the event is processed. Events with the same key maintain order. @see LocalEventDispatcher
[ "Processes", "the", "{", "@code", "event", "}", "on", "this", "node", ".", "If", "the", "event", "is", "not", "accepted", "to", "the", "executor", "in", "{", "@link", "#eventQueueTimeoutMs", "}", "it", "will", "be", "rejected", "and", "not", "processed", ".", "This", "means", "that", "we", "increase", "the", "rejected", "count", "and", "log", "the", "failure", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java#L468-L489
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.dropRight
public static <T> T[] dropRight(T[] self, int num) { """ Drops the given number of elements from the tail of this array if they are available. <pre class="groovyTestCase"> String[] strings = [ 'a', 'b', 'c' ] assert strings.dropRight( 0 ) == [ 'a', 'b', 'c' ] as String[] assert strings.dropRight( 2 ) == [ 'a' ] as String[] assert strings.dropRight( 5 ) == [] as String[] </pre> @param self the original array @param num the number of elements to drop from this array @return an array consisting of all elements of this array except the last <code>num</code> ones, or else the empty array, if this array has less than <code>num</code> elements. @since 2.4.0 """ if (self.length <= num) { return createSimilarArray(self, 0); } if (num <= 0) { T[] ret = createSimilarArray(self, self.length); System.arraycopy(self, 0, ret, 0, self.length); return ret; } T[] ret = createSimilarArray(self, self.length - num); System.arraycopy(self, 0, ret, 0, self.length - num); return ret; }
java
public static <T> T[] dropRight(T[] self, int num) { if (self.length <= num) { return createSimilarArray(self, 0); } if (num <= 0) { T[] ret = createSimilarArray(self, self.length); System.arraycopy(self, 0, ret, 0, self.length); return ret; } T[] ret = createSimilarArray(self, self.length - num); System.arraycopy(self, 0, ret, 0, self.length - num); return ret; }
[ "public", "static", "<", "T", ">", "T", "[", "]", "dropRight", "(", "T", "[", "]", "self", ",", "int", "num", ")", "{", "if", "(", "self", ".", "length", "<=", "num", ")", "{", "return", "createSimilarArray", "(", "self", ",", "0", ")", ";", "}", "if", "(", "num", "<=", "0", ")", "{", "T", "[", "]", "ret", "=", "createSimilarArray", "(", "self", ",", "self", ".", "length", ")", ";", "System", ".", "arraycopy", "(", "self", ",", "0", ",", "ret", ",", "0", ",", "self", ".", "length", ")", ";", "return", "ret", ";", "}", "T", "[", "]", "ret", "=", "createSimilarArray", "(", "self", ",", "self", ".", "length", "-", "num", ")", ";", "System", ".", "arraycopy", "(", "self", ",", "0", ",", "ret", ",", "0", ",", "self", ".", "length", "-", "num", ")", ";", "return", "ret", ";", "}" ]
Drops the given number of elements from the tail of this array if they are available. <pre class="groovyTestCase"> String[] strings = [ 'a', 'b', 'c' ] assert strings.dropRight( 0 ) == [ 'a', 'b', 'c' ] as String[] assert strings.dropRight( 2 ) == [ 'a' ] as String[] assert strings.dropRight( 5 ) == [] as String[] </pre> @param self the original array @param num the number of elements to drop from this array @return an array consisting of all elements of this array except the last <code>num</code> ones, or else the empty array, if this array has less than <code>num</code> elements. @since 2.4.0
[ "Drops", "the", "given", "number", "of", "elements", "from", "the", "tail", "of", "this", "array", "if", "they", "are", "available", ".", "<pre", "class", "=", "groovyTestCase", ">", "String", "[]", "strings", "=", "[", "a", "b", "c", "]", "assert", "strings", ".", "dropRight", "(", "0", ")", "==", "[", "a", "b", "c", "]", "as", "String", "[]", "assert", "strings", ".", "dropRight", "(", "2", ")", "==", "[", "a", "]", "as", "String", "[]", "assert", "strings", ".", "dropRight", "(", "5", ")", "==", "[]", "as", "String", "[]", "<", "/", "pre", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L10851-L10864
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.telephony_billingAccount_securityDeposit_GET
public OvhOrder telephony_billingAccount_securityDeposit_GET(String billingAccount, OvhSecurityDepositAmountsEnum amount) throws IOException { """ Get prices and contracts information REST: GET /order/telephony/{billingAccount}/securityDeposit @param amount [required] The amount, in euros, to credit to the current security deposit @param billingAccount [required] The name of your billingAccount """ String qPath = "/order/telephony/{billingAccount}/securityDeposit"; StringBuilder sb = path(qPath, billingAccount); query(sb, "amount", amount); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder telephony_billingAccount_securityDeposit_GET(String billingAccount, OvhSecurityDepositAmountsEnum amount) throws IOException { String qPath = "/order/telephony/{billingAccount}/securityDeposit"; StringBuilder sb = path(qPath, billingAccount); query(sb, "amount", amount); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "telephony_billingAccount_securityDeposit_GET", "(", "String", "billingAccount", ",", "OvhSecurityDepositAmountsEnum", "amount", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/telephony/{billingAccount}/securityDeposit\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ")", ";", "query", "(", "sb", ",", "\"amount\"", ",", "amount", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/telephony/{billingAccount}/securityDeposit @param amount [required] The amount, in euros, to credit to the current security deposit @param billingAccount [required] The name of your billingAccount
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6396-L6402
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.putMemory
public void putMemory(final WritableMemory dstMem, final ArrayOfItemsSerDe<T> serDe) { """ Puts the current sketch into the given Memory if there is sufficient space. Otherwise, throws an error. @param dstMem the given memory. @param serDe an instance of ArrayOfItemsSerDe """ final byte[] byteArr = toByteArray(serDe); final long memCap = dstMem.getCapacity(); if (memCap < byteArr.length) { throw new SketchesArgumentException( "Destination Memory not large enough: " + memCap + " < " + byteArr.length); } dstMem.putByteArray(0, byteArr, 0, byteArr.length); }
java
public void putMemory(final WritableMemory dstMem, final ArrayOfItemsSerDe<T> serDe) { final byte[] byteArr = toByteArray(serDe); final long memCap = dstMem.getCapacity(); if (memCap < byteArr.length) { throw new SketchesArgumentException( "Destination Memory not large enough: " + memCap + " < " + byteArr.length); } dstMem.putByteArray(0, byteArr, 0, byteArr.length); }
[ "public", "void", "putMemory", "(", "final", "WritableMemory", "dstMem", ",", "final", "ArrayOfItemsSerDe", "<", "T", ">", "serDe", ")", "{", "final", "byte", "[", "]", "byteArr", "=", "toByteArray", "(", "serDe", ")", ";", "final", "long", "memCap", "=", "dstMem", ".", "getCapacity", "(", ")", ";", "if", "(", "memCap", "<", "byteArr", ".", "length", ")", "{", "throw", "new", "SketchesArgumentException", "(", "\"Destination Memory not large enough: \"", "+", "memCap", "+", "\" < \"", "+", "byteArr", ".", "length", ")", ";", "}", "dstMem", ".", "putByteArray", "(", "0", ",", "byteArr", ",", "0", ",", "byteArr", ".", "length", ")", ";", "}" ]
Puts the current sketch into the given Memory if there is sufficient space. Otherwise, throws an error. @param dstMem the given memory. @param serDe an instance of ArrayOfItemsSerDe
[ "Puts", "the", "current", "sketch", "into", "the", "given", "Memory", "if", "there", "is", "sufficient", "space", ".", "Otherwise", "throws", "an", "error", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L663-L671