repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
jenkinsci/jenkins
core/src/main/java/hudson/model/Fingerprint.java
Fingerprint.getSortedFacets
public @Nonnull Collection<FingerprintFacet> getSortedFacets() { List<FingerprintFacet> r = new ArrayList<>(getFacets()); r.sort(new Comparator<FingerprintFacet>() { public int compare(FingerprintFacet o1, FingerprintFacet o2) { long a = o1.getTimestamp(); long b = o2.getTimestamp(); if (a < b) return -1; if (a == b) return 0; return 1; } }); return r; }
java
public @Nonnull Collection<FingerprintFacet> getSortedFacets() { List<FingerprintFacet> r = new ArrayList<>(getFacets()); r.sort(new Comparator<FingerprintFacet>() { public int compare(FingerprintFacet o1, FingerprintFacet o2) { long a = o1.getTimestamp(); long b = o2.getTimestamp(); if (a < b) return -1; if (a == b) return 0; return 1; } }); return r; }
[ "public", "@", "Nonnull", "Collection", "<", "FingerprintFacet", ">", "getSortedFacets", "(", ")", "{", "List", "<", "FingerprintFacet", ">", "r", "=", "new", "ArrayList", "<>", "(", "getFacets", "(", ")", ")", ";", "r", ".", "sort", "(", "new", "Compara...
Sorts {@link FingerprintFacet}s by their timestamps. @return Sorted list of {@link FingerprintFacet}s
[ "Sorts", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Fingerprint.java#L1201-L1213
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateZipCode
public static <T extends CharSequence> T validateZipCode(T value, String errorMsg) throws ValidateException { if (false == isZipCode(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateZipCode(T value, String errorMsg) throws ValidateException { if (false == isZipCode(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateZipCode", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isZipCode", "(", "value", ")", ")", "{", "throw", "new",...
验证是否为邮政编码(中国) @param <T> 字符串类型 @param value 表单值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为邮政编码(中国)" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L625-L630
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.setOrtho2D
public Matrix4x3f setOrtho2D(float left, float right, float bottom, float top) { MemUtil.INSTANCE.identity(this); m00 = 2.0f / (right - left); m11 = 2.0f / (top - bottom); m22 = -1.0f; m30 = -(right + left) / (right - left); m31 = -(top + bottom) / (top - bottom); properties = 0; return this; }
java
public Matrix4x3f setOrtho2D(float left, float right, float bottom, float top) { MemUtil.INSTANCE.identity(this); m00 = 2.0f / (right - left); m11 = 2.0f / (top - bottom); m22 = -1.0f; m30 = -(right + left) / (right - left); m31 = -(top + bottom) / (top - bottom); properties = 0; return this; }
[ "public", "Matrix4x3f", "setOrtho2D", "(", "float", "left", ",", "float", "right", ",", "float", "bottom", ",", "float", "top", ")", "{", "MemUtil", ".", "INSTANCE", ".", "identity", "(", "this", ")", ";", "m00", "=", "2.0f", "/", "(", "right", "-", ...
Set this matrix to be an orthographic projection transformation for a right-handed coordinate system. <p> This method is equivalent to calling {@link #setOrtho(float, float, float, float, float, float) setOrtho()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> In order to apply the orthographic projection to an already existing transformation, use {@link #ortho2D(float, float, float, float) ortho2D()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrtho(float, float, float, float, float, float) @see #ortho2D(float, float, float, float) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @return this
[ "Set", "this", "matrix", "to", "be", "an", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#setOrtho", "(", "flo...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5857-L5866
square/jna-gmp
jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java
Gmp.getPeer
private mpz_t getPeer(BigInteger value, mpz_t sharedPeer) { if (value instanceof GmpInteger) { return ((GmpInteger) value).getPeer(); } mpzImport(sharedPeer, value.signum(), value.abs().toByteArray()); return sharedPeer; }
java
private mpz_t getPeer(BigInteger value, mpz_t sharedPeer) { if (value instanceof GmpInteger) { return ((GmpInteger) value).getPeer(); } mpzImport(sharedPeer, value.signum(), value.abs().toByteArray()); return sharedPeer; }
[ "private", "mpz_t", "getPeer", "(", "BigInteger", "value", ",", "mpz_t", "sharedPeer", ")", "{", "if", "(", "value", "instanceof", "GmpInteger", ")", "{", "return", "(", "(", "GmpInteger", ")", "value", ")", ".", "getPeer", "(", ")", ";", "}", "mpzImport...
If {@code value} is a {@link GmpInteger}, return its peer. Otherwise, import {@code value} into {@code sharedPeer} and return {@code sharedPeer}.
[ "If", "{" ]
train
https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L335-L341
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.createIndex
public void createIndex(String collectionName, List<String> columnList, int order) { DBCollection coll = mongoDb.getCollection(collectionName); List<DBObject> indexes = coll.getIndexInfo(); // List of all current // indexes on collection Set<String> indexNames = new HashSet<String>(); // List of all current // index names for (DBObject index : indexes) { BasicDBObject obj = (BasicDBObject) index.get("key"); Set<String> set = obj.keySet(); // Set containing index name which // is key indexNames.addAll(set); } // Create index if not already created for (String columnName : columnList) { if (!indexNames.contains(columnName)) { KunderaCoreUtils.printQuery("Create index on:" + columnName, showQuery); coll.createIndex(new BasicDBObject(columnName, order)); } } }
java
public void createIndex(String collectionName, List<String> columnList, int order) { DBCollection coll = mongoDb.getCollection(collectionName); List<DBObject> indexes = coll.getIndexInfo(); // List of all current // indexes on collection Set<String> indexNames = new HashSet<String>(); // List of all current // index names for (DBObject index : indexes) { BasicDBObject obj = (BasicDBObject) index.get("key"); Set<String> set = obj.keySet(); // Set containing index name which // is key indexNames.addAll(set); } // Create index if not already created for (String columnName : columnList) { if (!indexNames.contains(columnName)) { KunderaCoreUtils.printQuery("Create index on:" + columnName, showQuery); coll.createIndex(new BasicDBObject(columnName, order)); } } }
[ "public", "void", "createIndex", "(", "String", "collectionName", ",", "List", "<", "String", ">", "columnList", ",", "int", "order", ")", "{", "DBCollection", "coll", "=", "mongoDb", ".", "getCollection", "(", "collectionName", ")", ";", "List", "<", "DBObj...
Creates the index. @param collectionName the collection name @param columnList the column list @param order the order
[ "Creates", "the", "index", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L975-L1000
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java
TaskManagerService.taskShouldExecute
private boolean taskShouldExecute(Task task, TaskRecord taskRecord) { String taskID = taskRecord.getTaskID(); if (taskRecord.getStatus() == TaskStatus.NEVER_EXECUTED) { m_logger.debug("Task '{}' has never executed", taskID); return true; } if (taskRecord.getStatus() == TaskStatus.IN_PROGRESS) { m_logger.debug("Task '{}' is already being executed", taskID); return false; } Calendar startTime = taskRecord.getTime(TaskRecord.PROP_START_TIME); long startTimeMillis = startTime == null ? 0 : startTime.getTimeInMillis(); long taskPeriodMillis = task.getTaskFreq().getValueInMinutes() * 60 * 1000; long nowMillis = System.currentTimeMillis(); boolean bShouldStart = startTimeMillis + taskPeriodMillis <= nowMillis; m_logger.debug("Considering task {}: Last started at {}; periodicity in millis: {}; current time: {}; next start: {}; should start: {}", new Object[]{task.getTaskID(), Utils.formatDateUTC(startTimeMillis, Calendar.MILLISECOND), taskPeriodMillis, Utils.formatDateUTC(nowMillis, Calendar.MILLISECOND), Utils.formatDateUTC(startTimeMillis + taskPeriodMillis, Calendar.MILLISECOND), bShouldStart}); return bShouldStart; }
java
private boolean taskShouldExecute(Task task, TaskRecord taskRecord) { String taskID = taskRecord.getTaskID(); if (taskRecord.getStatus() == TaskStatus.NEVER_EXECUTED) { m_logger.debug("Task '{}' has never executed", taskID); return true; } if (taskRecord.getStatus() == TaskStatus.IN_PROGRESS) { m_logger.debug("Task '{}' is already being executed", taskID); return false; } Calendar startTime = taskRecord.getTime(TaskRecord.PROP_START_TIME); long startTimeMillis = startTime == null ? 0 : startTime.getTimeInMillis(); long taskPeriodMillis = task.getTaskFreq().getValueInMinutes() * 60 * 1000; long nowMillis = System.currentTimeMillis(); boolean bShouldStart = startTimeMillis + taskPeriodMillis <= nowMillis; m_logger.debug("Considering task {}: Last started at {}; periodicity in millis: {}; current time: {}; next start: {}; should start: {}", new Object[]{task.getTaskID(), Utils.formatDateUTC(startTimeMillis, Calendar.MILLISECOND), taskPeriodMillis, Utils.formatDateUTC(nowMillis, Calendar.MILLISECOND), Utils.formatDateUTC(startTimeMillis + taskPeriodMillis, Calendar.MILLISECOND), bShouldStart}); return bShouldStart; }
[ "private", "boolean", "taskShouldExecute", "(", "Task", "task", ",", "TaskRecord", "taskRecord", ")", "{", "String", "taskID", "=", "taskRecord", ".", "getTaskID", "(", ")", ";", "if", "(", "taskRecord", ".", "getStatus", "(", ")", "==", "TaskStatus", ".", ...
and (2) enough time has passed since its last execution that it's time to run.
[ "and", "(", "2", ")", "enough", "time", "has", "passed", "since", "its", "last", "execution", "that", "it", "s", "time", "to", "run", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java#L364-L388
Stratio/deep-spark
deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CassandraCell.java
CassandraCell.create
public static <E extends IDeepType> Cell create(E e, Field field) { return new CassandraCell(e, field); }
java
public static <E extends IDeepType> Cell create(E e, Field field) { return new CassandraCell(e, field); }
[ "public", "static", "<", "E", "extends", "IDeepType", ">", "Cell", "create", "(", "E", "e", ",", "Field", "field", ")", "{", "return", "new", "CassandraCell", "(", "e", ",", "field", ")", ";", "}" ]
Constructs a Cell from a {@link com.stratio.deep.commons.annotations.DeepField} property. @param e instance of the testentity whose field is going to generate a Cell. @param field field that will generate the Cell. @param <E> a subclass of IDeepType. @return an instance of a Cell object for the provided parameters.
[ "Constructs", "a", "Cell", "from", "a", "{", "@link", "com", ".", "stratio", ".", "deep", ".", "commons", ".", "annotations", ".", "DeepField", "}", "property", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CassandraCell.java#L123-L125
Chorus-bdd/Chorus
extensions/chorus-sql/src/main/java/org/chorusbdd/chorus/sql/manager/DefaultSqlManager.java
DefaultSqlManager.executeJdbcStatements
private void executeJdbcStatements(Connection connection, String configName, String statements, String description) { Statement stmt = createStatement(configName, connection); try { log.debug("Executing statement [" + description + "]"); List<String> stmtsToExecute = Stream.of(statements.split(";")) .map(String::trim) .filter(s -> s.length() > 0) .collect(Collectors.toList()); if ( log.isTraceEnabled()) { log.trace("These statements will be executed:"); stmtsToExecute.forEach(s -> log.trace("Statement: [" + s + "]")); } for ( String currentStatement : stmtsToExecute) { stmt.execute(currentStatement); log.trace("Executing statement: " + currentStatement + " OK!"); } } catch (SQLException e) { throw new ChorusException( String.format("Failed while executing statement [%s] on database + %s [%s]", description, configName, e.toString(), e) ); } }
java
private void executeJdbcStatements(Connection connection, String configName, String statements, String description) { Statement stmt = createStatement(configName, connection); try { log.debug("Executing statement [" + description + "]"); List<String> stmtsToExecute = Stream.of(statements.split(";")) .map(String::trim) .filter(s -> s.length() > 0) .collect(Collectors.toList()); if ( log.isTraceEnabled()) { log.trace("These statements will be executed:"); stmtsToExecute.forEach(s -> log.trace("Statement: [" + s + "]")); } for ( String currentStatement : stmtsToExecute) { stmt.execute(currentStatement); log.trace("Executing statement: " + currentStatement + " OK!"); } } catch (SQLException e) { throw new ChorusException( String.format("Failed while executing statement [%s] on database + %s [%s]", description, configName, e.toString(), e) ); } }
[ "private", "void", "executeJdbcStatements", "(", "Connection", "connection", ",", "String", "configName", ",", "String", "statements", ",", "String", "description", ")", "{", "Statement", "stmt", "=", "createStatement", "(", "configName", ",", "connection", ")", "...
Execute one or more SQL statements @param statements, a String which may contain one or more semi-colon-delimited SQL statements
[ "Execute", "one", "or", "more", "SQL", "statements" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/extensions/chorus-sql/src/main/java/org/chorusbdd/chorus/sql/manager/DefaultSqlManager.java#L148-L173
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/sse/ServerSentEventConnection.java
ServerSentEventConnection.sendRetry
public synchronized void sendRetry(long retry, EventCallback callback) { if (open == 0 || shutdown) { if (callback != null) { callback.failed(this, null, null, null, new ClosedChannelException()); } return; } queue.add(new SSEData(retry, callback)); sink.getIoThread().execute(new Runnable() { @Override public void run() { synchronized (ServerSentEventConnection.this) { if (pooled == null) { fillBuffer(); writeListener.handleEvent(sink); } } } }); }
java
public synchronized void sendRetry(long retry, EventCallback callback) { if (open == 0 || shutdown) { if (callback != null) { callback.failed(this, null, null, null, new ClosedChannelException()); } return; } queue.add(new SSEData(retry, callback)); sink.getIoThread().execute(new Runnable() { @Override public void run() { synchronized (ServerSentEventConnection.this) { if (pooled == null) { fillBuffer(); writeListener.handleEvent(sink); } } } }); }
[ "public", "synchronized", "void", "sendRetry", "(", "long", "retry", ",", "EventCallback", "callback", ")", "{", "if", "(", "open", "==", "0", "||", "shutdown", ")", "{", "if", "(", "callback", "!=", "null", ")", "{", "callback", ".", "failed", "(", "t...
Sends the 'retry' message to the client, instructing it how long to wait before attempting a reconnect. @param retry The retry time in milliseconds @param callback The callback that is notified on success or failure
[ "Sends", "the", "retry", "message", "to", "the", "client", "instructing", "it", "how", "long", "to", "wait", "before", "attempting", "a", "reconnect", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/sse/ServerSentEventConnection.java#L213-L233
mscharhag/oleaster
oleaster-matcher/src/main/java/com/mscharhag/oleaster/matcher/matchers/FloatingPointNumberMatcher.java
FloatingPointNumberMatcher.toBeBetween
public void toBeBetween(double lower, double upper) { Arguments.ensureTrue(lower < upper, "upper has to be greater than lower"); boolean isBetween = this.value >= lower && this.value <= upper; Expectations.expectTrue(isBetween, "Expected %s to be between %s and %s", this.value, lower, upper); }
java
public void toBeBetween(double lower, double upper) { Arguments.ensureTrue(lower < upper, "upper has to be greater than lower"); boolean isBetween = this.value >= lower && this.value <= upper; Expectations.expectTrue(isBetween, "Expected %s to be between %s and %s", this.value, lower, upper); }
[ "public", "void", "toBeBetween", "(", "double", "lower", ",", "double", "upper", ")", "{", "Arguments", ".", "ensureTrue", "(", "lower", "<", "upper", ",", "\"upper has to be greater than lower\"", ")", ";", "boolean", "isBetween", "=", "this", ".", "value", "...
Checks if the stored value is between a lower and an upper bound. <p>This method throws an {@code AssertionError} if: <ul> <li>the stored value is smaller than the lower bound</li> <li>the stored value is greater than the upper bound</li> </ul> <p>It is ok if the stored value is equal to the lower or the upper bound @param lower the lower bound @param upper the upper bound @throws java.lang.IllegalArgumentException if {@code lower} is not smaller than {@code upper}
[ "Checks", "if", "the", "stored", "value", "is", "between", "a", "lower", "and", "an", "upper", "bound", ".", "<p", ">", "This", "method", "throws", "an", "{" ]
train
https://github.com/mscharhag/oleaster/blob/ce8c6fe2346cd0c0cf5f641417ff85019d1d09ac/oleaster-matcher/src/main/java/com/mscharhag/oleaster/matcher/matchers/FloatingPointNumberMatcher.java#L110-L114
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPreferences.java
CmsPreferences.computeStartGalleryPreselection
private String computeStartGalleryPreselection(HttpServletRequest request, String galleryType) { // first check presence of the setting in request parameter String preSelection = request.getParameter(PARAM_STARTGALLERY_PREFIX + galleryType); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(preSelection)) { return CmsEncoder.decode(preSelection); } else { // no value found in request, check current user settings (not the member!) CmsUserSettings userSettings = new CmsUserSettings(getSettings().getUser()); return userSettings.getStartGallery(galleryType); } }
java
private String computeStartGalleryPreselection(HttpServletRequest request, String galleryType) { // first check presence of the setting in request parameter String preSelection = request.getParameter(PARAM_STARTGALLERY_PREFIX + galleryType); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(preSelection)) { return CmsEncoder.decode(preSelection); } else { // no value found in request, check current user settings (not the member!) CmsUserSettings userSettings = new CmsUserSettings(getSettings().getUser()); return userSettings.getStartGallery(galleryType); } }
[ "private", "String", "computeStartGalleryPreselection", "(", "HttpServletRequest", "request", ",", "String", "galleryType", ")", "{", "// first check presence of the setting in request parameter", "String", "preSelection", "=", "request", ".", "getParameter", "(", "PARAM_STARTG...
Returns the preferred editor preselection value either from the request, if not present, from the user settings.<p> @param request the current http servlet request @param galleryType the preferred gallery type @return the preferred editor preselection value or null, if none found
[ "Returns", "the", "preferred", "editor", "preselection", "value", "either", "from", "the", "request", "if", "not", "present", "from", "the", "user", "settings", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L2308-L2320
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/PrincipalUser.java
PrincipalUser.findByUserName
public static PrincipalUser findByUserName(EntityManager em, String userName) { Class<PrincipalUser> type = PrincipalUser.class; TypedQuery<PrincipalUser> query = em.createNamedQuery("PrincipalUser.findByUserName", type); try { return query.setParameter("userName", userName).getSingleResult(); } catch (NoResultException ex) { return null; } }
java
public static PrincipalUser findByUserName(EntityManager em, String userName) { Class<PrincipalUser> type = PrincipalUser.class; TypedQuery<PrincipalUser> query = em.createNamedQuery("PrincipalUser.findByUserName", type); try { return query.setParameter("userName", userName).getSingleResult(); } catch (NoResultException ex) { return null; } }
[ "public", "static", "PrincipalUser", "findByUserName", "(", "EntityManager", "em", ",", "String", "userName", ")", "{", "Class", "<", "PrincipalUser", ">", "type", "=", "PrincipalUser", ".", "class", ";", "TypedQuery", "<", "PrincipalUser", ">", "query", "=", ...
Finds the application database user account for the provided user name. @param em The entity manager to use. @param userName The user name for which to retrieve the account information for. @return The user account or null if no account exists.
[ "Finds", "the", "application", "database", "user", "account", "for", "the", "provided", "user", "name", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/PrincipalUser.java#L260-L269
amzn/ion-java
src/com/amazon/ion/facet/Facets.java
Facets.assumeFacet
public static <T> T assumeFacet(Class<T> facetType, Faceted subject) { if (subject != null) { T facet = subject.asFacet(facetType); if (facet != null) return facet; } throw new UnsupportedFacetException(facetType, subject); }
java
public static <T> T assumeFacet(Class<T> facetType, Faceted subject) { if (subject != null) { T facet = subject.asFacet(facetType); if (facet != null) return facet; } throw new UnsupportedFacetException(facetType, subject); }
[ "public", "static", "<", "T", ">", "T", "assumeFacet", "(", "Class", "<", "T", ">", "facetType", ",", "Faceted", "subject", ")", "{", "if", "(", "subject", "!=", "null", ")", "{", "T", "facet", "=", "subject", ".", "asFacet", "(", "facetType", ")", ...
Returns a facet of the given subject if supported, throwing an exception otherwise. <p> This does not attempt to cast the subject to the requested type, since the {@link Faceted} interface declares the intent to control the conversion. @return not null. @throws UnsupportedFacetException if {@code subject} is null or if the subject doesn't support the requested facet type.
[ "Returns", "a", "facet", "of", "the", "given", "subject", "if", "supported", "throwing", "an", "exception", "otherwise", ".", "<p", ">", "This", "does", "not", "attempt", "to", "cast", "the", "subject", "to", "the", "requested", "type", "since", "the", "{"...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/facet/Facets.java#L90-L99
amzn/ion-java
src/com/amazon/ion/util/IonTextUtils.java
IonTextUtils.printJsonString
public static void printJsonString(Appendable out, CharSequence text) throws IOException { if (text == null) { out.append("null"); } else { out.append('"'); printCodePoints(out, text, EscapeMode.JSON); out.append('"'); } }
java
public static void printJsonString(Appendable out, CharSequence text) throws IOException { if (text == null) { out.append("null"); } else { out.append('"'); printCodePoints(out, text, EscapeMode.JSON); out.append('"'); } }
[ "public", "static", "void", "printJsonString", "(", "Appendable", "out", ",", "CharSequence", "text", ")", "throws", "IOException", "{", "if", "(", "text", "==", "null", ")", "{", "out", ".", "append", "(", "\"null\"", ")", ";", "}", "else", "{", "out", ...
Prints characters as an ASCII-encoded JSON string, including surrounding double-quotes. If the {@code text} is null, this prints {@code null}. @param out the stream to receive the JSON data. @param text the text to print; may be {@code null}. @throws IOException if the {@link Appendable} throws an exception. @throws IllegalArgumentException if the text contains invalid UTF-16 surrogates.
[ "Prints", "characters", "as", "an", "ASCII", "-", "encoded", "JSON", "string", "including", "surrounding", "double", "-", "quotes", ".", "If", "the", "{", "@code", "text", "}", "is", "null", "this", "prints", "{", "@code", "null", "}", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonTextUtils.java#L432-L445
Wikidata/Wikidata-Toolkit
wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java
WmfDumpFileManager.findDumpDatesOnline
List<String> findDumpDatesOnline(DumpContentType dumpContentType) { List<String> result = new ArrayList<>(); try (InputStream in = this.webResourceFetcher .getInputStreamForUrl(WmfDumpFile.getDumpFileWebDirectory( dumpContentType, this.projectName))) { BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(in, StandardCharsets.UTF_8)); String inputLine; while ((inputLine = bufferedReader.readLine()) != null) { String dateStamp = ""; if (inputLine.startsWith("<tr><td class=\"n\">")) { // old format of HTML file lists dateStamp = inputLine.substring(27, 35); } else if (inputLine.startsWith("<a href=")) { // new Jan 2015 of HTML file lists dateStamp = inputLine.substring(9, 17); } if (dateStamp.matches(WmfDumpFileManager.DATE_STAMP_PATTERN)) { result.add(dateStamp); } } bufferedReader.close(); } catch (IOException e) { logger.error("Failed to fetch available dump dates online."); } result.sort(Collections.reverseOrder()); return result; }
java
List<String> findDumpDatesOnline(DumpContentType dumpContentType) { List<String> result = new ArrayList<>(); try (InputStream in = this.webResourceFetcher .getInputStreamForUrl(WmfDumpFile.getDumpFileWebDirectory( dumpContentType, this.projectName))) { BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(in, StandardCharsets.UTF_8)); String inputLine; while ((inputLine = bufferedReader.readLine()) != null) { String dateStamp = ""; if (inputLine.startsWith("<tr><td class=\"n\">")) { // old format of HTML file lists dateStamp = inputLine.substring(27, 35); } else if (inputLine.startsWith("<a href=")) { // new Jan 2015 of HTML file lists dateStamp = inputLine.substring(9, 17); } if (dateStamp.matches(WmfDumpFileManager.DATE_STAMP_PATTERN)) { result.add(dateStamp); } } bufferedReader.close(); } catch (IOException e) { logger.error("Failed to fetch available dump dates online."); } result.sort(Collections.reverseOrder()); return result; }
[ "List", "<", "String", ">", "findDumpDatesOnline", "(", "DumpContentType", "dumpContentType", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "(", "InputStream", "in", "=", "this", ".", "webResourceFetcher...
Finds out which dump files are available for download in a given directory. The result is a list of YYYYMMDD date stamps, ordered newest to oldest. The list is based on the directories or files found at the target location, without considering whether or not each dump is actually available. <p> The implementation is rather uniform since all cases supported thus far use directory/file names that start with a date stamp. If the date would occur elsewhere or in another form, then more work would be needed. @param dumpContentType the type of dump to consider @return list of date stamps
[ "Finds", "out", "which", "dump", "files", "are", "available", "for", "download", "in", "a", "given", "directory", ".", "The", "result", "is", "a", "list", "of", "YYYYMMDD", "date", "stamps", "ordered", "newest", "to", "oldest", ".", "The", "list", "is", ...
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/wmf/WmfDumpFileManager.java#L333-L362
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/DiagnosticRenderUtil.java
DiagnosticRenderUtil.renderDiagnostics
public static void renderDiagnostics(final Diagnosable component, final WebXmlRenderContext renderContext) { List<Diagnostic> diags = component.getDiagnostics(Diagnostic.ERROR); if (diags != null) { renderHelper(renderContext, component, diags, Diagnostic.ERROR); } diags = component.getDiagnostics(Diagnostic.WARNING); if (diags != null) { renderHelper(renderContext, component, diags, Diagnostic.WARNING); } diags = component.getDiagnostics(Diagnostic.INFO); if (diags != null) { renderHelper(renderContext, component, diags, Diagnostic.INFO); } diags = component.getDiagnostics(Diagnostic.SUCCESS); if (diags != null) { renderHelper(renderContext, component, diags, Diagnostic.SUCCESS); } }
java
public static void renderDiagnostics(final Diagnosable component, final WebXmlRenderContext renderContext) { List<Diagnostic> diags = component.getDiagnostics(Diagnostic.ERROR); if (diags != null) { renderHelper(renderContext, component, diags, Diagnostic.ERROR); } diags = component.getDiagnostics(Diagnostic.WARNING); if (diags != null) { renderHelper(renderContext, component, diags, Diagnostic.WARNING); } diags = component.getDiagnostics(Diagnostic.INFO); if (diags != null) { renderHelper(renderContext, component, diags, Diagnostic.INFO); } diags = component.getDiagnostics(Diagnostic.SUCCESS); if (diags != null) { renderHelper(renderContext, component, diags, Diagnostic.SUCCESS); } }
[ "public", "static", "void", "renderDiagnostics", "(", "final", "Diagnosable", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "List", "<", "Diagnostic", ">", "diags", "=", "component", ".", "getDiagnostics", "(", "Diagnostic", ".", "ER...
Render diagnostics for the component. @param component the component being rendered @param renderContext the RenderContext to paint to.
[ "Render", "diagnostics", "for", "the", "component", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/DiagnosticRenderUtil.java#L87-L104
wisdom-framework/wisdom
core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java
ConfigurationImpl.getBooleanWithDefault
@Override public Boolean getBooleanWithDefault(final String key, Boolean defaultValue) { return retrieve(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return configuration.getBoolean(key); } }, defaultValue); }
java
@Override public Boolean getBooleanWithDefault(final String key, Boolean defaultValue) { return retrieve(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return configuration.getBoolean(key); } }, defaultValue); }
[ "@", "Override", "public", "Boolean", "getBooleanWithDefault", "(", "final", "String", "key", ",", "Boolean", "defaultValue", ")", "{", "return", "retrieve", "(", "new", "Callable", "<", "Boolean", ">", "(", ")", "{", "@", "Override", "public", "Boolean", "c...
Get a Boolean property or a default value when property cannot be found in any configuration file. @param key the key used in the configuration file. @param defaultValue Default value returned, when value cannot be found in configuration. @return the value of the key or the default value.
[ "Get", "a", "Boolean", "property", "or", "a", "default", "value", "when", "property", "cannot", "be", "found", "in", "any", "configuration", "file", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L227-L236
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._generate
protected void _generate(SarlEnumeration enumeration, PyAppendable it, IExtraLanguageGeneratorContext context) { generateEnumerationDeclaration(enumeration, it, context); }
java
protected void _generate(SarlEnumeration enumeration, PyAppendable it, IExtraLanguageGeneratorContext context) { generateEnumerationDeclaration(enumeration, it, context); }
[ "protected", "void", "_generate", "(", "SarlEnumeration", "enumeration", ",", "PyAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "generateEnumerationDeclaration", "(", "enumeration", ",", "it", ",", "context", ")", ";", "}" ]
Generate the given object. @param enumeration the enumeration. @param it the target for the generated content. @param context the context.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L913-L915
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java
SRTPCryptoContext.authenticatePacketHMCSHA1
private void authenticatePacketHMCSHA1(RawPacket pkt, int rocIn) { ByteBuffer buf = pkt.getBuffer(); buf.rewind(); int len = buf.remaining(); buf.get(tempBuffer, 0, len); mac.update(tempBuffer, 0, len); rbStore[0] = (byte) (rocIn >> 24); rbStore[1] = (byte) (rocIn >> 16); rbStore[2] = (byte) (rocIn >> 8); rbStore[3] = (byte) rocIn; mac.update(rbStore, 0, rbStore.length); mac.doFinal(tagStore, 0); }
java
private void authenticatePacketHMCSHA1(RawPacket pkt, int rocIn) { ByteBuffer buf = pkt.getBuffer(); buf.rewind(); int len = buf.remaining(); buf.get(tempBuffer, 0, len); mac.update(tempBuffer, 0, len); rbStore[0] = (byte) (rocIn >> 24); rbStore[1] = (byte) (rocIn >> 16); rbStore[2] = (byte) (rocIn >> 8); rbStore[3] = (byte) rocIn; mac.update(rbStore, 0, rbStore.length); mac.doFinal(tagStore, 0); }
[ "private", "void", "authenticatePacketHMCSHA1", "(", "RawPacket", "pkt", ",", "int", "rocIn", ")", "{", "ByteBuffer", "buf", "=", "pkt", ".", "getBuffer", "(", ")", ";", "buf", ".", "rewind", "(", ")", ";", "int", "len", "=", "buf", ".", "remaining", "...
Authenticate a packet. Calculated authentication tag is returned. @param pkt the RTP packet to be authenticated @param rocIn Roll-Over-Counter
[ "Authenticate", "a", "packet", ".", "Calculated", "authentication", "tag", "is", "returned", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java#L522-L534
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/DoubleBindingChecker.java
DoubleBindingChecker.findSource
private GinjectorBindings findSource(GinjectorBindings ginjector, Key<?> key) { Set<GinjectorBindings> visited = new LinkedHashSet<GinjectorBindings>(); GinjectorBindings lastGinjector = null; while (ginjector != null) { if (!visited.add(ginjector)) { logger.log(Type.ERROR, PrettyPrinter.format( "Cycle detected in bindings for %s", key)); for (GinjectorBindings visitedBindings : visited) { PrettyPrinter.log(logger, Type.ERROR, " %s", visitedBindings); } return ginjector; // at this point, just return *something* } lastGinjector = ginjector; ginjector = linkedGinjector(ginjector.getBinding(key)); } return lastGinjector; }
java
private GinjectorBindings findSource(GinjectorBindings ginjector, Key<?> key) { Set<GinjectorBindings> visited = new LinkedHashSet<GinjectorBindings>(); GinjectorBindings lastGinjector = null; while (ginjector != null) { if (!visited.add(ginjector)) { logger.log(Type.ERROR, PrettyPrinter.format( "Cycle detected in bindings for %s", key)); for (GinjectorBindings visitedBindings : visited) { PrettyPrinter.log(logger, Type.ERROR, " %s", visitedBindings); } return ginjector; // at this point, just return *something* } lastGinjector = ginjector; ginjector = linkedGinjector(ginjector.getBinding(key)); } return lastGinjector; }
[ "private", "GinjectorBindings", "findSource", "(", "GinjectorBindings", "ginjector", ",", "Key", "<", "?", ">", "key", ")", "{", "Set", "<", "GinjectorBindings", ">", "visited", "=", "new", "LinkedHashSet", "<", "GinjectorBindings", ">", "(", ")", ";", "Ginjec...
Find the ginjector that we "really" get the binding for key from. That is, if it is inherited from a child/parent, return that injector.
[ "Find", "the", "ginjector", "that", "we", "really", "get", "the", "binding", "for", "key", "from", ".", "That", "is", "if", "it", "is", "inherited", "from", "a", "child", "/", "parent", "return", "that", "injector", "." ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/DoubleBindingChecker.java#L93-L111
google/closure-templates
java/src/com/google/template/soy/shared/SoyAstCache.java
SoyAstCache.put
public synchronized void put(String fileName, VersionedFile versionedFile) { cache.put(fileName, versionedFile.copy()); }
java
public synchronized void put(String fileName, VersionedFile versionedFile) { cache.put(fileName, versionedFile.copy()); }
[ "public", "synchronized", "void", "put", "(", "String", "fileName", ",", "VersionedFile", "versionedFile", ")", "{", "cache", ".", "put", "(", "fileName", ",", "versionedFile", ".", "copy", "(", ")", ")", ";", "}" ]
Stores a cached version of the AST. <p>Please treat this as superpackage-private for Soy internals. @param fileName The name of the file. @param versionedFile The compiled AST at the particular version. The node is defensively copied; the caller is free to modify it.
[ "Stores", "a", "cached", "version", "of", "the", "AST", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/SoyAstCache.java#L80-L82
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/internal/monitor/DropinMonitor.java
DropinMonitor.getAppMessageHelper
private AppMessageHelper getAppMessageHelper(String type, String fileName) { if (type == null && fileName != null) { String[] parts = fileName.split("[\\\\/]"); if (parts.length > 0) { String last = parts[parts.length - 1]; int dot = last.indexOf('.'); type = dot >= 0 ? last.substring(dot + 1) : parts.length > 1 ? parts[parts.length - 2] : null; } } if (type != null) try { String filter = FilterUtils.createPropertyFilter(AppManagerConstants.TYPE, type.toLowerCase()); @SuppressWarnings("rawtypes") Collection<ServiceReference<ApplicationHandler>> refs = _ctx.getServiceReferences(ApplicationHandler.class, filter); if (refs.size() > 0) { @SuppressWarnings("rawtypes") ServiceReference<ApplicationHandler> ref = refs.iterator().next(); ApplicationHandler<?> appHandler = _ctx.getService(ref); try { return AppMessageHelper.get(appHandler); } finally { _ctx.ungetService(ref); } } } catch (InvalidSyntaxException x) { } return AppMessageHelper.get(null); }
java
private AppMessageHelper getAppMessageHelper(String type, String fileName) { if (type == null && fileName != null) { String[] parts = fileName.split("[\\\\/]"); if (parts.length > 0) { String last = parts[parts.length - 1]; int dot = last.indexOf('.'); type = dot >= 0 ? last.substring(dot + 1) : parts.length > 1 ? parts[parts.length - 2] : null; } } if (type != null) try { String filter = FilterUtils.createPropertyFilter(AppManagerConstants.TYPE, type.toLowerCase()); @SuppressWarnings("rawtypes") Collection<ServiceReference<ApplicationHandler>> refs = _ctx.getServiceReferences(ApplicationHandler.class, filter); if (refs.size() > 0) { @SuppressWarnings("rawtypes") ServiceReference<ApplicationHandler> ref = refs.iterator().next(); ApplicationHandler<?> appHandler = _ctx.getService(ref); try { return AppMessageHelper.get(appHandler); } finally { _ctx.ungetService(ref); } } } catch (InvalidSyntaxException x) { } return AppMessageHelper.get(null); }
[ "private", "AppMessageHelper", "getAppMessageHelper", "(", "String", "type", ",", "String", "fileName", ")", "{", "if", "(", "type", "==", "null", "&&", "fileName", "!=", "null", ")", "{", "String", "[", "]", "parts", "=", "fileName", ".", "split", "(", ...
Returns the message helper for the specified application handler type. @param type application handler type @param fileName file name from which type can be inferred if not specified @return the message helper for the specified application handler type.
[ "Returns", "the", "message", "helper", "for", "the", "specified", "application", "handler", "type", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/internal/monitor/DropinMonitor.java#L354-L381
EsotericSoftware/kryo
src/com/esotericsoftware/kryo/io/Input.java
Input.readString
public String readString () { if (!readVarIntFlag()) return readAsciiString(); // ASCII. // Null, empty, or UTF8. int charCount = readVarIntFlag(true); switch (charCount) { case 0: return null; case 1: return ""; } charCount--; readUtf8Chars(charCount); return new String(chars, 0, charCount); }
java
public String readString () { if (!readVarIntFlag()) return readAsciiString(); // ASCII. // Null, empty, or UTF8. int charCount = readVarIntFlag(true); switch (charCount) { case 0: return null; case 1: return ""; } charCount--; readUtf8Chars(charCount); return new String(chars, 0, charCount); }
[ "public", "String", "readString", "(", ")", "{", "if", "(", "!", "readVarIntFlag", "(", ")", ")", "return", "readAsciiString", "(", ")", ";", "// ASCII.\r", "// Null, empty, or UTF8.\r", "int", "charCount", "=", "readVarIntFlag", "(", "true", ")", ";", "switch...
Reads the length and string of UTF8 characters, or null. This can read strings written by {@link Output#writeString(String)} and {@link Output#writeAscii(String)}. @return May be null.
[ "Reads", "the", "length", "and", "string", "of", "UTF8", "characters", "or", "null", ".", "This", "can", "read", "strings", "written", "by", "{" ]
train
https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/src/com/esotericsoftware/kryo/io/Input.java#L774-L787
mgm-tp/jfunk
jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ResourceLoader.java
ResourceLoader.getInputStream
public static InputStream getInputStream(final String baseDir, final String resource) throws IOException { return getInputStream(new File(baseDir), resource); }
java
public static InputStream getInputStream(final String baseDir, final String resource) throws IOException { return getInputStream(new File(baseDir), resource); }
[ "public", "static", "InputStream", "getInputStream", "(", "final", "String", "baseDir", ",", "final", "String", "resource", ")", "throws", "IOException", "{", "return", "getInputStream", "(", "new", "File", "(", "baseDir", ")", ",", "resource", ")", ";", "}" ]
Loads a resource as {@link InputStream}. @param baseDir If not {@code null}, the directory relative to which resources are loaded. @param resource The resource to be loaded. If {@code baseDir} is not {@code null}, it is loaded relative to {@code baseDir}. @return The stream
[ "Loads", "a", "resource", "as", "{", "@link", "InputStream", "}", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ResourceLoader.java#L259-L261
apache/flink
flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java
MetricConfig.getDouble
public double getDouble(String key, double defaultValue) { String argument = getProperty(key, null); return argument == null ? defaultValue : Double.parseDouble(argument); }
java
public double getDouble(String key, double defaultValue) { String argument = getProperty(key, null); return argument == null ? defaultValue : Double.parseDouble(argument); }
[ "public", "double", "getDouble", "(", "String", "key", ",", "double", "defaultValue", ")", "{", "String", "argument", "=", "getProperty", "(", "key", ",", "null", ")", ";", "return", "argument", "==", "null", "?", "defaultValue", ":", "Double", ".", "parse...
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found. @param key the hashtable key. @param defaultValue a default value. @return the value in this property list with the specified key value parsed as a double.
[ "Searches", "for", "the", "property", "with", "the", "specified", "key", "in", "this", "property", "list", ".", "If", "the", "key", "is", "not", "found", "in", "this", "property", "list", "the", "default", "property", "list", "and", "its", "defaults", "rec...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java#L93-L98
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java
PoolManager.incRunningTasks
public void incRunningTasks(String poolName, TaskType type, int inc) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); if (!runningMap.containsKey(poolName)) { runningMap.put(poolName, 0); } int runningTasks = runningMap.get(poolName) + inc; runningMap.put(poolName, runningTasks); }
java
public void incRunningTasks(String poolName, TaskType type, int inc) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); if (!runningMap.containsKey(poolName)) { runningMap.put(poolName, 0); } int runningTasks = runningMap.get(poolName) + inc; runningMap.put(poolName, runningTasks); }
[ "public", "void", "incRunningTasks", "(", "String", "poolName", ",", "TaskType", "type", ",", "int", "inc", ")", "{", "Map", "<", "String", ",", "Integer", ">", "runningMap", "=", "(", "type", "==", "TaskType", ".", "MAP", "?", "poolRunningMaps", ":", "p...
Set the number of running tasks in a pool @param poolName name of the pool @param type type of task to be set @param runningTasks number of current running tasks
[ "Set", "the", "number", "of", "running", "tasks", "in", "a", "pool" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L725-L733
atomix/atomix
protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/RaftSessionSequencer.java
RaftSessionSequencer.sequenceEvent
public void sequenceEvent(PublishRequest request, Runnable callback) { if (requestSequence == responseSequence) { log.trace("Completing {}", request); callback.run(); eventIndex = request.eventIndex(); } else { eventCallbacks.add(new EventCallback(request, callback)); completeResponses(); } }
java
public void sequenceEvent(PublishRequest request, Runnable callback) { if (requestSequence == responseSequence) { log.trace("Completing {}", request); callback.run(); eventIndex = request.eventIndex(); } else { eventCallbacks.add(new EventCallback(request, callback)); completeResponses(); } }
[ "public", "void", "sequenceEvent", "(", "PublishRequest", "request", ",", "Runnable", "callback", ")", "{", "if", "(", "requestSequence", "==", "responseSequence", ")", "{", "log", ".", "trace", "(", "\"Completing {}\"", ",", "request", ")", ";", "callback", "...
Sequences an event. <p> This method relies on the session event protocol to ensure that events are applied in sequential order. When an event is received, if no operations are outstanding, the event is immediately completed since the event could not have occurred concurrently with any other operation. Otherwise, the event is queued and the next response in the sequence of responses is checked to determine whether the event can be completed. @param request The publish request. @param callback The callback to sequence.
[ "Sequences", "an", "event", ".", "<p", ">", "This", "method", "relies", "on", "the", "session", "event", "protocol", "to", "ensure", "that", "events", "are", "applied", "in", "sequential", "order", ".", "When", "an", "event", "is", "received", "if", "no", ...
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/RaftSessionSequencer.java#L102-L111
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.withInputStream
public static Object withInputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.InputStream") Closure closure) throws IOException { return IOGroovyMethods.withStream(newInputStream(file), closure); }
java
public static Object withInputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.InputStream") Closure closure) throws IOException { return IOGroovyMethods.withStream(newInputStream(file), closure); }
[ "public", "static", "Object", "withInputStream", "(", "File", "file", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.InputStream\"", ")", "Closure", "closure", ")", "throws", "IOException", "{", "return"...
Create a new InputStream for this file and passes it into the closure. This method ensures the stream is closed after the closure returns. @param file a File @param closure a closure @return the value returned by the closure @throws IOException if an IOException occurs. @see IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure) @since 1.5.2
[ "Create", "a", "new", "InputStream", "for", "this", "file", "and", "passes", "it", "into", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1842-L1844
casbin/jcasbin
src/main/java/org/casbin/jcasbin/util/Util.java
Util.logPrintf
public static void logPrintf(String format, String... v) { if (enableLog) { String tmp = String.format(format, (Object[]) v); logger.log(Level.INFO, tmp); } }
java
public static void logPrintf(String format, String... v) { if (enableLog) { String tmp = String.format(format, (Object[]) v); logger.log(Level.INFO, tmp); } }
[ "public", "static", "void", "logPrintf", "(", "String", "format", ",", "String", "...", "v", ")", "{", "if", "(", "enableLog", ")", "{", "String", "tmp", "=", "String", ".", "format", "(", "format", ",", "(", "Object", "[", "]", ")", "v", ")", ";",...
logPrintf prints the log with the format. @param format the format of the log. @param v the log.
[ "logPrintf", "prints", "the", "log", "with", "the", "format", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/util/Util.java#L47-L52
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/Version.java
Version.overlapping
public static boolean overlapping(Version min1, Version max1, Version min2, Version max2) { // Versions overlap if: // - either Min or Max values are identical (fast test for real scenarios) // - Min1|Max1 are within the range Min2-Max2 // - Min2|Max2 are within the range Min1-Max1 return min1.equals(min2) || max1.equals(max2) || min2.within(min1, max1) || max2.within(min1, min2) || min1.within(min2, max2) || max1.within(min2, max2); }
java
public static boolean overlapping(Version min1, Version max1, Version min2, Version max2) { // Versions overlap if: // - either Min or Max values are identical (fast test for real scenarios) // - Min1|Max1 are within the range Min2-Max2 // - Min2|Max2 are within the range Min1-Max1 return min1.equals(min2) || max1.equals(max2) || min2.within(min1, max1) || max2.within(min1, min2) || min1.within(min2, max2) || max1.within(min2, max2); }
[ "public", "static", "boolean", "overlapping", "(", "Version", "min1", ",", "Version", "max1", ",", "Version", "min2", ",", "Version", "max2", ")", "{", "// Versions overlap if:", "// - either Min or Max values are identical (fast test for real scenarios)", "// - Min1|Max1 are...
Determines if 2 version ranges have any overlap @param min1 Version The 1st range @param max1 Version The 1st range @param min2 Version The 2nd range @param max2 Version The 2nd range @return boolean True if the version ranges overlap
[ "Determines", "if", "2", "version", "ranges", "have", "any", "overlap" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/Version.java#L210-L219
sannies/mp4parser
muxer/src/main/java/org/mp4parser/muxer/tracks/AbstractH26XTrack.java
AbstractH26XTrack.createSampleObject
protected Sample createSampleObject(List<? extends ByteBuffer> nals) { byte[] sizeInfo = new byte[nals.size() * 4]; ByteBuffer sizeBuf = ByteBuffer.wrap(sizeInfo); for (ByteBuffer b : nals) { sizeBuf.putInt(b.remaining()); } ByteBuffer[] data = new ByteBuffer[nals.size() * 2]; for (int i = 0; i < nals.size(); i++) { data[2 * i] = ByteBuffer.wrap(sizeInfo, i * 4, 4); data[2 * i + 1] = nals.get(i); } return new SampleImpl(data, getCurrentSampleEntry()); }
java
protected Sample createSampleObject(List<? extends ByteBuffer> nals) { byte[] sizeInfo = new byte[nals.size() * 4]; ByteBuffer sizeBuf = ByteBuffer.wrap(sizeInfo); for (ByteBuffer b : nals) { sizeBuf.putInt(b.remaining()); } ByteBuffer[] data = new ByteBuffer[nals.size() * 2]; for (int i = 0; i < nals.size(); i++) { data[2 * i] = ByteBuffer.wrap(sizeInfo, i * 4, 4); data[2 * i + 1] = nals.get(i); } return new SampleImpl(data, getCurrentSampleEntry()); }
[ "protected", "Sample", "createSampleObject", "(", "List", "<", "?", "extends", "ByteBuffer", ">", "nals", ")", "{", "byte", "[", "]", "sizeInfo", "=", "new", "byte", "[", "nals", ".", "size", "(", ")", "*", "4", "]", ";", "ByteBuffer", "sizeBuf", "=", ...
Builds an MP4 sample from a list of NALs. Each NAL will be preceded by its 4 byte (unit32) length. @param nals a list of NALs that form the sample @return sample as it appears in the MP4 file
[ "Builds", "an", "MP4", "sample", "from", "a", "list", "of", "NALs", ".", "Each", "NAL", "will", "be", "preceded", "by", "its", "4", "byte", "(", "unit32", ")", "length", "." ]
train
https://github.com/sannies/mp4parser/blob/3382ff5d489363900f352a8da0f794a20ad3b063/muxer/src/main/java/org/mp4parser/muxer/tracks/AbstractH26XTrack.java#L81-L96
alkacon/opencms-core
src/org/opencms/util/CmsStringUtil.java
CmsStringUtil.getRelativeSubPath
public static String getRelativeSubPath(String base, String path) { String result = null; base = CmsStringUtil.joinPaths(base, "/"); path = CmsStringUtil.joinPaths(path, "/"); if (path.startsWith(base)) { result = path.substring(base.length()); } if (result != null) { if (result.endsWith("/")) { result = result.substring(0, result.length() - 1); } if (!result.startsWith("/")) { result = "/" + result; } } return result; }
java
public static String getRelativeSubPath(String base, String path) { String result = null; base = CmsStringUtil.joinPaths(base, "/"); path = CmsStringUtil.joinPaths(path, "/"); if (path.startsWith(base)) { result = path.substring(base.length()); } if (result != null) { if (result.endsWith("/")) { result = result.substring(0, result.length() - 1); } if (!result.startsWith("/")) { result = "/" + result; } } return result; }
[ "public", "static", "String", "getRelativeSubPath", "(", "String", "base", ",", "String", "path", ")", "{", "String", "result", "=", "null", ";", "base", "=", "CmsStringUtil", ".", "joinPaths", "(", "base", ",", "\"/\"", ")", ";", "path", "=", "CmsStringUt...
Converts the given path to a path relative to a base folder, but only if it actually is a sub-path of the latter, otherwise <code>null</code> is returned.<p> <b>Directly exposed for JSP EL</b>, not through {@link org.opencms.jsp.util.CmsJspElFunctions}.<p> @param base the base path @param path the path which should be converted to a relative path @return 'path' converted to a path relative to 'base', or null if 'path' is not a sub-folder of 'base'
[ "Converts", "the", "given", "path", "to", "a", "path", "relative", "to", "a", "base", "folder", "but", "only", "if", "it", "actually", "is", "a", "sub", "-", "path", "of", "the", "latter", "otherwise", "<code", ">", "null<", "/", "code", ">", "is", "...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L992-L1009
jmeetsma/Iglu-Http
src/main/java/org/ijsberg/iglu/util/http/MultiPartReader.java
MultiPartReader.readMultipartUpload
public long readMultipartUpload() throws IOException { input = request.getInputStream(); //the next variable stores all post data and is useful for debug purposes bytesReadAsLine = input.readLine(line, 0, BUFFER_SIZE); if (bytesReadAsLine <= 2) { return 0; } bytesRead = bytesReadAsLine; //save the multipart boundary string String boundary = new String(line, 0, bytesReadAsLine - 2); while ((bytesReadAsLine = input.readLine(line, 0, BUFFER_SIZE)) != -1) { readPropertiesUntilEmptyLine(); //TODO fullFileName may be empty in which case storage output stream cannot be opened bytesRead += bytesReadAsLine; bytesReadAsLine = input.readLine(line, 0, BUFFER_SIZE); //before the boundary that indicates the end of the file //there is a line separator which does not belong to the file //it's necessary to filter it out without too much memory overhead //it's not clear where the line separator comes from. //this has to work on Windows and UNIX partialCopyOutputStream = getStorageOutputStream(); readUploadedFile(boundary, partialCopyOutputStream); bytesRead += bytesReadAsLine; if (fullFileName != null) { if (uploadDir == null) { FileData file = new FileData(fullFileName, contentType); file.setDescription("Obtained from: " + fullFileName); file.setRawData(((ByteArrayOutputStream) partialCopyOutputStream).toByteArray()); //propertyName is specified in HTML form like <INPUT TYPE="FILE" NAME="myPropertyName"> request.setAttribute(propertyName, file); System.out.println(new LogEntry("file found in multi-part data: " + file)); } } else { String propertyValue = partialCopyOutputStream.toString(); request.setAttribute(propertyName, propertyValue); System.out.println(new LogEntry("property found in multi-part data:" + propertyName + '=' + propertyValue)); } partialCopyOutputStream.close(); fullFileName = null; } System.out.println(new LogEntry("post data retrieved from multi-part data: " + bytesRead + " bytes")); return bytesRead; }
java
public long readMultipartUpload() throws IOException { input = request.getInputStream(); //the next variable stores all post data and is useful for debug purposes bytesReadAsLine = input.readLine(line, 0, BUFFER_SIZE); if (bytesReadAsLine <= 2) { return 0; } bytesRead = bytesReadAsLine; //save the multipart boundary string String boundary = new String(line, 0, bytesReadAsLine - 2); while ((bytesReadAsLine = input.readLine(line, 0, BUFFER_SIZE)) != -1) { readPropertiesUntilEmptyLine(); //TODO fullFileName may be empty in which case storage output stream cannot be opened bytesRead += bytesReadAsLine; bytesReadAsLine = input.readLine(line, 0, BUFFER_SIZE); //before the boundary that indicates the end of the file //there is a line separator which does not belong to the file //it's necessary to filter it out without too much memory overhead //it's not clear where the line separator comes from. //this has to work on Windows and UNIX partialCopyOutputStream = getStorageOutputStream(); readUploadedFile(boundary, partialCopyOutputStream); bytesRead += bytesReadAsLine; if (fullFileName != null) { if (uploadDir == null) { FileData file = new FileData(fullFileName, contentType); file.setDescription("Obtained from: " + fullFileName); file.setRawData(((ByteArrayOutputStream) partialCopyOutputStream).toByteArray()); //propertyName is specified in HTML form like <INPUT TYPE="FILE" NAME="myPropertyName"> request.setAttribute(propertyName, file); System.out.println(new LogEntry("file found in multi-part data: " + file)); } } else { String propertyValue = partialCopyOutputStream.toString(); request.setAttribute(propertyName, propertyValue); System.out.println(new LogEntry("property found in multi-part data:" + propertyName + '=' + propertyValue)); } partialCopyOutputStream.close(); fullFileName = null; } System.out.println(new LogEntry("post data retrieved from multi-part data: " + bytesRead + " bytes")); return bytesRead; }
[ "public", "long", "readMultipartUpload", "(", ")", "throws", "IOException", "{", "input", "=", "request", ".", "getInputStream", "(", ")", ";", "//the next variable stores all post data and is useful for debug purposes", "bytesReadAsLine", "=", "input", ".", "readLine", "...
Reads uploaded files and form variables from POSTed data. Files are stored on disk in case uploadDir is not null. Otherwise files are stored as attributes on the http-request in the form of FileObjects, using the name of the html-form-variable as key. Plain properties are stored as String attributes on the http-request. In case a file to be stored on disk already exists, the existing file is preserved and renamed by adding a sequence number to its name. @return total nr of bytes read @throws IOException @see org.ijsberg.iglu.util.io.FileData
[ "Reads", "uploaded", "files", "and", "form", "variables", "from", "POSTed", "data", ".", "Files", "are", "stored", "on", "disk", "in", "case", "uploadDir", "is", "not", "null", ".", "Otherwise", "files", "are", "stored", "as", "attributes", "on", "the", "h...
train
https://github.com/jmeetsma/Iglu-Http/blob/5b5ed3b417285dc79b7aa013bf2340bb5ba1ffbe/src/main/java/org/ijsberg/iglu/util/http/MultiPartReader.java#L87-L151
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
DynamicReportBuilder.addAutoText
public DynamicReportBuilder addAutoText(String message, byte position, byte alignment, int width) { HorizontalBandAlignment alignment_ = HorizontalBandAlignment.buildAligment(alignment); AutoText text = new AutoText(message, position, alignment_, width); addAutoText(text); return this; }
java
public DynamicReportBuilder addAutoText(String message, byte position, byte alignment, int width) { HorizontalBandAlignment alignment_ = HorizontalBandAlignment.buildAligment(alignment); AutoText text = new AutoText(message, position, alignment_, width); addAutoText(text); return this; }
[ "public", "DynamicReportBuilder", "addAutoText", "(", "String", "message", ",", "byte", "position", ",", "byte", "alignment", ",", "int", "width", ")", "{", "HorizontalBandAlignment", "alignment_", "=", "HorizontalBandAlignment", ".", "buildAligment", "(", "alignment"...
Adds a custom fixed message (literal) in header or footer. The message width will be the page width<br> The parameters are all constants from the <code>ar.com.fdvs.dj.domain.AutoText</code> class <br> <br> @param message The text to show @param position POSITION_HEADER or POSITION_FOOTER @param alignment <br>ALIGMENT_LEFT <br> ALIGMENT_CENTER <br> ALIGMENT_RIGHT @param width the width of the message @return
[ "Adds", "a", "custom", "fixed", "message", "(", "literal", ")", "in", "header", "or", "footer", ".", "The", "message", "width", "will", "be", "the", "page", "width<br", ">", "The", "parameters", "are", "all", "constants", "from", "the", "<code", ">", "ar...
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L223-L228
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java
ClassesManager.getFieldName
private static String getFieldName(Class<?> aClass,String regex){ for (Field field : aClass.getDeclaredFields()) if(field.getName().matches(regex)) return field.getName(); return null; }
java
private static String getFieldName(Class<?> aClass,String regex){ for (Field field : aClass.getDeclaredFields()) if(field.getName().matches(regex)) return field.getName(); return null; }
[ "private", "static", "String", "getFieldName", "(", "Class", "<", "?", ">", "aClass", ",", "String", "regex", ")", "{", "for", "(", "Field", "field", ":", "aClass", ".", "getDeclaredFields", "(", ")", ")", "if", "(", "field", ".", "getName", "(", ")", ...
This method returns the name of the field whose name matches with regex. @param aClass class to check @param regex regex used to find the field @return the field name if exists, null otherwise
[ "This", "method", "returns", "the", "name", "of", "the", "field", "whose", "name", "matches", "with", "regex", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L413-L419
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/EmailApi.java
EmailApi.saveEmail
public ApiSuccessResponse saveEmail(String id, SaveData saveData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = saveEmailWithHttpInfo(id, saveData); return resp.getData(); }
java
public ApiSuccessResponse saveEmail(String id, SaveData saveData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = saveEmailWithHttpInfo(id, saveData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "saveEmail", "(", "String", "id", ",", "SaveData", "saveData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "saveEmailWithHttpInfo", "(", "id", ",", "saveData", ")", ";", "return", ...
Save email information to UCS Save email information of interaction specified in the id path parameter @param id id of interaction to save (required) @param saveData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Save", "email", "information", "to", "UCS", "Save", "email", "information", "of", "interaction", "specified", "in", "the", "id", "path", "parameter" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/EmailApi.java#L763-L766
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/ThemeUtil.java
ThemeUtil.getFraction
public static float getFraction(@NonNull final Context context, @AttrRes final int resourceId, final int base, final int pbase) { return getFraction(context, -1, resourceId, base, pbase); }
java
public static float getFraction(@NonNull final Context context, @AttrRes final int resourceId, final int base, final int pbase) { return getFraction(context, -1, resourceId, base, pbase); }
[ "public", "static", "float", "getFraction", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "AttrRes", "final", "int", "resourceId", ",", "final", "int", "base", ",", "final", "int", "pbase", ")", "{", "return", "getFraction", "(", "context", ...
Obtains the fraction, which corresponds to a specific resource id, from a context's theme. If the given resource id is invalid, a {@link NotFoundException} will be thrown. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource id of the attribute, which should be obtained, as an {@link Integer} value. The resource id must corresponds to a valid theme attribute @param base The base value of this fraction as an {@link Integer} value. A standard fraction is multiplied by this value @param pbase The parent base value of this fraction as an {@link Integer} value. A parent fraction (nn%p) is multiplied by this value @return The fraction, which has been obtained, as a {@link Float} value
[ "Obtains", "the", "fraction", "which", "corresponds", "to", "a", "specific", "resource", "id", "from", "a", "context", "s", "theme", ".", "If", "the", "given", "resource", "id", "is", "invalid", "a", "{", "@link", "NotFoundException", "}", "will", "be", "t...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ThemeUtil.java#L603-L606
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/savedialog/SVGSaveDialog.java
SVGSaveDialog.showError
private static void showError(Component parent, String title, String msg) { JOptionPane.showMessageDialog(parent, msg, title, JOptionPane.ERROR_MESSAGE); }
java
private static void showError(Component parent, String title, String msg) { JOptionPane.showMessageDialog(parent, msg, title, JOptionPane.ERROR_MESSAGE); }
[ "private", "static", "void", "showError", "(", "Component", "parent", ",", "String", "title", ",", "String", "msg", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "parent", ",", "msg", ",", "title", ",", "JOptionPane", ".", "ERROR_MESSAGE", ")", ";"...
Helper method to show a error message as "popup". Calls {@link JOptionPane#showMessageDialog(java.awt.Component, Object)}. @param parent The parent component for the popup. @param msg The message to be displayed.
[ "Helper", "method", "to", "show", "a", "error", "message", "as", "popup", ".", "Calls", "{", "@link", "JOptionPane#showMessageDialog", "(", "java", ".", "awt", ".", "Component", "Object", ")", "}", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/savedialog/SVGSaveDialog.java#L220-L222
astrapi69/mystic-crypt
crypt-core/src/main/java/de/alpharogroup/crypto/gm/GoogleMapsUrlSigner.java
GoogleMapsUrlSigner.signRequest
public static String signRequest(final URL url, final String yourGooglePrivateKeyString) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException, URISyntaxException { // Retrieve the proper URL components to sign final String resource = url.getPath() + '?' + url.getQuery(); // Get an HMAC-SHA1 signing key from the raw key bytes final SecretKeySpec sha1Key = new SecretKeySpec( convertToKeyByteArray(yourGooglePrivateKeyString), "HmacSHA1"); // Get an HMAC-SHA1 Mac instance and initialize it with the HMAC-SHA1 // key final Mac mac = Mac.getInstance("HmacSHA1"); mac.init(sha1Key); // compute the binary signature for the request final byte[] sigBytes = mac.doFinal(resource.getBytes()); // base 64 encode the binary signature // Base64 is JDK 1.8 only - older versions may need to use Apache // Commons or similar. String signature = Base64.getEncoder().encodeToString(sigBytes); // convert the signature to 'web safe' base 64 signature = signature.replace('+', '-'); signature = signature.replace('/', '_'); final String signedRequestPath = resource + "&signature=" + signature; final String urlGoogleMapSignedRequest = url.getProtocol() + "://" + url.getHost() + signedRequestPath; return urlGoogleMapSignedRequest; }
java
public static String signRequest(final URL url, final String yourGooglePrivateKeyString) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException, URISyntaxException { // Retrieve the proper URL components to sign final String resource = url.getPath() + '?' + url.getQuery(); // Get an HMAC-SHA1 signing key from the raw key bytes final SecretKeySpec sha1Key = new SecretKeySpec( convertToKeyByteArray(yourGooglePrivateKeyString), "HmacSHA1"); // Get an HMAC-SHA1 Mac instance and initialize it with the HMAC-SHA1 // key final Mac mac = Mac.getInstance("HmacSHA1"); mac.init(sha1Key); // compute the binary signature for the request final byte[] sigBytes = mac.doFinal(resource.getBytes()); // base 64 encode the binary signature // Base64 is JDK 1.8 only - older versions may need to use Apache // Commons or similar. String signature = Base64.getEncoder().encodeToString(sigBytes); // convert the signature to 'web safe' base 64 signature = signature.replace('+', '-'); signature = signature.replace('/', '_'); final String signedRequestPath = resource + "&signature=" + signature; final String urlGoogleMapSignedRequest = url.getProtocol() + "://" + url.getHost() + signedRequestPath; return urlGoogleMapSignedRequest; }
[ "public", "static", "String", "signRequest", "(", "final", "URL", "url", ",", "final", "String", "yourGooglePrivateKeyString", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyException", ",", "UnsupportedEncodingException", ",", "URISyntaxException", "{", "// R...
Returns the full url as String object with the signature as parameter. @param url the url @param yourGooglePrivateKeyString the your google private key string @return the string @throws NoSuchAlgorithmException the no such algorithm exception @throws InvalidKeyException the invalid key exception @throws UnsupportedEncodingException the unsupported encoding exception @throws URISyntaxException the URI syntax exception
[ "Returns", "the", "full", "url", "as", "String", "object", "with", "the", "signature", "as", "parameter", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-core/src/main/java/de/alpharogroup/crypto/gm/GoogleMapsUrlSigner.java#L130-L162
h2oai/h2o-3
h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java
EasyPredictModelWrapper.predictMultinomial
public MultinomialModelPrediction predictMultinomial(RowData data, double offset) throws PredictException { double[] preds = preamble(ModelCategory.Multinomial, data, offset); MultinomialModelPrediction p = new MultinomialModelPrediction(); if (enableLeafAssignment) { // only get leaf node assignment if enabled SharedTreeMojoModel.LeafNodeAssignments assignments = leafNodeAssignmentExtended(data); p.leafNodeAssignments = assignments._paths; p.leafNodeAssignmentIds = assignments._nodeIds; } p.classProbabilities = new double[m.getNumResponseClasses()]; p.labelIndex = (int) preds[0]; String[] domainValues = m.getDomainValues(m.getResponseIdx()); p.label = domainValues[p.labelIndex]; System.arraycopy(preds, 1, p.classProbabilities, 0, p.classProbabilities.length); if (enableStagedProbabilities) { double[] rawData = nanArray(m.nfeatures()); rawData = fillRawData(data, rawData); p.stageProbabilities = ((SharedTreeMojoModel) m).scoreStagedPredictions(rawData, preds.length); } return p; }
java
public MultinomialModelPrediction predictMultinomial(RowData data, double offset) throws PredictException { double[] preds = preamble(ModelCategory.Multinomial, data, offset); MultinomialModelPrediction p = new MultinomialModelPrediction(); if (enableLeafAssignment) { // only get leaf node assignment if enabled SharedTreeMojoModel.LeafNodeAssignments assignments = leafNodeAssignmentExtended(data); p.leafNodeAssignments = assignments._paths; p.leafNodeAssignmentIds = assignments._nodeIds; } p.classProbabilities = new double[m.getNumResponseClasses()]; p.labelIndex = (int) preds[0]; String[] domainValues = m.getDomainValues(m.getResponseIdx()); p.label = domainValues[p.labelIndex]; System.arraycopy(preds, 1, p.classProbabilities, 0, p.classProbabilities.length); if (enableStagedProbabilities) { double[] rawData = nanArray(m.nfeatures()); rawData = fillRawData(data, rawData); p.stageProbabilities = ((SharedTreeMojoModel) m).scoreStagedPredictions(rawData, preds.length); } return p; }
[ "public", "MultinomialModelPrediction", "predictMultinomial", "(", "RowData", "data", ",", "double", "offset", ")", "throws", "PredictException", "{", "double", "[", "]", "preds", "=", "preamble", "(", "ModelCategory", ".", "Multinomial", ",", "data", ",", "offset...
Make a prediction on a new data point using a Multinomial model. @param data A new data point. @param offset Prediction offset @return The prediction. @throws PredictException
[ "Make", "a", "prediction", "on", "a", "new", "data", "point", "using", "a", "Multinomial", "model", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L603-L623
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.createOrUpdate
public VirtualNetworkGatewayInner createOrUpdate(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGatewayInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().last().body(); }
java
public VirtualNetworkGatewayInner createOrUpdate(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGatewayInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().last().body(); }
[ "public", "VirtualNetworkGatewayInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ",", "VirtualNetworkGatewayInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Creates or updates a virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param parameters Parameters supplied to create or update virtual network gateway operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualNetworkGatewayInner object if successful.
[ "Creates", "or", "updates", "a", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L209-L211
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java
UriUtils.encodePath
public static String encodePath(String path, String encoding) throws UnsupportedEncodingException { return HierarchicalUriComponents.encodeUriComponent(path, encoding, HierarchicalUriComponents.Type.PATH); }
java
public static String encodePath(String path, String encoding) throws UnsupportedEncodingException { return HierarchicalUriComponents.encodeUriComponent(path, encoding, HierarchicalUriComponents.Type.PATH); }
[ "public", "static", "String", "encodePath", "(", "String", "path", ",", "String", "encoding", ")", "throws", "UnsupportedEncodingException", "{", "return", "HierarchicalUriComponents", ".", "encodeUriComponent", "(", "path", ",", "encoding", ",", "HierarchicalUriCompone...
Encodes the given URI path with the given encoding. @param path the path to be encoded @param encoding the character encoding to encode to @return the encoded path @throws UnsupportedEncodingException when the given encoding parameter is not supported
[ "Encodes", "the", "given", "URI", "path", "with", "the", "given", "encoding", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L274-L276
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.withObjectInputStream
public static <T> T withObjectInputStream(Path self, ClassLoader classLoader, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectInputStream") Closure<T> closure) throws IOException { return IOGroovyMethods.withStream(newObjectInputStream(self, classLoader), closure); }
java
public static <T> T withObjectInputStream(Path self, ClassLoader classLoader, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectInputStream") Closure<T> closure) throws IOException { return IOGroovyMethods.withStream(newObjectInputStream(self, classLoader), closure); }
[ "public", "static", "<", "T", ">", "T", "withObjectInputStream", "(", "Path", "self", ",", "ClassLoader", "classLoader", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.ObjectInputStream\"", ")", "Closure...
Create a new ObjectInputStream for this file associated with the given class loader and pass it to the closure. This method ensures the stream is closed after the closure returns. @param self a Path @param classLoader the class loader to use when loading the class @param closure a closure @return the value returned by the closure @throws java.io.IOException if an IOException occurs. @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure) @since 2.3.0
[ "Create", "a", "new", "ObjectInputStream", "for", "this", "file", "associated", "with", "the", "given", "class", "loader", "and", "pass", "it", "to", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closur...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L191-L193
JavaKoan/koan-annotations
src/main/java/com/javakoan/fixture/io/KoanReader.java
KoanReader.getProblemFromFile
public static String getProblemFromFile(Class<?> koanClass, String methodName) { return getSourceFromFile(koanClass, methodName, PROBLEM_EXTENSION); }
java
public static String getProblemFromFile(Class<?> koanClass, String methodName) { return getSourceFromFile(koanClass, methodName, PROBLEM_EXTENSION); }
[ "public", "static", "String", "getProblemFromFile", "(", "Class", "<", "?", ">", "koanClass", ",", "String", "methodName", ")", "{", "return", "getSourceFromFile", "(", "koanClass", ",", "methodName", ",", "PROBLEM_EXTENSION", ")", ";", "}" ]
Gets problem for a koan by method name. @param koanClass the koan class @param methodName the method name of the problem required @return the problem content to be inserted between the koan start and end markers
[ "Gets", "problem", "for", "a", "koan", "by", "method", "name", "." ]
train
https://github.com/JavaKoan/koan-annotations/blob/e3c4872ae57051a0b74b2efa6f15f4ee9e37d263/src/main/java/com/javakoan/fixture/io/KoanReader.java#L114-L116
line/armeria
core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java
ServerSentEvents.fromStream
public static <T> HttpResponse fromStream(Stream<T> contentStream, Executor executor, Function<? super T, ? extends ServerSentEvent> converter) { return fromStream(defaultHttpHeaders, contentStream, HttpHeaders.EMPTY_HEADERS, executor, converter); }
java
public static <T> HttpResponse fromStream(Stream<T> contentStream, Executor executor, Function<? super T, ? extends ServerSentEvent> converter) { return fromStream(defaultHttpHeaders, contentStream, HttpHeaders.EMPTY_HEADERS, executor, converter); }
[ "public", "static", "<", "T", ">", "HttpResponse", "fromStream", "(", "Stream", "<", "T", ">", "contentStream", ",", "Executor", "executor", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "ServerSentEvent", ">", "converter", ")", "{", "retur...
Creates a new Server-Sent Events stream from the specified {@link Stream} and {@code converter}. @param contentStream the {@link Stream} which publishes the objects supposed to send as contents @param executor the executor which iterates the stream @param converter the converter which converts published objects into {@link ServerSentEvent}s
[ "Creates", "a", "new", "Server", "-", "Sent", "Events", "stream", "from", "the", "specified", "{", "@link", "Stream", "}", "and", "{", "@code", "converter", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java#L213-L216
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java
GVRAssetLoader.loadModel
public GVRSceneObject loadModel(final String filePath, final GVRScene scene) throws IOException { GVRSceneObject model = new GVRSceneObject(mContext); AssetRequest assetRequest = new AssetRequest(model, new GVRResourceVolume(mContext, filePath), scene, null, false); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); assetRequest.setImportSettings(GVRImportSettings.getRecommendedSettings()); model.setName(assetRequest.getBaseName()); if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } return model; }
java
public GVRSceneObject loadModel(final String filePath, final GVRScene scene) throws IOException { GVRSceneObject model = new GVRSceneObject(mContext); AssetRequest assetRequest = new AssetRequest(model, new GVRResourceVolume(mContext, filePath), scene, null, false); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); assetRequest.setImportSettings(GVRImportSettings.getRecommendedSettings()); model.setName(assetRequest.getBaseName()); if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } return model; }
[ "public", "GVRSceneObject", "loadModel", "(", "final", "String", "filePath", ",", "final", "GVRScene", "scene", ")", "throws", "IOException", "{", "GVRSceneObject", "model", "=", "new", "GVRSceneObject", "(", "mContext", ")", ";", "AssetRequest", "assetRequest", "...
Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model and adds it to the specified scene. IAssetEvents are emitted to event listener attached to the context. This function blocks the current thread while loading the model but loads the textures asynchronously in the background. <p> If you are loading large models, you can call {@link #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene)} to load the model asychronously to avoid blocking the main thread. @param filePath A filename, relative to the root of the volume. If the filename starts with "sd:" the file is assumed to reside on the SD Card. If the filename starts with "http:" or "https:" it is assumed to be a URL. Otherwise the file is assumed to be relative to the "assets" directory. @param scene If present, this asset loader will wait until all of the textures have been loaded and then it will add the model to the scene. @return A {@link GVRSceneObject} that contains the meshes with textures and bones and animations. @throws IOException
[ "Loads", "a", "hierarchy", "of", "scene", "objects", "{", "@link", "GVRSceneObject", "}", "from", "a", "3D", "model", "and", "adds", "it", "to", "the", "specified", "scene", ".", "IAssetEvents", "are", "emitted", "to", "event", "listener", "attached", "to", ...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java#L1092-L1109
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java
DerInputBuffer.getBigInteger
BigInteger getBigInteger(int len, boolean makePositive) throws IOException { if (len > available()) throw new IOException("short read of integer"); if (len == 0) { throw new IOException("Invalid encoding: zero length Int value"); } byte[] bytes = new byte[len]; System.arraycopy(buf, pos, bytes, 0, len); skip(len); // check to make sure no extra leading 0s for DER if (len >= 2 && (bytes[0] == 0) && (bytes[1] >= 0)) { throw new IOException("Invalid encoding: redundant leading 0s"); } if (makePositive) { return new BigInteger(1, bytes); } else { return new BigInteger(bytes); } }
java
BigInteger getBigInteger(int len, boolean makePositive) throws IOException { if (len > available()) throw new IOException("short read of integer"); if (len == 0) { throw new IOException("Invalid encoding: zero length Int value"); } byte[] bytes = new byte[len]; System.arraycopy(buf, pos, bytes, 0, len); skip(len); // check to make sure no extra leading 0s for DER if (len >= 2 && (bytes[0] == 0) && (bytes[1] >= 0)) { throw new IOException("Invalid encoding: redundant leading 0s"); } if (makePositive) { return new BigInteger(1, bytes); } else { return new BigInteger(bytes); } }
[ "BigInteger", "getBigInteger", "(", "int", "len", ",", "boolean", "makePositive", ")", "throws", "IOException", "{", "if", "(", "len", ">", "available", "(", ")", ")", "throw", "new", "IOException", "(", "\"short read of integer\"", ")", ";", "if", "(", "len...
Returns the integer which takes up the specified number of bytes in this buffer as a BigInteger. @param len the number of bytes to use. @param makePositive whether to always return a positive value, irrespective of actual encoding @return the integer as a BigInteger.
[ "Returns", "the", "integer", "which", "takes", "up", "the", "specified", "number", "of", "bytes", "in", "this", "buffer", "as", "a", "BigInteger", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java#L149-L172
Alluxio/alluxio
core/common/src/main/java/alluxio/util/ConfigurationUtils.java
ConfigurationUtils.checkRatio
public static float checkRatio(AlluxioConfiguration conf, PropertyKey key) { float value = conf.getFloat(key); Preconditions.checkState(value <= 1.0, "Property %s must not exceed 1, but it is set to %s", key.getName(), value); Preconditions.checkState(value >= 0.0, "Property %s must be non-negative, but it is set to %s", key.getName(), value); return value; }
java
public static float checkRatio(AlluxioConfiguration conf, PropertyKey key) { float value = conf.getFloat(key); Preconditions.checkState(value <= 1.0, "Property %s must not exceed 1, but it is set to %s", key.getName(), value); Preconditions.checkState(value >= 0.0, "Property %s must be non-negative, but it is set to %s", key.getName(), value); return value; }
[ "public", "static", "float", "checkRatio", "(", "AlluxioConfiguration", "conf", ",", "PropertyKey", "key", ")", "{", "float", "value", "=", "conf", ".", "getFloat", "(", "key", ")", ";", "Preconditions", ".", "checkState", "(", "value", "<=", "1.0", ",", "...
Checks that the given property key is a ratio from 0.0 and 1.0, throwing an exception if it is not. @param conf the configuration for looking up the property key @param key the property key @return the property value
[ "Checks", "that", "the", "given", "property", "key", "is", "a", "ratio", "from", "0", ".", "0", "and", "1", ".", "0", "throwing", "an", "exception", "if", "it", "is", "not", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/ConfigurationUtils.java#L318-L325
mike10004/common-helper
imnetio-helper/src/main/java/com/github/mike10004/common/image/ImageInfo.java
ImageInfo.run
private static void run(String sourceName, InputStream in, ImageInfo imageInfo, boolean verbose) { imageInfo.setInput(in); imageInfo.setDetermineImageNumber(true); imageInfo.setCollectComments(verbose); if (imageInfo.check()) { print(sourceName, imageInfo, verbose); } }
java
private static void run(String sourceName, InputStream in, ImageInfo imageInfo, boolean verbose) { imageInfo.setInput(in); imageInfo.setDetermineImageNumber(true); imageInfo.setCollectComments(verbose); if (imageInfo.check()) { print(sourceName, imageInfo, verbose); } }
[ "private", "static", "void", "run", "(", "String", "sourceName", ",", "InputStream", "in", ",", "ImageInfo", "imageInfo", ",", "boolean", "verbose", ")", "{", "imageInfo", ".", "setInput", "(", "in", ")", ";", "imageInfo", ".", "setDetermineImageNumber", "(", ...
/* private String readLine(int firstChar) throws IOException { StringBuffer result = new StringBuffer(); result.append((char)firstChar); return readLine(result); }
[ "/", "*", "private", "String", "readLine", "(", "int", "firstChar", ")", "throws", "IOException", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "()", ";", "result", ".", "append", "((", "char", ")", "firstChar", ")", ";", "return", "readLine", ...
train
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/imnetio-helper/src/main/java/com/github/mike10004/common/image/ImageInfo.java#L1248-L1255
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/NetworkInfo.java
NetworkInfo.of
public static NetworkInfo of(NetworkId networkId, NetworkConfiguration configuration) { return newBuilder(networkId, configuration).build(); }
java
public static NetworkInfo of(NetworkId networkId, NetworkConfiguration configuration) { return newBuilder(networkId, configuration).build(); }
[ "public", "static", "NetworkInfo", "of", "(", "NetworkId", "networkId", ",", "NetworkConfiguration", "configuration", ")", "{", "return", "newBuilder", "(", "networkId", ",", "configuration", ")", ".", "build", "(", ")", ";", "}" ]
Returns a {@code NetworkInfo} object given the network identity. Use {@link StandardNetworkConfiguration} to create a standard network with associated address range. Use {@link SubnetNetworkConfiguration} to create a network that supports subnetworks, up to one per region, each with its own address range.
[ "Returns", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/NetworkInfo.java#L268-L270
ixa-ehu/kaflib
src/main/java/ixa/kaflib/KAFDocument.java
KAFDocument.newRelation
public Relation newRelation(String id, Relational from, Relational to) { idManager.updateCounter(AnnotationType.RELATION, id); Relation newRelation = new Relation(id, from, to); annotationContainer.add(newRelation, Layer.RELATIONS, AnnotationType.RELATION); return newRelation; }
java
public Relation newRelation(String id, Relational from, Relational to) { idManager.updateCounter(AnnotationType.RELATION, id); Relation newRelation = new Relation(id, from, to); annotationContainer.add(newRelation, Layer.RELATIONS, AnnotationType.RELATION); return newRelation; }
[ "public", "Relation", "newRelation", "(", "String", "id", ",", "Relational", "from", ",", "Relational", "to", ")", "{", "idManager", ".", "updateCounter", "(", "AnnotationType", ".", "RELATION", ",", "id", ")", ";", "Relation", "newRelation", "=", "new", "Re...
Creates a new relation between entities and/or sentiment features. It receives its ID as an argument. The relation is added to the document. @param id the ID of the relation @param from source of the relation @param to target of the relation @return a new relation
[ "Creates", "a", "new", "relation", "between", "entities", "and", "/", "or", "sentiment", "features", ".", "It", "receives", "its", "ID", "as", "an", "argument", ".", "The", "relation", "is", "added", "to", "the", "document", "." ]
train
https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L984-L989
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsXmlContainerPageFactory.java
CmsXmlContainerPageFactory.getCache
private static CmsXmlContainerPage getCache(CmsObject cms, CmsResource resource, boolean keepEncoding) { if (resource instanceof I_CmsHistoryResource) { return null; } return getCache().getCacheContainerPage( getCache().getCacheKey(resource.getStructureId(), keepEncoding), cms.getRequestContext().getCurrentProject().isOnlineProject()); }
java
private static CmsXmlContainerPage getCache(CmsObject cms, CmsResource resource, boolean keepEncoding) { if (resource instanceof I_CmsHistoryResource) { return null; } return getCache().getCacheContainerPage( getCache().getCacheKey(resource.getStructureId(), keepEncoding), cms.getRequestContext().getCurrentProject().isOnlineProject()); }
[ "private", "static", "CmsXmlContainerPage", "getCache", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "boolean", "keepEncoding", ")", "{", "if", "(", "resource", "instanceof", "I_CmsHistoryResource", ")", "{", "return", "null", ";", "}", "return", ...
Returns the cached container page.<p> @param cms the cms context @param resource the container page resource @param keepEncoding if to keep the encoding while unmarshalling @return the cached container page, or <code>null</code> if not found
[ "Returns", "the", "cached", "container", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlContainerPageFactory.java#L436-L444
lastaflute/lastaflute
src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java
TypicalLoginAssist.isValidRememberMeCookie
protected boolean isValidRememberMeCookie(String userKey, String expireDate) { final String currentDate = formatForRememberMeExpireDate(timeManager.currentHandyDate()); if (currentDate.compareTo(expireDate) < 0) { // String v.s. String return true; // valid access token within time limit } // expired here logger.debug("The access token for remember-me expired: userKey={} expireDate={}", userKey, expireDate); return false; }
java
protected boolean isValidRememberMeCookie(String userKey, String expireDate) { final String currentDate = formatForRememberMeExpireDate(timeManager.currentHandyDate()); if (currentDate.compareTo(expireDate) < 0) { // String v.s. String return true; // valid access token within time limit } // expired here logger.debug("The access token for remember-me expired: userKey={} expireDate={}", userKey, expireDate); return false; }
[ "protected", "boolean", "isValidRememberMeCookie", "(", "String", "userKey", ",", "String", "expireDate", ")", "{", "final", "String", "currentDate", "=", "formatForRememberMeExpireDate", "(", "timeManager", ".", "currentHandyDate", "(", ")", ")", ";", "if", "(", ...
Are the user ID and expire date extracted from cookie valid? @param userKey The key of the login user. (NotNull) @param expireDate The string expression for expire date of remember-me access token. (NotNull) @return Is a validation for remember-me OK?
[ "Are", "the", "user", "ID", "and", "expire", "date", "extracted", "from", "cookie", "valid?" ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java#L593-L601
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemLiteralResult.java
ElemLiteralResult.throwDOMException
public void throwDOMException(short code, String msg) { String themsg = XSLMessages.createMessage(msg, null); throw new DOMException(code, themsg); }
java
public void throwDOMException(short code, String msg) { String themsg = XSLMessages.createMessage(msg, null); throw new DOMException(code, themsg); }
[ "public", "void", "throwDOMException", "(", "short", "code", ",", "String", "msg", ")", "{", "String", "themsg", "=", "XSLMessages", ".", "createMessage", "(", "msg", ",", "null", ")", ";", "throw", "new", "DOMException", "(", "code", ",", "themsg", ")", ...
Throw a DOMException @param msg key of the error that occured.
[ "Throw", "a", "DOMException" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemLiteralResult.java#L1470-L1476
opentracing-contrib/java-kafka-client
opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java
TracingKafkaUtils.extractSpanContext
public static SpanContext extractSpanContext(Headers headers, Tracer tracer) { return tracer .extract(Format.Builtin.TEXT_MAP, new HeadersMapExtractAdapter(headers, true)); }
java
public static SpanContext extractSpanContext(Headers headers, Tracer tracer) { return tracer .extract(Format.Builtin.TEXT_MAP, new HeadersMapExtractAdapter(headers, true)); }
[ "public", "static", "SpanContext", "extractSpanContext", "(", "Headers", "headers", ",", "Tracer", "tracer", ")", "{", "return", "tracer", ".", "extract", "(", "Format", ".", "Builtin", ".", "TEXT_MAP", ",", "new", "HeadersMapExtractAdapter", "(", "headers", ","...
Extract Span Context from Consumer record headers @param headers Consumer record headers @return span context
[ "Extract", "Span", "Context", "from", "Consumer", "record", "headers" ]
train
https://github.com/opentracing-contrib/java-kafka-client/blob/e3aeec8d68d3a2dead89b9dbdfea3791817e1a26/opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java#L52-L55
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Ingest.java
Ingest.getLagBytes
public long getLagBytes() { try { if (inputEditStream != null && inputEditStream.isInProgress()) { // for file journals it may happen that we read a segment finalized // by primary, but not refreshed by the standby, so length() returns 0 // hence we take max(-1,lag) return Math.max(-1, inputEditStream.length() - this.inputEditStream.getPosition()); } return -1; } catch (IOException ex) { LOG.error("Error getting the lag", ex); return -1; } }
java
public long getLagBytes() { try { if (inputEditStream != null && inputEditStream.isInProgress()) { // for file journals it may happen that we read a segment finalized // by primary, but not refreshed by the standby, so length() returns 0 // hence we take max(-1,lag) return Math.max(-1, inputEditStream.length() - this.inputEditStream.getPosition()); } return -1; } catch (IOException ex) { LOG.error("Error getting the lag", ex); return -1; } }
[ "public", "long", "getLagBytes", "(", ")", "{", "try", "{", "if", "(", "inputEditStream", "!=", "null", "&&", "inputEditStream", ".", "isInProgress", "(", ")", ")", "{", "// for file journals it may happen that we read a segment finalized", "// by primary, but not refresh...
Returns the distance in bytes between the current position inside of the edits log and the length of the edits log
[ "Returns", "the", "distance", "in", "bytes", "between", "the", "current", "position", "inside", "of", "the", "edits", "log", "and", "the", "length", "of", "the", "edits", "log" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Ingest.java#L169-L183
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/HostAddress.java
HostAddress.withDefaultPort
public HostAddress withDefaultPort(int defaultPort) { if (!isValidPort(defaultPort)) { throw new IllegalArgumentException("Port number out of range: " + defaultPort); } if (hasPort() || port == defaultPort) { return this; } return new HostAddress(host, defaultPort); }
java
public HostAddress withDefaultPort(int defaultPort) { if (!isValidPort(defaultPort)) { throw new IllegalArgumentException("Port number out of range: " + defaultPort); } if (hasPort() || port == defaultPort) { return this; } return new HostAddress(host, defaultPort); }
[ "public", "HostAddress", "withDefaultPort", "(", "int", "defaultPort", ")", "{", "if", "(", "!", "isValidPort", "(", "defaultPort", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Port number out of range: \"", "+", "defaultPort", ")", ";", "}",...
Provide a default port if the parsed string contained only a host. <p> You can chain this after {@link #fromString(String)} to include a port in case the port was omitted from the input string. If a port was already provided, then this method is a no-op. @param defaultPort a port number, from [0..65535] @return a HostAddress instance, guaranteed to have a defined port.
[ "Provide", "a", "default", "port", "if", "the", "parsed", "string", "contained", "only", "a", "host", ".", "<p", ">", "You", "can", "chain", "this", "after", "{", "@link", "#fromString", "(", "String", ")", "}", "to", "include", "a", "port", "in", "cas...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/HostAddress.java#L232-L242
google/gwtmockito
gwtmockito/src/main/java/com/google/gwtmockito/fakes/FakeMessagesProvider.java
FakeMessagesProvider.getFake
@Override @SuppressWarnings("unchecked") // safe since the proxy implements type public T getFake(Class<?> type) { return (T) Proxy.newProxyInstance(FakeMessagesProvider.class.getClassLoader(), new Class<?>[] {type}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Exception { if (method.getName().equals("ensureInjected")) { return true; } else if (method.getName().equals("hashCode")) { return proxy.getClass().hashCode(); } else if (method.getName().equals("equals")) { return proxy.getClass().equals(args[0].getClass()); } else if (method.getReturnType() == String.class) { return buildMessage(method, args); } else if (method.getReturnType() == SafeHtml.class) { return SafeHtmlUtils.fromTrustedString(buildMessage(method, args)); } else { throw new IllegalArgumentException(method.getName() + " must return either String or SafeHtml"); } } }); }
java
@Override @SuppressWarnings("unchecked") // safe since the proxy implements type public T getFake(Class<?> type) { return (T) Proxy.newProxyInstance(FakeMessagesProvider.class.getClassLoader(), new Class<?>[] {type}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Exception { if (method.getName().equals("ensureInjected")) { return true; } else if (method.getName().equals("hashCode")) { return proxy.getClass().hashCode(); } else if (method.getName().equals("equals")) { return proxy.getClass().equals(args[0].getClass()); } else if (method.getReturnType() == String.class) { return buildMessage(method, args); } else if (method.getReturnType() == SafeHtml.class) { return SafeHtmlUtils.fromTrustedString(buildMessage(method, args)); } else { throw new IllegalArgumentException(method.getName() + " must return either String or SafeHtml"); } } }); }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// safe since the proxy implements type", "public", "T", "getFake", "(", "Class", "<", "?", ">", "type", ")", "{", "return", "(", "T", ")", "Proxy", ".", "newProxyInstance", "(", "FakeMessages...
Returns a new instance of the given type that implements methods as described in the class description. @param type interface to be implemented by the returned type.
[ "Returns", "a", "new", "instance", "of", "the", "given", "type", "that", "implements", "methods", "as", "described", "in", "the", "class", "description", "." ]
train
https://github.com/google/gwtmockito/blob/e886a9b9d290169b5f83582dd89b7545c5f198a2/gwtmockito/src/main/java/com/google/gwtmockito/fakes/FakeMessagesProvider.java#L45-L68
sgroschupf/zkclient
src/main/java/org/I0Itec/zkclient/ZkClient.java
ZkClient.createPersistent
public void createPersistent(String path, boolean createParents) throws ZkInterruptedException, IllegalArgumentException, ZkException, RuntimeException { createPersistent(path, createParents, ZooDefs.Ids.OPEN_ACL_UNSAFE); }
java
public void createPersistent(String path, boolean createParents) throws ZkInterruptedException, IllegalArgumentException, ZkException, RuntimeException { createPersistent(path, createParents, ZooDefs.Ids.OPEN_ACL_UNSAFE); }
[ "public", "void", "createPersistent", "(", "String", "path", ",", "boolean", "createParents", ")", "throws", "ZkInterruptedException", ",", "IllegalArgumentException", ",", "ZkException", ",", "RuntimeException", "{", "createPersistent", "(", "path", ",", "createParents...
Create a persistent node and set its ACLs. @param path @param createParents if true all parent dirs are created as well and no {@link ZkNodeExistsException} is thrown in case the path already exists @throws ZkInterruptedException if operation was interrupted, or a required reconnection got interrupted @throws IllegalArgumentException if called from anything except the ZooKeeper event thread @throws ZkException if any ZooKeeper exception occurred @throws RuntimeException if any other exception occurs
[ "Create", "a", "persistent", "node", "and", "set", "its", "ACLs", "." ]
train
https://github.com/sgroschupf/zkclient/blob/03ccf12c70aca2f771bfcd94d44dc7c4d4a1495e/src/main/java/org/I0Itec/zkclient/ZkClient.java#L270-L272
alkacon/opencms-core
src/org/opencms/file/collectors/CmsDefaultResourceCollector.java
CmsDefaultResourceCollector.allInFolderNavPos
protected List<CmsResource> allInFolderNavPos(CmsObject cms, String param, boolean readSubTree, int numResults) throws CmsException { CmsCollectorData data = new CmsCollectorData(param); String foldername = CmsResource.getFolderPath(data.getFileName()); CmsResourceFilter filter = CmsResourceFilter.DEFAULT_FILES.addRequireType(data.getType()).addExcludeFlags( CmsResource.FLAG_TEMPFILE); if (data.isExcludeTimerange() && !cms.getRequestContext().getCurrentProject().isOnlineProject()) { // include all not yet released and expired resources in an offline project filter = filter.addExcludeTimerange(); } List<CmsResource> foundResources = cms.readResources(foldername, filter, readSubTree); // the Cms resources are saved in a map keyed by their nav elements // to save time sorting the resources by the value of their NavPos property CmsJspNavBuilder navBuilder = new CmsJspNavBuilder(cms); Map<CmsJspNavElement, CmsResource> navElementMap = new HashMap<CmsJspNavElement, CmsResource>(); for (int i = 0, n = foundResources.size(); i < n; i++) { CmsResource resource = foundResources.get(i); CmsJspNavElement navElement = navBuilder.getNavigationForResource(cms.getSitePath(resource)); // check if the resource has the NavPos property set or not if ((navElement != null) && (navElement.getNavPosition() != Float.MAX_VALUE)) { navElementMap.put(navElement, resource); } else if (LOG.isInfoEnabled()) { // printing a log messages makes it a little easier to identify // resources having not the NavPos property set LOG.info( Messages.get().getBundle().key(Messages.LOG_RESOURCE_WITHOUT_NAVPROP_1, cms.getSitePath(resource))); } } // all found resources have the NavPos property set // sort the nav. elements, and pull the found Cms resources // from the map in the correct order into a list // only resources with the NavPos property set are used here List<CmsJspNavElement> navElementList = new ArrayList<CmsJspNavElement>(navElementMap.keySet()); List<CmsResource> result = new ArrayList<CmsResource>(); Collections.sort(navElementList); for (int i = 0, n = navElementList.size(); i < n; i++) { CmsJspNavElement navElement = navElementList.get(i); result.add(navElementMap.get(navElement)); } return shrinkToFit(result, data.getCount(), numResults); }
java
protected List<CmsResource> allInFolderNavPos(CmsObject cms, String param, boolean readSubTree, int numResults) throws CmsException { CmsCollectorData data = new CmsCollectorData(param); String foldername = CmsResource.getFolderPath(data.getFileName()); CmsResourceFilter filter = CmsResourceFilter.DEFAULT_FILES.addRequireType(data.getType()).addExcludeFlags( CmsResource.FLAG_TEMPFILE); if (data.isExcludeTimerange() && !cms.getRequestContext().getCurrentProject().isOnlineProject()) { // include all not yet released and expired resources in an offline project filter = filter.addExcludeTimerange(); } List<CmsResource> foundResources = cms.readResources(foldername, filter, readSubTree); // the Cms resources are saved in a map keyed by their nav elements // to save time sorting the resources by the value of their NavPos property CmsJspNavBuilder navBuilder = new CmsJspNavBuilder(cms); Map<CmsJspNavElement, CmsResource> navElementMap = new HashMap<CmsJspNavElement, CmsResource>(); for (int i = 0, n = foundResources.size(); i < n; i++) { CmsResource resource = foundResources.get(i); CmsJspNavElement navElement = navBuilder.getNavigationForResource(cms.getSitePath(resource)); // check if the resource has the NavPos property set or not if ((navElement != null) && (navElement.getNavPosition() != Float.MAX_VALUE)) { navElementMap.put(navElement, resource); } else if (LOG.isInfoEnabled()) { // printing a log messages makes it a little easier to identify // resources having not the NavPos property set LOG.info( Messages.get().getBundle().key(Messages.LOG_RESOURCE_WITHOUT_NAVPROP_1, cms.getSitePath(resource))); } } // all found resources have the NavPos property set // sort the nav. elements, and pull the found Cms resources // from the map in the correct order into a list // only resources with the NavPos property set are used here List<CmsJspNavElement> navElementList = new ArrayList<CmsJspNavElement>(navElementMap.keySet()); List<CmsResource> result = new ArrayList<CmsResource>(); Collections.sort(navElementList); for (int i = 0, n = navElementList.size(); i < n; i++) { CmsJspNavElement navElement = navElementList.get(i); result.add(navElementMap.get(navElement)); } return shrinkToFit(result, data.getCount(), numResults); }
[ "protected", "List", "<", "CmsResource", ">", "allInFolderNavPos", "(", "CmsObject", "cms", ",", "String", "param", ",", "boolean", "readSubTree", ",", "int", "numResults", ")", "throws", "CmsException", "{", "CmsCollectorData", "data", "=", "new", "CmsCollectorDa...
Collects all resources in a folder (or subtree) sorted by the NavPos property.<p> @param cms the current user's Cms object @param param the collector's parameter(s) @param readSubTree if true, collects all resources in the subtree @param numResults the number of results @return a List of Cms resources found by the collector @throws CmsException if something goes wrong
[ "Collects", "all", "resources", "in", "a", "folder", "(", "or", "subtree", ")", "sorted", "by", "the", "NavPos", "property", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/collectors/CmsDefaultResourceCollector.java#L255-L304
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.L3_L93
@Pure public static Point2d L3_L93(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_93_N, LAMBERT_93_C, LAMBERT_93_XS, LAMBERT_93_YS); }
java
@Pure public static Point2d L3_L93(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_93_N, LAMBERT_93_C, LAMBERT_93_XS, LAMBERT_93_YS); }
[ "@", "Pure", "public", "static", "Point2d", "L3_L93", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_3_N", ",", "LAMBERT_3_C", ",", "LAMBERT_3_XS", ",", ...
This function convert France Lambert III coordinate to France Lambert 93 coordinate. @param x is the coordinate in France Lambert III @param y is the coordinate in France Lambert III @return the France Lambert 93 coordinate.
[ "This", "function", "convert", "France", "Lambert", "III", "coordinate", "to", "France", "Lambert", "93", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L651-L664
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/FilterVirtualFileVisitor.java
FilterVirtualFileVisitor.checkAttributes
private static VisitorAttributes checkAttributes(VirtualFileFilter filter, VisitorAttributes attributes) { if (filter == null) { throw MESSAGES.nullArgument("filter"); } // Specified if (attributes != null) { return attributes; } // From the filter if (filter instanceof VirtualFileFilterWithAttributes) { return ((VirtualFileFilterWithAttributes) filter).getAttributes(); } // It will use the default return null; }
java
private static VisitorAttributes checkAttributes(VirtualFileFilter filter, VisitorAttributes attributes) { if (filter == null) { throw MESSAGES.nullArgument("filter"); } // Specified if (attributes != null) { return attributes; } // From the filter if (filter instanceof VirtualFileFilterWithAttributes) { return ((VirtualFileFilterWithAttributes) filter).getAttributes(); } // It will use the default return null; }
[ "private", "static", "VisitorAttributes", "checkAttributes", "(", "VirtualFileFilter", "filter", ",", "VisitorAttributes", "attributes", ")", "{", "if", "(", "filter", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"filter\"", ")", ";", ...
Check the attributes @param filter the filter @param attributes the attributes @return the attributes @throws IllegalArgumentException for a null filter
[ "Check", "the", "attributes" ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/FilterVirtualFileVisitor.java#L57-L67
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newUserException
public static UserException newUserException(Throwable cause, String message, Object... args) { return new UserException(format(message, args), cause); }
java
public static UserException newUserException(Throwable cause, String message, Object... args) { return new UserException(format(message, args), cause); }
[ "public", "static", "UserException", "newUserException", "(", "Throwable", "cause", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "new", "UserException", "(", "format", "(", "message", ",", "args", ")", ",", "cause", ")", ";", ...
Constructs and initializes a new {@link UserException} with the given {@link Throwable cause} and {@link String message} formatted with the given {@link Object[] arguments}. @param cause {@link Throwable} identified as the reason this {@link UserException} was thrown. @param message {@link String} describing the {@link UserException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link UserException} with the given {@link Throwable cause} and {@link String message}. @see org.cp.elements.util.UserException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "UserException", "}", "with", "the", "given", "{", "@link", "Throwable", "cause", "}", "and", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L943-L945
google/j2objc
jre_emul/android/frameworks/base/core/java/android/text/Selection.java
Selection.setSelection
public static void setSelection(Spannable text, int start, int stop) { // int len = text.length(); // start = pin(start, 0, len); XXX remove unless we really need it // stop = pin(stop, 0, len); int ostart = getSelectionStart(text); int oend = getSelectionEnd(text); if (ostart != start || oend != stop) { text.setSpan(SELECTION_START, start, start, Spanned.SPAN_POINT_POINT|Spanned.SPAN_INTERMEDIATE); text.setSpan(SELECTION_END, stop, stop, Spanned.SPAN_POINT_POINT); } }
java
public static void setSelection(Spannable text, int start, int stop) { // int len = text.length(); // start = pin(start, 0, len); XXX remove unless we really need it // stop = pin(stop, 0, len); int ostart = getSelectionStart(text); int oend = getSelectionEnd(text); if (ostart != start || oend != stop) { text.setSpan(SELECTION_START, start, start, Spanned.SPAN_POINT_POINT|Spanned.SPAN_INTERMEDIATE); text.setSpan(SELECTION_END, stop, stop, Spanned.SPAN_POINT_POINT); } }
[ "public", "static", "void", "setSelection", "(", "Spannable", "text", ",", "int", "start", ",", "int", "stop", ")", "{", "// int len = text.length();", "// start = pin(start, 0, len); XXX remove unless we really need it", "// stop = pin(stop, 0, len);", "int", "ostart", "=",...
Set the selection anchor to <code>start</code> and the selection edge to <code>stop</code>.
[ "Set", "the", "selection", "anchor", "to", "<code", ">", "start<", "/", "code", ">", "and", "the", "selection", "edge", "to", "<code", ">", "stop<", "/", "code", ">", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/Selection.java#L65-L79
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/GeneralizedParetoDistribution.java
GeneralizedParetoDistribution.logpdf
public static double logpdf(double x, double mu, double sigma, double xi) { x = (x - mu) / sigma; // Check support: if(x < 0 || (xi < 0 && x > -1. / xi)) { return Double.NEGATIVE_INFINITY; } if(xi == 0) { return Double.POSITIVE_INFINITY; } return ((xi == -1) ? 0. : FastMath.log(1 + xi * x) * (-1 / xi - 1)) - FastMath.log(sigma); }
java
public static double logpdf(double x, double mu, double sigma, double xi) { x = (x - mu) / sigma; // Check support: if(x < 0 || (xi < 0 && x > -1. / xi)) { return Double.NEGATIVE_INFINITY; } if(xi == 0) { return Double.POSITIVE_INFINITY; } return ((xi == -1) ? 0. : FastMath.log(1 + xi * x) * (-1 / xi - 1)) - FastMath.log(sigma); }
[ "public", "static", "double", "logpdf", "(", "double", "x", ",", "double", "mu", ",", "double", "sigma", ",", "double", "xi", ")", "{", "x", "=", "(", "x", "-", "mu", ")", "/", "sigma", ";", "// Check support:", "if", "(", "x", "<", "0", "||", "(...
PDF of GPD distribution @param x Value @param mu Location parameter mu @param sigma Scale parameter sigma @param xi Shape parameter xi (= -kappa) @return PDF at position x.
[ "PDF", "of", "GPD", "distribution" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/GeneralizedParetoDistribution.java#L143-L153
powermock/powermock
powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java
SuppressCode.suppressMethod
public static synchronized void suppressMethod(Class<?> clazz, String methodName, Class<?>[] parameterTypes) { Method method = null; if (parameterTypes.length > 0) { method = Whitebox.getMethod(clazz, methodName, parameterTypes); } else { method = WhiteboxImpl.findMethodOrThrowException(clazz, methodName, parameterTypes); } MockRepository.addMethodToSuppress(method); }
java
public static synchronized void suppressMethod(Class<?> clazz, String methodName, Class<?>[] parameterTypes) { Method method = null; if (parameterTypes.length > 0) { method = Whitebox.getMethod(clazz, methodName, parameterTypes); } else { method = WhiteboxImpl.findMethodOrThrowException(clazz, methodName, parameterTypes); } MockRepository.addMethodToSuppress(method); }
[ "public", "static", "synchronized", "void", "suppressMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "[", "]", "parameterTypes", ")", "{", "Method", "method", "=", "null", ";", "if", "(", "paramete...
Suppress a specific method call. Use this for overloaded methods.
[ "Suppress", "a", "specific", "method", "call", ".", "Use", "this", "for", "overloaded", "methods", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java#L235-L243
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncRequest.java
PartitionReplicaSyncRequest.sendResponse
private void sendResponse(Collection<Operation> operations, ServiceNamespace ns) { NodeEngine nodeEngine = getNodeEngine(); PartitionReplicaSyncResponse syncResponse = createResponse(operations, ns); Address target = getCallerAddress(); ILogger logger = getLogger(); if (logger.isFinestEnabled()) { logger.finest("Sending sync response to -> " + target + " for partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + ns); } // PartitionReplicaSyncResponse is TargetAware and sent directly without invocation system. syncResponse.setTarget(target); OperationService operationService = nodeEngine.getOperationService(); operationService.send(syncResponse, target); }
java
private void sendResponse(Collection<Operation> operations, ServiceNamespace ns) { NodeEngine nodeEngine = getNodeEngine(); PartitionReplicaSyncResponse syncResponse = createResponse(operations, ns); Address target = getCallerAddress(); ILogger logger = getLogger(); if (logger.isFinestEnabled()) { logger.finest("Sending sync response to -> " + target + " for partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + ns); } // PartitionReplicaSyncResponse is TargetAware and sent directly without invocation system. syncResponse.setTarget(target); OperationService operationService = nodeEngine.getOperationService(); operationService.send(syncResponse, target); }
[ "private", "void", "sendResponse", "(", "Collection", "<", "Operation", ">", "operations", ",", "ServiceNamespace", "ns", ")", "{", "NodeEngine", "nodeEngine", "=", "getNodeEngine", "(", ")", ";", "PartitionReplicaSyncResponse", "syncResponse", "=", "createResponse", ...
Send a synchronization response to the caller replica containing the replication operations to be executed
[ "Send", "a", "synchronization", "response", "to", "the", "caller", "replica", "containing", "the", "replication", "operations", "to", "be", "executed" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncRequest.java#L192-L208
lightblue-platform/lightblue-client
core/src/main/java/com/redhat/lightblue/client/Query.java
Query.withStringIgnoreCase
public static Query withStringIgnoreCase(String field, String value) { return Query.withString(field, value, true); }
java
public static Query withStringIgnoreCase(String field, String value) { return Query.withString(field, value, true); }
[ "public", "static", "Query", "withStringIgnoreCase", "(", "String", "field", ",", "String", "value", ")", "{", "return", "Query", ".", "withString", "(", "field", ",", "value", ",", "true", ")", ";", "}" ]
<pre> { field: <field>, regex: <^string$>, caseInsensitive: true, ... } </pre>
[ "<pre", ">", "{", "field", ":", "<field", ">", "regex", ":", "<^string$", ">", "caseInsensitive", ":", "true", "...", "}", "<", "/", "pre", ">" ]
train
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/Query.java#L211-L213
netty/netty
codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java
ByteToMessageDecoder.decodeRemovalReentryProtection
final void decodeRemovalReentryProtection(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { decodeState = STATE_CALLING_CHILD_DECODE; try { decode(ctx, in, out); } finally { boolean removePending = decodeState == STATE_HANDLER_REMOVED_PENDING; decodeState = STATE_INIT; if (removePending) { handlerRemoved(ctx); } } }
java
final void decodeRemovalReentryProtection(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { decodeState = STATE_CALLING_CHILD_DECODE; try { decode(ctx, in, out); } finally { boolean removePending = decodeState == STATE_HANDLER_REMOVED_PENDING; decodeState = STATE_INIT; if (removePending) { handlerRemoved(ctx); } } }
[ "final", "void", "decodeRemovalReentryProtection", "(", "ChannelHandlerContext", "ctx", ",", "ByteBuf", "in", ",", "List", "<", "Object", ">", "out", ")", "throws", "Exception", "{", "decodeState", "=", "STATE_CALLING_CHILD_DECODE", ";", "try", "{", "decode", "(",...
Decode the from one {@link ByteBuf} to an other. This method will be called till either the input {@link ByteBuf} has nothing to read when return from this method or till nothing was read from the input {@link ByteBuf}. @param ctx the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to @param in the {@link ByteBuf} from which to read data @param out the {@link List} to which decoded messages should be added @throws Exception is thrown if an error occurs
[ "Decode", "the", "from", "one", "{", "@link", "ByteBuf", "}", "to", "an", "other", ".", "This", "method", "will", "be", "called", "till", "either", "the", "input", "{", "@link", "ByteBuf", "}", "has", "nothing", "to", "read", "when", "return", "from", ...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java#L498-L510
foundation-runtime/monitoring
monitoring-api/src/main/java/com/cisco/oss/foundation/monitoring/ServerInfo.java
ServerInfo.sendAttributeChangeNotification
@Override public void sendAttributeChangeNotification(String msg, String attributeName, String attributeType, Object oldValue, Object newValue) { LOGGER.debug("Sending Notification " + (attrNotificationSeq + 1) + ":" + msg + ":" + attributeName + ":" + attributeType + ":" + oldValue.toString() + ":" + newValue.toString()); Notification n = new AttributeChangeNotification(this, attrNotificationSeq++, System.currentTimeMillis(), msg, attributeName, attributeType, oldValue, newValue); sendNotification(n); LOGGER.debug("Notification Sent " + attrNotificationSeq); }
java
@Override public void sendAttributeChangeNotification(String msg, String attributeName, String attributeType, Object oldValue, Object newValue) { LOGGER.debug("Sending Notification " + (attrNotificationSeq + 1) + ":" + msg + ":" + attributeName + ":" + attributeType + ":" + oldValue.toString() + ":" + newValue.toString()); Notification n = new AttributeChangeNotification(this, attrNotificationSeq++, System.currentTimeMillis(), msg, attributeName, attributeType, oldValue, newValue); sendNotification(n); LOGGER.debug("Notification Sent " + attrNotificationSeq); }
[ "@", "Override", "public", "void", "sendAttributeChangeNotification", "(", "String", "msg", ",", "String", "attributeName", ",", "String", "attributeType", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "{", "LOGGER", ".", "debug", "(", "\"Sending Noti...
Sends a notification to registered clients about the change in value of an attribute. @param msg A String containing the message of the notification. @param attributeName A String giving the name of the attribute. @param attributeType A String containing the type of the attribute. @param oldValue An object representing value of the attribute before the change. @param newValue An object representing value of the attribute after the change.
[ "Sends", "a", "notification", "to", "registered", "clients", "about", "the", "change", "in", "value", "of", "an", "attribute", "." ]
train
https://github.com/foundation-runtime/monitoring/blob/a85ec72dc5558f787704fb13d9125a5803403ee5/monitoring-api/src/main/java/com/cisco/oss/foundation/monitoring/ServerInfo.java#L117-L127
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java
NotificationHubsInner.debugSendAsync
public Observable<DebugSendResponseInner> debugSendAsync(String resourceGroupName, String namespaceName, String notificationHubName) { return debugSendWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<DebugSendResponseInner>, DebugSendResponseInner>() { @Override public DebugSendResponseInner call(ServiceResponse<DebugSendResponseInner> response) { return response.body(); } }); }
java
public Observable<DebugSendResponseInner> debugSendAsync(String resourceGroupName, String namespaceName, String notificationHubName) { return debugSendWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<DebugSendResponseInner>, DebugSendResponseInner>() { @Override public DebugSendResponseInner call(ServiceResponse<DebugSendResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DebugSendResponseInner", ">", "debugSendAsync", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "String", "notificationHubName", ")", "{", "return", "debugSendWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
test send a push notification. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DebugSendResponseInner object
[ "test", "send", "a", "push", "notification", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L742-L749
JetBrains/xodus
environment/src/main/java/jetbrains/exodus/tree/patricia/MutableNode.java
MutableNode.splitKey
MutableNode splitKey(final int prefixLength, final byte nextByte) { final byte[] keyBytes = keySequence.getBytesUnsafe(); final ByteIterable prefixKey; if (prefixLength == 0) { prefixKey = ByteIterable.EMPTY; } else if (prefixLength == 1) { prefixKey = SingleByteIterable.getIterable(keyBytes[0]); } else { prefixKey = new ArrayByteIterable(keyBytes, prefixLength); } final MutableNode prefix = new MutableNode(prefixKey); final int suffixLength = keySequence.getLength() - prefixLength - 1; final ByteIterable suffixKey; if (suffixLength == 0) { suffixKey = ByteIterable.EMPTY; } else if (suffixLength == 1) { suffixKey = SingleByteIterable.getIterable(keyBytes[prefixLength + 1]); } else { suffixKey = keySequence.subIterable(prefixLength + 1, suffixLength); } final MutableNode suffix = new MutableNode(suffixKey, value, // copy children of this node to the suffix one children); prefix.setChild(nextByte, suffix); return prefix; }
java
MutableNode splitKey(final int prefixLength, final byte nextByte) { final byte[] keyBytes = keySequence.getBytesUnsafe(); final ByteIterable prefixKey; if (prefixLength == 0) { prefixKey = ByteIterable.EMPTY; } else if (prefixLength == 1) { prefixKey = SingleByteIterable.getIterable(keyBytes[0]); } else { prefixKey = new ArrayByteIterable(keyBytes, prefixLength); } final MutableNode prefix = new MutableNode(prefixKey); final int suffixLength = keySequence.getLength() - prefixLength - 1; final ByteIterable suffixKey; if (suffixLength == 0) { suffixKey = ByteIterable.EMPTY; } else if (suffixLength == 1) { suffixKey = SingleByteIterable.getIterable(keyBytes[prefixLength + 1]); } else { suffixKey = keySequence.subIterable(prefixLength + 1, suffixLength); } final MutableNode suffix = new MutableNode(suffixKey, value, // copy children of this node to the suffix one children); prefix.setChild(nextByte, suffix); return prefix; }
[ "MutableNode", "splitKey", "(", "final", "int", "prefixLength", ",", "final", "byte", "nextByte", ")", "{", "final", "byte", "[", "]", "keyBytes", "=", "keySequence", ".", "getBytesUnsafe", "(", ")", ";", "final", "ByteIterable", "prefixKey", ";", "if", "(",...
Splits current node onto two ones: prefix defined by prefix length and suffix linked with suffix via nextByte. @param prefixLength length of the prefix. @param nextByte next byte after prefix linking it with suffix. @return the prefix node.
[ "Splits", "current", "node", "onto", "two", "ones", ":", "prefix", "defined", "by", "prefix", "length", "and", "suffix", "linked", "with", "suffix", "via", "nextByte", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/tree/patricia/MutableNode.java#L209-L234
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlayEngine.java
PlayEngine.sendOnPlayStatus
private void sendOnPlayStatus(String code, int duration, long bytes) { if (log.isDebugEnabled()) { log.debug("Sending onPlayStatus - code: {} duration: {} bytes: {}", code, duration, bytes); } // create the buffer IoBuffer buf = IoBuffer.allocate(102); buf.setAutoExpand(true); Output out = new Output(buf); out.writeString("onPlayStatus"); ObjectMap<Object, Object> args = new ObjectMap<>(); args.put("code", code); args.put("level", Status.STATUS); args.put("duration", duration); args.put("bytes", bytes); String name = currentItem.get().getName(); if (StatusCodes.NS_PLAY_TRANSITION_COMPLETE.equals(code)) { args.put("clientId", streamId); args.put("details", name); args.put("description", String.format("Transitioned to %s", name)); args.put("isFastPlay", false); } out.writeObject(args); buf.flip(); Notify event = new Notify(buf, "onPlayStatus"); if (lastMessageTs > 0) { event.setTimestamp(lastMessageTs); } else { event.setTimestamp(0); } RTMPMessage msg = RTMPMessage.build(event); doPushMessage(msg); }
java
private void sendOnPlayStatus(String code, int duration, long bytes) { if (log.isDebugEnabled()) { log.debug("Sending onPlayStatus - code: {} duration: {} bytes: {}", code, duration, bytes); } // create the buffer IoBuffer buf = IoBuffer.allocate(102); buf.setAutoExpand(true); Output out = new Output(buf); out.writeString("onPlayStatus"); ObjectMap<Object, Object> args = new ObjectMap<>(); args.put("code", code); args.put("level", Status.STATUS); args.put("duration", duration); args.put("bytes", bytes); String name = currentItem.get().getName(); if (StatusCodes.NS_PLAY_TRANSITION_COMPLETE.equals(code)) { args.put("clientId", streamId); args.put("details", name); args.put("description", String.format("Transitioned to %s", name)); args.put("isFastPlay", false); } out.writeObject(args); buf.flip(); Notify event = new Notify(buf, "onPlayStatus"); if (lastMessageTs > 0) { event.setTimestamp(lastMessageTs); } else { event.setTimestamp(0); } RTMPMessage msg = RTMPMessage.build(event); doPushMessage(msg); }
[ "private", "void", "sendOnPlayStatus", "(", "String", "code", ",", "int", "duration", ",", "long", "bytes", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Sending onPlayStatus - code: {} duration: {} bytes: {}...
Sends an onPlayStatus message. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/NetDataEvent.html @param code @param duration @param bytes
[ "Sends", "an", "onPlayStatus", "message", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1163-L1194
symulakr/gwt-generators
src/main/java/com/github/symulakr/gwt/generators/rebind/Logger.java
Logger.die
public void die(String message, Object... params) throws UnableToCompleteException { internalLog(TreeLogger.ERROR, String.format(message, params)); throw new UnableToCompleteException(); }
java
public void die(String message, Object... params) throws UnableToCompleteException { internalLog(TreeLogger.ERROR, String.format(message, params)); throw new UnableToCompleteException(); }
[ "public", "void", "die", "(", "String", "message", ",", "Object", "...", "params", ")", "throws", "UnableToCompleteException", "{", "internalLog", "(", "TreeLogger", ".", "ERROR", ",", "String", ".", "format", "(", "message", ",", "params", ")", ")", ";", ...
Post an error message and halt processing. This method always throws an {@link com.google.gwt.core.ext.UnableToCompleteException}
[ "Post", "an", "error", "message", "and", "halt", "processing", ".", "This", "method", "always", "throws", "an", "{" ]
train
https://github.com/symulakr/gwt-generators/blob/fb34ea6a5dcc9e83b5ab2e420b638bbef3cfe589/src/main/java/com/github/symulakr/gwt/generators/rebind/Logger.java#L46-L50
pierre/serialization
hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/ThriftStorage.java
ThriftStorage.setLocation
@Override public void setLocation(String location, Job job) throws IOException { setIOSerializations(job.getConfiguration()); FileInputFormat.setInputPaths(job, location); }
java
@Override public void setLocation(String location, Job job) throws IOException { setIOSerializations(job.getConfiguration()); FileInputFormat.setInputPaths(job, location); }
[ "@", "Override", "public", "void", "setLocation", "(", "String", "location", ",", "Job", "job", ")", "throws", "IOException", "{", "setIOSerializations", "(", "job", ".", "getConfiguration", "(", ")", ")", ";", "FileInputFormat", ".", "setInputPaths", "(", "jo...
Communicate to the loader the location of the object(s) being loaded. The location string passed to the LoadFunc here is the return value of {@link org.apache.pig.LoadFunc#relativeToAbsolutePath(String, org.apache.hadoop.fs.Path)}. Implementations should use this method to communicate the location (and any other information) to its underlying InputFormat through the Job object. <p/> This method will be called in the backend multiple times. Implementations should bear in mind that this method is called multiple times and should ensure there are no inconsistent side effects due to the multiple calls. @param location Location as returned by {@link org.apache.pig.LoadFunc#relativeToAbsolutePath(String, org.apache.hadoop.fs.Path)} @param job the {@link org.apache.hadoop.mapreduce.Job} object store or retrieve earlier stored information from the {@link org.apache.pig.impl.util.UDFContext} @throws java.io.IOException if the location is not valid.
[ "Communicate", "to", "the", "loader", "the", "location", "of", "the", "object", "(", "s", ")", "being", "loaded", ".", "The", "location", "string", "passed", "to", "the", "LoadFunc", "here", "is", "the", "return", "value", "of", "{", "@link", "org", ".",...
train
https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/ThriftStorage.java#L101-L106
ziccardi/jnrpe
jnrpe-plugins/src/main/java/it/jnrpe/plugin/CCheckOracle.java
CCheckOracle.checkAlive
private List<Metric> checkAlive(final Connection c, final ICommandLine cl) throws BadThresholdException, SQLException { List<Metric> metricList = new ArrayList<Metric>(); Statement stmt = null; ResultSet rs = null; long lStart = System.currentTimeMillis(); try { stmt = c.createStatement(); rs = stmt.executeQuery(QRY_CHECK_ALIVE); if (!rs.next()) { // Should never happen... throw new SQLException("Unable to execute a 'SELECT SYSDATE FROM DUAL' query"); } long elapsed = (System.currentTimeMillis() - lStart) / 1000L; metricList.add(new Metric("conn", "Connection time : " + elapsed + "s", new BigDecimal(elapsed), new BigDecimal(0), null)); return metricList; } finally { DBUtils.closeQuietly(rs); DBUtils.closeQuietly(stmt); } }
java
private List<Metric> checkAlive(final Connection c, final ICommandLine cl) throws BadThresholdException, SQLException { List<Metric> metricList = new ArrayList<Metric>(); Statement stmt = null; ResultSet rs = null; long lStart = System.currentTimeMillis(); try { stmt = c.createStatement(); rs = stmt.executeQuery(QRY_CHECK_ALIVE); if (!rs.next()) { // Should never happen... throw new SQLException("Unable to execute a 'SELECT SYSDATE FROM DUAL' query"); } long elapsed = (System.currentTimeMillis() - lStart) / 1000L; metricList.add(new Metric("conn", "Connection time : " + elapsed + "s", new BigDecimal(elapsed), new BigDecimal(0), null)); return metricList; } finally { DBUtils.closeQuietly(rs); DBUtils.closeQuietly(stmt); } }
[ "private", "List", "<", "Metric", ">", "checkAlive", "(", "final", "Connection", "c", ",", "final", "ICommandLine", "cl", ")", "throws", "BadThresholdException", ",", "SQLException", "{", "List", "<", "Metric", ">", "metricList", "=", "new", "ArrayList", "<", ...
Checks if the database is reacheble. @param c The connection to the database @param cl The command line as received from JNRPE @return The plugin result @throws BadThresholdException - @throws SQLException
[ "Checks", "if", "the", "database", "is", "reacheble", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/CCheckOracle.java#L96-L123
lecousin/java-compression
lzma/src/main/java/net/lecousin/compression/lzma/Optimum.java
Optimum.set3
void set3(int newPrice, int optCur, int back2, int len2, int back) { price = newPrice; optPrev = optCur + len2 + 1; backPrev = back; prev1IsLiteral = true; hasPrev2 = true; optPrev2 = optCur; backPrev2 = back2; }
java
void set3(int newPrice, int optCur, int back2, int len2, int back) { price = newPrice; optPrev = optCur + len2 + 1; backPrev = back; prev1IsLiteral = true; hasPrev2 = true; optPrev2 = optCur; backPrev2 = back2; }
[ "void", "set3", "(", "int", "newPrice", ",", "int", "optCur", ",", "int", "back2", ",", "int", "len2", ",", "int", "back", ")", "{", "price", "=", "newPrice", ";", "optPrev", "=", "optCur", "+", "len2", "+", "1", ";", "backPrev", "=", "back", ";", ...
Sets to indicate three LZMA symbols of which the second one is a literal.
[ "Sets", "to", "indicate", "three", "LZMA", "symbols", "of", "which", "the", "second", "one", "is", "a", "literal", "." ]
train
https://github.com/lecousin/java-compression/blob/19c8001fb3655817a52a3b8ab69501e3df7a2b4a/lzma/src/main/java/net/lecousin/compression/lzma/Optimum.java#L54-L62
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java
MetadataFinder.attachMetadataCache
public void attachMetadataCache(SlotReference slot, File file) throws IOException { ensureRunning(); if (slot.player < 1 || slot.player > 4 || DeviceFinder.getInstance().getLatestAnnouncementFrom(slot.player) == null) { throw new IllegalArgumentException("unable to attach metadata cache for player " + slot.player); } if ((slot.slot != CdjStatus.TrackSourceSlot.USB_SLOT) && (slot.slot != CdjStatus.TrackSourceSlot.SD_SLOT)) { throw new IllegalArgumentException("unable to attach metadata cache for slot " + slot.slot); } MetadataCache cache = new MetadataCache(file); final MediaDetails slotDetails = getMediaDetailsFor(slot); if (cache.sourceMedia != null && slotDetails != null) { if (!slotDetails.hashKey().equals(cache.sourceMedia.hashKey())) { throw new IllegalArgumentException("Cache was created for different media (" + cache.sourceMedia.hashKey() + ") than is in the slot (" + slotDetails.hashKey() + ")."); } if (slotDetails.hasChanged(cache.sourceMedia)) { logger.warn("Media has changed (" + slotDetails + ") since cache was created (" + cache.sourceMedia + "). Attaching anyway as instructed."); } } attachMetadataCacheInternal(slot, cache); }
java
public void attachMetadataCache(SlotReference slot, File file) throws IOException { ensureRunning(); if (slot.player < 1 || slot.player > 4 || DeviceFinder.getInstance().getLatestAnnouncementFrom(slot.player) == null) { throw new IllegalArgumentException("unable to attach metadata cache for player " + slot.player); } if ((slot.slot != CdjStatus.TrackSourceSlot.USB_SLOT) && (slot.slot != CdjStatus.TrackSourceSlot.SD_SLOT)) { throw new IllegalArgumentException("unable to attach metadata cache for slot " + slot.slot); } MetadataCache cache = new MetadataCache(file); final MediaDetails slotDetails = getMediaDetailsFor(slot); if (cache.sourceMedia != null && slotDetails != null) { if (!slotDetails.hashKey().equals(cache.sourceMedia.hashKey())) { throw new IllegalArgumentException("Cache was created for different media (" + cache.sourceMedia.hashKey() + ") than is in the slot (" + slotDetails.hashKey() + ")."); } if (slotDetails.hasChanged(cache.sourceMedia)) { logger.warn("Media has changed (" + slotDetails + ") since cache was created (" + cache.sourceMedia + "). Attaching anyway as instructed."); } } attachMetadataCacheInternal(slot, cache); }
[ "public", "void", "attachMetadataCache", "(", "SlotReference", "slot", ",", "File", "file", ")", "throws", "IOException", "{", "ensureRunning", "(", ")", ";", "if", "(", "slot", ".", "player", "<", "1", "||", "slot", ".", "player", ">", "4", "||", "Devic...
Attach a metadata cache file to a particular player media slot, so the cache will be used instead of querying the player for metadata. This supports operation with metadata during shows where DJs are using all four player numbers and heavily cross-linking between them. If the media is ejected from that player slot, the cache will be detached. @param slot the media slot to which a meta data cache is to be attached @param file the metadata cache to be attached @throws IOException if there is a problem reading the cache file @throws IllegalArgumentException if an invalid player number or slot is supplied @throws IllegalStateException if the metadata finder is not running
[ "Attach", "a", "metadata", "cache", "file", "to", "a", "particular", "player", "media", "slot", "so", "the", "cache", "will", "be", "used", "instead", "of", "querying", "the", "player", "for", "metadata", ".", "This", "supports", "operation", "with", "metada...
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L540-L563
google/closure-compiler
src/com/google/javascript/jscomp/ProcessClosurePrimitives.java
ProcessClosurePrimitives.processForwardDeclare
private void processForwardDeclare(Node n, Node parent) { CodingConvention convention = compiler.getCodingConvention(); String typeDeclaration = null; try { typeDeclaration = Iterables.getOnlyElement( convention.identifyTypeDeclarationCall(n)); } catch (NullPointerException | NoSuchElementException | IllegalArgumentException e) { compiler.report( JSError.make( n, INVALID_FORWARD_DECLARE, "A single type could not identified for the goog.forwardDeclare statement")); } if (typeDeclaration != null) { compiler.forwardDeclareType(typeDeclaration); // Forward declaration was recorded and we can remove the call. Node toRemove = parent.isExprResult() ? parent : parent.getParent(); NodeUtil.deleteNode(toRemove, compiler); } }
java
private void processForwardDeclare(Node n, Node parent) { CodingConvention convention = compiler.getCodingConvention(); String typeDeclaration = null; try { typeDeclaration = Iterables.getOnlyElement( convention.identifyTypeDeclarationCall(n)); } catch (NullPointerException | NoSuchElementException | IllegalArgumentException e) { compiler.report( JSError.make( n, INVALID_FORWARD_DECLARE, "A single type could not identified for the goog.forwardDeclare statement")); } if (typeDeclaration != null) { compiler.forwardDeclareType(typeDeclaration); // Forward declaration was recorded and we can remove the call. Node toRemove = parent.isExprResult() ? parent : parent.getParent(); NodeUtil.deleteNode(toRemove, compiler); } }
[ "private", "void", "processForwardDeclare", "(", "Node", "n", ",", "Node", "parent", ")", "{", "CodingConvention", "convention", "=", "compiler", ".", "getCodingConvention", "(", ")", ";", "String", "typeDeclaration", "=", "null", ";", "try", "{", "typeDeclarati...
Process a goog.forwardDeclare() call and record the specified forward declaration.
[ "Process", "a", "goog", ".", "forwardDeclare", "()", "call", "and", "record", "the", "specified", "forward", "declaration", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java#L927-L948
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/AtomDODeserializer.java
AtomDODeserializer.addObjectProperties
private void addObjectProperties(Feed feed, DigitalObject obj) throws ObjectIntegrityException { PID pid; try { pid = new PID(feed.getId().toString()); } catch (MalformedPIDException e) { throw new ObjectIntegrityException(e.getMessage(), e); } String label = feed.getTitle(); String state = m_xpath.valueOf("/a:feed/a:category[@scheme='" + MODEL.STATE.uri + "']/@term", feed); String createDate = m_xpath.valueOf("/a:feed/a:category[@scheme='" + MODEL.CREATED_DATE.uri + "']/@term", feed); obj.setPid(pid.toString()); try { obj.setState(DOTranslationUtility.readStateAttribute(state)); } catch (ParseException e) { throw new ObjectIntegrityException("Could not read object state", e); } obj.setLabel(label); obj.setOwnerId(getOwnerId(feed)); obj.setCreateDate(DateUtility.convertStringToDate(createDate)); obj.setLastModDate(feed.getUpdated()); setExtProps(obj, feed); }
java
private void addObjectProperties(Feed feed, DigitalObject obj) throws ObjectIntegrityException { PID pid; try { pid = new PID(feed.getId().toString()); } catch (MalformedPIDException e) { throw new ObjectIntegrityException(e.getMessage(), e); } String label = feed.getTitle(); String state = m_xpath.valueOf("/a:feed/a:category[@scheme='" + MODEL.STATE.uri + "']/@term", feed); String createDate = m_xpath.valueOf("/a:feed/a:category[@scheme='" + MODEL.CREATED_DATE.uri + "']/@term", feed); obj.setPid(pid.toString()); try { obj.setState(DOTranslationUtility.readStateAttribute(state)); } catch (ParseException e) { throw new ObjectIntegrityException("Could not read object state", e); } obj.setLabel(label); obj.setOwnerId(getOwnerId(feed)); obj.setCreateDate(DateUtility.convertStringToDate(createDate)); obj.setLastModDate(feed.getUpdated()); setExtProps(obj, feed); }
[ "private", "void", "addObjectProperties", "(", "Feed", "feed", ",", "DigitalObject", "obj", ")", "throws", "ObjectIntegrityException", "{", "PID", "pid", ";", "try", "{", "pid", "=", "new", "PID", "(", "feed", ".", "getId", "(", ")", ".", "toString", "(", ...
Set the Fedora Object properties from the Feed metadata. @throws ObjectIntegrityException
[ "Set", "the", "Fedora", "Object", "properties", "from", "the", "Feed", "metadata", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/AtomDODeserializer.java#L160-L191
arquillian/arquillian-core
config/impl-base/src/main/java/org/jboss/arquillian/config/impl/extension/StringPropertyReplacer.java
StringPropertyReplacer.replaceProperties
public static String replaceProperties(final String string) { Properties props = System.getProperties(); for (Map.Entry<String, String> var : System.getenv().entrySet()) { String propKey = ENV_VAR_BASE_PROPERTY_KEY + var.getKey(); // honor overridden environment variable (primarily for testing) if (!props.containsKey(propKey)) { props.setProperty(propKey, var.getValue()); } } return replaceProperties(string, new PropertiesPropertyResolver(props)); }
java
public static String replaceProperties(final String string) { Properties props = System.getProperties(); for (Map.Entry<String, String> var : System.getenv().entrySet()) { String propKey = ENV_VAR_BASE_PROPERTY_KEY + var.getKey(); // honor overridden environment variable (primarily for testing) if (!props.containsKey(propKey)) { props.setProperty(propKey, var.getValue()); } } return replaceProperties(string, new PropertiesPropertyResolver(props)); }
[ "public", "static", "String", "replaceProperties", "(", "final", "String", "string", ")", "{", "Properties", "props", "=", "System", ".", "getProperties", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "var", ":", "Sys...
Go through the input string and replace any occurrence of ${p} with the System.getProtocolProperty(p) value. If there is no such property p defined, then the ${p} reference will remain unchanged. <p> If the property reference is of the form ${p:v} and there is no such property p, then the default value v will be returned. <p> If the property reference is of the form ${p1,p2} or ${p1,p2:v} then the primary and the secondary properties will be tried in turn, before returning either the unchanged input, or the default value. <p> The property ${/} is replaced with System.getProtocolProperty("file.separator") value and the property ${:} is replaced with System.getProtocolProperty("path.separator"). <p> Prior to resolving variables, environment variables are assigned to the collection of properties. Each environment variable is prefixed with the prefix "env.". If a system property is already defined for the prefixed environment variable, the system property is honored as an override (primarily for testing). @param string - the string with possible ${} references @return the input string with all property references replaced if any. If there are no valid references the input string will be returned.
[ "Go", "through", "the", "input", "string", "and", "replace", "any", "occurrence", "of", "$", "{", "p", "}", "with", "the", "System", ".", "getProtocolProperty", "(", "p", ")", "value", ".", "If", "there", "is", "no", "such", "property", "p", "defined", ...
train
https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/config/impl-base/src/main/java/org/jboss/arquillian/config/impl/extension/StringPropertyReplacer.java#L95-L105
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java
CompressorHttp2ConnectionEncoder.cleanup
void cleanup(Http2Stream stream, EmbeddedChannel compressor) { if (compressor.finish()) { for (;;) { final ByteBuf buf = compressor.readOutbound(); if (buf == null) { break; } buf.release(); } } stream.removeProperty(propertyKey); }
java
void cleanup(Http2Stream stream, EmbeddedChannel compressor) { if (compressor.finish()) { for (;;) { final ByteBuf buf = compressor.readOutbound(); if (buf == null) { break; } buf.release(); } } stream.removeProperty(propertyKey); }
[ "void", "cleanup", "(", "Http2Stream", "stream", ",", "EmbeddedChannel", "compressor", ")", "{", "if", "(", "compressor", ".", "finish", "(", ")", ")", "{", "for", "(", ";", ";", ")", "{", "final", "ByteBuf", "buf", "=", "compressor", ".", "readOutbound"...
Release remaining content from {@link EmbeddedChannel} and remove the compressor from the {@link Http2Stream}. @param stream The stream for which {@code compressor} is the compressor for @param compressor The compressor for {@code stream}
[ "Release", "remaining", "content", "from", "{", "@link", "EmbeddedChannel", "}", "and", "remove", "the", "compressor", "from", "the", "{", "@link", "Http2Stream", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java#L286-L298
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/messageml/MessageMLContext.java
MessageMLContext.parseMarkdown
public void parseMarkdown(String message, JsonNode entities, JsonNode media) throws InvalidInputException { this.messageML = markdownParser.parse(message, entities, media); this.entityJson = messageML.asEntityJson(this.entityJson); this.markdownRenderer = new MarkdownRenderer(messageML.asMarkdown()); }
java
public void parseMarkdown(String message, JsonNode entities, JsonNode media) throws InvalidInputException { this.messageML = markdownParser.parse(message, entities, media); this.entityJson = messageML.asEntityJson(this.entityJson); this.markdownRenderer = new MarkdownRenderer(messageML.asMarkdown()); }
[ "public", "void", "parseMarkdown", "(", "String", "message", ",", "JsonNode", "entities", ",", "JsonNode", "media", ")", "throws", "InvalidInputException", "{", "this", ".", "messageML", "=", "markdownParser", ".", "parse", "(", "message", ",", "entities", ",", ...
Parse a Markdown message into its MessageMLV2 representation. Generates document tree structures for serialization into output formats with the respective get() methods. @param message string containing a message in Markdown @param entities additional entity data in JSON
[ "Parse", "a", "Markdown", "message", "into", "its", "MessageMLV2", "representation", ".", "Generates", "document", "tree", "structures", "for", "serialization", "into", "output", "formats", "with", "the", "respective", "get", "()", "methods", "." ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/MessageMLContext.java#L83-L87
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/model/ModelUtil.java
ModelUtil.getPrototypeOrCentroid
public static NumberVector getPrototypeOrCentroid(Model model, Relation<? extends NumberVector> relation, DBIDs ids) { assert (ids.size() > 0); NumberVector v = getPrototype(model, relation); return v != null ? v : Centroid.make(relation, ids); }
java
public static NumberVector getPrototypeOrCentroid(Model model, Relation<? extends NumberVector> relation, DBIDs ids) { assert (ids.size() > 0); NumberVector v = getPrototype(model, relation); return v != null ? v : Centroid.make(relation, ids); }
[ "public", "static", "NumberVector", "getPrototypeOrCentroid", "(", "Model", "model", ",", "Relation", "<", "?", "extends", "NumberVector", ">", "relation", ",", "DBIDs", "ids", ")", "{", "assert", "(", "ids", ".", "size", "(", ")", ">", "0", ")", ";", "N...
Get the representative vector for a cluster model, or compute the centroid. @param model Model @param relation Data relation (for representatives specified per DBID) @param ids Cluster ids (must not be empty. @return Some {@link NumberVector}.
[ "Get", "the", "representative", "vector", "for", "a", "cluster", "model", "or", "compute", "the", "centroid", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/model/ModelUtil.java#L141-L145
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolMetrics.java
HystrixThreadPoolMetrics.getInstance
public static HystrixThreadPoolMetrics getInstance(HystrixThreadPoolKey key, ThreadPoolExecutor threadPool, HystrixThreadPoolProperties properties) { // attempt to retrieve from cache first HystrixThreadPoolMetrics threadPoolMetrics = metrics.get(key.name()); if (threadPoolMetrics != null) { return threadPoolMetrics; } else { synchronized (HystrixThreadPoolMetrics.class) { HystrixThreadPoolMetrics existingMetrics = metrics.get(key.name()); if (existingMetrics != null) { return existingMetrics; } else { HystrixThreadPoolMetrics newThreadPoolMetrics = new HystrixThreadPoolMetrics(key, threadPool, properties); metrics.putIfAbsent(key.name(), newThreadPoolMetrics); return newThreadPoolMetrics; } } } }
java
public static HystrixThreadPoolMetrics getInstance(HystrixThreadPoolKey key, ThreadPoolExecutor threadPool, HystrixThreadPoolProperties properties) { // attempt to retrieve from cache first HystrixThreadPoolMetrics threadPoolMetrics = metrics.get(key.name()); if (threadPoolMetrics != null) { return threadPoolMetrics; } else { synchronized (HystrixThreadPoolMetrics.class) { HystrixThreadPoolMetrics existingMetrics = metrics.get(key.name()); if (existingMetrics != null) { return existingMetrics; } else { HystrixThreadPoolMetrics newThreadPoolMetrics = new HystrixThreadPoolMetrics(key, threadPool, properties); metrics.putIfAbsent(key.name(), newThreadPoolMetrics); return newThreadPoolMetrics; } } } }
[ "public", "static", "HystrixThreadPoolMetrics", "getInstance", "(", "HystrixThreadPoolKey", "key", ",", "ThreadPoolExecutor", "threadPool", ",", "HystrixThreadPoolProperties", "properties", ")", "{", "// attempt to retrieve from cache first", "HystrixThreadPoolMetrics", "threadPool...
Get or create the {@link HystrixThreadPoolMetrics} instance for a given {@link HystrixThreadPoolKey}. <p> This is thread-safe and ensures only 1 {@link HystrixThreadPoolMetrics} per {@link HystrixThreadPoolKey}. @param key {@link HystrixThreadPoolKey} of {@link HystrixThreadPool} instance requesting the {@link HystrixThreadPoolMetrics} @param threadPool Pass-thru of ThreadPoolExecutor to {@link HystrixThreadPoolMetrics} instance on first time when constructed @param properties Pass-thru to {@link HystrixThreadPoolMetrics} instance on first time when constructed @return {@link HystrixThreadPoolMetrics}
[ "Get", "or", "create", "the", "{", "@link", "HystrixThreadPoolMetrics", "}", "instance", "for", "a", "given", "{", "@link", "HystrixThreadPoolKey", "}", ".", "<p", ">", "This", "is", "thread", "-", "safe", "and", "ensures", "only", "1", "{", "@link", "Hyst...
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolMetrics.java#L62-L79
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.createNameNode
private Name createNameNode(boolean checkActivation, int token) { int beg = ts.tokenBeg; String s = ts.getString(); int lineno = ts.lineno; if (!"".equals(prevNameTokenString)) { beg = prevNameTokenStart; s = prevNameTokenString; lineno = prevNameTokenLineno; prevNameTokenStart = 0; prevNameTokenString = ""; prevNameTokenLineno = 0; } if (s == null) { if (compilerEnv.isIdeMode()) { s = ""; } else { codeBug(); } } Name name = new Name(beg, s); name.setLineno(lineno); if (checkActivation) { checkActivationName(s, token); } return name; }
java
private Name createNameNode(boolean checkActivation, int token) { int beg = ts.tokenBeg; String s = ts.getString(); int lineno = ts.lineno; if (!"".equals(prevNameTokenString)) { beg = prevNameTokenStart; s = prevNameTokenString; lineno = prevNameTokenLineno; prevNameTokenStart = 0; prevNameTokenString = ""; prevNameTokenLineno = 0; } if (s == null) { if (compilerEnv.isIdeMode()) { s = ""; } else { codeBug(); } } Name name = new Name(beg, s); name.setLineno(lineno); if (checkActivation) { checkActivationName(s, token); } return name; }
[ "private", "Name", "createNameNode", "(", "boolean", "checkActivation", ",", "int", "token", ")", "{", "int", "beg", "=", "ts", ".", "tokenBeg", ";", "String", "s", "=", "ts", ".", "getString", "(", ")", ";", "int", "lineno", "=", "ts", ".", "lineno", ...
Create a {@code Name} node using the token info from the last scanned name. In some cases we need to either synthesize a name node, or we lost the name token information by peeking. If the {@code token} parameter is not {@link Token#NAME}, then we use token info saved in instance vars.
[ "Create", "a", "{" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L3748-L3773
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java
OGraphDatabase.getEdgesBetweenVertexes
public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2) { return getEdgesBetweenVertexes(iVertex1, iVertex2, null, null); }
java
public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2) { return getEdgesBetweenVertexes(iVertex1, iVertex2, null, null); }
[ "public", "Set", "<", "ODocument", ">", "getEdgesBetweenVertexes", "(", "final", "ODocument", "iVertex1", ",", "final", "ODocument", "iVertex2", ")", "{", "return", "getEdgesBetweenVertexes", "(", "iVertex1", ",", "iVertex2", ",", "null", ",", "null", ")", ";", ...
Returns all the edges between the vertexes iVertex1 and iVertex2. @param iVertex1 First Vertex @param iVertex2 Second Vertex @return The Set with the common Edges between the two vertexes. If edges aren't found the set is empty
[ "Returns", "all", "the", "edges", "between", "the", "vertexes", "iVertex1", "and", "iVertex2", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java#L338-L340
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/ChatApi.java
ChatApi.cancelConsultationChat
public ApiSuccessResponse cancelConsultationChat(String id, CancelConsultData cancelConsultData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = cancelConsultationChatWithHttpInfo(id, cancelConsultData); return resp.getData(); }
java
public ApiSuccessResponse cancelConsultationChat(String id, CancelConsultData cancelConsultData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = cancelConsultationChatWithHttpInfo(id, cancelConsultData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "cancelConsultationChat", "(", "String", "id", ",", "CancelConsultData", "cancelConsultData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "cancelConsultationChatWithHttpInfo", "(", "id", "...
Cancel a chat consultation request Cancel a chat consultation request that was initialized by calling [/media/chat/interactions/{id}/consult-by-queue](/reference/workspace/Media/index.html#consultByQueue). If the agent has already accepted the invitation, the Workspace API can&#39;t cancel the consultation. @param id The ID of the chat interaction. (required) @param cancelConsultData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Cancel", "a", "chat", "consultation", "request", "Cancel", "a", "chat", "consultation", "request", "that", "was", "initialized", "by", "calling", "[", "/", "media", "/", "chat", "/", "interactions", "/", "{", "id", "}", "/", "consult", "-", "by", "-", "...
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L408-L411
google/closure-compiler
src/com/google/javascript/jscomp/FileInstrumentationData.java
FileInstrumentationData.getBranchNode
Node getBranchNode(int lineNumber, int branchNumber) { Preconditions.checkArgument( lineNumber > 0, "Expected non-zero positive integer as line number: %s", lineNumber); Preconditions.checkArgument( branchNumber > 0, "Expected non-zero positive integer as branch number: %s", branchNumber); return branchNodes.get(BranchIndexPair.of(lineNumber - 1, branchNumber - 1)); }
java
Node getBranchNode(int lineNumber, int branchNumber) { Preconditions.checkArgument( lineNumber > 0, "Expected non-zero positive integer as line number: %s", lineNumber); Preconditions.checkArgument( branchNumber > 0, "Expected non-zero positive integer as branch number: %s", branchNumber); return branchNodes.get(BranchIndexPair.of(lineNumber - 1, branchNumber - 1)); }
[ "Node", "getBranchNode", "(", "int", "lineNumber", ",", "int", "branchNumber", ")", "{", "Preconditions", ".", "checkArgument", "(", "lineNumber", ">", "0", ",", "\"Expected non-zero positive integer as line number: %s\"", ",", "lineNumber", ")", ";", "Preconditions", ...
Get the block node to be instrumented for branch coverage. @param lineNumber 1-based line number @param branchNumber 1-based branch number @return the node of the conditional block.
[ "Get", "the", "block", "node", "to", "be", "instrumented", "for", "branch", "coverage", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FileInstrumentationData.java#L139-L146
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java
Channels.newReader
public static Reader newReader(ReadableByteChannel ch, String csName) { checkNotNull(csName, "csName"); return newReader(ch, Charset.forName(csName).newDecoder(), -1); }
java
public static Reader newReader(ReadableByteChannel ch, String csName) { checkNotNull(csName, "csName"); return newReader(ch, Charset.forName(csName).newDecoder(), -1); }
[ "public", "static", "Reader", "newReader", "(", "ReadableByteChannel", "ch", ",", "String", "csName", ")", "{", "checkNotNull", "(", "csName", ",", "\"csName\"", ")", ";", "return", "newReader", "(", "ch", ",", "Charset", ".", "forName", "(", "csName", ")", ...
Constructs a reader that decodes bytes from the given channel according to the named charset. <p> An invocation of this method of the form <blockquote><pre> Channels.newReader(ch, csname)</pre></blockquote> behaves in exactly the same way as the expression <blockquote><pre> Channels.newReader(ch, Charset.forName(csName) .newDecoder(), -1);</pre></blockquote> @param ch The channel from which bytes will be read @param csName The name of the charset to be used @return A new reader @throws UnsupportedCharsetException If no support for the named charset is available in this instance of the Java virtual machine
[ "Constructs", "a", "reader", "that", "decodes", "bytes", "from", "the", "given", "channel", "according", "to", "the", "named", "charset", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L386-L391
davidmoten/rxjava2-extras
src/main/java/com/github/davidmoten/rx2/flowable/Transformers.java
Transformers.collectStats
@SuppressWarnings("unchecked") public static <T extends Number> FlowableTransformer<T, Statistics> collectStats() { return (FlowableTransformer<T, Statistics>) CollectStatsHolder.INSTANCE; }
java
@SuppressWarnings("unchecked") public static <T extends Number> FlowableTransformer<T, Statistics> collectStats() { return (FlowableTransformer<T, Statistics>) CollectStatsHolder.INSTANCE; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Number", ">", "FlowableTransformer", "<", "T", ",", "Statistics", ">", "collectStats", "(", ")", "{", "return", "(", "FlowableTransformer", "<", "T", ",", "Statistics...
<p> Converts a stream of {@code Number} to a stream of {@link Statistics} about those numbers. <p> <img src= "https://raw.githubusercontent.com/davidmoten/rxjava2-extras/master/src/docs/collectStats.png" alt="image"> @param <T> item type @return transformer that converts a stream of Number to a stream of Statistics
[ "<p", ">", "Converts", "a", "stream", "of", "{", "@code", "Number", "}", "to", "a", "stream", "of", "{", "@link", "Statistics", "}", "about", "those", "numbers", "." ]
train
https://github.com/davidmoten/rxjava2-extras/blob/bf5ece3f97191f29a81957a6529bc3cfa4d7b328/src/main/java/com/github/davidmoten/rx2/flowable/Transformers.java#L169-L172
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/util/CausticUtil.java
CausticUtil.getImageData
public static ByteBuffer getImageData(InputStream source, Format format, Rectangle size) { try { final BufferedImage image = ImageIO.read(source); size.setSize(image.getWidth(), image.getHeight()); return getImageData(image, format); } catch (IOException ex) { throw new IllegalStateException("Unreadable texture image data", ex); } }
java
public static ByteBuffer getImageData(InputStream source, Format format, Rectangle size) { try { final BufferedImage image = ImageIO.read(source); size.setSize(image.getWidth(), image.getHeight()); return getImageData(image, format); } catch (IOException ex) { throw new IllegalStateException("Unreadable texture image data", ex); } }
[ "public", "static", "ByteBuffer", "getImageData", "(", "InputStream", "source", ",", "Format", "format", ",", "Rectangle", "size", ")", "{", "try", "{", "final", "BufferedImage", "image", "=", "ImageIO", ".", "read", "(", "source", ")", ";", "size", ".", "...
Gets the {@link java.io.InputStream}'s data as a {@link java.nio.ByteBuffer}. The image data reading is done according to the {@link com.flowpowered.caustic.api.gl.Texture.Format}. The image size is stored in the passed {@link Rectangle} instance. The returned buffer is flipped an ready for reading. @param source The image input stream to extract the data from @param format The format of the image data @param size The rectangle to store the size in @return The flipped buffer containing the decoded image data
[ "Gets", "the", "{", "@link", "java", ".", "io", ".", "InputStream", "}", "s", "data", "as", "a", "{", "@link", "java", ".", "nio", ".", "ByteBuffer", "}", ".", "The", "image", "data", "reading", "is", "done", "according", "to", "the", "{", "@link", ...
train
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/CausticUtil.java#L126-L134
lucee/Lucee
core/src/main/java/lucee/commons/img/Captcha.java
Captcha.writeOut
public static void writeOut(BufferedImage image, OutputStream os, String format) throws IOException { ImageIO.write(image, format, os); }
java
public static void writeOut(BufferedImage image, OutputStream os, String format) throws IOException { ImageIO.write(image, format, os); }
[ "public", "static", "void", "writeOut", "(", "BufferedImage", "image", ",", "OutputStream", "os", ",", "String", "format", ")", "throws", "IOException", "{", "ImageIO", ".", "write", "(", "image", ",", "format", ",", "os", ")", ";", "}" ]
write out image object to a output stream @param image @param os @param format @throws IOException
[ "write", "out", "image", "object", "to", "a", "output", "stream" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/img/Captcha.java#L51-L54
aws/aws-sdk-java
aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/ReEncryptRequest.java
ReEncryptRequest.setSourceEncryptionContext
public void setSourceEncryptionContext(java.util.Map<String, String> sourceEncryptionContext) { this.sourceEncryptionContext = sourceEncryptionContext == null ? null : new com.amazonaws.internal.SdkInternalMap<String, String>( sourceEncryptionContext); }
java
public void setSourceEncryptionContext(java.util.Map<String, String> sourceEncryptionContext) { this.sourceEncryptionContext = sourceEncryptionContext == null ? null : new com.amazonaws.internal.SdkInternalMap<String, String>( sourceEncryptionContext); }
[ "public", "void", "setSourceEncryptionContext", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "sourceEncryptionContext", ")", "{", "this", ".", "sourceEncryptionContext", "=", "sourceEncryptionContext", "==", "null", "?", "null", ":", ...
<p> Encryption context used to encrypt and decrypt the data specified in the <code>CiphertextBlob</code> parameter. </p> @param sourceEncryptionContext Encryption context used to encrypt and decrypt the data specified in the <code>CiphertextBlob</code> parameter.
[ "<p", ">", "Encryption", "context", "used", "to", "encrypt", "and", "decrypt", "the", "data", "specified", "in", "the", "<code", ">", "CiphertextBlob<", "/", "code", ">", "parameter", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/ReEncryptRequest.java#L190-L193
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsCreateCategoryMenuEntry.java
CmsCreateCategoryMenuEntry.askForNewCategoryInfo
public static void askForNewCategoryInfo(CmsUUID parentId, final AsyncCallback<CmsCategoryTitleAndName> callback) { CmsSitemapCategoryData categoryData = CmsSitemapView.getInstance().getController().getCategoryData(); CmsCategoryTreeEntry entry = categoryData.getEntryById(parentId); String caption; if (entry == null) { caption = Messages.get().key(Messages.GUI_SITEMAP_CREATE_CATEGORY_TITLE_0); } else { caption = Messages.get().key(Messages.GUI_SITEMAP_CREATE_SUBCATEGORY_TITLE_1, entry.getPath()); } CmsFormDialog dlg = new CmsFormDialog(caption, new CmsForm(true)); dlg.setWidth(CmsPopup.DEFAULT_WIDTH); CmsDialogFormHandler fh = new CmsDialogFormHandler(); fh.setSubmitHandler(new I_CmsFormSubmitHandler() { public void onSubmitForm(CmsForm form, Map<String, String> fieldValues, Set<String> editedFields) { String title = fieldValues.get("title"); String name = fieldValues.get("name"); callback.onSuccess(new CmsCategoryTitleAndName(title, name)); } }); dlg.setFormHandler(fh); fh.setDialog(dlg); String nameLabel = Messages.get().key(Messages.GUI_CATEGORY_NAME_LABEL_0); String titleLabel = Messages.get().key(Messages.GUI_CATEGORY_TITLE_LABEL_0); dlg.getForm().addField(CmsBasicFormField.createField(createBasicStringProperty("title", titleLabel)), ""); dlg.getForm().addField(CmsBasicFormField.createField(createBasicStringProperty("name", nameLabel)), ""); dlg.getForm().render(); dlg.center(); }
java
public static void askForNewCategoryInfo(CmsUUID parentId, final AsyncCallback<CmsCategoryTitleAndName> callback) { CmsSitemapCategoryData categoryData = CmsSitemapView.getInstance().getController().getCategoryData(); CmsCategoryTreeEntry entry = categoryData.getEntryById(parentId); String caption; if (entry == null) { caption = Messages.get().key(Messages.GUI_SITEMAP_CREATE_CATEGORY_TITLE_0); } else { caption = Messages.get().key(Messages.GUI_SITEMAP_CREATE_SUBCATEGORY_TITLE_1, entry.getPath()); } CmsFormDialog dlg = new CmsFormDialog(caption, new CmsForm(true)); dlg.setWidth(CmsPopup.DEFAULT_WIDTH); CmsDialogFormHandler fh = new CmsDialogFormHandler(); fh.setSubmitHandler(new I_CmsFormSubmitHandler() { public void onSubmitForm(CmsForm form, Map<String, String> fieldValues, Set<String> editedFields) { String title = fieldValues.get("title"); String name = fieldValues.get("name"); callback.onSuccess(new CmsCategoryTitleAndName(title, name)); } }); dlg.setFormHandler(fh); fh.setDialog(dlg); String nameLabel = Messages.get().key(Messages.GUI_CATEGORY_NAME_LABEL_0); String titleLabel = Messages.get().key(Messages.GUI_CATEGORY_TITLE_LABEL_0); dlg.getForm().addField(CmsBasicFormField.createField(createBasicStringProperty("title", titleLabel)), ""); dlg.getForm().addField(CmsBasicFormField.createField(createBasicStringProperty("name", nameLabel)), ""); dlg.getForm().render(); dlg.center(); }
[ "public", "static", "void", "askForNewCategoryInfo", "(", "CmsUUID", "parentId", ",", "final", "AsyncCallback", "<", "CmsCategoryTitleAndName", ">", "callback", ")", "{", "CmsSitemapCategoryData", "categoryData", "=", "CmsSitemapView", ".", "getInstance", "(", ")", "....
Asks the user for a new category's name and title.<p> @param parentId the parent category @param callback the callback to call with the user-supplied information
[ "Asks", "the", "user", "for", "a", "new", "category", "s", "name", "and", "title", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsCreateCategoryMenuEntry.java#L116-L150
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java
RecommendationsInner.resetAllFiltersForWebApp
public void resetAllFiltersForWebApp(String resourceGroupName, String siteName) { resetAllFiltersForWebAppWithServiceResponseAsync(resourceGroupName, siteName).toBlocking().single().body(); }
java
public void resetAllFiltersForWebApp(String resourceGroupName, String siteName) { resetAllFiltersForWebAppWithServiceResponseAsync(resourceGroupName, siteName).toBlocking().single().body(); }
[ "public", "void", "resetAllFiltersForWebApp", "(", "String", "resourceGroupName", ",", "String", "siteName", ")", "{", "resetAllFiltersForWebAppWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ...
Reset all recommendation opt-out settings for an app. Reset all recommendation opt-out settings for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @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
[ "Reset", "all", "recommendation", "opt", "-", "out", "settings", "for", "an", "app", ".", "Reset", "all", "recommendation", "opt", "-", "out", "settings", "for", "an", "app", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1119-L1121
taimos/RESTUtils
src/main/java/de/taimos/restutils/RESTAssert.java
RESTAssert.assertNotNull
public static void assertNotNull(final Object object, final StatusType status) { RESTAssert.assertTrue(object != null, status); }
java
public static void assertNotNull(final Object object, final StatusType status) { RESTAssert.assertTrue(object != null, status); }
[ "public", "static", "void", "assertNotNull", "(", "final", "Object", "object", ",", "final", "StatusType", "status", ")", "{", "RESTAssert", ".", "assertTrue", "(", "object", "!=", "null", ",", "status", ")", ";", "}" ]
assert that object is not null @param object the object to check @param status the status code to throw @throws WebApplicationException with given status code
[ "assert", "that", "object", "is", "not", "null" ]
train
https://github.com/taimos/RESTUtils/blob/bdb1bf9a2eb13ede0eec6f071c10cb2698313501/src/main/java/de/taimos/restutils/RESTAssert.java#L160-L162
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java
Postconditions.checkPostconditionL
public static long checkPostconditionL( final long value, final LongPredicate predicate, final LongFunction<String> describer) { final boolean ok; try { ok = predicate.test(value); } catch (final Throwable e) { throw failed( e, Long.valueOf(value), singleViolation(failedPredicate(e))); } return innerCheckL(value, ok, describer); }
java
public static long checkPostconditionL( final long value, final LongPredicate predicate, final LongFunction<String> describer) { final boolean ok; try { ok = predicate.test(value); } catch (final Throwable e) { throw failed( e, Long.valueOf(value), singleViolation(failedPredicate(e))); } return innerCheckL(value, ok, describer); }
[ "public", "static", "long", "checkPostconditionL", "(", "final", "long", "value", ",", "final", "LongPredicate", "predicate", ",", "final", "LongFunction", "<", "String", ">", "describer", ")", "{", "final", "boolean", "ok", ";", "try", "{", "ok", "=", "pred...
A {@code long} specialized version of {@link #checkPostcondition(Object, Predicate, Function)} @param value The value @param predicate The predicate @param describer The describer of the predicate @return value @throws PostconditionViolationException If the predicate is false
[ "A", "{", "@code", "long", "}", "specialized", "version", "of", "{", "@link", "#checkPostcondition", "(", "Object", "Predicate", "Function", ")", "}" ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L445-L461
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GalleryImagesInner.java
GalleryImagesInner.update
public GalleryImageInner update(String resourceGroupName, String labAccountName, String galleryImageName, GalleryImageFragment galleryImage) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, galleryImageName, galleryImage).toBlocking().single().body(); }
java
public GalleryImageInner update(String resourceGroupName, String labAccountName, String galleryImageName, GalleryImageFragment galleryImage) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, galleryImageName, galleryImage).toBlocking().single().body(); }
[ "public", "GalleryImageInner", "update", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "galleryImageName", ",", "GalleryImageFragment", "galleryImage", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",",...
Modify properties of gallery images. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param galleryImageName The name of the gallery Image. @param galleryImage Represents an image from the Azure Marketplace @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 GalleryImageInner object if successful.
[ "Modify", "properties", "of", "gallery", "images", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GalleryImagesInner.java#L746-L748
VoltDB/voltdb
src/frontend/org/voltdb/utils/CatalogUtil.java
CatalogUtil.getSignatureForTable
public static String getSignatureForTable(String name, SortedMap<Integer, VoltType> schema) { StringBuilder sb = new StringBuilder(); sb.append(name).append(SIGNATURE_TABLE_NAME_SEPARATOR); for (VoltType t : schema.values()) { sb.append(t.getSignatureChar()); } return sb.toString(); }
java
public static String getSignatureForTable(String name, SortedMap<Integer, VoltType> schema) { StringBuilder sb = new StringBuilder(); sb.append(name).append(SIGNATURE_TABLE_NAME_SEPARATOR); for (VoltType t : schema.values()) { sb.append(t.getSignatureChar()); } return sb.toString(); }
[ "public", "static", "String", "getSignatureForTable", "(", "String", "name", ",", "SortedMap", "<", "Integer", ",", "VoltType", ">", "schema", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "name", ")...
Get a string signature for the table represented by the args @param name The name of the table @param schema A sorted map of the columns in the table, keyed by column index @return The table signature string.
[ "Get", "a", "string", "signature", "for", "the", "table", "represented", "by", "the", "args" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogUtil.java#L2875-L2882