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
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java
AbstractRadial.createArea3DEffectGradient
protected RadialGradientPaint createArea3DEffectGradient(final int WIDTH, final float RADIUS_FACTOR) { """ Returns a radial gradient paint that will be used as overlay for the track or area image to achieve some kind of a 3d effect. @param WIDTH @param RADIUS_FACTOR @return a radial gradient paint that will be used as overlay for the track or area image """ final float[] FRACTIONS; final Color[] COLORS; FRACTIONS = new float[]{ 0.0f, 0.6f, 1.0f }; COLORS = new Color[]{ new Color(1.0f, 1.0f, 1.0f, 0.75f), new Color(1.0f, 1.0f, 1.0f, 0.0f), new Color(0.0f, 0.0f, 0.0f, 0.3f) }; final Point2D GRADIENT_CENTER = new Point2D.Double(WIDTH / 2.0, WIDTH / 2.0); return new RadialGradientPaint(GRADIENT_CENTER, WIDTH * RADIUS_FACTOR, FRACTIONS, COLORS); }
java
protected RadialGradientPaint createArea3DEffectGradient(final int WIDTH, final float RADIUS_FACTOR) { final float[] FRACTIONS; final Color[] COLORS; FRACTIONS = new float[]{ 0.0f, 0.6f, 1.0f }; COLORS = new Color[]{ new Color(1.0f, 1.0f, 1.0f, 0.75f), new Color(1.0f, 1.0f, 1.0f, 0.0f), new Color(0.0f, 0.0f, 0.0f, 0.3f) }; final Point2D GRADIENT_CENTER = new Point2D.Double(WIDTH / 2.0, WIDTH / 2.0); return new RadialGradientPaint(GRADIENT_CENTER, WIDTH * RADIUS_FACTOR, FRACTIONS, COLORS); }
[ "protected", "RadialGradientPaint", "createArea3DEffectGradient", "(", "final", "int", "WIDTH", ",", "final", "float", "RADIUS_FACTOR", ")", "{", "final", "float", "[", "]", "FRACTIONS", ";", "final", "Color", "[", "]", "COLORS", ";", "FRACTIONS", "=", "new", "float", "[", "]", "{", "0.0f", ",", "0.6f", ",", "1.0f", "}", ";", "COLORS", "=", "new", "Color", "[", "]", "{", "new", "Color", "(", "1.0f", ",", "1.0f", ",", "1.0f", ",", "0.75f", ")", ",", "new", "Color", "(", "1.0f", ",", "1.0f", ",", "1.0f", ",", "0.0f", ")", ",", "new", "Color", "(", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.3f", ")", "}", ";", "final", "Point2D", "GRADIENT_CENTER", "=", "new", "Point2D", ".", "Double", "(", "WIDTH", "/", "2.0", ",", "WIDTH", "/", "2.0", ")", ";", "return", "new", "RadialGradientPaint", "(", "GRADIENT_CENTER", ",", "WIDTH", "*", "RADIUS_FACTOR", ",", "FRACTIONS", ",", "COLORS", ")", ";", "}" ]
Returns a radial gradient paint that will be used as overlay for the track or area image to achieve some kind of a 3d effect. @param WIDTH @param RADIUS_FACTOR @return a radial gradient paint that will be used as overlay for the track or area image
[ "Returns", "a", "radial", "gradient", "paint", "that", "will", "be", "used", "as", "overlay", "for", "the", "track", "or", "area", "image", "to", "achieve", "some", "kind", "of", "a", "3d", "effect", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L1238-L1255
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.getSplitPath
private Path getSplitPath(FileSplit inputSplit, JobConf conf) throws IOException { """ /* This is to work around an issue reading from ORC transactional data sets that contain only deltas. These contain synthesised column names that are not usable to us. """ Path path = inputSplit.getPath(); if (inputSplit instanceof OrcSplit) { OrcSplit orcSplit = (OrcSplit) inputSplit; List<Long> deltas = orcSplit.getDeltas(); if (!orcSplit.hasBase() && deltas.size() >= 2) { throw new IOException("Cannot read valid StructTypeInfo from delta only file: " + path); } } LOG.debug("Input split path: {}", path); return path; }
java
private Path getSplitPath(FileSplit inputSplit, JobConf conf) throws IOException { Path path = inputSplit.getPath(); if (inputSplit instanceof OrcSplit) { OrcSplit orcSplit = (OrcSplit) inputSplit; List<Long> deltas = orcSplit.getDeltas(); if (!orcSplit.hasBase() && deltas.size() >= 2) { throw new IOException("Cannot read valid StructTypeInfo from delta only file: " + path); } } LOG.debug("Input split path: {}", path); return path; }
[ "private", "Path", "getSplitPath", "(", "FileSplit", "inputSplit", ",", "JobConf", "conf", ")", "throws", "IOException", "{", "Path", "path", "=", "inputSplit", ".", "getPath", "(", ")", ";", "if", "(", "inputSplit", "instanceof", "OrcSplit", ")", "{", "OrcSplit", "orcSplit", "=", "(", "OrcSplit", ")", "inputSplit", ";", "List", "<", "Long", ">", "deltas", "=", "orcSplit", ".", "getDeltas", "(", ")", ";", "if", "(", "!", "orcSplit", ".", "hasBase", "(", ")", "&&", "deltas", ".", "size", "(", ")", ">=", "2", ")", "{", "throw", "new", "IOException", "(", "\"Cannot read valid StructTypeInfo from delta only file: \"", "+", "path", ")", ";", "}", "}", "LOG", ".", "debug", "(", "\"Input split path: {}\"", ",", "path", ")", ";", "return", "path", ";", "}" ]
/* This is to work around an issue reading from ORC transactional data sets that contain only deltas. These contain synthesised column names that are not usable to us.
[ "/", "*", "This", "is", "to", "work", "around", "an", "issue", "reading", "from", "ORC", "transactional", "data", "sets", "that", "contain", "only", "deltas", ".", "These", "contain", "synthesised", "column", "names", "that", "are", "not", "usable", "to", "us", "." ]
train
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L257-L268
Axway/Grapes
server/src/main/java/org/axway/grapes/server/db/ModelMapper.java
ModelMapper.getDependency
public Dependency getDependency(final DbDependency dbDependency, final String sourceName, final String sourceVersion) { """ Transform a dependency from database model to client/server model @param dbDependency DbDependency @return Dependency """ final DbArtifact dbArtifact = repositoryHandler.getArtifact(dbDependency.getTarget()); final Artifact artifact; if (dbArtifact == null) { artifact = DataUtils.createArtifact(dbDependency.getTarget()); } else { artifact = getArtifact(dbArtifact); } final Dependency dependency = DataModelFactory.createDependency(artifact, dbDependency.getScope()); dependency.setSourceName(sourceName); dependency.setSourceVersion(sourceVersion); return dependency; }
java
public Dependency getDependency(final DbDependency dbDependency, final String sourceName, final String sourceVersion) { final DbArtifact dbArtifact = repositoryHandler.getArtifact(dbDependency.getTarget()); final Artifact artifact; if (dbArtifact == null) { artifact = DataUtils.createArtifact(dbDependency.getTarget()); } else { artifact = getArtifact(dbArtifact); } final Dependency dependency = DataModelFactory.createDependency(artifact, dbDependency.getScope()); dependency.setSourceName(sourceName); dependency.setSourceVersion(sourceVersion); return dependency; }
[ "public", "Dependency", "getDependency", "(", "final", "DbDependency", "dbDependency", ",", "final", "String", "sourceName", ",", "final", "String", "sourceVersion", ")", "{", "final", "DbArtifact", "dbArtifact", "=", "repositoryHandler", ".", "getArtifact", "(", "dbDependency", ".", "getTarget", "(", ")", ")", ";", "final", "Artifact", "artifact", ";", "if", "(", "dbArtifact", "==", "null", ")", "{", "artifact", "=", "DataUtils", ".", "createArtifact", "(", "dbDependency", ".", "getTarget", "(", ")", ")", ";", "}", "else", "{", "artifact", "=", "getArtifact", "(", "dbArtifact", ")", ";", "}", "final", "Dependency", "dependency", "=", "DataModelFactory", ".", "createDependency", "(", "artifact", ",", "dbDependency", ".", "getScope", "(", ")", ")", ";", "dependency", ".", "setSourceName", "(", "sourceName", ")", ";", "dependency", ".", "setSourceVersion", "(", "sourceVersion", ")", ";", "return", "dependency", ";", "}" ]
Transform a dependency from database model to client/server model @param dbDependency DbDependency @return Dependency
[ "Transform", "a", "dependency", "from", "database", "model", "to", "client", "/", "server", "model" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/db/ModelMapper.java#L233-L248
cloudfoundry/uaa
server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/idp/IdpMetadataGenerator.java
IdpMetadataGenerator.getServerURL
private String getServerURL(String entityBaseURL, String entityAlias, String processingURL) { """ Creates URL at which the local server is capable of accepting incoming SAML messages. @param entityBaseURL entity ID @param processingURL local context at which processing filter is waiting @return URL of local server """ return getServerURL(entityBaseURL, entityAlias, processingURL, null); }
java
private String getServerURL(String entityBaseURL, String entityAlias, String processingURL) { return getServerURL(entityBaseURL, entityAlias, processingURL, null); }
[ "private", "String", "getServerURL", "(", "String", "entityBaseURL", ",", "String", "entityAlias", ",", "String", "processingURL", ")", "{", "return", "getServerURL", "(", "entityBaseURL", ",", "entityAlias", ",", "processingURL", ",", "null", ")", ";", "}" ]
Creates URL at which the local server is capable of accepting incoming SAML messages. @param entityBaseURL entity ID @param processingURL local context at which processing filter is waiting @return URL of local server
[ "Creates", "URL", "at", "which", "the", "local", "server", "is", "capable", "of", "accepting", "incoming", "SAML", "messages", "." ]
train
https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/idp/IdpMetadataGenerator.java#L499-L503
dwdyer/watchmaker
examples/src/java/main/org/uncommons/watchmaker/examples/sudoku/SudokuCellRenderer.java
SudokuCellRenderer.getBorder
private Border getBorder(int row, int column) { """ Get appropriate border for cell based on its position in the grid. """ if (row % 3 == 2) { switch (column % 3) { case 2: return BOTTOM_RIGHT_BORDER; case 0: return BOTTOM_LEFT_BORDER; default: return BOTTOM_BORDER; } } else if (row % 3 == 0) { switch (column % 3) { case 2: return TOP_RIGHT_BORDER; case 0: return TOP_LEFT_BORDER; default: return TOP_BORDER; } } switch (column % 3) { case 2: return RIGHT_BORDER; case 0: return LEFT_BORDER; default: return null; } }
java
private Border getBorder(int row, int column) { if (row % 3 == 2) { switch (column % 3) { case 2: return BOTTOM_RIGHT_BORDER; case 0: return BOTTOM_LEFT_BORDER; default: return BOTTOM_BORDER; } } else if (row % 3 == 0) { switch (column % 3) { case 2: return TOP_RIGHT_BORDER; case 0: return TOP_LEFT_BORDER; default: return TOP_BORDER; } } switch (column % 3) { case 2: return RIGHT_BORDER; case 0: return LEFT_BORDER; default: return null; } }
[ "private", "Border", "getBorder", "(", "int", "row", ",", "int", "column", ")", "{", "if", "(", "row", "%", "3", "==", "2", ")", "{", "switch", "(", "column", "%", "3", ")", "{", "case", "2", ":", "return", "BOTTOM_RIGHT_BORDER", ";", "case", "0", ":", "return", "BOTTOM_LEFT_BORDER", ";", "default", ":", "return", "BOTTOM_BORDER", ";", "}", "}", "else", "if", "(", "row", "%", "3", "==", "0", ")", "{", "switch", "(", "column", "%", "3", ")", "{", "case", "2", ":", "return", "TOP_RIGHT_BORDER", ";", "case", "0", ":", "return", "TOP_LEFT_BORDER", ";", "default", ":", "return", "TOP_BORDER", ";", "}", "}", "switch", "(", "column", "%", "3", ")", "{", "case", "2", ":", "return", "RIGHT_BORDER", ";", "case", "0", ":", "return", "LEFT_BORDER", ";", "default", ":", "return", "null", ";", "}", "}" ]
Get appropriate border for cell based on its position in the grid.
[ "Get", "appropriate", "border", "for", "cell", "based", "on", "its", "position", "in", "the", "grid", "." ]
train
https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/examples/src/java/main/org/uncommons/watchmaker/examples/sudoku/SudokuCellRenderer.java#L134-L161
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java
HadoopUtils.deleteIfExists
public static void deleteIfExists(FileSystem fs, Path path, boolean recursive) throws IOException { """ A wrapper around {@link FileSystem#delete(Path, boolean)} that only deletes a given {@link Path} if it is present on the given {@link FileSystem}. """ if (fs.exists(path)) { deletePath(fs, path, recursive); } }
java
public static void deleteIfExists(FileSystem fs, Path path, boolean recursive) throws IOException { if (fs.exists(path)) { deletePath(fs, path, recursive); } }
[ "public", "static", "void", "deleteIfExists", "(", "FileSystem", "fs", ",", "Path", "path", ",", "boolean", "recursive", ")", "throws", "IOException", "{", "if", "(", "fs", ".", "exists", "(", "path", ")", ")", "{", "deletePath", "(", "fs", ",", "path", ",", "recursive", ")", ";", "}", "}" ]
A wrapper around {@link FileSystem#delete(Path, boolean)} that only deletes a given {@link Path} if it is present on the given {@link FileSystem}.
[ "A", "wrapper", "around", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L171-L175
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java
WorkManagerImpl.checkAndVerifyWork
private void checkAndVerifyWork(Work work, ExecutionContext executionContext) throws WorkException { """ Check and verify work before submitting. @param work the work instance @param executionContext any execution context that is passed by apadater @throws WorkException if any exception occurs """ if (specCompliant) { verifyWork(work); } if (work instanceof WorkContextProvider && executionContext != null) { //Implements WorkContextProvider and not-null ExecutionContext throw new WorkRejectedException(bundle.workExecutionContextMustNullImplementsWorkContextProvider()); } }
java
private void checkAndVerifyWork(Work work, ExecutionContext executionContext) throws WorkException { if (specCompliant) { verifyWork(work); } if (work instanceof WorkContextProvider && executionContext != null) { //Implements WorkContextProvider and not-null ExecutionContext throw new WorkRejectedException(bundle.workExecutionContextMustNullImplementsWorkContextProvider()); } }
[ "private", "void", "checkAndVerifyWork", "(", "Work", "work", ",", "ExecutionContext", "executionContext", ")", "throws", "WorkException", "{", "if", "(", "specCompliant", ")", "{", "verifyWork", "(", "work", ")", ";", "}", "if", "(", "work", "instanceof", "WorkContextProvider", "&&", "executionContext", "!=", "null", ")", "{", "//Implements WorkContextProvider and not-null ExecutionContext", "throw", "new", "WorkRejectedException", "(", "bundle", ".", "workExecutionContextMustNullImplementsWorkContextProvider", "(", ")", ")", ";", "}", "}" ]
Check and verify work before submitting. @param work the work instance @param executionContext any execution context that is passed by apadater @throws WorkException if any exception occurs
[ "Check", "and", "verify", "work", "before", "submitting", "." ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java#L1060-L1072
pf4j/pf4j
pf4j/src/main/java/org/pf4j/util/ClassUtils.java
ClassUtils.getAnnotationMirror
public static AnnotationMirror getAnnotationMirror(TypeElement typeElement, Class<?> annotationClass) { """ Get a certain annotation of a {@link TypeElement}. See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information. @param typeElement the type element, that contains the requested annotation @param annotationClass the class of the requested annotation @return the requested annotation or null, if no annotation of the provided class was found @throws NullPointerException if <code>typeElement</code> or <code>annotationClass</code> is null """ String annotationClassName = annotationClass.getName(); for (AnnotationMirror m : typeElement.getAnnotationMirrors()) { if (m.getAnnotationType().toString().equals(annotationClassName)) { return m; } } return null; }
java
public static AnnotationMirror getAnnotationMirror(TypeElement typeElement, Class<?> annotationClass) { String annotationClassName = annotationClass.getName(); for (AnnotationMirror m : typeElement.getAnnotationMirrors()) { if (m.getAnnotationType().toString().equals(annotationClassName)) { return m; } } return null; }
[ "public", "static", "AnnotationMirror", "getAnnotationMirror", "(", "TypeElement", "typeElement", ",", "Class", "<", "?", ">", "annotationClass", ")", "{", "String", "annotationClassName", "=", "annotationClass", ".", "getName", "(", ")", ";", "for", "(", "AnnotationMirror", "m", ":", "typeElement", ".", "getAnnotationMirrors", "(", ")", ")", "{", "if", "(", "m", ".", "getAnnotationType", "(", ")", ".", "toString", "(", ")", ".", "equals", "(", "annotationClassName", ")", ")", "{", "return", "m", ";", "}", "}", "return", "null", ";", "}" ]
Get a certain annotation of a {@link TypeElement}. See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information. @param typeElement the type element, that contains the requested annotation @param annotationClass the class of the requested annotation @return the requested annotation or null, if no annotation of the provided class was found @throws NullPointerException if <code>typeElement</code> or <code>annotationClass</code> is null
[ "Get", "a", "certain", "annotation", "of", "a", "{", "@link", "TypeElement", "}", ".", "See", "<a", "href", "=", "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "10167558", ">", "stackoverflow", ".", "com<", "/", "a", ">", "for", "more", "information", "." ]
train
https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/ClassUtils.java#L89-L97
ModeShape/modeshape
connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/ObjectId.java
ObjectId.valueOf
public static ObjectId valueOf( String uuid ) { """ Constructs instance of this class from its textual representation. @param uuid the textual representation of this object. @return object instance. """ int p = uuid.indexOf("/"); if (p < 0) { return new ObjectId(Type.OBJECT, uuid); } int p1 = p; while (p > 0) { p1 = p; p = uuid.indexOf("/", p + 1); } p = p1; String ident = uuid.substring(0, p); String type = uuid.substring(p + 1); return new ObjectId(Type.valueOf(type.toUpperCase()), ident); }
java
public static ObjectId valueOf( String uuid ) { int p = uuid.indexOf("/"); if (p < 0) { return new ObjectId(Type.OBJECT, uuid); } int p1 = p; while (p > 0) { p1 = p; p = uuid.indexOf("/", p + 1); } p = p1; String ident = uuid.substring(0, p); String type = uuid.substring(p + 1); return new ObjectId(Type.valueOf(type.toUpperCase()), ident); }
[ "public", "static", "ObjectId", "valueOf", "(", "String", "uuid", ")", "{", "int", "p", "=", "uuid", ".", "indexOf", "(", "\"/\"", ")", ";", "if", "(", "p", "<", "0", ")", "{", "return", "new", "ObjectId", "(", "Type", ".", "OBJECT", ",", "uuid", ")", ";", "}", "int", "p1", "=", "p", ";", "while", "(", "p", ">", "0", ")", "{", "p1", "=", "p", ";", "p", "=", "uuid", ".", "indexOf", "(", "\"/\"", ",", "p", "+", "1", ")", ";", "}", "p", "=", "p1", ";", "String", "ident", "=", "uuid", ".", "substring", "(", "0", ",", "p", ")", ";", "String", "type", "=", "uuid", ".", "substring", "(", "p", "+", "1", ")", ";", "return", "new", "ObjectId", "(", "Type", ".", "valueOf", "(", "type", ".", "toUpperCase", "(", ")", ")", ",", "ident", ")", ";", "}" ]
Constructs instance of this class from its textual representation. @param uuid the textual representation of this object. @return object instance.
[ "Constructs", "instance", "of", "this", "class", "from", "its", "textual", "representation", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/ObjectId.java#L77-L94
JodaOrg/joda-time
src/main/java/org/joda/time/YearMonth.java
YearMonth.withYear
public YearMonth withYear(int year) { """ Returns a copy of this year-month with the year field updated. <p> YearMonth is immutable, so there are no set methods. Instead, this method returns a new instance with the value of year changed. @param year the year to set @return a copy of this object with the field set, never null @throws IllegalArgumentException if the value is invalid """ int[] newValues = getValues(); newValues = getChronology().year().set(this, YEAR, newValues, year); return new YearMonth(this, newValues); }
java
public YearMonth withYear(int year) { int[] newValues = getValues(); newValues = getChronology().year().set(this, YEAR, newValues, year); return new YearMonth(this, newValues); }
[ "public", "YearMonth", "withYear", "(", "int", "year", ")", "{", "int", "[", "]", "newValues", "=", "getValues", "(", ")", ";", "newValues", "=", "getChronology", "(", ")", ".", "year", "(", ")", ".", "set", "(", "this", ",", "YEAR", ",", "newValues", ",", "year", ")", ";", "return", "new", "YearMonth", "(", "this", ",", "newValues", ")", ";", "}" ]
Returns a copy of this year-month with the year field updated. <p> YearMonth is immutable, so there are no set methods. Instead, this method returns a new instance with the value of year changed. @param year the year to set @return a copy of this object with the field set, never null @throws IllegalArgumentException if the value is invalid
[ "Returns", "a", "copy", "of", "this", "year", "-", "month", "with", "the", "year", "field", "updated", ".", "<p", ">", "YearMonth", "is", "immutable", "so", "there", "are", "no", "set", "methods", ".", "Instead", "this", "method", "returns", "a", "new", "instance", "with", "the", "value", "of", "year", "changed", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/YearMonth.java#L734-L738
shrinkwrap/resolver
api/src/main/java/org/jboss/shrinkwrap/resolver/api/ResolverSystemFactory.java
ResolverSystemFactory.createFromUserView
static <RESOLVERSYSTEMTYPE extends ResolverSystem> RESOLVERSYSTEMTYPE createFromUserView( final Class<RESOLVERSYSTEMTYPE> userViewClass, final ClassLoader cl) { """ Creates a new {@link ResolverSystem} instance of the specified user view type using the specified {@link ClassLoader}. Will consult a configuration file visible to the specified {@link ClassLoader} named "META-INF/services/$fullyQualfiedClassName" which should contain a key=value format with the key {@link ResolverSystemFactory#KEY_IMPL_CLASS_NAME}. The implementation class name must have a no-arg constructor. @param userViewClass The user view type @param cl The {@link ClassLoader} @return The new {@link ResolverSystem} instance of the specified user view type created by using the specified {@link ClassLoader}. """ assert userViewClass != null : "user view class must be specified"; assert cl != null : "ClassLoader must be specified"; // get SPI service loader final Object spiServiceLoader = new Invokable(cl, CLASS_NAME_SPISERVICELOADER) .invokeConstructor(new Class[] { ClassLoader.class }, new Object[] { cl }); // return service loader implementation final Object serviceLoader = new Invokable(cl, CLASS_NAME_SPISERVICELOADER).invokeMethod(METHOD_NAME_ONLY_ONE, new Class[] { Class.class, Class.class }, spiServiceLoader, new Object[] { Invokable.loadClass(cl, CLASS_NAME_SPISERVICELOADER), spiServiceLoader.getClass() }); // get registry final Object serviceRegistry = new Invokable(cl, CLASS_NAME_SERVICEREGISTRY).invokeConstructor( new Class<?>[] { Invokable.loadClass(cl, CLASS_NAME_SERVICELOADER) }, new Object[] { serviceLoader }); // register itself new Invokable(cl, serviceRegistry.getClass()).invokeMethod(METHOD_NAME_REGISTER, new Class<?>[] { serviceRegistry.getClass() }, null, new Object[] { serviceRegistry }); Object userViewObject = new Invokable(cl, serviceRegistry.getClass()).invokeMethod(METHOD_NAME_ONLY_ONE, new Class<?>[] { Class.class }, serviceRegistry, new Object[] { userViewClass }); return userViewClass.cast(userViewObject); }
java
static <RESOLVERSYSTEMTYPE extends ResolverSystem> RESOLVERSYSTEMTYPE createFromUserView( final Class<RESOLVERSYSTEMTYPE> userViewClass, final ClassLoader cl) { assert userViewClass != null : "user view class must be specified"; assert cl != null : "ClassLoader must be specified"; // get SPI service loader final Object spiServiceLoader = new Invokable(cl, CLASS_NAME_SPISERVICELOADER) .invokeConstructor(new Class[] { ClassLoader.class }, new Object[] { cl }); // return service loader implementation final Object serviceLoader = new Invokable(cl, CLASS_NAME_SPISERVICELOADER).invokeMethod(METHOD_NAME_ONLY_ONE, new Class[] { Class.class, Class.class }, spiServiceLoader, new Object[] { Invokable.loadClass(cl, CLASS_NAME_SPISERVICELOADER), spiServiceLoader.getClass() }); // get registry final Object serviceRegistry = new Invokable(cl, CLASS_NAME_SERVICEREGISTRY).invokeConstructor( new Class<?>[] { Invokable.loadClass(cl, CLASS_NAME_SERVICELOADER) }, new Object[] { serviceLoader }); // register itself new Invokable(cl, serviceRegistry.getClass()).invokeMethod(METHOD_NAME_REGISTER, new Class<?>[] { serviceRegistry.getClass() }, null, new Object[] { serviceRegistry }); Object userViewObject = new Invokable(cl, serviceRegistry.getClass()).invokeMethod(METHOD_NAME_ONLY_ONE, new Class<?>[] { Class.class }, serviceRegistry, new Object[] { userViewClass }); return userViewClass.cast(userViewObject); }
[ "static", "<", "RESOLVERSYSTEMTYPE", "extends", "ResolverSystem", ">", "RESOLVERSYSTEMTYPE", "createFromUserView", "(", "final", "Class", "<", "RESOLVERSYSTEMTYPE", ">", "userViewClass", ",", "final", "ClassLoader", "cl", ")", "{", "assert", "userViewClass", "!=", "null", ":", "\"user view class must be specified\"", ";", "assert", "cl", "!=", "null", ":", "\"ClassLoader must be specified\"", ";", "// get SPI service loader", "final", "Object", "spiServiceLoader", "=", "new", "Invokable", "(", "cl", ",", "CLASS_NAME_SPISERVICELOADER", ")", ".", "invokeConstructor", "(", "new", "Class", "[", "]", "{", "ClassLoader", ".", "class", "}", ",", "new", "Object", "[", "]", "{", "cl", "}", ")", ";", "// return service loader implementation", "final", "Object", "serviceLoader", "=", "new", "Invokable", "(", "cl", ",", "CLASS_NAME_SPISERVICELOADER", ")", ".", "invokeMethod", "(", "METHOD_NAME_ONLY_ONE", ",", "new", "Class", "[", "]", "{", "Class", ".", "class", ",", "Class", ".", "class", "}", ",", "spiServiceLoader", ",", "new", "Object", "[", "]", "{", "Invokable", ".", "loadClass", "(", "cl", ",", "CLASS_NAME_SPISERVICELOADER", ")", ",", "spiServiceLoader", ".", "getClass", "(", ")", "}", ")", ";", "// get registry", "final", "Object", "serviceRegistry", "=", "new", "Invokable", "(", "cl", ",", "CLASS_NAME_SERVICEREGISTRY", ")", ".", "invokeConstructor", "(", "new", "Class", "<", "?", ">", "[", "]", "{", "Invokable", ".", "loadClass", "(", "cl", ",", "CLASS_NAME_SERVICELOADER", ")", "}", ",", "new", "Object", "[", "]", "{", "serviceLoader", "}", ")", ";", "// register itself", "new", "Invokable", "(", "cl", ",", "serviceRegistry", ".", "getClass", "(", ")", ")", ".", "invokeMethod", "(", "METHOD_NAME_REGISTER", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "serviceRegistry", ".", "getClass", "(", ")", "}", ",", "null", ",", "new", "Object", "[", "]", "{", "serviceRegistry", "}", ")", ";", "Object", "userViewObject", "=", "new", "Invokable", "(", "cl", ",", "serviceRegistry", ".", "getClass", "(", ")", ")", ".", "invokeMethod", "(", "METHOD_NAME_ONLY_ONE", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "Class", ".", "class", "}", ",", "serviceRegistry", ",", "new", "Object", "[", "]", "{", "userViewClass", "}", ")", ";", "return", "userViewClass", ".", "cast", "(", "userViewObject", ")", ";", "}" ]
Creates a new {@link ResolverSystem} instance of the specified user view type using the specified {@link ClassLoader}. Will consult a configuration file visible to the specified {@link ClassLoader} named "META-INF/services/$fullyQualfiedClassName" which should contain a key=value format with the key {@link ResolverSystemFactory#KEY_IMPL_CLASS_NAME}. The implementation class name must have a no-arg constructor. @param userViewClass The user view type @param cl The {@link ClassLoader} @return The new {@link ResolverSystem} instance of the specified user view type created by using the specified {@link ClassLoader}.
[ "Creates", "a", "new", "{", "@link", "ResolverSystem", "}", "instance", "of", "the", "specified", "user", "view", "type", "using", "the", "specified", "{", "@link", "ClassLoader", "}", ".", "Will", "consult", "a", "configuration", "file", "visible", "to", "the", "specified", "{", "@link", "ClassLoader", "}", "named", "META", "-", "INF", "/", "services", "/", "$fullyQualfiedClassName", "which", "should", "contain", "a", "key", "=", "value", "format", "with", "the", "key", "{", "@link", "ResolverSystemFactory#KEY_IMPL_CLASS_NAME", "}", ".", "The", "implementation", "class", "name", "must", "have", "a", "no", "-", "arg", "constructor", "." ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/api/src/main/java/org/jboss/shrinkwrap/resolver/api/ResolverSystemFactory.java#L69-L98
monitorjbl/json-view
spring-json-view/src/main/java/com/monitorjbl/json/JsonViewSupportFactoryBean.java
JsonViewSupportFactoryBean.registerCustomSerializer
public <T> void registerCustomSerializer( Class<T> cls, JsonSerializer<T> forType ) { """ Registering custom serializer allows to the JSonView to deal with custom serializations for certains field types.<br> This way you could register for instance a JODA serialization as a DateTimeSerializer. <br> Thus, when JSonView find a field of that type (DateTime), it will delegate the serialization to the serializer specified.<br> Example:<br> <code> JsonViewSupportFactoryBean bean = new JsonViewSupportFactoryBean( mapper ); bean.registerCustomSerializer( DateTime.class, new DateTimeSerializer() ); </code> @param <T> Type class of the serializer @param cls {@link Class} the class type you want to add a custom serializer @param forType {@link JsonSerializer} the serializer you want to apply for that type """ this.converter.registerCustomSerializer( cls, forType ); }
java
public <T> void registerCustomSerializer( Class<T> cls, JsonSerializer<T> forType ) { this.converter.registerCustomSerializer( cls, forType ); }
[ "public", "<", "T", ">", "void", "registerCustomSerializer", "(", "Class", "<", "T", ">", "cls", ",", "JsonSerializer", "<", "T", ">", "forType", ")", "{", "this", ".", "converter", ".", "registerCustomSerializer", "(", "cls", ",", "forType", ")", ";", "}" ]
Registering custom serializer allows to the JSonView to deal with custom serializations for certains field types.<br> This way you could register for instance a JODA serialization as a DateTimeSerializer. <br> Thus, when JSonView find a field of that type (DateTime), it will delegate the serialization to the serializer specified.<br> Example:<br> <code> JsonViewSupportFactoryBean bean = new JsonViewSupportFactoryBean( mapper ); bean.registerCustomSerializer( DateTime.class, new DateTimeSerializer() ); </code> @param <T> Type class of the serializer @param cls {@link Class} the class type you want to add a custom serializer @param forType {@link JsonSerializer} the serializer you want to apply for that type
[ "Registering", "custom", "serializer", "allows", "to", "the", "JSonView", "to", "deal", "with", "custom", "serializations", "for", "certains", "field", "types", ".", "<br", ">", "This", "way", "you", "could", "register", "for", "instance", "a", "JODA", "serialization", "as", "a", "DateTimeSerializer", ".", "<br", ">", "Thus", "when", "JSonView", "find", "a", "field", "of", "that", "type", "(", "DateTime", ")", "it", "will", "delegate", "the", "serialization", "to", "the", "serializer", "specified", ".", "<br", ">", "Example", ":", "<br", ">", "<code", ">", "JsonViewSupportFactoryBean", "bean", "=", "new", "JsonViewSupportFactoryBean", "(", "mapper", ")", ";", "bean", ".", "registerCustomSerializer", "(", "DateTime", ".", "class", "new", "DateTimeSerializer", "()", ")", ";", "<", "/", "code", ">" ]
train
https://github.com/monitorjbl/json-view/blob/c01505ac76e5416abe8af85c5816f60bd5d483ea/spring-json-view/src/main/java/com/monitorjbl/json/JsonViewSupportFactoryBean.java#L103-L106
netplex/json-smart-v2
accessors-smart/src/main/java/net/minidev/asm/ASMUtil.java
ASMUtil.autoBoxing
protected static void autoBoxing(MethodVisitor mv, Type fieldType) { """ Append the call of proper autoboxing method for the given primitif type. """ switch (fieldType.getSort()) { case Type.BOOLEAN: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;"); break; case Type.BYTE: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;"); break; case Type.CHAR: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;"); break; case Type.SHORT: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;"); break; case Type.INT: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;"); break; case Type.FLOAT: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;"); break; case Type.LONG: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;"); break; case Type.DOUBLE: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;"); break; } }
java
protected static void autoBoxing(MethodVisitor mv, Type fieldType) { switch (fieldType.getSort()) { case Type.BOOLEAN: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;"); break; case Type.BYTE: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;"); break; case Type.CHAR: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;"); break; case Type.SHORT: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;"); break; case Type.INT: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;"); break; case Type.FLOAT: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;"); break; case Type.LONG: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;"); break; case Type.DOUBLE: mv.visitMethodInsn(INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;"); break; } }
[ "protected", "static", "void", "autoBoxing", "(", "MethodVisitor", "mv", ",", "Type", "fieldType", ")", "{", "switch", "(", "fieldType", ".", "getSort", "(", ")", ")", "{", "case", "Type", ".", "BOOLEAN", ":", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "\"java/lang/Boolean\"", ",", "\"valueOf\"", ",", "\"(Z)Ljava/lang/Boolean;\"", ")", ";", "break", ";", "case", "Type", ".", "BYTE", ":", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "\"java/lang/Byte\"", ",", "\"valueOf\"", ",", "\"(B)Ljava/lang/Byte;\"", ")", ";", "break", ";", "case", "Type", ".", "CHAR", ":", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "\"java/lang/Character\"", ",", "\"valueOf\"", ",", "\"(C)Ljava/lang/Character;\"", ")", ";", "break", ";", "case", "Type", ".", "SHORT", ":", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "\"java/lang/Short\"", ",", "\"valueOf\"", ",", "\"(S)Ljava/lang/Short;\"", ")", ";", "break", ";", "case", "Type", ".", "INT", ":", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "\"java/lang/Integer\"", ",", "\"valueOf\"", ",", "\"(I)Ljava/lang/Integer;\"", ")", ";", "break", ";", "case", "Type", ".", "FLOAT", ":", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "\"java/lang/Float\"", ",", "\"valueOf\"", ",", "\"(F)Ljava/lang/Float;\"", ")", ";", "break", ";", "case", "Type", ".", "LONG", ":", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "\"java/lang/Long\"", ",", "\"valueOf\"", ",", "\"(J)Ljava/lang/Long;\"", ")", ";", "break", ";", "case", "Type", ".", "DOUBLE", ":", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "\"java/lang/Double\"", ",", "\"valueOf\"", ",", "\"(D)Ljava/lang/Double;\"", ")", ";", "break", ";", "}", "}" ]
Append the call of proper autoboxing method for the given primitif type.
[ "Append", "the", "call", "of", "proper", "autoboxing", "method", "for", "the", "given", "primitif", "type", "." ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/accessors-smart/src/main/java/net/minidev/asm/ASMUtil.java#L73-L100
meertensinstituut/mtas
src/main/java/mtas/solr/handler/util/MtasSolrStatus.java
MtasSolrStatus.getBoolean
private final Boolean getBoolean(NamedList<Object> response, String... args) { """ Gets the boolean. @param response the response @param args the args @return the boolean """ Object objectItem = response.findRecursive(args); Boolean result = null; if (objectItem != null && objectItem instanceof Boolean) { result = (Boolean) objectItem; } return result; }
java
private final Boolean getBoolean(NamedList<Object> response, String... args) { Object objectItem = response.findRecursive(args); Boolean result = null; if (objectItem != null && objectItem instanceof Boolean) { result = (Boolean) objectItem; } return result; }
[ "private", "final", "Boolean", "getBoolean", "(", "NamedList", "<", "Object", ">", "response", ",", "String", "...", "args", ")", "{", "Object", "objectItem", "=", "response", ".", "findRecursive", "(", "args", ")", ";", "Boolean", "result", "=", "null", ";", "if", "(", "objectItem", "!=", "null", "&&", "objectItem", "instanceof", "Boolean", ")", "{", "result", "=", "(", "Boolean", ")", "objectItem", ";", "}", "return", "result", ";", "}" ]
Gets the boolean. @param response the response @param args the args @return the boolean
[ "Gets", "the", "boolean", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java#L642-L649
alkacon/opencms-core
src/org/opencms/util/CmsRequestUtil.java
CmsRequestUtil.redirectRequestSecure
public static void redirectRequestSecure(CmsJspActionElement jsp, String target) throws IOException { """ Redirects the response to the target link.<p> Use this method instead of {@link javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)} to avoid relative links with secure sites (and issues with apache).<p> @param jsp the OpenCms JSP context @param target the target link @throws IOException if something goes wrong during redirection """ jsp.getResponse().sendRedirect(OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true)); }
java
public static void redirectRequestSecure(CmsJspActionElement jsp, String target) throws IOException { jsp.getResponse().sendRedirect(OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true)); }
[ "public", "static", "void", "redirectRequestSecure", "(", "CmsJspActionElement", "jsp", ",", "String", "target", ")", "throws", "IOException", "{", "jsp", ".", "getResponse", "(", ")", ".", "sendRedirect", "(", "OpenCms", ".", "getLinkManager", "(", ")", ".", "substituteLink", "(", "jsp", ".", "getCmsObject", "(", ")", ",", "target", ",", "null", ",", "true", ")", ")", ";", "}" ]
Redirects the response to the target link.<p> Use this method instead of {@link javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)} to avoid relative links with secure sites (and issues with apache).<p> @param jsp the OpenCms JSP context @param target the target link @throws IOException if something goes wrong during redirection
[ "Redirects", "the", "response", "to", "the", "target", "link", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L870-L873
lets-blade/blade
src/main/java/com/blade/kit/AsmKit.java
AsmKit.sameType
private static boolean sameType(Type[] types, Class<?>[] classes) { """ Compare whether the parameter type is consistent @param types the type of the asm({@link Type}) @param classes java type({@link Class}) @return return param type equals """ if (types.length != classes.length) return false; for (int i = 0; i < types.length; i++) { if (!Type.getType(classes[i]).equals(types[i])) return false; } return true; }
java
private static boolean sameType(Type[] types, Class<?>[] classes) { if (types.length != classes.length) return false; for (int i = 0; i < types.length; i++) { if (!Type.getType(classes[i]).equals(types[i])) return false; } return true; }
[ "private", "static", "boolean", "sameType", "(", "Type", "[", "]", "types", ",", "Class", "<", "?", ">", "[", "]", "classes", ")", "{", "if", "(", "types", ".", "length", "!=", "classes", ".", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "Type", ".", "getType", "(", "classes", "[", "i", "]", ")", ".", "equals", "(", "types", "[", "i", "]", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}" ]
Compare whether the parameter type is consistent @param types the type of the asm({@link Type}) @param classes java type({@link Class}) @return return param type equals
[ "Compare", "whether", "the", "parameter", "type", "is", "consistent" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/AsmKit.java#L49-L55
alkacon/opencms-core
src/org/opencms/gwt/CmsGwtActionElement.java
CmsGwtActionElement.exportCommon
public static String exportCommon(CmsObject cms, CmsCoreData coreData) throws Exception { """ Returns the serialized data for the core provider wrapped into a script tag.<p> @param cms the CMS context @param coreData the core data to write into the page @return the data @throws Exception if something goes wrong """ // determine the workplace locale String wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms).getLanguage(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(wpLocale)) { // if no locale was found, take English as locale wpLocale = Locale.ENGLISH.getLanguage(); } StringBuffer sb = new StringBuffer(); // append meta tag to set the IE to standard document mode sb.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n"); sb.append( "<script type=\"text/javascript\" src=\"" + OpenCms.getStaticExportManager().getVfsPrefix() + "/" + CmsMessagesService.class.getName() + ".gwt?" + CmsLocaleManager.PARAMETER_LOCALE + "=" + wpLocale + "\"></script>\n"); // print out the missing permutation message to be used from the nocache.js generated by custom linker // see org.opencms.gwt.linker.CmsIFrameLinker sb.append( wrapScript( "var ", CMS_NO_PERMUTATION_MESSAGE, "='", Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( Messages.ERR_NO_PERMUTATION_AVAILABLE_0), "';\n")); String prefetchedData = exportDictionary( CmsCoreData.DICT_NAME, I_CmsCoreService.class.getMethod("prefetch"), coreData); sb.append(prefetchedData); // sb.append(ClientMessages.get().export(wpLocale)); sb.append("<style type=\"text/css\">\n @import url(\"").append(iconCssLink(cms)).append("\");\n </style>\n"); // append additional style sheets Collection<String> stylesheets = OpenCms.getWorkplaceAppManager().getAdditionalStyleSheets(); for (String stylesheet : stylesheets) { sb.append("<style type=\"text/css\">\n @import url(\"").append(stylesheet).append("\");\n </style>\n"); } // append the workplace locale information sb.append("<meta name=\"gwt:property\" content=\"locale=").append(wpLocale).append("\" />\n"); return sb.toString(); }
java
public static String exportCommon(CmsObject cms, CmsCoreData coreData) throws Exception { // determine the workplace locale String wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms).getLanguage(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(wpLocale)) { // if no locale was found, take English as locale wpLocale = Locale.ENGLISH.getLanguage(); } StringBuffer sb = new StringBuffer(); // append meta tag to set the IE to standard document mode sb.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n"); sb.append( "<script type=\"text/javascript\" src=\"" + OpenCms.getStaticExportManager().getVfsPrefix() + "/" + CmsMessagesService.class.getName() + ".gwt?" + CmsLocaleManager.PARAMETER_LOCALE + "=" + wpLocale + "\"></script>\n"); // print out the missing permutation message to be used from the nocache.js generated by custom linker // see org.opencms.gwt.linker.CmsIFrameLinker sb.append( wrapScript( "var ", CMS_NO_PERMUTATION_MESSAGE, "='", Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( Messages.ERR_NO_PERMUTATION_AVAILABLE_0), "';\n")); String prefetchedData = exportDictionary( CmsCoreData.DICT_NAME, I_CmsCoreService.class.getMethod("prefetch"), coreData); sb.append(prefetchedData); // sb.append(ClientMessages.get().export(wpLocale)); sb.append("<style type=\"text/css\">\n @import url(\"").append(iconCssLink(cms)).append("\");\n </style>\n"); // append additional style sheets Collection<String> stylesheets = OpenCms.getWorkplaceAppManager().getAdditionalStyleSheets(); for (String stylesheet : stylesheets) { sb.append("<style type=\"text/css\">\n @import url(\"").append(stylesheet).append("\");\n </style>\n"); } // append the workplace locale information sb.append("<meta name=\"gwt:property\" content=\"locale=").append(wpLocale).append("\" />\n"); return sb.toString(); }
[ "public", "static", "String", "exportCommon", "(", "CmsObject", "cms", ",", "CmsCoreData", "coreData", ")", "throws", "Exception", "{", "// determine the workplace locale", "String", "wpLocale", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getWorkplaceLocale", "(", "cms", ")", ".", "getLanguage", "(", ")", ";", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "wpLocale", ")", ")", "{", "// if no locale was found, take English as locale", "wpLocale", "=", "Locale", ".", "ENGLISH", ".", "getLanguage", "(", ")", ";", "}", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "// append meta tag to set the IE to standard document mode", "sb", ".", "append", "(", "\"<meta http-equiv=\\\"X-UA-Compatible\\\" content=\\\"IE=edge\\\" />\\n\"", ")", ";", "sb", ".", "append", "(", "\"<script type=\\\"text/javascript\\\" src=\\\"\"", "+", "OpenCms", ".", "getStaticExportManager", "(", ")", ".", "getVfsPrefix", "(", ")", "+", "\"/\"", "+", "CmsMessagesService", ".", "class", ".", "getName", "(", ")", "+", "\".gwt?\"", "+", "CmsLocaleManager", ".", "PARAMETER_LOCALE", "+", "\"=\"", "+", "wpLocale", "+", "\"\\\"></script>\\n\"", ")", ";", "// print out the missing permutation message to be used from the nocache.js generated by custom linker", "// see org.opencms.gwt.linker.CmsIFrameLinker", "sb", ".", "append", "(", "wrapScript", "(", "\"var \"", ",", "CMS_NO_PERMUTATION_MESSAGE", ",", "\"='\"", ",", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getWorkplaceLocale", "(", "cms", ")", ")", ".", "key", "(", "Messages", ".", "ERR_NO_PERMUTATION_AVAILABLE_0", ")", ",", "\"';\\n\"", ")", ")", ";", "String", "prefetchedData", "=", "exportDictionary", "(", "CmsCoreData", ".", "DICT_NAME", ",", "I_CmsCoreService", ".", "class", ".", "getMethod", "(", "\"prefetch\"", ")", ",", "coreData", ")", ";", "sb", ".", "append", "(", "prefetchedData", ")", ";", "// sb.append(ClientMessages.get().export(wpLocale));", "sb", ".", "append", "(", "\"<style type=\\\"text/css\\\">\\n @import url(\\\"\"", ")", ".", "append", "(", "iconCssLink", "(", "cms", ")", ")", ".", "append", "(", "\"\\\");\\n </style>\\n\"", ")", ";", "// append additional style sheets", "Collection", "<", "String", ">", "stylesheets", "=", "OpenCms", ".", "getWorkplaceAppManager", "(", ")", ".", "getAdditionalStyleSheets", "(", ")", ";", "for", "(", "String", "stylesheet", ":", "stylesheets", ")", "{", "sb", ".", "append", "(", "\"<style type=\\\"text/css\\\">\\n @import url(\\\"\"", ")", ".", "append", "(", "stylesheet", ")", ".", "append", "(", "\"\\\");\\n </style>\\n\"", ")", ";", "}", "// append the workplace locale information", "sb", ".", "append", "(", "\"<meta name=\\\"gwt:property\\\" content=\\\"locale=\"", ")", ".", "append", "(", "wpLocale", ")", ".", "append", "(", "\"\\\" />\\n\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the serialized data for the core provider wrapped into a script tag.<p> @param cms the CMS context @param coreData the core data to write into the page @return the data @throws Exception if something goes wrong
[ "Returns", "the", "serialized", "data", "for", "the", "core", "provider", "wrapped", "into", "a", "script", "tag", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsGwtActionElement.java#L117-L167
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java
XSLTAttributeDef.processENUM
Object processENUM(StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { """ Process an attribute string of type T_ENUM into a int value. @param handler non-null reference to current StylesheetHandler that is constructing the Templates. @param uri The Namespace URI, or an empty string. @param name The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @param value non-null string that represents an enumerated value that is valid for this element. @param owner @return An Integer representation of the enumerated value if this attribute does not support AVT. Otherwise, and AVT is returned. """ AVT avt = null; if (getSupportsAVT()) { try { avt = new AVT(handler, uri, name, rawName, value, owner); // If this attribute used an avt, then we can't validate at this time. if (!avt.isSimple()) return avt; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } int retVal = this.getEnum(value); if (retVal == StringToIntTable.INVALID_KEY) { StringBuffer enumNamesList = getListOfEnums(); handleError(handler, XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },null); return null; } if (getSupportsAVT()) return avt; else return new Integer(retVal); }
java
Object processENUM(StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { AVT avt = null; if (getSupportsAVT()) { try { avt = new AVT(handler, uri, name, rawName, value, owner); // If this attribute used an avt, then we can't validate at this time. if (!avt.isSimple()) return avt; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } int retVal = this.getEnum(value); if (retVal == StringToIntTable.INVALID_KEY) { StringBuffer enumNamesList = getListOfEnums(); handleError(handler, XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },null); return null; } if (getSupportsAVT()) return avt; else return new Integer(retVal); }
[ "Object", "processENUM", "(", "StylesheetHandler", "handler", ",", "String", "uri", ",", "String", "name", ",", "String", "rawName", ",", "String", "value", ",", "ElemTemplateElement", "owner", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "AVT", "avt", "=", "null", ";", "if", "(", "getSupportsAVT", "(", ")", ")", "{", "try", "{", "avt", "=", "new", "AVT", "(", "handler", ",", "uri", ",", "name", ",", "rawName", ",", "value", ",", "owner", ")", ";", "// If this attribute used an avt, then we can't validate at this time.", "if", "(", "!", "avt", ".", "isSimple", "(", ")", ")", "return", "avt", ";", "}", "catch", "(", "TransformerException", "te", ")", "{", "throw", "new", "org", ".", "xml", ".", "sax", ".", "SAXException", "(", "te", ")", ";", "}", "}", "int", "retVal", "=", "this", ".", "getEnum", "(", "value", ")", ";", "if", "(", "retVal", "==", "StringToIntTable", ".", "INVALID_KEY", ")", "{", "StringBuffer", "enumNamesList", "=", "getListOfEnums", "(", ")", ";", "handleError", "(", "handler", ",", "XSLTErrorResources", ".", "INVALID_ENUM", ",", "new", "Object", "[", "]", "{", "name", ",", "value", ",", "enumNamesList", ".", "toString", "(", ")", "}", ",", "null", ")", ";", "return", "null", ";", "}", "if", "(", "getSupportsAVT", "(", ")", ")", "return", "avt", ";", "else", "return", "new", "Integer", "(", "retVal", ")", ";", "}" ]
Process an attribute string of type T_ENUM into a int value. @param handler non-null reference to current StylesheetHandler that is constructing the Templates. @param uri The Namespace URI, or an empty string. @param name The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @param value non-null string that represents an enumerated value that is valid for this element. @param owner @return An Integer representation of the enumerated value if this attribute does not support AVT. Otherwise, and AVT is returned.
[ "Process", "an", "attribute", "string", "of", "type", "T_ENUM", "into", "a", "int", "value", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L622-L654
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/application/AbstractApplication.java
AbstractApplication.preloadAndLaunch
protected static void preloadAndLaunch(final Class<? extends Preloader> preloaderClass, final String... args) { """ Launch the Current JavaFX Application with given preloader. @param preloaderClass the preloader class used as splash screen with progress @param args arguments passed to java command line """ preloadAndLaunch(ClassUtility.getClassFromStaticMethod(3), preloaderClass, args); }
java
protected static void preloadAndLaunch(final Class<? extends Preloader> preloaderClass, final String... args) { preloadAndLaunch(ClassUtility.getClassFromStaticMethod(3), preloaderClass, args); }
[ "protected", "static", "void", "preloadAndLaunch", "(", "final", "Class", "<", "?", "extends", "Preloader", ">", "preloaderClass", ",", "final", "String", "...", "args", ")", "{", "preloadAndLaunch", "(", "ClassUtility", ".", "getClassFromStaticMethod", "(", "3", ")", ",", "preloaderClass", ",", "args", ")", ";", "}" ]
Launch the Current JavaFX Application with given preloader. @param preloaderClass the preloader class used as splash screen with progress @param args arguments passed to java command line
[ "Launch", "the", "Current", "JavaFX", "Application", "with", "given", "preloader", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/application/AbstractApplication.java#L113-L115
springfox/springfox
springfox-core/src/main/java/springfox/documentation/builders/BuilderDefaults.java
BuilderDefaults.replaceIfMoreSpecific
public static ResolvedType replaceIfMoreSpecific(ResolvedType replacement, ResolvedType defaultValue) { """ Coalesces the resolved type. Preservers the default value if the replacement is either null or represents a type that is less specific than the default value. For e.g. if default value represents a String then the replacement value has to be any value that is a subclass of Object. If it represents Object.class then the default value is preferred @param replacement - replacement value @param defaultValue - default value @return most specific resolved type """ ResolvedType toReturn = defaultIfAbsent(replacement, defaultValue); if (isObject(replacement) && isNotObject(defaultValue)) { return defaultValue; } return toReturn; }
java
public static ResolvedType replaceIfMoreSpecific(ResolvedType replacement, ResolvedType defaultValue) { ResolvedType toReturn = defaultIfAbsent(replacement, defaultValue); if (isObject(replacement) && isNotObject(defaultValue)) { return defaultValue; } return toReturn; }
[ "public", "static", "ResolvedType", "replaceIfMoreSpecific", "(", "ResolvedType", "replacement", ",", "ResolvedType", "defaultValue", ")", "{", "ResolvedType", "toReturn", "=", "defaultIfAbsent", "(", "replacement", ",", "defaultValue", ")", ";", "if", "(", "isObject", "(", "replacement", ")", "&&", "isNotObject", "(", "defaultValue", ")", ")", "{", "return", "defaultValue", ";", "}", "return", "toReturn", ";", "}" ]
Coalesces the resolved type. Preservers the default value if the replacement is either null or represents a type that is less specific than the default value. For e.g. if default value represents a String then the replacement value has to be any value that is a subclass of Object. If it represents Object.class then the default value is preferred @param replacement - replacement value @param defaultValue - default value @return most specific resolved type
[ "Coalesces", "the", "resolved", "type", ".", "Preservers", "the", "default", "value", "if", "the", "replacement", "is", "either", "null", "or", "represents", "a", "type", "that", "is", "less", "specific", "than", "the", "default", "value", ".", "For", "e", ".", "g", ".", "if", "default", "value", "represents", "a", "String", "then", "the", "replacement", "value", "has", "to", "be", "any", "value", "that", "is", "a", "subclass", "of", "Object", ".", "If", "it", "represents", "Object", ".", "class", "then", "the", "default", "value", "is", "preferred" ]
train
https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-core/src/main/java/springfox/documentation/builders/BuilderDefaults.java#L127-L133
ddf-project/DDF
core/src/main/java/io/ddf/util/DDFUtils.java
DDFUtils.generateObjectName
public static String generateObjectName(Object obj, String sourceName, String operation, String desiredName) { """ Heuristic: if the source/parent already has a table name then we can add something that identifies the operation. Plus a unique extension if needed. If the starting name is already too long, we call that a degenerate case, for which we go back to UUID-based. All this is overridden if the caller specifies a desired name. For the desired name we still attach an extension if needed to make it unique. @param obj object to be named, no hyphens @param sourceName the name of the source object, if any, based on which we will generate the name @param operation the name/brief description of the operation, if any, which we would use as an extension to the sourceName @param desiredName the desired name to be used, if any @return """ if (Strings.isNullOrEmpty(desiredName)) { if (Strings.isNullOrEmpty(sourceName)) { return generateUniqueName(obj); } else if (Strings.isNullOrEmpty(operation)) { desiredName = sourceName; } else { desiredName = String.format("%s_%s", sourceName, operation); } } desiredName = desiredName.replace("-", "_"); return (Strings.isNullOrEmpty(desiredName) || desiredName.length() > MAX_DESIRED_NAME_LEN) ? generateUniqueName(obj) : ensureUniqueness(desiredName); }
java
public static String generateObjectName(Object obj, String sourceName, String operation, String desiredName) { if (Strings.isNullOrEmpty(desiredName)) { if (Strings.isNullOrEmpty(sourceName)) { return generateUniqueName(obj); } else if (Strings.isNullOrEmpty(operation)) { desiredName = sourceName; } else { desiredName = String.format("%s_%s", sourceName, operation); } } desiredName = desiredName.replace("-", "_"); return (Strings.isNullOrEmpty(desiredName) || desiredName.length() > MAX_DESIRED_NAME_LEN) ? generateUniqueName(obj) : ensureUniqueness(desiredName); }
[ "public", "static", "String", "generateObjectName", "(", "Object", "obj", ",", "String", "sourceName", ",", "String", "operation", ",", "String", "desiredName", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "desiredName", ")", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "sourceName", ")", ")", "{", "return", "generateUniqueName", "(", "obj", ")", ";", "}", "else", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "operation", ")", ")", "{", "desiredName", "=", "sourceName", ";", "}", "else", "{", "desiredName", "=", "String", ".", "format", "(", "\"%s_%s\"", ",", "sourceName", ",", "operation", ")", ";", "}", "}", "desiredName", "=", "desiredName", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", ";", "return", "(", "Strings", ".", "isNullOrEmpty", "(", "desiredName", ")", "||", "desiredName", ".", "length", "(", ")", ">", "MAX_DESIRED_NAME_LEN", ")", "?", "generateUniqueName", "(", "obj", ")", ":", "ensureUniqueness", "(", "desiredName", ")", ";", "}" ]
Heuristic: if the source/parent already has a table name then we can add something that identifies the operation. Plus a unique extension if needed. If the starting name is already too long, we call that a degenerate case, for which we go back to UUID-based. All this is overridden if the caller specifies a desired name. For the desired name we still attach an extension if needed to make it unique. @param obj object to be named, no hyphens @param sourceName the name of the source object, if any, based on which we will generate the name @param operation the name/brief description of the operation, if any, which we would use as an extension to the sourceName @param desiredName the desired name to be used, if any @return
[ "Heuristic", ":", "if", "the", "source", "/", "parent", "already", "has", "a", "table", "name", "then", "we", "can", "add", "something", "that", "identifies", "the", "operation", ".", "Plus", "a", "unique", "extension", "if", "needed", ".", "If", "the", "starting", "name", "is", "already", "too", "long", "we", "call", "that", "a", "degenerate", "case", "for", "which", "we", "go", "back", "to", "UUID", "-", "based", ".", "All", "this", "is", "overridden", "if", "the", "caller", "specifies", "a", "desired", "name", ".", "For", "the", "desired", "name", "we", "still", "attach", "an", "extension", "if", "needed", "to", "make", "it", "unique", "." ]
train
https://github.com/ddf-project/DDF/blob/e4e68315dcec1ed8b287bf1ee73baa88e7e41eba/core/src/main/java/io/ddf/util/DDFUtils.java#L26-L44
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_ips_ip_GET
public OvhIP serviceName_ips_ip_GET(String serviceName, String ip) throws IOException { """ Get this object properties REST: GET /xdsl/{serviceName}/ips/{ip} @param serviceName [required] The internal name of your XDSL offer @param ip [required] The IP address """ String qPath = "/xdsl/{serviceName}/ips/{ip}"; StringBuilder sb = path(qPath, serviceName, ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIP.class); }
java
public OvhIP serviceName_ips_ip_GET(String serviceName, String ip) throws IOException { String qPath = "/xdsl/{serviceName}/ips/{ip}"; StringBuilder sb = path(qPath, serviceName, ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIP.class); }
[ "public", "OvhIP", "serviceName_ips_ip_GET", "(", "String", "serviceName", ",", "String", "ip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/ips/{ip}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "ip", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhIP", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /xdsl/{serviceName}/ips/{ip} @param serviceName [required] The internal name of your XDSL offer @param ip [required] The IP address
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1467-L1472
line/armeria
core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java
TypeSignature.ofMap
public static TypeSignature ofMap(Class<?> namedKeyType, Class<?> namedValueType) { """ Creates a new type signature for the map with the specified named key and value types. This method is a shortcut of: <pre>{@code ofMap(ofNamed(namedKeyType), ofNamed(namedValueType)); }</pre> """ return ofMap(ofNamed(namedKeyType, "namedKeyType"), ofNamed(namedValueType, "namedValueType")); }
java
public static TypeSignature ofMap(Class<?> namedKeyType, Class<?> namedValueType) { return ofMap(ofNamed(namedKeyType, "namedKeyType"), ofNamed(namedValueType, "namedValueType")); }
[ "public", "static", "TypeSignature", "ofMap", "(", "Class", "<", "?", ">", "namedKeyType", ",", "Class", "<", "?", ">", "namedValueType", ")", "{", "return", "ofMap", "(", "ofNamed", "(", "namedKeyType", ",", "\"namedKeyType\"", ")", ",", "ofNamed", "(", "namedValueType", ",", "\"namedValueType\"", ")", ")", ";", "}" ]
Creates a new type signature for the map with the specified named key and value types. This method is a shortcut of: <pre>{@code ofMap(ofNamed(namedKeyType), ofNamed(namedValueType)); }</pre>
[ "Creates", "a", "new", "type", "signature", "for", "the", "map", "with", "the", "specified", "named", "key", "and", "value", "types", ".", "This", "method", "is", "a", "shortcut", "of", ":", "<pre", ">", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java#L171-L173
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java
OrderItemUrl.updateItemDutyUrl
public static MozuUrl updateItemDutyUrl(Double dutyAmount, String orderId, String orderItemId, String responseFields, String updateMode, String version) { """ Get Resource Url for UpdateItemDuty @param dutyAmount The amount added to the order item for duty fees. @param orderId Unique identifier of the order. @param orderItemId Unique identifier of the item to remove from the order. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param updateMode Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit." @param version Determines whether or not to check versioning of items for concurrency purposes. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{orderItemId}/dutyAmount/{dutyAmount}?updatemode={updateMode}&version={version}&responseFields={responseFields}"); formatter.formatUrl("dutyAmount", dutyAmount); formatter.formatUrl("orderId", orderId); formatter.formatUrl("orderItemId", orderItemId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("updateMode", updateMode); formatter.formatUrl("version", version); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateItemDutyUrl(Double dutyAmount, String orderId, String orderItemId, String responseFields, String updateMode, String version) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{orderItemId}/dutyAmount/{dutyAmount}?updatemode={updateMode}&version={version}&responseFields={responseFields}"); formatter.formatUrl("dutyAmount", dutyAmount); formatter.formatUrl("orderId", orderId); formatter.formatUrl("orderItemId", orderItemId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("updateMode", updateMode); formatter.formatUrl("version", version); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateItemDutyUrl", "(", "Double", "dutyAmount", ",", "String", "orderId", ",", "String", "orderItemId", ",", "String", "responseFields", ",", "String", "updateMode", ",", "String", "version", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/orders/{orderId}/items/{orderItemId}/dutyAmount/{dutyAmount}?updatemode={updateMode}&version={version}&responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"dutyAmount\"", ",", "dutyAmount", ")", ";", "formatter", ".", "formatUrl", "(", "\"orderId\"", ",", "orderId", ")", ";", "formatter", ".", "formatUrl", "(", "\"orderItemId\"", ",", "orderItemId", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "formatter", ".", "formatUrl", "(", "\"updateMode\"", ",", "updateMode", ")", ";", "formatter", ".", "formatUrl", "(", "\"version\"", ",", "version", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for UpdateItemDuty @param dutyAmount The amount added to the order item for duty fees. @param orderId Unique identifier of the order. @param orderItemId Unique identifier of the item to remove from the order. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param updateMode Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit." @param version Determines whether or not to check versioning of items for concurrency purposes. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateItemDuty", "@param", "dutyAmount", "The", "amount", "added", "to", "the", "order", "item", "for", "duty", "fees", "." ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java#L121-L131
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/octracker/ConnectionDataGroup.java
ConnectionDataGroup.createnewConnectionData
private ConnectionData createnewConnectionData(NetworkConnection vc) throws FrameworkException { """ Create a new Connection data object @param vc The network connection over which to create a connection data @return ConnectionData A new connection data object @throws FrameworkException is thrown if the new connection data cannot be created """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createnewConnectionData", vc); ConnectionData connectionDataToUse; NetworkConnectionContext connLink = vc.getNetworkConnectionContext(); connectionDataToUse = new ConnectionData(this, groupEndpointDescriptor); connectionDataToUse.incrementUseCount(); // New connections start with a use count of zero and it is now in use // No need to lock as it's not in the connectionData list yet OutboundConnection oc = new OutboundConnection(connLink, vc, tracker, heartbeatInterval, heartbeatTimeout, connectionDataToUse); connectionDataToUse.setConnection(oc); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createnewConnectionData", connectionDataToUse); return connectionDataToUse; }
java
private ConnectionData createnewConnectionData(NetworkConnection vc) throws FrameworkException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createnewConnectionData", vc); ConnectionData connectionDataToUse; NetworkConnectionContext connLink = vc.getNetworkConnectionContext(); connectionDataToUse = new ConnectionData(this, groupEndpointDescriptor); connectionDataToUse.incrementUseCount(); // New connections start with a use count of zero and it is now in use // No need to lock as it's not in the connectionData list yet OutboundConnection oc = new OutboundConnection(connLink, vc, tracker, heartbeatInterval, heartbeatTimeout, connectionDataToUse); connectionDataToUse.setConnection(oc); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createnewConnectionData", connectionDataToUse); return connectionDataToUse; }
[ "private", "ConnectionData", "createnewConnectionData", "(", "NetworkConnection", "vc", ")", "throws", "FrameworkException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"createnewConnectionData\"", ",", "vc", ")", ";", "ConnectionData", "connectionDataToUse", ";", "NetworkConnectionContext", "connLink", "=", "vc", ".", "getNetworkConnectionContext", "(", ")", ";", "connectionDataToUse", "=", "new", "ConnectionData", "(", "this", ",", "groupEndpointDescriptor", ")", ";", "connectionDataToUse", ".", "incrementUseCount", "(", ")", ";", "// New connections start with a use count of zero and it is now in use", "// No need to lock as it's not in the connectionData list yet", "OutboundConnection", "oc", "=", "new", "OutboundConnection", "(", "connLink", ",", "vc", ",", "tracker", ",", "heartbeatInterval", ",", "heartbeatTimeout", ",", "connectionDataToUse", ")", ";", "connectionDataToUse", ".", "setConnection", "(", "oc", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"createnewConnectionData\"", ",", "connectionDataToUse", ")", ";", "return", "connectionDataToUse", ";", "}" ]
Create a new Connection data object @param vc The network connection over which to create a connection data @return ConnectionData A new connection data object @throws FrameworkException is thrown if the new connection data cannot be created
[ "Create", "a", "new", "Connection", "data", "object" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/octracker/ConnectionDataGroup.java#L800-L824
respoke/respoke-sdk-android
respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java
RespokeClient.buildGroupMessage
private RespokeGroupMessage buildGroupMessage(JSONObject source) throws JSONException { """ Build a group message from a JSON object. The format of the JSON object would be the format that comes over the wire from Respoke when receiving a pubsub message. This same format is used when retrieving message history. @param source The source JSON object to build the RespokeGroupMessage from @return The built RespokeGroupMessage @throws JSONException """ if (source == null) { throw new IllegalArgumentException("source cannot be null"); } final JSONObject header = source.getJSONObject("header"); final String endpointID = header.getString("from"); final RespokeEndpoint endpoint = getEndpoint(endpointID, false); final String groupID = header.getString("channel"); RespokeGroup group = getGroup(groupID); if (group == null) { group = new RespokeGroup(groupID, signalingChannel, this, false); groups.put(groupID, group); } final String message = source.getString("message"); final Date timestamp; if (!header.isNull("timestamp")) { timestamp = new Date(header.getLong("timestamp")); } else { // Just use the current time if no date is specified in the header data timestamp = new Date(); } return new RespokeGroupMessage(message, group, endpoint, timestamp); }
java
private RespokeGroupMessage buildGroupMessage(JSONObject source) throws JSONException { if (source == null) { throw new IllegalArgumentException("source cannot be null"); } final JSONObject header = source.getJSONObject("header"); final String endpointID = header.getString("from"); final RespokeEndpoint endpoint = getEndpoint(endpointID, false); final String groupID = header.getString("channel"); RespokeGroup group = getGroup(groupID); if (group == null) { group = new RespokeGroup(groupID, signalingChannel, this, false); groups.put(groupID, group); } final String message = source.getString("message"); final Date timestamp; if (!header.isNull("timestamp")) { timestamp = new Date(header.getLong("timestamp")); } else { // Just use the current time if no date is specified in the header data timestamp = new Date(); } return new RespokeGroupMessage(message, group, endpoint, timestamp); }
[ "private", "RespokeGroupMessage", "buildGroupMessage", "(", "JSONObject", "source", ")", "throws", "JSONException", "{", "if", "(", "source", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"source cannot be null\"", ")", ";", "}", "final", "JSONObject", "header", "=", "source", ".", "getJSONObject", "(", "\"header\"", ")", ";", "final", "String", "endpointID", "=", "header", ".", "getString", "(", "\"from\"", ")", ";", "final", "RespokeEndpoint", "endpoint", "=", "getEndpoint", "(", "endpointID", ",", "false", ")", ";", "final", "String", "groupID", "=", "header", ".", "getString", "(", "\"channel\"", ")", ";", "RespokeGroup", "group", "=", "getGroup", "(", "groupID", ")", ";", "if", "(", "group", "==", "null", ")", "{", "group", "=", "new", "RespokeGroup", "(", "groupID", ",", "signalingChannel", ",", "this", ",", "false", ")", ";", "groups", ".", "put", "(", "groupID", ",", "group", ")", ";", "}", "final", "String", "message", "=", "source", ".", "getString", "(", "\"message\"", ")", ";", "final", "Date", "timestamp", ";", "if", "(", "!", "header", ".", "isNull", "(", "\"timestamp\"", ")", ")", "{", "timestamp", "=", "new", "Date", "(", "header", ".", "getLong", "(", "\"timestamp\"", ")", ")", ";", "}", "else", "{", "// Just use the current time if no date is specified in the header data", "timestamp", "=", "new", "Date", "(", ")", ";", "}", "return", "new", "RespokeGroupMessage", "(", "message", ",", "group", ",", "endpoint", ",", "timestamp", ")", ";", "}" ]
Build a group message from a JSON object. The format of the JSON object would be the format that comes over the wire from Respoke when receiving a pubsub message. This same format is used when retrieving message history. @param source The source JSON object to build the RespokeGroupMessage from @return The built RespokeGroupMessage @throws JSONException
[ "Build", "a", "group", "message", "from", "a", "JSON", "object", ".", "The", "format", "of", "the", "JSON", "object", "would", "be", "the", "format", "that", "comes", "over", "the", "wire", "from", "Respoke", "when", "receiving", "a", "pubsub", "message", ".", "This", "same", "format", "is", "used", "when", "retrieving", "message", "history", "." ]
train
https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java#L1576-L1604
tvesalainen/util
util/src/main/java/org/vesalainen/code/TransactionalSetter.java
TransactionalSetter.getInstance
public static <T extends TransactionalSetter> T getInstance(Class<T> cls, Object intf) { """ Creates a instance of a class TransactionalSetter subclass. @param <T> Type of TransactionalSetter subclass @param cls TransactionalSetter subclass class @param intf Interface implemented by TransactionalSetter subclass @return """ Class<?>[] interfaces = cls.getInterfaces(); if (interfaces.length != 1) { throw new IllegalArgumentException(cls+" should implement exactly one interface"); } boolean ok = false; if (!interfaces[0].isAssignableFrom(intf.getClass())) { throw new IllegalArgumentException(cls+" doesn't implement "+intf); } try { TransactionalSetterClass annotation = cls.getAnnotation(TransactionalSetterClass.class); if (annotation == null) { throw new IllegalArgumentException("@"+TransactionalSetterClass.class.getSimpleName()+" missing in cls"); } Class<?> c = Class.forName(annotation.value()); T t =(T) c.newInstance(); t.intf = intf; return t; } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) { throw new IllegalArgumentException(ex); } }
java
public static <T extends TransactionalSetter> T getInstance(Class<T> cls, Object intf) { Class<?>[] interfaces = cls.getInterfaces(); if (interfaces.length != 1) { throw new IllegalArgumentException(cls+" should implement exactly one interface"); } boolean ok = false; if (!interfaces[0].isAssignableFrom(intf.getClass())) { throw new IllegalArgumentException(cls+" doesn't implement "+intf); } try { TransactionalSetterClass annotation = cls.getAnnotation(TransactionalSetterClass.class); if (annotation == null) { throw new IllegalArgumentException("@"+TransactionalSetterClass.class.getSimpleName()+" missing in cls"); } Class<?> c = Class.forName(annotation.value()); T t =(T) c.newInstance(); t.intf = intf; return t; } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) { throw new IllegalArgumentException(ex); } }
[ "public", "static", "<", "T", "extends", "TransactionalSetter", ">", "T", "getInstance", "(", "Class", "<", "T", ">", "cls", ",", "Object", "intf", ")", "{", "Class", "<", "?", ">", "[", "]", "interfaces", "=", "cls", ".", "getInterfaces", "(", ")", ";", "if", "(", "interfaces", ".", "length", "!=", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "cls", "+", "\" should implement exactly one interface\"", ")", ";", "}", "boolean", "ok", "=", "false", ";", "if", "(", "!", "interfaces", "[", "0", "]", ".", "isAssignableFrom", "(", "intf", ".", "getClass", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "cls", "+", "\" doesn't implement \"", "+", "intf", ")", ";", "}", "try", "{", "TransactionalSetterClass", "annotation", "=", "cls", ".", "getAnnotation", "(", "TransactionalSetterClass", ".", "class", ")", ";", "if", "(", "annotation", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"@\"", "+", "TransactionalSetterClass", ".", "class", ".", "getSimpleName", "(", ")", "+", "\" missing in cls\"", ")", ";", "}", "Class", "<", "?", ">", "c", "=", "Class", ".", "forName", "(", "annotation", ".", "value", "(", ")", ")", ";", "T", "t", "=", "(", "T", ")", "c", ".", "newInstance", "(", ")", ";", "t", ".", "intf", "=", "intf", ";", "return", "t", ";", "}", "catch", "(", "ClassNotFoundException", "|", "InstantiationException", "|", "IllegalAccessException", "ex", ")", "{", "throw", "new", "IllegalArgumentException", "(", "ex", ")", ";", "}", "}" ]
Creates a instance of a class TransactionalSetter subclass. @param <T> Type of TransactionalSetter subclass @param cls TransactionalSetter subclass class @param intf Interface implemented by TransactionalSetter subclass @return
[ "Creates", "a", "instance", "of", "a", "class", "TransactionalSetter", "subclass", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/code/TransactionalSetter.java#L75-L103
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.pretrainLayer
public void pretrainLayer(String layerName, DataSetIterator dataSetIterator) { """ Pretrain a specified layer with the given DataSetIterator @param layerName Layer name @param dataSetIterator Data """ if (numInputArrays != 1) { throw new UnsupportedOperationException( "Cannot train ComputationGraph network with multiple inputs using a DataSetIterator"); } pretrainLayer(layerName, ComputationGraphUtil.toMultiDataSetIterator(dataSetIterator)); }
java
public void pretrainLayer(String layerName, DataSetIterator dataSetIterator) { if (numInputArrays != 1) { throw new UnsupportedOperationException( "Cannot train ComputationGraph network with multiple inputs using a DataSetIterator"); } pretrainLayer(layerName, ComputationGraphUtil.toMultiDataSetIterator(dataSetIterator)); }
[ "public", "void", "pretrainLayer", "(", "String", "layerName", ",", "DataSetIterator", "dataSetIterator", ")", "{", "if", "(", "numInputArrays", "!=", "1", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Cannot train ComputationGraph network with multiple inputs using a DataSetIterator\"", ")", ";", "}", "pretrainLayer", "(", "layerName", ",", "ComputationGraphUtil", ".", "toMultiDataSetIterator", "(", "dataSetIterator", ")", ")", ";", "}" ]
Pretrain a specified layer with the given DataSetIterator @param layerName Layer name @param dataSetIterator Data
[ "Pretrain", "a", "specified", "layer", "with", "the", "given", "DataSetIterator" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L879-L886
jmeetsma/Iglu-Common
src/main/java/org/ijsberg/iglu/util/xml/ElementList.java
ElementList.renameNodesInTree
public void renameNodesInTree(String oldName, String newName) { """ Renames all subnodes with a certain name @param oldName @param newName """ List<Node> nodes = getNodesFromTreeByName(oldName); Iterator i = nodes.iterator(); while (i.hasNext()) { Node n = (Node) i.next(); n.setName(newName); } }
java
public void renameNodesInTree(String oldName, String newName) { List<Node> nodes = getNodesFromTreeByName(oldName); Iterator i = nodes.iterator(); while (i.hasNext()) { Node n = (Node) i.next(); n.setName(newName); } }
[ "public", "void", "renameNodesInTree", "(", "String", "oldName", ",", "String", "newName", ")", "{", "List", "<", "Node", ">", "nodes", "=", "getNodesFromTreeByName", "(", "oldName", ")", ";", "Iterator", "i", "=", "nodes", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "Node", "n", "=", "(", "Node", ")", "i", ".", "next", "(", ")", ";", "n", ".", "setName", "(", "newName", ")", ";", "}", "}" ]
Renames all subnodes with a certain name @param oldName @param newName
[ "Renames", "all", "subnodes", "with", "a", "certain", "name" ]
train
https://github.com/jmeetsma/Iglu-Common/blob/0fb0885775b576209ff1b5a0f67e3c25a99a6420/src/main/java/org/ijsberg/iglu/util/xml/ElementList.java#L260-L267
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/tcpchannel/TCPConnectRequestContextFactory.java
TCPConnectRequestContextFactory.createTCPConnectRequestContext
public TCPConnectRequestContext createTCPConnectRequestContext(String _localHostName, int _localPort, String _remoteHostName, int _remotePort, int _timeout) { """ Create a new connection request context based upon the input needed to fully define the context. @param _localHostName host name of the local side of the connection. null is valid. @param _localPort port to be used by the local side of the connection @param _remoteHostName host name of the remote side of the connection @param _remotePort port to be used by the remote side of the connection @param _timeout timeout for waiting for the connection to complete @return a connect request context to be used by the channel connection """ return new TCPConnectRequestContextImpl(_localHostName, _localPort, _remoteHostName, _remotePort, _timeout); }
java
public TCPConnectRequestContext createTCPConnectRequestContext(String _localHostName, int _localPort, String _remoteHostName, int _remotePort, int _timeout) { return new TCPConnectRequestContextImpl(_localHostName, _localPort, _remoteHostName, _remotePort, _timeout); }
[ "public", "TCPConnectRequestContext", "createTCPConnectRequestContext", "(", "String", "_localHostName", ",", "int", "_localPort", ",", "String", "_remoteHostName", ",", "int", "_remotePort", ",", "int", "_timeout", ")", "{", "return", "new", "TCPConnectRequestContextImpl", "(", "_localHostName", ",", "_localPort", ",", "_remoteHostName", ",", "_remotePort", ",", "_timeout", ")", ";", "}" ]
Create a new connection request context based upon the input needed to fully define the context. @param _localHostName host name of the local side of the connection. null is valid. @param _localPort port to be used by the local side of the connection @param _remoteHostName host name of the remote side of the connection @param _remotePort port to be used by the remote side of the connection @param _timeout timeout for waiting for the connection to complete @return a connect request context to be used by the channel connection
[ "Create", "a", "new", "connection", "request", "context", "based", "upon", "the", "input", "needed", "to", "fully", "define", "the", "context", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/tcpchannel/TCPConnectRequestContextFactory.java#L40-L43
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java
ValueListMap.addValuesToKey
public void addValuesToKey(K key, Collection<V> valueCollection) { """ Add a collection of one or more values to the map under the existing key or creating a new key if it does not yet exist in the map. @param key the key to associate the values with @param valueCollection a collection of values to add to the key """ if (!valueCollection.isEmpty()) { // Create a new collection to store the values (will be changed to internal type by call // to putIfAbsent anyway) List<V> collectionToAppendValuesOn = new ArrayList<V>(); List<V> existing = this.putIfAbsent(key, collectionToAppendValuesOn); if (existing != null) { // Already had a collection, discard the new one and use existing collectionToAppendValuesOn = existing; } collectionToAppendValuesOn.addAll(valueCollection); } }
java
public void addValuesToKey(K key, Collection<V> valueCollection) { if (!valueCollection.isEmpty()) { // Create a new collection to store the values (will be changed to internal type by call // to putIfAbsent anyway) List<V> collectionToAppendValuesOn = new ArrayList<V>(); List<V> existing = this.putIfAbsent(key, collectionToAppendValuesOn); if (existing != null) { // Already had a collection, discard the new one and use existing collectionToAppendValuesOn = existing; } collectionToAppendValuesOn.addAll(valueCollection); } }
[ "public", "void", "addValuesToKey", "(", "K", "key", ",", "Collection", "<", "V", ">", "valueCollection", ")", "{", "if", "(", "!", "valueCollection", ".", "isEmpty", "(", ")", ")", "{", "// Create a new collection to store the values (will be changed to internal type by call", "// to putIfAbsent anyway)", "List", "<", "V", ">", "collectionToAppendValuesOn", "=", "new", "ArrayList", "<", "V", ">", "(", ")", ";", "List", "<", "V", ">", "existing", "=", "this", ".", "putIfAbsent", "(", "key", ",", "collectionToAppendValuesOn", ")", ";", "if", "(", "existing", "!=", "null", ")", "{", "// Already had a collection, discard the new one and use existing", "collectionToAppendValuesOn", "=", "existing", ";", "}", "collectionToAppendValuesOn", ".", "addAll", "(", "valueCollection", ")", ";", "}", "}" ]
Add a collection of one or more values to the map under the existing key or creating a new key if it does not yet exist in the map. @param key the key to associate the values with @param valueCollection a collection of values to add to the key
[ "Add", "a", "collection", "of", "one", "or", "more", "values", "to", "the", "map", "under", "the", "existing", "key", "or", "creating", "a", "new", "key", "if", "it", "does", "not", "yet", "exist", "in", "the", "map", "." ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java#L66-L78
alexvasilkov/GestureViews
library/src/main/java/com/alexvasilkov/gestures/State.java
State.updateFromMatrix
private void updateFromMatrix(boolean updateZoom, boolean updateRotation) { """ Applying state from current matrix. <p> Having matrix: <pre> | a b tx | A = | c d ty | | 0 0 1 | x = tx y = ty scale = sqrt(b^2+d^2) rotation = atan(c/d) = atan(-b/a) </pre> See <a href="http://stackoverflow.com/questions/4361242">here</a>. @param updateZoom Whether to extract zoom from matrix @param updateRotation Whether to extract rotation from matrix """ matrix.getValues(matrixValues); x = matrixValues[2]; y = matrixValues[5]; if (updateZoom) { zoom = (float) Math.hypot(matrixValues[1], matrixValues[4]); } if (updateRotation) { rotation = (float) Math.toDegrees(Math.atan2(matrixValues[3], matrixValues[4])); } }
java
private void updateFromMatrix(boolean updateZoom, boolean updateRotation) { matrix.getValues(matrixValues); x = matrixValues[2]; y = matrixValues[5]; if (updateZoom) { zoom = (float) Math.hypot(matrixValues[1], matrixValues[4]); } if (updateRotation) { rotation = (float) Math.toDegrees(Math.atan2(matrixValues[3], matrixValues[4])); } }
[ "private", "void", "updateFromMatrix", "(", "boolean", "updateZoom", ",", "boolean", "updateRotation", ")", "{", "matrix", ".", "getValues", "(", "matrixValues", ")", ";", "x", "=", "matrixValues", "[", "2", "]", ";", "y", "=", "matrixValues", "[", "5", "]", ";", "if", "(", "updateZoom", ")", "{", "zoom", "=", "(", "float", ")", "Math", ".", "hypot", "(", "matrixValues", "[", "1", "]", ",", "matrixValues", "[", "4", "]", ")", ";", "}", "if", "(", "updateRotation", ")", "{", "rotation", "=", "(", "float", ")", "Math", ".", "toDegrees", "(", "Math", ".", "atan2", "(", "matrixValues", "[", "3", "]", ",", "matrixValues", "[", "4", "]", ")", ")", ";", "}", "}" ]
Applying state from current matrix. <p> Having matrix: <pre> | a b tx | A = | c d ty | | 0 0 1 | x = tx y = ty scale = sqrt(b^2+d^2) rotation = atan(c/d) = atan(-b/a) </pre> See <a href="http://stackoverflow.com/questions/4361242">here</a>. @param updateZoom Whether to extract zoom from matrix @param updateRotation Whether to extract rotation from matrix
[ "Applying", "state", "from", "current", "matrix", ".", "<p", ">", "Having", "matrix", ":", "<pre", ">", "|", "a", "b", "tx", "|", "A", "=", "|", "c", "d", "ty", "|", "|", "0", "0", "1", "|" ]
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/State.java#L155-L165
amplexus/java-flac-encoder
src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java
EncodedElement.packIntByBits
protected static void packIntByBits(int[] inputA, int[] inputBits, int inputIndex, int inputCount, int destPos, byte[] dest) { """ Pack a number of bits from each int of an array(within given limits)to the end of this list. @param inputA Array containing input values. @param inputBits Array containing number of bits to use for each index packed. This array should be equal in size to the inputA array. @param inputIndex Index of first usable index. @param inputCount Number of indices to pack. @param destPos First usable bit-level index in destination array(byte index = startPosIn/8, bit within that byte = destPos) @param dest Destination array to store input values in. This array *must* be large enough to store all values or this method will fail in an undefined manner. """ int origInputIndex = inputIndex; inputIndex = packIntByBitsToByteBoundary(inputA, inputBits, inputIndex, inputCount, destPos, dest); if(destPos%8 > 0) destPos = (destPos/8+1)*8;//put dest where we know it should be if(inputIndex < 0)//done, no more to write. return; inputCount = inputCount - (inputIndex - origInputIndex); inputCount = EncodedElement.compressIntArrayByBits(inputA, inputBits, inputCount, inputIndex); assert(destPos%8 == 0);//sanity check. if(inputCount >1) { int stopIndex = inputCount-1; EncodedElement.mergeFullOnByte(inputA, stopIndex, dest, destPos/8); destPos += (stopIndex)*32; } if(inputCount >0) { int index = inputCount-1; EncodedElement.addInt_new(inputA[index], inputBits[index], destPos, dest); destPos+=inputBits[index]; } }
java
protected static void packIntByBits(int[] inputA, int[] inputBits, int inputIndex, int inputCount, int destPos, byte[] dest) { int origInputIndex = inputIndex; inputIndex = packIntByBitsToByteBoundary(inputA, inputBits, inputIndex, inputCount, destPos, dest); if(destPos%8 > 0) destPos = (destPos/8+1)*8;//put dest where we know it should be if(inputIndex < 0)//done, no more to write. return; inputCount = inputCount - (inputIndex - origInputIndex); inputCount = EncodedElement.compressIntArrayByBits(inputA, inputBits, inputCount, inputIndex); assert(destPos%8 == 0);//sanity check. if(inputCount >1) { int stopIndex = inputCount-1; EncodedElement.mergeFullOnByte(inputA, stopIndex, dest, destPos/8); destPos += (stopIndex)*32; } if(inputCount >0) { int index = inputCount-1; EncodedElement.addInt_new(inputA[index], inputBits[index], destPos, dest); destPos+=inputBits[index]; } }
[ "protected", "static", "void", "packIntByBits", "(", "int", "[", "]", "inputA", ",", "int", "[", "]", "inputBits", ",", "int", "inputIndex", ",", "int", "inputCount", ",", "int", "destPos", ",", "byte", "[", "]", "dest", ")", "{", "int", "origInputIndex", "=", "inputIndex", ";", "inputIndex", "=", "packIntByBitsToByteBoundary", "(", "inputA", ",", "inputBits", ",", "inputIndex", ",", "inputCount", ",", "destPos", ",", "dest", ")", ";", "if", "(", "destPos", "%", "8", ">", "0", ")", "destPos", "=", "(", "destPos", "/", "8", "+", "1", ")", "*", "8", ";", "//put dest where we know it should be", "if", "(", "inputIndex", "<", "0", ")", "//done, no more to write.", "return", ";", "inputCount", "=", "inputCount", "-", "(", "inputIndex", "-", "origInputIndex", ")", ";", "inputCount", "=", "EncodedElement", ".", "compressIntArrayByBits", "(", "inputA", ",", "inputBits", ",", "inputCount", ",", "inputIndex", ")", ";", "assert", "(", "destPos", "%", "8", "==", "0", ")", ";", "//sanity check.", "if", "(", "inputCount", ">", "1", ")", "{", "int", "stopIndex", "=", "inputCount", "-", "1", ";", "EncodedElement", ".", "mergeFullOnByte", "(", "inputA", ",", "stopIndex", ",", "dest", ",", "destPos", "/", "8", ")", ";", "destPos", "+=", "(", "stopIndex", ")", "*", "32", ";", "}", "if", "(", "inputCount", ">", "0", ")", "{", "int", "index", "=", "inputCount", "-", "1", ";", "EncodedElement", ".", "addInt_new", "(", "inputA", "[", "index", "]", ",", "inputBits", "[", "index", "]", ",", "destPos", ",", "dest", ")", ";", "destPos", "+=", "inputBits", "[", "index", "]", ";", "}", "}" ]
Pack a number of bits from each int of an array(within given limits)to the end of this list. @param inputA Array containing input values. @param inputBits Array containing number of bits to use for each index packed. This array should be equal in size to the inputA array. @param inputIndex Index of first usable index. @param inputCount Number of indices to pack. @param destPos First usable bit-level index in destination array(byte index = startPosIn/8, bit within that byte = destPos) @param dest Destination array to store input values in. This array *must* be large enough to store all values or this method will fail in an undefined manner.
[ "Pack", "a", "number", "of", "bits", "from", "each", "int", "of", "an", "array", "(", "within", "given", "limits", ")", "to", "the", "end", "of", "this", "list", "." ]
train
https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java#L881-L902
javagl/ND
nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/j/LongTupleNeighborhoodIterables.java
LongTupleNeighborhoodIterables.mooreNeighborhoodIterable
public static Iterable<MutableLongTuple> mooreNeighborhoodIterable( LongTuple center, int radius, Order order) { """ Creates an iterable that provides iterators for iterating over the Moore neighborhood of the given center and the given radius.<br> <br> Also see <a href="../../package-summary.html#Neighborhoods"> Neighborhoods</a> @param center The center of the Moore neighborhood A copy of this tuple will be stored internally. @param radius The radius of the Moore neighborhood @param order The iteration {@link Order} @return The iterable """ return mooreNeighborhoodIterable(center, radius, null, null, order); }
java
public static Iterable<MutableLongTuple> mooreNeighborhoodIterable( LongTuple center, int radius, Order order) { return mooreNeighborhoodIterable(center, radius, null, null, order); }
[ "public", "static", "Iterable", "<", "MutableLongTuple", ">", "mooreNeighborhoodIterable", "(", "LongTuple", "center", ",", "int", "radius", ",", "Order", "order", ")", "{", "return", "mooreNeighborhoodIterable", "(", "center", ",", "radius", ",", "null", ",", "null", ",", "order", ")", ";", "}" ]
Creates an iterable that provides iterators for iterating over the Moore neighborhood of the given center and the given radius.<br> <br> Also see <a href="../../package-summary.html#Neighborhoods"> Neighborhoods</a> @param center The center of the Moore neighborhood A copy of this tuple will be stored internally. @param radius The radius of the Moore neighborhood @param order The iteration {@link Order} @return The iterable
[ "Creates", "an", "iterable", "that", "provides", "iterators", "for", "iterating", "over", "the", "Moore", "neighborhood", "of", "the", "given", "center", "and", "the", "given", "radius", ".", "<br", ">", "<br", ">", "Also", "see", "<a", "href", "=", "..", "/", "..", "/", "package", "-", "summary", ".", "html#Neighborhoods", ">", "Neighborhoods<", "/", "a", ">" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/j/LongTupleNeighborhoodIterables.java#L60-L64
mojohaus/jaxb2-maven-plugin
src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java
DomHelper.addXmlDocumentAnnotationTo
public static void addXmlDocumentAnnotationTo(final Node aNode, final String formattedDocumentation) { """ <p>Adds the given formattedDocumentation within an XML documentation annotation under the supplied Node. Only adds the documentation annotation if the formattedDocumentation is non-null and non-empty. The documentation annotation is on the form:</p> <pre> <code> &lt;xs:annotation&gt; &lt;xs:documentation&gt;(JavaDoc here, within a CDATA section)&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; </code> </pre> @param aNode The non-null Node to which an XML documentation annotation should be added. @param formattedDocumentation The documentation text to add. """ if (aNode != null && formattedDocumentation != null && !formattedDocumentation.isEmpty()) { // Add the new Elements, as required. final Document doc = aNode.getOwnerDocument(); final Element annotation = doc.createElementNS( XMLConstants.W3C_XML_SCHEMA_NS_URI, ANNOTATION_ELEMENT_NAME); final Element docElement = doc.createElementNS( XMLConstants.W3C_XML_SCHEMA_NS_URI, DOCUMENTATION_ELEMENT_NAME); final CDATASection xsdDocumentation = doc.createCDATASection(formattedDocumentation); // Set the prefixes annotation.setPrefix(XSD_SCHEMA_NAMESPACE_PREFIX); docElement.setPrefix(XSD_SCHEMA_NAMESPACE_PREFIX); // Inject the formattedDocumentation into the CDATA section. annotation.appendChild(docElement); final Node firstChildOfCurrentNode = aNode.getFirstChild(); if (firstChildOfCurrentNode == null) { aNode.appendChild(annotation); } else { aNode.insertBefore(annotation, firstChildOfCurrentNode); } // All Done. docElement.appendChild(xsdDocumentation); } }
java
public static void addXmlDocumentAnnotationTo(final Node aNode, final String formattedDocumentation) { if (aNode != null && formattedDocumentation != null && !formattedDocumentation.isEmpty()) { // Add the new Elements, as required. final Document doc = aNode.getOwnerDocument(); final Element annotation = doc.createElementNS( XMLConstants.W3C_XML_SCHEMA_NS_URI, ANNOTATION_ELEMENT_NAME); final Element docElement = doc.createElementNS( XMLConstants.W3C_XML_SCHEMA_NS_URI, DOCUMENTATION_ELEMENT_NAME); final CDATASection xsdDocumentation = doc.createCDATASection(formattedDocumentation); // Set the prefixes annotation.setPrefix(XSD_SCHEMA_NAMESPACE_PREFIX); docElement.setPrefix(XSD_SCHEMA_NAMESPACE_PREFIX); // Inject the formattedDocumentation into the CDATA section. annotation.appendChild(docElement); final Node firstChildOfCurrentNode = aNode.getFirstChild(); if (firstChildOfCurrentNode == null) { aNode.appendChild(annotation); } else { aNode.insertBefore(annotation, firstChildOfCurrentNode); } // All Done. docElement.appendChild(xsdDocumentation); } }
[ "public", "static", "void", "addXmlDocumentAnnotationTo", "(", "final", "Node", "aNode", ",", "final", "String", "formattedDocumentation", ")", "{", "if", "(", "aNode", "!=", "null", "&&", "formattedDocumentation", "!=", "null", "&&", "!", "formattedDocumentation", ".", "isEmpty", "(", ")", ")", "{", "// Add the new Elements, as required.", "final", "Document", "doc", "=", "aNode", ".", "getOwnerDocument", "(", ")", ";", "final", "Element", "annotation", "=", "doc", ".", "createElementNS", "(", "XMLConstants", ".", "W3C_XML_SCHEMA_NS_URI", ",", "ANNOTATION_ELEMENT_NAME", ")", ";", "final", "Element", "docElement", "=", "doc", ".", "createElementNS", "(", "XMLConstants", ".", "W3C_XML_SCHEMA_NS_URI", ",", "DOCUMENTATION_ELEMENT_NAME", ")", ";", "final", "CDATASection", "xsdDocumentation", "=", "doc", ".", "createCDATASection", "(", "formattedDocumentation", ")", ";", "// Set the prefixes", "annotation", ".", "setPrefix", "(", "XSD_SCHEMA_NAMESPACE_PREFIX", ")", ";", "docElement", ".", "setPrefix", "(", "XSD_SCHEMA_NAMESPACE_PREFIX", ")", ";", "// Inject the formattedDocumentation into the CDATA section.", "annotation", ".", "appendChild", "(", "docElement", ")", ";", "final", "Node", "firstChildOfCurrentNode", "=", "aNode", ".", "getFirstChild", "(", ")", ";", "if", "(", "firstChildOfCurrentNode", "==", "null", ")", "{", "aNode", ".", "appendChild", "(", "annotation", ")", ";", "}", "else", "{", "aNode", ".", "insertBefore", "(", "annotation", ",", "firstChildOfCurrentNode", ")", ";", "}", "// All Done.", "docElement", ".", "appendChild", "(", "xsdDocumentation", ")", ";", "}", "}" ]
<p>Adds the given formattedDocumentation within an XML documentation annotation under the supplied Node. Only adds the documentation annotation if the formattedDocumentation is non-null and non-empty. The documentation annotation is on the form:</p> <pre> <code> &lt;xs:annotation&gt; &lt;xs:documentation&gt;(JavaDoc here, within a CDATA section)&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; </code> </pre> @param aNode The non-null Node to which an XML documentation annotation should be added. @param formattedDocumentation The documentation text to add.
[ "<p", ">", "Adds", "the", "given", "formattedDocumentation", "within", "an", "XML", "documentation", "annotation", "under", "the", "supplied", "Node", ".", "Only", "adds", "the", "documentation", "annotation", "if", "the", "formattedDocumentation", "is", "non", "-", "null", "and", "non", "-", "empty", ".", "The", "documentation", "annotation", "is", "on", "the", "form", ":", "<", "/", "p", ">", "<pre", ">", "<code", ">", "&lt", ";", "xs", ":", "annotation&gt", ";", "&lt", ";", "xs", ":", "documentation&gt", ";", "(", "JavaDoc", "here", "within", "a", "CDATA", "section", ")", "&lt", ";", "/", "xs", ":", "documentation&gt", ";", "&lt", ";", "/", "xs", ":", "annotation&gt", ";", "<", "/", "code", ">", "<", "/", "pre", ">" ]
train
https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java#L134-L162
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java
PaymentChannelServerState.storeChannelInWallet
public synchronized void storeChannelInWallet(@Nullable PaymentChannelServer connectedHandler) { """ Stores this channel's state in the wallet as a part of a {@link StoredPaymentChannelServerStates} wallet extension and keeps it up-to-date each time payment is incremented. This will be automatically removed when a call to {@link PaymentChannelV1ServerState#close()} completes successfully. A channel may only be stored after it has fully opened (ie state == State.READY). @param connectedHandler Optional {@link PaymentChannelServer} object that manages this object. This will set the appropriate pointer in the newly created {@link StoredServerChannel} before it is committed to wallet. If set, closing the state object will propagate the close to the handler which can then do a TCP disconnect. """ stateMachine.checkState(State.READY); if (storedServerChannel != null) return; log.info("Storing state with contract hash {}.", getContract().getTxId()); StoredPaymentChannelServerStates channels = (StoredPaymentChannelServerStates) wallet.addOrGetExistingExtension(new StoredPaymentChannelServerStates(wallet, broadcaster)); storedServerChannel = new StoredServerChannel(this, getMajorVersion(), getContract(), getClientOutput(), getExpiryTime(), serverKey, getClientKey(), bestValueToMe, bestValueSignature); if (connectedHandler != null) checkState(storedServerChannel.setConnectedHandler(connectedHandler, false) == connectedHandler); channels.putChannel(storedServerChannel); }
java
public synchronized void storeChannelInWallet(@Nullable PaymentChannelServer connectedHandler) { stateMachine.checkState(State.READY); if (storedServerChannel != null) return; log.info("Storing state with contract hash {}.", getContract().getTxId()); StoredPaymentChannelServerStates channels = (StoredPaymentChannelServerStates) wallet.addOrGetExistingExtension(new StoredPaymentChannelServerStates(wallet, broadcaster)); storedServerChannel = new StoredServerChannel(this, getMajorVersion(), getContract(), getClientOutput(), getExpiryTime(), serverKey, getClientKey(), bestValueToMe, bestValueSignature); if (connectedHandler != null) checkState(storedServerChannel.setConnectedHandler(connectedHandler, false) == connectedHandler); channels.putChannel(storedServerChannel); }
[ "public", "synchronized", "void", "storeChannelInWallet", "(", "@", "Nullable", "PaymentChannelServer", "connectedHandler", ")", "{", "stateMachine", ".", "checkState", "(", "State", ".", "READY", ")", ";", "if", "(", "storedServerChannel", "!=", "null", ")", "return", ";", "log", ".", "info", "(", "\"Storing state with contract hash {}.\"", ",", "getContract", "(", ")", ".", "getTxId", "(", ")", ")", ";", "StoredPaymentChannelServerStates", "channels", "=", "(", "StoredPaymentChannelServerStates", ")", "wallet", ".", "addOrGetExistingExtension", "(", "new", "StoredPaymentChannelServerStates", "(", "wallet", ",", "broadcaster", ")", ")", ";", "storedServerChannel", "=", "new", "StoredServerChannel", "(", "this", ",", "getMajorVersion", "(", ")", ",", "getContract", "(", ")", ",", "getClientOutput", "(", ")", ",", "getExpiryTime", "(", ")", ",", "serverKey", ",", "getClientKey", "(", ")", ",", "bestValueToMe", ",", "bestValueSignature", ")", ";", "if", "(", "connectedHandler", "!=", "null", ")", "checkState", "(", "storedServerChannel", ".", "setConnectedHandler", "(", "connectedHandler", ",", "false", ")", "==", "connectedHandler", ")", ";", "channels", ".", "putChannel", "(", "storedServerChannel", ")", ";", "}" ]
Stores this channel's state in the wallet as a part of a {@link StoredPaymentChannelServerStates} wallet extension and keeps it up-to-date each time payment is incremented. This will be automatically removed when a call to {@link PaymentChannelV1ServerState#close()} completes successfully. A channel may only be stored after it has fully opened (ie state == State.READY). @param connectedHandler Optional {@link PaymentChannelServer} object that manages this object. This will set the appropriate pointer in the newly created {@link StoredServerChannel} before it is committed to wallet. If set, closing the state object will propagate the close to the handler which can then do a TCP disconnect.
[ "Stores", "this", "channel", "s", "state", "in", "the", "wallet", "as", "a", "part", "of", "a", "{", "@link", "StoredPaymentChannelServerStates", "}", "wallet", "extension", "and", "keeps", "it", "up", "-", "to", "-", "date", "each", "time", "payment", "is", "incremented", ".", "This", "will", "be", "automatically", "removed", "when", "a", "call", "to", "{", "@link", "PaymentChannelV1ServerState#close", "()", "}", "completes", "successfully", ".", "A", "channel", "may", "only", "be", "stored", "after", "it", "has", "fully", "opened", "(", "ie", "state", "==", "State", ".", "READY", ")", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java#L366-L378
diegocarloslima/ByakuGallery
ByakuGallery/src/com/diegocarloslima/byakugallery/lib/TouchImageView.java
TouchImageView.computeTranslation
private static float computeTranslation(float viewSize, float drawableSize, float currentTranslation, float delta) { """ The translation values must be in [0, viewSize - drawableSize], except if we have free space. In that case we will translate to half of the free space """ final float sideFreeSpace = (viewSize - drawableSize) / 2F; if(sideFreeSpace > 0) { return sideFreeSpace - currentTranslation; } else if(currentTranslation + delta > 0) { return -currentTranslation; } else if(currentTranslation + delta < viewSize - drawableSize) { return viewSize - drawableSize - currentTranslation; } return delta; }
java
private static float computeTranslation(float viewSize, float drawableSize, float currentTranslation, float delta) { final float sideFreeSpace = (viewSize - drawableSize) / 2F; if(sideFreeSpace > 0) { return sideFreeSpace - currentTranslation; } else if(currentTranslation + delta > 0) { return -currentTranslation; } else if(currentTranslation + delta < viewSize - drawableSize) { return viewSize - drawableSize - currentTranslation; } return delta; }
[ "private", "static", "float", "computeTranslation", "(", "float", "viewSize", ",", "float", "drawableSize", ",", "float", "currentTranslation", ",", "float", "delta", ")", "{", "final", "float", "sideFreeSpace", "=", "(", "viewSize", "-", "drawableSize", ")", "/", "2F", ";", "if", "(", "sideFreeSpace", ">", "0", ")", "{", "return", "sideFreeSpace", "-", "currentTranslation", ";", "}", "else", "if", "(", "currentTranslation", "+", "delta", ">", "0", ")", "{", "return", "-", "currentTranslation", ";", "}", "else", "if", "(", "currentTranslation", "+", "delta", "<", "viewSize", "-", "drawableSize", ")", "{", "return", "viewSize", "-", "drawableSize", "-", "currentTranslation", ";", "}", "return", "delta", ";", "}" ]
The translation values must be in [0, viewSize - drawableSize], except if we have free space. In that case we will translate to half of the free space
[ "The", "translation", "values", "must", "be", "in", "[", "0", "viewSize", "-", "drawableSize", "]", "except", "if", "we", "have", "free", "space", ".", "In", "that", "case", "we", "will", "translate", "to", "half", "of", "the", "free", "space" ]
train
https://github.com/diegocarloslima/ByakuGallery/blob/a0472e8c9f79184b6b83351da06a5544e4dc1be4/ByakuGallery/src/com/diegocarloslima/byakugallery/lib/TouchImageView.java#L342-L354
ThreeTen/threetenbp
src/main/java/org/threeten/bp/chrono/HijrahDate.java
HijrahDate.getMonthDays
private static int getMonthDays(int month, int year) { """ Returns month days from the beginning of year. @param month month (0-based) @parma year year @return month days from the beginning of year """ Integer[] newMonths = getAdjustedMonthDays(year); return newMonths[month].intValue(); }
java
private static int getMonthDays(int month, int year) { Integer[] newMonths = getAdjustedMonthDays(year); return newMonths[month].intValue(); }
[ "private", "static", "int", "getMonthDays", "(", "int", "month", ",", "int", "year", ")", "{", "Integer", "[", "]", "newMonths", "=", "getAdjustedMonthDays", "(", "year", ")", ";", "return", "newMonths", "[", "month", "]", ".", "intValue", "(", ")", ";", "}" ]
Returns month days from the beginning of year. @param month month (0-based) @parma year year @return month days from the beginning of year
[ "Returns", "month", "days", "from", "the", "beginning", "of", "year", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/HijrahDate.java#L1124-L1127
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/UserProperties.java
UserProperties.setProperty
public void setProperty(String strName, String strData) { """ Set this property. @param strProperty The property key. @param strValue The property value. """ Record recUserRegistration = this.getUserRegistration(); ((PropertiesField)recUserRegistration.getField(UserRegistrationModel.PROPERTIES)).setProperty(strName, strData); }
java
public void setProperty(String strName, String strData) { Record recUserRegistration = this.getUserRegistration(); ((PropertiesField)recUserRegistration.getField(UserRegistrationModel.PROPERTIES)).setProperty(strName, strData); }
[ "public", "void", "setProperty", "(", "String", "strName", ",", "String", "strData", ")", "{", "Record", "recUserRegistration", "=", "this", ".", "getUserRegistration", "(", ")", ";", "(", "(", "PropertiesField", ")", "recUserRegistration", ".", "getField", "(", "UserRegistrationModel", ".", "PROPERTIES", ")", ")", ".", "setProperty", "(", "strName", ",", "strData", ")", ";", "}" ]
Set this property. @param strProperty The property key. @param strValue The property value.
[ "Set", "this", "property", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/UserProperties.java#L188-L192
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandManager.java
DefaultCommandManager.createCommandGroup
@Override public CommandGroup createCommandGroup(List<? extends Object> members) { """ Create a command group which holds all the given members. @param members members to add to the group. @return a {@link CommandGroup} which contains all the members. """ return createCommandGroup(null, members.toArray(), false, null); }
java
@Override public CommandGroup createCommandGroup(List<? extends Object> members) { return createCommandGroup(null, members.toArray(), false, null); }
[ "@", "Override", "public", "CommandGroup", "createCommandGroup", "(", "List", "<", "?", "extends", "Object", ">", "members", ")", "{", "return", "createCommandGroup", "(", "null", ",", "members", ".", "toArray", "(", ")", ",", "false", ",", "null", ")", ";", "}" ]
Create a command group which holds all the given members. @param members members to add to the group. @return a {@link CommandGroup} which contains all the members.
[ "Create", "a", "command", "group", "which", "holds", "all", "the", "given", "members", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandManager.java#L280-L283
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MatchAllWeight.java
MatchAllWeight.createScorer
@Override protected Scorer createScorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException { """ Creates a {@link MatchAllScorer} instance. @param reader index reader @return a {@link MatchAllScorer} instance """ return new MatchAllScorer(reader, field); }
java
@Override protected Scorer createScorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException { return new MatchAllScorer(reader, field); }
[ "@", "Override", "protected", "Scorer", "createScorer", "(", "IndexReader", "reader", ",", "boolean", "scoreDocsInOrder", ",", "boolean", "topScorer", ")", "throws", "IOException", "{", "return", "new", "MatchAllScorer", "(", "reader", ",", "field", ")", ";", "}" ]
Creates a {@link MatchAllScorer} instance. @param reader index reader @return a {@link MatchAllScorer} instance
[ "Creates", "a", "{", "@link", "MatchAllScorer", "}", "instance", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MatchAllWeight.java#L80-L83
OpenLiberty/open-liberty
dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java
SelfExtractor.getCommonRootDir
private String getCommonRootDir(String filePath, HashMap validFilePaths) { """ Retrieves the directory in common between the specified path and the archive root directory. If the file path cannot be found among the valid paths then null is returned. @param filePath Path to the file to check @param validFilePaths A list of valid file paths and their common directories with the root @return The directory in common between the specified path and the root directory """ for (Iterator it = validFilePaths.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); String path = (String) ((entry).getKey()); if (filePath.startsWith(path)) return (String) entry.getValue(); } return null; }
java
private String getCommonRootDir(String filePath, HashMap validFilePaths) { for (Iterator it = validFilePaths.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); String path = (String) ((entry).getKey()); if (filePath.startsWith(path)) return (String) entry.getValue(); } return null; }
[ "private", "String", "getCommonRootDir", "(", "String", "filePath", ",", "HashMap", "validFilePaths", ")", "{", "for", "(", "Iterator", "it", "=", "validFilePaths", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "it", ".", "next", "(", ")", ";", "String", "path", "=", "(", "String", ")", "(", "(", "entry", ")", ".", "getKey", "(", ")", ")", ";", "if", "(", "filePath", ".", "startsWith", "(", "path", ")", ")", "return", "(", "String", ")", "entry", ".", "getValue", "(", ")", ";", "}", "return", "null", ";", "}" ]
Retrieves the directory in common between the specified path and the archive root directory. If the file path cannot be found among the valid paths then null is returned. @param filePath Path to the file to check @param validFilePaths A list of valid file paths and their common directories with the root @return The directory in common between the specified path and the root directory
[ "Retrieves", "the", "directory", "in", "common", "between", "the", "specified", "path", "and", "the", "archive", "root", "directory", ".", "If", "the", "file", "path", "cannot", "be", "found", "among", "the", "valid", "paths", "then", "null", "is", "returned", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L982-L991
Impetus/Kundera
src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/GraphEntityMapper.java
GraphEntityMapper.getMatchingNodeFromIndexHits
protected Node getMatchingNodeFromIndexHits(IndexHits<Node> nodesFound, boolean skipProxy) { """ Fetches first Non-proxy node from Index Hits @param skipProxy @param nodesFound @return """ Node node = null; try { if (nodesFound == null || nodesFound.size() == 0 || !nodesFound.hasNext()) { return null; } else { if (skipProxy) node = getNonProxyNode(nodesFound); else node = nodesFound.next(); } } finally { nodesFound.close(); } return node; }
java
protected Node getMatchingNodeFromIndexHits(IndexHits<Node> nodesFound, boolean skipProxy) { Node node = null; try { if (nodesFound == null || nodesFound.size() == 0 || !nodesFound.hasNext()) { return null; } else { if (skipProxy) node = getNonProxyNode(nodesFound); else node = nodesFound.next(); } } finally { nodesFound.close(); } return node; }
[ "protected", "Node", "getMatchingNodeFromIndexHits", "(", "IndexHits", "<", "Node", ">", "nodesFound", ",", "boolean", "skipProxy", ")", "{", "Node", "node", "=", "null", ";", "try", "{", "if", "(", "nodesFound", "==", "null", "||", "nodesFound", ".", "size", "(", ")", "==", "0", "||", "!", "nodesFound", ".", "hasNext", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", "if", "(", "skipProxy", ")", "node", "=", "getNonProxyNode", "(", "nodesFound", ")", ";", "else", "node", "=", "nodesFound", ".", "next", "(", ")", ";", "}", "}", "finally", "{", "nodesFound", ".", "close", "(", ")", ";", "}", "return", "node", ";", "}" ]
Fetches first Non-proxy node from Index Hits @param skipProxy @param nodesFound @return
[ "Fetches", "first", "Non", "-", "proxy", "node", "from", "Index", "Hits" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/GraphEntityMapper.java#L695-L717
hal/core
gui/src/main/java/org/jboss/as/console/client/shared/subsys/jca/ResourceAdapterPresenter.java
ResourceAdapterPresenter.onCreateProperty
public void onCreateProperty(AddressTemplate address, ModelNode entity, String... names) { """ /*public void onCreate(AddressTemplate address, String name, ModelNode entity) { ResourceAddress fqAddress = address.resolve(statementContext, name); entity.get(OP).set(ADD); entity.get(ADDRESS).set(fqAddress); dispatcher.execute(new DMRAction(entity), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error("Failed to create resource " + fqAddress, response.getFailureDescription()); } else { Console.info("Successfully created " + fqAddress); } loadAdapter(); } }); } """ List<String> args = new LinkedList<>(); args.add(0, selectedAdapter); for (String name : names) { args.add(name); } ResourceAddress fqAddress = address.resolve(statementContext, args); entity.get(OP).set(ADD); entity.get(ADDRESS).set(fqAddress); dispatcher.execute(new DMRAction(entity), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error(Console.MESSAGES.failedToCreateResource(fqAddress.toString()), response.getFailureDescription()); } else { Console.info(Console.MESSAGES.successfullyAdded(fqAddress.toString())); } loadAdapter(); } }); }
java
public void onCreateProperty(AddressTemplate address, ModelNode entity, String... names) { List<String> args = new LinkedList<>(); args.add(0, selectedAdapter); for (String name : names) { args.add(name); } ResourceAddress fqAddress = address.resolve(statementContext, args); entity.get(OP).set(ADD); entity.get(ADDRESS).set(fqAddress); dispatcher.execute(new DMRAction(entity), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error(Console.MESSAGES.failedToCreateResource(fqAddress.toString()), response.getFailureDescription()); } else { Console.info(Console.MESSAGES.successfullyAdded(fqAddress.toString())); } loadAdapter(); } }); }
[ "public", "void", "onCreateProperty", "(", "AddressTemplate", "address", ",", "ModelNode", "entity", ",", "String", "...", "names", ")", "{", "List", "<", "String", ">", "args", "=", "new", "LinkedList", "<>", "(", ")", ";", "args", ".", "add", "(", "0", ",", "selectedAdapter", ")", ";", "for", "(", "String", "name", ":", "names", ")", "{", "args", ".", "add", "(", "name", ")", ";", "}", "ResourceAddress", "fqAddress", "=", "address", ".", "resolve", "(", "statementContext", ",", "args", ")", ";", "entity", ".", "get", "(", "OP", ")", ".", "set", "(", "ADD", ")", ";", "entity", ".", "get", "(", "ADDRESS", ")", ".", "set", "(", "fqAddress", ")", ";", "dispatcher", ".", "execute", "(", "new", "DMRAction", "(", "entity", ")", ",", "new", "SimpleCallback", "<", "DMRResponse", ">", "(", ")", "{", "@", "Override", "public", "void", "onSuccess", "(", "DMRResponse", "result", ")", "{", "ModelNode", "response", "=", "result", ".", "get", "(", ")", ";", "if", "(", "response", ".", "isFailure", "(", ")", ")", "{", "Console", ".", "error", "(", "Console", ".", "MESSAGES", ".", "failedToCreateResource", "(", "fqAddress", ".", "toString", "(", ")", ")", ",", "response", ".", "getFailureDescription", "(", ")", ")", ";", "}", "else", "{", "Console", ".", "info", "(", "Console", ".", "MESSAGES", ".", "successfullyAdded", "(", "fqAddress", ".", "toString", "(", ")", ")", ")", ";", "}", "loadAdapter", "(", ")", ";", "}", "}", ")", ";", "}" ]
/*public void onCreate(AddressTemplate address, String name, ModelNode entity) { ResourceAddress fqAddress = address.resolve(statementContext, name); entity.get(OP).set(ADD); entity.get(ADDRESS).set(fqAddress); dispatcher.execute(new DMRAction(entity), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error("Failed to create resource " + fqAddress, response.getFailureDescription()); } else { Console.info("Successfully created " + fqAddress); } loadAdapter(); } }); }
[ "/", "*", "public", "void", "onCreate", "(", "AddressTemplate", "address", "String", "name", "ModelNode", "entity", ")", "{" ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/shared/subsys/jca/ResourceAdapterPresenter.java#L175-L203
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/Types.java
Types.isAssignableToOrFrom
public static boolean isAssignableToOrFrom(Class<?> classToCheck, Class<?> anotherClass) { """ Returns whether a class is either assignable to or from another class. @param classToCheck class to check @param anotherClass another class """ return classToCheck.isAssignableFrom(anotherClass) || anotherClass.isAssignableFrom(classToCheck); }
java
public static boolean isAssignableToOrFrom(Class<?> classToCheck, Class<?> anotherClass) { return classToCheck.isAssignableFrom(anotherClass) || anotherClass.isAssignableFrom(classToCheck); }
[ "public", "static", "boolean", "isAssignableToOrFrom", "(", "Class", "<", "?", ">", "classToCheck", ",", "Class", "<", "?", ">", "anotherClass", ")", "{", "return", "classToCheck", ".", "isAssignableFrom", "(", "anotherClass", ")", "||", "anotherClass", ".", "isAssignableFrom", "(", "classToCheck", ")", ";", "}" ]
Returns whether a class is either assignable to or from another class. @param classToCheck class to check @param anotherClass another class
[ "Returns", "whether", "a", "class", "is", "either", "assignable", "to", "or", "from", "another", "class", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/Types.java#L97-L100
james-hu/jabb-core
src/main/java/net/sf/jabb/util/text/word/TextAnalyzer.java
TextAnalyzer.createInstance
static public TextAnalyzer createInstance(int type, String dictionaryPath, Map<String, ? extends Object> keywordDefinitions, Map<Integer, ? extends Object> lengthDefinitions) { """ Create an instance of TextAnalyzer.<br> 创建一个文本分析器实例。 @param type {@link #TYPE_MMSEG_SIMPLE} | {@link #TYPE_MMSEG_COMPLEX} | {@link #TYPE_MMSEG_MAXWORD} | {@link #TYPE_FAST} @param dictionaryPath 字典文件路径,如果为null,则表示使用缺省位置的字典文件 @param keywordDefinitions 关键词字的定义 @param lengthDefinitions 文本长度类别定义 @return A new instance of TextAnalyzer.<br>TextAnalyzer的一个实例。 """ switch(type){ case TYPE_MMSEG_COMPLEX: case TYPE_MMSEG_MAXWORD: case TYPE_MMSEG_SIMPLE: return new MmsegTextAnalyzer(type, dictionaryPath, keywordDefinitions, lengthDefinitions); case TYPE_FAST: return new FastTextAnalyzer(dictionaryPath, keywordDefinitions, lengthDefinitions); default: throw new IllegalArgumentException("Not supported TextAnalyzer type: " + type); } }
java
static public TextAnalyzer createInstance(int type, String dictionaryPath, Map<String, ? extends Object> keywordDefinitions, Map<Integer, ? extends Object> lengthDefinitions){ switch(type){ case TYPE_MMSEG_COMPLEX: case TYPE_MMSEG_MAXWORD: case TYPE_MMSEG_SIMPLE: return new MmsegTextAnalyzer(type, dictionaryPath, keywordDefinitions, lengthDefinitions); case TYPE_FAST: return new FastTextAnalyzer(dictionaryPath, keywordDefinitions, lengthDefinitions); default: throw new IllegalArgumentException("Not supported TextAnalyzer type: " + type); } }
[ "static", "public", "TextAnalyzer", "createInstance", "(", "int", "type", ",", "String", "dictionaryPath", ",", "Map", "<", "String", ",", "?", "extends", "Object", ">", "keywordDefinitions", ",", "Map", "<", "Integer", ",", "?", "extends", "Object", ">", "lengthDefinitions", ")", "{", "switch", "(", "type", ")", "{", "case", "TYPE_MMSEG_COMPLEX", ":", "case", "TYPE_MMSEG_MAXWORD", ":", "case", "TYPE_MMSEG_SIMPLE", ":", "return", "new", "MmsegTextAnalyzer", "(", "type", ",", "dictionaryPath", ",", "keywordDefinitions", ",", "lengthDefinitions", ")", ";", "case", "TYPE_FAST", ":", "return", "new", "FastTextAnalyzer", "(", "dictionaryPath", ",", "keywordDefinitions", ",", "lengthDefinitions", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Not supported TextAnalyzer type: \"", "+", "type", ")", ";", "}", "}" ]
Create an instance of TextAnalyzer.<br> 创建一个文本分析器实例。 @param type {@link #TYPE_MMSEG_SIMPLE} | {@link #TYPE_MMSEG_COMPLEX} | {@link #TYPE_MMSEG_MAXWORD} | {@link #TYPE_FAST} @param dictionaryPath 字典文件路径,如果为null,则表示使用缺省位置的字典文件 @param keywordDefinitions 关键词字的定义 @param lengthDefinitions 文本长度类别定义 @return A new instance of TextAnalyzer.<br>TextAnalyzer的一个实例。
[ "Create", "an", "instance", "of", "TextAnalyzer", ".", "<br", ">", "创建一个文本分析器实例。" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/text/word/TextAnalyzer.java#L61-L75
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/XmlWriter.java
XmlWriter.appendEscapedString
private void appendEscapedString(String s, StringBuilder builder) { """ Appends the specified string (with any non-XML-compatible characters replaced with the corresponding escape code) to the specified StringBuilder. @param s The string to escape and append to the specified StringBuilder. @param builder The StringBuilder to which the escaped string should be appened. """ if (s == null) s = ""; int pos; int start = 0; int len = s.length(); for (pos = 0; pos < len; pos++) { char ch = s.charAt(pos); String escape; switch (ch) { case '\t': escape = "&#9;"; break; case '\n': escape = "&#10;"; break; case '\r': escape = "&#13;"; break; case '&': escape = "&amp;"; break; case '"': escape = "&quot;"; break; case '<': escape = "&lt;"; break; case '>': escape = "&gt;"; break; default: escape = null; break; } // If we found an escape character, write all the characters up to that // character, then write the escaped char and get back to scanning if (escape != null) { if (start < pos) builder.append(s, start, pos); sb.append(escape); start = pos + 1; } } // Write anything that's left if (start < pos) sb.append(s, start, pos); }
java
private void appendEscapedString(String s, StringBuilder builder) { if (s == null) s = ""; int pos; int start = 0; int len = s.length(); for (pos = 0; pos < len; pos++) { char ch = s.charAt(pos); String escape; switch (ch) { case '\t': escape = "&#9;"; break; case '\n': escape = "&#10;"; break; case '\r': escape = "&#13;"; break; case '&': escape = "&amp;"; break; case '"': escape = "&quot;"; break; case '<': escape = "&lt;"; break; case '>': escape = "&gt;"; break; default: escape = null; break; } // If we found an escape character, write all the characters up to that // character, then write the escaped char and get back to scanning if (escape != null) { if (start < pos) builder.append(s, start, pos); sb.append(escape); start = pos + 1; } } // Write anything that's left if (start < pos) sb.append(s, start, pos); }
[ "private", "void", "appendEscapedString", "(", "String", "s", ",", "StringBuilder", "builder", ")", "{", "if", "(", "s", "==", "null", ")", "s", "=", "\"\"", ";", "int", "pos", ";", "int", "start", "=", "0", ";", "int", "len", "=", "s", ".", "length", "(", ")", ";", "for", "(", "pos", "=", "0", ";", "pos", "<", "len", ";", "pos", "++", ")", "{", "char", "ch", "=", "s", ".", "charAt", "(", "pos", ")", ";", "String", "escape", ";", "switch", "(", "ch", ")", "{", "case", "'", "'", ":", "escape", "=", "\"&#9;\"", ";", "break", ";", "case", "'", "'", ":", "escape", "=", "\"&#10;\"", ";", "break", ";", "case", "'", "'", ":", "escape", "=", "\"&#13;\"", ";", "break", ";", "case", "'", "'", ":", "escape", "=", "\"&amp;\"", ";", "break", ";", "case", "'", "'", ":", "escape", "=", "\"&quot;\"", ";", "break", ";", "case", "'", "'", ":", "escape", "=", "\"&lt;\"", ";", "break", ";", "case", "'", "'", ":", "escape", "=", "\"&gt;\"", ";", "break", ";", "default", ":", "escape", "=", "null", ";", "break", ";", "}", "// If we found an escape character, write all the characters up to that", "// character, then write the escaped char and get back to scanning", "if", "(", "escape", "!=", "null", ")", "{", "if", "(", "start", "<", "pos", ")", "builder", ".", "append", "(", "s", ",", "start", ",", "pos", ")", ";", "sb", ".", "append", "(", "escape", ")", ";", "start", "=", "pos", "+", "1", ";", "}", "}", "// Write anything that's left", "if", "(", "start", "<", "pos", ")", "sb", ".", "append", "(", "s", ",", "start", ",", "pos", ")", ";", "}" ]
Appends the specified string (with any non-XML-compatible characters replaced with the corresponding escape code) to the specified StringBuilder. @param s The string to escape and append to the specified StringBuilder. @param builder The StringBuilder to which the escaped string should be appened.
[ "Appends", "the", "specified", "string", "(", "with", "any", "non", "-", "XML", "-", "compatible", "characters", "replaced", "with", "the", "corresponding", "escape", "code", ")", "to", "the", "specified", "StringBuilder", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/XmlWriter.java#L105-L153
DataArt/CalculationEngine
calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/ConverterUtils.java
ConverterUtils.copyCell
static void copyCell(ICellAddress address, Sheet from, IDataModel to) { """ Does cell of a given address copy from {@link Sheet} to {@link IDataModel}. """ if (from == null) { return; } Row fromRow = from.getRow(address.a1Address().row()); if (fromRow == null) { return; } Cell fromCell = fromRow.getCell(address.a1Address().column()); if (fromCell == null) { return; } DmCell toCell = new DmCell(); toCell.setAddress(address); toCell.setContent(resolveCellValue(fromCell)); to.setCell(address, toCell); }
java
static void copyCell(ICellAddress address, Sheet from, IDataModel to) { if (from == null) { return; } Row fromRow = from.getRow(address.a1Address().row()); if (fromRow == null) { return; } Cell fromCell = fromRow.getCell(address.a1Address().column()); if (fromCell == null) { return; } DmCell toCell = new DmCell(); toCell.setAddress(address); toCell.setContent(resolveCellValue(fromCell)); to.setCell(address, toCell); }
[ "static", "void", "copyCell", "(", "ICellAddress", "address", ",", "Sheet", "from", ",", "IDataModel", "to", ")", "{", "if", "(", "from", "==", "null", ")", "{", "return", ";", "}", "Row", "fromRow", "=", "from", ".", "getRow", "(", "address", ".", "a1Address", "(", ")", ".", "row", "(", ")", ")", ";", "if", "(", "fromRow", "==", "null", ")", "{", "return", ";", "}", "Cell", "fromCell", "=", "fromRow", ".", "getCell", "(", "address", ".", "a1Address", "(", ")", ".", "column", "(", ")", ")", ";", "if", "(", "fromCell", "==", "null", ")", "{", "return", ";", "}", "DmCell", "toCell", "=", "new", "DmCell", "(", ")", ";", "toCell", ".", "setAddress", "(", "address", ")", ";", "toCell", ".", "setContent", "(", "resolveCellValue", "(", "fromCell", ")", ")", ";", "to", ".", "setCell", "(", "address", ",", "toCell", ")", ";", "}" ]
Does cell of a given address copy from {@link Sheet} to {@link IDataModel}.
[ "Does", "cell", "of", "a", "given", "address", "copy", "from", "{" ]
train
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/ConverterUtils.java#L150-L162
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java
ReadMasterDomainModelUtil.populateHostResolutionContext
public static RequiredConfigurationHolder populateHostResolutionContext(final HostInfo hostInfo, final Resource root, final ExtensionRegistry extensionRegistry) { """ Process the host info and determine which configuration elements are required on the slave host. @param hostInfo the host info @param root the model root @param extensionRegistry the extension registry @return """ final RequiredConfigurationHolder rc = new RequiredConfigurationHolder(); for (IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo info : hostInfo.getServerConfigInfos()) { processServerConfig(root, rc, info, extensionRegistry); } return rc; }
java
public static RequiredConfigurationHolder populateHostResolutionContext(final HostInfo hostInfo, final Resource root, final ExtensionRegistry extensionRegistry) { final RequiredConfigurationHolder rc = new RequiredConfigurationHolder(); for (IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo info : hostInfo.getServerConfigInfos()) { processServerConfig(root, rc, info, extensionRegistry); } return rc; }
[ "public", "static", "RequiredConfigurationHolder", "populateHostResolutionContext", "(", "final", "HostInfo", "hostInfo", ",", "final", "Resource", "root", ",", "final", "ExtensionRegistry", "extensionRegistry", ")", "{", "final", "RequiredConfigurationHolder", "rc", "=", "new", "RequiredConfigurationHolder", "(", ")", ";", "for", "(", "IgnoredNonAffectedServerGroupsUtil", ".", "ServerConfigInfo", "info", ":", "hostInfo", ".", "getServerConfigInfos", "(", ")", ")", "{", "processServerConfig", "(", "root", ",", "rc", ",", "info", ",", "extensionRegistry", ")", ";", "}", "return", "rc", ";", "}" ]
Process the host info and determine which configuration elements are required on the slave host. @param hostInfo the host info @param root the model root @param extensionRegistry the extension registry @return
[ "Process", "the", "host", "info", "and", "determine", "which", "configuration", "elements", "are", "required", "on", "the", "slave", "host", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java#L224-L230
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/EditService.java
EditService.disableAll
public void disableAll(int profileId, String client_uuid) { """ Delete all enabled overrides for a client @param profileId profile ID of teh client @param client_uuid UUID of teh client """ PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants.CLIENT_PROFILE_ID + " = ?" + " AND " + Constants.CLIENT_CLIENT_UUID + " =? " ); statement.setInt(1, profileId); statement.setString(2, client_uuid); statement.executeUpdate(); statement.close(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void disableAll(int profileId, String client_uuid) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants.CLIENT_PROFILE_ID + " = ?" + " AND " + Constants.CLIENT_CLIENT_UUID + " =? " ); statement.setInt(1, profileId); statement.setString(2, client_uuid); statement.executeUpdate(); statement.close(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "disableAll", "(", "int", "profileId", ",", "String", "client_uuid", ")", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "sqlService", ".", "getConnection", "(", ")", ")", "{", "statement", "=", "sqlConnection", ".", "prepareStatement", "(", "\"DELETE FROM \"", "+", "Constants", ".", "DB_TABLE_ENABLED_OVERRIDE", "+", "\" WHERE \"", "+", "Constants", ".", "CLIENT_PROFILE_ID", "+", "\" = ?\"", "+", "\" AND \"", "+", "Constants", ".", "CLIENT_CLIENT_UUID", "+", "\" =? \"", ")", ";", "statement", ".", "setInt", "(", "1", ",", "profileId", ")", ";", "statement", ".", "setString", "(", "2", ",", "client_uuid", ")", ";", "statement", ".", "executeUpdate", "(", ")", ";", "statement", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "statement", "!=", "null", ")", "{", "statement", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}" ]
Delete all enabled overrides for a client @param profileId profile ID of teh client @param client_uuid UUID of teh client
[ "Delete", "all", "enabled", "overrides", "for", "a", "client" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/EditService.java#L120-L142
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/AccountsInner.java
AccountsInner.listWithServiceResponseAsync
public Observable<ServiceResponse<Page<DataLakeStoreAccountBasicInner>>> listWithServiceResponseAsync(final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) { """ Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. @param filter OData filter. Optional. @param top The number of items to return. Optional. @param skip The number of items to skip over before returning elements. Optional. @param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. @param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. @param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DataLakeStoreAccountBasicInner&gt; object """ return listSinglePageAsync(filter, top, skip, select, orderby, count) .concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountBasicInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountBasicInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeStoreAccountBasicInner>>> call(ServiceResponse<Page<DataLakeStoreAccountBasicInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<DataLakeStoreAccountBasicInner>>> listWithServiceResponseAsync(final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) { return listSinglePageAsync(filter, top, skip, select, orderby, count) .concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountBasicInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountBasicInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeStoreAccountBasicInner>>> call(ServiceResponse<Page<DataLakeStoreAccountBasicInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DataLakeStoreAccountBasicInner", ">", ">", ">", "listWithServiceResponseAsync", "(", "final", "String", "filter", ",", "final", "Integer", "top", ",", "final", "Integer", "skip", ",", "final", "String", "select", ",", "final", "String", "orderby", ",", "final", "Boolean", "count", ")", "{", "return", "listSinglePageAsync", "(", "filter", ",", "top", ",", "skip", ",", "select", ",", "orderby", ",", "count", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "DataLakeStoreAccountBasicInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DataLakeStoreAccountBasicInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DataLakeStoreAccountBasicInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "DataLakeStoreAccountBasicInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. @param filter OData filter. Optional. @param top The number of items to return. Optional. @param skip The number of items to skip over before returning elements. Optional. @param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. @param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. @param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DataLakeStoreAccountBasicInner&gt; object
[ "Lists", "the", "Data", "Lake", "Store", "accounts", "within", "the", "subscription", ".", "The", "response", "includes", "a", "link", "to", "the", "next", "page", "of", "results", "if", "any", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/AccountsInner.java#L315-L327
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java
VisualizeCamera2Activity.processImageOuter
private void processImageOuter( ImageBase image ) { """ Internal function which manages images and invokes {@link #processImage}. """ long startTime = System.currentTimeMillis(); // this image is owned by only this process and no other. So no need to lock it while // processing processImage(image); // If an old image finished being processes after a more recent one it won't be visualized if( !visualizeOnlyMostRecent || startTime > timeOfLastUpdated ) { timeOfLastUpdated = startTime; // Copy this frame renderBitmapImage(bitmapMode,image); // Update the visualization runOnUiThread(() -> displayView.invalidate()); } // Put the image into the stack if the image type has not changed synchronized (boofImage.imageLock) { if( boofImage.imageType.isSameType(image.getImageType())) boofImage.stackImages.add(image); } }
java
private void processImageOuter( ImageBase image ) { long startTime = System.currentTimeMillis(); // this image is owned by only this process and no other. So no need to lock it while // processing processImage(image); // If an old image finished being processes after a more recent one it won't be visualized if( !visualizeOnlyMostRecent || startTime > timeOfLastUpdated ) { timeOfLastUpdated = startTime; // Copy this frame renderBitmapImage(bitmapMode,image); // Update the visualization runOnUiThread(() -> displayView.invalidate()); } // Put the image into the stack if the image type has not changed synchronized (boofImage.imageLock) { if( boofImage.imageType.isSameType(image.getImageType())) boofImage.stackImages.add(image); } }
[ "private", "void", "processImageOuter", "(", "ImageBase", "image", ")", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "// this image is owned by only this process and no other. So no need to lock it while", "// processing", "processImage", "(", "image", ")", ";", "// If an old image finished being processes after a more recent one it won't be visualized", "if", "(", "!", "visualizeOnlyMostRecent", "||", "startTime", ">", "timeOfLastUpdated", ")", "{", "timeOfLastUpdated", "=", "startTime", ";", "// Copy this frame", "renderBitmapImage", "(", "bitmapMode", ",", "image", ")", ";", "// Update the visualization", "runOnUiThread", "(", "(", ")", "->", "displayView", ".", "invalidate", "(", ")", ")", ";", "}", "// Put the image into the stack if the image type has not changed", "synchronized", "(", "boofImage", ".", "imageLock", ")", "{", "if", "(", "boofImage", ".", "imageType", ".", "isSameType", "(", "image", ".", "getImageType", "(", ")", ")", ")", "boofImage", ".", "stackImages", ".", "add", "(", "image", ")", ";", "}", "}" ]
Internal function which manages images and invokes {@link #processImage}.
[ "Internal", "function", "which", "manages", "images", "and", "invokes", "{" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java#L391-L414
grails/grails-core
grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java
GrailsASTUtils.addAnnotationOrGetExisting
public static AnnotationNode addAnnotationOrGetExisting(ClassNode classNode, Class<? extends Annotation> annotationClass) { """ Adds an annotation to the given class node or returns the existing annotation @param classNode The class node @param annotationClass The annotation class """ return addAnnotationOrGetExisting(classNode, annotationClass, Collections.<String, Object>emptyMap()); }
java
public static AnnotationNode addAnnotationOrGetExisting(ClassNode classNode, Class<? extends Annotation> annotationClass) { return addAnnotationOrGetExisting(classNode, annotationClass, Collections.<String, Object>emptyMap()); }
[ "public", "static", "AnnotationNode", "addAnnotationOrGetExisting", "(", "ClassNode", "classNode", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ")", "{", "return", "addAnnotationOrGetExisting", "(", "classNode", ",", "annotationClass", ",", "Collections", ".", "<", "String", ",", "Object", ">", "emptyMap", "(", ")", ")", ";", "}" ]
Adds an annotation to the given class node or returns the existing annotation @param classNode The class node @param annotationClass The annotation class
[ "Adds", "an", "annotation", "to", "the", "given", "class", "node", "or", "returns", "the", "existing", "annotation" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L826-L828
threerings/nenya
core/src/main/java/com/threerings/util/DirectionUtil.java
DirectionUtil.getFineDirection
public static int getFineDirection (Point a, Point b) { """ Returns which of the sixteen compass directions that point <code>b</code> lies in from point <code>a</code> as one of the {@link DirectionCodes} direction constants. <em>Note:</em> that the coordinates supplied are assumed to be logical (screen) rather than cartesian coordinates and <code>NORTH</code> is considered to point toward the top of the screen. """ return getFineDirection(a.x, a.y, b.x, b.y); }
java
public static int getFineDirection (Point a, Point b) { return getFineDirection(a.x, a.y, b.x, b.y); }
[ "public", "static", "int", "getFineDirection", "(", "Point", "a", ",", "Point", "b", ")", "{", "return", "getFineDirection", "(", "a", ".", "x", ",", "a", ".", "y", ",", "b", ".", "x", ",", "b", ".", "y", ")", ";", "}" ]
Returns which of the sixteen compass directions that point <code>b</code> lies in from point <code>a</code> as one of the {@link DirectionCodes} direction constants. <em>Note:</em> that the coordinates supplied are assumed to be logical (screen) rather than cartesian coordinates and <code>NORTH</code> is considered to point toward the top of the screen.
[ "Returns", "which", "of", "the", "sixteen", "compass", "directions", "that", "point", "<code", ">", "b<", "/", "code", ">", "lies", "in", "from", "point", "<code", ">", "a<", "/", "code", ">", "as", "one", "of", "the", "{" ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/DirectionUtil.java#L230-L233
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/transport/netty/DcpControlHandler.java
DcpControlHandler.channelRead0
@Override protected void channelRead0(final ChannelHandlerContext ctx, final ByteBuf msg) throws Exception { """ Since only one feature per req/res can be negotiated, repeat the process once a response comes back until the iterator is complete or a non-success response status is received. """ ResponseStatus status = MessageUtil.getResponseStatus(msg); if (status.isSuccess()) { negotiate(ctx); } else { originalPromise().setFailure(new IllegalStateException("Could not configure DCP Controls: " + status)); } }
java
@Override protected void channelRead0(final ChannelHandlerContext ctx, final ByteBuf msg) throws Exception { ResponseStatus status = MessageUtil.getResponseStatus(msg); if (status.isSuccess()) { negotiate(ctx); } else { originalPromise().setFailure(new IllegalStateException("Could not configure DCP Controls: " + status)); } }
[ "@", "Override", "protected", "void", "channelRead0", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "ByteBuf", "msg", ")", "throws", "Exception", "{", "ResponseStatus", "status", "=", "MessageUtil", ".", "getResponseStatus", "(", "msg", ")", ";", "if", "(", "status", ".", "isSuccess", "(", ")", ")", "{", "negotiate", "(", "ctx", ")", ";", "}", "else", "{", "originalPromise", "(", ")", ".", "setFailure", "(", "new", "IllegalStateException", "(", "\"Could not configure DCP Controls: \"", "+", "status", ")", ")", ";", "}", "}" ]
Since only one feature per req/res can be negotiated, repeat the process once a response comes back until the iterator is complete or a non-success response status is received.
[ "Since", "only", "one", "feature", "per", "req", "/", "res", "can", "be", "negotiated", "repeat", "the", "process", "once", "a", "response", "comes", "back", "until", "the", "iterator", "is", "complete", "or", "a", "non", "-", "success", "response", "status", "is", "received", "." ]
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/transport/netty/DcpControlHandler.java#L103-L111
dnsjava/dnsjava
org/xbill/DNS/ZoneTransferIn.java
ZoneTransferIn.newAXFR
public static ZoneTransferIn newAXFR(Name zone, String host, TSIG key) throws UnknownHostException { """ Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer). @param zone The zone to transfer. @param host The host from which to transfer the zone. @param key The TSIG key used to authenticate the transfer, or null. @return The ZoneTransferIn object. @throws UnknownHostException The host does not exist. """ return newAXFR(zone, host, 0, key); }
java
public static ZoneTransferIn newAXFR(Name zone, String host, TSIG key) throws UnknownHostException { return newAXFR(zone, host, 0, key); }
[ "public", "static", "ZoneTransferIn", "newAXFR", "(", "Name", "zone", ",", "String", "host", ",", "TSIG", "key", ")", "throws", "UnknownHostException", "{", "return", "newAXFR", "(", "zone", ",", "host", ",", "0", ",", "key", ")", ";", "}" ]
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer). @param zone The zone to transfer. @param host The host from which to transfer the zone. @param key The TSIG key used to authenticate the transfer, or null. @return The ZoneTransferIn object. @throws UnknownHostException The host does not exist.
[ "Instantiates", "a", "ZoneTransferIn", "object", "to", "do", "an", "AXFR", "(", "full", "zone", "transfer", ")", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ZoneTransferIn.java#L231-L236
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_database_name_request_POST
public OvhTask serviceName_database_name_request_POST(String serviceName, String name, net.minidev.ovh.api.hosting.web.database.OvhRequestActionEnum action) throws IOException { """ Request specific operation for your database REST: POST /hosting/web/{serviceName}/database/{name}/request @param action [required] Action you want to request @param serviceName [required] The internal name of your hosting @param name [required] Database name (like mydb.mysql.db or mydb.postgres.db) """ String qPath = "/hosting/web/{serviceName}/database/{name}/request"; StringBuilder sb = path(qPath, serviceName, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_database_name_request_POST(String serviceName, String name, net.minidev.ovh.api.hosting.web.database.OvhRequestActionEnum action) throws IOException { String qPath = "/hosting/web/{serviceName}/database/{name}/request"; StringBuilder sb = path(qPath, serviceName, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_database_name_request_POST", "(", "String", "serviceName", ",", "String", "name", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "hosting", ".", "web", ".", "database", ".", "OvhRequestActionEnum", "action", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/database/{name}/request\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "name", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"action\"", ",", "action", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Request specific operation for your database REST: POST /hosting/web/{serviceName}/database/{name}/request @param action [required] Action you want to request @param serviceName [required] The internal name of your hosting @param name [required] Database name (like mydb.mysql.db or mydb.postgres.db)
[ "Request", "specific", "operation", "for", "your", "database" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1160-L1167
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.holdsLock
public static void holdsLock(Object lock, Supplier<String> message) { """ Asserts that the {@link Thread#currentThread() current Thread} holds the specified {@link Object lock}. The assertion holds if and only if the {@link Object lock} is not {@literal null} and the {@link Thread#currentThread() current Thread} holds the given {@link Object lock}. @param lock {@link Object} used as the lock, monitor or mutex in the synchronization. @param message {@link Supplier} containing the message used in the {@link IllegalMonitorStateException} thrown if the assertion fails. @throws java.lang.IllegalMonitorStateException if the {@link Thread#currentThread() current Thread} does not hold the {@link Object lock} or the {@link Object lock} is {@literal null}. @see java.lang.Thread#holdsLock(Object) @see java.util.function.Supplier """ if (isNotLockHolder(lock)) { throw new IllegalMonitorStateException(message.get()); } }
java
public static void holdsLock(Object lock, Supplier<String> message) { if (isNotLockHolder(lock)) { throw new IllegalMonitorStateException(message.get()); } }
[ "public", "static", "void", "holdsLock", "(", "Object", "lock", ",", "Supplier", "<", "String", ">", "message", ")", "{", "if", "(", "isNotLockHolder", "(", "lock", ")", ")", "{", "throw", "new", "IllegalMonitorStateException", "(", "message", ".", "get", "(", ")", ")", ";", "}", "}" ]
Asserts that the {@link Thread#currentThread() current Thread} holds the specified {@link Object lock}. The assertion holds if and only if the {@link Object lock} is not {@literal null} and the {@link Thread#currentThread() current Thread} holds the given {@link Object lock}. @param lock {@link Object} used as the lock, monitor or mutex in the synchronization. @param message {@link Supplier} containing the message used in the {@link IllegalMonitorStateException} thrown if the assertion fails. @throws java.lang.IllegalMonitorStateException if the {@link Thread#currentThread() current Thread} does not hold the {@link Object lock} or the {@link Object lock} is {@literal null}. @see java.lang.Thread#holdsLock(Object) @see java.util.function.Supplier
[ "Asserts", "that", "the", "{", "@link", "Thread#currentThread", "()", "current", "Thread", "}", "holds", "the", "specified", "{", "@link", "Object", "lock", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L467-L471
atomix/atomix
cluster/src/main/java/io/atomix/cluster/messaging/impl/NettyMessagingService.java
NettyMessagingService.bootstrapServer
private CompletableFuture<Void> bootstrapServer() { """ Bootstraps a server. @return a future to be completed once the server has been bound to all interfaces """ ServerBootstrap b = new ServerBootstrap(); b.option(ChannelOption.SO_REUSEADDR, true); b.option(ChannelOption.SO_BACKLOG, 128); b.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(8 * 1024, 32 * 1024)); b.childOption(ChannelOption.SO_RCVBUF, 1024 * 1024); b.childOption(ChannelOption.SO_SNDBUF, 1024 * 1024); b.childOption(ChannelOption.SO_KEEPALIVE, true); b.childOption(ChannelOption.TCP_NODELAY, true); b.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT); b.group(serverGroup, clientGroup); b.channel(serverChannelClass); if (enableNettyTls) { try { b.childHandler(new SslServerChannelInitializer()); } catch (SSLException e) { return Futures.exceptionalFuture(e); } } else { b.childHandler(new BasicServerChannelInitializer()); } return bind(b); }
java
private CompletableFuture<Void> bootstrapServer() { ServerBootstrap b = new ServerBootstrap(); b.option(ChannelOption.SO_REUSEADDR, true); b.option(ChannelOption.SO_BACKLOG, 128); b.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(8 * 1024, 32 * 1024)); b.childOption(ChannelOption.SO_RCVBUF, 1024 * 1024); b.childOption(ChannelOption.SO_SNDBUF, 1024 * 1024); b.childOption(ChannelOption.SO_KEEPALIVE, true); b.childOption(ChannelOption.TCP_NODELAY, true); b.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT); b.group(serverGroup, clientGroup); b.channel(serverChannelClass); if (enableNettyTls) { try { b.childHandler(new SslServerChannelInitializer()); } catch (SSLException e) { return Futures.exceptionalFuture(e); } } else { b.childHandler(new BasicServerChannelInitializer()); } return bind(b); }
[ "private", "CompletableFuture", "<", "Void", ">", "bootstrapServer", "(", ")", "{", "ServerBootstrap", "b", "=", "new", "ServerBootstrap", "(", ")", ";", "b", ".", "option", "(", "ChannelOption", ".", "SO_REUSEADDR", ",", "true", ")", ";", "b", ".", "option", "(", "ChannelOption", ".", "SO_BACKLOG", ",", "128", ")", ";", "b", ".", "childOption", "(", "ChannelOption", ".", "WRITE_BUFFER_WATER_MARK", ",", "new", "WriteBufferWaterMark", "(", "8", "*", "1024", ",", "32", "*", "1024", ")", ")", ";", "b", ".", "childOption", "(", "ChannelOption", ".", "SO_RCVBUF", ",", "1024", "*", "1024", ")", ";", "b", ".", "childOption", "(", "ChannelOption", ".", "SO_SNDBUF", ",", "1024", "*", "1024", ")", ";", "b", ".", "childOption", "(", "ChannelOption", ".", "SO_KEEPALIVE", ",", "true", ")", ";", "b", ".", "childOption", "(", "ChannelOption", ".", "TCP_NODELAY", ",", "true", ")", ";", "b", ".", "childOption", "(", "ChannelOption", ".", "ALLOCATOR", ",", "PooledByteBufAllocator", ".", "DEFAULT", ")", ";", "b", ".", "group", "(", "serverGroup", ",", "clientGroup", ")", ";", "b", ".", "channel", "(", "serverChannelClass", ")", ";", "if", "(", "enableNettyTls", ")", "{", "try", "{", "b", ".", "childHandler", "(", "new", "SslServerChannelInitializer", "(", ")", ")", ";", "}", "catch", "(", "SSLException", "e", ")", "{", "return", "Futures", ".", "exceptionalFuture", "(", "e", ")", ";", "}", "}", "else", "{", "b", ".", "childHandler", "(", "new", "BasicServerChannelInitializer", "(", ")", ")", ";", "}", "return", "bind", "(", "b", ")", ";", "}" ]
Bootstraps a server. @return a future to be completed once the server has been bound to all interfaces
[ "Bootstraps", "a", "server", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/cluster/src/main/java/io/atomix/cluster/messaging/impl/NettyMessagingService.java#L509-L532
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/RDBMEntityLockStore.java
RDBMEntityLockStore.primAdd
private void primAdd(IEntityLock lock, Connection conn) throws SQLException, LockingException { """ Add the lock to the underlying store. @param lock org.apereo.portal.concurrency.locking.IEntityLock @param conn java.sql.Connection """ Integer typeID = EntityTypesLocator.getEntityTypes().getEntityIDFromType(lock.getEntityType()); String key = lock.getEntityKey(); int lockType = lock.getLockType(); Timestamp ts = new Timestamp(lock.getExpirationTime().getTime()); String owner = lock.getLockOwner(); try { PreparedStatement ps = conn.prepareStatement(getAddSql()); try { ps.setInt(1, typeID.intValue()); // entity type ps.setString(2, key); // entity key ps.setInt(3, lockType); // lock type ps.setTimestamp(4, ts); // lock expiration ps.setString(5, owner); // lock owner if (log.isDebugEnabled()) log.debug("RDBMEntityLockStore.primAdd(): " + ps); int rc = ps.executeUpdate(); if (rc != 1) { String errString = "Problem adding " + lock; log.error(errString); throw new LockingException(errString); } } finally { if (ps != null) ps.close(); } } catch (java.sql.SQLException sqle) { log.error(sqle, sqle); throw sqle; } }
java
private void primAdd(IEntityLock lock, Connection conn) throws SQLException, LockingException { Integer typeID = EntityTypesLocator.getEntityTypes().getEntityIDFromType(lock.getEntityType()); String key = lock.getEntityKey(); int lockType = lock.getLockType(); Timestamp ts = new Timestamp(lock.getExpirationTime().getTime()); String owner = lock.getLockOwner(); try { PreparedStatement ps = conn.prepareStatement(getAddSql()); try { ps.setInt(1, typeID.intValue()); // entity type ps.setString(2, key); // entity key ps.setInt(3, lockType); // lock type ps.setTimestamp(4, ts); // lock expiration ps.setString(5, owner); // lock owner if (log.isDebugEnabled()) log.debug("RDBMEntityLockStore.primAdd(): " + ps); int rc = ps.executeUpdate(); if (rc != 1) { String errString = "Problem adding " + lock; log.error(errString); throw new LockingException(errString); } } finally { if (ps != null) ps.close(); } } catch (java.sql.SQLException sqle) { log.error(sqle, sqle); throw sqle; } }
[ "private", "void", "primAdd", "(", "IEntityLock", "lock", ",", "Connection", "conn", ")", "throws", "SQLException", ",", "LockingException", "{", "Integer", "typeID", "=", "EntityTypesLocator", ".", "getEntityTypes", "(", ")", ".", "getEntityIDFromType", "(", "lock", ".", "getEntityType", "(", ")", ")", ";", "String", "key", "=", "lock", ".", "getEntityKey", "(", ")", ";", "int", "lockType", "=", "lock", ".", "getLockType", "(", ")", ";", "Timestamp", "ts", "=", "new", "Timestamp", "(", "lock", ".", "getExpirationTime", "(", ")", ".", "getTime", "(", ")", ")", ";", "String", "owner", "=", "lock", ".", "getLockOwner", "(", ")", ";", "try", "{", "PreparedStatement", "ps", "=", "conn", ".", "prepareStatement", "(", "getAddSql", "(", ")", ")", ";", "try", "{", "ps", ".", "setInt", "(", "1", ",", "typeID", ".", "intValue", "(", ")", ")", ";", "// entity type", "ps", ".", "setString", "(", "2", ",", "key", ")", ";", "// entity key", "ps", ".", "setInt", "(", "3", ",", "lockType", ")", ";", "// lock type", "ps", ".", "setTimestamp", "(", "4", ",", "ts", ")", ";", "// lock expiration", "ps", ".", "setString", "(", "5", ",", "owner", ")", ";", "// lock owner", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "log", ".", "debug", "(", "\"RDBMEntityLockStore.primAdd(): \"", "+", "ps", ")", ";", "int", "rc", "=", "ps", ".", "executeUpdate", "(", ")", ";", "if", "(", "rc", "!=", "1", ")", "{", "String", "errString", "=", "\"Problem adding \"", "+", "lock", ";", "log", ".", "error", "(", "errString", ")", ";", "throw", "new", "LockingException", "(", "errString", ")", ";", "}", "}", "finally", "{", "if", "(", "ps", "!=", "null", ")", "ps", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "java", ".", "sql", ".", "SQLException", "sqle", ")", "{", "log", ".", "error", "(", "sqle", ",", "sqle", ")", ";", "throw", "sqle", ";", "}", "}" ]
Add the lock to the underlying store. @param lock org.apereo.portal.concurrency.locking.IEntityLock @param conn java.sql.Connection
[ "Add", "the", "lock", "to", "the", "underlying", "store", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/RDBMEntityLockStore.java#L349-L381
junit-team/junit4
src/main/java/org/junit/runners/model/FrameworkMethod.java
FrameworkMethod.validatePublicVoid
public void validatePublicVoid(boolean isStatic, List<Throwable> errors) { """ Adds to {@code errors} if this method: <ul> <li>is not public, or <li>returns something other than void, or <li>is static (given {@code isStatic is false}), or <li>is not static (given {@code isStatic is true}). </ul> """ if (isStatic() != isStatic) { String state = isStatic ? "should" : "should not"; errors.add(new Exception("Method " + method.getName() + "() " + state + " be static")); } if (!isPublic()) { errors.add(new Exception("Method " + method.getName() + "() should be public")); } if (method.getReturnType() != Void.TYPE) { errors.add(new Exception("Method " + method.getName() + "() should be void")); } }
java
public void validatePublicVoid(boolean isStatic, List<Throwable> errors) { if (isStatic() != isStatic) { String state = isStatic ? "should" : "should not"; errors.add(new Exception("Method " + method.getName() + "() " + state + " be static")); } if (!isPublic()) { errors.add(new Exception("Method " + method.getName() + "() should be public")); } if (method.getReturnType() != Void.TYPE) { errors.add(new Exception("Method " + method.getName() + "() should be void")); } }
[ "public", "void", "validatePublicVoid", "(", "boolean", "isStatic", ",", "List", "<", "Throwable", ">", "errors", ")", "{", "if", "(", "isStatic", "(", ")", "!=", "isStatic", ")", "{", "String", "state", "=", "isStatic", "?", "\"should\"", ":", "\"should not\"", ";", "errors", ".", "add", "(", "new", "Exception", "(", "\"Method \"", "+", "method", ".", "getName", "(", ")", "+", "\"() \"", "+", "state", "+", "\" be static\"", ")", ")", ";", "}", "if", "(", "!", "isPublic", "(", ")", ")", "{", "errors", ".", "add", "(", "new", "Exception", "(", "\"Method \"", "+", "method", ".", "getName", "(", ")", "+", "\"() should be public\"", ")", ")", ";", "}", "if", "(", "method", ".", "getReturnType", "(", ")", "!=", "Void", ".", "TYPE", ")", "{", "errors", ".", "add", "(", "new", "Exception", "(", "\"Method \"", "+", "method", ".", "getName", "(", ")", "+", "\"() should be void\"", ")", ")", ";", "}", "}" ]
Adds to {@code errors} if this method: <ul> <li>is not public, or <li>returns something other than void, or <li>is static (given {@code isStatic is false}), or <li>is not static (given {@code isStatic is true}). </ul>
[ "Adds", "to", "{" ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runners/model/FrameworkMethod.java#L99-L110
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitCall
private void visitCall(NodeTraversal t, Node n) { """ Visits a CALL node. @param t The node traversal object that supplies context, such as the scope chain to use in name lookups as well as error reporting. @param n The node being visited. """ checkCallConventions(t, n); Node child = n.getFirstChild(); JSType childType = getJSType(child).restrictByNotNullOrUndefined(); if (!childType.canBeCalled()) { report(n, NOT_CALLABLE, childType.toString()); ensureTyped(n); return; } // A couple of types can be called as if they were functions. // If it is a function type, then validate parameters. if (childType.isFunctionType()) { FunctionType functionType = childType.toMaybeFunctionType(); // Non-native constructors should not be called directly // unless they specify a return type if (functionType.isConstructor() && !functionType.isNativeObjectType() && (functionType.getReturnType().isUnknownType() || functionType.getReturnType().isVoidType()) && !n.getFirstChild().isSuper()) { report(n, CONSTRUCTOR_NOT_CALLABLE, childType.toString()); } // Functions with explicit 'this' types must be called in a GETPROP or GETELEM. if (functionType.isOrdinaryFunction() && !NodeUtil.isGet(child)) { JSType receiverType = functionType.getTypeOfThis(); if (receiverType.isUnknownType() || receiverType.isAllType() || receiverType.isVoidType() || (receiverType.isObjectType() && receiverType.toObjectType().isNativeObjectType())) { // Allow these special cases. } else { report(n, EXPECTED_THIS_TYPE, functionType.toString()); } } visitArgumentList(n, functionType); ensureTyped(n, functionType.getReturnType()); } else { ensureTyped(n); } // TODO(nicksantos): Add something to check for calls of RegExp objects, // which is not supported by IE. Either say something about the return type // or warn about the non-portability of the call or both. }
java
private void visitCall(NodeTraversal t, Node n) { checkCallConventions(t, n); Node child = n.getFirstChild(); JSType childType = getJSType(child).restrictByNotNullOrUndefined(); if (!childType.canBeCalled()) { report(n, NOT_CALLABLE, childType.toString()); ensureTyped(n); return; } // A couple of types can be called as if they were functions. // If it is a function type, then validate parameters. if (childType.isFunctionType()) { FunctionType functionType = childType.toMaybeFunctionType(); // Non-native constructors should not be called directly // unless they specify a return type if (functionType.isConstructor() && !functionType.isNativeObjectType() && (functionType.getReturnType().isUnknownType() || functionType.getReturnType().isVoidType()) && !n.getFirstChild().isSuper()) { report(n, CONSTRUCTOR_NOT_CALLABLE, childType.toString()); } // Functions with explicit 'this' types must be called in a GETPROP or GETELEM. if (functionType.isOrdinaryFunction() && !NodeUtil.isGet(child)) { JSType receiverType = functionType.getTypeOfThis(); if (receiverType.isUnknownType() || receiverType.isAllType() || receiverType.isVoidType() || (receiverType.isObjectType() && receiverType.toObjectType().isNativeObjectType())) { // Allow these special cases. } else { report(n, EXPECTED_THIS_TYPE, functionType.toString()); } } visitArgumentList(n, functionType); ensureTyped(n, functionType.getReturnType()); } else { ensureTyped(n); } // TODO(nicksantos): Add something to check for calls of RegExp objects, // which is not supported by IE. Either say something about the return type // or warn about the non-portability of the call or both. }
[ "private", "void", "visitCall", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "checkCallConventions", "(", "t", ",", "n", ")", ";", "Node", "child", "=", "n", ".", "getFirstChild", "(", ")", ";", "JSType", "childType", "=", "getJSType", "(", "child", ")", ".", "restrictByNotNullOrUndefined", "(", ")", ";", "if", "(", "!", "childType", ".", "canBeCalled", "(", ")", ")", "{", "report", "(", "n", ",", "NOT_CALLABLE", ",", "childType", ".", "toString", "(", ")", ")", ";", "ensureTyped", "(", "n", ")", ";", "return", ";", "}", "// A couple of types can be called as if they were functions.", "// If it is a function type, then validate parameters.", "if", "(", "childType", ".", "isFunctionType", "(", ")", ")", "{", "FunctionType", "functionType", "=", "childType", ".", "toMaybeFunctionType", "(", ")", ";", "// Non-native constructors should not be called directly", "// unless they specify a return type", "if", "(", "functionType", ".", "isConstructor", "(", ")", "&&", "!", "functionType", ".", "isNativeObjectType", "(", ")", "&&", "(", "functionType", ".", "getReturnType", "(", ")", ".", "isUnknownType", "(", ")", "||", "functionType", ".", "getReturnType", "(", ")", ".", "isVoidType", "(", ")", ")", "&&", "!", "n", ".", "getFirstChild", "(", ")", ".", "isSuper", "(", ")", ")", "{", "report", "(", "n", ",", "CONSTRUCTOR_NOT_CALLABLE", ",", "childType", ".", "toString", "(", ")", ")", ";", "}", "// Functions with explicit 'this' types must be called in a GETPROP or GETELEM.", "if", "(", "functionType", ".", "isOrdinaryFunction", "(", ")", "&&", "!", "NodeUtil", ".", "isGet", "(", "child", ")", ")", "{", "JSType", "receiverType", "=", "functionType", ".", "getTypeOfThis", "(", ")", ";", "if", "(", "receiverType", ".", "isUnknownType", "(", ")", "||", "receiverType", ".", "isAllType", "(", ")", "||", "receiverType", ".", "isVoidType", "(", ")", "||", "(", "receiverType", ".", "isObjectType", "(", ")", "&&", "receiverType", ".", "toObjectType", "(", ")", ".", "isNativeObjectType", "(", ")", ")", ")", "{", "// Allow these special cases.", "}", "else", "{", "report", "(", "n", ",", "EXPECTED_THIS_TYPE", ",", "functionType", ".", "toString", "(", ")", ")", ";", "}", "}", "visitArgumentList", "(", "n", ",", "functionType", ")", ";", "ensureTyped", "(", "n", ",", "functionType", ".", "getReturnType", "(", ")", ")", ";", "}", "else", "{", "ensureTyped", "(", "n", ")", ";", "}", "// TODO(nicksantos): Add something to check for calls of RegExp objects,", "// which is not supported by IE. Either say something about the return type", "// or warn about the non-portability of the call or both.", "}" ]
Visits a CALL node. @param t The node traversal object that supplies context, such as the scope chain to use in name lookups as well as error reporting. @param n The node being visited.
[ "Visits", "a", "CALL", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2534-L2583
fommil/matrix-toolkits-java
src/main/java/no/uib/cipr/matrix/sparse/Arrays.java
Arrays.binarySearch
public static int binarySearch(int[] index, int key, int begin, int end) { """ Searches for a key in a subset of a sorted array. @param index Sorted array of integers @param key Key to search for @param begin Start posisiton in the index @param end One past the end position in the index @return Integer index to key. A negative integer if not found """ return java.util.Arrays.binarySearch(index, begin, end, key); }
java
public static int binarySearch(int[] index, int key, int begin, int end) { return java.util.Arrays.binarySearch(index, begin, end, key); }
[ "public", "static", "int", "binarySearch", "(", "int", "[", "]", "index", ",", "int", "key", ",", "int", "begin", ",", "int", "end", ")", "{", "return", "java", ".", "util", ".", "Arrays", ".", "binarySearch", "(", "index", ",", "begin", ",", "end", ",", "key", ")", ";", "}" ]
Searches for a key in a subset of a sorted array. @param index Sorted array of integers @param key Key to search for @param begin Start posisiton in the index @param end One past the end position in the index @return Integer index to key. A negative integer if not found
[ "Searches", "for", "a", "key", "in", "a", "subset", "of", "a", "sorted", "array", "." ]
train
https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/sparse/Arrays.java#L119-L121
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/embeddings/KerasEmbedding.java
KerasEmbedding.getInputLengthFromConfig
private int getInputLengthFromConfig(Map<String, Object> layerConfig) throws InvalidKerasConfigurationException { """ Get Keras input length from Keras layer configuration. In Keras input_length, if present, denotes the number of indices to embed per mini-batch, i.e. input will be of shape (mb, input_length) and (mb, 1) else. @param layerConfig dictionary containing Keras layer configuration @return input length as int """ Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf); if (!innerConfig.containsKey(conf.getLAYER_FIELD_INPUT_LENGTH())) throw new InvalidKerasConfigurationException( "Keras Embedding layer config missing " + conf.getLAYER_FIELD_INPUT_LENGTH() + " field"); if (innerConfig.get(conf.getLAYER_FIELD_INPUT_LENGTH()) == null) { return 0; } else { return (int) innerConfig.get(conf.getLAYER_FIELD_INPUT_LENGTH()); } }
java
private int getInputLengthFromConfig(Map<String, Object> layerConfig) throws InvalidKerasConfigurationException { Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf); if (!innerConfig.containsKey(conf.getLAYER_FIELD_INPUT_LENGTH())) throw new InvalidKerasConfigurationException( "Keras Embedding layer config missing " + conf.getLAYER_FIELD_INPUT_LENGTH() + " field"); if (innerConfig.get(conf.getLAYER_FIELD_INPUT_LENGTH()) == null) { return 0; } else { return (int) innerConfig.get(conf.getLAYER_FIELD_INPUT_LENGTH()); } }
[ "private", "int", "getInputLengthFromConfig", "(", "Map", "<", "String", ",", "Object", ">", "layerConfig", ")", "throws", "InvalidKerasConfigurationException", "{", "Map", "<", "String", ",", "Object", ">", "innerConfig", "=", "KerasLayerUtils", ".", "getInnerLayerConfigFromConfig", "(", "layerConfig", ",", "conf", ")", ";", "if", "(", "!", "innerConfig", ".", "containsKey", "(", "conf", ".", "getLAYER_FIELD_INPUT_LENGTH", "(", ")", ")", ")", "throw", "new", "InvalidKerasConfigurationException", "(", "\"Keras Embedding layer config missing \"", "+", "conf", ".", "getLAYER_FIELD_INPUT_LENGTH", "(", ")", "+", "\" field\"", ")", ";", "if", "(", "innerConfig", ".", "get", "(", "conf", ".", "getLAYER_FIELD_INPUT_LENGTH", "(", ")", ")", "==", "null", ")", "{", "return", "0", ";", "}", "else", "{", "return", "(", "int", ")", "innerConfig", ".", "get", "(", "conf", ".", "getLAYER_FIELD_INPUT_LENGTH", "(", ")", ")", ";", "}", "}" ]
Get Keras input length from Keras layer configuration. In Keras input_length, if present, denotes the number of indices to embed per mini-batch, i.e. input will be of shape (mb, input_length) and (mb, 1) else. @param layerConfig dictionary containing Keras layer configuration @return input length as int
[ "Get", "Keras", "input", "length", "from", "Keras", "layer", "configuration", ".", "In", "Keras", "input_length", "if", "present", "denotes", "the", "number", "of", "indices", "to", "embed", "per", "mini", "-", "batch", "i", ".", "e", ".", "input", "will", "be", "of", "shape", "(", "mb", "input_length", ")", "and", "(", "mb", "1", ")", "else", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/embeddings/KerasEmbedding.java#L211-L221
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingConfigurationImpl.java
IndexingConfigurationImpl.isIncludedInNodeScopeIndex
public boolean isIncludedInNodeScopeIndex(NodeData state, InternalQName propertyName) { """ Returns <code>true</code> if the property with the given name should be included in the node scope fulltext index. If there is not configuration entry for that propery <code>false</code> is returned. @param state the node state. @param propertyName the name of a property. @return <code>true</code> if the property should be included in the node scope fulltext index. """ IndexingRule rule = getApplicableIndexingRule(state); if (rule != null) { return rule.isIncludedInNodeScopeIndex(propertyName); } // none of the config elements matched -> default is to include return true; }
java
public boolean isIncludedInNodeScopeIndex(NodeData state, InternalQName propertyName) { IndexingRule rule = getApplicableIndexingRule(state); if (rule != null) { return rule.isIncludedInNodeScopeIndex(propertyName); } // none of the config elements matched -> default is to include return true; }
[ "public", "boolean", "isIncludedInNodeScopeIndex", "(", "NodeData", "state", ",", "InternalQName", "propertyName", ")", "{", "IndexingRule", "rule", "=", "getApplicableIndexingRule", "(", "state", ")", ";", "if", "(", "rule", "!=", "null", ")", "{", "return", "rule", ".", "isIncludedInNodeScopeIndex", "(", "propertyName", ")", ";", "}", "// none of the config elements matched -> default is to include", "return", "true", ";", "}" ]
Returns <code>true</code> if the property with the given name should be included in the node scope fulltext index. If there is not configuration entry for that propery <code>false</code> is returned. @param state the node state. @param propertyName the name of a property. @return <code>true</code> if the property should be included in the node scope fulltext index.
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "property", "with", "the", "given", "name", "should", "be", "included", "in", "the", "node", "scope", "fulltext", "index", ".", "If", "there", "is", "not", "configuration", "entry", "for", "that", "propery", "<code", ">", "false<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingConfigurationImpl.java#L310-L319
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.listNoteOccurrences
public final ListNoteOccurrencesPagedResponse listNoteOccurrences(String name, String filter) { """ Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); String filter = ""; for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(name.toString(), filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param name The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. @param filter The filter expression. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder().setName(name).setFilter(filter).build(); return listNoteOccurrences(request); }
java
public final ListNoteOccurrencesPagedResponse listNoteOccurrences(String name, String filter) { ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder().setName(name).setFilter(filter).build(); return listNoteOccurrences(request); }
[ "public", "final", "ListNoteOccurrencesPagedResponse", "listNoteOccurrences", "(", "String", "name", ",", "String", "filter", ")", "{", "ListNoteOccurrencesRequest", "request", "=", "ListNoteOccurrencesRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", ")", ".", "setFilter", "(", "filter", ")", ".", "build", "(", ")", ";", "return", "listNoteOccurrences", "(", "request", ")", ";", "}" ]
Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); String filter = ""; for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(name.toString(), filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param name The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. @param filter The filter expression. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "occurrences", "referencing", "the", "specified", "note", ".", "Provider", "projects", "can", "use", "this", "method", "to", "get", "all", "occurrences", "across", "consumer", "projects", "referencing", "the", "specified", "note", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L1649-L1653
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mktab/MkTabTreeIndex.java
MkTabTreeIndex.createNewLeafEntry
protected MkTabEntry createNewLeafEntry(DBID id, O object, double parentDistance) { """ Creates a new leaf entry representing the specified data object in the specified subtree. @param object the data object to be represented by the new entry @param parentDistance the distance from the object to the routing object of the parent node """ return new MkTabLeafEntry(id, parentDistance, knnDistances(object)); }
java
protected MkTabEntry createNewLeafEntry(DBID id, O object, double parentDistance) { return new MkTabLeafEntry(id, parentDistance, knnDistances(object)); }
[ "protected", "MkTabEntry", "createNewLeafEntry", "(", "DBID", "id", ",", "O", "object", ",", "double", "parentDistance", ")", "{", "return", "new", "MkTabLeafEntry", "(", "id", ",", "parentDistance", ",", "knnDistances", "(", "object", ")", ")", ";", "}" ]
Creates a new leaf entry representing the specified data object in the specified subtree. @param object the data object to be represented by the new entry @param parentDistance the distance from the object to the routing object of the parent node
[ "Creates", "a", "new", "leaf", "entry", "representing", "the", "specified", "data", "object", "in", "the", "specified", "subtree", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mktab/MkTabTreeIndex.java#L76-L78
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java
FacesImpl.verifyFaceToPersonAsync
public Observable<VerifyResult> verifyFaceToPersonAsync(UUID faceId, String personGroupId, UUID personId) { """ Verify whether two faces belong to a same person. Compares a face Id with a Person Id. @param faceId FaceId the face, comes from Face - Detect @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. @param personId Specify a certain person in a person group. personId is created in Persons.Create. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VerifyResult object """ return verifyFaceToPersonWithServiceResponseAsync(faceId, personGroupId, personId).map(new Func1<ServiceResponse<VerifyResult>, VerifyResult>() { @Override public VerifyResult call(ServiceResponse<VerifyResult> response) { return response.body(); } }); }
java
public Observable<VerifyResult> verifyFaceToPersonAsync(UUID faceId, String personGroupId, UUID personId) { return verifyFaceToPersonWithServiceResponseAsync(faceId, personGroupId, personId).map(new Func1<ServiceResponse<VerifyResult>, VerifyResult>() { @Override public VerifyResult call(ServiceResponse<VerifyResult> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VerifyResult", ">", "verifyFaceToPersonAsync", "(", "UUID", "faceId", ",", "String", "personGroupId", ",", "UUID", "personId", ")", "{", "return", "verifyFaceToPersonWithServiceResponseAsync", "(", "faceId", ",", "personGroupId", ",", "personId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VerifyResult", ">", ",", "VerifyResult", ">", "(", ")", "{", "@", "Override", "public", "VerifyResult", "call", "(", "ServiceResponse", "<", "VerifyResult", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Verify whether two faces belong to a same person. Compares a face Id with a Person Id. @param faceId FaceId the face, comes from Face - Detect @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. @param personId Specify a certain person in a person group. personId is created in Persons.Create. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VerifyResult object
[ "Verify", "whether", "two", "faces", "belong", "to", "a", "same", "person", ".", "Compares", "a", "face", "Id", "with", "a", "Person", "Id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java#L857-L864
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/AbstractReplicator.java
AbstractReplicator.addDocumentReplicationListener
@NonNull public ListenerToken addDocumentReplicationListener( Executor executor, @NonNull DocumentReplicationListener listener) { """ Set the given DocumentReplicationListener to the this replicator. @param listener """ if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); } synchronized (lock) { setProgressLevel(ReplicatorProgressLevel.PER_DOCUMENT); final DocumentReplicationListenerToken token = new DocumentReplicationListenerToken(executor, listener); docEndedListenerTokens.add(token); return token; } }
java
@NonNull public ListenerToken addDocumentReplicationListener( Executor executor, @NonNull DocumentReplicationListener listener) { if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); } synchronized (lock) { setProgressLevel(ReplicatorProgressLevel.PER_DOCUMENT); final DocumentReplicationListenerToken token = new DocumentReplicationListenerToken(executor, listener); docEndedListenerTokens.add(token); return token; } }
[ "@", "NonNull", "public", "ListenerToken", "addDocumentReplicationListener", "(", "Executor", "executor", ",", "@", "NonNull", "DocumentReplicationListener", "listener", ")", "{", "if", "(", "listener", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"listener cannot be null.\"", ")", ";", "}", "synchronized", "(", "lock", ")", "{", "setProgressLevel", "(", "ReplicatorProgressLevel", ".", "PER_DOCUMENT", ")", ";", "final", "DocumentReplicationListenerToken", "token", "=", "new", "DocumentReplicationListenerToken", "(", "executor", ",", "listener", ")", ";", "docEndedListenerTokens", ".", "add", "(", "token", ")", ";", "return", "token", ";", "}", "}" ]
Set the given DocumentReplicationListener to the this replicator. @param listener
[ "Set", "the", "given", "DocumentReplicationListener", "to", "the", "this", "replicator", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/AbstractReplicator.java#L446-L458
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/MessageRouterImpl.java
MessageRouterImpl.routeToAll
protected boolean routeToAll(String msg, LogRecord logRecord, Set<String> logHandlerIds) { """ Route the message to all LogHandlers in the set. @return true if the set contained DEFAULT, which means the msg should be logged normally as well. false otherwise. """ boolean logNormally = false; for (String id : logHandlerIds) { if (id.equals("DEFAULT")) { // DEFAULT is still in the list, so we should tell the caller to also log // the message normally. logNormally = true; } else { routeTo(msg, logRecord, id); } } return logNormally; }
java
protected boolean routeToAll(String msg, LogRecord logRecord, Set<String> logHandlerIds) { boolean logNormally = false; for (String id : logHandlerIds) { if (id.equals("DEFAULT")) { // DEFAULT is still in the list, so we should tell the caller to also log // the message normally. logNormally = true; } else { routeTo(msg, logRecord, id); } } return logNormally; }
[ "protected", "boolean", "routeToAll", "(", "String", "msg", ",", "LogRecord", "logRecord", ",", "Set", "<", "String", ">", "logHandlerIds", ")", "{", "boolean", "logNormally", "=", "false", ";", "for", "(", "String", "id", ":", "logHandlerIds", ")", "{", "if", "(", "id", ".", "equals", "(", "\"DEFAULT\"", ")", ")", "{", "// DEFAULT is still in the list, so we should tell the caller to also log ", "// the message normally.", "logNormally", "=", "true", ";", "}", "else", "{", "routeTo", "(", "msg", ",", "logRecord", ",", "id", ")", ";", "}", "}", "return", "logNormally", ";", "}" ]
Route the message to all LogHandlers in the set. @return true if the set contained DEFAULT, which means the msg should be logged normally as well. false otherwise.
[ "Route", "the", "message", "to", "all", "LogHandlers", "in", "the", "set", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/MessageRouterImpl.java#L255-L270
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/key/reader/PrivateKeyReader.java
PrivateKeyReader.readPemPrivateKey
public static PrivateKey readPemPrivateKey(final String privateKeyAsString, final String algorithm) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException { """ Reads the given {@link String}( in *.pem format) with given algorithm and returns the {@link PrivateKey} object. @param privateKeyAsString the private key as string( in *.pem format) @param algorithm the algorithm @return the {@link PrivateKey} object @throws NoSuchAlgorithmException is thrown if instantiation of the SecretKeyFactory object fails. @throws InvalidKeySpecException is thrown if generation of the SecretKey object fails. @throws NoSuchProviderException is thrown if the specified provider is not registered in the security provider list. """ final byte[] decoded = new Base64().decode(privateKeyAsString); return readPrivateKey(decoded, algorithm); }
java
public static PrivateKey readPemPrivateKey(final String privateKeyAsString, final String algorithm) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException { final byte[] decoded = new Base64().decode(privateKeyAsString); return readPrivateKey(decoded, algorithm); }
[ "public", "static", "PrivateKey", "readPemPrivateKey", "(", "final", "String", "privateKeyAsString", ",", "final", "String", "algorithm", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", ",", "NoSuchProviderException", "{", "final", "byte", "[", "]", "decoded", "=", "new", "Base64", "(", ")", ".", "decode", "(", "privateKeyAsString", ")", ";", "return", "readPrivateKey", "(", "decoded", ",", "algorithm", ")", ";", "}" ]
Reads the given {@link String}( in *.pem format) with given algorithm and returns the {@link PrivateKey} object. @param privateKeyAsString the private key as string( in *.pem format) @param algorithm the algorithm @return the {@link PrivateKey} object @throws NoSuchAlgorithmException is thrown if instantiation of the SecretKeyFactory object fails. @throws InvalidKeySpecException is thrown if generation of the SecretKey object fails. @throws NoSuchProviderException is thrown if the specified provider is not registered in the security provider list.
[ "Reads", "the", "given", "{", "@link", "String", "}", "(", "in", "*", ".", "pem", "format", ")", "with", "given", "algorithm", "and", "returns", "the", "{", "@link", "PrivateKey", "}", "object", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/reader/PrivateKeyReader.java#L307-L313
hugegraph/hugegraph-common
src/main/java/com/baidu/hugegraph/util/VersionUtil.java
VersionUtil.match
public static boolean match(Version version, String begin, String end) { """ Compare if a version is inside a range [begin, end) @param version The version to be compared @param begin The lower bound of the range @param end The upper bound of the range @return true if belong to the range, otherwise false """ E.checkArgumentNotNull(version, "The version to match is null"); return version.compareTo(new Version(begin)) >= 0 && version.compareTo(new Version(end)) < 0; }
java
public static boolean match(Version version, String begin, String end) { E.checkArgumentNotNull(version, "The version to match is null"); return version.compareTo(new Version(begin)) >= 0 && version.compareTo(new Version(end)) < 0; }
[ "public", "static", "boolean", "match", "(", "Version", "version", ",", "String", "begin", ",", "String", "end", ")", "{", "E", ".", "checkArgumentNotNull", "(", "version", ",", "\"The version to match is null\"", ")", ";", "return", "version", ".", "compareTo", "(", "new", "Version", "(", "begin", ")", ")", ">=", "0", "&&", "version", ".", "compareTo", "(", "new", "Version", "(", "end", ")", ")", "<", "0", ";", "}" ]
Compare if a version is inside a range [begin, end) @param version The version to be compared @param begin The lower bound of the range @param end The upper bound of the range @return true if belong to the range, otherwise false
[ "Compare", "if", "a", "version", "is", "inside", "a", "range", "[", "begin", "end", ")" ]
train
https://github.com/hugegraph/hugegraph-common/blob/1eb2414134b639a13f68ca352c1b3eb2d956e7b2/src/main/java/com/baidu/hugegraph/util/VersionUtil.java#L38-L42
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/user/UserCoreDao.java
UserCoreDao.queryForChunk
public TResult queryForChunk(int limit, long offset) { """ Query for id ordered rows starting at the offset and returning no more than the limit. @param limit chunk limit @param offset chunk query offset @return result @since 3.1.0 """ return queryForChunk(table.getPkColumn().getName(), limit, offset); }
java
public TResult queryForChunk(int limit, long offset) { return queryForChunk(table.getPkColumn().getName(), limit, offset); }
[ "public", "TResult", "queryForChunk", "(", "int", "limit", ",", "long", "offset", ")", "{", "return", "queryForChunk", "(", "table", ".", "getPkColumn", "(", ")", ".", "getName", "(", ")", ",", "limit", ",", "offset", ")", ";", "}" ]
Query for id ordered rows starting at the offset and returning no more than the limit. @param limit chunk limit @param offset chunk query offset @return result @since 3.1.0
[ "Query", "for", "id", "ordered", "rows", "starting", "at", "the", "offset", "and", "returning", "no", "more", "than", "the", "limit", "." ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserCoreDao.java#L487-L489
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/FileServersInner.java
FileServersInner.beginCreate
public FileServerInner beginCreate(String resourceGroupName, String fileServerName, FileServerCreateParameters parameters) { """ Creates a file server. @param resourceGroupName Name of the resource group to which the resource belongs. @param fileServerName The name of the file server within the specified resource group. File server names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param parameters The parameters to provide for file server creation. @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 FileServerInner object if successful. """ return beginCreateWithServiceResponseAsync(resourceGroupName, fileServerName, parameters).toBlocking().single().body(); }
java
public FileServerInner beginCreate(String resourceGroupName, String fileServerName, FileServerCreateParameters parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, fileServerName, parameters).toBlocking().single().body(); }
[ "public", "FileServerInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "fileServerName", ",", "FileServerCreateParameters", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ",", "fileServerName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a file server. @param resourceGroupName Name of the resource group to which the resource belongs. @param fileServerName The name of the file server within the specified resource group. File server names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param parameters The parameters to provide for file server creation. @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 FileServerInner object if successful.
[ "Creates", "a", "file", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/FileServersInner.java#L196-L198
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java
JSONConverter.writeJMX
public void writeJMX(OutputStream out, JMXServerInfo value) throws IOException { """ Encode a JMX instance as JSON: { "version" : Integer, "mbeans" : URL, "createMBean" : URL, "mbeanCount" : URL, "defaultDomain" : URL, "domains" : URL, "notifications" : URL, "instanceOf" : URL } @param out The stream to write JSON to @param value The JMX instance to encode. Can't be null. @throws IOException If an I/O error occurs @see #readJMX(InputStream) """ writeStartObject(out); writeIntField(out, OM_VERSION, value.version); writeStringField(out, OM_MBEANS, value.mbeansURL); writeStringField(out, OM_CREATEMBEAN, value.createMBeanURL); writeStringField(out, OM_MBEANCOUNT, value.mbeanCountURL); writeStringField(out, OM_DEFAULTDOMAIN, value.defaultDomainURL); writeStringField(out, OM_DOMAINS, value.domainsURL); writeStringField(out, OM_NOTIFICATIONS, value.notificationsURL); writeStringField(out, OM_INSTANCEOF, value.instanceOfURL); writeStringField(out, OM_FILE_TRANSFER, value.fileTransferURL); writeStringField(out, OM_API, value.apiURL); writeStringField(out, OM_GRAPH, value.graphURL); writeEndObject(out); }
java
public void writeJMX(OutputStream out, JMXServerInfo value) throws IOException { writeStartObject(out); writeIntField(out, OM_VERSION, value.version); writeStringField(out, OM_MBEANS, value.mbeansURL); writeStringField(out, OM_CREATEMBEAN, value.createMBeanURL); writeStringField(out, OM_MBEANCOUNT, value.mbeanCountURL); writeStringField(out, OM_DEFAULTDOMAIN, value.defaultDomainURL); writeStringField(out, OM_DOMAINS, value.domainsURL); writeStringField(out, OM_NOTIFICATIONS, value.notificationsURL); writeStringField(out, OM_INSTANCEOF, value.instanceOfURL); writeStringField(out, OM_FILE_TRANSFER, value.fileTransferURL); writeStringField(out, OM_API, value.apiURL); writeStringField(out, OM_GRAPH, value.graphURL); writeEndObject(out); }
[ "public", "void", "writeJMX", "(", "OutputStream", "out", ",", "JMXServerInfo", "value", ")", "throws", "IOException", "{", "writeStartObject", "(", "out", ")", ";", "writeIntField", "(", "out", ",", "OM_VERSION", ",", "value", ".", "version", ")", ";", "writeStringField", "(", "out", ",", "OM_MBEANS", ",", "value", ".", "mbeansURL", ")", ";", "writeStringField", "(", "out", ",", "OM_CREATEMBEAN", ",", "value", ".", "createMBeanURL", ")", ";", "writeStringField", "(", "out", ",", "OM_MBEANCOUNT", ",", "value", ".", "mbeanCountURL", ")", ";", "writeStringField", "(", "out", ",", "OM_DEFAULTDOMAIN", ",", "value", ".", "defaultDomainURL", ")", ";", "writeStringField", "(", "out", ",", "OM_DOMAINS", ",", "value", ".", "domainsURL", ")", ";", "writeStringField", "(", "out", ",", "OM_NOTIFICATIONS", ",", "value", ".", "notificationsURL", ")", ";", "writeStringField", "(", "out", ",", "OM_INSTANCEOF", ",", "value", ".", "instanceOfURL", ")", ";", "writeStringField", "(", "out", ",", "OM_FILE_TRANSFER", ",", "value", ".", "fileTransferURL", ")", ";", "writeStringField", "(", "out", ",", "OM_API", ",", "value", ".", "apiURL", ")", ";", "writeStringField", "(", "out", ",", "OM_GRAPH", ",", "value", ".", "graphURL", ")", ";", "writeEndObject", "(", "out", ")", ";", "}" ]
Encode a JMX instance as JSON: { "version" : Integer, "mbeans" : URL, "createMBean" : URL, "mbeanCount" : URL, "defaultDomain" : URL, "domains" : URL, "notifications" : URL, "instanceOf" : URL } @param out The stream to write JSON to @param value The JMX instance to encode. Can't be null. @throws IOException If an I/O error occurs @see #readJMX(InputStream)
[ "Encode", "a", "JMX", "instance", "as", "JSON", ":", "{", "version", ":", "Integer", "mbeans", ":", "URL", "createMBean", ":", "URL", "mbeanCount", ":", "URL", "defaultDomain", ":", "URL", "domains", ":", "URL", "notifications", ":", "URL", "instanceOf", ":", "URL", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L963-L977
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.matchesFingerprint
private boolean matchesFingerprint(byte[] buffer, Pattern fingerprint) { """ Determine if the buffer, when expressed as text, matches a fingerprint regular expression. @param buffer bytes from file @param fingerprint fingerprint regular expression @return true if the file matches the fingerprint """ return fingerprint.matcher(m_charset == null ? new String(buffer) : new String(buffer, m_charset)).matches(); }
java
private boolean matchesFingerprint(byte[] buffer, Pattern fingerprint) { return fingerprint.matcher(m_charset == null ? new String(buffer) : new String(buffer, m_charset)).matches(); }
[ "private", "boolean", "matchesFingerprint", "(", "byte", "[", "]", "buffer", ",", "Pattern", "fingerprint", ")", "{", "return", "fingerprint", ".", "matcher", "(", "m_charset", "==", "null", "?", "new", "String", "(", "buffer", ")", ":", "new", "String", "(", "buffer", ",", "m_charset", ")", ")", ".", "matches", "(", ")", ";", "}" ]
Determine if the buffer, when expressed as text, matches a fingerprint regular expression. @param buffer bytes from file @param fingerprint fingerprint regular expression @return true if the file matches the fingerprint
[ "Determine", "if", "the", "buffer", "when", "expressed", "as", "text", "matches", "a", "fingerprint", "regular", "expression", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L341-L344
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java
Item.withBigInteger
public Item withBigInteger(String attrName, BigInteger val) { """ Sets the value of the specified attribute in the current item to the given value. """ checkInvalidAttrName(attrName); return withNumber(attrName, val); }
java
public Item withBigInteger(String attrName, BigInteger val) { checkInvalidAttrName(attrName); return withNumber(attrName, val); }
[ "public", "Item", "withBigInteger", "(", "String", "attrName", ",", "BigInteger", "val", ")", "{", "checkInvalidAttrName", "(", "attrName", ")", ";", "return", "withNumber", "(", "attrName", ",", "val", ")", ";", "}" ]
Sets the value of the specified attribute in the current item to the given value.
[ "Sets", "the", "value", "of", "the", "specified", "attribute", "in", "the", "current", "item", "to", "the", "given", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java#L296-L299
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java
CommonUtils.parseInt
public static int parseInt(String num, int defaultInt) { """ 字符串转数值 @param num 数字 @param defaultInt 默认值 @return int """ if (num == null) { return defaultInt; } else { try { return Integer.parseInt(num); } catch (Exception e) { return defaultInt; } } }
java
public static int parseInt(String num, int defaultInt) { if (num == null) { return defaultInt; } else { try { return Integer.parseInt(num); } catch (Exception e) { return defaultInt; } } }
[ "public", "static", "int", "parseInt", "(", "String", "num", ",", "int", "defaultInt", ")", "{", "if", "(", "num", "==", "null", ")", "{", "return", "defaultInt", ";", "}", "else", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "num", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "defaultInt", ";", "}", "}", "}" ]
字符串转数值 @param num 数字 @param defaultInt 默认值 @return int
[ "字符串转数值" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java#L166-L176
CrawlScript/WebCollector
src/main/java/cn/edu/hfut/dmic/webcollector/example/DemoAnnotatedBingCrawler.java
DemoAnnotatedBingCrawler.visitRedirect
@MatchCode(codes = { """ you have to copy it to the added task by "xxxx.meta(page.copyMeta())" """301, 302}) public void visitRedirect(Page page, CrawlDatums next){ try { // page.location() may be relative url path // we have to construct an absolute url path String redirectUrl = new URL(new URL(page.url()), page.location()).toExternalForm(); next.addAndReturn(redirectUrl).meta(page.copyMeta()); } catch (MalformedURLException e) { //the way to handle exceptions in WebCollector ExceptionUtils.fail(e); } }
java
@MatchCode(codes = {301, 302}) public void visitRedirect(Page page, CrawlDatums next){ try { // page.location() may be relative url path // we have to construct an absolute url path String redirectUrl = new URL(new URL(page.url()), page.location()).toExternalForm(); next.addAndReturn(redirectUrl).meta(page.copyMeta()); } catch (MalformedURLException e) { //the way to handle exceptions in WebCollector ExceptionUtils.fail(e); } }
[ "@", "MatchCode", "(", "codes", "=", "{", "301", ",", "302", "}", ")", "public", "void", "visitRedirect", "(", "Page", "page", ",", "CrawlDatums", "next", ")", "{", "try", "{", "// page.location() may be relative url path", "// we have to construct an absolute url path", "String", "redirectUrl", "=", "new", "URL", "(", "new", "URL", "(", "page", ".", "url", "(", ")", ")", ",", "page", ".", "location", "(", ")", ")", ".", "toExternalForm", "(", ")", ";", "next", ".", "addAndReturn", "(", "redirectUrl", ")", ".", "meta", "(", "page", ".", "copyMeta", "(", ")", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "//the way to handle exceptions in WebCollector", "ExceptionUtils", ".", "fail", "(", "e", ")", ";", "}", "}" ]
you have to copy it to the added task by "xxxx.meta(page.copyMeta())"
[ "you", "have", "to", "copy", "it", "to", "the", "added", "task", "by", "xxxx", ".", "meta", "(", "page", ".", "copyMeta", "()", ")" ]
train
https://github.com/CrawlScript/WebCollector/blob/4ca71ec0e69d354feaf64319d76e64663159902d/src/main/java/cn/edu/hfut/dmic/webcollector/example/DemoAnnotatedBingCrawler.java#L71-L82
knowm/XChart
xchart/src/main/java/org/knowm/xchart/QuickChart.java
QuickChart.getChart
public static XYChart getChart( String chartTitle, String xTitle, String yTitle, String[] seriesNames, double[] xData, double[][] yData) { """ Creates a Chart with multiple Series for the same X-Axis data with default style @param chartTitle the Chart title @param xTitle The X-Axis title @param yTitle The Y-Axis title @param seriesNames An array of the name of the multiple series @param xData An array containing the X-Axis data @param yData An array of double arrays containing multiple Y-Axis data @return a Chart Object """ // Create Chart XYChart chart = new XYChart(WIDTH, HEIGHT); // Customize Chart chart.setTitle(chartTitle); chart.setXAxisTitle(xTitle); chart.setYAxisTitle(yTitle); // Series for (int i = 0; i < yData.length; i++) { XYSeries series; if (seriesNames != null) { series = chart.addSeries(seriesNames[i], xData, yData[i]); } else { chart.getStyler().setLegendVisible(false); series = chart.addSeries(" " + i, xData, yData[i]); } series.setMarker(SeriesMarkers.NONE); } return chart; }
java
public static XYChart getChart( String chartTitle, String xTitle, String yTitle, String[] seriesNames, double[] xData, double[][] yData) { // Create Chart XYChart chart = new XYChart(WIDTH, HEIGHT); // Customize Chart chart.setTitle(chartTitle); chart.setXAxisTitle(xTitle); chart.setYAxisTitle(yTitle); // Series for (int i = 0; i < yData.length; i++) { XYSeries series; if (seriesNames != null) { series = chart.addSeries(seriesNames[i], xData, yData[i]); } else { chart.getStyler().setLegendVisible(false); series = chart.addSeries(" " + i, xData, yData[i]); } series.setMarker(SeriesMarkers.NONE); } return chart; }
[ "public", "static", "XYChart", "getChart", "(", "String", "chartTitle", ",", "String", "xTitle", ",", "String", "yTitle", ",", "String", "[", "]", "seriesNames", ",", "double", "[", "]", "xData", ",", "double", "[", "]", "[", "]", "yData", ")", "{", "// Create Chart", "XYChart", "chart", "=", "new", "XYChart", "(", "WIDTH", ",", "HEIGHT", ")", ";", "// Customize Chart", "chart", ".", "setTitle", "(", "chartTitle", ")", ";", "chart", ".", "setXAxisTitle", "(", "xTitle", ")", ";", "chart", ".", "setYAxisTitle", "(", "yTitle", ")", ";", "// Series", "for", "(", "int", "i", "=", "0", ";", "i", "<", "yData", ".", "length", ";", "i", "++", ")", "{", "XYSeries", "series", ";", "if", "(", "seriesNames", "!=", "null", ")", "{", "series", "=", "chart", ".", "addSeries", "(", "seriesNames", "[", "i", "]", ",", "xData", ",", "yData", "[", "i", "]", ")", ";", "}", "else", "{", "chart", ".", "getStyler", "(", ")", ".", "setLegendVisible", "(", "false", ")", ";", "series", "=", "chart", ".", "addSeries", "(", "\" \"", "+", "i", ",", "xData", ",", "yData", "[", "i", "]", ")", ";", "}", "series", ".", "setMarker", "(", "SeriesMarkers", ".", "NONE", ")", ";", "}", "return", "chart", ";", "}" ]
Creates a Chart with multiple Series for the same X-Axis data with default style @param chartTitle the Chart title @param xTitle The X-Axis title @param yTitle The Y-Axis title @param seriesNames An array of the name of the multiple series @param xData An array containing the X-Axis data @param yData An array of double arrays containing multiple Y-Axis data @return a Chart Object
[ "Creates", "a", "Chart", "with", "multiple", "Series", "for", "the", "same", "X", "-", "Axis", "data", "with", "default", "style" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/QuickChart.java#L57-L85
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java
ExtendedByteBuf.readMaybeString
public static Optional<String> readMaybeString(ByteBuf bf) { """ Reads a string if possible. If not present the reader index is reset to the last mark. @param bf @return """ Optional<byte[]> bytes = readMaybeRangedBytes(bf); return bytes.map(b -> { if (b.length == 0) return ""; else return new String(b, CharsetUtil.UTF_8); }); }
java
public static Optional<String> readMaybeString(ByteBuf bf) { Optional<byte[]> bytes = readMaybeRangedBytes(bf); return bytes.map(b -> { if (b.length == 0) return ""; else return new String(b, CharsetUtil.UTF_8); }); }
[ "public", "static", "Optional", "<", "String", ">", "readMaybeString", "(", "ByteBuf", "bf", ")", "{", "Optional", "<", "byte", "[", "]", ">", "bytes", "=", "readMaybeRangedBytes", "(", "bf", ")", ";", "return", "bytes", ".", "map", "(", "b", "->", "{", "if", "(", "b", ".", "length", "==", "0", ")", "return", "\"\"", ";", "else", "return", "new", "String", "(", "b", ",", "CharsetUtil", ".", "UTF_8", ")", ";", "}", ")", ";", "}" ]
Reads a string if possible. If not present the reader index is reset to the last mark. @param bf @return
[ "Reads", "a", "string", "if", "possible", ".", "If", "not", "present", "the", "reader", "index", "is", "reset", "to", "the", "last", "mark", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L244-L250
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/query/LiteralMapList.java
LiteralMapList.select
public LiteralMapList select(String key, Object value) { """ Answer a LiteralMapList containing only literal maps with the given key and value @param key @param value @return """ LiteralMapList ret = new LiteralMapList(); for (LiteralMap lm : this) { if (isEqual(value, lm.get(key))) ret.add(lm); } return ret; }
java
public LiteralMapList select(String key, Object value) { LiteralMapList ret = new LiteralMapList(); for (LiteralMap lm : this) { if (isEqual(value, lm.get(key))) ret.add(lm); } return ret; }
[ "public", "LiteralMapList", "select", "(", "String", "key", ",", "Object", "value", ")", "{", "LiteralMapList", "ret", "=", "new", "LiteralMapList", "(", ")", ";", "for", "(", "LiteralMap", "lm", ":", "this", ")", "{", "if", "(", "isEqual", "(", "value", ",", "lm", ".", "get", "(", "key", ")", ")", ")", "ret", ".", "add", "(", "lm", ")", ";", "}", "return", "ret", ";", "}" ]
Answer a LiteralMapList containing only literal maps with the given key and value @param key @param value @return
[ "Answer", "a", "LiteralMapList", "containing", "only", "literal", "maps", "with", "the", "given", "key", "and", "value" ]
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/LiteralMapList.java#L62-L69
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsMessages.java
CmsMessages.getRegEx
private static String getRegEx(int position, String... options) { """ Returns a regular expression for replacement.<p> @param position the parameter number @param options the optional options @return the regular expression for replacement """ String value = "" + position; for (int i = 0; i < options.length; i++) { value += "," + options[i]; } return "{" + value + "}"; }
java
private static String getRegEx(int position, String... options) { String value = "" + position; for (int i = 0; i < options.length; i++) { value += "," + options[i]; } return "{" + value + "}"; }
[ "private", "static", "String", "getRegEx", "(", "int", "position", ",", "String", "...", "options", ")", "{", "String", "value", "=", "\"\"", "+", "position", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "options", ".", "length", ";", "i", "++", ")", "{", "value", "+=", "\",\"", "+", "options", "[", "i", "]", ";", "}", "return", "\"{\"", "+", "value", "+", "\"}\"", ";", "}" ]
Returns a regular expression for replacement.<p> @param position the parameter number @param options the optional options @return the regular expression for replacement
[ "Returns", "a", "regular", "expression", "for", "replacement", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsMessages.java#L179-L186
haifengl/smile
core/src/main/java/smile/regression/NeuralNetwork.java
NeuralNetwork.backpropagate
private void backpropagate(Layer upper, Layer lower) { """ Propagates the errors back from a upper layer to the next lower layer. @param upper the lower layer where errors are from. @param lower the upper layer where errors are propagated back to. """ for (int i = 0; i <= lower.units; i++) { double out = lower.output[i]; double err = 0; for (int j = 0; j < upper.units; j++) { err += upper.weight[j][i] * upper.error[j]; } if (activationFunction==ActivationFunction.LOGISTIC_SIGMOID) { lower.error[i] = out * (1.0 - out) * err; } else if (activationFunction==ActivationFunction.TANH){ lower.error[i] = (1-(out*out))*err; } } }
java
private void backpropagate(Layer upper, Layer lower) { for (int i = 0; i <= lower.units; i++) { double out = lower.output[i]; double err = 0; for (int j = 0; j < upper.units; j++) { err += upper.weight[j][i] * upper.error[j]; } if (activationFunction==ActivationFunction.LOGISTIC_SIGMOID) { lower.error[i] = out * (1.0 - out) * err; } else if (activationFunction==ActivationFunction.TANH){ lower.error[i] = (1-(out*out))*err; } } }
[ "private", "void", "backpropagate", "(", "Layer", "upper", ",", "Layer", "lower", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "lower", ".", "units", ";", "i", "++", ")", "{", "double", "out", "=", "lower", ".", "output", "[", "i", "]", ";", "double", "err", "=", "0", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "upper", ".", "units", ";", "j", "++", ")", "{", "err", "+=", "upper", ".", "weight", "[", "j", "]", "[", "i", "]", "*", "upper", ".", "error", "[", "j", "]", ";", "}", "if", "(", "activationFunction", "==", "ActivationFunction", ".", "LOGISTIC_SIGMOID", ")", "{", "lower", ".", "error", "[", "i", "]", "=", "out", "*", "(", "1.0", "-", "out", ")", "*", "err", ";", "}", "else", "if", "(", "activationFunction", "==", "ActivationFunction", ".", "TANH", ")", "{", "lower", ".", "error", "[", "i", "]", "=", "(", "1", "-", "(", "out", "*", "out", ")", ")", "*", "err", ";", "}", "}", "}" ]
Propagates the errors back from a upper layer to the next lower layer. @param upper the lower layer where errors are from. @param lower the upper layer where errors are propagated back to.
[ "Propagates", "the", "errors", "back", "from", "a", "upper", "layer", "to", "the", "next", "lower", "layer", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/regression/NeuralNetwork.java#L496-L510
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/LimitedTemporaryStorage.java
LimitedTemporaryStorage.createFile
public LimitedOutputStream createFile() throws IOException { """ Create a new temporary file. All methods of the returned output stream may throw {@link TemporaryStorageFullException} if the temporary storage area fills up. @return output stream to the file @throws TemporaryStorageFullException if the temporary storage area is full @throws IOException if something goes wrong while creating the file """ if (bytesUsed.get() >= maxBytesUsed) { throw new TemporaryStorageFullException(maxBytesUsed); } synchronized (files) { if (closed) { throw new ISE("Closed"); } FileUtils.forceMkdir(storageDirectory); if (!createdStorageDirectory) { createdStorageDirectory = true; } final File theFile = new File(storageDirectory, StringUtils.format("%08d.tmp", files.size())); final EnumSet<StandardOpenOption> openOptions = EnumSet.of( StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE ); final FileChannel channel = FileChannel.open(theFile.toPath(), openOptions); files.add(theFile); return new LimitedOutputStream(theFile, Channels.newOutputStream(channel)); } }
java
public LimitedOutputStream createFile() throws IOException { if (bytesUsed.get() >= maxBytesUsed) { throw new TemporaryStorageFullException(maxBytesUsed); } synchronized (files) { if (closed) { throw new ISE("Closed"); } FileUtils.forceMkdir(storageDirectory); if (!createdStorageDirectory) { createdStorageDirectory = true; } final File theFile = new File(storageDirectory, StringUtils.format("%08d.tmp", files.size())); final EnumSet<StandardOpenOption> openOptions = EnumSet.of( StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE ); final FileChannel channel = FileChannel.open(theFile.toPath(), openOptions); files.add(theFile); return new LimitedOutputStream(theFile, Channels.newOutputStream(channel)); } }
[ "public", "LimitedOutputStream", "createFile", "(", ")", "throws", "IOException", "{", "if", "(", "bytesUsed", ".", "get", "(", ")", ">=", "maxBytesUsed", ")", "{", "throw", "new", "TemporaryStorageFullException", "(", "maxBytesUsed", ")", ";", "}", "synchronized", "(", "files", ")", "{", "if", "(", "closed", ")", "{", "throw", "new", "ISE", "(", "\"Closed\"", ")", ";", "}", "FileUtils", ".", "forceMkdir", "(", "storageDirectory", ")", ";", "if", "(", "!", "createdStorageDirectory", ")", "{", "createdStorageDirectory", "=", "true", ";", "}", "final", "File", "theFile", "=", "new", "File", "(", "storageDirectory", ",", "StringUtils", ".", "format", "(", "\"%08d.tmp\"", ",", "files", ".", "size", "(", ")", ")", ")", ";", "final", "EnumSet", "<", "StandardOpenOption", ">", "openOptions", "=", "EnumSet", ".", "of", "(", "StandardOpenOption", ".", "CREATE_NEW", ",", "StandardOpenOption", ".", "WRITE", ")", ";", "final", "FileChannel", "channel", "=", "FileChannel", ".", "open", "(", "theFile", ".", "toPath", "(", ")", ",", "openOptions", ")", ";", "files", ".", "add", "(", "theFile", ")", ";", "return", "new", "LimitedOutputStream", "(", "theFile", ",", "Channels", ".", "newOutputStream", "(", "channel", ")", ")", ";", "}", "}" ]
Create a new temporary file. All methods of the returned output stream may throw {@link TemporaryStorageFullException} if the temporary storage area fills up. @return output stream to the file @throws TemporaryStorageFullException if the temporary storage area is full @throws IOException if something goes wrong while creating the file
[ "Create", "a", "new", "temporary", "file", ".", "All", "methods", "of", "the", "returned", "output", "stream", "may", "throw", "{", "@link", "TemporaryStorageFullException", "}", "if", "the", "temporary", "storage", "area", "fills", "up", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/LimitedTemporaryStorage.java#L74-L100
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/descriptors/ClasspathScanDescriptorProvider.java
ClasspathScanDescriptorProvider.scanPackage
public ClasspathScanDescriptorProvider scanPackage(final String packageName, final boolean recursive, final ClassLoader classLoader) { """ Scans a package in the classpath (of a particular classloader) for annotated components. @param packageName the package name to scan @param recursive whether or not to scan subpackages recursively @param classLoader the classloader to use @return """ return scanPackage(packageName, recursive, classLoader, true); }
java
public ClasspathScanDescriptorProvider scanPackage(final String packageName, final boolean recursive, final ClassLoader classLoader) { return scanPackage(packageName, recursive, classLoader, true); }
[ "public", "ClasspathScanDescriptorProvider", "scanPackage", "(", "final", "String", "packageName", ",", "final", "boolean", "recursive", ",", "final", "ClassLoader", "classLoader", ")", "{", "return", "scanPackage", "(", "packageName", ",", "recursive", ",", "classLoader", ",", "true", ")", ";", "}" ]
Scans a package in the classpath (of a particular classloader) for annotated components. @param packageName the package name to scan @param recursive whether or not to scan subpackages recursively @param classLoader the classloader to use @return
[ "Scans", "a", "package", "in", "the", "classpath", "(", "of", "a", "particular", "classloader", ")", "for", "annotated", "components", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/descriptors/ClasspathScanDescriptorProvider.java#L191-L194
liferay/com-liferay-commerce
commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java
CommerceCurrencyPersistenceImpl.findByG_C
@Override public CommerceCurrency findByG_C(long groupId, String code) throws NoSuchCurrencyException { """ Returns the commerce currency where groupId = &#63; and code = &#63; or throws a {@link NoSuchCurrencyException} if it could not be found. @param groupId the group ID @param code the code @return the matching commerce currency @throws NoSuchCurrencyException if a matching commerce currency could not be found """ CommerceCurrency commerceCurrency = fetchByG_C(groupId, code); if (commerceCurrency == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", code="); msg.append(code); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCurrencyException(msg.toString()); } return commerceCurrency; }
java
@Override public CommerceCurrency findByG_C(long groupId, String code) throws NoSuchCurrencyException { CommerceCurrency commerceCurrency = fetchByG_C(groupId, code); if (commerceCurrency == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", code="); msg.append(code); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCurrencyException(msg.toString()); } return commerceCurrency; }
[ "@", "Override", "public", "CommerceCurrency", "findByG_C", "(", "long", "groupId", ",", "String", "code", ")", "throws", "NoSuchCurrencyException", "{", "CommerceCurrency", "commerceCurrency", "=", "fetchByG_C", "(", "groupId", ",", "code", ")", ";", "if", "(", "commerceCurrency", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"groupId=\"", ")", ";", "msg", ".", "append", "(", "groupId", ")", ";", "msg", ".", "append", "(", "\", code=\"", ")", ";", "msg", ".", "append", "(", "code", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchCurrencyException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "commerceCurrency", ";", "}" ]
Returns the commerce currency where groupId = &#63; and code = &#63; or throws a {@link NoSuchCurrencyException} if it could not be found. @param groupId the group ID @param code the code @return the matching commerce currency @throws NoSuchCurrencyException if a matching commerce currency could not be found
[ "Returns", "the", "commerce", "currency", "where", "groupId", "=", "&#63", ";", "and", "code", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCurrencyException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L2011-L2037
lucee/Lucee
core/src/main/java/lucee/commons/io/log/log4j/appender/ResourceAppender.java
ResourceAppender.setFile
protected void setFile(boolean append) throws IOException { """ <p> Sets and <i>opens</i> the file where the log output will go. The specified file must be writable. <p> If there was already an opened file, then the previous file is closed first. <p> <b>Do not use this method directly. To configure a FileAppender or one of its subclasses, set its properties one by one and then call activateOptions.</b> @param fileName The path to the log file. @param append If true will append to fileName. Otherwise will truncate fileName. """ synchronized (sync) { LogLog.debug("setFile called: " + res + ", " + append); // It does not make sense to have immediate flush and bufferedIO. if (bufferedIO) { setImmediateFlush(false); } reset(); Resource parent = res.getParentResource(); if (!parent.exists()) parent.createDirectory(true); boolean writeHeader = !append || res.length() == 0;// this must happen before we open the stream Writer fw = createWriter(new RetireOutputStream(res, append, timeout, listener)); if (bufferedIO) { fw = new BufferedWriter(fw, bufferSize); } this.setQWForFiles(fw); if (writeHeader) writeHeader(); LogLog.debug("setFile ended"); } }
java
protected void setFile(boolean append) throws IOException { synchronized (sync) { LogLog.debug("setFile called: " + res + ", " + append); // It does not make sense to have immediate flush and bufferedIO. if (bufferedIO) { setImmediateFlush(false); } reset(); Resource parent = res.getParentResource(); if (!parent.exists()) parent.createDirectory(true); boolean writeHeader = !append || res.length() == 0;// this must happen before we open the stream Writer fw = createWriter(new RetireOutputStream(res, append, timeout, listener)); if (bufferedIO) { fw = new BufferedWriter(fw, bufferSize); } this.setQWForFiles(fw); if (writeHeader) writeHeader(); LogLog.debug("setFile ended"); } }
[ "protected", "void", "setFile", "(", "boolean", "append", ")", "throws", "IOException", "{", "synchronized", "(", "sync", ")", "{", "LogLog", ".", "debug", "(", "\"setFile called: \"", "+", "res", "+", "\", \"", "+", "append", ")", ";", "// It does not make sense to have immediate flush and bufferedIO.", "if", "(", "bufferedIO", ")", "{", "setImmediateFlush", "(", "false", ")", ";", "}", "reset", "(", ")", ";", "Resource", "parent", "=", "res", ".", "getParentResource", "(", ")", ";", "if", "(", "!", "parent", ".", "exists", "(", ")", ")", "parent", ".", "createDirectory", "(", "true", ")", ";", "boolean", "writeHeader", "=", "!", "append", "||", "res", ".", "length", "(", ")", "==", "0", ";", "// this must happen before we open the stream", "Writer", "fw", "=", "createWriter", "(", "new", "RetireOutputStream", "(", "res", ",", "append", ",", "timeout", ",", "listener", ")", ")", ";", "if", "(", "bufferedIO", ")", "{", "fw", "=", "new", "BufferedWriter", "(", "fw", ",", "bufferSize", ")", ";", "}", "this", ".", "setQWForFiles", "(", "fw", ")", ";", "if", "(", "writeHeader", ")", "writeHeader", "(", ")", ";", "LogLog", ".", "debug", "(", "\"setFile ended\"", ")", ";", "}", "}" ]
<p> Sets and <i>opens</i> the file where the log output will go. The specified file must be writable. <p> If there was already an opened file, then the previous file is closed first. <p> <b>Do not use this method directly. To configure a FileAppender or one of its subclasses, set its properties one by one and then call activateOptions.</b> @param fileName The path to the log file. @param append If true will append to fileName. Otherwise will truncate fileName.
[ "<p", ">", "Sets", "and", "<i", ">", "opens<", "/", "i", ">", "the", "file", "where", "the", "log", "output", "will", "go", ".", "The", "specified", "file", "must", "be", "writable", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/log/log4j/appender/ResourceAppender.java#L191-L212
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_vrack_network_vrackNetworkId_DELETE
public void serviceName_vrack_network_vrackNetworkId_DELETE(String serviceName, Long vrackNetworkId) throws IOException { """ Delete this description of a private network in the vRack. It must not be used by any farm server REST: DELETE /ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId} @param serviceName [required] The internal name of your IP load balancing @param vrackNetworkId [required] Internal Load Balancer identifier of the vRack private network description API beta """ String qPath = "/ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}"; StringBuilder sb = path(qPath, serviceName, vrackNetworkId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void serviceName_vrack_network_vrackNetworkId_DELETE(String serviceName, Long vrackNetworkId) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}"; StringBuilder sb = path(qPath, serviceName, vrackNetworkId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "serviceName_vrack_network_vrackNetworkId_DELETE", "(", "String", "serviceName", ",", "Long", "vrackNetworkId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "vrackNetworkId", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete this description of a private network in the vRack. It must not be used by any farm server REST: DELETE /ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId} @param serviceName [required] The internal name of your IP load balancing @param vrackNetworkId [required] Internal Load Balancer identifier of the vRack private network description API beta
[ "Delete", "this", "description", "of", "a", "private", "network", "in", "the", "vRack", ".", "It", "must", "not", "be", "used", "by", "any", "farm", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1141-L1145
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java
PubSubManager.createNode
public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Creates an instant node, if supported. @return The node that was created @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException """ PubSub reply = sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.CREATE), null); NodeExtension elem = reply.getExtension("create", PubSubNamespace.basic.getXmlns()); LeafNode newNode = new LeafNode(this, elem.getNode()); nodeMap.put(newNode.getId(), newNode); return newNode; }
java
public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub reply = sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.CREATE), null); NodeExtension elem = reply.getExtension("create", PubSubNamespace.basic.getXmlns()); LeafNode newNode = new LeafNode(this, elem.getNode()); nodeMap.put(newNode.getId(), newNode); return newNode; }
[ "public", "LeafNode", "createNode", "(", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "PubSub", "reply", "=", "sendPubsubPacket", "(", "Type", ".", "set", ",", "new", "NodeExtension", "(", "PubSubElementType", ".", "CREATE", ")", ",", "null", ")", ";", "NodeExtension", "elem", "=", "reply", ".", "getExtension", "(", "\"create\"", ",", "PubSubNamespace", ".", "basic", ".", "getXmlns", "(", ")", ")", ";", "LeafNode", "newNode", "=", "new", "LeafNode", "(", "this", ",", "elem", ".", "getNode", "(", ")", ")", ";", "nodeMap", ".", "put", "(", "newNode", ".", "getId", "(", ")", ",", "newNode", ")", ";", "return", "newNode", ";", "}" ]
Creates an instant node, if supported. @return The node that was created @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Creates", "an", "instant", "node", "if", "supported", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java#L197-L205
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXField
public static XField createXField(@DottedClassName String className, String fieldName, String fieldSignature, boolean isStatic) { """ Create an XField object @param className @param fieldName @param fieldSignature @param isStatic @return the created XField """ FieldDescriptor fieldDesc = DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className), fieldName, fieldSignature, isStatic); return createXField(fieldDesc); }
java
public static XField createXField(@DottedClassName String className, String fieldName, String fieldSignature, boolean isStatic) { FieldDescriptor fieldDesc = DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className), fieldName, fieldSignature, isStatic); return createXField(fieldDesc); }
[ "public", "static", "XField", "createXField", "(", "@", "DottedClassName", "String", "className", ",", "String", "fieldName", ",", "String", "fieldSignature", ",", "boolean", "isStatic", ")", "{", "FieldDescriptor", "fieldDesc", "=", "DescriptorFactory", ".", "instance", "(", ")", ".", "getFieldDescriptor", "(", "ClassName", ".", "toSlashedClassName", "(", "className", ")", ",", "fieldName", ",", "fieldSignature", ",", "isStatic", ")", ";", "return", "createXField", "(", "fieldDesc", ")", ";", "}" ]
Create an XField object @param className @param fieldName @param fieldSignature @param isStatic @return the created XField
[ "Create", "an", "XField", "object" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L459-L464
likethecolor/Alchemy-API
src/main/java/com/likethecolor/alchemy/api/parser/json/KeywordParser.java
KeywordParser.isValidKeyword
private boolean isValidKeyword(final String keyword, final Double score) { """ Return true if at least one of the values is not null/empty. @param keyword the sentiment keyword @param score the sentiment score @return true if at least one of the values is not null/empty """ return !StringUtils.isBlank(keyword) || score != null; }
java
private boolean isValidKeyword(final String keyword, final Double score) { return !StringUtils.isBlank(keyword) || score != null; }
[ "private", "boolean", "isValidKeyword", "(", "final", "String", "keyword", ",", "final", "Double", "score", ")", "{", "return", "!", "StringUtils", ".", "isBlank", "(", "keyword", ")", "||", "score", "!=", "null", ";", "}" ]
Return true if at least one of the values is not null/empty. @param keyword the sentiment keyword @param score the sentiment score @return true if at least one of the values is not null/empty
[ "Return", "true", "if", "at", "least", "one", "of", "the", "values", "is", "not", "null", "/", "empty", "." ]
train
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/KeywordParser.java#L114-L117
alkacon/opencms-core
src-modules/org/opencms/workplace/CmsFrameset.java
CmsFrameset.getViewSelect
public String getViewSelect(String htmlAttributes) { """ Returns a html select box filled with the views accessible by the current user.<p> @param htmlAttributes attributes that will be inserted into the generated html @return a html select box filled with the views accessible by the current user """ List<String> options = new ArrayList<String>(); List<String> values = new ArrayList<String>(); int selectedIndex = 0; // loop through the vectors and fill the result vectors Iterator<CmsWorkplaceView> i = OpenCms.getWorkplaceManager().getViews().iterator(); int count = -1; String currentView = getSettings().getViewUri(); if (CmsStringUtil.isNotEmpty(currentView)) { // remove possible parameters from current view int pos = currentView.indexOf('?'); if (pos >= 0) { currentView = currentView.substring(0, pos); } } while (i.hasNext()) { CmsWorkplaceView view = i.next(); if (getCms().existsResource(view.getUri(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) { count++; // ensure the current user has +v+r permissions on the view String loopLink = getJsp().link(view.getUri()); String localizedKey = resolveMacros(view.getKey()); options.add(localizedKey); values.add(loopLink); if (loopLink.equals(currentView)) { selectedIndex = count; } } } return buildSelect(htmlAttributes, options, values, selectedIndex); }
java
public String getViewSelect(String htmlAttributes) { List<String> options = new ArrayList<String>(); List<String> values = new ArrayList<String>(); int selectedIndex = 0; // loop through the vectors and fill the result vectors Iterator<CmsWorkplaceView> i = OpenCms.getWorkplaceManager().getViews().iterator(); int count = -1; String currentView = getSettings().getViewUri(); if (CmsStringUtil.isNotEmpty(currentView)) { // remove possible parameters from current view int pos = currentView.indexOf('?'); if (pos >= 0) { currentView = currentView.substring(0, pos); } } while (i.hasNext()) { CmsWorkplaceView view = i.next(); if (getCms().existsResource(view.getUri(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) { count++; // ensure the current user has +v+r permissions on the view String loopLink = getJsp().link(view.getUri()); String localizedKey = resolveMacros(view.getKey()); options.add(localizedKey); values.add(loopLink); if (loopLink.equals(currentView)) { selectedIndex = count; } } } return buildSelect(htmlAttributes, options, values, selectedIndex); }
[ "public", "String", "getViewSelect", "(", "String", "htmlAttributes", ")", "{", "List", "<", "String", ">", "options", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "List", "<", "String", ">", "values", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "int", "selectedIndex", "=", "0", ";", "// loop through the vectors and fill the result vectors", "Iterator", "<", "CmsWorkplaceView", ">", "i", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getViews", "(", ")", ".", "iterator", "(", ")", ";", "int", "count", "=", "-", "1", ";", "String", "currentView", "=", "getSettings", "(", ")", ".", "getViewUri", "(", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmpty", "(", "currentView", ")", ")", "{", "// remove possible parameters from current view", "int", "pos", "=", "currentView", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "pos", ">=", "0", ")", "{", "currentView", "=", "currentView", ".", "substring", "(", "0", ",", "pos", ")", ";", "}", "}", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "CmsWorkplaceView", "view", "=", "i", ".", "next", "(", ")", ";", "if", "(", "getCms", "(", ")", ".", "existsResource", "(", "view", ".", "getUri", "(", ")", ",", "CmsResourceFilter", ".", "ONLY_VISIBLE_NO_DELETED", ")", ")", "{", "count", "++", ";", "// ensure the current user has +v+r permissions on the view", "String", "loopLink", "=", "getJsp", "(", ")", ".", "link", "(", "view", ".", "getUri", "(", ")", ")", ";", "String", "localizedKey", "=", "resolveMacros", "(", "view", ".", "getKey", "(", ")", ")", ";", "options", ".", "add", "(", "localizedKey", ")", ";", "values", ".", "add", "(", "loopLink", ")", ";", "if", "(", "loopLink", ".", "equals", "(", "currentView", ")", ")", "{", "selectedIndex", "=", "count", ";", "}", "}", "}", "return", "buildSelect", "(", "htmlAttributes", ",", "options", ",", "values", ",", "selectedIndex", ")", ";", "}" ]
Returns a html select box filled with the views accessible by the current user.<p> @param htmlAttributes attributes that will be inserted into the generated html @return a html select box filled with the views accessible by the current user
[ "Returns", "a", "html", "select", "box", "filled", "with", "the", "views", "accessible", "by", "the", "current", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsFrameset.java#L435-L469
GenesysPureEngage/authentication-client-java
src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java
AuthenticationApi.signIn
public void signIn(String username, String password, Boolean saml) throws ApiException { """ Perform form-based authentication. Perform form-based authentication by submitting an agent&#39;s username and password. @param username The agent&#39;s username, formatted as &#39;tenant\\username&#39;. (required) @param password The agent&#39;s password. (required) @param saml Specifies whether to login using [Security Assertion Markup Language](https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language) (SAML). (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ signInWithHttpInfo(username, password, saml); }
java
public void signIn(String username, String password, Boolean saml) throws ApiException { signInWithHttpInfo(username, password, saml); }
[ "public", "void", "signIn", "(", "String", "username", ",", "String", "password", ",", "Boolean", "saml", ")", "throws", "ApiException", "{", "signInWithHttpInfo", "(", "username", ",", "password", ",", "saml", ")", ";", "}" ]
Perform form-based authentication. Perform form-based authentication by submitting an agent&#39;s username and password. @param username The agent&#39;s username, formatted as &#39;tenant\\username&#39;. (required) @param password The agent&#39;s password. (required) @param saml Specifies whether to login using [Security Assertion Markup Language](https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language) (SAML). (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Perform", "form", "-", "based", "authentication", ".", "Perform", "form", "-", "based", "authentication", "by", "submitting", "an", "agent&#39", ";", "s", "username", "and", "password", "." ]
train
https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L1199-L1201
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.getAsync
public <T> CompletableFuture<T> getAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { """ Executes asynchronous GET request on the configured URI (alias for the `get(Class, Closure)` method), with additional configuration provided by the configuration closure. The result will be cast to the specified `type`. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } CompletableFuture future = http.getAsync(String){ request.uri.path = '/something' } String result = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param type the type of the response content @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} for the resulting content cast to the specified type """ return CompletableFuture.supplyAsync(() -> get(type, closure), getExecutor()); }
java
public <T> CompletableFuture<T> getAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { return CompletableFuture.supplyAsync(() -> get(type, closure), getExecutor()); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "T", ">", "getAsync", "(", "final", "Class", "<", "T", ">", "type", ",", "@", "DelegatesTo", "(", "HttpConfig", ".", "class", ")", "final", "Closure", "closure", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "get", "(", "type", ",", "closure", ")", ",", "getExecutor", "(", ")", ")", ";", "}" ]
Executes asynchronous GET request on the configured URI (alias for the `get(Class, Closure)` method), with additional configuration provided by the configuration closure. The result will be cast to the specified `type`. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } CompletableFuture future = http.getAsync(String){ request.uri.path = '/something' } String result = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param type the type of the response content @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} for the resulting content cast to the specified type
[ "Executes", "asynchronous", "GET", "request", "on", "the", "configured", "URI", "(", "alias", "for", "the", "get", "(", "Class", "Closure", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "closure", ".", "The", "result", "will", "be", "cast", "to", "the", "specified", "type", "." ]
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L465-L467
upwork/java-upwork
src/com/Upwork/api/Routers/Hr/Submissions.java
Submissions.requestApproval
public JSONObject requestApproval(HashMap<String, String> params) throws JSONException { """ Freelancer submits work for the client to approve @param params Parameters @throws JSONException If error occurred @return {@link JSONObject} """ return oClient.post("/hr/v3/fp/submissions", params); }
java
public JSONObject requestApproval(HashMap<String, String> params) throws JSONException { return oClient.post("/hr/v3/fp/submissions", params); }
[ "public", "JSONObject", "requestApproval", "(", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "oClient", ".", "post", "(", "\"/hr/v3/fp/submissions\"", ",", "params", ")", ";", "}" ]
Freelancer submits work for the client to approve @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Freelancer", "submits", "work", "for", "the", "client", "to", "approve" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Submissions.java#L53-L55
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.homographyStereo2Lines
public static DMatrixRMaj homographyStereo2Lines( DMatrixRMaj F , PairLineNorm line0, PairLineNorm line1) { """ Computes the homography induced from a planar surface when viewed from two views using correspondences of two lines. Observations must be on the planar surface. @see HomographyInducedStereo2Line @param F Fundamental matrix @param line0 Line on the plane @param line1 Line on the plane @return The homography from view 1 to view 2 or null if it fails """ HomographyInducedStereo2Line alg = new HomographyInducedStereo2Line(); alg.setFundamental(F,null); if( !alg.process(line0,line1) ) return null; return alg.getHomography(); }
java
public static DMatrixRMaj homographyStereo2Lines( DMatrixRMaj F , PairLineNorm line0, PairLineNorm line1) { HomographyInducedStereo2Line alg = new HomographyInducedStereo2Line(); alg.setFundamental(F,null); if( !alg.process(line0,line1) ) return null; return alg.getHomography(); }
[ "public", "static", "DMatrixRMaj", "homographyStereo2Lines", "(", "DMatrixRMaj", "F", ",", "PairLineNorm", "line0", ",", "PairLineNorm", "line1", ")", "{", "HomographyInducedStereo2Line", "alg", "=", "new", "HomographyInducedStereo2Line", "(", ")", ";", "alg", ".", "setFundamental", "(", "F", ",", "null", ")", ";", "if", "(", "!", "alg", ".", "process", "(", "line0", ",", "line1", ")", ")", "return", "null", ";", "return", "alg", ".", "getHomography", "(", ")", ";", "}" ]
Computes the homography induced from a planar surface when viewed from two views using correspondences of two lines. Observations must be on the planar surface. @see HomographyInducedStereo2Line @param F Fundamental matrix @param line0 Line on the plane @param line1 Line on the plane @return The homography from view 1 to view 2 or null if it fails
[ "Computes", "the", "homography", "induced", "from", "a", "planar", "surface", "when", "viewed", "from", "two", "views", "using", "correspondences", "of", "two", "lines", ".", "Observations", "must", "be", "on", "the", "planar", "surface", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L573-L580
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.intersectLineLine
public static boolean intersectLineLine(float ps1x, float ps1y, float pe1x, float pe1y, float ps2x, float ps2y, float pe2x, float pe2y, Vector2f p) { """ Determine whether the two lines, specified via two points lying on each line, intersect each other, and store the point of intersection into the given vector <code>p</code>. @param ps1x the x coordinate of the first point on the first line @param ps1y the y coordinate of the first point on the first line @param pe1x the x coordinate of the second point on the first line @param pe1y the y coordinate of the second point on the first line @param ps2x the x coordinate of the first point on the second line @param ps2y the y coordinate of the first point on the second line @param pe2x the x coordinate of the second point on the second line @param pe2y the y coordinate of the second point on the second line @param p will hold the point of intersection @return <code>true</code> iff the two lines intersect; <code>false</code> otherwise """ float d1x = ps1x - pe1x; float d1y = pe1y - ps1y; float d1ps1 = d1y * ps1x + d1x * ps1y; float d2x = ps2x - pe2x; float d2y = pe2y - ps2y; float d2ps2 = d2y * ps2x + d2x * ps2y; float det = d1y * d2x - d2y * d1x; if (det == 0.0f) return false; p.x = (d2x * d1ps1 - d1x * d2ps2) / det; p.y = (d1y * d2ps2 - d2y * d1ps1) / det; return true; }
java
public static boolean intersectLineLine(float ps1x, float ps1y, float pe1x, float pe1y, float ps2x, float ps2y, float pe2x, float pe2y, Vector2f p) { float d1x = ps1x - pe1x; float d1y = pe1y - ps1y; float d1ps1 = d1y * ps1x + d1x * ps1y; float d2x = ps2x - pe2x; float d2y = pe2y - ps2y; float d2ps2 = d2y * ps2x + d2x * ps2y; float det = d1y * d2x - d2y * d1x; if (det == 0.0f) return false; p.x = (d2x * d1ps1 - d1x * d2ps2) / det; p.y = (d1y * d2ps2 - d2y * d1ps1) / det; return true; }
[ "public", "static", "boolean", "intersectLineLine", "(", "float", "ps1x", ",", "float", "ps1y", ",", "float", "pe1x", ",", "float", "pe1y", ",", "float", "ps2x", ",", "float", "ps2y", ",", "float", "pe2x", ",", "float", "pe2y", ",", "Vector2f", "p", ")", "{", "float", "d1x", "=", "ps1x", "-", "pe1x", ";", "float", "d1y", "=", "pe1y", "-", "ps1y", ";", "float", "d1ps1", "=", "d1y", "*", "ps1x", "+", "d1x", "*", "ps1y", ";", "float", "d2x", "=", "ps2x", "-", "pe2x", ";", "float", "d2y", "=", "pe2y", "-", "ps2y", ";", "float", "d2ps2", "=", "d2y", "*", "ps2x", "+", "d2x", "*", "ps2y", ";", "float", "det", "=", "d1y", "*", "d2x", "-", "d2y", "*", "d1x", ";", "if", "(", "det", "==", "0.0f", ")", "return", "false", ";", "p", ".", "x", "=", "(", "d2x", "*", "d1ps1", "-", "d1x", "*", "d2ps2", ")", "/", "det", ";", "p", ".", "y", "=", "(", "d1y", "*", "d2ps2", "-", "d2y", "*", "d1ps1", ")", "/", "det", ";", "return", "true", ";", "}" ]
Determine whether the two lines, specified via two points lying on each line, intersect each other, and store the point of intersection into the given vector <code>p</code>. @param ps1x the x coordinate of the first point on the first line @param ps1y the y coordinate of the first point on the first line @param pe1x the x coordinate of the second point on the first line @param pe1y the y coordinate of the second point on the first line @param ps2x the x coordinate of the first point on the second line @param ps2y the y coordinate of the first point on the second line @param pe2x the x coordinate of the second point on the second line @param pe2y the y coordinate of the second point on the second line @param p will hold the point of intersection @return <code>true</code> iff the two lines intersect; <code>false</code> otherwise
[ "Determine", "whether", "the", "two", "lines", "specified", "via", "two", "points", "lying", "on", "each", "line", "intersect", "each", "other", "and", "store", "the", "point", "of", "intersection", "into", "the", "given", "vector", "<code", ">", "p<", "/", "code", ">", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L4941-L4954
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/FaultToleranceStateFactory.java
FaultToleranceStateFactory.createCircuitBreakerState
public CircuitBreakerState createCircuitBreakerState(CircuitBreakerPolicy policy, MetricRecorder metricRecorder) { """ Create an object implementing CircuitBreaker @param policy the CircuitBreakerPolicy, may be {@code null} @return a new CircuitBreakerState """ if (policy == null) { return new CircuitBreakerStateNullImpl(); } else { return new CircuitBreakerStateImpl(policy, metricRecorder); } }
java
public CircuitBreakerState createCircuitBreakerState(CircuitBreakerPolicy policy, MetricRecorder metricRecorder) { if (policy == null) { return new CircuitBreakerStateNullImpl(); } else { return new CircuitBreakerStateImpl(policy, metricRecorder); } }
[ "public", "CircuitBreakerState", "createCircuitBreakerState", "(", "CircuitBreakerPolicy", "policy", ",", "MetricRecorder", "metricRecorder", ")", "{", "if", "(", "policy", "==", "null", ")", "{", "return", "new", "CircuitBreakerStateNullImpl", "(", ")", ";", "}", "else", "{", "return", "new", "CircuitBreakerStateImpl", "(", "policy", ",", "metricRecorder", ")", ";", "}", "}" ]
Create an object implementing CircuitBreaker @param policy the CircuitBreakerPolicy, may be {@code null} @return a new CircuitBreakerState
[ "Create", "an", "object", "implementing", "CircuitBreaker" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/FaultToleranceStateFactory.java#L96-L102
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLAnnotationUtil.java
SARLAnnotationUtil.findIntValue
public Integer findIntValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { """ Extract the integer value of the given annotation, if it exists. @param op the annotated element. @param annotationType the type of the annotation to consider @return the value of the annotation, or {@code null} if no annotation or no value. @since 0.6 """ final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findIntValue(reference); } return null; }
java
public Integer findIntValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findIntValue(reference); } return null; }
[ "public", "Integer", "findIntValue", "(", "JvmAnnotationTarget", "op", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ")", "{", "final", "JvmAnnotationReference", "reference", "=", "this", ".", "lookup", ".", "findAnnotation", "(", "op", ",", "annotationType", ")", ";", "if", "(", "reference", "!=", "null", ")", "{", "return", "findIntValue", "(", "reference", ")", ";", "}", "return", "null", ";", "}" ]
Extract the integer value of the given annotation, if it exists. @param op the annotated element. @param annotationType the type of the annotation to consider @return the value of the annotation, or {@code null} if no annotation or no value. @since 0.6
[ "Extract", "the", "integer", "value", "of", "the", "given", "annotation", "if", "it", "exists", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLAnnotationUtil.java#L177-L183