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
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/rest/AbstractRestCommandJob2.java
AbstractRestCommandJob2.createHttpPostEntity
private HttpPost createHttpPostEntity(ReviewInput reviewInput, String reviewEndpoint) { HttpPost httpPost = new HttpPost(reviewEndpoint); String asJson = GSON.toJson(reviewInput); StringEntity entity = null; try { entity = new StringEntity(asJson); } catch (UnsupportedEncodingException e) { logger.error("Failed to create JSON for posting to Gerrit", e); if (altLogger != null) { altLogger.print("ERROR Failed to create JSON for posting to Gerrit: " + e.toString()); } return null; } entity.setContentType("application/json"); httpPost.setEntity(entity); return httpPost; }
java
private HttpPost createHttpPostEntity(ReviewInput reviewInput, String reviewEndpoint) { HttpPost httpPost = new HttpPost(reviewEndpoint); String asJson = GSON.toJson(reviewInput); StringEntity entity = null; try { entity = new StringEntity(asJson); } catch (UnsupportedEncodingException e) { logger.error("Failed to create JSON for posting to Gerrit", e); if (altLogger != null) { altLogger.print("ERROR Failed to create JSON for posting to Gerrit: " + e.toString()); } return null; } entity.setContentType("application/json"); httpPost.setEntity(entity); return httpPost; }
[ "private", "HttpPost", "createHttpPostEntity", "(", "ReviewInput", "reviewInput", ",", "String", "reviewEndpoint", ")", "{", "HttpPost", "httpPost", "=", "new", "HttpPost", "(", "reviewEndpoint", ")", ";", "String", "asJson", "=", "GSON", ".", "toJson", "(", "re...
Construct the post. @param reviewInput input @param reviewEndpoint end point @return the entity
[ "Construct", "the", "post", "." ]
train
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/rest/AbstractRestCommandJob2.java#L176-L194
canhnt/sne-xacml
sne-xacml/src/main/java/nl/uva/sne/midd/nodes/InternalNode.java
InternalNode.addChild
@SuppressWarnings("unchecked") public void addChild(final AbstractEdge<?> edge, final AbstractNode child) { if (child == null || edge == null || edge.getIntervals() == null || edge.getIntervals().size() == 0) { throw new IllegalArgumentException("Cannot add null child or empty edge"); } edge.setSubDiagram(child); edges.add((AbstractEdge<T>) edge); }
java
@SuppressWarnings("unchecked") public void addChild(final AbstractEdge<?> edge, final AbstractNode child) { if (child == null || edge == null || edge.getIntervals() == null || edge.getIntervals().size() == 0) { throw new IllegalArgumentException("Cannot add null child or empty edge"); } edge.setSubDiagram(child); edges.add((AbstractEdge<T>) edge); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "addChild", "(", "final", "AbstractEdge", "<", "?", ">", "edge", ",", "final", "AbstractNode", "child", ")", "{", "if", "(", "child", "==", "null", "||", "edge", "==", "null", "||", "e...
Create an out-going edge to the given node. The edge and child node are mutable objects. If they are used in another tree, it'd better to clone before adding them. Note: Edge<?> and InternalNode<T> must use the same type @param edge @param child
[ "Create", "an", "out", "-", "going", "edge", "to", "the", "given", "node", ".", "The", "edge", "and", "child", "node", "are", "mutable", "objects", ".", "If", "they", "are", "used", "in", "another", "tree", "it", "d", "better", "to", "clone", "before",...
train
https://github.com/canhnt/sne-xacml/blob/7ffca16bf558d2c3ee16181d926f066ab1de75b2/sne-xacml/src/main/java/nl/uva/sne/midd/nodes/InternalNode.java#L85-L94
XDean/Java-EX
src/main/java/xdean/jex/util/reflect/AnnotationUtil.java
AnnotationUtil.addAnnotation
@SuppressWarnings("unchecked") public static void addAnnotation(Executable ex, Annotation annotation) { ex.getAnnotation(Annotation.class);// prevent declaredAnnotations haven't initialized Map<Class<? extends Annotation>, Annotation> annos; try { annos = (Map<Class<? extends Annotation>, Annotation>) Field_Excutable_DeclaredAnnotations.get(ex); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } if (annos.getClass() == Collections.EMPTY_MAP.getClass()) { annos = new HashMap<>(); try { Field_Excutable_DeclaredAnnotations.set(ex, annos); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } } annos.put(annotation.annotationType(), annotation); }
java
@SuppressWarnings("unchecked") public static void addAnnotation(Executable ex, Annotation annotation) { ex.getAnnotation(Annotation.class);// prevent declaredAnnotations haven't initialized Map<Class<? extends Annotation>, Annotation> annos; try { annos = (Map<Class<? extends Annotation>, Annotation>) Field_Excutable_DeclaredAnnotations.get(ex); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } if (annos.getClass() == Collections.EMPTY_MAP.getClass()) { annos = new HashMap<>(); try { Field_Excutable_DeclaredAnnotations.set(ex, annos); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } } annos.put(annotation.annotationType(), annotation); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "void", "addAnnotation", "(", "Executable", "ex", ",", "Annotation", "annotation", ")", "{", "ex", ".", "getAnnotation", "(", "Annotation", ".", "class", ")", ";", "// prevent declaredAnnotati...
Add annotation to Executable(Method or Constructor)<br> Note that you may need to give the root method. @param ex @param annotation @author XDean @see Executable @see #createAnnotationFromMap(Class, Map) @see ReflectUtil#getRootMethods(Class)
[ "Add", "annotation", "to", "Executable", "(", "Method", "or", "Constructor", ")", "<br", ">", "Note", "that", "you", "may", "need", "to", "give", "the", "root", "method", "." ]
train
https://github.com/XDean/Java-EX/blob/9208ba71c5b2af9f9bd979d01fab2ff5e433b3e7/src/main/java/xdean/jex/util/reflect/AnnotationUtil.java#L127-L145
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/utils/MongoDBUtils.java
MongoDBUtils.populateValue
public static Object populateValue(Object valObj, Class clazz) { if (isUTF8Value(clazz) || clazz.isEnum()) { return valObj.toString(); } else if ((valObj instanceof Calendar) || (valObj instanceof GregorianCalendar)) { return ((Calendar) valObj).getTime(); } else if (CollectionExpression.class.isAssignableFrom(clazz)) { CollectionExpression collExpr = (CollectionExpression) valObj; List<String> texts = new ArrayList<String>(collExpr.childrenSize()); for (Expression childExpr : collExpr.orderedChildren()) { if (childExpr instanceof StringLiteral) { StringLiteral stringLiteral = (StringLiteral) childExpr; texts.add(stringLiteral.getUnquotedText()); } } return texts; } return valObj; }
java
public static Object populateValue(Object valObj, Class clazz) { if (isUTF8Value(clazz) || clazz.isEnum()) { return valObj.toString(); } else if ((valObj instanceof Calendar) || (valObj instanceof GregorianCalendar)) { return ((Calendar) valObj).getTime(); } else if (CollectionExpression.class.isAssignableFrom(clazz)) { CollectionExpression collExpr = (CollectionExpression) valObj; List<String> texts = new ArrayList<String>(collExpr.childrenSize()); for (Expression childExpr : collExpr.orderedChildren()) { if (childExpr instanceof StringLiteral) { StringLiteral stringLiteral = (StringLiteral) childExpr; texts.add(stringLiteral.getUnquotedText()); } } return texts; } return valObj; }
[ "public", "static", "Object", "populateValue", "(", "Object", "valObj", ",", "Class", "clazz", ")", "{", "if", "(", "isUTF8Value", "(", "clazz", ")", "||", "clazz", ".", "isEnum", "(", ")", ")", "{", "return", "valObj", ".", "toString", "(", ")", ";", ...
Populate value. @param valObj the val obj @param clazz the clazz @return the object
[ "Populate", "value", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/utils/MongoDBUtils.java#L140-L167
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/landf/ScreenUtil.java
ScreenUtil.getPropery
public static String getPropery(String key, PropertyOwner propertyOwner, Map<String,Object> properties, String defaultValue) { String returnValue = null; if (propertyOwner != null) returnValue = propertyOwner.getProperty(key); if (properties != null) if (returnValue == null) returnValue = (String)properties.get(key); if (returnValue == null) returnValue = defaultValue; return returnValue; }
java
public static String getPropery(String key, PropertyOwner propertyOwner, Map<String,Object> properties, String defaultValue) { String returnValue = null; if (propertyOwner != null) returnValue = propertyOwner.getProperty(key); if (properties != null) if (returnValue == null) returnValue = (String)properties.get(key); if (returnValue == null) returnValue = defaultValue; return returnValue; }
[ "public", "static", "String", "getPropery", "(", "String", "key", ",", "PropertyOwner", "propertyOwner", ",", "Map", "<", "String", ",", "Object", ">", "properties", ",", "String", "defaultValue", ")", "{", "String", "returnValue", "=", "null", ";", "if", "(...
A utility to get the property from the propertyowner or the property.
[ "A", "utility", "to", "get", "the", "property", "from", "the", "propertyowner", "or", "the", "property", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/landf/ScreenUtil.java#L210-L220
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/decisiontables/DecisionTableImpl.java
DecisionTableImpl.defaultToOutput
private Object defaultToOutput(EvaluationContext ctx, FEEL feel) { Map<String, Object> values = ctx.getAllValues(); if ( outputs.size() == 1 ) { Object value = feel.evaluate( outputs.get( 0 ).getDefaultValue(), values ); return value; } else { // zip outputEntries with its name: return IntStream.range( 0, outputs.size() ).boxed() .collect( toMap( i -> outputs.get( i ).getName(), i -> feel.evaluate( outputs.get( i ).getDefaultValue(), values ) ) ); } }
java
private Object defaultToOutput(EvaluationContext ctx, FEEL feel) { Map<String, Object> values = ctx.getAllValues(); if ( outputs.size() == 1 ) { Object value = feel.evaluate( outputs.get( 0 ).getDefaultValue(), values ); return value; } else { // zip outputEntries with its name: return IntStream.range( 0, outputs.size() ).boxed() .collect( toMap( i -> outputs.get( i ).getName(), i -> feel.evaluate( outputs.get( i ).getDefaultValue(), values ) ) ); } }
[ "private", "Object", "defaultToOutput", "(", "EvaluationContext", "ctx", ",", "FEEL", "feel", ")", "{", "Map", "<", "String", ",", "Object", ">", "values", "=", "ctx", ".", "getAllValues", "(", ")", ";", "if", "(", "outputs", ".", "size", "(", ")", "==...
No hits matched for the DT, so calculate result based on default outputs
[ "No", "hits", "matched", "for", "the", "DT", "so", "calculate", "result", "based", "on", "default", "outputs" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/decisiontables/DecisionTableImpl.java#L319-L329
guardtime/ksi-java-sdk
ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java
TLVElement.encodeHeader
public byte[] encodeHeader() throws TLVParserException { DataOutputStream out = null; try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); out = new DataOutputStream(byteArrayOutputStream); int dataLength = getContentLength(); boolean tlv16 = isOutputTlv16(); int firstByte = (tlv16 ? TLVInputStream.TLV16_FLAG : 0) + (isNonCritical() ? TLVInputStream.NON_CRITICAL_FLAG : 0) + (isForwarded() ? TLVInputStream.FORWARD_FLAG : 0); if (tlv16) { firstByte = firstByte | (getType() >>> TLVInputStream.BYTE_BITS) & TLVInputStream.TYPE_MASK; out.writeByte(firstByte); out.writeByte(getType()); if (dataLength < 1) { out.writeShort(0); } else { out.writeShort(dataLength); } } else { firstByte = firstByte | getType() & TLVInputStream.TYPE_MASK; out.writeByte(firstByte); if (dataLength < 1) { out.writeByte(0); } else { out.writeByte(dataLength); } } return byteArrayOutputStream.toByteArray(); } catch (IOException e) { throw new TLVParserException("TLV header encoding failed", e); } finally { Util.closeQuietly(out); } }
java
public byte[] encodeHeader() throws TLVParserException { DataOutputStream out = null; try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); out = new DataOutputStream(byteArrayOutputStream); int dataLength = getContentLength(); boolean tlv16 = isOutputTlv16(); int firstByte = (tlv16 ? TLVInputStream.TLV16_FLAG : 0) + (isNonCritical() ? TLVInputStream.NON_CRITICAL_FLAG : 0) + (isForwarded() ? TLVInputStream.FORWARD_FLAG : 0); if (tlv16) { firstByte = firstByte | (getType() >>> TLVInputStream.BYTE_BITS) & TLVInputStream.TYPE_MASK; out.writeByte(firstByte); out.writeByte(getType()); if (dataLength < 1) { out.writeShort(0); } else { out.writeShort(dataLength); } } else { firstByte = firstByte | getType() & TLVInputStream.TYPE_MASK; out.writeByte(firstByte); if (dataLength < 1) { out.writeByte(0); } else { out.writeByte(dataLength); } } return byteArrayOutputStream.toByteArray(); } catch (IOException e) { throw new TLVParserException("TLV header encoding failed", e); } finally { Util.closeQuietly(out); } }
[ "public", "byte", "[", "]", "encodeHeader", "(", ")", "throws", "TLVParserException", "{", "DataOutputStream", "out", "=", "null", ";", "try", "{", "ByteArrayOutputStream", "byteArrayOutputStream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "out", "=", ...
Encodes TLV header. @return Byte array containing encoded TLV header. @throws TLVParserException when TLV header encoding fails or I/O error occurs.
[ "Encodes", "TLV", "header", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L484-L520
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java
SnowflakeStatementV1.executeQueryInternal
ResultSet executeQueryInternal( String sql, Map<String, ParameterBindingDTO> parameterBindings) throws SQLException { SFBaseResultSet sfResultSet; try { sfResultSet = sfStatement.execute(sql, parameterBindings, SFStatement.CallingMethod.EXECUTE_QUERY); sfResultSet.setSession(this.connection.getSfSession()); } catch (SFException ex) { throw new SnowflakeSQLException(ex.getCause(), ex.getSqlState(), ex.getVendorCode(), ex.getParams()); } if (resultSet != null) { openResultSets.add(resultSet); } resultSet = new SnowflakeResultSetV1(sfResultSet, this); return getResultSet(); }
java
ResultSet executeQueryInternal( String sql, Map<String, ParameterBindingDTO> parameterBindings) throws SQLException { SFBaseResultSet sfResultSet; try { sfResultSet = sfStatement.execute(sql, parameterBindings, SFStatement.CallingMethod.EXECUTE_QUERY); sfResultSet.setSession(this.connection.getSfSession()); } catch (SFException ex) { throw new SnowflakeSQLException(ex.getCause(), ex.getSqlState(), ex.getVendorCode(), ex.getParams()); } if (resultSet != null) { openResultSets.add(resultSet); } resultSet = new SnowflakeResultSetV1(sfResultSet, this); return getResultSet(); }
[ "ResultSet", "executeQueryInternal", "(", "String", "sql", ",", "Map", "<", "String", ",", "ParameterBindingDTO", ">", "parameterBindings", ")", "throws", "SQLException", "{", "SFBaseResultSet", "sfResultSet", ";", "try", "{", "sfResultSet", "=", "sfStatement", ".",...
Internal method for executing a query with bindings accepted. @param sql sql statement @param parameterBindings parameters bindings @return query result set @throws SQLException if @link{SFStatement.execute(String)} throws exception
[ "Internal", "method", "for", "executing", "a", "query", "with", "bindings", "accepted", "." ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java#L232-L257
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ContextServiceImpl.java
ContextServiceImpl.ignoreWarnOrFail
private <T extends Throwable> T ignoreWarnOrFail(Throwable throwable, final Class<T> exceptionClassToRaise, String msgKey, Object... objs) { // Read the value each time in order to allow for changes to the onError setting switch ((OnError) properties.get(OnErrorUtil.CFG_KEY_ON_ERROR)) { case IGNORE: if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "ignoring error: " + msgKey, objs); return null; case WARN: Tr.warning(tc, msgKey, objs); return null; case FAIL: try { if (throwable != null && exceptionClassToRaise.isInstance(throwable)) return exceptionClassToRaise.cast(throwable); Constructor<T> con = AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor<T>>() { @Override public Constructor<T> run() throws NoSuchMethodException { return exceptionClassToRaise.getConstructor(String.class); } }); String message = msgKey == null ? throwable.getMessage() : Tr.formatMessage(tc, msgKey, objs); T failure = con.newInstance(message); failure.initCause(throwable); return failure; } catch (PrivilegedActionException e) { throw new RuntimeException(e.getCause()); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } return null; }
java
private <T extends Throwable> T ignoreWarnOrFail(Throwable throwable, final Class<T> exceptionClassToRaise, String msgKey, Object... objs) { // Read the value each time in order to allow for changes to the onError setting switch ((OnError) properties.get(OnErrorUtil.CFG_KEY_ON_ERROR)) { case IGNORE: if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "ignoring error: " + msgKey, objs); return null; case WARN: Tr.warning(tc, msgKey, objs); return null; case FAIL: try { if (throwable != null && exceptionClassToRaise.isInstance(throwable)) return exceptionClassToRaise.cast(throwable); Constructor<T> con = AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor<T>>() { @Override public Constructor<T> run() throws NoSuchMethodException { return exceptionClassToRaise.getConstructor(String.class); } }); String message = msgKey == null ? throwable.getMessage() : Tr.formatMessage(tc, msgKey, objs); T failure = con.newInstance(message); failure.initCause(throwable); return failure; } catch (PrivilegedActionException e) { throw new RuntimeException(e.getCause()); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } return null; }
[ "private", "<", "T", "extends", "Throwable", ">", "T", "ignoreWarnOrFail", "(", "Throwable", "throwable", ",", "final", "Class", "<", "T", ">", "exceptionClassToRaise", ",", "String", "msgKey", ",", "Object", "...", "objs", ")", "{", "// Read the value each time...
Ignore, warn, or fail when a configuration error occurs. This is copied from Tim's code in tWAS and updated slightly to override with the Liberty ignore/warn/fail setting. Precondition: invoker must have lock on this context service, in order to read the onError property. @param throwable an already created Throwable object, which can be used if the desired action is fail. @param exceptionClassToRaise the class of the Throwable object to return @param msgKey the NLS message key @param objs list of objects to substitute in the NLS message @return either null or the Throwable object
[ "Ignore", "warn", "or", "fail", "when", "a", "configuration", "error", "occurs", ".", "This", "is", "copied", "from", "Tim", "s", "code", "in", "tWAS", "and", "updated", "slightly", "to", "override", "with", "the", "Liberty", "ignore", "/", "warn", "/", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ContextServiceImpl.java#L500-L536
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java
FDBigInteger.valueOfPow2
private static FDBigInteger valueOfPow2(int p2) { int wordcount = p2 >> 5; int bitcount = p2 & 0x1f; return new FDBigInteger(new int[]{1 << bitcount}, wordcount); }
java
private static FDBigInteger valueOfPow2(int p2) { int wordcount = p2 >> 5; int bitcount = p2 & 0x1f; return new FDBigInteger(new int[]{1 << bitcount}, wordcount); }
[ "private", "static", "FDBigInteger", "valueOfPow2", "(", "int", "p2", ")", "{", "int", "wordcount", "=", "p2", ">>", "5", ";", "int", "bitcount", "=", "p2", "&", "0x1f", ";", "return", "new", "FDBigInteger", "(", "new", "int", "[", "]", "{", "1", "<<...
/*@ @ requires p2 >= 0; @ assignable \nothing; @ ensures \result.value() == pow52(0, p2); @
[ "/", "*" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java#L352-L356
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java
CmsCloneModuleThread.replaceModuleName
private void replaceModuleName() throws CmsException, UnsupportedEncodingException { CmsResourceFilter filter = CmsResourceFilter.ALL.addRequireFile().addExcludeState( CmsResource.STATE_DELETED).addRequireTimerange().addRequireVisible(); List<CmsResource> resources = getCms().readResources( CmsWorkplace.VFS_PATH_MODULES + m_cloneInfo.getName() + "/", filter); for (CmsResource resource : resources) { CmsFile file = getCms().readFile(resource); if (CmsResourceTypeXmlContent.isXmlContent(file)) { CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file); xmlContent.setAutoCorrectionEnabled(true); file = xmlContent.correctXmlStructure(getCms()); } byte[] contents = file.getContents(); String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file); String content = new String(contents, encoding); Matcher matcher = Pattern.compile(m_cloneInfo.getSourceModuleName()).matcher(content); if (matcher.find()) { contents = matcher.replaceAll(m_cloneInfo.getName()).getBytes(encoding); if (lockResource(getCms(), file)) { file.setContents(contents); getCms().writeFile(file); } } } }
java
private void replaceModuleName() throws CmsException, UnsupportedEncodingException { CmsResourceFilter filter = CmsResourceFilter.ALL.addRequireFile().addExcludeState( CmsResource.STATE_DELETED).addRequireTimerange().addRequireVisible(); List<CmsResource> resources = getCms().readResources( CmsWorkplace.VFS_PATH_MODULES + m_cloneInfo.getName() + "/", filter); for (CmsResource resource : resources) { CmsFile file = getCms().readFile(resource); if (CmsResourceTypeXmlContent.isXmlContent(file)) { CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file); xmlContent.setAutoCorrectionEnabled(true); file = xmlContent.correctXmlStructure(getCms()); } byte[] contents = file.getContents(); String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file); String content = new String(contents, encoding); Matcher matcher = Pattern.compile(m_cloneInfo.getSourceModuleName()).matcher(content); if (matcher.find()) { contents = matcher.replaceAll(m_cloneInfo.getName()).getBytes(encoding); if (lockResource(getCms(), file)) { file.setContents(contents); getCms().writeFile(file); } } } }
[ "private", "void", "replaceModuleName", "(", ")", "throws", "CmsException", ",", "UnsupportedEncodingException", "{", "CmsResourceFilter", "filter", "=", "CmsResourceFilter", ".", "ALL", ".", "addRequireFile", "(", ")", ".", "addExcludeState", "(", "CmsResource", ".",...
Initializes a thread to find and replace all occurrence of the module's path.<p> @throws CmsException in case writing the file fails @throws UnsupportedEncodingException in case of the wrong encoding
[ "Initializes", "a", "thread", "to", "find", "and", "replace", "all", "occurrence", "of", "the", "module", "s", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java#L947-L973
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/client/utils/HelloDory.java
HelloDory.run
private void run(String[] args) { if (args.length != 2) { usage(); } System.out.println("Opening Doradus server: " + args[0] + ":" + args[1]); try (DoradusClient client = new DoradusClient(args[0], Integer.parseInt(args[1]))) { deleteApplication(client); createApplication(client); addData(client); queryData(client); deleteData(client); } }
java
private void run(String[] args) { if (args.length != 2) { usage(); } System.out.println("Opening Doradus server: " + args[0] + ":" + args[1]); try (DoradusClient client = new DoradusClient(args[0], Integer.parseInt(args[1]))) { deleteApplication(client); createApplication(client); addData(client); queryData(client); deleteData(client); } }
[ "private", "void", "run", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "!=", "2", ")", "{", "usage", "(", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"Opening Doradus server: \"", "+", "args", "[", "0...
Create a Dory client connection and execute the example commands.
[ "Create", "a", "Dory", "client", "connection", "and", "execute", "the", "example", "commands", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/utils/HelloDory.java#L84-L97
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java
SpecializedOps_DDRM.diffNormF
public static double diffNormF(DMatrixD1 a , DMatrixD1 b ) { if( a.numRows != b.numRows || a.numCols != b.numCols ) { throw new IllegalArgumentException("Both matrices must have the same shape."); } final int size = a.getNumElements(); DMatrixRMaj diff = new DMatrixRMaj(size,1); for( int i = 0; i < size; i++ ) { diff.set(i , b.get(i) - a.get(i)); } return NormOps_DDRM.normF(diff); }
java
public static double diffNormF(DMatrixD1 a , DMatrixD1 b ) { if( a.numRows != b.numRows || a.numCols != b.numCols ) { throw new IllegalArgumentException("Both matrices must have the same shape."); } final int size = a.getNumElements(); DMatrixRMaj diff = new DMatrixRMaj(size,1); for( int i = 0; i < size; i++ ) { diff.set(i , b.get(i) - a.get(i)); } return NormOps_DDRM.normF(diff); }
[ "public", "static", "double", "diffNormF", "(", "DMatrixD1", "a", ",", "DMatrixD1", "b", ")", "{", "if", "(", "a", ".", "numRows", "!=", "b", ".", "numRows", "||", "a", ".", "numCols", "!=", "b", ".", "numCols", ")", "{", "throw", "new", "IllegalArgu...
<p> Computes the F norm of the difference between the two Matrices:<br> <br> Sqrt{&sum;<sub>i=1:m</sub> &sum;<sub>j=1:n</sub> ( a<sub>ij</sub> - b<sub>ij</sub>)<sup>2</sup>} </p> <p> This is often used as a cost function. </p> @see NormOps_DDRM#fastNormF @param a m by n matrix. Not modified. @param b m by n matrix. Not modified. @return The F normal of the difference matrix.
[ "<p", ">", "Computes", "the", "F", "norm", "of", "the", "difference", "between", "the", "two", "Matrices", ":", "<br", ">", "<br", ">", "Sqrt", "{", "&sum", ";", "<sub", ">", "i", "=", "1", ":", "m<", "/", "sub", ">", "&sum", ";", "<sub", ">", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java#L209-L223
Jasig/uPortal
uPortal-webapp/src/main/java/org/apereo/portal/context/rendering/RenderingPipelineConfiguration.java
RenderingPipelineConfiguration.getPortalRenderingPipeline
@Bean(name = "portalRenderingPipeline") @Qualifier(value = "main") public IPortalRenderingPipeline getPortalRenderingPipeline() { // Rendering Pipeline Branches (adopter extension point) final List<RenderingPipelineBranchPoint> sortedList = (branchPoints != null) ? new LinkedList<>(branchPoints) : Collections.emptyList(); Collections.sort(sortedList); final List<RenderingPipelineBranchPoint> branches = Collections.unmodifiableList(sortedList); /* * Sanity check: if you have multiple RenderingPipelineBranchPoint beans, you can specify * an 'order' property on some or all of them to control the sequence of processing. * Having 2 RenderingPipelineBranchPoint beans with the same order value will produce * non-deterministic results and is a likely source of misconfiguration. */ final Set<Integer> usedOderValues = new HashSet<>(); boolean hasCollision = branches.stream() .anyMatch( branchPoint -> { final boolean rslt = usedOderValues.contains(branchPoint.getOrder()); usedOderValues.add(branchPoint.getOrder()); return rslt; }); if (hasCollision) { throw new RenderingPipelineConfigurationException( "Multiple RenderingPipelineBranchPoint beans have the same 'order' value, which likely a misconfiguration"); } // "Standard" Pipeline final IPortalRenderingPipeline standardRenderingPipeline = getStandardRenderingPipeline(); return new IPortalRenderingPipeline() { @Override public void renderState(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { for (RenderingPipelineBranchPoint branchPoint : branches) { if (branchPoint.renderStateIfApplicable(req, res)) { /* * Rendering bas been processed by the branch point -- no need to continue. */ return; } } /* * Reaching this point means that a branch was not followed; use the "standard" * pipeline. */ standardRenderingPipeline.renderState(req, res); } }; }
java
@Bean(name = "portalRenderingPipeline") @Qualifier(value = "main") public IPortalRenderingPipeline getPortalRenderingPipeline() { // Rendering Pipeline Branches (adopter extension point) final List<RenderingPipelineBranchPoint> sortedList = (branchPoints != null) ? new LinkedList<>(branchPoints) : Collections.emptyList(); Collections.sort(sortedList); final List<RenderingPipelineBranchPoint> branches = Collections.unmodifiableList(sortedList); /* * Sanity check: if you have multiple RenderingPipelineBranchPoint beans, you can specify * an 'order' property on some or all of them to control the sequence of processing. * Having 2 RenderingPipelineBranchPoint beans with the same order value will produce * non-deterministic results and is a likely source of misconfiguration. */ final Set<Integer> usedOderValues = new HashSet<>(); boolean hasCollision = branches.stream() .anyMatch( branchPoint -> { final boolean rslt = usedOderValues.contains(branchPoint.getOrder()); usedOderValues.add(branchPoint.getOrder()); return rslt; }); if (hasCollision) { throw new RenderingPipelineConfigurationException( "Multiple RenderingPipelineBranchPoint beans have the same 'order' value, which likely a misconfiguration"); } // "Standard" Pipeline final IPortalRenderingPipeline standardRenderingPipeline = getStandardRenderingPipeline(); return new IPortalRenderingPipeline() { @Override public void renderState(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { for (RenderingPipelineBranchPoint branchPoint : branches) { if (branchPoint.renderStateIfApplicable(req, res)) { /* * Rendering bas been processed by the branch point -- no need to continue. */ return; } } /* * Reaching this point means that a branch was not followed; use the "standard" * pipeline. */ standardRenderingPipeline.renderState(req, res); } }; }
[ "@", "Bean", "(", "name", "=", "\"portalRenderingPipeline\"", ")", "@", "Qualifier", "(", "value", "=", "\"main\"", ")", "public", "IPortalRenderingPipeline", "getPortalRenderingPipeline", "(", ")", "{", "// Rendering Pipeline Branches (adopter extension point)", "final", ...
This bean is the entry point into the uPortal Rendering Pipeline. It supports {@link RenderingPipelineBranchPoint} beans, which are an extension point for adopters.
[ "This", "bean", "is", "the", "entry", "point", "into", "the", "uPortal", "Rendering", "Pipeline", ".", "It", "supports", "{" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-webapp/src/main/java/org/apereo/portal/context/rendering/RenderingPipelineConfiguration.java#L150-L204
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java
TaskOperations.terminateTask
public void terminateTask(String jobId, String taskId) throws BatchErrorException, IOException { terminateTask(jobId, taskId, null); }
java
public void terminateTask(String jobId, String taskId) throws BatchErrorException, IOException { terminateTask(jobId, taskId, null); }
[ "public", "void", "terminateTask", "(", "String", "jobId", ",", "String", "taskId", ")", "throws", "BatchErrorException", ",", "IOException", "{", "terminateTask", "(", "jobId", ",", "taskId", ",", "null", ")", ";", "}" ]
Terminates the specified task. @param jobId The ID of the job containing the task. @param taskId The ID of the task. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Terminates", "the", "specified", "task", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java#L729-L731
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getMarkerAnchor
public Content getMarkerAnchor(SectionName sectionName, String anchorName) { return getMarkerAnchor(sectionName.getName() + getName(anchorName), null); }
java
public Content getMarkerAnchor(SectionName sectionName, String anchorName) { return getMarkerAnchor(sectionName.getName() + getName(anchorName), null); }
[ "public", "Content", "getMarkerAnchor", "(", "SectionName", "sectionName", ",", "String", "anchorName", ")", "{", "return", "getMarkerAnchor", "(", "sectionName", ".", "getName", "(", ")", "+", "getName", "(", "anchorName", ")", ",", "null", ")", ";", "}" ]
Get the marker anchor which will be added to the documentation tree. @param sectionName the section name anchor attribute for page @param anchorName the anchor name combined with section name attribute for the page @return a content tree for the marker anchor
[ "Get", "the", "marker", "anchor", "which", "will", "be", "added", "to", "the", "documentation", "tree", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L828-L830
WASdev/ci.maven
liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java
MavenProjectUtil.getPluginGoalConfigurationString
public static String getPluginGoalConfigurationString(MavenProject project, String pluginKey, String goal, String configName) throws PluginScenarioException { PluginExecution execution = getPluginGoalExecution(project, pluginKey, goal); final Xpp3Dom config = (Xpp3Dom)execution.getConfiguration(); if(config != null) { Xpp3Dom configElement = config.getChild(configName); if(configElement != null) { String value = configElement.getValue().trim(); return value; } } throw new PluginScenarioException("Could not find configuration string " + configName + " for goal " + goal + " on plugin " + pluginKey); }
java
public static String getPluginGoalConfigurationString(MavenProject project, String pluginKey, String goal, String configName) throws PluginScenarioException { PluginExecution execution = getPluginGoalExecution(project, pluginKey, goal); final Xpp3Dom config = (Xpp3Dom)execution.getConfiguration(); if(config != null) { Xpp3Dom configElement = config.getChild(configName); if(configElement != null) { String value = configElement.getValue().trim(); return value; } } throw new PluginScenarioException("Could not find configuration string " + configName + " for goal " + goal + " on plugin " + pluginKey); }
[ "public", "static", "String", "getPluginGoalConfigurationString", "(", "MavenProject", "project", ",", "String", "pluginKey", ",", "String", "goal", ",", "String", "configName", ")", "throws", "PluginScenarioException", "{", "PluginExecution", "execution", "=", "getPlug...
Get a configuration value from a goal from a plugin @param project @param pluginKey @param goal @param configName @return the value of the configuration parameter @throws PluginScenarioException
[ "Get", "a", "configuration", "value", "from", "a", "goal", "from", "a", "plugin" ]
train
https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java#L59-L71
poetix/protonpack
src/main/java/com/codepoetics/protonpack/StreamUtils.java
StreamUtils.takeUntil
public static <T> Stream<T> takeUntil(Stream<T> source, Predicate<T> condition) { return takeWhile(source, condition.negate()); }
java
public static <T> Stream<T> takeUntil(Stream<T> source, Predicate<T> condition) { return takeWhile(source, condition.negate()); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "takeUntil", "(", "Stream", "<", "T", ">", "source", ",", "Predicate", "<", "T", ">", "condition", ")", "{", "return", "takeWhile", "(", "source", ",", "condition", ".", "negate", "(", ")", ...
Construct a stream which takes values from the source stream until one of them meets the supplied condition, and then stops. @param source The source stream. @param condition The condition to apply to elements of the source stream. @param <T> The type over which the stream streams. @return A condition-bounded stream.
[ "Construct", "a", "stream", "which", "takes", "values", "from", "the", "source", "stream", "until", "one", "of", "them", "meets", "the", "supplied", "condition", "and", "then", "stops", "." ]
train
https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L155-L157
infinispan/infinispan
server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheAdd.java
CacheAdd.populate
void populate(ModelNode fromModel, ModelNode toModel) throws OperationFailedException { for(AttributeDefinition attr : CacheResource.CACHE_ATTRIBUTES) { attr.validateAndSet(fromModel, toModel); } }
java
void populate(ModelNode fromModel, ModelNode toModel) throws OperationFailedException { for(AttributeDefinition attr : CacheResource.CACHE_ATTRIBUTES) { attr.validateAndSet(fromModel, toModel); } }
[ "void", "populate", "(", "ModelNode", "fromModel", ",", "ModelNode", "toModel", ")", "throws", "OperationFailedException", "{", "for", "(", "AttributeDefinition", "attr", ":", "CacheResource", ".", "CACHE_ATTRIBUTES", ")", "{", "attr", ".", "validateAndSet", "(", ...
Transfer elements common to both operations and models @param fromModel @param toModel
[ "Transfer", "elements", "common", "to", "both", "operations", "and", "models" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheAdd.java#L270-L274
cdk/cdk
tool/charges/src/main/java/org/openscience/cdk/charges/Polarizability.java
Polarizability.calculateBondPolarizability
public double calculateBondPolarizability(IAtomContainer atomContainer, IBond bond) { double polarizabilitiy = 0; IAtomContainer acH = atomContainer.getBuilder().newInstance(IAtomContainer.class, atomContainer); addExplicitHydrogens(acH); if (bond.getAtomCount() == 2) { polarizabilitiy += getKJPolarizabilityFactor(acH, bond.getBegin()); polarizabilitiy += getKJPolarizabilityFactor(acH, bond.getEnd()); } return (polarizabilitiy / 2); }
java
public double calculateBondPolarizability(IAtomContainer atomContainer, IBond bond) { double polarizabilitiy = 0; IAtomContainer acH = atomContainer.getBuilder().newInstance(IAtomContainer.class, atomContainer); addExplicitHydrogens(acH); if (bond.getAtomCount() == 2) { polarizabilitiy += getKJPolarizabilityFactor(acH, bond.getBegin()); polarizabilitiy += getKJPolarizabilityFactor(acH, bond.getEnd()); } return (polarizabilitiy / 2); }
[ "public", "double", "calculateBondPolarizability", "(", "IAtomContainer", "atomContainer", ",", "IBond", "bond", ")", "{", "double", "polarizabilitiy", "=", "0", ";", "IAtomContainer", "acH", "=", "atomContainer", ".", "getBuilder", "(", ")", ".", "newInstance", "...
calculate bond polarizability. @param atomContainer AtomContainer @param bond Bond bond for which the polarizabilitiy should be calculated @return polarizabilitiy
[ "calculate", "bond", "polarizability", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/charges/src/main/java/org/openscience/cdk/charges/Polarizability.java#L190-L199
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java
CommonsOJBLockManager.atomicGetOrCreateLock
public OJBLock atomicGetOrCreateLock(Object resourceId, Object isolationId) { synchronized(globalLocks) { MultiLevelLock lock = getLock(resourceId); if(lock == null) { lock = createLock(resourceId, isolationId); } return (OJBLock) lock; } }
java
public OJBLock atomicGetOrCreateLock(Object resourceId, Object isolationId) { synchronized(globalLocks) { MultiLevelLock lock = getLock(resourceId); if(lock == null) { lock = createLock(resourceId, isolationId); } return (OJBLock) lock; } }
[ "public", "OJBLock", "atomicGetOrCreateLock", "(", "Object", "resourceId", ",", "Object", "isolationId", ")", "{", "synchronized", "(", "globalLocks", ")", "{", "MultiLevelLock", "lock", "=", "getLock", "(", "resourceId", ")", ";", "if", "(", "lock", "==", "nu...
Either gets an existing lock on the specified resource or creates one if none exists. This methods guarantees to do this atomically. @param resourceId the resource to get or create the lock on @param isolationId the isolation level identity key. See {@link CommonsOJBLockManager}. @return the lock for the specified resource
[ "Either", "gets", "an", "existing", "lock", "on", "the", "specified", "resource", "or", "creates", "one", "if", "none", "exists", ".", "This", "methods", "guarantees", "to", "do", "this", "atomically", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java#L148-L159
zaproxy/zaproxy
src/org/parosproxy/paros/core/scanner/HostProcess.java
HostProcess.notifyNewMessage
public void notifyNewMessage(Plugin plugin, HttpMessage message) { parentScanner.notifyNewMessage(message); notifyNewMessage(plugin); }
java
public void notifyNewMessage(Plugin plugin, HttpMessage message) { parentScanner.notifyNewMessage(message); notifyNewMessage(plugin); }
[ "public", "void", "notifyNewMessage", "(", "Plugin", "plugin", ",", "HttpMessage", "message", ")", "{", "parentScanner", ".", "notifyNewMessage", "(", "message", ")", ";", "notifyNewMessage", "(", "plugin", ")", ";", "}" ]
Notifies that the given {@code plugin} sent (and received) the given HTTP message. @param plugin the plugin that sent the message @param message the message sent @throws IllegalArgumentException if the given {@code plugin} is {@code null}. @since 2.5.0 @see #notifyNewMessage(Plugin)
[ "Notifies", "that", "the", "given", "{", "@code", "plugin", "}", "sent", "(", "and", "received", ")", "the", "given", "HTTP", "message", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/HostProcess.java#L734-L737
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.isAscii
private static boolean isAscii(ByteBuf buf, int index, int length) { return buf.forEachByte(index, length, FIND_NON_ASCII) == -1; }
java
private static boolean isAscii(ByteBuf buf, int index, int length) { return buf.forEachByte(index, length, FIND_NON_ASCII) == -1; }
[ "private", "static", "boolean", "isAscii", "(", "ByteBuf", "buf", ",", "int", "index", ",", "int", "length", ")", "{", "return", "buf", ".", "forEachByte", "(", "index", ",", "length", ",", "FIND_NON_ASCII", ")", "==", "-", "1", ";", "}" ]
Returns {@code true} if the specified {@link ByteBuf} starting at {@code index} with {@code length} is valid ASCII text, otherwise return {@code false}. @param buf The given {@link ByteBuf}. @param index The start index of the specified buffer. @param length The length of the specified buffer.
[ "Returns", "{", "@code", "true", "}", "if", "the", "specified", "{", "@link", "ByteBuf", "}", "starting", "at", "{", "@code", "index", "}", "with", "{", "@code", "length", "}", "is", "valid", "ASCII", "text", "otherwise", "return", "{", "@code", "false",...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L1269-L1271
jakenjarvis/Android-OrmLiteContentProvider
ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java
OrmLiteDefaultContentProvider.onUpdateCompleted
protected void onUpdateCompleted(int result, Uri uri, MatcherPattern target, UpdateParameters parameter) { this.getContext().getContentResolver().notifyChange(uri, null); }
java
protected void onUpdateCompleted(int result, Uri uri, MatcherPattern target, UpdateParameters parameter) { this.getContext().getContentResolver().notifyChange(uri, null); }
[ "protected", "void", "onUpdateCompleted", "(", "int", "result", ",", "Uri", "uri", ",", "MatcherPattern", "target", ",", "UpdateParameters", "parameter", ")", "{", "this", ".", "getContext", "(", ")", ".", "getContentResolver", "(", ")", ".", "notifyChange", "...
This method is called after the onUpdate processing has been handled. If you're a need, you can override this method. @param result This is the return value of onUpdate method. @param uri This is the Uri of target. @param target This is identical to the argument of onUpdate method. It is MatcherPattern objects that match to evaluate Uri by UriMatcher. You can access information in the tables and columns, ContentUri, MimeType etc. @param parameter This is identical to the argument of onUpdate method. Arguments passed to the update() method. @since 1.0.4
[ "This", "method", "is", "called", "after", "the", "onUpdate", "processing", "has", "been", "handled", ".", "If", "you", "re", "a", "need", "you", "can", "override", "this", "method", "." ]
train
https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L334-L336
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/QueueData.java
QueueData.addSlice
public synchronized void addSlice(CommsByteBuffer bufferContainingSlice, boolean last) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "addSlice", new Object[]{bufferContainingSlice, last}); slices.add(bufferContainingSlice.getDataSlice()); // If this is the last slice, calculate the message length if (last) { for (DataSlice slice : slices) { messageLength += slice.getLength(); } complete = true; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Message now consists of " + slices.size() + " slices"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addSlice"); }
java
public synchronized void addSlice(CommsByteBuffer bufferContainingSlice, boolean last) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "addSlice", new Object[]{bufferContainingSlice, last}); slices.add(bufferContainingSlice.getDataSlice()); // If this is the last slice, calculate the message length if (last) { for (DataSlice slice : slices) { messageLength += slice.getLength(); } complete = true; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Message now consists of " + slices.size() + " slices"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addSlice"); }
[ "public", "synchronized", "void", "addSlice", "(", "CommsByteBuffer", "bufferContainingSlice", ",", "boolean", "last", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", ...
This method will add a data slice to the list of slices for this message. @param bufferContainingSlice @param last
[ "This", "method", "will", "add", "a", "data", "slice", "to", "the", "list", "of", "slices", "for", "this", "message", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/QueueData.java#L161-L180
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/GeoIntents.java
GeoIntents.newMapsIntent
public static Intent newMapsIntent(float latitude, float longitude, String placeName) { StringBuilder sb = new StringBuilder(); sb.append("geo:"); sb.append(latitude); sb.append(","); sb.append(longitude); if (!TextUtils.isEmpty(placeName)) { sb.append("?q="); sb.append(latitude); sb.append(","); sb.append(longitude); sb.append("("); sb.append(Uri.encode(placeName)); sb.append(")"); } return new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString())); }
java
public static Intent newMapsIntent(float latitude, float longitude, String placeName) { StringBuilder sb = new StringBuilder(); sb.append("geo:"); sb.append(latitude); sb.append(","); sb.append(longitude); if (!TextUtils.isEmpty(placeName)) { sb.append("?q="); sb.append(latitude); sb.append(","); sb.append(longitude); sb.append("("); sb.append(Uri.encode(placeName)); sb.append(")"); } return new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString())); }
[ "public", "static", "Intent", "newMapsIntent", "(", "float", "latitude", ",", "float", "longitude", ",", "String", "placeName", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"geo:\"", ")", ";", "sb...
Intent that should allow opening a map showing the given location (if it exists) @param latitude The latitude of the center of the map @param longitude The longitude of the center of the map @param placeName The name to show on the marker @return the intent
[ "Intent", "that", "should", "allow", "opening", "a", "map", "showing", "the", "given", "location", "(", "if", "it", "exists", ")" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/GeoIntents.java#L70-L89
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.rotateLocalY
public Matrix4x3d rotateLocalY(double ang, Matrix4x3d dest) { double sin = Math.sin(ang); double cos = Math.cosFromSin(sin, ang); double nm00 = cos * m00 + sin * m02; double nm02 = -sin * m00 + cos * m02; double nm10 = cos * m10 + sin * m12; double nm12 = -sin * m10 + cos * m12; double nm20 = cos * m20 + sin * m22; double nm22 = -sin * m20 + cos * m22; double nm30 = cos * m30 + sin * m32; double nm32 = -sin * m30 + cos * m32; dest.m00 = nm00; dest.m01 = m01; dest.m02 = nm02; dest.m10 = nm10; dest.m11 = m11; dest.m12 = nm12; dest.m20 = nm20; dest.m21 = m21; dest.m22 = nm22; dest.m30 = nm30; dest.m31 = m31; dest.m32 = nm32; dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
java
public Matrix4x3d rotateLocalY(double ang, Matrix4x3d dest) { double sin = Math.sin(ang); double cos = Math.cosFromSin(sin, ang); double nm00 = cos * m00 + sin * m02; double nm02 = -sin * m00 + cos * m02; double nm10 = cos * m10 + sin * m12; double nm12 = -sin * m10 + cos * m12; double nm20 = cos * m20 + sin * m22; double nm22 = -sin * m20 + cos * m22; double nm30 = cos * m30 + sin * m32; double nm32 = -sin * m30 + cos * m32; dest.m00 = nm00; dest.m01 = m01; dest.m02 = nm02; dest.m10 = nm10; dest.m11 = m11; dest.m12 = nm12; dest.m20 = nm20; dest.m21 = m21; dest.m22 = nm22; dest.m30 = nm30; dest.m31 = m31; dest.m32 = nm32; dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
[ "public", "Matrix4x3d", "rotateLocalY", "(", "double", "ang", ",", "Matrix4x3d", "dest", ")", "{", "double", "sin", "=", "Math", ".", "sin", "(", "ang", ")", ";", "double", "cos", "=", "Math", ".", "cosFromSin", "(", "sin", ",", "ang", ")", ";", "dou...
Pre-multiply a rotation around the Y axis to this matrix by rotating the given amount of radians about the Y axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationY(double) rotationY()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationY(double) @param ang the angle in radians to rotate about the Y axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "around", "the", "Y", "axis", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "Y", "axis", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L3664-L3689
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_dynHost_login_POST
public OvhDynHostLogin zone_zoneName_dynHost_login_POST(String zoneName, String loginSuffix, String password, String subDomain) throws IOException { String qPath = "/domain/zone/{zoneName}/dynHost/login"; StringBuilder sb = path(qPath, zoneName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "loginSuffix", loginSuffix); addBody(o, "password", password); addBody(o, "subDomain", subDomain); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhDynHostLogin.class); }
java
public OvhDynHostLogin zone_zoneName_dynHost_login_POST(String zoneName, String loginSuffix, String password, String subDomain) throws IOException { String qPath = "/domain/zone/{zoneName}/dynHost/login"; StringBuilder sb = path(qPath, zoneName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "loginSuffix", loginSuffix); addBody(o, "password", password); addBody(o, "subDomain", subDomain); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhDynHostLogin.class); }
[ "public", "OvhDynHostLogin", "zone_zoneName_dynHost_login_POST", "(", "String", "zoneName", ",", "String", "loginSuffix", ",", "String", "password", ",", "String", "subDomain", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/dynHost/l...
Create a new DynHost login REST: POST /domain/zone/{zoneName}/dynHost/login @param password [required] Password of the login @param subDomain [required] Subdomain that the login will be allowed to update (use * to allow all) @param loginSuffix [required] Suffix that will be concatenated to the zoneName to create the login @param zoneName [required] The internal name of your zone
[ "Create", "a", "new", "DynHost", "login" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L514-L523
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/ram/RamResourceCore.java
RamResourceCore.getChild
public RamResourceCore getChild(String name, boolean caseSensitive) { if (children == null) return null; RamResourceCore child; for (int i = children.size() - 1; i >= 0; i--) { child = (RamResourceCore) children.get(i); if (child != null && (caseSensitive ? child.getName().equals(name) : child.getName().equalsIgnoreCase(name))) return child; } return null; }
java
public RamResourceCore getChild(String name, boolean caseSensitive) { if (children == null) return null; RamResourceCore child; for (int i = children.size() - 1; i >= 0; i--) { child = (RamResourceCore) children.get(i); if (child != null && (caseSensitive ? child.getName().equals(name) : child.getName().equalsIgnoreCase(name))) return child; } return null; }
[ "public", "RamResourceCore", "getChild", "(", "String", "name", ",", "boolean", "caseSensitive", ")", "{", "if", "(", "children", "==", "null", ")", "return", "null", ";", "RamResourceCore", "child", ";", "for", "(", "int", "i", "=", "children", ".", "size...
returns a child that match given name @param name @return matching child
[ "returns", "a", "child", "that", "match", "given", "name" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/ram/RamResourceCore.java#L204-L213
twilio/twilio-java
src/main/java/com/twilio/rest/flexapi/v1/FlexFlowReader.java
FlexFlowReader.nextPage
@Override public Page<FlexFlow> nextPage(final Page<FlexFlow> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.FLEXAPI.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<FlexFlow> nextPage(final Page<FlexFlow> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.FLEXAPI.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "FlexFlow", ">", "nextPage", "(", "final", "Page", "<", "FlexFlow", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", ...
Retrieve the next page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Next Page
[ "Retrieve", "the", "next", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/flexapi/v1/FlexFlowReader.java#L92-L103
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper._hasSideEffects
protected Boolean _hasSideEffects(XCastedExpression expression, ISideEffectContext context) { return hasSideEffects(expression.getTarget(), context); }
java
protected Boolean _hasSideEffects(XCastedExpression expression, ISideEffectContext context) { return hasSideEffects(expression.getTarget(), context); }
[ "protected", "Boolean", "_hasSideEffects", "(", "XCastedExpression", "expression", ",", "ISideEffectContext", "context", ")", "{", "return", "hasSideEffects", "(", "expression", ".", "getTarget", "(", ")", ",", "context", ")", ";", "}" ]
Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects.
[ "Test", "if", "the", "given", "expression", "has", "side", "effects", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L274-L276
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.getFsLayers
private static JsonNode getFsLayers(JsonNode manifest, boolean isSchemeVersion1) { JsonNode fsLayers; if (isSchemeVersion1) { fsLayers = manifest.get("fsLayers"); } else { fsLayers = manifest.get("layers"); } if (fsLayers == null) { throw new IllegalStateException("Could not find 'fsLayers' or 'layers' in manifest"); } return fsLayers; }
java
private static JsonNode getFsLayers(JsonNode manifest, boolean isSchemeVersion1) { JsonNode fsLayers; if (isSchemeVersion1) { fsLayers = manifest.get("fsLayers"); } else { fsLayers = manifest.get("layers"); } if (fsLayers == null) { throw new IllegalStateException("Could not find 'fsLayers' or 'layers' in manifest"); } return fsLayers; }
[ "private", "static", "JsonNode", "getFsLayers", "(", "JsonNode", "manifest", ",", "boolean", "isSchemeVersion1", ")", "{", "JsonNode", "fsLayers", ";", "if", "(", "isSchemeVersion1", ")", "{", "fsLayers", "=", "manifest", ".", "get", "(", "\"fsLayers\"", ")", ...
Return blob sum depend on scheme version. @param manifest @param isSchemeVersion1 @return
[ "Return", "blob", "sum", "depend", "on", "scheme", "version", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L173-L185
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_virtualMac_POST
public OvhTask serviceName_virtualMac_POST(String serviceName, String ipAddress, OvhVmacTypeEnum type, String virtualMachineName) throws IOException { String qPath = "/dedicated/server/{serviceName}/virtualMac"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ipAddress", ipAddress); addBody(o, "type", type); addBody(o, "virtualMachineName", virtualMachineName); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_virtualMac_POST(String serviceName, String ipAddress, OvhVmacTypeEnum type, String virtualMachineName) throws IOException { String qPath = "/dedicated/server/{serviceName}/virtualMac"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ipAddress", ipAddress); addBody(o, "type", type); addBody(o, "virtualMachineName", virtualMachineName); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_virtualMac_POST", "(", "String", "serviceName", ",", "String", "ipAddress", ",", "OvhVmacTypeEnum", "type", ",", "String", "virtualMachineName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}...
Add a virtual mac to an IP address REST: POST /dedicated/server/{serviceName}/virtualMac @param type [required] vmac address type @param virtualMachineName [required] Friendly name of your Virtual Machine behind this IP/MAC @param ipAddress [required] Ip address to link with this virtualMac @param serviceName [required] The internal name of your dedicated server
[ "Add", "a", "virtual", "mac", "to", "an", "IP", "address" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L541-L550
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/Charset.java
Charset.forName
public static Charset forName(String charsetName) { // Is this charset in our cache? Charset cs; synchronized (CACHED_CHARSETS) { cs = CACHED_CHARSETS.get(charsetName); if (cs != null) { return cs; } } if (charsetName == null) { throw new IllegalCharsetNameException(null); } // Is this a built-in charset supported by iOS? checkCharsetName(charsetName); cs = IOSCharset.charsetForName(charsetName); if (cs != null) { return cacheCharset(charsetName, cs); } throw new UnsupportedCharsetException(charsetName); }
java
public static Charset forName(String charsetName) { // Is this charset in our cache? Charset cs; synchronized (CACHED_CHARSETS) { cs = CACHED_CHARSETS.get(charsetName); if (cs != null) { return cs; } } if (charsetName == null) { throw new IllegalCharsetNameException(null); } // Is this a built-in charset supported by iOS? checkCharsetName(charsetName); cs = IOSCharset.charsetForName(charsetName); if (cs != null) { return cacheCharset(charsetName, cs); } throw new UnsupportedCharsetException(charsetName); }
[ "public", "static", "Charset", "forName", "(", "String", "charsetName", ")", "{", "// Is this charset in our cache?", "Charset", "cs", ";", "synchronized", "(", "CACHED_CHARSETS", ")", "{", "cs", "=", "CACHED_CHARSETS", ".", "get", "(", "charsetName", ")", ";", ...
Returns a {@code Charset} instance for the named charset. @param charsetName a charset name (either canonical or an alias) @throws IllegalCharsetNameException if the specified charset name is illegal. @throws UnsupportedCharsetException if the desired charset is not supported by this runtime.
[ "Returns", "a", "{", "@code", "Charset", "}", "instance", "for", "the", "named", "charset", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/Charset.java#L253-L275
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/PropertiesUtils.java
PropertiesUtils.getDouble
public static double getDouble(Properties props, String key, double defaultValue) { String value = props.getProperty(key); if (value != null) { return Double.parseDouble(value); } else { return defaultValue; } }
java
public static double getDouble(Properties props, String key, double defaultValue) { String value = props.getProperty(key); if (value != null) { return Double.parseDouble(value); } else { return defaultValue; } }
[ "public", "static", "double", "getDouble", "(", "Properties", "props", ",", "String", "key", ",", "double", "defaultValue", ")", "{", "String", "value", "=", "props", ".", "getProperty", "(", "key", ")", ";", "if", "(", "value", "!=", "null", ")", "{", ...
Load a double property. If the key is not present, returns defaultValue.
[ "Load", "a", "double", "property", ".", "If", "the", "key", "is", "not", "present", "returns", "defaultValue", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/PropertiesUtils.java#L148-L155
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optBoolean
public static boolean optBoolean(@Nullable Bundle bundle, @Nullable String key) { return optBoolean(bundle, key, false); }
java
public static boolean optBoolean(@Nullable Bundle bundle, @Nullable String key) { return optBoolean(bundle, key, false); }
[ "public", "static", "boolean", "optBoolean", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")", "{", "return", "optBoolean", "(", "bundle", ",", "key", ",", "false", ")", ";", "}" ]
Returns a optional boolean value. In other words, returns the value mapped by key if it exists and is a boolean. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns false. @param bundle a bundle. If the bundle is null, this method will return false. @param key a key for the value. @return a boolean value if exists, false otherwise. @see android.os.Bundle#getBoolean(String)
[ "Returns", "a", "optional", "boolean", "value", ".", "In", "other", "words", "returns", "the", "value", "mapped", "by", "key", "if", "it", "exists", "and", "is", "a", "boolean", ".", "The", "bundle", "argument", "is", "allowed", "to", "be", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L125-L127
bitcoinj/bitcoinj
wallettemplate/src/main/java/wallettemplate/utils/QRCodeImages.java
QRCodeImages.matrixFromString
private static BitMatrix matrixFromString(String uri, int width, int height) { Writer qrWriter = new QRCodeWriter(); BitMatrix matrix; try { matrix = qrWriter.encode(uri, BarcodeFormat.QR_CODE, width, height); } catch (WriterException e) { throw new RuntimeException(e); } return matrix; }
java
private static BitMatrix matrixFromString(String uri, int width, int height) { Writer qrWriter = new QRCodeWriter(); BitMatrix matrix; try { matrix = qrWriter.encode(uri, BarcodeFormat.QR_CODE, width, height); } catch (WriterException e) { throw new RuntimeException(e); } return matrix; }
[ "private", "static", "BitMatrix", "matrixFromString", "(", "String", "uri", ",", "int", "width", ",", "int", "height", ")", "{", "Writer", "qrWriter", "=", "new", "QRCodeWriter", "(", ")", ";", "BitMatrix", "matrix", ";", "try", "{", "matrix", "=", "qrWrit...
Create a BitMatrix from a Bitcoin URI @param uri Bitcoin URI @return A BitMatrix for the QRCode for the URI
[ "Create", "a", "BitMatrix", "from", "a", "Bitcoin", "URI" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/wallettemplate/src/main/java/wallettemplate/utils/QRCodeImages.java#L48-L57
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java
TarHeader.parseName
public static StringBuffer parseName(byte[] header, int offset, int length) throws InvalidHeaderException { StringBuffer result = new StringBuffer(length); int end = offset + length; for (int i = offset; i < end; ++i) { if (header[i] == 0) { break; } result.append((char) header[i]); } return result; }
java
public static StringBuffer parseName(byte[] header, int offset, int length) throws InvalidHeaderException { StringBuffer result = new StringBuffer(length); int end = offset + length; for (int i = offset; i < end; ++i) { if (header[i] == 0) { break; } result.append((char) header[i]); } return result; }
[ "public", "static", "StringBuffer", "parseName", "(", "byte", "[", "]", "header", ",", "int", "offset", ",", "int", "length", ")", "throws", "InvalidHeaderException", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "length", ")", ";", "int", ...
Parse an entry name from a header buffer. @param header The header buffer from which to parse. @param offset The offset into the buffer from which to parse. @param length The number of header bytes to parse. @return The header's entry name.
[ "Parse", "an", "entry", "name", "from", "a", "header", "buffer", "." ]
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L331-L343
NessComputing/syslog4j
src/main/java/com/nesscomputing/syslog4j/Syslog.java
Syslog.destroyInstance
public synchronized static void destroyInstance(SyslogIF syslog) throws SyslogRuntimeException { if (syslog == null) { return; } String protocol = syslog.getProtocol().toLowerCase(); if (instances.containsKey(protocol)) { try { syslog.shutdown(); } finally { instances.remove(protocol); } } else { throw new SyslogRuntimeException("Cannot destroy protocol \"%s\" instance; call shutdown instead", protocol); } }
java
public synchronized static void destroyInstance(SyslogIF syslog) throws SyslogRuntimeException { if (syslog == null) { return; } String protocol = syslog.getProtocol().toLowerCase(); if (instances.containsKey(protocol)) { try { syslog.shutdown(); } finally { instances.remove(protocol); } } else { throw new SyslogRuntimeException("Cannot destroy protocol \"%s\" instance; call shutdown instead", protocol); } }
[ "public", "synchronized", "static", "void", "destroyInstance", "(", "SyslogIF", "syslog", ")", "throws", "SyslogRuntimeException", "{", "if", "(", "syslog", "==", "null", ")", "{", "return", ";", "}", "String", "protocol", "=", "syslog", ".", "getProtocol", "(...
destroyInstance() gracefully shuts down the specified Syslog instance and removes it from Syslog4j. @param syslog - the Syslog instance to destroy @throws SyslogRuntimeException
[ "destroyInstance", "()", "gracefully", "shuts", "down", "the", "specified", "Syslog", "instance", "and", "removes", "it", "from", "Syslog4j", "." ]
train
https://github.com/NessComputing/syslog4j/blob/698fe4ce926cfc46524329d089052507cdb8cba4/src/main/java/com/nesscomputing/syslog4j/Syslog.java#L269-L287
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanDocBookBuilder.java
PublicanDocBookBuilder.applyPublicanCfgOverrides
private String applyPublicanCfgOverrides(final BuildData buildData, final String publicanCfg) { final Map<String, String> publicanCfgOverrides = buildData.getBuildOptions().getPublicanCfgOverrides(); String retValue = publicanCfg; // Loop over each override and remove any entries that may exist and then append the new entry for (final Map.Entry<String, String> publicanCfgOverrideEntry : publicanCfgOverrides.entrySet()) { retValue = retValue.replaceFirst(publicanCfgOverrideEntry.getKey() + "\\s*:.*?(\\r)?\\n", ""); retValue += publicanCfgOverrideEntry.getKey() + ": " + publicanCfgOverrideEntry.getValue() + "\n"; } return retValue; }
java
private String applyPublicanCfgOverrides(final BuildData buildData, final String publicanCfg) { final Map<String, String> publicanCfgOverrides = buildData.getBuildOptions().getPublicanCfgOverrides(); String retValue = publicanCfg; // Loop over each override and remove any entries that may exist and then append the new entry for (final Map.Entry<String, String> publicanCfgOverrideEntry : publicanCfgOverrides.entrySet()) { retValue = retValue.replaceFirst(publicanCfgOverrideEntry.getKey() + "\\s*:.*?(\\r)?\\n", ""); retValue += publicanCfgOverrideEntry.getKey() + ": " + publicanCfgOverrideEntry.getValue() + "\n"; } return retValue; }
[ "private", "String", "applyPublicanCfgOverrides", "(", "final", "BuildData", "buildData", ",", "final", "String", "publicanCfg", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "publicanCfgOverrides", "=", "buildData", ".", "getBuildOptions", "(", ")"...
Applies custom user overrides to the publican.cfg file. @param publicanCfg @return
[ "Applies", "custom", "user", "overrides", "to", "the", "publican", ".", "cfg", "file", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanDocBookBuilder.java#L269-L280
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java
IndexElasticsearchUpdater.createIndexWithSettingsInElasticsearch
@Deprecated private static void createIndexWithSettingsInElasticsearch(Client client, String index, String settings) throws Exception { logger.trace("createIndex([{}])", index); assert client != null; assert index != null; CreateIndexRequestBuilder cirb = client.admin().indices().prepareCreate(index); // If there are settings for this index, we use it. If not, using Elasticsearch defaults. if (settings != null) { logger.trace("Found settings for index [{}]: [{}]", index, settings); cirb.setSource(settings, XContentType.JSON); } CreateIndexResponse createIndexResponse = cirb.execute().actionGet(); if (!createIndexResponse.isAcknowledged()) { logger.warn("Could not create index [{}]", index); throw new Exception("Could not create index ["+index+"]."); } logger.trace("/createIndex([{}])", index); }
java
@Deprecated private static void createIndexWithSettingsInElasticsearch(Client client, String index, String settings) throws Exception { logger.trace("createIndex([{}])", index); assert client != null; assert index != null; CreateIndexRequestBuilder cirb = client.admin().indices().prepareCreate(index); // If there are settings for this index, we use it. If not, using Elasticsearch defaults. if (settings != null) { logger.trace("Found settings for index [{}]: [{}]", index, settings); cirb.setSource(settings, XContentType.JSON); } CreateIndexResponse createIndexResponse = cirb.execute().actionGet(); if (!createIndexResponse.isAcknowledged()) { logger.warn("Could not create index [{}]", index); throw new Exception("Could not create index ["+index+"]."); } logger.trace("/createIndex([{}])", index); }
[ "@", "Deprecated", "private", "static", "void", "createIndexWithSettingsInElasticsearch", "(", "Client", "client", ",", "String", "index", ",", "String", "settings", ")", "throws", "Exception", "{", "logger", ".", "trace", "(", "\"createIndex([{}])\"", ",", "index",...
Create a new index in Elasticsearch @param client Elasticsearch client @param index Index name @param settings Settings if any, null if no specific settings @throws Exception if the elasticsearch API call is failing
[ "Create", "a", "new", "index", "in", "Elasticsearch" ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java#L119-L141
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/util/EditeViewPageUtil.java
EditeViewPageUtil.getParamKeyValue
public Object getParamKeyValue(HttpServletRequest request, ModelHandler modelHandler) { Object keyValue = null; try { ModelMapping modelMapping = modelHandler.getModelMapping(); String keyName = modelMapping.getKeyName(); Debug.logVerbose("[JdonFramework] the keyName is " + keyName, module); String keyValueS = request.getParameter(keyName); Debug.logVerbose("[JdonFramework] got the keyValue is " + keyValueS, module); if (keyValueS == null) { Debug.logVerbose("[JdonFramework]the keyValue is null", module); } Class keyClassType = modelMapping.getKeyClassType(); if (keyClassType.isAssignableFrom(String.class)) { keyValue = keyValueS; } else { Debug.logVerbose("[JdonFramework] convert String keyValue to" + keyClassType.getName(), module); keyValue = ConvertUtils.convert(keyValueS, keyClassType); } } catch (Exception e) { Debug.logError("[JdonFramework] getParamKeyValue error: " + e); } return keyValue; }
java
public Object getParamKeyValue(HttpServletRequest request, ModelHandler modelHandler) { Object keyValue = null; try { ModelMapping modelMapping = modelHandler.getModelMapping(); String keyName = modelMapping.getKeyName(); Debug.logVerbose("[JdonFramework] the keyName is " + keyName, module); String keyValueS = request.getParameter(keyName); Debug.logVerbose("[JdonFramework] got the keyValue is " + keyValueS, module); if (keyValueS == null) { Debug.logVerbose("[JdonFramework]the keyValue is null", module); } Class keyClassType = modelMapping.getKeyClassType(); if (keyClassType.isAssignableFrom(String.class)) { keyValue = keyValueS; } else { Debug.logVerbose("[JdonFramework] convert String keyValue to" + keyClassType.getName(), module); keyValue = ConvertUtils.convert(keyValueS, keyClassType); } } catch (Exception e) { Debug.logError("[JdonFramework] getParamKeyValue error: " + e); } return keyValue; }
[ "public", "Object", "getParamKeyValue", "(", "HttpServletRequest", "request", ",", "ModelHandler", "modelHandler", ")", "{", "Object", "keyValue", "=", "null", ";", "try", "{", "ModelMapping", "modelMapping", "=", "modelHandler", ".", "getModelMapping", "(", ")", ...
获得参数key值 例如: /admin/productAction.do?action=edit&productId=1721 缺省:productId为product的modelmapping.xml中key定义值 对于如下调用: /admin/productAction.do?action=edit&userId=16 userId不是modelmapping.xml中key定义值,则需要override本方法, @param actionMapping @param request @return 参数key值 @throws java.lang.Exception
[ "获得参数key值", "例如:", "/", "admin", "/", "productAction", ".", "do?action", "=", "edit&productId", "=", "1721", "缺省", ":", "productId为product的modelmapping", ".", "xml中key定义值" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/util/EditeViewPageUtil.java#L148-L171
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java
ServerImpl.getOrCreateServerTextChannel
public ServerTextChannel getOrCreateServerTextChannel(JsonNode data) { long id = Long.parseLong(data.get("id").asText()); ChannelType type = ChannelType.fromId(data.get("type").asInt()); synchronized (this) { // TODO Treat news channels differently if (type == ChannelType.SERVER_TEXT_CHANNEL || type == ChannelType.SERVER_NEWS_CHANNEL) { return getTextChannelById(id).orElseGet(() -> new ServerTextChannelImpl(api, this, data)); } } // Invalid channel type return null; }
java
public ServerTextChannel getOrCreateServerTextChannel(JsonNode data) { long id = Long.parseLong(data.get("id").asText()); ChannelType type = ChannelType.fromId(data.get("type").asInt()); synchronized (this) { // TODO Treat news channels differently if (type == ChannelType.SERVER_TEXT_CHANNEL || type == ChannelType.SERVER_NEWS_CHANNEL) { return getTextChannelById(id).orElseGet(() -> new ServerTextChannelImpl(api, this, data)); } } // Invalid channel type return null; }
[ "public", "ServerTextChannel", "getOrCreateServerTextChannel", "(", "JsonNode", "data", ")", "{", "long", "id", "=", "Long", ".", "parseLong", "(", "data", ".", "get", "(", "\"id\"", ")", ".", "asText", "(", ")", ")", ";", "ChannelType", "type", "=", "Chan...
Gets or creates a server text channel. @param data The json data of the channel. @return The server text channel.
[ "Gets", "or", "creates", "a", "server", "text", "channel", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L618-L629
Azure/azure-sdk-for-java
redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/FirewallRulesInner.java
FirewallRulesInner.getAsync
public Observable<RedisFirewallRuleInner> getAsync(String resourceGroupName, String cacheName, String ruleName) { return getWithServiceResponseAsync(resourceGroupName, cacheName, ruleName).map(new Func1<ServiceResponse<RedisFirewallRuleInner>, RedisFirewallRuleInner>() { @Override public RedisFirewallRuleInner call(ServiceResponse<RedisFirewallRuleInner> response) { return response.body(); } }); }
java
public Observable<RedisFirewallRuleInner> getAsync(String resourceGroupName, String cacheName, String ruleName) { return getWithServiceResponseAsync(resourceGroupName, cacheName, ruleName).map(new Func1<ServiceResponse<RedisFirewallRuleInner>, RedisFirewallRuleInner>() { @Override public RedisFirewallRuleInner call(ServiceResponse<RedisFirewallRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RedisFirewallRuleInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "cacheName", ",", "String", "ruleName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "cacheName", ",", "rule...
Gets a single firewall rule in a specified redis cache. @param resourceGroupName The name of the resource group. @param cacheName The name of the Redis cache. @param ruleName The name of the firewall rule. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RedisFirewallRuleInner object
[ "Gets", "a", "single", "firewall", "rule", "in", "a", "specified", "redis", "cache", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/FirewallRulesInner.java#L350-L357
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java
TitlePaneMenuButtonPainter.paintPressed
private void paintPressed(Graphics2D g, JComponent c, int width, int height) { paintMenu(g, c, width, height, pressed); }
java
private void paintPressed(Graphics2D g, JComponent c, int width, int height) { paintMenu(g, c, width, height, pressed); }
[ "private", "void", "paintPressed", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "paintMenu", "(", "g", ",", "c", ",", "width", ",", "height", ",", "pressed", ")", ";", "}" ]
Paint the background pressed state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "background", "pressed", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java#L134-L136
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Bernoulli.java
Bernoulli.doubleSum
private Rational doubleSum(int n) { Rational resul = Rational.ZERO; for (int k = 0; k <= n; k++) { Rational jsum = Rational.ZERO; BigInteger bin = BigInteger.ONE; for (int j = 0; j <= k; j++) { BigInteger jpown = BigInteger.valueOf(j).pow(n); if (j % 2 == 0) { jsum = jsum.add(bin.multiply(jpown)); } else { jsum = jsum.subtract(bin.multiply(jpown)); } /* update binomial(k,j) recursively */ bin = bin.multiply(BigInteger.valueOf(k - j)).divide(BigInteger.valueOf(j + 1)); } resul = resul.add(jsum.divide(BigInteger.valueOf(k + 1))); } return resul; }
java
private Rational doubleSum(int n) { Rational resul = Rational.ZERO; for (int k = 0; k <= n; k++) { Rational jsum = Rational.ZERO; BigInteger bin = BigInteger.ONE; for (int j = 0; j <= k; j++) { BigInteger jpown = BigInteger.valueOf(j).pow(n); if (j % 2 == 0) { jsum = jsum.add(bin.multiply(jpown)); } else { jsum = jsum.subtract(bin.multiply(jpown)); } /* update binomial(k,j) recursively */ bin = bin.multiply(BigInteger.valueOf(k - j)).divide(BigInteger.valueOf(j + 1)); } resul = resul.add(jsum.divide(BigInteger.valueOf(k + 1))); } return resul; }
[ "private", "Rational", "doubleSum", "(", "int", "n", ")", "{", "Rational", "resul", "=", "Rational", ".", "ZERO", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<=", "n", ";", "k", "++", ")", "{", "Rational", "jsum", "=", "Rational", ".", "ZER...
/* Generate a new B_n by a standard double sum. @param n The index of the Bernoulli number. @return The Bernoulli number at n.
[ "/", "*", "Generate", "a", "new", "B_n", "by", "a", "standard", "double", "sum", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Bernoulli.java#L89-L108
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addConstraintsRangeMessage
public FessMessages addConstraintsRangeMessage(String property, String min, String max) { assertPropertyNotNull(property); add(property, new UserMessage(CONSTRAINTS_Range_MESSAGE, min, max)); return this; }
java
public FessMessages addConstraintsRangeMessage(String property, String min, String max) { assertPropertyNotNull(property); add(property, new UserMessage(CONSTRAINTS_Range_MESSAGE, min, max)); return this; }
[ "public", "FessMessages", "addConstraintsRangeMessage", "(", "String", "property", ",", "String", "min", ",", "String", "max", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "CONSTRAINTS_Range_...
Add the created action message for the key 'constraints.Range.message' with parameters. <pre> message: {item} must be between {min} and {max}. </pre> @param property The property name for the message. (NotNull) @param min The parameter min for message. (NotNull) @param max The parameter max for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "constraints", ".", "Range", ".", "message", "with", "parameters", ".", "<pre", ">", "message", ":", "{", "item", "}", "must", "be", "between", "{", "min", "}", "and", "{", "max", "}", ...
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L964-L968
di2e/Argo
clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java
CLIContext.loadProperties
private void loadProperties(InputStream stream, String path) { if (stream == null) { return; } try { Properties props = new Properties(); props.load(stream); Iterator<Object> keyIt = props.keySet().iterator(); while (keyIt.hasNext()) { String key = keyIt.next().toString(); _properties.put(key, props.get(key)); } } catch (Exception e) { Console.warn("Unable to load properties file ["+path+"]."); } finally { if (stream != null) { try { stream.close(); } catch (Exception e) { Console.warn("Unable to close properties file ["+path+"]."); } } } }
java
private void loadProperties(InputStream stream, String path) { if (stream == null) { return; } try { Properties props = new Properties(); props.load(stream); Iterator<Object> keyIt = props.keySet().iterator(); while (keyIt.hasNext()) { String key = keyIt.next().toString(); _properties.put(key, props.get(key)); } } catch (Exception e) { Console.warn("Unable to load properties file ["+path+"]."); } finally { if (stream != null) { try { stream.close(); } catch (Exception e) { Console.warn("Unable to close properties file ["+path+"]."); } } } }
[ "private", "void", "loadProperties", "(", "InputStream", "stream", ",", "String", "path", ")", "{", "if", "(", "stream", "==", "null", ")", "{", "return", ";", "}", "try", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "props", "....
Loads properties from the given stream. This will close the stream. @param stream The stream to load from. @param path The path represented by the stream.
[ "Loads", "properties", "from", "the", "given", "stream", ".", "This", "will", "close", "the", "stream", "." ]
train
https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java#L82-L110
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EventsBatch.java
EventsBatch.withEvents
public EventsBatch withEvents(java.util.Map<String, Event> events) { setEvents(events); return this; }
java
public EventsBatch withEvents(java.util.Map<String, Event> events) { setEvents(events); return this; }
[ "public", "EventsBatch", "withEvents", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "Event", ">", "events", ")", "{", "setEvents", "(", "events", ")", ";", "return", "this", ";", "}" ]
An object that contains a set of events associated with the endpoint. @param events An object that contains a set of events associated with the endpoint. @return Returns a reference to this object so that method calls can be chained together.
[ "An", "object", "that", "contains", "a", "set", "of", "events", "associated", "with", "the", "endpoint", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EventsBatch.java#L97-L100
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
KnowledgeBuilderImpl.addPackageFromDrl
public void addPackageFromDrl(final Reader reader) throws DroolsParserException, IOException { addPackageFromDrl(reader, new ReaderResource(reader, ResourceType.DRL)); }
java
public void addPackageFromDrl(final Reader reader) throws DroolsParserException, IOException { addPackageFromDrl(reader, new ReaderResource(reader, ResourceType.DRL)); }
[ "public", "void", "addPackageFromDrl", "(", "final", "Reader", "reader", ")", "throws", "DroolsParserException", ",", "IOException", "{", "addPackageFromDrl", "(", "reader", ",", "new", "ReaderResource", "(", "reader", ",", "ResourceType", ".", "DRL", ")", ")", ...
Load a rule package from DRL source. @throws DroolsParserException @throws java.io.IOException
[ "Load", "a", "rule", "package", "from", "DRL", "source", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java#L344-L347
mikepenz/FastAdapter
app/src/main/java/com/mikepenz/fastadapter/app/items/SimpleImageItem.java
SimpleImageItem.bindView
@Override public void bindView(SimpleImageItem.ViewHolder viewHolder, List<Object> payloads) { super.bindView(viewHolder, payloads); //get the context Context ctx = viewHolder.itemView.getContext(); //define our data for the view viewHolder.imageName.setText(mName); viewHolder.imageDescription.setText(mDescription); viewHolder.imageView.setImageBitmap(null); //set the background for the item int color = UIUtils.getThemeColor(ctx, R.attr.colorPrimary); viewHolder.view.clearAnimation(); viewHolder.view.setForeground(FastAdapterUIUtils.getSelectablePressedBackground(ctx, FastAdapterUIUtils.adjustAlpha(color, 100), 50, true)); //load glide Glide.clear(viewHolder.imageView); Glide.with(ctx).load(mImageUrl).animate(R.anim.alpha_on).into(viewHolder.imageView); }
java
@Override public void bindView(SimpleImageItem.ViewHolder viewHolder, List<Object> payloads) { super.bindView(viewHolder, payloads); //get the context Context ctx = viewHolder.itemView.getContext(); //define our data for the view viewHolder.imageName.setText(mName); viewHolder.imageDescription.setText(mDescription); viewHolder.imageView.setImageBitmap(null); //set the background for the item int color = UIUtils.getThemeColor(ctx, R.attr.colorPrimary); viewHolder.view.clearAnimation(); viewHolder.view.setForeground(FastAdapterUIUtils.getSelectablePressedBackground(ctx, FastAdapterUIUtils.adjustAlpha(color, 100), 50, true)); //load glide Glide.clear(viewHolder.imageView); Glide.with(ctx).load(mImageUrl).animate(R.anim.alpha_on).into(viewHolder.imageView); }
[ "@", "Override", "public", "void", "bindView", "(", "SimpleImageItem", ".", "ViewHolder", "viewHolder", ",", "List", "<", "Object", ">", "payloads", ")", "{", "super", ".", "bindView", "(", "viewHolder", ",", "payloads", ")", ";", "//get the context", "Context...
binds the data of this item onto the viewHolder @param viewHolder the viewHolder of this item
[ "binds", "the", "data", "of", "this", "item", "onto", "the", "viewHolder" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/SimpleImageItem.java#L70-L91
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/MetricFilterWithInteralReducerTransform.java
MetricFilterWithInteralReducerTransform.internalReducer
public static String internalReducer(Metric metric, String reducerType) { Map<Long, Double> sortedDatapoints = new TreeMap<>(); List<Double> operands = new ArrayList<Double>(); if(!reducerType.equals(InternalReducerType.NAME.getName())) { if(metric.getDatapoints()!=null && metric.getDatapoints().size()>0) { sortedDatapoints.putAll(metric.getDatapoints()); for (Double value : sortedDatapoints.values()) { if (value == null) { operands.add(0.0); } else { operands.add(value); } } }else { return null; } } InternalReducerType type = InternalReducerType.fromString(reducerType); switch (type) { case AVG: return String.valueOf((new Mean()).evaluate(Doubles.toArray(operands))); case MIN: return String.valueOf(Collections.min(operands)); case MAX: return String.valueOf(Collections.max(operands)); case RECENT: return String.valueOf(operands.get(operands.size() - 1)); case MAXIMA: return String.valueOf(Collections.max(operands)); case MINIMA: return String.valueOf(Collections.min(operands)); case NAME: return metric.getMetric(); case DEVIATION: return String.valueOf((new StandardDeviation()).evaluate(Doubles.toArray(operands))); default: throw new UnsupportedOperationException(reducerType); } }
java
public static String internalReducer(Metric metric, String reducerType) { Map<Long, Double> sortedDatapoints = new TreeMap<>(); List<Double> operands = new ArrayList<Double>(); if(!reducerType.equals(InternalReducerType.NAME.getName())) { if(metric.getDatapoints()!=null && metric.getDatapoints().size()>0) { sortedDatapoints.putAll(metric.getDatapoints()); for (Double value : sortedDatapoints.values()) { if (value == null) { operands.add(0.0); } else { operands.add(value); } } }else { return null; } } InternalReducerType type = InternalReducerType.fromString(reducerType); switch (type) { case AVG: return String.valueOf((new Mean()).evaluate(Doubles.toArray(operands))); case MIN: return String.valueOf(Collections.min(operands)); case MAX: return String.valueOf(Collections.max(operands)); case RECENT: return String.valueOf(operands.get(operands.size() - 1)); case MAXIMA: return String.valueOf(Collections.max(operands)); case MINIMA: return String.valueOf(Collections.min(operands)); case NAME: return metric.getMetric(); case DEVIATION: return String.valueOf((new StandardDeviation()).evaluate(Doubles.toArray(operands))); default: throw new UnsupportedOperationException(reducerType); } }
[ "public", "static", "String", "internalReducer", "(", "Metric", "metric", ",", "String", "reducerType", ")", "{", "Map", "<", "Long", ",", "Double", ">", "sortedDatapoints", "=", "new", "TreeMap", "<>", "(", ")", ";", "List", "<", "Double", ">", "operands"...
Reduces the give metric to a single value based on the specified reducer. @param metric The metric to reduce. @param reducerType The type of reduction to perform. @return The reduced value. @throws UnsupportedOperationException If an unknown reducer type is specified.
[ "Reduces", "the", "give", "metric", "to", "a", "single", "value", "based", "on", "the", "specified", "reducer", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/MetricFilterWithInteralReducerTransform.java#L92-L135
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java
GVRLight.setVec2
public void setVec2(String key, float x, float y) { checkKeyIsUniform(key); NativeLight.setVec2(getNative(), key, x, y); }
java
public void setVec2(String key, float x, float y) { checkKeyIsUniform(key); NativeLight.setVec2(getNative(), key, x, y); }
[ "public", "void", "setVec2", "(", "String", "key", ",", "float", "x", ",", "float", "y", ")", "{", "checkKeyIsUniform", "(", "key", ")", ";", "NativeLight", ".", "setVec2", "(", "getNative", "(", ")", ",", "key", ",", "x", ",", "y", ")", ";", "}" ]
Set the value for a floating point vector of length 2. @param key name of uniform to set. @param x new X value @param y new Y value @see #getVec2 @see #getFloatVec(String)
[ "Set", "the", "value", "for", "a", "floating", "point", "vector", "of", "length", "2", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java#L400-L404
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/juel/ExpressionFactoryImpl.java
ExpressionFactoryImpl.createTypeConverter
protected TypeConverter createTypeConverter(Properties properties) { Class<?> clazz = load(TypeConverter.class, properties); if (clazz == null) { return TypeConverter.DEFAULT; } try { return TypeConverter.class.cast(clazz.newInstance()); } catch (Exception e) { throw new ELException("TypeConverter " + clazz + " could not be instantiated", e); } }
java
protected TypeConverter createTypeConverter(Properties properties) { Class<?> clazz = load(TypeConverter.class, properties); if (clazz == null) { return TypeConverter.DEFAULT; } try { return TypeConverter.class.cast(clazz.newInstance()); } catch (Exception e) { throw new ELException("TypeConverter " + clazz + " could not be instantiated", e); } }
[ "protected", "TypeConverter", "createTypeConverter", "(", "Properties", "properties", ")", "{", "Class", "<", "?", ">", "clazz", "=", "load", "(", "TypeConverter", ".", "class", ",", "properties", ")", ";", "if", "(", "clazz", "==", "null", ")", "{", "retu...
Create the factory's type converter. This implementation takes the <code>de.odysseus.el.misc.TypeConverter</code> property as the name of a class implementing the <code>de.odysseus.el.misc.TypeConverter</code> interface. If the property is not set, the default converter (<code>TypeConverter.DEFAULT</code>) is used.
[ "Create", "the", "factory", "s", "type", "converter", ".", "This", "implementation", "takes", "the", "<code", ">", "de", ".", "odysseus", ".", "el", ".", "misc", ".", "TypeConverter<", "/", "code", ">", "property", "as", "the", "name", "of", "a", "class"...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/juel/ExpressionFactoryImpl.java#L348-L358
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlign.java
QsAlign.getAlignedAtomsForClusterSubunitMap
private static Pair<Atom[]> getAlignedAtomsForClusterSubunitMap( List<SubunitCluster> clusters, Map<Integer, Map<Integer, Integer>> clusterSubunitMap) { List<Atom> atomArray1 = new ArrayList<Atom>(); List<Atom> atomArray2 = new ArrayList<Atom>(); // For each cluster of subunits for (int key : clusterSubunitMap.keySet()) { // Obtain the cluster and the alignment in it SubunitCluster cluster = clusters.get(key); // For each subunit matching in the cluster for (Entry<Integer, Integer> pair : clusterSubunitMap.get(key) .entrySet()) { int i = pair.getKey(); int j = pair.getValue(); // Apend atoms to the arrays atomArray1.addAll(Arrays.asList(cluster .getAlignedAtomsSubunit(i))); atomArray2.addAll(Arrays.asList(cluster .getAlignedAtomsSubunit(j))); } } return new Pair<Atom[]>( atomArray1.toArray(new Atom[atomArray1.size()]), atomArray2.toArray(new Atom[atomArray2.size()])); }
java
private static Pair<Atom[]> getAlignedAtomsForClusterSubunitMap( List<SubunitCluster> clusters, Map<Integer, Map<Integer, Integer>> clusterSubunitMap) { List<Atom> atomArray1 = new ArrayList<Atom>(); List<Atom> atomArray2 = new ArrayList<Atom>(); // For each cluster of subunits for (int key : clusterSubunitMap.keySet()) { // Obtain the cluster and the alignment in it SubunitCluster cluster = clusters.get(key); // For each subunit matching in the cluster for (Entry<Integer, Integer> pair : clusterSubunitMap.get(key) .entrySet()) { int i = pair.getKey(); int j = pair.getValue(); // Apend atoms to the arrays atomArray1.addAll(Arrays.asList(cluster .getAlignedAtomsSubunit(i))); atomArray2.addAll(Arrays.asList(cluster .getAlignedAtomsSubunit(j))); } } return new Pair<Atom[]>( atomArray1.toArray(new Atom[atomArray1.size()]), atomArray2.toArray(new Atom[atomArray2.size()])); }
[ "private", "static", "Pair", "<", "Atom", "[", "]", ">", "getAlignedAtomsForClusterSubunitMap", "(", "List", "<", "SubunitCluster", ">", "clusters", ",", "Map", "<", "Integer", ",", "Map", "<", "Integer", ",", "Integer", ">", ">", "clusterSubunitMap", ")", "...
Returns a pair of Atom arrays corresponding to the alignment of subunit matchings, in order of appearance. Superposition of the two Atom sets gives the transformation of the complex. <p> Utility method to cumulative calculate the alignment Atoms. @param clusters List of SubunitClusters @param clusterSubunitMap map from cluster id to subunit matching @return pair of atom arrays to be superposed
[ "Returns", "a", "pair", "of", "Atom", "arrays", "corresponding", "to", "the", "alignment", "of", "subunit", "matchings", "in", "order", "of", "appearance", ".", "Superposition", "of", "the", "two", "Atom", "sets", "gives", "the", "transformation", "of", "the",...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlign.java#L323-L354
sailthru/sailthru-java-client
src/main/com/sailthru/client/AbstractSailthruClient.java
AbstractSailthruClient.httpRequest
protected Object httpRequest(HttpRequestMethod method, ApiParams apiParams) throws IOException { ApiAction action = apiParams.getApiCall(); String url = apiUrl + "/" + action.toString().toLowerCase(); String json = GSON.toJson(apiParams, apiParams.getType()); Map<String, String> params = buildPayload(json); Object response = httpClient.executeHttpRequest(url, method, params, handler, customHeaders); recordRateLimitInfo(action, method, response); return response; }
java
protected Object httpRequest(HttpRequestMethod method, ApiParams apiParams) throws IOException { ApiAction action = apiParams.getApiCall(); String url = apiUrl + "/" + action.toString().toLowerCase(); String json = GSON.toJson(apiParams, apiParams.getType()); Map<String, String> params = buildPayload(json); Object response = httpClient.executeHttpRequest(url, method, params, handler, customHeaders); recordRateLimitInfo(action, method, response); return response; }
[ "protected", "Object", "httpRequest", "(", "HttpRequestMethod", "method", ",", "ApiParams", "apiParams", ")", "throws", "IOException", "{", "ApiAction", "action", "=", "apiParams", ".", "getApiCall", "(", ")", ";", "String", "url", "=", "apiUrl", "+", "\"/\"", ...
Make HTTP Request to Sailthru API but with Api Params rather than generalized Map, this is recommended way to make request if data structure is complex @param method HTTP method @param apiParams @return Object @throws IOException
[ "Make", "HTTP", "Request", "to", "Sailthru", "API", "but", "with", "Api", "Params", "rather", "than", "generalized", "Map", "this", "is", "recommended", "way", "to", "make", "request", "if", "data", "structure", "is", "complex" ]
train
https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L170-L178
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.vps_serviceName_upgrade_duration_GET
public OvhOrder vps_serviceName_upgrade_duration_GET(String serviceName, String duration, String model) throws IOException { String qPath = "/order/vps/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "model", model); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder vps_serviceName_upgrade_duration_GET(String serviceName, String duration, String model) throws IOException { String qPath = "/order/vps/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "model", model); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "vps_serviceName_upgrade_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "String", "model", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/vps/{serviceName}/upgrade/{duration}\"", ";", "StringBuilder",...
Get prices and contracts information REST: GET /order/vps/{serviceName}/upgrade/{duration} @param model [required] Model @param serviceName [required] The internal name of your VPS offer @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3469-L3475
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasLayer.java
KerasLayer.registerCustomLayer
public static void registerCustomLayer(String layerName, Class<? extends KerasLayer> configClass) { customLayers.put(layerName, configClass); }
java
public static void registerCustomLayer(String layerName, Class<? extends KerasLayer> configClass) { customLayers.put(layerName, configClass); }
[ "public", "static", "void", "registerCustomLayer", "(", "String", "layerName", ",", "Class", "<", "?", "extends", "KerasLayer", ">", "configClass", ")", "{", "customLayers", ".", "put", "(", "layerName", ",", "configClass", ")", ";", "}" ]
Register a custom layer @param layerName name of custom layer class @param configClass class of custom layer
[ "Register", "a", "custom", "layer" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasLayer.java#L171-L173
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java
ScatterChartPanel.paintTicks
protected void paintTicks(Graphics g, ValueDimension dim) { for(int i=0; i<getTickInfo(dim).getTickNumber(); i++) { if(i % getTickInfo(dim).getTickMultiplicator() != 0) paintTick(g, dim, getTickInfo(dim).getFirstTick()+i*getTickInfo(dim).getMinorTickSpacing(), getTickInfo(dim).getMinorTickLength()); else paintTick(g, dim, getTickInfo(dim).getFirstTick()+i*getTickInfo(dim).getMinorTickSpacing(), getTickInfo(dim).getMajorTickLength()); } }
java
protected void paintTicks(Graphics g, ValueDimension dim) { for(int i=0; i<getTickInfo(dim).getTickNumber(); i++) { if(i % getTickInfo(dim).getTickMultiplicator() != 0) paintTick(g, dim, getTickInfo(dim).getFirstTick()+i*getTickInfo(dim).getMinorTickSpacing(), getTickInfo(dim).getMinorTickLength()); else paintTick(g, dim, getTickInfo(dim).getFirstTick()+i*getTickInfo(dim).getMinorTickSpacing(), getTickInfo(dim).getMajorTickLength()); } }
[ "protected", "void", "paintTicks", "(", "Graphics", "g", ",", "ValueDimension", "dim", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getTickInfo", "(", "dim", ")", ".", "getTickNumber", "(", ")", ";", "i", "++", ")", "{", "if", "(", ...
Paints tick information for the coordinate axis of the given dimension. @param g Graphics context @param dim Reference dimension for tick painting
[ "Paints", "tick", "information", "for", "the", "coordinate", "axis", "of", "the", "given", "dimension", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java#L324-L330
GeoLatte/geolatte-common-hibernate
src/main/java/org/geolatte/common/cql/hibernate/CqlHibernate.java
CqlHibernate.toCriteria
public static DetachedCriteria toCriteria(String cqlExpression, Class forClass) throws ParseException { try { Parser p = new Parser( new CqlLexer( new PushbackReader(new StringReader(cqlExpression), 1024))); // Parse the input. Start tree = p.parse(); // Build the filter expression HibernateCriteriaBuilder builder = new HibernateCriteriaBuilder(forClass); tree.apply(builder); return builder.getCriteria(); } catch(ParserException e) { ParseException parseException = new ParseException(e.getMessage(), e.getToken().getPos()); parseException.initCause(e); throw parseException; } catch (LexerException e) { ParseException parseException = new ParseException(e.getMessage(), 0); parseException.initCause(e); throw parseException; } catch (IOException e) { ParseException parseException = new ParseException(e.getMessage(), 0); parseException.initCause(e); throw parseException; } }
java
public static DetachedCriteria toCriteria(String cqlExpression, Class forClass) throws ParseException { try { Parser p = new Parser( new CqlLexer( new PushbackReader(new StringReader(cqlExpression), 1024))); // Parse the input. Start tree = p.parse(); // Build the filter expression HibernateCriteriaBuilder builder = new HibernateCriteriaBuilder(forClass); tree.apply(builder); return builder.getCriteria(); } catch(ParserException e) { ParseException parseException = new ParseException(e.getMessage(), e.getToken().getPos()); parseException.initCause(e); throw parseException; } catch (LexerException e) { ParseException parseException = new ParseException(e.getMessage(), 0); parseException.initCause(e); throw parseException; } catch (IOException e) { ParseException parseException = new ParseException(e.getMessage(), 0); parseException.initCause(e); throw parseException; } }
[ "public", "static", "DetachedCriteria", "toCriteria", "(", "String", "cqlExpression", ",", "Class", "forClass", ")", "throws", "ParseException", "{", "try", "{", "Parser", "p", "=", "new", "Parser", "(", "new", "CqlLexer", "(", "new", "PushbackReader", "(", "n...
Constructs a Hibernate <tt>DetachedCriteria</tt> based on the given CQL expression, for the given class. Use the <tt>DetachedCriteria.getExecutableCriteria(mySession)</tt> to get an executable <tt>Criteria<tt>. @param cqlExpression The CQL expression @param forClass The class of the objects on which the CQL expression will be applied. @return A DetachedCriteria that corresponds to the given CQL expression. @throws java.text.ParseException When parsing fails for any reason (parser, lexer, IO)
[ "Constructs", "a", "Hibernate", "<tt", ">", "DetachedCriteria<", "/", "tt", ">", "based", "on", "the", "given", "CQL", "expression", "for", "the", "given", "class", ".", "Use", "the", "<tt", ">", "DetachedCriteria", ".", "getExecutableCriteria", "(", "mySessio...
train
https://github.com/GeoLatte/geolatte-common-hibernate/blob/2e871c70e506df2485d91152fbd0955c94de1d39/src/main/java/org/geolatte/common/cql/hibernate/CqlHibernate.java#L36-L67
belaban/JGroups
src/org/jgroups/util/DefaultThreadFactory.java
DefaultThreadFactory.renameThread
public void renameThread(String base_name, Thread thread, String addr, String cluster_name) { String thread_name=getThreadName(base_name, thread, addr, cluster_name); if(thread_name != null) thread.setName(thread_name); }
java
public void renameThread(String base_name, Thread thread, String addr, String cluster_name) { String thread_name=getThreadName(base_name, thread, addr, cluster_name); if(thread_name != null) thread.setName(thread_name); }
[ "public", "void", "renameThread", "(", "String", "base_name", ",", "Thread", "thread", ",", "String", "addr", ",", "String", "cluster_name", ")", "{", "String", "thread_name", "=", "getThreadName", "(", "base_name", ",", "thread", ",", "addr", ",", "cluster_na...
Names a thread according to base_name, cluster name and local address. If includeClusterName and includeLocalAddress are null, but cluster_name is set, then we assume we have a shared transport and name the thread shared=clusterName. In the latter case, clusterName points to the singleton_name of TP. @param base_name @param thread @param addr @param cluster_name
[ "Names", "a", "thread", "according", "to", "base_name", "cluster", "name", "and", "local", "address", ".", "If", "includeClusterName", "and", "includeLocalAddress", "are", "null", "but", "cluster_name", "is", "set", "then", "we", "assume", "we", "have", "a", "...
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/DefaultThreadFactory.java#L88-L92
maxschuster/DataUrl
src/main/java/eu/maxschuster/dataurl/DataUrlSerializer.java
DataUrlSerializer.getAppliedCharset
protected String getAppliedCharset(Map<String, String> headers) { String encoding; if (headers != null && (encoding = headers.get("charset")) != null) { return encoding; } return "US-ASCII"; }
java
protected String getAppliedCharset(Map<String, String> headers) { String encoding; if (headers != null && (encoding = headers.get("charset")) != null) { return encoding; } return "US-ASCII"; }
[ "protected", "String", "getAppliedCharset", "(", "Map", "<", "String", ",", "String", ">", "headers", ")", "{", "String", "encoding", ";", "if", "(", "headers", "!=", "null", "&&", "(", "encoding", "=", "headers", ".", "get", "(", "\"charset\"", ")", ")"...
Gets the charset that should be used to encode the {@link DataUrl} @param headers Headers map @return Applied charset, never {@code null}
[ "Gets", "the", "charset", "that", "should", "be", "used", "to", "encode", "the", "{" ]
train
https://github.com/maxschuster/DataUrl/blob/6b2e2c54e50bb8ee5a7d8b30c8c2b3b24ddcb628/src/main/java/eu/maxschuster/dataurl/DataUrlSerializer.java#L192-L198
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java
DateTimeFormatter.withLocale
public DateTimeFormatter withLocale(Locale locale) { if (this.locale.equals(locale)) { return this; } return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone); }
java
public DateTimeFormatter withLocale(Locale locale) { if (this.locale.equals(locale)) { return this; } return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone); }
[ "public", "DateTimeFormatter", "withLocale", "(", "Locale", "locale", ")", "{", "if", "(", "this", ".", "locale", ".", "equals", "(", "locale", ")", ")", "{", "return", "this", ";", "}", "return", "new", "DateTimeFormatter", "(", "printerParser", ",", "loc...
Returns a copy of this formatter with a new locale. <p> This is used to lookup any part of the formatter needing specific localization, such as the text or localized pattern. <p> This instance is immutable and unaffected by this method call. @param locale the new locale, not null @return a formatter based on this formatter with the requested locale, not null
[ "Returns", "a", "copy", "of", "this", "formatter", "with", "a", "new", "locale", ".", "<p", ">", "This", "is", "used", "to", "lookup", "any", "part", "of", "the", "formatter", "needing", "specific", "localization", "such", "as", "the", "text", "or", "loc...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L1409-L1414
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java
Parameters.getStringOf
public String getStringOf(final String param, final List<String> possibleValues) { checkNotNull(possibleValues); checkArgument(!possibleValues.isEmpty()); final String value = getString(param); if (possibleValues.contains(value)) { return value; } else { throw new InvalidEnumeratedPropertyException(fullString(param), value, possibleValues); } }
java
public String getStringOf(final String param, final List<String> possibleValues) { checkNotNull(possibleValues); checkArgument(!possibleValues.isEmpty()); final String value = getString(param); if (possibleValues.contains(value)) { return value; } else { throw new InvalidEnumeratedPropertyException(fullString(param), value, possibleValues); } }
[ "public", "String", "getStringOf", "(", "final", "String", "param", ",", "final", "List", "<", "String", ">", "possibleValues", ")", "{", "checkNotNull", "(", "possibleValues", ")", ";", "checkArgument", "(", "!", "possibleValues", ".", "isEmpty", "(", ")", ...
Looks up a parameter. If the value is not in <code>possibleValues</code>, throws and exception. @param possibleValues May not be null. May not be empty. @throws InvalidEnumeratedPropertyException if the parameter value is not on the list.
[ "Looks", "up", "a", "parameter", ".", "If", "the", "value", "is", "not", "in", "<code", ">", "possibleValues<", "/", "code", ">", "throws", "and", "exception", "." ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L416-L427
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.getAndCheckEntitySet
public static EntitySet getAndCheckEntitySet(EntityDataModel entityDataModel, String entitySetName) { EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(entitySetName); if (entitySet == null) { throw new ODataSystemException("Entity set not found in the entity data model: " + entitySetName); } return entitySet; }
java
public static EntitySet getAndCheckEntitySet(EntityDataModel entityDataModel, String entitySetName) { EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(entitySetName); if (entitySet == null) { throw new ODataSystemException("Entity set not found in the entity data model: " + entitySetName); } return entitySet; }
[ "public", "static", "EntitySet", "getAndCheckEntitySet", "(", "EntityDataModel", "entityDataModel", ",", "String", "entitySetName", ")", "{", "EntitySet", "entitySet", "=", "entityDataModel", ".", "getEntityContainer", "(", ")", ".", "getEntitySet", "(", "entitySetName"...
Gets the entity set with the specified name, throws an exception if no entity set with the specified name exists. @param entityDataModel The entity data model. @param entitySetName The name of the entity set. @return The entity set. @throws ODataSystemException If the entity data model does not contain an entity set with the specified name.
[ "Gets", "the", "entity", "set", "with", "the", "specified", "name", "throws", "an", "exception", "if", "no", "entity", "set", "with", "the", "specified", "name", "exists", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L447-L453
radkovo/CSSBox
src/main/java/org/fit/cssbox/css/HTMLNorm.java
HTMLNorm.computeAttributeLength
public static int computeAttributeLength(String value, int whole) throws NumberFormatException { String sval = value.trim().toLowerCase(); if (sval.endsWith("%")) { double val = Double.parseDouble(sval.substring(0, sval.length() - 1)); return (int) Math.round(val * whole / 100.0); } else if (sval.endsWith("px")) { return (int) Math.rint(Double.parseDouble(sval.substring(0, sval.length() - 2))); } else { return (int) Math.rint(Double.parseDouble(sval)); } }
java
public static int computeAttributeLength(String value, int whole) throws NumberFormatException { String sval = value.trim().toLowerCase(); if (sval.endsWith("%")) { double val = Double.parseDouble(sval.substring(0, sval.length() - 1)); return (int) Math.round(val * whole / 100.0); } else if (sval.endsWith("px")) { return (int) Math.rint(Double.parseDouble(sval.substring(0, sval.length() - 2))); } else { return (int) Math.rint(Double.parseDouble(sval)); } }
[ "public", "static", "int", "computeAttributeLength", "(", "String", "value", ",", "int", "whole", ")", "throws", "NumberFormatException", "{", "String", "sval", "=", "value", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "sval", ".",...
Computes a length defined using an HTML attribute (e.g. width for tables). @param value The attribute value @param whole the value used as 100% when value is a percentage @return the computed length
[ "Computes", "a", "length", "defined", "using", "an", "HTML", "attribute", "(", "e", ".", "g", ".", "width", "for", "tables", ")", "." ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/css/HTMLNorm.java#L324-L340
crawljax/crawljax
examples/src/main/java/com/crawljax/examples/CrawlExample.java
CrawlExample.main
public static void main(String[] args) throws IOException { CrawljaxConfigurationBuilder builder = CrawljaxConfiguration.builderFor(URL); builder.crawlRules().setFormFillMode(FormFillMode.RANDOM); // click these elements builder.crawlRules().clickDefaultElements(); /*builder.crawlRules().click("A"); builder.crawlRules().click("button");*/ builder.crawlRules().crawlHiddenAnchors(true); builder.crawlRules().crawlFrames(false); builder.setUnlimitedCrawlDepth(); builder.setUnlimitedRuntime(); builder.setUnlimitedStates(); //builder.setMaximumStates(10); //builder.setMaximumDepth(3); builder.crawlRules().clickElementsInRandomOrder(false); // Set timeouts builder.crawlRules().waitAfterReloadUrl(WAIT_TIME_AFTER_RELOAD, TimeUnit.MILLISECONDS); builder.crawlRules().waitAfterEvent(WAIT_TIME_AFTER_EVENT, TimeUnit.MILLISECONDS); builder.setBrowserConfig(new BrowserConfiguration(BrowserType.PHANTOMJS, 1)); // CrawlOverview builder.addPlugin(new CrawlOverview()); CrawljaxRunner crawljax = new CrawljaxRunner(builder.build()); crawljax.call(); }
java
public static void main(String[] args) throws IOException { CrawljaxConfigurationBuilder builder = CrawljaxConfiguration.builderFor(URL); builder.crawlRules().setFormFillMode(FormFillMode.RANDOM); // click these elements builder.crawlRules().clickDefaultElements(); /*builder.crawlRules().click("A"); builder.crawlRules().click("button");*/ builder.crawlRules().crawlHiddenAnchors(true); builder.crawlRules().crawlFrames(false); builder.setUnlimitedCrawlDepth(); builder.setUnlimitedRuntime(); builder.setUnlimitedStates(); //builder.setMaximumStates(10); //builder.setMaximumDepth(3); builder.crawlRules().clickElementsInRandomOrder(false); // Set timeouts builder.crawlRules().waitAfterReloadUrl(WAIT_TIME_AFTER_RELOAD, TimeUnit.MILLISECONDS); builder.crawlRules().waitAfterEvent(WAIT_TIME_AFTER_EVENT, TimeUnit.MILLISECONDS); builder.setBrowserConfig(new BrowserConfiguration(BrowserType.PHANTOMJS, 1)); // CrawlOverview builder.addPlugin(new CrawlOverview()); CrawljaxRunner crawljax = new CrawljaxRunner(builder.build()); crawljax.call(); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "CrawljaxConfigurationBuilder", "builder", "=", "CrawljaxConfiguration", ".", "builderFor", "(", "URL", ")", ";", "builder", ".", "crawlRules", "(", ")", "....
Run this method to start the crawl. @throws IOException when the output folder cannot be created or emptied.
[ "Run", "this", "method", "to", "start", "the", "crawl", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/examples/src/main/java/com/crawljax/examples/CrawlExample.java#L34-L65
wg/scrypt
src/main/java/com/lambdaworks/crypto/SCryptUtil.java
SCryptUtil.check
public static boolean check(String passwd, String hashed) { try { String[] parts = hashed.split("\\$"); if (parts.length != 5 || !parts[1].equals("s0")) { throw new IllegalArgumentException("Invalid hashed value"); } long params = Long.parseLong(parts[2], 16); byte[] salt = decode(parts[3].toCharArray()); byte[] derived0 = decode(parts[4].toCharArray()); int N = (int) Math.pow(2, params >> 16 & 0xffff); int r = (int) params >> 8 & 0xff; int p = (int) params & 0xff; byte[] derived1 = SCrypt.scrypt(passwd.getBytes("UTF-8"), salt, N, r, p, 32); if (derived0.length != derived1.length) return false; int result = 0; for (int i = 0; i < derived0.length; i++) { result |= derived0[i] ^ derived1[i]; } return result == 0; } catch (UnsupportedEncodingException e) { throw new IllegalStateException("JVM doesn't support UTF-8?"); } catch (GeneralSecurityException e) { throw new IllegalStateException("JVM doesn't support SHA1PRNG or HMAC_SHA256?"); } }
java
public static boolean check(String passwd, String hashed) { try { String[] parts = hashed.split("\\$"); if (parts.length != 5 || !parts[1].equals("s0")) { throw new IllegalArgumentException("Invalid hashed value"); } long params = Long.parseLong(parts[2], 16); byte[] salt = decode(parts[3].toCharArray()); byte[] derived0 = decode(parts[4].toCharArray()); int N = (int) Math.pow(2, params >> 16 & 0xffff); int r = (int) params >> 8 & 0xff; int p = (int) params & 0xff; byte[] derived1 = SCrypt.scrypt(passwd.getBytes("UTF-8"), salt, N, r, p, 32); if (derived0.length != derived1.length) return false; int result = 0; for (int i = 0; i < derived0.length; i++) { result |= derived0[i] ^ derived1[i]; } return result == 0; } catch (UnsupportedEncodingException e) { throw new IllegalStateException("JVM doesn't support UTF-8?"); } catch (GeneralSecurityException e) { throw new IllegalStateException("JVM doesn't support SHA1PRNG or HMAC_SHA256?"); } }
[ "public", "static", "boolean", "check", "(", "String", "passwd", ",", "String", "hashed", ")", "{", "try", "{", "String", "[", "]", "parts", "=", "hashed", ".", "split", "(", "\"\\\\$\"", ")", ";", "if", "(", "parts", ".", "length", "!=", "5", "||", ...
Compare the supplied plaintext password to a hashed password. @param passwd Plaintext password. @param hashed scrypt hashed password. @return true if passwd matches hashed value.
[ "Compare", "the", "supplied", "plaintext", "password", "to", "a", "hashed", "password", "." ]
train
https://github.com/wg/scrypt/blob/0675236370458e819ee21e4427c5f7f3f9485d33/src/main/java/com/lambdaworks/crypto/SCryptUtil.java#L72-L102
nulab/backlog4j
src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java
CreateIssueParams.estimatedHours
public CreateIssueParams estimatedHours(BigDecimal estimatedHours) { if (estimatedHours == null) { parameters.add(new NameValuePair("estimatedHours", "")); } else { parameters.add(new NameValuePair("estimatedHours", estimatedHours.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString())); } return this; }
java
public CreateIssueParams estimatedHours(BigDecimal estimatedHours) { if (estimatedHours == null) { parameters.add(new NameValuePair("estimatedHours", "")); } else { parameters.add(new NameValuePair("estimatedHours", estimatedHours.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString())); } return this; }
[ "public", "CreateIssueParams", "estimatedHours", "(", "BigDecimal", "estimatedHours", ")", "{", "if", "(", "estimatedHours", "==", "null", ")", "{", "parameters", ".", "add", "(", "new", "NameValuePair", "(", "\"estimatedHours\"", ",", "\"\"", ")", ")", ";", "...
Sets the issue estimate hours. @param estimatedHours the issue estimate hours @return CreateIssueParams instance
[ "Sets", "the", "issue", "estimate", "hours", "." ]
train
https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L95-L102
devcon5io/common
cli/src/main/java/io/devcon5/cli/OptionInjector.java
OptionInjector.preFlightCheckMethods
private <T> void preFlightCheckMethods(final T target, final List<Method> methods) { methods.forEach(m -> {m.setAccessible(true); try { m.invoke(target); } catch (IllegalAccessException | InvocationTargetException e) { throw new RuntimeException(e); } }); }
java
private <T> void preFlightCheckMethods(final T target, final List<Method> methods) { methods.forEach(m -> {m.setAccessible(true); try { m.invoke(target); } catch (IllegalAccessException | InvocationTargetException e) { throw new RuntimeException(e); } }); }
[ "private", "<", "T", ">", "void", "preFlightCheckMethods", "(", "final", "T", "target", ",", "final", "List", "<", "Method", ">", "methods", ")", "{", "methods", ".", "forEach", "(", "m", "->", "{", "m", ".", "setAccessible", "(", "true", ")", ";", "...
Invokes all methods in the list on the target. @param target the target on which the methods should be ivoked @param methods the methods to be invoked in order of priority @param <T>
[ "Invokes", "all", "methods", "in", "the", "list", "on", "the", "target", "." ]
train
https://github.com/devcon5io/common/blob/363688e0dc904d559682bf796bd6c836b4e0efc7/cli/src/main/java/io/devcon5/cli/OptionInjector.java#L122-L131
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/ServerRedirectService.java
ServerRedirectService.setHostHeader
public void setHostHeader(String newHost, int id) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_SERVERS + " SET " + Constants.SERVER_REDIRECT_HOST_HEADER + " = ?" + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, newHost); statement.setInt(2, id); statement.executeUpdate(); statement.close(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void setHostHeader(String newHost, int id) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_SERVERS + " SET " + Constants.SERVER_REDIRECT_HOST_HEADER + " = ?" + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, newHost); statement.setInt(2, id); statement.executeUpdate(); statement.close(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "setHostHeader", "(", "String", "newHost", ",", "int", "id", ")", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "sqlService", ".", "getConnection", "(", ")", ")", "{", "statement", ...
Set (optional) host header for a server @param newHost host header @param id server ID
[ "Set", "(", "optional", ")", "host", "header", "for", "a", "server" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/ServerRedirectService.java#L538-L561
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java
ExpressRouteCircuitConnectionsInner.beginCreateOrUpdateAsync
public Observable<ExpressRouteCircuitConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteCircuitConnectionInner>, ExpressRouteCircuitConnectionInner>() { @Override public ExpressRouteCircuitConnectionInner call(ServiceResponse<ExpressRouteCircuitConnectionInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCircuitConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteCircuitConnectionInner>, ExpressRouteCircuitConnectionInner>() { @Override public ExpressRouteCircuitConnectionInner call(ServiceResponse<ExpressRouteCircuitConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCircuitConnectionInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "String", "peeringName", ",", "String", "connectionName", ",", "ExpressRouteCircuitConnectionInner", "exp...
Creates or updates a Express Route Circuit Connection in the specified express route circuits. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @param connectionName The name of the express route circuit connection. @param expressRouteCircuitConnectionParameters Parameters supplied to the create or update express route circuit circuit connection operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteCircuitConnectionInner object
[ "Creates", "or", "updates", "a", "Express", "Route", "Circuit", "Connection", "in", "the", "specified", "express", "route", "circuits", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java#L490-L497
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java
QsAlignResult.setSubunitMap
public void setSubunitMap(Map<Integer, Integer> subunitMap) { // Check consistency of the map if (Collections.max(subunitMap.keySet()) > subunits1.size() | Collections.max(subunitMap.values()) > subunits2.size()) throw new IndexOutOfBoundsException( "Subunit Map index higher than Subunit List size."); // Update the relation enum if (subunitMap.size() == 0) { relation = QsRelation.DIFFERENT; } else if (subunitMap.keySet().size() == subunits1.size()) { if (subunitMap.values().size() == subunits2.size()) { relation = QsRelation.EQUIVALENT; } else { relation = QsRelation.PARTIAL_COMPLETE; } } else { if (subunitMap.values().size() == subunits2.size()) { relation = QsRelation.PARTIAL_COMPLETE; } else { relation = QsRelation.PARTIAL_INCOMPLETE; } } this.subunitMap = subunitMap; }
java
public void setSubunitMap(Map<Integer, Integer> subunitMap) { // Check consistency of the map if (Collections.max(subunitMap.keySet()) > subunits1.size() | Collections.max(subunitMap.values()) > subunits2.size()) throw new IndexOutOfBoundsException( "Subunit Map index higher than Subunit List size."); // Update the relation enum if (subunitMap.size() == 0) { relation = QsRelation.DIFFERENT; } else if (subunitMap.keySet().size() == subunits1.size()) { if (subunitMap.values().size() == subunits2.size()) { relation = QsRelation.EQUIVALENT; } else { relation = QsRelation.PARTIAL_COMPLETE; } } else { if (subunitMap.values().size() == subunits2.size()) { relation = QsRelation.PARTIAL_COMPLETE; } else { relation = QsRelation.PARTIAL_INCOMPLETE; } } this.subunitMap = subunitMap; }
[ "public", "void", "setSubunitMap", "(", "Map", "<", "Integer", ",", "Integer", ">", "subunitMap", ")", "{", "// Check consistency of the map", "if", "(", "Collections", ".", "max", "(", "subunitMap", ".", "keySet", "(", ")", ")", ">", "subunits1", ".", "size...
Map of Subunit equivalencies from the first to the second group. @param subunitMap
[ "Map", "of", "Subunit", "equivalencies", "from", "the", "first", "to", "the", "second", "group", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java#L111-L137
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/FieldAccess.java
FieldAccess.isLongOrDouble
protected static boolean isLongOrDouble(FieldInstruction fieldIns, ConstantPoolGen cpg) { Type type = fieldIns.getFieldType(cpg); int code = type.getType(); return code == Const.T_LONG || code == Const.T_DOUBLE; }
java
protected static boolean isLongOrDouble(FieldInstruction fieldIns, ConstantPoolGen cpg) { Type type = fieldIns.getFieldType(cpg); int code = type.getType(); return code == Const.T_LONG || code == Const.T_DOUBLE; }
[ "protected", "static", "boolean", "isLongOrDouble", "(", "FieldInstruction", "fieldIns", ",", "ConstantPoolGen", "cpg", ")", "{", "Type", "type", "=", "fieldIns", ".", "getFieldType", "(", "cpg", ")", ";", "int", "code", "=", "type", ".", "getType", "(", ")"...
Return whether the given FieldInstruction accesses a long or double field. @param fieldIns the FieldInstruction @param cpg the ConstantPoolGen for the method
[ "Return", "whether", "the", "given", "FieldInstruction", "accesses", "a", "long", "or", "double", "field", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/FieldAccess.java#L94-L98
Terracotta-OSS/statistics
src/main/java/org/terracotta/statistics/registry/StatisticRegistry.java
StatisticRegistry.queryStatistic
public <T extends Serializable> Optional<Statistic<T>> queryStatistic(String fullStatisticName) { return queryStatistic(fullStatisticName, 0); }
java
public <T extends Serializable> Optional<Statistic<T>> queryStatistic(String fullStatisticName) { return queryStatistic(fullStatisticName, 0); }
[ "public", "<", "T", "extends", "Serializable", ">", "Optional", "<", "Statistic", "<", "T", ">", ">", "queryStatistic", "(", "String", "fullStatisticName", ")", "{", "return", "queryStatistic", "(", "fullStatisticName", ",", "0", ")", ";", "}" ]
Query a statistic based on the full statistic name. Returns null if not found.
[ "Query", "a", "statistic", "based", "on", "the", "full", "statistic", "name", ".", "Returns", "null", "if", "not", "found", "." ]
train
https://github.com/Terracotta-OSS/statistics/blob/d24e4989b8c8dbe4f5210e49c7945d51b6585881/src/main/java/org/terracotta/statistics/registry/StatisticRegistry.java#L82-L84
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java
MyStringUtils.saveContentMap
public static void saveContentMap(Map<String, String> map, File file) throws IOException { FileWriter out = new FileWriter(file); for (String key : map.keySet()) { if (map.get(key) != null) { out.write(key.replace(":", "#escapedtwodots#") + ":" + map.get(key).replace(":", "#escapedtwodots#") + "\r\n"); } } out.close(); }
java
public static void saveContentMap(Map<String, String> map, File file) throws IOException { FileWriter out = new FileWriter(file); for (String key : map.keySet()) { if (map.get(key) != null) { out.write(key.replace(":", "#escapedtwodots#") + ":" + map.get(key).replace(":", "#escapedtwodots#") + "\r\n"); } } out.close(); }
[ "public", "static", "void", "saveContentMap", "(", "Map", "<", "String", ",", "String", ">", "map", ",", "File", "file", ")", "throws", "IOException", "{", "FileWriter", "out", "=", "new", "FileWriter", "(", "file", ")", ";", "for", "(", "String", "key",...
Save map to file @param map Map to save @param file File to save @throws IOException I/O error
[ "Save", "map", "to", "file" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L820-L830
osglworks/java-tool-ext
src/main/java/org/osgl/util/Token.java
Token.generateToken
@Deprecated public static String generateToken(String secret, String oid, String... payload) { return generateToken(secret, Life.SHORT, oid, payload); }
java
@Deprecated public static String generateToken(String secret, String oid, String... payload) { return generateToken(secret, Life.SHORT, oid, payload); }
[ "@", "Deprecated", "public", "static", "String", "generateToken", "(", "String", "secret", ",", "String", "oid", ",", "String", "...", "payload", ")", "{", "return", "generateToken", "(", "secret", ",", "Life", ".", "SHORT", ",", "oid", ",", "payload", ")"...
This method is deprecated. Please use {@link #generateToken(byte[], String, String...)} instead Generate a token string with secret key, ID and optionally payloads @param secret the secret to encrypt to token string @param oid the ID of the token (could be customer ID etc) @param payload the payload optionally indicate more information @return an encrypted token string that is expiring in {@link Life#SHORT} time period
[ "This", "method", "is", "deprecated", ".", "Please", "use", "{", "@link", "#generateToken", "(", "byte", "[]", "String", "String", "...", ")", "}", "instead" ]
train
https://github.com/osglworks/java-tool-ext/blob/43f034bd0a42e571e437f44aa20487d45248a30b/src/main/java/org/osgl/util/Token.java#L270-L273
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/SessionTokenInterceptor.java
SessionTokenInterceptor.serviceRequest
@Override public void serviceRequest(final Request request) { // Get the expected session token UIContext uic = UIContextHolder.getCurrent(); String expected = uic.getEnvironment().getSessionToken(); // Get the session token from the request String got = request.getParameter(Environment.SESSION_TOKEN_VARIABLE); // Check tokens match (Both null if new session) // or processing a GET and no token if (Util.equals(expected, got) || (got == null && "GET".equals(request.getMethod()))) { // Process request getBackingComponent().serviceRequest(request); } else { // Invalid token String msg; if (expected == null && got != null) { msg = "Session for token [" + got + "] is no longer valid or timed out."; } else { msg = "Wrong session token detected for servlet request. Expected token [" + expected + "] but got token [" + got + "]."; } LOG.error(msg); String message = I18nUtilities.format(uic.getLocale(), InternalMessages.DEFAULT_SESSION_TOKEN_ERROR); throw new SystemException(message); } }
java
@Override public void serviceRequest(final Request request) { // Get the expected session token UIContext uic = UIContextHolder.getCurrent(); String expected = uic.getEnvironment().getSessionToken(); // Get the session token from the request String got = request.getParameter(Environment.SESSION_TOKEN_VARIABLE); // Check tokens match (Both null if new session) // or processing a GET and no token if (Util.equals(expected, got) || (got == null && "GET".equals(request.getMethod()))) { // Process request getBackingComponent().serviceRequest(request); } else { // Invalid token String msg; if (expected == null && got != null) { msg = "Session for token [" + got + "] is no longer valid or timed out."; } else { msg = "Wrong session token detected for servlet request. Expected token [" + expected + "] but got token [" + got + "]."; } LOG.error(msg); String message = I18nUtilities.format(uic.getLocale(), InternalMessages.DEFAULT_SESSION_TOKEN_ERROR); throw new SystemException(message); } }
[ "@", "Override", "public", "void", "serviceRequest", "(", "final", "Request", "request", ")", "{", "// Get the expected session token", "UIContext", "uic", "=", "UIContextHolder", ".", "getCurrent", "(", ")", ";", "String", "expected", "=", "uic", ".", "getEnviron...
Override to check whether the session token variable in the incoming request matches what we expect. @param request the request being serviced.
[ "Override", "to", "check", "whether", "the", "session", "token", "variable", "in", "the", "incoming", "request", "matches", "what", "we", "expect", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/SessionTokenInterceptor.java#L37-L65
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRowRendererRenderer.java
WTableRowRendererRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WTableRowRenderer renderer = (WTableRowRenderer) component; XmlStringBuilder xml = renderContext.getWriter(); WTable table = renderer.getTable(); TableModel dataModel = table.getTableModel(); int[] columnOrder = table.getColumnOrder(); final int numCols = columnOrder == null ? table.getColumnCount() : columnOrder.length; // Get current row details RowIdWrapper wrapper = renderer.getCurrentRowIdWrapper(); List<Integer> rowIndex = wrapper.getRowIndex(); boolean tableSelectable = table.getSelectMode() != SelectMode.NONE; boolean rowSelectable = tableSelectable && dataModel.isSelectable(rowIndex); boolean rowSelected = rowSelectable && table.getSelectedRows().contains(wrapper.getRowKey()); boolean tableExpandable = table.getExpandMode() != WTable.ExpandMode.NONE; boolean rowExpandable = tableExpandable && dataModel.isExpandable(rowIndex) && wrapper. hasChildren(); boolean rowExpanded = rowExpandable && table.getExpandedRows().contains(wrapper.getRowKey()); String rowIndexAsString = TableUtil.rowIndexListToString(rowIndex); xml.appendTagOpen("ui:tr"); xml.appendAttribute("rowIndex", rowIndexAsString); xml.appendOptionalAttribute("unselectable", !rowSelectable, "true"); xml.appendOptionalAttribute("selected", rowSelected, "true"); xml.appendOptionalAttribute("expandable", rowExpandable && !rowExpanded, "true"); xml.appendClose(); // wrote the column cell. boolean isRowHeader = table.isRowHeaders(); // need this before we get into the loop for (int i = 0; i < numCols; i++) { int colIndex = columnOrder == null ? i : columnOrder[i]; WTableColumn col = table.getColumn(colIndex); String cellTag = "ui:td"; if (col.isVisible()) { if (isRowHeader) { // The first rendered column will be the row header. cellTag = "ui:th"; isRowHeader = false; // only set one col as the row header. } xml.appendTag(cellTag); renderer.getRenderer(colIndex).paint(renderContext); xml.appendEndTag(cellTag); } } if (rowExpandable) { xml.appendTagOpen("ui:subtr"); xml.appendOptionalAttribute("open", rowExpanded, "true"); xml.appendClose(); if (rowExpanded || table.getExpandMode() == ExpandMode.CLIENT) { renderChildren(renderer, renderContext, wrapper.getChildren()); } xml.appendEndTag("ui:subtr"); } xml.appendEndTag("ui:tr"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WTableRowRenderer renderer = (WTableRowRenderer) component; XmlStringBuilder xml = renderContext.getWriter(); WTable table = renderer.getTable(); TableModel dataModel = table.getTableModel(); int[] columnOrder = table.getColumnOrder(); final int numCols = columnOrder == null ? table.getColumnCount() : columnOrder.length; // Get current row details RowIdWrapper wrapper = renderer.getCurrentRowIdWrapper(); List<Integer> rowIndex = wrapper.getRowIndex(); boolean tableSelectable = table.getSelectMode() != SelectMode.NONE; boolean rowSelectable = tableSelectable && dataModel.isSelectable(rowIndex); boolean rowSelected = rowSelectable && table.getSelectedRows().contains(wrapper.getRowKey()); boolean tableExpandable = table.getExpandMode() != WTable.ExpandMode.NONE; boolean rowExpandable = tableExpandable && dataModel.isExpandable(rowIndex) && wrapper. hasChildren(); boolean rowExpanded = rowExpandable && table.getExpandedRows().contains(wrapper.getRowKey()); String rowIndexAsString = TableUtil.rowIndexListToString(rowIndex); xml.appendTagOpen("ui:tr"); xml.appendAttribute("rowIndex", rowIndexAsString); xml.appendOptionalAttribute("unselectable", !rowSelectable, "true"); xml.appendOptionalAttribute("selected", rowSelected, "true"); xml.appendOptionalAttribute("expandable", rowExpandable && !rowExpanded, "true"); xml.appendClose(); // wrote the column cell. boolean isRowHeader = table.isRowHeaders(); // need this before we get into the loop for (int i = 0; i < numCols; i++) { int colIndex = columnOrder == null ? i : columnOrder[i]; WTableColumn col = table.getColumn(colIndex); String cellTag = "ui:td"; if (col.isVisible()) { if (isRowHeader) { // The first rendered column will be the row header. cellTag = "ui:th"; isRowHeader = false; // only set one col as the row header. } xml.appendTag(cellTag); renderer.getRenderer(colIndex).paint(renderContext); xml.appendEndTag(cellTag); } } if (rowExpandable) { xml.appendTagOpen("ui:subtr"); xml.appendOptionalAttribute("open", rowExpanded, "true"); xml.appendClose(); if (rowExpanded || table.getExpandMode() == ExpandMode.CLIENT) { renderChildren(renderer, renderContext, wrapper.getChildren()); } xml.appendEndTag("ui:subtr"); } xml.appendEndTag("ui:tr"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WTableRowRenderer", "renderer", "=", "(", "WTableRowRenderer", ")", "component", ";", "XmlStringBuilder", "xml", ...
Paints the given WTableRowRenderer. @param component the WTableRowRenderer to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WTableRowRenderer", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRowRendererRenderer.java#L34-L97
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/io/LruTraceCache.java
LruTraceCache.put
public TraceObject put(TraceObject value) { String key = increment.incrementAndGet() + "- " + DateTimeFormatter.ISO_INSTANT.format(Instant.now()); return put(key, value); }
java
public TraceObject put(TraceObject value) { String key = increment.incrementAndGet() + "- " + DateTimeFormatter.ISO_INSTANT.format(Instant.now()); return put(key, value); }
[ "public", "TraceObject", "put", "(", "TraceObject", "value", ")", "{", "String", "key", "=", "increment", ".", "incrementAndGet", "(", ")", "+", "\"- \"", "+", "DateTimeFormatter", ".", "ISO_INSTANT", ".", "format", "(", "Instant", ".", "now", "(", ")", ")...
Add value to map. @param value value to add @return added value
[ "Add", "value", "to", "map", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/LruTraceCache.java#L78-L82
qiniu/java-sdk
src/main/java/com/qiniu/util/Auth.java
Auth.uploadToken
public String uploadToken(String bucket, String key, long expires, StringMap policy, boolean strict) { long deadline = System.currentTimeMillis() / 1000 + expires; return uploadTokenWithDeadline(bucket, key, deadline, policy, strict); }
java
public String uploadToken(String bucket, String key, long expires, StringMap policy, boolean strict) { long deadline = System.currentTimeMillis() / 1000 + expires; return uploadTokenWithDeadline(bucket, key, deadline, policy, strict); }
[ "public", "String", "uploadToken", "(", "String", "bucket", ",", "String", "key", ",", "long", "expires", ",", "StringMap", "policy", ",", "boolean", "strict", ")", "{", "long", "deadline", "=", "System", ".", "currentTimeMillis", "(", ")", "/", "1000", "+...
生成上传token @param bucket 空间名 @param key key,可为 null @param expires 有效时长,单位秒。默认3600s @param policy 上传策略的其它参数,如 new StringMap().put("endUser", "uid").putNotEmpty("returnBody", "")。 scope通过 bucket、key间接设置,deadline 通过 expires 间接设置 @param strict 是否去除非限定的策略字段,默认true @return 生成的上传token
[ "生成上传token" ]
train
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/util/Auth.java#L247-L250
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONCompare.java
JSONCompare.compareJSON
public static JSONCompareResult compareJSON(JSONObject expected, JSONObject actual, JSONCompareMode mode) throws JSONException { return compareJSON(expected, actual, getComparatorForMode(mode)); }
java
public static JSONCompareResult compareJSON(JSONObject expected, JSONObject actual, JSONCompareMode mode) throws JSONException { return compareJSON(expected, actual, getComparatorForMode(mode)); }
[ "public", "static", "JSONCompareResult", "compareJSON", "(", "JSONObject", "expected", ",", "JSONObject", "actual", ",", "JSONCompareMode", "mode", ")", "throws", "JSONException", "{", "return", "compareJSON", "(", "expected", ",", "actual", ",", "getComparatorForMode...
Compares JSONObject provided to the expected JSONObject, and returns the results of the comparison. @param expected Expected JSONObject @param actual JSONObject to compare @param mode Defines comparison behavior @return result of the comparison @throws JSONException JSON parsing error
[ "Compares", "JSONObject", "provided", "to", "the", "expected", "JSONObject", "and", "returns", "the", "results", "of", "the", "comparison", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONCompare.java#L137-L140
KostyaSha/yet-another-docker-plugin
yet-another-docker-its/src/main/java/com/github/kostyasha/it/rule/DockerRule.java
DockerRule.createCliWithWait
private DockerCLI createCliWithWait(URL url, int port) throws InterruptedException, IOException { DockerCLI tempCli = null; boolean connected = false; int i = 0; while (i <= 10 && !connected) { i++; try { final CLIConnectionFactory factory = new CLIConnectionFactory().url(url); tempCli = new DockerCLI(factory, port); final String channelName = tempCli.getChannel().getName(); if (channelName.contains("CLI connection to")) { tempCli.upgrade(); connected = true; LOG.debug(channelName); } else { LOG.debug("Cli connection is not via CliPort '{}'. Sleeping for 5s...", channelName); tempCli.close(); Thread.sleep(5 * 1000); } } catch (IOException e) { LOG.debug("Jenkins is not available. Sleeping for 5s...", e.getMessage()); Thread.sleep(5 * 1000); } } if (!connected) { throw new IOException("Can't connect to {}" + url.toString()); } LOG.info("Jenkins future {}", url); LOG.info("Jenkins future {}/configure", url); LOG.info("Jenkins future {}/log/all", url); return tempCli; }
java
private DockerCLI createCliWithWait(URL url, int port) throws InterruptedException, IOException { DockerCLI tempCli = null; boolean connected = false; int i = 0; while (i <= 10 && !connected) { i++; try { final CLIConnectionFactory factory = new CLIConnectionFactory().url(url); tempCli = new DockerCLI(factory, port); final String channelName = tempCli.getChannel().getName(); if (channelName.contains("CLI connection to")) { tempCli.upgrade(); connected = true; LOG.debug(channelName); } else { LOG.debug("Cli connection is not via CliPort '{}'. Sleeping for 5s...", channelName); tempCli.close(); Thread.sleep(5 * 1000); } } catch (IOException e) { LOG.debug("Jenkins is not available. Sleeping for 5s...", e.getMessage()); Thread.sleep(5 * 1000); } } if (!connected) { throw new IOException("Can't connect to {}" + url.toString()); } LOG.info("Jenkins future {}", url); LOG.info("Jenkins future {}/configure", url); LOG.info("Jenkins future {}/log/all", url); return tempCli; }
[ "private", "DockerCLI", "createCliWithWait", "(", "URL", "url", ",", "int", "port", ")", "throws", "InterruptedException", ",", "IOException", "{", "DockerCLI", "tempCli", "=", "null", ";", "boolean", "connected", "=", "false", ";", "int", "i", "=", "0", ";"...
Create DockerCLI connection against specified jnlpSlaveAgent port
[ "Create", "DockerCLI", "connection", "against", "specified", "jnlpSlaveAgent", "port" ]
train
https://github.com/KostyaSha/yet-another-docker-plugin/blob/40b12e39ff94c3834cff7e028c3dd01c88e87d77/yet-another-docker-its/src/main/java/com/github/kostyasha/it/rule/DockerRule.java#L568-L601
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CategoryUrl.java
CategoryUrl.updateCategoryUrl
public static MozuUrl updateCategoryUrl(Boolean cascadeVisibility, Integer categoryId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}?cascadeVisibility={cascadeVisibility}&responseFields={responseFields}"); formatter.formatUrl("cascadeVisibility", cascadeVisibility); formatter.formatUrl("categoryId", categoryId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateCategoryUrl(Boolean cascadeVisibility, Integer categoryId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}?cascadeVisibility={cascadeVisibility}&responseFields={responseFields}"); formatter.formatUrl("cascadeVisibility", cascadeVisibility); formatter.formatUrl("categoryId", categoryId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateCategoryUrl", "(", "Boolean", "cascadeVisibility", ",", "Integer", "categoryId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/categories/{categor...
Get Resource Url for UpdateCategory @param cascadeVisibility If true, when changing the display option for the category, change it for all subcategories also. The default value is false. @param categoryId Unique identifier of the category to modify. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateCategory" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CategoryUrl.java#L135-L142
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java
AbstractAsymmetricCrypto.encryptHex
public String encryptHex(String data, KeyType keyType) { return HexUtil.encodeHexStr(encrypt(data, keyType)); }
java
public String encryptHex(String data, KeyType keyType) { return HexUtil.encodeHexStr(encrypt(data, keyType)); }
[ "public", "String", "encryptHex", "(", "String", "data", ",", "KeyType", "keyType", ")", "{", "return", "HexUtil", ".", "encodeHexStr", "(", "encrypt", "(", "data", ",", "keyType", ")", ")", ";", "}" ]
编码为Hex字符串 @param data 被加密的字符串 @param keyType 私钥或公钥 {@link KeyType} @return Hex字符串 @since 4.0.1
[ "编码为Hex字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L112-L114
mapbox/mapbox-java
services-turf/src/main/java/com/mapbox/turf/TurfMeasurement.java
TurfMeasurement.length
public static double length(@NonNull Polygon polygon, @NonNull @TurfConstants.TurfUnitCriteria String units) { double len = 0; for (List<Point> points : polygon.coordinates()) { len += length(points, units); } return len; }
java
public static double length(@NonNull Polygon polygon, @NonNull @TurfConstants.TurfUnitCriteria String units) { double len = 0; for (List<Point> points : polygon.coordinates()) { len += length(points, units); } return len; }
[ "public", "static", "double", "length", "(", "@", "NonNull", "Polygon", "polygon", ",", "@", "NonNull", "@", "TurfConstants", ".", "TurfUnitCriteria", "String", "units", ")", "{", "double", "len", "=", "0", ";", "for", "(", "List", "<", "Point", ">", "po...
Takes a {@link Polygon} and measures its perimeter in the specified units. if the polygon contains holes, the perimeter will also be included. @param polygon geometry to measure @param units one of the units found inside {@link TurfConstants.TurfUnitCriteria} @return total perimeter of the input polygon in the units specified @see <a href="http://turfjs.org/docs/#linedistance">Turf Line Distance documentation</a> @since 1.2.0
[ "Takes", "a", "{", "@link", "Polygon", "}", "and", "measures", "its", "perimeter", "in", "the", "specified", "units", ".", "if", "the", "polygon", "contains", "holes", "the", "perimeter", "will", "also", "be", "included", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-turf/src/main/java/com/mapbox/turf/TurfMeasurement.java#L174-L181
apache/incubator-atlas
webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
EntityREST.getByGuids
@GET @Path("/bulk") @Consumes(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE) public AtlasEntitiesWithExtInfo getByGuids(@QueryParam("guid") List<String> guids) throws AtlasBaseException { AtlasPerfTracer perf = null; try { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.getByGuids(" + guids + ")"); } if (CollectionUtils.isEmpty(guids)) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guids); } return entitiesStore.getByIds(guids); } finally { AtlasPerfTracer.log(perf); } }
java
@GET @Path("/bulk") @Consumes(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE) public AtlasEntitiesWithExtInfo getByGuids(@QueryParam("guid") List<String> guids) throws AtlasBaseException { AtlasPerfTracer perf = null; try { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.getByGuids(" + guids + ")"); } if (CollectionUtils.isEmpty(guids)) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guids); } return entitiesStore.getByIds(guids); } finally { AtlasPerfTracer.log(perf); } }
[ "@", "GET", "@", "Path", "(", "\"/bulk\"", ")", "@", "Consumes", "(", "Servlets", ".", "JSON_MEDIA_TYPE", ")", "@", "Produces", "(", "Servlets", ".", "JSON_MEDIA_TYPE", ")", "public", "AtlasEntitiesWithExtInfo", "getByGuids", "(", "@", "QueryParam", "(", "\"gu...
Bulk API to retrieve list of entities identified by its GUIDs.
[ "Bulk", "API", "to", "retrieve", "list", "of", "entities", "identified", "by", "its", "GUIDs", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java#L413-L433
iipc/webarchive-commons
src/main/java/org/archive/util/zip/GzipHeader.java
GzipHeader.readInt
private int readInt(InputStream in, CRC32 crc) throws IOException { int s = readShort(in, crc); return ((readShort(in, crc) << 16) & 0xffff0000) | s; }
java
private int readInt(InputStream in, CRC32 crc) throws IOException { int s = readShort(in, crc); return ((readShort(in, crc) << 16) & 0xffff0000) | s; }
[ "private", "int", "readInt", "(", "InputStream", "in", ",", "CRC32", "crc", ")", "throws", "IOException", "{", "int", "s", "=", "readShort", "(", "in", ",", "crc", ")", ";", "return", "(", "(", "readShort", "(", "in", ",", "crc", ")", "<<", "16", "...
Read an int. We do not expect to get a -1 reading. If we do, we throw exception. Update the crc as we go. @param in InputStream to read. @param crc CRC to update. @return int read. @throws IOException
[ "Read", "an", "int", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/zip/GzipHeader.java#L213-L216
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_lines_number_dslamPort_GET
public OvhDslamPort serviceName_lines_number_dslamPort_GET(String serviceName, String number) throws IOException { String qPath = "/xdsl/{serviceName}/lines/{number}/dslamPort"; StringBuilder sb = path(qPath, serviceName, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDslamPort.class); }
java
public OvhDslamPort serviceName_lines_number_dslamPort_GET(String serviceName, String number) throws IOException { String qPath = "/xdsl/{serviceName}/lines/{number}/dslamPort"; StringBuilder sb = path(qPath, serviceName, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDslamPort.class); }
[ "public", "OvhDslamPort", "serviceName_lines_number_dslamPort_GET", "(", "String", "serviceName", ",", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/lines/{number}/dslamPort\"", ";", "StringBuilder", "sb", "=", "path",...
Get this object properties REST: GET /xdsl/{serviceName}/lines/{number}/dslamPort @param serviceName [required] The internal name of your XDSL offer @param number [required] The number of the line
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L493-L498
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENsettimeparam
public void ENsettimeparam( TimeParameterCodes code, Long timevalue ) throws EpanetException { int errcode = epanet.ENsettimeparam(code.getCode(), timevalue); checkError(errcode); }
java
public void ENsettimeparam( TimeParameterCodes code, Long timevalue ) throws EpanetException { int errcode = epanet.ENsettimeparam(code.getCode(), timevalue); checkError(errcode); }
[ "public", "void", "ENsettimeparam", "(", "TimeParameterCodes", "code", ",", "Long", "timevalue", ")", "throws", "EpanetException", "{", "int", "errcode", "=", "epanet", ".", "ENsettimeparam", "(", "code", ".", "getCode", "(", ")", ",", "timevalue", ")", ";", ...
Sets the value of a time parameter. @param paramcode the {@link TimeParameterCodes}. @param timevalue value of time parameter in seconds. @throws EpanetException
[ "Sets", "the", "value", "of", "a", "time", "parameter", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L657-L660
alkacon/opencms-core
src/org/opencms/i18n/CmsEncoder.java
CmsEncoder.encodeJavaEntities
public static String encodeJavaEntities(String input, String encoding) { StringBuffer result = new StringBuffer(input.length() * 2); CharBuffer buffer = CharBuffer.wrap(input.toCharArray()); Charset charset = Charset.forName(encoding); CharsetEncoder encoder = charset.newEncoder(); for (int i = 0; i < buffer.length(); i++) { int c = buffer.get(i); if (c < 128) { // first 128 chars are contained in almost every charset result.append((char)c); // this is intended as performance improvement since // the canEncode() operation appears quite CPU heavy } else if (encoder.canEncode((char)c)) { // encoder can encode this char result.append((char)c); } else { // append Java entity reference result.append("\\u"); String hex = Integer.toHexString(c); int pad = 4 - hex.length(); for (int p = 0; p < pad; p++) { result.append('0'); } result.append(hex); } } return result.toString(); }
java
public static String encodeJavaEntities(String input, String encoding) { StringBuffer result = new StringBuffer(input.length() * 2); CharBuffer buffer = CharBuffer.wrap(input.toCharArray()); Charset charset = Charset.forName(encoding); CharsetEncoder encoder = charset.newEncoder(); for (int i = 0; i < buffer.length(); i++) { int c = buffer.get(i); if (c < 128) { // first 128 chars are contained in almost every charset result.append((char)c); // this is intended as performance improvement since // the canEncode() operation appears quite CPU heavy } else if (encoder.canEncode((char)c)) { // encoder can encode this char result.append((char)c); } else { // append Java entity reference result.append("\\u"); String hex = Integer.toHexString(c); int pad = 4 - hex.length(); for (int p = 0; p < pad; p++) { result.append('0'); } result.append(hex); } } return result.toString(); }
[ "public", "static", "String", "encodeJavaEntities", "(", "String", "input", ",", "String", "encoding", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "input", ".", "length", "(", ")", "*", "2", ")", ";", "CharBuffer", "buffer", "=", "...
Encodes all characters that are contained in the String which can not displayed in the given encodings charset with Java escaping like <code>\u20ac</code>.<p> This can be used to escape values used in Java property files.<p> @param input the input to encode for Java @param encoding the charset to encode the result with @return the input with the encoded Java entities
[ "Encodes", "all", "characters", "that", "are", "contained", "in", "the", "String", "which", "can", "not", "displayed", "in", "the", "given", "encodings", "charset", "with", "Java", "escaping", "like", "<code", ">", "\\", "u20ac<", "/", "code", ">", ".", "<...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L468-L496
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java
ExcelUtil.readBySax
public static void readBySax(File file, int sheetIndex, RowHandler rowHandler) { BufferedInputStream in = null; try { in = FileUtil.getInputStream(file); readBySax(in, sheetIndex, rowHandler); } finally { IoUtil.close(in); } }
java
public static void readBySax(File file, int sheetIndex, RowHandler rowHandler) { BufferedInputStream in = null; try { in = FileUtil.getInputStream(file); readBySax(in, sheetIndex, rowHandler); } finally { IoUtil.close(in); } }
[ "public", "static", "void", "readBySax", "(", "File", "file", ",", "int", "sheetIndex", ",", "RowHandler", "rowHandler", ")", "{", "BufferedInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "FileUtil", ".", "getInputStream", "(", "file", ")", ";...
通过Sax方式读取Excel,同时支持03和07格式 @param file Excel文件 @param sheetIndex sheet序号 @param rowHandler 行处理器 @since 3.2.0
[ "通过Sax方式读取Excel,同时支持03和07格式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L53-L61
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/model/BaseDescribeableDrawerItem.java
BaseDescribeableDrawerItem.bindViewHelper
protected void bindViewHelper(BaseViewHolder viewHolder) { Context ctx = viewHolder.itemView.getContext(); //set the identifier from the drawerItem here. It can be used to run tests viewHolder.itemView.setId(hashCode()); //set the item selected if it is viewHolder.itemView.setSelected(isSelected()); //set the item enabled if it is viewHolder.itemView.setEnabled(isEnabled()); //get the correct color for the background int selectedColor = getSelectedColor(ctx); //get the correct color for the text int color = getColor(ctx); ColorStateList selectedTextColor = getTextColorStateList(color, getSelectedTextColor(ctx)); //get the correct color for the icon int iconColor = getIconColor(ctx); int selectedIconColor = getSelectedIconColor(ctx); //set the background for the item themeDrawerItem(ctx, viewHolder.view, selectedColor, isSelectedBackgroundAnimated()); //set the text for the name StringHolder.applyTo(this.getName(), viewHolder.name); //set the text for the description or hide StringHolder.applyToOrHide(this.getDescription(), viewHolder.description); //set the colors for textViews viewHolder.name.setTextColor(selectedTextColor); //set the description text color ColorHolder.applyToOr(getDescriptionTextColor(), viewHolder.description, selectedTextColor); //define the typeface for our textViews if (getTypeface() != null) { viewHolder.name.setTypeface(getTypeface()); viewHolder.description.setTypeface(getTypeface()); } //get the drawables for our icon and set it Drawable icon = ImageHolder.decideIcon(getIcon(), ctx, iconColor, isIconTinted(), 1); if (icon != null) { Drawable selectedIcon = ImageHolder.decideIcon(getSelectedIcon(), ctx, selectedIconColor, isIconTinted(), 1); ImageHolder.applyMultiIconTo(icon, iconColor, selectedIcon, selectedIconColor, isIconTinted(), viewHolder.icon); } else { ImageHolder.applyDecidedIconOrSetGone(getIcon(), viewHolder.icon, iconColor, isIconTinted(), 1); } //for android API 17 --> Padding not applied via xml DrawerUIUtils.setDrawerVerticalPadding(viewHolder.view, level); }
java
protected void bindViewHelper(BaseViewHolder viewHolder) { Context ctx = viewHolder.itemView.getContext(); //set the identifier from the drawerItem here. It can be used to run tests viewHolder.itemView.setId(hashCode()); //set the item selected if it is viewHolder.itemView.setSelected(isSelected()); //set the item enabled if it is viewHolder.itemView.setEnabled(isEnabled()); //get the correct color for the background int selectedColor = getSelectedColor(ctx); //get the correct color for the text int color = getColor(ctx); ColorStateList selectedTextColor = getTextColorStateList(color, getSelectedTextColor(ctx)); //get the correct color for the icon int iconColor = getIconColor(ctx); int selectedIconColor = getSelectedIconColor(ctx); //set the background for the item themeDrawerItem(ctx, viewHolder.view, selectedColor, isSelectedBackgroundAnimated()); //set the text for the name StringHolder.applyTo(this.getName(), viewHolder.name); //set the text for the description or hide StringHolder.applyToOrHide(this.getDescription(), viewHolder.description); //set the colors for textViews viewHolder.name.setTextColor(selectedTextColor); //set the description text color ColorHolder.applyToOr(getDescriptionTextColor(), viewHolder.description, selectedTextColor); //define the typeface for our textViews if (getTypeface() != null) { viewHolder.name.setTypeface(getTypeface()); viewHolder.description.setTypeface(getTypeface()); } //get the drawables for our icon and set it Drawable icon = ImageHolder.decideIcon(getIcon(), ctx, iconColor, isIconTinted(), 1); if (icon != null) { Drawable selectedIcon = ImageHolder.decideIcon(getSelectedIcon(), ctx, selectedIconColor, isIconTinted(), 1); ImageHolder.applyMultiIconTo(icon, iconColor, selectedIcon, selectedIconColor, isIconTinted(), viewHolder.icon); } else { ImageHolder.applyDecidedIconOrSetGone(getIcon(), viewHolder.icon, iconColor, isIconTinted(), 1); } //for android API 17 --> Padding not applied via xml DrawerUIUtils.setDrawerVerticalPadding(viewHolder.view, level); }
[ "protected", "void", "bindViewHelper", "(", "BaseViewHolder", "viewHolder", ")", "{", "Context", "ctx", "=", "viewHolder", ".", "itemView", ".", "getContext", "(", ")", ";", "//set the identifier from the drawerItem here. It can be used to run tests", "viewHolder", ".", "...
a helper method to have the logic for all secondaryDrawerItems only once @param viewHolder
[ "a", "helper", "method", "to", "have", "the", "logic", "for", "all", "secondaryDrawerItems", "only", "once" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/model/BaseDescribeableDrawerItem.java#L58-L108
google/closure-templates
java/src/com/google/template/soy/data/UnsafeSanitizedContentOrdainer.java
UnsafeSanitizedContentOrdainer.ordainAsSafe
public static SanitizedContent ordainAsSafe(String value, ContentKind kind) { return ordainAsSafe(value, kind, kind.getDefaultDir()); }
java
public static SanitizedContent ordainAsSafe(String value, ContentKind kind) { return ordainAsSafe(value, kind, kind.getDefaultDir()); }
[ "public", "static", "SanitizedContent", "ordainAsSafe", "(", "String", "value", ",", "ContentKind", "kind", ")", "{", "return", "ordainAsSafe", "(", "value", ",", "kind", ",", "kind", ".", "getDefaultDir", "(", ")", ")", ";", "}" ]
Faithfully assumes the provided value is "safe" and marks it not to be re-escaped. The value's direction is assumed to be LTR for JS, URI, ATTRIBUTES, and CSS content, and otherwise unknown. <p>When you "ordain" a string as safe content, it means that Soy will NOT re-escape or validate the contents if printed in the relevant context. You can use this to insert known-safe HTML into a template via a parameter. <p>This doesn't do a lot of strict checking, but makes it easier to differentiate safe constants in your code.
[ "Faithfully", "assumes", "the", "provided", "value", "is", "safe", "and", "marks", "it", "not", "to", "be", "re", "-", "escaped", ".", "The", "value", "s", "direction", "is", "assumed", "to", "be", "LTR", "for", "JS", "URI", "ATTRIBUTES", "and", "CSS", ...
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/UnsafeSanitizedContentOrdainer.java#L60-L62
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/split/ST_LineIntersector.java
ST_LineIntersector.addGeometryToSegments
public static void addGeometryToSegments(Geometry geometry, int flag, ArrayList<SegmentString> segments) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry component = geometry.getGeometryN(i); if (component instanceof Polygon) { add((Polygon) component, flag, segments); } else if (component instanceof LineString) { add((LineString) component, flag, segments); } } }
java
public static void addGeometryToSegments(Geometry geometry, int flag, ArrayList<SegmentString> segments) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry component = geometry.getGeometryN(i); if (component instanceof Polygon) { add((Polygon) component, flag, segments); } else if (component instanceof LineString) { add((LineString) component, flag, segments); } } }
[ "public", "static", "void", "addGeometryToSegments", "(", "Geometry", "geometry", ",", "int", "flag", ",", "ArrayList", "<", "SegmentString", ">", "segments", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "geometry", ".", "getNumGeometries", "...
Convert the a geometry as a list of segments and mark it with a flag @param geometry @param flag @param segments
[ "Convert", "the", "a", "geometry", "as", "a", "list", "of", "segments", "and", "mark", "it", "with", "a", "flag" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/split/ST_LineIntersector.java#L114-L123
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java
BigtableInstanceAdminClient.resizeCluster
@SuppressWarnings("WeakerAccess") public Cluster resizeCluster(String instanceId, String clusterId, int numServeNodes) { return ApiExceptions.callAndTranslateApiException( resizeClusterAsync(instanceId, clusterId, numServeNodes)); }
java
@SuppressWarnings("WeakerAccess") public Cluster resizeCluster(String instanceId, String clusterId, int numServeNodes) { return ApiExceptions.callAndTranslateApiException( resizeClusterAsync(instanceId, clusterId, numServeNodes)); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "Cluster", "resizeCluster", "(", "String", "instanceId", ",", "String", "clusterId", ",", "int", "numServeNodes", ")", "{", "return", "ApiExceptions", ".", "callAndTranslateApiException", "(", "resizeClu...
Resizes the cluster's node count. Please note that only clusters that belong to a PRODUCTION instance can be resized. <p>Sample code: <pre>{@code Cluster cluster = client.resizeCluster("my-instance", "my-cluster", 30); }</pre>
[ "Resizes", "the", "cluster", "s", "node", "count", ".", "Please", "note", "that", "only", "clusters", "that", "belong", "to", "a", "PRODUCTION", "instance", "can", "be", "resized", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java#L703-L707
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java
JsJmsMapMessageImpl.setByte
public void setByte(String name, byte value) throws UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setByte", Byte.valueOf(value)); getBodyMap().put(name, Byte.valueOf(value)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setByte"); }
java
public void setByte(String name, byte value) throws UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setByte", Byte.valueOf(value)); getBodyMap().put(name, Byte.valueOf(value)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setByte"); }
[ "public", "void", "setByte", "(", "String", "name", ",", "byte", "value", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "...
/* Set a byte value with the given name, into the Map. Javadoc description supplied by JsJmsMessage interface.
[ "/", "*", "Set", "a", "byte", "value", "with", "the", "given", "name", "into", "the", "Map", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java#L282-L286
Red5/red5-server-common
src/main/java/org/red5/server/stream/StreamService.java
StreamService.sendNSFailed
private void sendNSFailed(IConnection conn, String errorCode, String description, String name, Number streamId) { StreamService.sendNetStreamStatus(conn, errorCode, description, name, Status.ERROR, streamId); }
java
private void sendNSFailed(IConnection conn, String errorCode, String description, String name, Number streamId) { StreamService.sendNetStreamStatus(conn, errorCode, description, name, Status.ERROR, streamId); }
[ "private", "void", "sendNSFailed", "(", "IConnection", "conn", ",", "String", "errorCode", ",", "String", "description", ",", "String", "name", ",", "Number", "streamId", ")", "{", "StreamService", ".", "sendNetStreamStatus", "(", "conn", ",", "errorCode", ",", ...
Send NetStream.Play.Failed to the client. @param conn @param errorCode @param description @param name @param streamId
[ "Send", "NetStream", ".", "Play", ".", "Failed", "to", "the", "client", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/StreamService.java#L800-L802
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.input_engine_engineId_GET
public OvhEngine input_engine_engineId_GET(String engineId) throws IOException { String qPath = "/dbaas/logs/input/engine/{engineId}"; StringBuilder sb = path(qPath, engineId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhEngine.class); }
java
public OvhEngine input_engine_engineId_GET(String engineId) throws IOException { String qPath = "/dbaas/logs/input/engine/{engineId}"; StringBuilder sb = path(qPath, engineId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhEngine.class); }
[ "public", "OvhEngine", "input_engine_engineId_GET", "(", "String", "engineId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/input/engine/{engineId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "engineId", ")", ";", "St...
Returns details of specified input engine REST: GET /dbaas/logs/input/engine/{engineId} @param engineId [required] Engine ID
[ "Returns", "details", "of", "specified", "input", "engine" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L90-L95
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java
BasicBondGenerator.getWidthForBond
public double getWidthForBond(IBond bond, RendererModel model) { double scale = model.getParameter(Scale.class).getValue(); if (this.overrideBondWidth != -1) { return this.overrideBondWidth / scale; } else { return model.getParameter(BondWidth.class).getValue() / scale; } }
java
public double getWidthForBond(IBond bond, RendererModel model) { double scale = model.getParameter(Scale.class).getValue(); if (this.overrideBondWidth != -1) { return this.overrideBondWidth / scale; } else { return model.getParameter(BondWidth.class).getValue() / scale; } }
[ "public", "double", "getWidthForBond", "(", "IBond", "bond", ",", "RendererModel", "model", ")", "{", "double", "scale", "=", "model", ".", "getParameter", "(", "Scale", ".", "class", ")", ".", "getValue", "(", ")", ";", "if", "(", "this", ".", "override...
Determine the width of a bond, returning either the width defined in the model, or the override width. Note that this will be scaled to the space of the model. @param bond the bond to determine the width for @param model the renderer model @return a double in chem-model space
[ "Determine", "the", "width", "of", "a", "bond", "returning", "either", "the", "width", "defined", "in", "the", "model", "or", "the", "override", "width", ".", "Note", "that", "this", "will", "be", "scaled", "to", "the", "space", "of", "the", "model", "."...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java#L245-L252