repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.updateWorkerPoolAsync
public Observable<WorkerPoolResourceInner> updateWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) { return updateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() { @Override public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) { return response.body(); } }); }
java
public Observable<WorkerPoolResourceInner> updateWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) { return updateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() { @Override public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkerPoolResourceInner", ">", "updateWorkerPoolAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "workerPoolName", ",", "WorkerPoolResourceInner", "workerPoolEnvelope", ")", "{", "return", "updateWorkerPoolWithS...
Create or update a worker pool. Create or update a worker pool. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @param workerPoolEnvelope Properties of the worker pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkerPoolResourceInner object
[ "Create", "or", "update", "a", "worker", "pool", ".", "Create", "or", "update", "a", "worker", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5418-L5425
aicer/hibiscus-http-client
src/main/java/org/aicer/hibiscus/http/client/HttpClient.java
HttpClient.addNameValuePair
public final HttpClient addNameValuePair(final String param, final String value) { nameValuePairs.add(new BasicNameValuePair(param, value)); return this; }
java
public final HttpClient addNameValuePair(final String param, final String value) { nameValuePairs.add(new BasicNameValuePair(param, value)); return this; }
[ "public", "final", "HttpClient", "addNameValuePair", "(", "final", "String", "param", ",", "final", "String", "value", ")", "{", "nameValuePairs", ".", "add", "(", "new", "BasicNameValuePair", "(", "param", ",", "value", ")", ")", ";", "return", "this", ";",...
Used by Entity-Enclosing HTTP Requests to send Name-Value pairs in the body of the request @param param Name of Parameter @param value Value of Parameter @return
[ "Used", "by", "Entity", "-", "Enclosing", "HTTP", "Requests", "to", "send", "Name", "-", "Value", "pairs", "in", "the", "body", "of", "the", "request" ]
train
https://github.com/aicer/hibiscus-http-client/blob/a037e3cf8d4bb862d38a55a090778736a48d67cc/src/main/java/org/aicer/hibiscus/http/client/HttpClient.java#L257-L260
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/ui/CmsAttributeValueView.java
CmsAttributeValueView.setValueWidget
public void setValueWidget(I_CmsFormEditWidget widget, String value, String defaultValue, boolean active) { if (m_hasValue) { throw new RuntimeException("Value has already been set"); } m_defaultValue = defaultValue; m_hasValue = true; m_isSimpleValue = true; m_widget = widget; if (CmsAttributeHandler.hasResizeHandler() && (m_widget instanceof HasResizeHandlers)) { ((HasResizeHandlers)m_widget).addResizeHandler(CmsAttributeHandler.getResizeHandler()); } m_widgetHolder.clear(); m_widget.setWidgetInfo(m_label, m_help); if (active) { m_widget.setValue(value, false); } else { m_widget.setValue(""); } m_widgetHolder.add(m_widget); m_widget.setName(getHandler().getAttributeName()); m_widget.addValueChangeHandler(new ChangeHandler()); m_widget.addFocusHandler(new FocusHandler() { public void onFocus(FocusEvent event) { CmsValueFocusHandler.getInstance().setFocus(CmsAttributeValueView.this); activateWidget(); } }); m_widget.setActive(active); if (!active) { addActivationHandler(); } else { removeStyleName(formCss().emptyValue()); } addStyleName(formCss().simpleValue()); if (m_widget instanceof CmsFormWidgetWrapper) { addLabelHoverHandler(((CmsFormWidgetWrapper)m_widget).getLabel()); } else { removeLabelHoverHandler(); } }
java
public void setValueWidget(I_CmsFormEditWidget widget, String value, String defaultValue, boolean active) { if (m_hasValue) { throw new RuntimeException("Value has already been set"); } m_defaultValue = defaultValue; m_hasValue = true; m_isSimpleValue = true; m_widget = widget; if (CmsAttributeHandler.hasResizeHandler() && (m_widget instanceof HasResizeHandlers)) { ((HasResizeHandlers)m_widget).addResizeHandler(CmsAttributeHandler.getResizeHandler()); } m_widgetHolder.clear(); m_widget.setWidgetInfo(m_label, m_help); if (active) { m_widget.setValue(value, false); } else { m_widget.setValue(""); } m_widgetHolder.add(m_widget); m_widget.setName(getHandler().getAttributeName()); m_widget.addValueChangeHandler(new ChangeHandler()); m_widget.addFocusHandler(new FocusHandler() { public void onFocus(FocusEvent event) { CmsValueFocusHandler.getInstance().setFocus(CmsAttributeValueView.this); activateWidget(); } }); m_widget.setActive(active); if (!active) { addActivationHandler(); } else { removeStyleName(formCss().emptyValue()); } addStyleName(formCss().simpleValue()); if (m_widget instanceof CmsFormWidgetWrapper) { addLabelHoverHandler(((CmsFormWidgetWrapper)m_widget).getLabel()); } else { removeLabelHoverHandler(); } }
[ "public", "void", "setValueWidget", "(", "I_CmsFormEditWidget", "widget", ",", "String", "value", ",", "String", "defaultValue", ",", "boolean", "active", ")", "{", "if", "(", "m_hasValue", ")", "{", "throw", "new", "RuntimeException", "(", "\"Value has already be...
Sets the value widget.<p> @param widget the widget @param value the value @param defaultValue the default attribute value @param active <code>true</code> if the widget should be activated
[ "Sets", "the", "value", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/ui/CmsAttributeValueView.java#L760-L803
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/internal/configuration/Connection.java
Connection.intValue
private int intValue(@Nullable Object object, int defaultValue) { if (object instanceof Number) { return ((Number) object).intValue(); } if (object instanceof String) { return Integer.parseInt((String) object, 10); } return defaultValue; }
java
private int intValue(@Nullable Object object, int defaultValue) { if (object instanceof Number) { return ((Number) object).intValue(); } if (object instanceof String) { return Integer.parseInt((String) object, 10); } return defaultValue; }
[ "private", "int", "intValue", "(", "@", "Nullable", "Object", "object", ",", "int", "defaultValue", ")", "{", "if", "(", "object", "instanceof", "Number", ")", "{", "return", "(", "(", "Number", ")", "object", ")", ".", "intValue", "(", ")", ";", "}", ...
Will try to get the int value of a given object. If the value cannot be obtained, it will return the default value. @param object to get an int from. @param defaultValue to return if the int value cannot be obtained. @return the int value of the object or the default value if it cannot be obtained.
[ "Will", "try", "to", "get", "the", "int", "value", "of", "a", "given", "object", ".", "If", "the", "value", "cannot", "be", "obtained", "it", "will", "return", "the", "default", "value", "." ]
train
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/internal/configuration/Connection.java#L210-L218
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.curveTo1
public void curveTo1 (final float x1, final float y1, final float x3, final float y3) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: curveTo1 is not allowed within a text block."); } writeOperand (x1); writeOperand (y1); writeOperand (x3); writeOperand (y3); writeOperator ((byte) 'y'); }
java
public void curveTo1 (final float x1, final float y1, final float x3, final float y3) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: curveTo1 is not allowed within a text block."); } writeOperand (x1); writeOperand (y1); writeOperand (x3); writeOperand (y3); writeOperator ((byte) 'y'); }
[ "public", "void", "curveTo1", "(", "final", "float", "x1", ",", "final", "float", "y1", ",", "final", "float", "x3", ",", "final", "float", "y3", ")", "throws", "IOException", "{", "if", "(", "inTextMode", ")", "{", "throw", "new", "IllegalStateException",...
Append a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bézier control points. @param x1 x coordinate of the point 1 @param y1 y coordinate of the point 1 @param x3 x coordinate of the point 3 @param y3 y coordinate of the point 3 @throws IOException If the content stream could not be written. @throws IllegalStateException If the method was called within a text block.
[ "Append", "a", "cubic", "Bézier", "curve", "to", "the", "current", "path", ".", "The", "curve", "extends", "from", "the", "current", "point", "to", "the", "point", "(", "x3", "y3", ")", "using", "(", "x1", "y1", ")", "and", "(", "x3", "y3", ")", "a...
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1197-L1208
gitblit/fathom
fathom-xmlrpc/src/main/java/fathom/xmlrpc/XmlRpcMethodRegistrar.java
XmlRpcMethodRegistrar.addDefaultMethodGroup
public void addDefaultMethodGroup(Class<?> methodGroupClass) { Object methodsObject = injector.getInstance(methodGroupClass); methodGroups.put(defaultMethods, new XmlRpcMethodInvoker("", methodGroupClass, methodsObject)); }
java
public void addDefaultMethodGroup(Class<?> methodGroupClass) { Object methodsObject = injector.getInstance(methodGroupClass); methodGroups.put(defaultMethods, new XmlRpcMethodInvoker("", methodGroupClass, methodsObject)); }
[ "public", "void", "addDefaultMethodGroup", "(", "Class", "<", "?", ">", "methodGroupClass", ")", "{", "Object", "methodsObject", "=", "injector", ".", "getInstance", "(", "methodGroupClass", ")", ";", "methodGroups", ".", "put", "(", "defaultMethods", ",", "new"...
Add @XmlRpc methods from this class to the default method handler. @param methodGroupClass
[ "Add", "@XmlRpc", "methods", "from", "this", "class", "to", "the", "default", "method", "handler", "." ]
train
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-xmlrpc/src/main/java/fathom/xmlrpc/XmlRpcMethodRegistrar.java#L50-L53
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java
GenericGenerators.ifObjectsEqual
public static InsnList ifObjectsEqual(InsnList lhs, InsnList rhs, InsnList action) { Validate.notNull(lhs); Validate.notNull(rhs); Validate.notNull(action); InsnList ret = new InsnList(); LabelNode notEqualLabelNode = new LabelNode(); ret.add(lhs); ret.add(rhs); ret.add(new JumpInsnNode(Opcodes.IF_ACMPNE, notEqualLabelNode)); ret.add(action); ret.add(notEqualLabelNode); return ret; }
java
public static InsnList ifObjectsEqual(InsnList lhs, InsnList rhs, InsnList action) { Validate.notNull(lhs); Validate.notNull(rhs); Validate.notNull(action); InsnList ret = new InsnList(); LabelNode notEqualLabelNode = new LabelNode(); ret.add(lhs); ret.add(rhs); ret.add(new JumpInsnNode(Opcodes.IF_ACMPNE, notEqualLabelNode)); ret.add(action); ret.add(notEqualLabelNode); return ret; }
[ "public", "static", "InsnList", "ifObjectsEqual", "(", "InsnList", "lhs", ",", "InsnList", "rhs", ",", "InsnList", "action", ")", "{", "Validate", ".", "notNull", "(", "lhs", ")", ";", "Validate", ".", "notNull", "(", "rhs", ")", ";", "Validate", ".", "n...
Compares two objects and performs some action if the objects are the same (uses == to check if same, not the equals method). @param lhs left hand side instruction list -- must leave an object on the stack @param rhs right hand side instruction list -- must leave an object on the stack @param action action to perform if results of {@code lhs} and {@code rhs} are equal @return instructions instruction list to perform some action if two objects are equal @throws NullPointerException if any argument is {@code null}
[ "Compares", "two", "objects", "and", "performs", "some", "action", "if", "the", "objects", "are", "the", "same", "(", "uses", "==", "to", "check", "if", "same", "not", "the", "equals", "method", ")", "." ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L648-L665
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/OsgiPropertyUtils.java
OsgiPropertyUtils.getProperty
public static String getProperty(String propertyName, String defaultValue) { String value = get(propertyName); return value == null ? defaultValue : value; }
java
public static String getProperty(String propertyName, String defaultValue) { String value = get(propertyName); return value == null ? defaultValue : value; }
[ "public", "static", "String", "getProperty", "(", "String", "propertyName", ",", "String", "defaultValue", ")", "{", "String", "value", "=", "get", "(", "propertyName", ")", ";", "return", "value", "==", "null", "?", "defaultValue", ":", "value", ";", "}" ]
Retrieve the value of the specified property from framework/system properties. @param propertyName Name of property @param defaultValue Default value to return if property is not set @return Property or default value as a String
[ "Retrieve", "the", "value", "of", "the", "specified", "property", "from", "framework", "/", "system", "properties", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/OsgiPropertyUtils.java#L84-L87
pravega/pravega
controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java
TransactionMetrics.commitTransactionFailed
public void commitTransactionFailed(String scope, String streamName, String txnId) { DYNAMIC_LOGGER.incCounterValue(globalMetricName(COMMIT_TRANSACTION_FAILED), 1); DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION_FAILED, 1, streamTags(scope, streamName)); DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION_FAILED, 1, transactionTags(scope, streamName, txnId)); }
java
public void commitTransactionFailed(String scope, String streamName, String txnId) { DYNAMIC_LOGGER.incCounterValue(globalMetricName(COMMIT_TRANSACTION_FAILED), 1); DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION_FAILED, 1, streamTags(scope, streamName)); DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION_FAILED, 1, transactionTags(scope, streamName, txnId)); }
[ "public", "void", "commitTransactionFailed", "(", "String", "scope", ",", "String", "streamName", ",", "String", "txnId", ")", "{", "DYNAMIC_LOGGER", ".", "incCounterValue", "(", "globalMetricName", "(", "COMMIT_TRANSACTION_FAILED", ")", ",", "1", ")", ";", "DYNAM...
This method increments the global, Stream-related and Transaction-related counters of failed commit operations. @param scope Scope. @param streamName Name of the Stream. @param txnId Transaction id.
[ "This", "method", "increments", "the", "global", "Stream", "-", "related", "and", "Transaction", "-", "related", "counters", "of", "failed", "commit", "operations", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L84-L88
PureSolTechnologies/parsers
parsers/src/main/java/com/puresoltechnologies/parsers/parser/packrat/PackratMemo.java
PackratMemo.getMemo
MemoEntry getMemo(String production, int position) { Map<String, MemoEntry> map = memo.get(position); if (map == null) return null; MemoEntry memo = map.get(production); if (memo == null) return null; return memo; }
java
MemoEntry getMemo(String production, int position) { Map<String, MemoEntry> map = memo.get(position); if (map == null) return null; MemoEntry memo = map.get(production); if (memo == null) return null; return memo; }
[ "MemoEntry", "getMemo", "(", "String", "production", ",", "int", "position", ")", "{", "Map", "<", "String", ",", "MemoEntry", ">", "map", "=", "memo", ".", "get", "(", "position", ")", ";", "if", "(", "map", "==", "null", ")", "return", "null", ";",...
This method returns the current memoization element from the buffer. This element is unprocessed. If the element is not set (null) a NONE element is put into the buffer and returned. @param production @param position @return
[ "This", "method", "returns", "the", "current", "memoization", "element", "from", "the", "buffer", ".", "This", "element", "is", "unprocessed", ".", "If", "the", "element", "is", "not", "set", "(", "null", ")", "a", "NONE", "element", "is", "put", "into", ...
train
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/parser/packrat/PackratMemo.java#L39-L47
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java
CheckClassAdapter.checkFormalTypeParameter
private static int checkFormalTypeParameter(final String signature, int pos) { // FormalTypeParameter: // Identifier : FieldTypeSignature? (: FieldTypeSignature)* pos = checkIdentifier(signature, pos); pos = checkChar(':', signature, pos); if ("L[T".indexOf(getChar(signature, pos)) != -1) { pos = checkFieldTypeSignature(signature, pos); } while (getChar(signature, pos) == ':') { pos = checkFieldTypeSignature(signature, pos + 1); } return pos; }
java
private static int checkFormalTypeParameter(final String signature, int pos) { // FormalTypeParameter: // Identifier : FieldTypeSignature? (: FieldTypeSignature)* pos = checkIdentifier(signature, pos); pos = checkChar(':', signature, pos); if ("L[T".indexOf(getChar(signature, pos)) != -1) { pos = checkFieldTypeSignature(signature, pos); } while (getChar(signature, pos) == ':') { pos = checkFieldTypeSignature(signature, pos + 1); } return pos; }
[ "private", "static", "int", "checkFormalTypeParameter", "(", "final", "String", "signature", ",", "int", "pos", ")", "{", "// FormalTypeParameter:", "// Identifier : FieldTypeSignature? (: FieldTypeSignature)*", "pos", "=", "checkIdentifier", "(", "signature", ",", "pos", ...
Checks a formal type parameter of a class or method signature. @param signature a string containing the signature that must be checked. @param pos index of first character to be checked. @return the index of the first character after the checked part.
[ "Checks", "a", "formal", "type", "parameter", "of", "a", "class", "or", "method", "signature", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L796-L809
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/dialogs/DirectorySelectionPanel.java
DirectorySelectionPanel.getButtonCancel
protected final JButton getButtonCancel() { if (buttonCancel == null) { buttonCancel = new JButton(); buttonCancel.setText("Cancel"); buttonCancel.setPreferredSize(new Dimension(80, 26)); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { if (destDirSelector != null) { destDirSelector.cancel(); } } }); } return buttonCancel; }
java
protected final JButton getButtonCancel() { if (buttonCancel == null) { buttonCancel = new JButton(); buttonCancel.setText("Cancel"); buttonCancel.setPreferredSize(new Dimension(80, 26)); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { if (destDirSelector != null) { destDirSelector.cancel(); } } }); } return buttonCancel; }
[ "protected", "final", "JButton", "getButtonCancel", "(", ")", "{", "if", "(", "buttonCancel", "==", "null", ")", "{", "buttonCancel", "=", "new", "JButton", "(", ")", ";", "buttonCancel", ".", "setText", "(", "\"Cancel\"", ")", ";", "buttonCancel", ".", "s...
Returns the 'Cancel' button for usage as default button. @return Button.
[ "Returns", "the", "Cancel", "button", "for", "usage", "as", "default", "button", "." ]
train
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/dialogs/DirectorySelectionPanel.java#L174-L188
Netflix/conductor
core/src/main/java/com/netflix/conductor/service/TaskServiceImpl.java
TaskServiceImpl.ackTaskReceived
@Service public String ackTaskReceived(String taskId, String workerId) { LOGGER.debug("Ack received for task: {} from worker: {}", taskId, workerId); return String.valueOf(ackTaskReceived(taskId)); }
java
@Service public String ackTaskReceived(String taskId, String workerId) { LOGGER.debug("Ack received for task: {} from worker: {}", taskId, workerId); return String.valueOf(ackTaskReceived(taskId)); }
[ "@", "Service", "public", "String", "ackTaskReceived", "(", "String", "taskId", ",", "String", "workerId", ")", "{", "LOGGER", ".", "debug", "(", "\"Ack received for task: {} from worker: {}\"", ",", "taskId", ",", "workerId", ")", ";", "return", "String", ".", ...
Ack Task is received. @param taskId Id of the task @param workerId Id of the worker @return `true|false` if task if received or not
[ "Ack", "Task", "is", "received", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/service/TaskServiceImpl.java#L147-L151
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/factories/SecretKeyFactoryExtensions.java
SecretKeyFactoryExtensions.newSecretKeySpec
public static SecretKeySpec newSecretKeySpec(final byte[] secretKey, final String algorithm) throws NoSuchAlgorithmException { final SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey, algorithm); return secretKeySpec; }
java
public static SecretKeySpec newSecretKeySpec(final byte[] secretKey, final String algorithm) throws NoSuchAlgorithmException { final SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey, algorithm); return secretKeySpec; }
[ "public", "static", "SecretKeySpec", "newSecretKeySpec", "(", "final", "byte", "[", "]", "secretKey", ",", "final", "String", "algorithm", ")", "throws", "NoSuchAlgorithmException", "{", "final", "SecretKeySpec", "secretKeySpec", "=", "new", "SecretKeySpec", "(", "s...
Factory method for creating a new {@link SecretKeySpec} from the given algorithm and the given secret key as byte array. @param algorithm the algorithm @param secretKey the secret key @return the new {@link SecretKeySpec} from the given algorithm and the given secret key. @throws NoSuchAlgorithmException the no such algorithm exception
[ "Factory", "method", "for", "creating", "a", "new", "{", "@link", "SecretKeySpec", "}", "from", "the", "given", "algorithm", "and", "the", "given", "secret", "key", "as", "byte", "array", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/factories/SecretKeyFactoryExtensions.java#L96-L101
jbundle/jbundle
app/program/project/src/main/java/org/jbundle/app/program/project/report/ProjectReportScreen.java
ProjectReportScreen.getCurrentLevelInfo
public Record getCurrentLevelInfo(int iOffsetFromCurrentLevel, Record record) { int dLevel = (int)this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).getValue(); dLevel = dLevel + iOffsetFromCurrentLevel; this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).setValue(dLevel); if (m_rgCurrentLevelInfo.size() >= dLevel) { try { m_rgCurrentLevelInfo.add((Record)record.clone()); m_rgCurrentLevelInfo.elementAt(dLevel).setKeyArea(ProjectTask.PARENT_PROJECT_TASK_ID_KEY); } catch (CloneNotSupportedException ex) { ex.printStackTrace(); } } return m_rgCurrentLevelInfo.elementAt(dLevel); }
java
public Record getCurrentLevelInfo(int iOffsetFromCurrentLevel, Record record) { int dLevel = (int)this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).getValue(); dLevel = dLevel + iOffsetFromCurrentLevel; this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).setValue(dLevel); if (m_rgCurrentLevelInfo.size() >= dLevel) { try { m_rgCurrentLevelInfo.add((Record)record.clone()); m_rgCurrentLevelInfo.elementAt(dLevel).setKeyArea(ProjectTask.PARENT_PROJECT_TASK_ID_KEY); } catch (CloneNotSupportedException ex) { ex.printStackTrace(); } } return m_rgCurrentLevelInfo.elementAt(dLevel); }
[ "public", "Record", "getCurrentLevelInfo", "(", "int", "iOffsetFromCurrentLevel", ",", "Record", "record", ")", "{", "int", "dLevel", "=", "(", "int", ")", "this", ".", "getScreenRecord", "(", ")", ".", "getField", "(", "ProjectTaskScreenRecord", ".", "CURRENT_L...
Add to the current level, then get the record at this level If the record doesn't exist, clone a new one and return it. @param record The main record (that I will clone if I need to) @param iOffsetFromCurrentLevel The amount to bump the level @return The record at this (new) level.
[ "Add", "to", "the", "current", "level", "then", "get", "the", "record", "at", "this", "level", "If", "the", "record", "doesn", "t", "exist", "clone", "a", "new", "one", "and", "return", "it", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/report/ProjectReportScreen.java#L164-L179
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/Sessions.java
Sessions.sessionHeartbeat
public void sessionHeartbeat(long sessionId) { synchronized (mSessions) { if (mSessions.containsKey(sessionId)) { mSessions.get(sessionId).heartbeat(); } else { int sessionTimeoutMs = (int) ServerConfiguration .getMs(PropertyKey.WORKER_SESSION_TIMEOUT_MS); mSessions.put(sessionId, new SessionInfo(sessionId, sessionTimeoutMs)); } } }
java
public void sessionHeartbeat(long sessionId) { synchronized (mSessions) { if (mSessions.containsKey(sessionId)) { mSessions.get(sessionId).heartbeat(); } else { int sessionTimeoutMs = (int) ServerConfiguration .getMs(PropertyKey.WORKER_SESSION_TIMEOUT_MS); mSessions.put(sessionId, new SessionInfo(sessionId, sessionTimeoutMs)); } } }
[ "public", "void", "sessionHeartbeat", "(", "long", "sessionId", ")", "{", "synchronized", "(", "mSessions", ")", "{", "if", "(", "mSessions", ".", "containsKey", "(", "sessionId", ")", ")", "{", "mSessions", ".", "get", "(", "sessionId", ")", ".", "heartbe...
Performs session heartbeat. @param sessionId the id of the session
[ "Performs", "session", "heartbeat", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/Sessions.java#L90-L100
sebastiangraf/jSCSI
bundles/commons/src/main/java/org/jscsi/parser/login/ISID.java
ISID.createRandom
public static final ISID createRandom (final long seed) { // TODO: Implement Qualifier final Random rand = new Random(seed); final ISID isid = new ISID(Format.RANDOM, Constants.RESERVED_BYTE, (short) rand.nextInt(), (byte) rand.nextInt(), (short) 0); return isid; }
java
public static final ISID createRandom (final long seed) { // TODO: Implement Qualifier final Random rand = new Random(seed); final ISID isid = new ISID(Format.RANDOM, Constants.RESERVED_BYTE, (short) rand.nextInt(), (byte) rand.nextInt(), (short) 0); return isid; }
[ "public", "static", "final", "ISID", "createRandom", "(", "final", "long", "seed", ")", "{", "// TODO: Implement Qualifier", "final", "Random", "rand", "=", "new", "Random", "(", "seed", ")", ";", "final", "ISID", "isid", "=", "new", "ISID", "(", "Format", ...
This method creates an Initiator Session ID of the <code>Random</code> format defined in the iSCSI Standard (RFC3720). @param seed The initialization seed for random generator. @return A instance of an <code>ISID</code>.
[ "This", "method", "creates", "an", "Initiator", "Session", "ID", "of", "the", "<code", ">", "Random<", "/", "code", ">", "format", "defined", "in", "the", "iSCSI", "Standard", "(", "RFC3720", ")", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/commons/src/main/java/org/jscsi/parser/login/ISID.java#L273-L281
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java
BasicBondGenerator.getColorForBond
public Color getColorForBond(IBond bond, RendererModel model) { if (this.overrideColor != null) { return overrideColor; } Color color = model.getParameter(ColorHash.class).getValue().get(bond); if (color == null) { return model.getParameter(DefaultBondColor.class).getValue(); } else { return color; } }
java
public Color getColorForBond(IBond bond, RendererModel model) { if (this.overrideColor != null) { return overrideColor; } Color color = model.getParameter(ColorHash.class).getValue().get(bond); if (color == null) { return model.getParameter(DefaultBondColor.class).getValue(); } else { return color; } }
[ "public", "Color", "getColorForBond", "(", "IBond", "bond", ",", "RendererModel", "model", ")", "{", "if", "(", "this", ".", "overrideColor", "!=", "null", ")", "{", "return", "overrideColor", ";", "}", "Color", "color", "=", "model", ".", "getParameter", ...
Determine the color of a bond, returning either the default color, the override color or whatever is in the color hash for that bond. @param bond the bond we are generating an element for @param model the rendering model @return the color to paint the bond
[ "Determine", "the", "color", "of", "a", "bond", "returning", "either", "the", "default", "color", "the", "override", "color", "or", "whatever", "is", "in", "the", "color", "hash", "for", "that", "bond", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java#L223-L234
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/Messages.java
Messages.createMessage
public final String createMessage(String msgKey, Object args[]) { if (m_resourceBundle == null) m_resourceBundle = loadResourceBundle(m_resourceBundleName); if (m_resourceBundle != null) { return createMsg(m_resourceBundle, msgKey, args); } else return "Could not load the resource bundles: "+ m_resourceBundleName; }
java
public final String createMessage(String msgKey, Object args[]) { if (m_resourceBundle == null) m_resourceBundle = loadResourceBundle(m_resourceBundleName); if (m_resourceBundle != null) { return createMsg(m_resourceBundle, msgKey, args); } else return "Could not load the resource bundles: "+ m_resourceBundleName; }
[ "public", "final", "String", "createMessage", "(", "String", "msgKey", ",", "Object", "args", "[", "]", ")", "{", "if", "(", "m_resourceBundle", "==", "null", ")", "m_resourceBundle", "=", "loadResourceBundle", "(", "m_resourceBundleName", ")", ";", "if", "(",...
Creates a message from the specified key and replacement arguments, localized to the given locale. @param msgKey The key for the message text. @param args The arguments to be used as replacement text in the message created. @return The formatted message string. @xsl.usage internal
[ "Creates", "a", "message", "from", "the", "specified", "key", "and", "replacement", "arguments", "localized", "to", "the", "given", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/Messages.java#L172-L183
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.SPAN
public static HtmlTree SPAN(HtmlStyle styleClass, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body)); if (styleClass != null) htmltree.addStyle(styleClass); return htmltree; }
java
public static HtmlTree SPAN(HtmlStyle styleClass, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body)); if (styleClass != null) htmltree.addStyle(styleClass); return htmltree; }
[ "public", "static", "HtmlTree", "SPAN", "(", "HtmlStyle", "styleClass", ",", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "SPAN", ",", "nullCheck", "(", "body", ")", ")", ";", "if", "(", "styleClass", ...
Generates a SPAN tag with style class attribute and some content. @param styleClass style class for the tag @param body content for the tag @return an HtmlTree object for the SPAN tag
[ "Generates", "a", "SPAN", "tag", "with", "style", "class", "attribute", "and", "some", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L719-L724
rhuss/jolokia
agent/core/src/main/java/org/jolokia/http/HttpRequestHandler.java
HttpRequestHandler.checkAccess
public void checkAccess(String pHost, String pAddress, String pOrigin) { if (!backendManager.isRemoteAccessAllowed(pHost, pAddress)) { throw new SecurityException("No access from client " + pAddress + " allowed"); } if (!backendManager.isOriginAllowed(pOrigin,true)) { throw new SecurityException("Origin " + pOrigin + " is not allowed to call this agent"); } }
java
public void checkAccess(String pHost, String pAddress, String pOrigin) { if (!backendManager.isRemoteAccessAllowed(pHost, pAddress)) { throw new SecurityException("No access from client " + pAddress + " allowed"); } if (!backendManager.isOriginAllowed(pOrigin,true)) { throw new SecurityException("Origin " + pOrigin + " is not allowed to call this agent"); } }
[ "public", "void", "checkAccess", "(", "String", "pHost", ",", "String", "pAddress", ",", "String", "pOrigin", ")", "{", "if", "(", "!", "backendManager", ".", "isRemoteAccessAllowed", "(", "pHost", ",", "pAddress", ")", ")", "{", "throw", "new", "SecurityExc...
Check whether the given host and/or address is allowed to access this agent. @param pHost host to check @param pAddress address to check @param pOrigin (optional) origin header to check also.
[ "Check", "whether", "the", "given", "host", "and", "/", "or", "address", "is", "allowed", "to", "access", "this", "agent", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/http/HttpRequestHandler.java#L282-L289
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/FunctionExtensions.java
FunctionExtensions.curry
@Pure public static <P1, P2, P3, RESULT> Function2<P2, P3, RESULT> curry(final Function3<? super P1, ? super P2, ? super P3, ? extends RESULT> function, final P1 argument) { if (function == null) throw new NullPointerException("function"); return new Function2<P2, P3, RESULT>() { @Override public RESULT apply(P2 p2, P3 p3) { return function.apply(argument, p2, p3); } }; }
java
@Pure public static <P1, P2, P3, RESULT> Function2<P2, P3, RESULT> curry(final Function3<? super P1, ? super P2, ? super P3, ? extends RESULT> function, final P1 argument) { if (function == null) throw new NullPointerException("function"); return new Function2<P2, P3, RESULT>() { @Override public RESULT apply(P2 p2, P3 p3) { return function.apply(argument, p2, p3); } }; }
[ "@", "Pure", "public", "static", "<", "P1", ",", "P2", ",", "P3", ",", "RESULT", ">", "Function2", "<", "P2", ",", "P3", ",", "RESULT", ">", "curry", "(", "final", "Function3", "<", "?", "super", "P1", ",", "?", "super", "P2", ",", "?", "super", ...
Curries a function that takes three arguments. @param function the original function. May not be <code>null</code>. @param argument the fixed first argument of {@code function}. @return a function that takes two arguments. Never <code>null</code>.
[ "Curries", "a", "function", "that", "takes", "three", "arguments", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/FunctionExtensions.java#L82-L93
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdBlock.java
ThresholdBlock.selectBlockSize
void selectBlockSize( int width , int height , int requestedBlockWidth) { if( height < requestedBlockWidth ) { blockHeight = height; } else { int rows = height/requestedBlockWidth; blockHeight = height/rows; } if( width < requestedBlockWidth ) { blockWidth = width; } else { int cols = width/requestedBlockWidth; blockWidth = width/cols; } }
java
void selectBlockSize( int width , int height , int requestedBlockWidth) { if( height < requestedBlockWidth ) { blockHeight = height; } else { int rows = height/requestedBlockWidth; blockHeight = height/rows; } if( width < requestedBlockWidth ) { blockWidth = width; } else { int cols = width/requestedBlockWidth; blockWidth = width/cols; } }
[ "void", "selectBlockSize", "(", "int", "width", ",", "int", "height", ",", "int", "requestedBlockWidth", ")", "{", "if", "(", "height", "<", "requestedBlockWidth", ")", "{", "blockHeight", "=", "height", ";", "}", "else", "{", "int", "rows", "=", "height",...
Selects a block size which is close to the requested block size by the user
[ "Selects", "a", "block", "size", "which", "is", "close", "to", "the", "requested", "block", "size", "by", "the", "user" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdBlock.java#L112-L127
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/utils/MaterialUtils.java
MaterialUtils.findIndexPageDocument
public static LocalDocument findIndexPageDocument(Delfoi delfoi, Locale locale) { String urlName = String.format("%s-%s", INDEX_PAGE_URLNAME, locale.getLanguage()); return findLocalDocumentByParentAndUrlName(delfoi.getRootFolder(), urlName); }
java
public static LocalDocument findIndexPageDocument(Delfoi delfoi, Locale locale) { String urlName = String.format("%s-%s", INDEX_PAGE_URLNAME, locale.getLanguage()); return findLocalDocumentByParentAndUrlName(delfoi.getRootFolder(), urlName); }
[ "public", "static", "LocalDocument", "findIndexPageDocument", "(", "Delfoi", "delfoi", ",", "Locale", "locale", ")", "{", "String", "urlName", "=", "String", ".", "format", "(", "\"%s-%s\"", ",", "INDEX_PAGE_URLNAME", ",", "locale", ".", "getLanguage", "(", ")",...
Finds delfoi index page document @param delfoi delfoi @param locale document locale @return index page document or null if not defined
[ "Finds", "delfoi", "index", "page", "document" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/MaterialUtils.java#L83-L86
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.translateLocal
public Matrix4f translateLocal(float x, float y, float z) { return translateLocal(x, y, z, thisOrNew()); }
java
public Matrix4f translateLocal(float x, float y, float z) { return translateLocal(x, y, z, thisOrNew()); }
[ "public", "Matrix4f", "translateLocal", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "return", "translateLocal", "(", "x", ",", "y", ",", "z", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Pre-multiply a translation to this matrix by translating by the given number of units in x, y and z. <p> If <code>M</code> is <code>this</code> matrix and <code>T</code> the translation matrix, then the new matrix will be <code>T * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>T * M * v</code>, the translation will be applied last! <p> In order to set the matrix to a translation transformation without pre-multiplying it, use {@link #translation(float, float, float)}. @see #translation(float, float, float) @param x the offset to translate in x @param y the offset to translate in y @param z the offset to translate in z @return a matrix holding the result
[ "Pre", "-", "multiply", "a", "translation", "to", "this", "matrix", "by", "translating", "by", "the", "given", "number", "of", "units", "in", "x", "y", "and", "z", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "thi...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L6762-L6764
jglobus/JGlobus
gridftp/src/main/java/org/globus/ftp/vanilla/FTPServerFacade.java
FTPServerFacade.setPassive
public HostPort setPassive(int port, int queue) throws IOException{ if (serverSocket == null) { ServerSocketFactory factory = ServerSocketFactory.getDefault(); serverSocket = factory.createServerSocket(port, queue); } session.serverMode = Session.SERVER_PASSIVE; String address = Util.getLocalHostAddress(); int localPort = serverSocket.getLocalPort(); if (remoteControlChannel.isIPv6()) { String version = HostPort6.getIPAddressVersion(address); session.serverAddress = new HostPort6(version, address, localPort); } else { session.serverAddress = new HostPort(address, localPort); } logger.debug("started passive server at port " + session.serverAddress.getPort()); return session.serverAddress; }
java
public HostPort setPassive(int port, int queue) throws IOException{ if (serverSocket == null) { ServerSocketFactory factory = ServerSocketFactory.getDefault(); serverSocket = factory.createServerSocket(port, queue); } session.serverMode = Session.SERVER_PASSIVE; String address = Util.getLocalHostAddress(); int localPort = serverSocket.getLocalPort(); if (remoteControlChannel.isIPv6()) { String version = HostPort6.getIPAddressVersion(address); session.serverAddress = new HostPort6(version, address, localPort); } else { session.serverAddress = new HostPort(address, localPort); } logger.debug("started passive server at port " + session.serverAddress.getPort()); return session.serverAddress; }
[ "public", "HostPort", "setPassive", "(", "int", "port", ",", "int", "queue", ")", "throws", "IOException", "{", "if", "(", "serverSocket", "==", "null", ")", "{", "ServerSocketFactory", "factory", "=", "ServerSocketFactory", ".", "getDefault", "(", ")", ";", ...
Start the local server @param port required server port; can be set to ANY_PORT @param queue max size of queue of awaiting new connection requests @return the server address
[ "Start", "the", "local", "server" ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/vanilla/FTPServerFacade.java#L183-L210
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/constant/ProtectedCudaConstantHandler.java
ProtectedCudaConstantHandler.relocateConstantSpace
@Override public DataBuffer relocateConstantSpace(DataBuffer dataBuffer) { // we always assume that data is sync, and valid on host side Integer deviceId = AtomicAllocator.getInstance().getDeviceId(); ensureMaps(deviceId); if (dataBuffer instanceof CudaIntDataBuffer) { int[] data = dataBuffer.asInt(); return getConstantBuffer(data, DataType.INT); } else if (dataBuffer instanceof CudaFloatDataBuffer) { float[] data = dataBuffer.asFloat(); return getConstantBuffer(data, DataType.FLOAT); } else if (dataBuffer instanceof CudaDoubleDataBuffer) { double[] data = dataBuffer.asDouble(); return getConstantBuffer(data, DataType.DOUBLE); } else if (dataBuffer instanceof CudaHalfDataBuffer) { float[] data = dataBuffer.asFloat(); return getConstantBuffer(data, DataType.HALF); } else if (dataBuffer instanceof CudaLongDataBuffer) { long[] data = dataBuffer.asLong(); return getConstantBuffer(data, DataType.LONG); } throw new IllegalStateException("Unknown CudaDataBuffer opType"); }
java
@Override public DataBuffer relocateConstantSpace(DataBuffer dataBuffer) { // we always assume that data is sync, and valid on host side Integer deviceId = AtomicAllocator.getInstance().getDeviceId(); ensureMaps(deviceId); if (dataBuffer instanceof CudaIntDataBuffer) { int[] data = dataBuffer.asInt(); return getConstantBuffer(data, DataType.INT); } else if (dataBuffer instanceof CudaFloatDataBuffer) { float[] data = dataBuffer.asFloat(); return getConstantBuffer(data, DataType.FLOAT); } else if (dataBuffer instanceof CudaDoubleDataBuffer) { double[] data = dataBuffer.asDouble(); return getConstantBuffer(data, DataType.DOUBLE); } else if (dataBuffer instanceof CudaHalfDataBuffer) { float[] data = dataBuffer.asFloat(); return getConstantBuffer(data, DataType.HALF); } else if (dataBuffer instanceof CudaLongDataBuffer) { long[] data = dataBuffer.asLong(); return getConstantBuffer(data, DataType.LONG); } throw new IllegalStateException("Unknown CudaDataBuffer opType"); }
[ "@", "Override", "public", "DataBuffer", "relocateConstantSpace", "(", "DataBuffer", "dataBuffer", ")", "{", "// we always assume that data is sync, and valid on host side", "Integer", "deviceId", "=", "AtomicAllocator", ".", "getInstance", "(", ")", ".", "getDeviceId", "("...
PLEASE NOTE: This method implementation is hardware-dependant. PLEASE NOTE: This method does NOT allow concurrent use of any array @param dataBuffer @return
[ "PLEASE", "NOTE", ":", "This", "method", "implementation", "is", "hardware", "-", "dependant", ".", "PLEASE", "NOTE", ":", "This", "method", "does", "NOT", "allow", "concurrent", "use", "of", "any", "array" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/constant/ProtectedCudaConstantHandler.java#L259-L283
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/util/TransitionUtil.java
TransitionUtil.executeOnGlobalLayout
public static void executeOnGlobalLayout(@NonNull final Activity activity, @NonNull final ViewTreeObserver.OnGlobalLayoutListener listener) { executeOnGlobalLayout(activity.getWindow().getDecorView().findViewById(android.R.id.content), listener); }
java
public static void executeOnGlobalLayout(@NonNull final Activity activity, @NonNull final ViewTreeObserver.OnGlobalLayoutListener listener) { executeOnGlobalLayout(activity.getWindow().getDecorView().findViewById(android.R.id.content), listener); }
[ "public", "static", "void", "executeOnGlobalLayout", "(", "@", "NonNull", "final", "Activity", "activity", ",", "@", "NonNull", "final", "ViewTreeObserver", ".", "OnGlobalLayoutListener", "listener", ")", "{", "executeOnGlobalLayout", "(", "activity", ".", "getWindow"...
Helper that removes the drudgery of using ViewTreeObserver @param activity used to retrieve a View that can be @param listener
[ "Helper", "that", "removes", "the", "drudgery", "of", "using", "ViewTreeObserver" ]
train
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/util/TransitionUtil.java#L105-L107
michael-rapp/AndroidMaterialDialog
library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java
DialogRootView.applyDialogPaddingLeft
private void applyDialogPaddingLeft(@NonNull final Area area, @NonNull final View view) { int padding = area != Area.HEADER && area != Area.BUTTON_BAR && area != Area.CONTENT ? dialogPadding[0] : 0; view.setPadding(padding, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()); }
java
private void applyDialogPaddingLeft(@NonNull final Area area, @NonNull final View view) { int padding = area != Area.HEADER && area != Area.BUTTON_BAR && area != Area.CONTENT ? dialogPadding[0] : 0; view.setPadding(padding, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()); }
[ "private", "void", "applyDialogPaddingLeft", "(", "@", "NonNull", "final", "Area", "area", ",", "@", "NonNull", "final", "View", "view", ")", "{", "int", "padding", "=", "area", "!=", "Area", ".", "HEADER", "&&", "area", "!=", "Area", ".", "BUTTON_BAR", ...
Applies the dialog's left padding to the view of a specific area. @param area The area, the view, the padding should be applied to, corresponds to, as an instance of the class {@link Area}. The area may not be null @param view The view, the padding should be applied to, as an instance of the class {@link View}. The view may not be null
[ "Applies", "the", "dialog", "s", "left", "padding", "to", "the", "view", "of", "a", "specific", "area", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java#L665-L670
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java
TiledFeatureService.fillTile
public void fillTile(InternalTile tile, Envelope maxTileExtent) throws GeomajasException { List<InternalFeature> origFeatures = tile.getFeatures(); tile.setFeatures(new ArrayList<InternalFeature>()); for (InternalFeature feature : origFeatures) { if (!addTileCode(tile, maxTileExtent, feature.getGeometry())) { log.debug("add feature"); tile.addFeature(feature); } } }
java
public void fillTile(InternalTile tile, Envelope maxTileExtent) throws GeomajasException { List<InternalFeature> origFeatures = tile.getFeatures(); tile.setFeatures(new ArrayList<InternalFeature>()); for (InternalFeature feature : origFeatures) { if (!addTileCode(tile, maxTileExtent, feature.getGeometry())) { log.debug("add feature"); tile.addFeature(feature); } } }
[ "public", "void", "fillTile", "(", "InternalTile", "tile", ",", "Envelope", "maxTileExtent", ")", "throws", "GeomajasException", "{", "List", "<", "InternalFeature", ">", "origFeatures", "=", "tile", ".", "getFeatures", "(", ")", ";", "tile", ".", "setFeatures",...
Put features in a tile. This will assure all features are only added in one tile. When a feature's unique tile is different from this one a link is added in the tile. @param tile tile to put features in @param maxTileExtent the maximum tile extent @throws GeomajasException oops
[ "Put", "features", "in", "a", "tile", ".", "This", "will", "assure", "all", "features", "are", "only", "added", "in", "one", "tile", ".", "When", "a", "feature", "s", "unique", "tile", "is", "different", "from", "this", "one", "a", "link", "is", "added...
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java#L71-L81
powermock/powermock
powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java
SuppressCode.suppressMethod
public static synchronized void suppressMethod(Class<?> clazz, boolean excludePrivateMethods) { Method[] methods = null; if (excludePrivateMethods) { methods = clazz.getMethods(); } else { methods = clazz.getDeclaredMethods(); } for (Method method : methods) { MockRepository.addMethodToSuppress(method); } }
java
public static synchronized void suppressMethod(Class<?> clazz, boolean excludePrivateMethods) { Method[] methods = null; if (excludePrivateMethods) { methods = clazz.getMethods(); } else { methods = clazz.getDeclaredMethods(); } for (Method method : methods) { MockRepository.addMethodToSuppress(method); } }
[ "public", "static", "synchronized", "void", "suppressMethod", "(", "Class", "<", "?", ">", "clazz", ",", "boolean", "excludePrivateMethods", ")", "{", "Method", "[", "]", "methods", "=", "null", ";", "if", "(", "excludePrivateMethods", ")", "{", "methods", "...
suSuppress all methods for this class. @param clazz The class which methods will be suppressed. @param excludePrivateMethods optionally not suppress private methods
[ "suSuppress", "all", "methods", "for", "this", "class", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java#L218-L230
aws/aws-sdk-java
aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetCredentialsForIdentityRequest.java
GetCredentialsForIdentityRequest.withLogins
public GetCredentialsForIdentityRequest withLogins(java.util.Map<String, String> logins) { setLogins(logins); return this; }
java
public GetCredentialsForIdentityRequest withLogins(java.util.Map<String, String> logins) { setLogins(logins); return this; }
[ "public", "GetCredentialsForIdentityRequest", "withLogins", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "logins", ")", "{", "setLogins", "(", "logins", ")", ";", "return", "this", ";", "}" ]
<p> A set of optional name-value pairs that map provider names to provider tokens. The name-value pair will follow the syntax "provider_name": "provider_user_identifier". </p> <p> Logins should not be specified when trying to get credentials for an unauthenticated identity. </p> <p> The Logins parameter is required when using identities associated with external identity providers such as FaceBook. For examples of <code>Logins</code> maps, see the code examples in the <a href="http://docs.aws.amazon.com/cognito/latest/developerguide/external-identity-providers.html">External Identity Providers</a> section of the Amazon Cognito Developer Guide. </p> @param logins A set of optional name-value pairs that map provider names to provider tokens. The name-value pair will follow the syntax "provider_name": "provider_user_identifier".</p> <p> Logins should not be specified when trying to get credentials for an unauthenticated identity. </p> <p> The Logins parameter is required when using identities associated with external identity providers such as FaceBook. For examples of <code>Logins</code> maps, see the code examples in the <a href="http://docs.aws.amazon.com/cognito/latest/developerguide/external-identity-providers.html">External Identity Providers</a> section of the Amazon Cognito Developer Guide. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "set", "of", "optional", "name", "-", "value", "pairs", "that", "map", "provider", "names", "to", "provider", "tokens", ".", "The", "name", "-", "value", "pair", "will", "follow", "the", "syntax", "provider_name", ":", "provider_user_identifi...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetCredentialsForIdentityRequest.java#L194-L197
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/RendererUtils.java
RendererUtils.parallelPath
static Point[] parallelPath(Point[] p, double dy) { int n = p.length - 1; Point[] u = new Point[n]; Point[] h = new Point[p.length]; // Generate an array u[] of unity vectors of each direction for (int k = 0; k < n; ++k) { double c = p[k + 1].x - p[k].x; double s = p[k + 1].y - p[k].y; double l = Math.sqrt(c * c + s * s); if (l == 0) { u[k] = new Point(0, 0); } else { u[k] = new Point(c / l, s / l); } } // For the start point calculate the normal h[0] = new Point(p[0].x - dy * u[0].y, p[0].y + dy * u[0].x); // For 1 to N-1 calculate the intersection of the offset lines for (int k = 1; k < n; k++) { double l = dy / (1 + u[k].x * u[k - 1].x + u[k].y * u[k - 1].y); h[k] = new Point(p[k].x - l * (u[k].y + u[k - 1].y), p[k].y + l * (u[k].x + u[k - 1].x)); } // For the end point use the normal h[n] = new Point(p[n].x - dy * u[n - 1].y, p[n].y + dy * u[n - 1].x); return h; }
java
static Point[] parallelPath(Point[] p, double dy) { int n = p.length - 1; Point[] u = new Point[n]; Point[] h = new Point[p.length]; // Generate an array u[] of unity vectors of each direction for (int k = 0; k < n; ++k) { double c = p[k + 1].x - p[k].x; double s = p[k + 1].y - p[k].y; double l = Math.sqrt(c * c + s * s); if (l == 0) { u[k] = new Point(0, 0); } else { u[k] = new Point(c / l, s / l); } } // For the start point calculate the normal h[0] = new Point(p[0].x - dy * u[0].y, p[0].y + dy * u[0].x); // For 1 to N-1 calculate the intersection of the offset lines for (int k = 1; k < n; k++) { double l = dy / (1 + u[k].x * u[k - 1].x + u[k].y * u[k - 1].y); h[k] = new Point(p[k].x - l * (u[k].y + u[k - 1].y), p[k].y + l * (u[k].x + u[k - 1].x)); } // For the end point use the normal h[n] = new Point(p[n].x - dy * u[n - 1].y, p[n].y + dy * u[n - 1].x); return h; }
[ "static", "Point", "[", "]", "parallelPath", "(", "Point", "[", "]", "p", ",", "double", "dy", ")", "{", "int", "n", "=", "p", ".", "length", "-", "1", ";", "Point", "[", "]", "u", "=", "new", "Point", "[", "n", "]", ";", "Point", "[", "]", ...
Computes a polyline with distance dy parallel to given coordinates. http://objectmix.com/graphics/132987-draw-parallel-polyline-algorithm-needed.html
[ "Computes", "a", "polyline", "with", "distance", "dy", "parallel", "to", "given", "coordinates", ".", "http", ":", "//", "objectmix", ".", "com", "/", "graphics", "/", "132987", "-", "draw", "-", "parallel", "-", "polyline", "-", "algorithm", "-", "needed"...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/RendererUtils.java#L26-L56
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseListener.java
BaseListener.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Return an error to stop the change int iErrorCode = DBConstants.NORMAL_RETURN; if (iChangeType == DBConstants.BEFORE_FREE_TYPE) { // This is the only type that I would pass on (So dependent knows it will be freed) BaseListener dependentListener = this.getDependentListener(); if (dependentListener != null) if (dependentListener.isEnabled()) { boolean bEnabled = dependentListener.setEnabledListener(false); iErrorCode = dependentListener.doRecordChange(field, iChangeType, bDisplayOption); dependentListener.setEnabledListener(bEnabled); } } return iErrorCode; }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Return an error to stop the change int iErrorCode = DBConstants.NORMAL_RETURN; if (iChangeType == DBConstants.BEFORE_FREE_TYPE) { // This is the only type that I would pass on (So dependent knows it will be freed) BaseListener dependentListener = this.getDependentListener(); if (dependentListener != null) if (dependentListener.isEnabled()) { boolean bEnabled = dependentListener.setEnabledListener(false); iErrorCode = dependentListener.doRecordChange(field, iChangeType, bDisplayOption); dependentListener.setEnabledListener(bEnabled); } } return iErrorCode; }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "// Return an error to stop the change", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "if", "(", "iChangeType", ...
Called when a change is the record status is about to happen/has happened. Note: This is a FileListener method, but I put it down here so this message will be propagated. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", ".", "Note", ":", "This", "is", "a", "FileListener", "method", "but", "I", "put", "it", "down", "here", "so", "this", "message", "w...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseListener.java#L362-L377
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java
ServletUtil.write
public static void write(HttpServletResponse response, InputStream in, String contentType) { response.setContentType(contentType); write(response, in); }
java
public static void write(HttpServletResponse response, InputStream in, String contentType) { response.setContentType(contentType); write(response, in); }
[ "public", "static", "void", "write", "(", "HttpServletResponse", "response", ",", "InputStream", "in", ",", "String", "contentType", ")", "{", "response", ".", "setContentType", "(", "contentType", ")", ";", "write", "(", "response", ",", "in", ")", ";", "}"...
返回数据给客户端 @param response 响应对象{@link HttpServletResponse} @param in 需要返回客户端的内容 @param contentType 返回的类型
[ "返回数据给客户端" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L536-L539
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/ChannelListController.java
ChannelListController.getPortletRegistry
@RequestMapping(value = "/v4-3/dlm/portletRegistry.json", method = RequestMethod.GET) public ModelAndView getPortletRegistry( WebRequest webRequest, HttpServletRequest request, @RequestParam(value = "categoryId", required = false) String categoryId, @RequestParam(value = "category", required = false) String categoryName, @RequestParam(value = "favorite", required = false) String favorite) { boolean includeUncategorizedPortlets = true; // default /* * Pick a category for the basis of the response */ PortletCategory rootCategory = portletCategoryRegistry.getTopLevelPortletCategory(); // default if (StringUtils.isNotBlank(categoryId)) { // Callers can specify a category by Id... rootCategory = portletCategoryRegistry.getPortletCategory(categoryId); includeUncategorizedPortlets = false; } else if (StringUtils.isNotBlank(categoryName)) { // or by name... rootCategory = portletCategoryRegistry.getPortletCategoryByName(categoryName); includeUncategorizedPortlets = false; } if (rootCategory == null) { // A specific category was requested, but there was a problem obtaining it throw new IllegalArgumentException("Requested category not found"); } final IPerson user = personManager.getPerson(request); /* * Gather the user's favorites */ final Set<IPortletDefinition> favoritePortlets = calculateFavoritePortlets(request); Map<String, SortedSet<PortletCategoryBean>> rslt = getRegistry43( webRequest, user, rootCategory, includeUncategorizedPortlets, favoritePortlets); /* * The 'favorite=true' option means return only portlets that this user has favorited. */ if (Boolean.valueOf(favorite)) { logger.debug( "Filtering out non-favorite portlets because 'favorite=true' was included in the query string"); rslt = filterRegistryFavoritesOnly(rslt); } return new ModelAndView("jsonView", "registry", rslt); }
java
@RequestMapping(value = "/v4-3/dlm/portletRegistry.json", method = RequestMethod.GET) public ModelAndView getPortletRegistry( WebRequest webRequest, HttpServletRequest request, @RequestParam(value = "categoryId", required = false) String categoryId, @RequestParam(value = "category", required = false) String categoryName, @RequestParam(value = "favorite", required = false) String favorite) { boolean includeUncategorizedPortlets = true; // default /* * Pick a category for the basis of the response */ PortletCategory rootCategory = portletCategoryRegistry.getTopLevelPortletCategory(); // default if (StringUtils.isNotBlank(categoryId)) { // Callers can specify a category by Id... rootCategory = portletCategoryRegistry.getPortletCategory(categoryId); includeUncategorizedPortlets = false; } else if (StringUtils.isNotBlank(categoryName)) { // or by name... rootCategory = portletCategoryRegistry.getPortletCategoryByName(categoryName); includeUncategorizedPortlets = false; } if (rootCategory == null) { // A specific category was requested, but there was a problem obtaining it throw new IllegalArgumentException("Requested category not found"); } final IPerson user = personManager.getPerson(request); /* * Gather the user's favorites */ final Set<IPortletDefinition> favoritePortlets = calculateFavoritePortlets(request); Map<String, SortedSet<PortletCategoryBean>> rslt = getRegistry43( webRequest, user, rootCategory, includeUncategorizedPortlets, favoritePortlets); /* * The 'favorite=true' option means return only portlets that this user has favorited. */ if (Boolean.valueOf(favorite)) { logger.debug( "Filtering out non-favorite portlets because 'favorite=true' was included in the query string"); rslt = filterRegistryFavoritesOnly(rslt); } return new ModelAndView("jsonView", "registry", rslt); }
[ "@", "RequestMapping", "(", "value", "=", "\"/v4-3/dlm/portletRegistry.json\"", ",", "method", "=", "RequestMethod", ".", "GET", ")", "public", "ModelAndView", "getPortletRegistry", "(", "WebRequest", "webRequest", ",", "HttpServletRequest", "request", ",", "@", "Requ...
Updated version of this API. Supports an optional 'categoryId' parameter. If provided, this URL will return the portlet registry beginning with the specified category, including all descendants, and <em>excluding</em> uncategorized portlets. If no 'categoryId' is provided, this method returns the portlet registry beginning with 'All Categories' (the root) and <em>including</em> uncategorized portlets. Access is based on the SUBSCRIBE permission. @since 4.3
[ "Updated", "version", "of", "this", "API", ".", "Supports", "an", "optional", "categoryId", "parameter", ".", "If", "provided", "this", "URL", "will", "return", "the", "portlet", "registry", "beginning", "with", "the", "specified", "category", "including", "all"...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/ChannelListController.java#L192-L247
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
SignatureUtils.getParameterSignatures
public static List<String> getParameterSignatures(String methodSignature) { int start = methodSignature.indexOf('(') + 1; int limit = methodSignature.lastIndexOf(')'); if ((limit - start) == 0) { return Collections.emptyList(); } List<String> parmSignatures = new ArrayList<>(); int sigStart = start; for (int i = start; i < limit; i++) { if (!methodSignature.startsWith(Values.SIG_ARRAY_PREFIX, i)) { if (methodSignature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX, i)) { int semiPos = methodSignature.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR, i + 1); parmSignatures.add(methodSignature.substring(sigStart, semiPos + 1)); i = semiPos; } else if (!isWonkyEclipseSignature(methodSignature, i)) { parmSignatures.add(methodSignature.substring(sigStart, i + 1)); } sigStart = i + 1; } } return parmSignatures; }
java
public static List<String> getParameterSignatures(String methodSignature) { int start = methodSignature.indexOf('(') + 1; int limit = methodSignature.lastIndexOf(')'); if ((limit - start) == 0) { return Collections.emptyList(); } List<String> parmSignatures = new ArrayList<>(); int sigStart = start; for (int i = start; i < limit; i++) { if (!methodSignature.startsWith(Values.SIG_ARRAY_PREFIX, i)) { if (methodSignature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX, i)) { int semiPos = methodSignature.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR, i + 1); parmSignatures.add(methodSignature.substring(sigStart, semiPos + 1)); i = semiPos; } else if (!isWonkyEclipseSignature(methodSignature, i)) { parmSignatures.add(methodSignature.substring(sigStart, i + 1)); } sigStart = i + 1; } } return parmSignatures; }
[ "public", "static", "List", "<", "String", ">", "getParameterSignatures", "(", "String", "methodSignature", ")", "{", "int", "start", "=", "methodSignature", ".", "indexOf", "(", "'", "'", ")", "+", "1", ";", "int", "limit", "=", "methodSignature", ".", "l...
returns a List of parameter signatures @param methodSignature the signature of the method to parse @return a list of parameter signatures
[ "returns", "a", "List", "of", "parameter", "signatures" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L221-L246
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/memory/MemorySize.java
MemorySize.toPrettyString
public static String toPrettyString(long size, MemoryUnit unit) { if (unit.toGigaBytes(size) >= PRETTY_FORMAT_LIMIT) { return unit.toGigaBytes(size) + " GB"; } if (unit.toMegaBytes(size) >= PRETTY_FORMAT_LIMIT) { return unit.toMegaBytes(size) + " MB"; } if (unit.toKiloBytes(size) >= PRETTY_FORMAT_LIMIT) { return unit.toKiloBytes(size) + " KB"; } if (size % MemoryUnit.K == 0) { return unit.toKiloBytes(size) + " KB"; } return size + " bytes"; }
java
public static String toPrettyString(long size, MemoryUnit unit) { if (unit.toGigaBytes(size) >= PRETTY_FORMAT_LIMIT) { return unit.toGigaBytes(size) + " GB"; } if (unit.toMegaBytes(size) >= PRETTY_FORMAT_LIMIT) { return unit.toMegaBytes(size) + " MB"; } if (unit.toKiloBytes(size) >= PRETTY_FORMAT_LIMIT) { return unit.toKiloBytes(size) + " KB"; } if (size % MemoryUnit.K == 0) { return unit.toKiloBytes(size) + " KB"; } return size + " bytes"; }
[ "public", "static", "String", "toPrettyString", "(", "long", "size", ",", "MemoryUnit", "unit", ")", "{", "if", "(", "unit", ".", "toGigaBytes", "(", "size", ")", ">=", "PRETTY_FORMAT_LIMIT", ")", "{", "return", "unit", ".", "toGigaBytes", "(", "size", ")"...
Utility method to create a pretty format representation of given value in given unit. @param size memory size @param unit memory unit @return pretty format representation of given value
[ "Utility", "method", "to", "create", "a", "pretty", "format", "representation", "of", "given", "value", "in", "given", "unit", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/memory/MemorySize.java#L197-L211
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java
AuditUtils.planCreated
public static AuditEntryBean planCreated(PlanBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Plan, securityContext); entry.setEntityId(bean.getId()); entry.setEntityVersion(null); entry.setData(null); entry.setWhat(AuditEntryType.Create); return entry; }
java
public static AuditEntryBean planCreated(PlanBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Plan, securityContext); entry.setEntityId(bean.getId()); entry.setEntityVersion(null); entry.setData(null); entry.setWhat(AuditEntryType.Create); return entry; }
[ "public", "static", "AuditEntryBean", "planCreated", "(", "PlanBean", "bean", ",", "ISecurityContext", "securityContext", ")", "{", "AuditEntryBean", "entry", "=", "newEntry", "(", "bean", ".", "getOrganization", "(", ")", ".", "getId", "(", ")", ",", "AuditEnti...
Creates an audit entry for the 'plan created' event. @param bean the bean @param securityContext the security context @return the audit entry
[ "Creates", "an", "audit", "entry", "for", "the", "plan", "created", "event", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java#L595-L602
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java
JavaBean.newBean
public static <T> T newBean(Map<?,?> aValues, Class<?> aClass, PropertyConverter<Object,Object> convert) throws InstantiationException, IllegalAccessException { T obj = ClassPath.newInstance(aClass); populate(aValues,obj,convert); return obj; }
java
public static <T> T newBean(Map<?,?> aValues, Class<?> aClass, PropertyConverter<Object,Object> convert) throws InstantiationException, IllegalAccessException { T obj = ClassPath.newInstance(aClass); populate(aValues,obj,convert); return obj; }
[ "public", "static", "<", "T", ">", "T", "newBean", "(", "Map", "<", "?", ",", "?", ">", "aValues", ",", "Class", "<", "?", ">", "aClass", ",", "PropertyConverter", "<", "Object", ",", "Object", ">", "convert", ")", "throws", "InstantiationException", "...
Create new instance of the object @param aValues the map value @param aClass the class to create @param <T> the type class @param convert the conversion implementation @return the create object instance @throws InstantiationException @throws IllegalAccessException
[ "Create", "new", "instance", "of", "the", "object" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java#L66-L75
mgormley/pacaya
src/main/java/edu/jhu/pacaya/hypergraph/depparse/HyperDepParser.java
HyperDepParser.insideSingleRootEntropyFoe
public static Pair<O1DpHypergraph, Scores> insideSingleRootEntropyFoe(double[] fracRoot, double[][] fracChild) { final Algebra semiring = LogSignAlgebra.getInstance(); return insideSingleRootEntropyFoe(fracRoot, fracChild, semiring); }
java
public static Pair<O1DpHypergraph, Scores> insideSingleRootEntropyFoe(double[] fracRoot, double[][] fracChild) { final Algebra semiring = LogSignAlgebra.getInstance(); return insideSingleRootEntropyFoe(fracRoot, fracChild, semiring); }
[ "public", "static", "Pair", "<", "O1DpHypergraph", ",", "Scores", ">", "insideSingleRootEntropyFoe", "(", "double", "[", "]", "fracRoot", ",", "double", "[", "]", "[", "]", "fracChild", ")", "{", "final", "Algebra", "semiring", "=", "LogSignAlgebra", ".", "g...
Runs the inside-outside algorithm for dependency parsing. @param fracRoot Input: The edge weights from the wall to each child. @param fracChild Input: The edge weights from parent to child. @return The parse chart.
[ "Runs", "the", "inside", "-", "outside", "algorithm", "for", "dependency", "parsing", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/hypergraph/depparse/HyperDepParser.java#L120-L123
berkesa/datatree
src/main/java/io/datatree/Tree.java
Tree.putMap
public Tree putMap(String path, boolean putIfAbsent) { return putObjectInternal(path, new LinkedHashMap<String, Object>(), putIfAbsent); }
java
public Tree putMap(String path, boolean putIfAbsent) { return putObjectInternal(path, new LinkedHashMap<String, Object>(), putIfAbsent); }
[ "public", "Tree", "putMap", "(", "String", "path", ",", "boolean", "putIfAbsent", ")", "{", "return", "putObjectInternal", "(", "path", ",", "new", "LinkedHashMap", "<", "String", ",", "Object", ">", "(", ")", ",", "putIfAbsent", ")", ";", "}" ]
Associates the specified Map (~= JSON object) container with the specified path. If the structure previously contained a mapping for the path, the old value is replaced. Sample code:<br> <br> Tree response = ...<br> Tree headers = response.getMeta().putMap("headers", true);<br> headers.put("Content-Type", "text/html"); @param path path with which the specified Map is to be associated @param putIfAbsent if true and the specified key is not already associated with a value associates it with the given value and returns the new Map, else returns the previous Map @return Tree of the new Map
[ "Associates", "the", "specified", "Map", "(", "~", "=", "JSON", "object", ")", "container", "with", "the", "specified", "path", ".", "If", "the", "structure", "previously", "contained", "a", "mapping", "for", "the", "path", "the", "old", "value", "is", "re...
train
https://github.com/berkesa/datatree/blob/79aea9b45c7b46ab28af0a09310bc01c421c6b3a/src/main/java/io/datatree/Tree.java#L2032-L2034
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java
FlatFileUtils.shrink
public static String shrink(String string, char c) { if (string == null) { return null; } string = string.trim(); Pattern pattern = Pattern.compile("\\" + String.valueOf(c) + "{2,}"); return pattern.matcher(string).replaceAll(String.valueOf(c)); }
java
public static String shrink(String string, char c) { if (string == null) { return null; } string = string.trim(); Pattern pattern = Pattern.compile("\\" + String.valueOf(c) + "{2,}"); return pattern.matcher(string).replaceAll(String.valueOf(c)); }
[ "public", "static", "String", "shrink", "(", "String", "string", ",", "char", "c", ")", "{", "if", "(", "string", "==", "null", ")", "{", "return", "null", ";", "}", "string", "=", "string", ".", "trim", "(", ")", ";", "Pattern", "pattern", "=", "P...
Trims the string and replaces runs of whitespace with a single character.
[ "Trims", "the", "string", "and", "replaces", "runs", "of", "whitespace", "with", "a", "single", "character", "." ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L215-L222
r0adkll/Slidr
library/src/main/java/com/r0adkll/slidr/Slidr.java
Slidr.attachSliderPanel
@NonNull private static SliderPanel attachSliderPanel(@NonNull Activity activity, @NonNull SlidrConfig config) { // Hijack the decorview ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); View oldScreen = decorView.getChildAt(0); decorView.removeViewAt(0); // Setup the slider panel and attach it to the decor SliderPanel panel = new SliderPanel(activity, oldScreen, config); panel.setId(R.id.slidable_panel); oldScreen.setId(R.id.slidable_content); panel.addView(oldScreen); decorView.addView(panel, 0); return panel; }
java
@NonNull private static SliderPanel attachSliderPanel(@NonNull Activity activity, @NonNull SlidrConfig config) { // Hijack the decorview ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); View oldScreen = decorView.getChildAt(0); decorView.removeViewAt(0); // Setup the slider panel and attach it to the decor SliderPanel panel = new SliderPanel(activity, oldScreen, config); panel.setId(R.id.slidable_panel); oldScreen.setId(R.id.slidable_content); panel.addView(oldScreen); decorView.addView(panel, 0); return panel; }
[ "@", "NonNull", "private", "static", "SliderPanel", "attachSliderPanel", "(", "@", "NonNull", "Activity", "activity", ",", "@", "NonNull", "SlidrConfig", "config", ")", "{", "// Hijack the decorview", "ViewGroup", "decorView", "=", "(", "ViewGroup", ")", "activity",...
Attach a new {@link SliderPanel} to the root of the activity's content
[ "Attach", "a", "new", "{" ]
train
https://github.com/r0adkll/Slidr/blob/737db115eb68435764648fbd905b1dea4b52f039/library/src/main/java/com/r0adkll/slidr/Slidr.java#L86-L100
wildfly/wildfly-core
embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java
SystemPropertyContext.addPropertyIfAbsent
void addPropertyIfAbsent(final String name, final Object value) { final String currentValue = SecurityActions.getPropertyPrivileged(name); if (currentValue == null) { SecurityActions.setPropertyPrivileged(name, value.toString()); propertiesToClear.add(name); } }
java
void addPropertyIfAbsent(final String name, final Object value) { final String currentValue = SecurityActions.getPropertyPrivileged(name); if (currentValue == null) { SecurityActions.setPropertyPrivileged(name, value.toString()); propertiesToClear.add(name); } }
[ "void", "addPropertyIfAbsent", "(", "final", "String", "name", ",", "final", "Object", "value", ")", "{", "final", "String", "currentValue", "=", "SecurityActions", ".", "getPropertyPrivileged", "(", "name", ")", ";", "if", "(", "currentValue", "==", "null", "...
Adds a system property only if the property does not currently exist. If the property does not exist on {@link #restore()} the property will be cleared. @param name the name of the property @param value the value to set if the property is absent
[ "Adds", "a", "system", "property", "only", "if", "the", "property", "does", "not", "currently", "exist", ".", "If", "the", "property", "does", "not", "exist", "on", "{", "@link", "#restore", "()", "}", "the", "property", "will", "be", "cleared", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java#L122-L128
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java
TurboProjectReader.addCalendarExceptions
private void addCalendarExceptions(Table table, ProjectCalendar calendar, Integer exceptionID) { Integer currentExceptionID = exceptionID; while (true) { MapRow row = table.find(currentExceptionID); if (row == null) { break; } Date date = row.getDate("DATE"); ProjectCalendarException exception = calendar.addCalendarException(date, date); if (row.getBoolean("WORKING")) { exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } currentExceptionID = row.getInteger("NEXT_CALENDAR_EXCEPTION_ID"); } }
java
private void addCalendarExceptions(Table table, ProjectCalendar calendar, Integer exceptionID) { Integer currentExceptionID = exceptionID; while (true) { MapRow row = table.find(currentExceptionID); if (row == null) { break; } Date date = row.getDate("DATE"); ProjectCalendarException exception = calendar.addCalendarException(date, date); if (row.getBoolean("WORKING")) { exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } currentExceptionID = row.getInteger("NEXT_CALENDAR_EXCEPTION_ID"); } }
[ "private", "void", "addCalendarExceptions", "(", "Table", "table", ",", "ProjectCalendar", "calendar", ",", "Integer", "exceptionID", ")", "{", "Integer", "currentExceptionID", "=", "exceptionID", ";", "while", "(", "true", ")", "{", "MapRow", "row", "=", "table...
Read exceptions for a calendar. @param table calendar exception data @param calendar calendar @param exceptionID first exception ID
[ "Read", "exceptions", "for", "a", "calendar", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L246-L267
glyptodon/guacamole-client
guacamole/src/main/java/org/apache/guacamole/extension/LanguageResourceService.java
LanguageResourceService.getLanguageNames
public Map<String, String> getLanguageNames() { Map<String, String> languageNames = new HashMap<String, String>(); // For each language key/resource pair for (Map.Entry<String, Resource> entry : resources.entrySet()) { // Get language key and resource String languageKey = entry.getKey(); Resource resource = entry.getValue(); // Get stream for resource InputStream resourceStream = resource.asStream(); if (resourceStream == null) { logger.warn("Expected language resource does not exist: \"{}\".", languageKey); continue; } // Get name node of language try { JsonNode tree = mapper.readTree(resourceStream); JsonNode nameNode = tree.get(LANGUAGE_DISPLAY_NAME_KEY); // Attempt to read language name from node String languageName; if (nameNode == null || (languageName = nameNode.getTextValue()) == null) { logger.warn("Root-level \"" + LANGUAGE_DISPLAY_NAME_KEY + "\" string missing or invalid in language \"{}\"", languageKey); languageName = languageKey; } // Add language key/name pair to map languageNames.put(languageKey, languageName); } // Continue with next language if unable to read catch (IOException e) { logger.warn("Unable to read language resource \"{}\".", languageKey); logger.debug("Error reading language resource.", e); } } return Collections.unmodifiableMap(languageNames); }
java
public Map<String, String> getLanguageNames() { Map<String, String> languageNames = new HashMap<String, String>(); // For each language key/resource pair for (Map.Entry<String, Resource> entry : resources.entrySet()) { // Get language key and resource String languageKey = entry.getKey(); Resource resource = entry.getValue(); // Get stream for resource InputStream resourceStream = resource.asStream(); if (resourceStream == null) { logger.warn("Expected language resource does not exist: \"{}\".", languageKey); continue; } // Get name node of language try { JsonNode tree = mapper.readTree(resourceStream); JsonNode nameNode = tree.get(LANGUAGE_DISPLAY_NAME_KEY); // Attempt to read language name from node String languageName; if (nameNode == null || (languageName = nameNode.getTextValue()) == null) { logger.warn("Root-level \"" + LANGUAGE_DISPLAY_NAME_KEY + "\" string missing or invalid in language \"{}\"", languageKey); languageName = languageKey; } // Add language key/name pair to map languageNames.put(languageKey, languageName); } // Continue with next language if unable to read catch (IOException e) { logger.warn("Unable to read language resource \"{}\".", languageKey); logger.debug("Error reading language resource.", e); } } return Collections.unmodifiableMap(languageNames); }
[ "public", "Map", "<", "String", ",", "String", ">", "getLanguageNames", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "languageNames", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "// For each language key/resource pair...
Returns a mapping of all language keys to their corresponding human- readable language names. If an error occurs while parsing a language resource, its key/name pair will simply be omitted. The returned map cannot be modified. @return A map of all language keys and their corresponding human-readable names.
[ "Returns", "a", "mapping", "of", "all", "language", "keys", "to", "their", "corresponding", "human", "-", "readable", "language", "names", ".", "If", "an", "error", "occurs", "while", "parsing", "a", "language", "resource", "its", "key", "/", "name", "pair",...
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/extension/LanguageResourceService.java#L403-L448
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java
GeneratedDConnectionDaoImpl.queryByUserRoles
public Iterable<DConnection> queryByUserRoles(java.lang.String userRoles) { return queryByField(null, DConnectionMapper.Field.USERROLES.getFieldName(), userRoles); }
java
public Iterable<DConnection> queryByUserRoles(java.lang.String userRoles) { return queryByField(null, DConnectionMapper.Field.USERROLES.getFieldName(), userRoles); }
[ "public", "Iterable", "<", "DConnection", ">", "queryByUserRoles", "(", "java", ".", "lang", ".", "String", "userRoles", ")", "{", "return", "queryByField", "(", "null", ",", "DConnectionMapper", ".", "Field", ".", "USERROLES", ".", "getFieldName", "(", ")", ...
query-by method for field userRoles @param userRoles the specified attribute @return an Iterable of DConnections for the specified userRoles
[ "query", "-", "by", "method", "for", "field", "userRoles" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L178-L180
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/DataTable.java
DataTable.setHeadings
public void setHeadings(int i, String v) { if (DataTable_Type.featOkTst && ((DataTable_Type)jcasType).casFeat_headings == null) jcasType.jcas.throwFeatMissing("headings", "ch.epfl.bbp.uima.types.DataTable"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DataTable_Type)jcasType).casFeatCode_headings), i); jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DataTable_Type)jcasType).casFeatCode_headings), i, v);}
java
public void setHeadings(int i, String v) { if (DataTable_Type.featOkTst && ((DataTable_Type)jcasType).casFeat_headings == null) jcasType.jcas.throwFeatMissing("headings", "ch.epfl.bbp.uima.types.DataTable"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DataTable_Type)jcasType).casFeatCode_headings), i); jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DataTable_Type)jcasType).casFeatCode_headings), i, v);}
[ "public", "void", "setHeadings", "(", "int", "i", ",", "String", "v", ")", "{", "if", "(", "DataTable_Type", ".", "featOkTst", "&&", "(", "(", "DataTable_Type", ")", "jcasType", ")", ".", "casFeat_headings", "==", "null", ")", "jcasType", ".", "jcas", "....
indexed setter for headings - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "headings", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/DataTable.java#L205-L209
whitesource/agents
wss-agent-client/src/main/java/org/whitesource/agent/client/WssServiceClientImpl.java
WssServiceClientImpl.extractResultData
protected String extractResultData(String response) throws IOException, WssServiceException { // parse response ResultEnvelope envelope = gson.fromJson(response, ResultEnvelope.class); if (envelope == null) { throw new WssServiceException("Empty response, response data is: " + response); } // extract info from envelope String message = envelope.getMessage(); String data = envelope.getData(); String requestToken = envelope.getRequestToken(); // service fault ? if (ResultEnvelope.STATUS_SUCCESS != envelope.getStatus()) { throw new WssServiceException(message + ": " + data, requestToken); } return data; }
java
protected String extractResultData(String response) throws IOException, WssServiceException { // parse response ResultEnvelope envelope = gson.fromJson(response, ResultEnvelope.class); if (envelope == null) { throw new WssServiceException("Empty response, response data is: " + response); } // extract info from envelope String message = envelope.getMessage(); String data = envelope.getData(); String requestToken = envelope.getRequestToken(); // service fault ? if (ResultEnvelope.STATUS_SUCCESS != envelope.getStatus()) { throw new WssServiceException(message + ": " + data, requestToken); } return data; }
[ "protected", "String", "extractResultData", "(", "String", "response", ")", "throws", "IOException", ",", "WssServiceException", "{", "// parse response", "ResultEnvelope", "envelope", "=", "gson", ".", "fromJson", "(", "response", ",", "ResultEnvelope", ".", "class",...
The method extract the data from the given {@link org.whitesource.agent.api.dispatch.ResultEnvelope}. @param response HTTP response as string. @return String with logical result in JSON format. @throws IOException @throws WssServiceException
[ "The", "method", "extract", "the", "data", "from", "the", "given", "{", "@link", "org", ".", "whitesource", ".", "agent", ".", "api", ".", "dispatch", ".", "ResultEnvelope", "}", "." ]
train
https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-client/src/main/java/org/whitesource/agent/client/WssServiceClientImpl.java#L419-L436
apereo/cas
support/cas-server-support-grouper-core/src/main/java/org/apereo/cas/grouper/GrouperFacade.java
GrouperFacade.getGrouperGroupAttribute
public static String getGrouperGroupAttribute(final GrouperGroupField groupField, final WsGroup group) { switch (groupField) { case DISPLAY_EXTENSION: return group.getDisplayExtension(); case DISPLAY_NAME: return group.getDisplayName(); case EXTENSION: return group.getExtension(); case NAME: default: return group.getName(); } }
java
public static String getGrouperGroupAttribute(final GrouperGroupField groupField, final WsGroup group) { switch (groupField) { case DISPLAY_EXTENSION: return group.getDisplayExtension(); case DISPLAY_NAME: return group.getDisplayName(); case EXTENSION: return group.getExtension(); case NAME: default: return group.getName(); } }
[ "public", "static", "String", "getGrouperGroupAttribute", "(", "final", "GrouperGroupField", "groupField", ",", "final", "WsGroup", "group", ")", "{", "switch", "(", "groupField", ")", "{", "case", "DISPLAY_EXTENSION", ":", "return", "group", ".", "getDisplayExtensi...
Construct grouper group attribute. This is the name of every individual group attribute transformed into a CAS attribute value. @param groupField the group field @param group the group @return the final attribute name
[ "Construct", "grouper", "group", "attribute", ".", "This", "is", "the", "name", "of", "every", "individual", "group", "attribute", "transformed", "into", "a", "CAS", "attribute", "value", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-grouper-core/src/main/java/org/apereo/cas/grouper/GrouperFacade.java#L33-L45
samskivert/samskivert
src/main/java/com/samskivert/util/ConfigUtil.java
ConfigUtil.loadInheritedProperties
public static Properties loadInheritedProperties (String path, ClassLoader loader) throws IOException { Properties props = new Properties(); loadInheritedProperties(path, loader, props); return props; }
java
public static Properties loadInheritedProperties (String path, ClassLoader loader) throws IOException { Properties props = new Properties(); loadInheritedProperties(path, loader, props); return props; }
[ "public", "static", "Properties", "loadInheritedProperties", "(", "String", "path", ",", "ClassLoader", "loader", ")", "throws", "IOException", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "loadInheritedProperties", "(", "path", ",", "loade...
Like {@link #loadInheritedProperties(String)} but this method uses the supplied class loader rather than the class loader used to load the <code>ConfigUtil</code> class.
[ "Like", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ConfigUtil.java#L224-L230
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/DefaultMongoDBDataHandler.java
DefaultMongoDBDataHandler.getLobFromGFSEntity
public Object getLobFromGFSEntity(GridFS gfs, EntityMetadata m, Object entity, KunderaMetadata kunderaMetadata) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata() .getMetamodel(m.getPersistenceUnit()); EntityType entityType = metaModel.entity(m.getEntityClazz()); Set<Attribute> columns = entityType.getAttributes(); for (Attribute column : columns) { boolean isLob = ((Field) column.getJavaMember()).getAnnotation(Lob.class) != null; if (isLob) { return PropertyAccessorHelper.getObject(entity, (Field) column.getJavaMember()); } } return null; }
java
public Object getLobFromGFSEntity(GridFS gfs, EntityMetadata m, Object entity, KunderaMetadata kunderaMetadata) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata() .getMetamodel(m.getPersistenceUnit()); EntityType entityType = metaModel.entity(m.getEntityClazz()); Set<Attribute> columns = entityType.getAttributes(); for (Attribute column : columns) { boolean isLob = ((Field) column.getJavaMember()).getAnnotation(Lob.class) != null; if (isLob) { return PropertyAccessorHelper.getObject(entity, (Field) column.getJavaMember()); } } return null; }
[ "public", "Object", "getLobFromGFSEntity", "(", "GridFS", "gfs", ",", "EntityMetadata", "m", ",", "Object", "entity", ",", "KunderaMetadata", "kunderaMetadata", ")", "{", "MetamodelImpl", "metaModel", "=", "(", "MetamodelImpl", ")", "kunderaMetadata", ".", "getAppli...
Gets the lob from GFS entity. @param gfs the gfs @param m the m @param entity the entity @param kunderaMetadata the kundera metadata @return the lob from gfs entity
[ "Gets", "the", "lob", "from", "GFS", "entity", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/DefaultMongoDBDataHandler.java#L650-L665
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/util/Ascii.java
Ascii.startsWithIgnoreCase
public static boolean startsWithIgnoreCase(CharSequence seq, CharSequence prefix, int fromIndex) { int seqOffset = fromIndex; int prefixOffset = 0; int prefixCounter = prefix.length(); // Note: fromIndex might be near -1>>>1. if ((fromIndex < 0) || (fromIndex > seq.length() - prefixCounter)) { return false; } while (--prefixCounter >= 0) { char charSeq = seq.charAt(seqOffset++); char charPrefix = prefix.charAt(prefixOffset++); if (charSeq == charPrefix) { continue; } int seqAlphaIndex = getAlphaIndex(charSeq); if (seqAlphaIndex < 26 && seqAlphaIndex == getAlphaIndex(charPrefix)) { continue; } return false; } return true; }
java
public static boolean startsWithIgnoreCase(CharSequence seq, CharSequence prefix, int fromIndex) { int seqOffset = fromIndex; int prefixOffset = 0; int prefixCounter = prefix.length(); // Note: fromIndex might be near -1>>>1. if ((fromIndex < 0) || (fromIndex > seq.length() - prefixCounter)) { return false; } while (--prefixCounter >= 0) { char charSeq = seq.charAt(seqOffset++); char charPrefix = prefix.charAt(prefixOffset++); if (charSeq == charPrefix) { continue; } int seqAlphaIndex = getAlphaIndex(charSeq); if (seqAlphaIndex < 26 && seqAlphaIndex == getAlphaIndex(charPrefix)) { continue; } return false; } return true; }
[ "public", "static", "boolean", "startsWithIgnoreCase", "(", "CharSequence", "seq", ",", "CharSequence", "prefix", ",", "int", "fromIndex", ")", "{", "int", "seqOffset", "=", "fromIndex", ";", "int", "prefixOffset", "=", "0", ";", "int", "prefixCounter", "=", "...
Returns if the character sequence {@code seq} starts with the character sequence {@code prefix} starting at {@code fromIndex}, ignoring the case of any ASCII alphabetic characters between {@code 'a'} and {@code 'z'} or {@code 'A'} and {@code 'Z'} inclusive. @since NEXT
[ "Returns", "if", "the", "character", "sequence", "{", "@code", "seq", "}", "starts", "with", "the", "character", "sequence", "{", "@code", "prefix", "}", "starting", "at", "{", "@code", "fromIndex", "}", "ignoring", "the", "case", "of", "any", "ASCII", "al...
train
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/util/Ascii.java#L154-L175
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java
EntityJsonParser.parseEntityJson
public EntityJson parseEntityJson(Object instanceSource, Reader instanceReader) throws SchemaValidationException, InvalidInstanceException { try { return new EntityJson(validate(ENTITY_JSON_SCHEMA_URL, instanceSource, instanceReader)); } catch (NoSchemaException | InvalidSchemaException e) { // In theory this cannot happen throw new RuntimeException(e); } }
java
public EntityJson parseEntityJson(Object instanceSource, Reader instanceReader) throws SchemaValidationException, InvalidInstanceException { try { return new EntityJson(validate(ENTITY_JSON_SCHEMA_URL, instanceSource, instanceReader)); } catch (NoSchemaException | InvalidSchemaException e) { // In theory this cannot happen throw new RuntimeException(e); } }
[ "public", "EntityJson", "parseEntityJson", "(", "Object", "instanceSource", ",", "Reader", "instanceReader", ")", "throws", "SchemaValidationException", ",", "InvalidInstanceException", "{", "try", "{", "return", "new", "EntityJson", "(", "validate", "(", "ENTITY_JSON_S...
Parse an EntityJSON instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way. @param instanceSource An object describing the source of the instance, typically an instance of java.net.URL or java.io.File. @param instanceReader A Reader containing the JSON representation of an EntityJSON instance. @return An EntityJSON instance. @throws SchemaValidationException If the given instance does not meet the general EntityJSON schema. @throws InvalidInstanceException If the given instance is structurally invalid.
[ "Parse", "an", "EntityJSON", "instance", "from", "the", "given", "URL", "." ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java#L135-L146
linkedin/PalDB
paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java
Serializers.getSerializer
Serializer getSerializer(int index) { if (index >= serializersArray.length) { throw new IllegalArgumentException(String.format("The serializer can't be found at index %d", index)); } return serializersArray[index]; }
java
Serializer getSerializer(int index) { if (index >= serializersArray.length) { throw new IllegalArgumentException(String.format("The serializer can't be found at index %d", index)); } return serializersArray[index]; }
[ "Serializer", "getSerializer", "(", "int", "index", ")", "{", "if", "(", "index", ">=", "serializersArray", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"The serializer can't be found at index %d\"", ",", ...
Returns the serializer given the index. @param index serializer index @return serializer
[ "Returns", "the", "serializer", "given", "the", "index", "." ]
train
https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java#L237-L242
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java
IntegerExtensions.bitwiseAnd
@Pure @Inline(value="($1 & $2)", constantExpression=true) public static int bitwiseAnd(int a, int b) { return a & b; }
java
@Pure @Inline(value="($1 & $2)", constantExpression=true) public static int bitwiseAnd(int a, int b) { return a & b; }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"($1 & $2)\"", ",", "constantExpression", "=", "true", ")", "public", "static", "int", "bitwiseAnd", "(", "int", "a", ",", "int", "b", ")", "{", "return", "a", "&", "b", ";", "}" ]
The bitwise <code>and</code> operation. This is the equivalent to the java <code>&</code> operator. @param a an integer. @param b an integer. @return <code>a&b</code>
[ "The", "bitwise", "<code", ">", "and<", "/", "code", ">", "operation", ".", "This", "is", "the", "equivalent", "to", "the", "java", "<code", ">", "&<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java#L106-L110
google/closure-compiler
src/com/google/javascript/jscomp/TypedScopeCreator.java
TypedScopeCreator.createInitialScope
@VisibleForTesting TypedScope createInitialScope(Node root) { checkArgument(root.isRoot(), root); NodeTraversal.traverse( compiler, root, new IdentifyGlobalEnumsAndTypedefsAsNonNullable(typeRegistry, codingConvention)); TypedScope s = TypedScope.createGlobalScope(root); declareNativeFunctionType(s, ARRAY_FUNCTION_TYPE); declareNativeFunctionType(s, BOOLEAN_OBJECT_FUNCTION_TYPE); declareNativeFunctionType(s, DATE_FUNCTION_TYPE); declareNativeFunctionType(s, FUNCTION_FUNCTION_TYPE); declareNativeFunctionType(s, GENERATOR_FUNCTION_TYPE); declareNativeFunctionType(s, ITERABLE_FUNCTION_TYPE); declareNativeFunctionType(s, ITERATOR_FUNCTION_TYPE); declareNativeFunctionType(s, NUMBER_OBJECT_FUNCTION_TYPE); declareNativeFunctionType(s, OBJECT_FUNCTION_TYPE); declareNativeFunctionType(s, REGEXP_FUNCTION_TYPE); declareNativeFunctionType(s, STRING_OBJECT_FUNCTION_TYPE); declareNativeValueType(s, "undefined", VOID_TYPE); gatherAllProvides(root); return s; }
java
@VisibleForTesting TypedScope createInitialScope(Node root) { checkArgument(root.isRoot(), root); NodeTraversal.traverse( compiler, root, new IdentifyGlobalEnumsAndTypedefsAsNonNullable(typeRegistry, codingConvention)); TypedScope s = TypedScope.createGlobalScope(root); declareNativeFunctionType(s, ARRAY_FUNCTION_TYPE); declareNativeFunctionType(s, BOOLEAN_OBJECT_FUNCTION_TYPE); declareNativeFunctionType(s, DATE_FUNCTION_TYPE); declareNativeFunctionType(s, FUNCTION_FUNCTION_TYPE); declareNativeFunctionType(s, GENERATOR_FUNCTION_TYPE); declareNativeFunctionType(s, ITERABLE_FUNCTION_TYPE); declareNativeFunctionType(s, ITERATOR_FUNCTION_TYPE); declareNativeFunctionType(s, NUMBER_OBJECT_FUNCTION_TYPE); declareNativeFunctionType(s, OBJECT_FUNCTION_TYPE); declareNativeFunctionType(s, REGEXP_FUNCTION_TYPE); declareNativeFunctionType(s, STRING_OBJECT_FUNCTION_TYPE); declareNativeValueType(s, "undefined", VOID_TYPE); gatherAllProvides(root); return s; }
[ "@", "VisibleForTesting", "TypedScope", "createInitialScope", "(", "Node", "root", ")", "{", "checkArgument", "(", "root", ".", "isRoot", "(", ")", ",", "root", ")", ";", "NodeTraversal", ".", "traverse", "(", "compiler", ",", "root", ",", "new", "IdentifyGl...
Create the outermost scope. This scope contains native binding such as {@code Object}, {@code Date}, etc. @param root The global ROOT node
[ "Create", "the", "outermost", "scope", ".", "This", "scope", "contains", "native", "binding", "such", "as", "{", "@code", "Object", "}", "{", "@code", "Date", "}", "etc", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L611-L637
lucee/Lucee
core/src/main/java/lucee/runtime/converter/ScriptConverter.java
ScriptConverter._serializeMap
private void _serializeMap(Map map, StringBuilder sb, Set<Object> done) throws ConverterException { if (map instanceof Serializable) { _serializeSerializable((Serializable) map, sb); return; } sb.append(goIn()); sb.append("{"); Iterator it = map.keySet().iterator(); boolean doIt = false; deep++; while (it.hasNext()) { Object key = it.next(); if (doIt) sb.append(','); doIt = true; sb.append(QUOTE_CHR); sb.append(escape(key.toString())); sb.append(QUOTE_CHR); sb.append(':'); _serialize(map.get(key), sb, done); } deep--; sb.append('}'); }
java
private void _serializeMap(Map map, StringBuilder sb, Set<Object> done) throws ConverterException { if (map instanceof Serializable) { _serializeSerializable((Serializable) map, sb); return; } sb.append(goIn()); sb.append("{"); Iterator it = map.keySet().iterator(); boolean doIt = false; deep++; while (it.hasNext()) { Object key = it.next(); if (doIt) sb.append(','); doIt = true; sb.append(QUOTE_CHR); sb.append(escape(key.toString())); sb.append(QUOTE_CHR); sb.append(':'); _serialize(map.get(key), sb, done); } deep--; sb.append('}'); }
[ "private", "void", "_serializeMap", "(", "Map", "map", ",", "StringBuilder", "sb", ",", "Set", "<", "Object", ">", "done", ")", "throws", "ConverterException", "{", "if", "(", "map", "instanceof", "Serializable", ")", "{", "_serializeSerializable", "(", "(", ...
serialize a Map (as Struct) @param map Map to serialize @param sb @param done @throws ConverterException
[ "serialize", "a", "Map", "(", "as", "Struct", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/ScriptConverter.java#L240-L264
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/profile/impl/AbstractSAML2ResponseValidator.java
AbstractSAML2ResponseValidator.validateSignature
protected final void validateSignature(final Signature signature, final String idpEntityId, final SignatureTrustEngine trustEngine) { final SAMLSignatureProfileValidator validator = new SAMLSignatureProfileValidator(); try { validator.validate(signature); } catch (final SignatureException e) { throw new SAMLSignatureValidationException("SAMLSignatureProfileValidator failed to validate signature", e); } final CriteriaSet criteriaSet = new CriteriaSet(); criteriaSet.add(new UsageCriterion(UsageType.SIGNING)); criteriaSet.add(new EntityRoleCriterion(IDPSSODescriptor.DEFAULT_ELEMENT_NAME)); criteriaSet.add(new ProtocolCriterion(SAMLConstants.SAML20P_NS)); criteriaSet.add(new EntityIdCriterion(idpEntityId)); final boolean valid; try { valid = trustEngine.validate(signature, criteriaSet); } catch (final SecurityException e) { throw new SAMLSignatureValidationException("An error occurred during signature validation", e); } if (!valid) { throw new SAMLSignatureValidationException("Signature is not trusted"); } }
java
protected final void validateSignature(final Signature signature, final String idpEntityId, final SignatureTrustEngine trustEngine) { final SAMLSignatureProfileValidator validator = new SAMLSignatureProfileValidator(); try { validator.validate(signature); } catch (final SignatureException e) { throw new SAMLSignatureValidationException("SAMLSignatureProfileValidator failed to validate signature", e); } final CriteriaSet criteriaSet = new CriteriaSet(); criteriaSet.add(new UsageCriterion(UsageType.SIGNING)); criteriaSet.add(new EntityRoleCriterion(IDPSSODescriptor.DEFAULT_ELEMENT_NAME)); criteriaSet.add(new ProtocolCriterion(SAMLConstants.SAML20P_NS)); criteriaSet.add(new EntityIdCriterion(idpEntityId)); final boolean valid; try { valid = trustEngine.validate(signature, criteriaSet); } catch (final SecurityException e) { throw new SAMLSignatureValidationException("An error occurred during signature validation", e); } if (!valid) { throw new SAMLSignatureValidationException("Signature is not trusted"); } }
[ "protected", "final", "void", "validateSignature", "(", "final", "Signature", "signature", ",", "final", "String", "idpEntityId", ",", "final", "SignatureTrustEngine", "trustEngine", ")", "{", "final", "SAMLSignatureProfileValidator", "validator", "=", "new", "SAMLSigna...
Validate the given digital signature by checking its profile and value. @param signature the signature @param idpEntityId the idp entity id @param trustEngine the trust engine
[ "Validate", "the", "given", "digital", "signature", "by", "checking", "its", "profile", "and", "value", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/profile/impl/AbstractSAML2ResponseValidator.java#L99-L123
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addEqualsIgnoreCaseCondition
protected void addEqualsIgnoreCaseCondition(final String propertyName, final String value) { final Expression<String> propertyNameField = getCriteriaBuilder().lower(getRootPath().get(propertyName).as(String.class)); fieldConditions.add(getCriteriaBuilder().equal(propertyNameField, value.toString())); }
java
protected void addEqualsIgnoreCaseCondition(final String propertyName, final String value) { final Expression<String> propertyNameField = getCriteriaBuilder().lower(getRootPath().get(propertyName).as(String.class)); fieldConditions.add(getCriteriaBuilder().equal(propertyNameField, value.toString())); }
[ "protected", "void", "addEqualsIgnoreCaseCondition", "(", "final", "String", "propertyName", ",", "final", "String", "value", ")", "{", "final", "Expression", "<", "String", ">", "propertyNameField", "=", "getCriteriaBuilder", "(", ")", ".", "lower", "(", "getRoot...
Add a Field Search Condition that will search a field for a specified value using the following SQL logic: {@code lower(field) = 'value'} @param propertyName The name of the field as defined in the Entity mapping class. @param value The value to search against.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "search", "a", "field", "for", "a", "specified", "value", "using", "the", "following", "SQL", "logic", ":", "{", "@code", "lower", "(", "field", ")", "=", "value", "}" ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L474-L477
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java
HylaFaxJob.getProperty
public String getProperty(String key,String defaultValue) { String value=null; try { value=this.JOB.getProperty(key); } catch(Exception exception) { throw new FaxException("Error while extracting job property.",exception); } if(value==null) { value=defaultValue; } return value; }
java
public String getProperty(String key,String defaultValue) { String value=null; try { value=this.JOB.getProperty(key); } catch(Exception exception) { throw new FaxException("Error while extracting job property.",exception); } if(value==null) { value=defaultValue; } return value; }
[ "public", "String", "getProperty", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "String", "value", "=", "null", ";", "try", "{", "value", "=", "this", ".", "JOB", ".", "getProperty", "(", "key", ")", ";", "}", "catch", "(", "Exception...
This function returns the fax job property for the given key. @param key The property key @param defaultValue The default value @return The property value
[ "This", "function", "returns", "the", "fax", "job", "property", "for", "the", "given", "key", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java#L330-L348
elki-project/elki
elki-timeseries/src/main/java/de/lmu/ifi/dbs/elki/algorithm/timeseries/OfflineChangePointDetectionAlgorithm.java
OfflineChangePointDetectionAlgorithm.cusum
public static void cusum(double[] data, double[] out, int begin, int end) { assert (out.length >= data.length); // Use Kahan summation for better precision! // FIXME: this should be unit tested. double m = 0., carry = 0.; for(int i = begin; i < end; i++) { double v = data[i] - carry; // Compensation double n = out[i] = (m + v); // May lose small digits of v. carry = (n - m) - v; // Recover lost bits m = n; } }
java
public static void cusum(double[] data, double[] out, int begin, int end) { assert (out.length >= data.length); // Use Kahan summation for better precision! // FIXME: this should be unit tested. double m = 0., carry = 0.; for(int i = begin; i < end; i++) { double v = data[i] - carry; // Compensation double n = out[i] = (m + v); // May lose small digits of v. carry = (n - m) - v; // Recover lost bits m = n; } }
[ "public", "static", "void", "cusum", "(", "double", "[", "]", "data", ",", "double", "[", "]", "out", ",", "int", "begin", ",", "int", "end", ")", "{", "assert", "(", "out", ".", "length", ">=", "data", ".", "length", ")", ";", "// Use Kahan summatio...
Compute the incremental sum of an array, i.e. the sum of all points up to the given index. @param data Input data @param out Output array (must be large enough).
[ "Compute", "the", "incremental", "sum", "of", "an", "array", "i", ".", "e", ".", "the", "sum", "of", "all", "points", "up", "to", "the", "given", "index", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-timeseries/src/main/java/de/lmu/ifi/dbs/elki/algorithm/timeseries/OfflineChangePointDetectionAlgorithm.java#L274-L285
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java
PublicIPAddressesInner.beginUpdateTags
public PublicIPAddressInner beginUpdateTags(String resourceGroupName, String publicIpAddressName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpAddressName, tags).toBlocking().single().body(); }
java
public PublicIPAddressInner beginUpdateTags(String resourceGroupName, String publicIpAddressName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpAddressName, tags).toBlocking().single().body(); }
[ "public", "PublicIPAddressInner", "beginUpdateTags", "(", "String", "resourceGroupName", ",", "String", "publicIpAddressName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ...
Updates public IP address tags. @param resourceGroupName The name of the resource group. @param publicIpAddressName The name of the public IP address. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PublicIPAddressInner object if successful.
[ "Updates", "public", "IP", "address", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java#L855-L857
buschmais/jqa-core-framework
analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AbstractCypherRuleInterpreterPlugin.java
AbstractCypherRuleInterpreterPlugin.isSuppressedRow
private boolean isSuppressedRow(String ruleId, Map<String, Object> row, String primaryColumn) { Object primaryValue = row.get(primaryColumn); if (primaryValue != null && Suppress.class.isAssignableFrom(primaryValue.getClass())) { Suppress suppress = (Suppress) primaryValue; for (String suppressId : suppress.getSuppressIds()) { if (ruleId.equals(suppressId)) { return true; } } } return false; }
java
private boolean isSuppressedRow(String ruleId, Map<String, Object> row, String primaryColumn) { Object primaryValue = row.get(primaryColumn); if (primaryValue != null && Suppress.class.isAssignableFrom(primaryValue.getClass())) { Suppress suppress = (Suppress) primaryValue; for (String suppressId : suppress.getSuppressIds()) { if (ruleId.equals(suppressId)) { return true; } } } return false; }
[ "private", "boolean", "isSuppressedRow", "(", "String", "ruleId", ",", "Map", "<", "String", ",", "Object", ">", "row", ",", "String", "primaryColumn", ")", "{", "Object", "primaryValue", "=", "row", ".", "get", "(", "primaryColumn", ")", ";", "if", "(", ...
Verifies if the given row shall be suppressed. The primary column is checked if it contains a suppression that matches the current rule id. @param ruleId The rule id. @param row The row. @param primaryColumn The name of the primary column. @return <code>true</code> if the row shall be suppressed.
[ "Verifies", "if", "the", "given", "row", "shall", "be", "suppressed", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AbstractCypherRuleInterpreterPlugin.java#L73-L84
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/GeoPackageExtensions.java
GeoPackageExtensions.deleteMetadata
public static void deleteMetadata(GeoPackageCore geoPackage, String table) { MetadataReferenceDao metadataReferenceDao = geoPackage .getMetadataReferenceDao(); try { if (metadataReferenceDao.isTableExists()) { metadataReferenceDao.deleteByTableName(table); } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Metadata extension. GeoPackage: " + geoPackage.getName() + ", Table: " + table, e); } }
java
public static void deleteMetadata(GeoPackageCore geoPackage, String table) { MetadataReferenceDao metadataReferenceDao = geoPackage .getMetadataReferenceDao(); try { if (metadataReferenceDao.isTableExists()) { metadataReferenceDao.deleteByTableName(table); } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Metadata extension. GeoPackage: " + geoPackage.getName() + ", Table: " + table, e); } }
[ "public", "static", "void", "deleteMetadata", "(", "GeoPackageCore", "geoPackage", ",", "String", "table", ")", "{", "MetadataReferenceDao", "metadataReferenceDao", "=", "geoPackage", ".", "getMetadataReferenceDao", "(", ")", ";", "try", "{", "if", "(", "metadataRef...
Delete the Metadata extensions for the table @param geoPackage GeoPackage @param table table name @since 3.2.0
[ "Delete", "the", "Metadata", "extensions", "for", "the", "table" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/GeoPackageExtensions.java#L358-L372
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ExtensionScript.java
ExtensionScript.hasSameScriptEngine
public static boolean hasSameScriptEngine(ScriptWrapper scriptWrapper, ScriptEngineWrapper engineWrapper) { if (scriptWrapper.getEngine() != null) { return scriptWrapper.getEngine() == engineWrapper; } return isSameScriptEngine(scriptWrapper.getEngineName(), engineWrapper.getEngineName(), engineWrapper.getLanguageName()); }
java
public static boolean hasSameScriptEngine(ScriptWrapper scriptWrapper, ScriptEngineWrapper engineWrapper) { if (scriptWrapper.getEngine() != null) { return scriptWrapper.getEngine() == engineWrapper; } return isSameScriptEngine(scriptWrapper.getEngineName(), engineWrapper.getEngineName(), engineWrapper.getLanguageName()); }
[ "public", "static", "boolean", "hasSameScriptEngine", "(", "ScriptWrapper", "scriptWrapper", ",", "ScriptEngineWrapper", "engineWrapper", ")", "{", "if", "(", "scriptWrapper", ".", "getEngine", "(", ")", "!=", "null", ")", "{", "return", "scriptWrapper", ".", "get...
Tells whether or not the given {@code scriptWrapper} has the given {@code engineWrapper}. <p> If the given {@code scriptWrapper} has an engine set it's checked by reference (operator {@code ==}), otherwise it's used the engine names. @param scriptWrapper the script wrapper that will be checked @param engineWrapper the engine that will be checked against the engine of the script @return {@code true} if the given script has the given engine, {@code false} otherwise. @since 2.4.0 @see #isSameScriptEngine(String, String, String)
[ "Tells", "whether", "or", "not", "the", "given", "{", "@code", "scriptWrapper", "}", "has", "the", "given", "{", "@code", "engineWrapper", "}", ".", "<p", ">", "If", "the", "given", "{", "@code", "scriptWrapper", "}", "has", "an", "engine", "set", "it", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ExtensionScript.java#L347-L353
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.withField
public Period withField(DurationFieldType field, int value) { if (field == null) { throw new IllegalArgumentException("Field must not be null"); } int[] newValues = getValues(); // cloned super.setFieldInto(newValues, field, value); return new Period(newValues, getPeriodType()); }
java
public Period withField(DurationFieldType field, int value) { if (field == null) { throw new IllegalArgumentException("Field must not be null"); } int[] newValues = getValues(); // cloned super.setFieldInto(newValues, field, value); return new Period(newValues, getPeriodType()); }
[ "public", "Period", "withField", "(", "DurationFieldType", "field", ",", "int", "value", ")", "{", "if", "(", "field", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Field must not be null\"", ")", ";", "}", "int", "[", "]", "new...
Creates a new Period instance with the specified field set to a new value. <p> This period instance is immutable and unaffected by this method call. @param field the field to set, not null @param value the value to set to @return the new period instance @throws IllegalArgumentException if the field type is null or unsupported
[ "Creates", "a", "new", "Period", "instance", "with", "the", "specified", "field", "set", "to", "a", "new", "value", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L873-L880
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java
RegistriesInner.regenerateCredentialAsync
public Observable<RegistryListCredentialsResultInner> regenerateCredentialAsync(String resourceGroupName, String registryName, PasswordName name) { return regenerateCredentialWithServiceResponseAsync(resourceGroupName, registryName, name).map(new Func1<ServiceResponse<RegistryListCredentialsResultInner>, RegistryListCredentialsResultInner>() { @Override public RegistryListCredentialsResultInner call(ServiceResponse<RegistryListCredentialsResultInner> response) { return response.body(); } }); }
java
public Observable<RegistryListCredentialsResultInner> regenerateCredentialAsync(String resourceGroupName, String registryName, PasswordName name) { return regenerateCredentialWithServiceResponseAsync(resourceGroupName, registryName, name).map(new Func1<ServiceResponse<RegistryListCredentialsResultInner>, RegistryListCredentialsResultInner>() { @Override public RegistryListCredentialsResultInner call(ServiceResponse<RegistryListCredentialsResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RegistryListCredentialsResultInner", ">", "regenerateCredentialAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "PasswordName", "name", ")", "{", "return", "regenerateCredentialWithServiceResponseAsync", "(", "resou...
Regenerates one of the login credentials for the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param name Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'password', 'password2' @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RegistryListCredentialsResultInner object
[ "Regenerates", "one", "of", "the", "login", "credentials", "for", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java#L989-L996
UrielCh/ovh-java-sdk
ovh-java-sdk-support/src/main/java/net/minidev/ovh/api/ApiOvhSupport.java
ApiOvhSupport.tickets_ticketId_reply_POST
public void tickets_ticketId_reply_POST(Long ticketId, String body) throws IOException { String qPath = "/support/tickets/{ticketId}/reply"; StringBuilder sb = path(qPath, ticketId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "body", body); exec(qPath, "POST", sb.toString(), o); }
java
public void tickets_ticketId_reply_POST(Long ticketId, String body) throws IOException { String qPath = "/support/tickets/{ticketId}/reply"; StringBuilder sb = path(qPath, ticketId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "body", body); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "tickets_ticketId_reply_POST", "(", "Long", "ticketId", ",", "String", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/support/tickets/{ticketId}/reply\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ticketId...
Reply to ticket REST: POST /support/tickets/{ticketId}/reply @param ticketId [required] internal ticket identifier @param body [required] text body of ticket response
[ "Reply", "to", "ticket" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-support/src/main/java/net/minidev/ovh/api/ApiOvhSupport.java#L36-L42
rhuss/jolokia
agent/core/src/main/java/org/jolokia/converter/object/StringToObjectConverter.java
StringToObjectConverter.prepareValue
public Object prepareValue(String pExpectedClassName, Object pValue) { if (pValue == null) { return null; } else { Class expectedClass = ClassUtil.classForName(pExpectedClassName); Object param = null; if (expectedClass != null) { param = prepareValue(expectedClass,pValue); } if (param == null) { // Ok, we try to convert it from a string // If expectedClass is null, it is probably a native type, so we // let happen the string conversion // later on (e.g. conversion of pArgument.toString()) which will throw // an exception at this point if conversion can not be done return convertFromString(pExpectedClassName, pValue.toString()); } return param; } }
java
public Object prepareValue(String pExpectedClassName, Object pValue) { if (pValue == null) { return null; } else { Class expectedClass = ClassUtil.classForName(pExpectedClassName); Object param = null; if (expectedClass != null) { param = prepareValue(expectedClass,pValue); } if (param == null) { // Ok, we try to convert it from a string // If expectedClass is null, it is probably a native type, so we // let happen the string conversion // later on (e.g. conversion of pArgument.toString()) which will throw // an exception at this point if conversion can not be done return convertFromString(pExpectedClassName, pValue.toString()); } return param; } }
[ "public", "Object", "prepareValue", "(", "String", "pExpectedClassName", ",", "Object", "pValue", ")", "{", "if", "(", "pValue", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "Class", "expectedClass", "=", "ClassUtil", ".", "classForName",...
Prepare a value from a either a given object or its string representation. If the value is already assignable to the given class name it is returned directly. @param pExpectedClassName type name of the expected type @param pValue value to either take directly or to convert from its string representation. @return the prepared / converted object
[ "Prepare", "a", "value", "from", "a", "either", "a", "given", "object", "or", "its", "string", "representation", ".", "If", "the", "value", "is", "already", "assignable", "to", "the", "given", "class", "name", "it", "is", "returned", "directly", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/object/StringToObjectConverter.java#L98-L118
jbundle/jbundle
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java
HBasePanel.printReport
public void printReport(PrintWriter out, ResourceBundle reg) throws DBException { if (reg == null) reg = ((BaseApplication)this.getTask().getApplication()).getResources(HtmlConstants.HTML_RESOURCE, false); this.printHtmlHeader(out, reg); this.printHtmlMenuStart(out, reg); this.processInputData(out); ((BasePanel)this.getScreenField()).prePrintReport(); this.printScreen(out, reg); this.printHtmlMenuEnd(out, reg); this.printHtmlTrailer(out, reg); this.printHtmlFooter(out, reg); }
java
public void printReport(PrintWriter out, ResourceBundle reg) throws DBException { if (reg == null) reg = ((BaseApplication)this.getTask().getApplication()).getResources(HtmlConstants.HTML_RESOURCE, false); this.printHtmlHeader(out, reg); this.printHtmlMenuStart(out, reg); this.processInputData(out); ((BasePanel)this.getScreenField()).prePrintReport(); this.printScreen(out, reg); this.printHtmlMenuEnd(out, reg); this.printHtmlTrailer(out, reg); this.printHtmlFooter(out, reg); }
[ "public", "void", "printReport", "(", "PrintWriter", "out", ",", "ResourceBundle", "reg", ")", "throws", "DBException", "{", "if", "(", "reg", "==", "null", ")", "reg", "=", "(", "(", "BaseApplication", ")", "this", ".", "getTask", "(", ")", ".", "getApp...
Output this screen using HTML. Display the html headers, etc. then: <ol> - Parse any parameters passed in and set the field values. - Process any command (such as move=Next). - Render this screen as Html (by calling printHtmlScreen()). </ol> @param out The html out stream. @exception DBException File exception.
[ "Output", "this", "screen", "using", "HTML", ".", "Display", "the", "html", "headers", "etc", ".", "then", ":", "<ol", ">", "-", "Parse", "any", "parameters", "passed", "in", "and", "set", "the", "field", "values", ".", "-", "Process", "any", "command", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L86-L100
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/geomorphology/slope/OmsSlope.java
OmsSlope.calculateSlope
public static double calculateSlope( GridNode node, double flowValue ) { double value = doubleNovalue; if (!isNovalue(flowValue)) { int flowDir = (int) flowValue; if (flowDir != 10) { Direction direction = Direction.forFlow(flowDir); double distance = direction.getDistance(node.xRes, node.yRes); double currentElevation = node.elevation; double nextElevation = node.getElevationAt(direction); value = (currentElevation - nextElevation) / distance; } } return value; }
java
public static double calculateSlope( GridNode node, double flowValue ) { double value = doubleNovalue; if (!isNovalue(flowValue)) { int flowDir = (int) flowValue; if (flowDir != 10) { Direction direction = Direction.forFlow(flowDir); double distance = direction.getDistance(node.xRes, node.yRes); double currentElevation = node.elevation; double nextElevation = node.getElevationAt(direction); value = (currentElevation - nextElevation) / distance; } } return value; }
[ "public", "static", "double", "calculateSlope", "(", "GridNode", "node", ",", "double", "flowValue", ")", "{", "double", "value", "=", "doubleNovalue", ";", "if", "(", "!", "isNovalue", "(", "flowValue", ")", ")", "{", "int", "flowDir", "=", "(", "int", ...
Calculates the slope of a given flowdirection value in currentCol and currentRow. @param node the current {@link GridNode}. @param flowValue the value of the flowdirection. @return
[ "Calculates", "the", "slope", "of", "a", "given", "flowdirection", "value", "in", "currentCol", "and", "currentRow", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/geomorphology/slope/OmsSlope.java#L135-L148
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/android/DbxOfficialAppConnector.java
DbxOfficialAppConnector.getPreviewFileIntent
public Intent getPreviewFileIntent(Context context, String path, String lastRev) { // TODO(jiuyangzhao): Assert path is valid Intent previewIntent = new Intent(ACTION_SHOW_DROPBOX_PREVIEW); addExtrasToIntent(context, previewIntent); previewIntent.putExtra(EXTRA_DROPBOX_PATH, path); previewIntent.putExtra(EXTRA_DROPBOX_REV, lastRev); if (getDropboxAppPackage(context, previewIntent) == null) { return null; } return previewIntent; }
java
public Intent getPreviewFileIntent(Context context, String path, String lastRev) { // TODO(jiuyangzhao): Assert path is valid Intent previewIntent = new Intent(ACTION_SHOW_DROPBOX_PREVIEW); addExtrasToIntent(context, previewIntent); previewIntent.putExtra(EXTRA_DROPBOX_PATH, path); previewIntent.putExtra(EXTRA_DROPBOX_REV, lastRev); if (getDropboxAppPackage(context, previewIntent) == null) { return null; } return previewIntent; }
[ "public", "Intent", "getPreviewFileIntent", "(", "Context", "context", ",", "String", "path", ",", "String", "lastRev", ")", "{", "// TODO(jiuyangzhao): Assert path is valid", "Intent", "previewIntent", "=", "new", "Intent", "(", "ACTION_SHOW_DROPBOX_PREVIEW", ")", ";",...
Display the DropboxApp's preview of file located at path This function should only be called if file was opened through DropboxAPI. If path refers to a directory (as defined by having a '/' at end, will show Dropbox file tree. <p>You won't need to use this unless you are our official partner in openwith.</p> @param path path of file in authorized user's Dropbox to preview @param lastRev The revision of file user is seeing (as returned by DropboxAPI.getFile/DropboxAPI.putFile) @return Intent that when passed into startActivity() displays Dropbox preview Returns null if DropboxApp is not installed
[ "Display", "the", "DropboxApp", "s", "preview", "of", "file", "located", "at", "path", "This", "function", "should", "only", "be", "called", "if", "file", "was", "opened", "through", "DropboxAPI", ".", "If", "path", "refers", "to", "a", "directory", "(", "...
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/android/DbxOfficialAppConnector.java#L312-L323
msteiger/jxmapviewer2
jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java
GraphicsUtilities.createCompatibleImage
public static BufferedImage createCompatibleImage(BufferedImage image, int width, int height) { return isHeadless() ? new BufferedImage(width, height, image.getType()) : getGraphicsConfiguration().createCompatibleImage(width, height, image.getTransparency()); }
java
public static BufferedImage createCompatibleImage(BufferedImage image, int width, int height) { return isHeadless() ? new BufferedImage(width, height, image.getType()) : getGraphicsConfiguration().createCompatibleImage(width, height, image.getTransparency()); }
[ "public", "static", "BufferedImage", "createCompatibleImage", "(", "BufferedImage", "image", ",", "int", "width", ",", "int", "height", ")", "{", "return", "isHeadless", "(", ")", "?", "new", "BufferedImage", "(", "width", ",", "height", ",", "image", ".", "...
<p>Returns a new compatible image of the specified width and height, and the same transparency setting as the image specified as a parameter. That is, the returned <code>BufferedImage</code> is compatible with the graphics hardware. If the method is called in a headless environment, then the returned BufferedImage will be compatible with the source image.</p> @see java.awt.Transparency @see #createCompatibleImage(java.awt.image.BufferedImage) @see #createCompatibleImage(int, int) @see #createCompatibleTranslucentImage(int, int) @see #loadCompatibleImage(java.net.URL) @see #toCompatibleImage(java.awt.image.BufferedImage) @param width the width of the new image @param height the height of the new image @param image the reference image from which the transparency of the new image is obtained @return a new compatible <code>BufferedImage</code> with the same transparency as <code>image</code> and the specified dimension
[ "<p", ">", "Returns", "a", "new", "compatible", "image", "of", "the", "specified", "width", "and", "height", "and", "the", "same", "transparency", "setting", "as", "the", "image", "specified", "as", "a", "parameter", ".", "That", "is", "the", "returned", "...
train
https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java#L193-L199
alipay/sofa-hessian
src/main/java/com/caucho/hessian/io/HessianOutput.java
HessianOutput.writeRemote
public void writeRemote(String type, String url) throws IOException { os.write('r'); os.write('t'); printLenString(type); os.write('S'); printLenString(url); }
java
public void writeRemote(String type, String url) throws IOException { os.write('r'); os.write('t'); printLenString(type); os.write('S'); printLenString(url); }
[ "public", "void", "writeRemote", "(", "String", "type", ",", "String", "url", ")", "throws", "IOException", "{", "os", ".", "write", "(", "'", "'", ")", ";", "os", ".", "write", "(", "'", "'", ")", ";", "printLenString", "(", "type", ")", ";", "os"...
Writes a remote object reference to the stream. The type is the type of the remote interface. <code><pre> 'r' 't' b16 b8 type url </pre></code>
[ "Writes", "a", "remote", "object", "reference", "to", "the", "stream", ".", "The", "type", "is", "the", "type", "of", "the", "remote", "interface", "." ]
train
https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianOutput.java#L402-L410
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/internal/TransferManagerUtils.java
TransferManagerUtils.calculateOptimalPartSize
public static long calculateOptimalPartSize(PutObjectRequest putObjectRequest, TransferManagerConfiguration configuration) { double contentLength = TransferManagerUtils.getContentLength(putObjectRequest); double optimalPartSize = (double)contentLength / (double)MAXIMUM_UPLOAD_PARTS; // round up so we don't push the upload over the maximum number of parts optimalPartSize = Math.ceil(optimalPartSize); return (long)Math.max(optimalPartSize, configuration.getMinimumUploadPartSize()); }
java
public static long calculateOptimalPartSize(PutObjectRequest putObjectRequest, TransferManagerConfiguration configuration) { double contentLength = TransferManagerUtils.getContentLength(putObjectRequest); double optimalPartSize = (double)contentLength / (double)MAXIMUM_UPLOAD_PARTS; // round up so we don't push the upload over the maximum number of parts optimalPartSize = Math.ceil(optimalPartSize); return (long)Math.max(optimalPartSize, configuration.getMinimumUploadPartSize()); }
[ "public", "static", "long", "calculateOptimalPartSize", "(", "PutObjectRequest", "putObjectRequest", ",", "TransferManagerConfiguration", "configuration", ")", "{", "double", "contentLength", "=", "TransferManagerUtils", ".", "getContentLength", "(", "putObjectRequest", ")", ...
Returns the optimal part size, in bytes, for each individual part upload in a multipart upload. @param putObjectRequest The request containing all the details of the upload. @param configuration Configuration values to use when calculating size. @return The optimal part size, in bytes, for each individual part upload in a multipart upload.
[ "Returns", "the", "optimal", "part", "size", "in", "bytes", "for", "each", "individual", "part", "upload", "in", "a", "multipart", "upload", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/internal/TransferManagerUtils.java#L118-L124
googleads/googleads-java-lib
modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/utils/v201805/StatementBuilder.java
StatementBuilder.withBindVariableValue
public StatementBuilder withBindVariableValue(String key, Object value) { return withBindVariableValue(key, Pql.createValue(value)); }
java
public StatementBuilder withBindVariableValue(String key, Object value) { return withBindVariableValue(key, Pql.createValue(value)); }
[ "public", "StatementBuilder", "withBindVariableValue", "(", "String", "key", ",", "Object", "value", ")", "{", "return", "withBindVariableValue", "(", "key", ",", "Pql", ".", "createValue", "(", "value", ")", ")", ";", "}" ]
Adds a bind variable value to the statement. The value will converted according to {@link Pql#createValue(Object)}. If the value is of type {@code Value}, no conversion will be done. @param key the value key @param value the bind variable value @return a reference to this object
[ "Adds", "a", "bind", "variable", "value", "to", "the", "statement", ".", "The", "value", "will", "converted", "according", "to", "{", "@link", "Pql#createValue", "(", "Object", ")", "}", ".", "If", "the", "value", "is", "of", "type", "{", "@code", "Value...
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/utils/v201805/StatementBuilder.java#L76-L78
google/allocation-instrumenter
src/main/java/com/google/monitoring/runtime/instrumentation/AllocationMethodAdapter.java
AllocationMethodAdapter.visitTypeInsn
@Override public void visitTypeInsn(int opcode, String typeName) { if (opcode == Opcodes.NEW) { // We can't actually tag this object right after allocation because it // must be initialized with a ctor before we can touch it (Verifier // enforces this). Instead, we just note it and tag following // initialization. super.visitTypeInsn(opcode, typeName); ++outstandingAllocs; } else if (opcode == Opcodes.ANEWARRAY) { super.visitInsn(Opcodes.DUP); super.visitTypeInsn(opcode, typeName); invokeRecordAllocation(typeName); } else { super.visitTypeInsn(opcode, typeName); } }
java
@Override public void visitTypeInsn(int opcode, String typeName) { if (opcode == Opcodes.NEW) { // We can't actually tag this object right after allocation because it // must be initialized with a ctor before we can touch it (Verifier // enforces this). Instead, we just note it and tag following // initialization. super.visitTypeInsn(opcode, typeName); ++outstandingAllocs; } else if (opcode == Opcodes.ANEWARRAY) { super.visitInsn(Opcodes.DUP); super.visitTypeInsn(opcode, typeName); invokeRecordAllocation(typeName); } else { super.visitTypeInsn(opcode, typeName); } }
[ "@", "Override", "public", "void", "visitTypeInsn", "(", "int", "opcode", ",", "String", "typeName", ")", "{", "if", "(", "opcode", "==", "Opcodes", ".", "NEW", ")", "{", "// We can't actually tag this object right after allocation because it", "// must be initialized w...
new and anewarray bytecodes take a String operand for the type of the object or array element so we hook them here. Note that new doesn't actually result in any instrumentation here; we just do a bit of book-keeping and do the instrumentation following the constructor call (because we're not allowed to touch the object until it is initialized).
[ "new", "and", "anewarray", "bytecodes", "take", "a", "String", "operand", "for", "the", "type", "of", "the", "object", "or", "array", "element", "so", "we", "hook", "them", "here", ".", "Note", "that", "new", "doesn", "t", "actually", "result", "in", "an...
train
https://github.com/google/allocation-instrumenter/blob/58d8473e8832e51f39ae7aa38328f61c4b747bff/src/main/java/com/google/monitoring/runtime/instrumentation/AllocationMethodAdapter.java#L444-L460
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.withInputStream
public static Object withInputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.InputStream") Closure closure) throws IOException { return IOGroovyMethods.withStream(newInputStream(self), closure); }
java
public static Object withInputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.InputStream") Closure closure) throws IOException { return IOGroovyMethods.withStream(newInputStream(self), closure); }
[ "public", "static", "Object", "withInputStream", "(", "Path", "self", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.InputStream\"", ")", "Closure", "closure", ")", "throws", "IOException", "{", "return"...
Create a new InputStream for this file and passes it into the closure. This method ensures the stream is closed after the closure returns. @param self a Path @param closure a closure @return the value returned by the closure @throws java.io.IOException if an IOException occurs. @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure) @since 2.3.0
[ "Create", "a", "new", "InputStream", "for", "this", "file", "and", "passes", "it", "into", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1500-L1502
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java
CPDefinitionSpecificationOptionValuePersistenceImpl.findAll
@Override public List<CPDefinitionSpecificationOptionValue> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CPDefinitionSpecificationOptionValue> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionSpecificationOptionValue", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the cp definition specification option values. @return the cp definition specification option values
[ "Returns", "all", "the", "cp", "definition", "specification", "option", "values", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java#L5853-L5856
sagiegurari/fax4j
src/main/java/org/fax4j/spi/mac/MacFaxClientSpi.java
MacFaxClientSpi.executeProcess
protected ProcessOutput executeProcess(String command,FaxActionType faxActionType) { //execute process ProcessOutput processOutput=ProcessExecutorHelper.executeProcess(this,command); //validate process output this.processOutputValidator.validateProcessOutput(this,processOutput,faxActionType); return processOutput; }
java
protected ProcessOutput executeProcess(String command,FaxActionType faxActionType) { //execute process ProcessOutput processOutput=ProcessExecutorHelper.executeProcess(this,command); //validate process output this.processOutputValidator.validateProcessOutput(this,processOutput,faxActionType); return processOutput; }
[ "protected", "ProcessOutput", "executeProcess", "(", "String", "command", ",", "FaxActionType", "faxActionType", ")", "{", "//execute process", "ProcessOutput", "processOutput", "=", "ProcessExecutorHelper", ".", "executeProcess", "(", "this", ",", "command", ")", ";", ...
This function executes the external command to send the fax. @param command The command to execute @param faxActionType The fax action type @return The process output
[ "This", "function", "executes", "the", "external", "command", "to", "send", "the", "fax", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/mac/MacFaxClientSpi.java#L304-L313
alkacon/opencms-core
src/org/opencms/loader/CmsJspLoader.java
CmsJspLoader.updateJsp
protected String updateJsp(String vfsName, CmsFlexController controller, Set<String> updatedFiles) { String jspVfsName = CmsLinkManager.getAbsoluteUri(vfsName, controller.getCurrentRequest().getElementRootPath()); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UPDATE_JSP_1, jspVfsName)); } String jspRfsName; try { CmsResource includeResource; try { // first try a root path includeResource = readJspResource(controller, jspVfsName); } catch (CmsVfsResourceNotFoundException e) { // if fails, try a site relative path includeResource = readJspResource( controller, controller.getCmsObject().getRequestContext().addSiteRoot(jspVfsName)); } // make sure the jsp referenced file is generated jspRfsName = updateJsp(includeResource, controller, updatedFiles); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_NAME_REAL_FS_1, jspRfsName)); } } catch (Exception e) { jspRfsName = null; if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ERR_UPDATE_1, jspVfsName), e); } } return jspRfsName; }
java
protected String updateJsp(String vfsName, CmsFlexController controller, Set<String> updatedFiles) { String jspVfsName = CmsLinkManager.getAbsoluteUri(vfsName, controller.getCurrentRequest().getElementRootPath()); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UPDATE_JSP_1, jspVfsName)); } String jspRfsName; try { CmsResource includeResource; try { // first try a root path includeResource = readJspResource(controller, jspVfsName); } catch (CmsVfsResourceNotFoundException e) { // if fails, try a site relative path includeResource = readJspResource( controller, controller.getCmsObject().getRequestContext().addSiteRoot(jspVfsName)); } // make sure the jsp referenced file is generated jspRfsName = updateJsp(includeResource, controller, updatedFiles); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_NAME_REAL_FS_1, jspRfsName)); } } catch (Exception e) { jspRfsName = null; if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ERR_UPDATE_1, jspVfsName), e); } } return jspRfsName; }
[ "protected", "String", "updateJsp", "(", "String", "vfsName", ",", "CmsFlexController", "controller", ",", "Set", "<", "String", ">", "updatedFiles", ")", "{", "String", "jspVfsName", "=", "CmsLinkManager", ".", "getAbsoluteUri", "(", "vfsName", ",", "controller",...
Updates a JSP page in the "real" file system in case the VFS resource has changed based on the resource name.<p> Generates a resource based on the provided name and calls {@link #updateJsp(CmsResource, CmsFlexController, Set)}.<p> @param vfsName the name of the JSP file resource in the VFS @param controller the controller for the JSP integration @param updatedFiles a Set containing all JSP pages that have been already updated @return the file name of the updated JSP in the "real" FS
[ "Updates", "a", "JSP", "page", "in", "the", "real", "file", "system", "in", "case", "the", "VFS", "resource", "has", "changed", "based", "on", "the", "resource", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L1654-L1684
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getEpisodeInfo
public TVEpisodeInfo getEpisodeInfo(int tvID, int seasonNumber, int episodeNumber, String language, String... appendToResponse) throws MovieDbException { return tmdbEpisodes.getEpisodeInfo(tvID, seasonNumber, episodeNumber, language, appendToResponse); }
java
public TVEpisodeInfo getEpisodeInfo(int tvID, int seasonNumber, int episodeNumber, String language, String... appendToResponse) throws MovieDbException { return tmdbEpisodes.getEpisodeInfo(tvID, seasonNumber, episodeNumber, language, appendToResponse); }
[ "public", "TVEpisodeInfo", "getEpisodeInfo", "(", "int", "tvID", ",", "int", "seasonNumber", ",", "int", "episodeNumber", ",", "String", "language", ",", "String", "...", "appendToResponse", ")", "throws", "MovieDbException", "{", "return", "tmdbEpisodes", ".", "g...
Get the primary information about a TV episode by combination of a season and episode number. @param tvID tvID @param seasonNumber seasonNumber @param episodeNumber episodeNumber @param language language @param appendToResponse appendToResponse @return @throws MovieDbException exception
[ "Get", "the", "primary", "information", "about", "a", "TV", "episode", "by", "combination", "of", "a", "season", "and", "episode", "number", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1772-L1774
amaembo/streamex
src/main/java/one/util/streamex/LongStreamEx.java
LongStreamEx.minByInt
public OptionalLong minByInt(LongToIntFunction keyExtractor) { return collect(PrimitiveBox::new, (box, l) -> { int key = keyExtractor.applyAsInt(l); if (!box.b || box.i > key) { box.b = true; box.i = key; box.l = l; } }, PrimitiveBox.MIN_INT).asLong(); }
java
public OptionalLong minByInt(LongToIntFunction keyExtractor) { return collect(PrimitiveBox::new, (box, l) -> { int key = keyExtractor.applyAsInt(l); if (!box.b || box.i > key) { box.b = true; box.i = key; box.l = l; } }, PrimitiveBox.MIN_INT).asLong(); }
[ "public", "OptionalLong", "minByInt", "(", "LongToIntFunction", "keyExtractor", ")", "{", "return", "collect", "(", "PrimitiveBox", "::", "new", ",", "(", "box", ",", "l", ")", "->", "{", "int", "key", "=", "keyExtractor", ".", "applyAsInt", "(", "l", ")",...
Returns the minimum element of this stream according to the provided key extractor function. <p> This is a terminal operation. @param keyExtractor a non-interfering, stateless function @return an {@code OptionalLong} describing the first element of this stream for which the lowest value was returned by key extractor, or an empty {@code OptionalLong} if the stream is empty @since 0.1.2
[ "Returns", "the", "minimum", "element", "of", "this", "stream", "according", "to", "the", "provided", "key", "extractor", "function", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L938-L947
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/SortedArrayList.java
SortedArrayList.findInsertionPoint
private int findInsertionPoint(Object o, int startIndex, int endIndex) { int halfPt = ((endIndex - startIndex)/2) + startIndex; int delta = compare(get(halfPt), o); if(delta < 0) { endIndex = halfPt; } else if(delta > 0) { startIndex = halfPt; } else { // System.out.println("halfPt: " + halfPt); return halfPt; } // the object in question falls between two elements if((endIndex - startIndex) <= 1) { // System.out.println("endIndex: " + endIndex); return endIndex+1; } return findInsertionPoint(o, startIndex, endIndex); }
java
private int findInsertionPoint(Object o, int startIndex, int endIndex) { int halfPt = ((endIndex - startIndex)/2) + startIndex; int delta = compare(get(halfPt), o); if(delta < 0) { endIndex = halfPt; } else if(delta > 0) { startIndex = halfPt; } else { // System.out.println("halfPt: " + halfPt); return halfPt; } // the object in question falls between two elements if((endIndex - startIndex) <= 1) { // System.out.println("endIndex: " + endIndex); return endIndex+1; } return findInsertionPoint(o, startIndex, endIndex); }
[ "private", "int", "findInsertionPoint", "(", "Object", "o", ",", "int", "startIndex", ",", "int", "endIndex", ")", "{", "int", "halfPt", "=", "(", "(", "endIndex", "-", "startIndex", ")", "/", "2", ")", "+", "startIndex", ";", "int", "delta", "=", "com...
Conducts a binary search to find the index where Object o should be inserted. @param o The Object that is to be inserted. @param startIndex The starting point for the search. @param endIndex The end boundary for this search. @return The index where Object o should be inserted.
[ "Conducts", "a", "binary", "search", "to", "find", "the", "index", "where", "Object", "o", "should", "be", "inserted", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/SortedArrayList.java#L176-L199
powermock/powermock
powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java
PowerMockito.verifyPrivate
public static PrivateMethodVerification verifyPrivate(Object object, VerificationMode verificationMode) { Mockito.verify(object, verificationMode); return new DefaultPrivateMethodVerification(object); }
java
public static PrivateMethodVerification verifyPrivate(Object object, VerificationMode verificationMode) { Mockito.verify(object, verificationMode); return new DefaultPrivateMethodVerification(object); }
[ "public", "static", "PrivateMethodVerification", "verifyPrivate", "(", "Object", "object", ",", "VerificationMode", "verificationMode", ")", "{", "Mockito", ".", "verify", "(", "object", ",", "verificationMode", ")", ";", "return", "new", "DefaultPrivateMethodVerificati...
Verify a private method invocation with a given verification mode. @see Mockito#verify(Object)
[ "Verify", "a", "private", "method", "invocation", "with", "a", "given", "verification", "mode", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java#L280-L283
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java
SvgGraphicsContext.drawSymbol
public void drawSymbol(Object parent, String name, Coordinate position, ShapeStyle style, String shapeTypeId) { if (isAttached()) { Element useElement = helper.createOrUpdateElement(parent, name, "use", style); Dom.setElementAttributeNS(Dom.NS_XLINK, useElement, "xlink:href", "#" + shapeTypeId); if (position != null) { Dom.setElementAttribute(useElement, "x", Double.toString(position.getX())); Dom.setElementAttribute(useElement, "y", Double.toString(position.getY())); } } }
java
public void drawSymbol(Object parent, String name, Coordinate position, ShapeStyle style, String shapeTypeId) { if (isAttached()) { Element useElement = helper.createOrUpdateElement(parent, name, "use", style); Dom.setElementAttributeNS(Dom.NS_XLINK, useElement, "xlink:href", "#" + shapeTypeId); if (position != null) { Dom.setElementAttribute(useElement, "x", Double.toString(position.getX())); Dom.setElementAttribute(useElement, "y", Double.toString(position.getY())); } } }
[ "public", "void", "drawSymbol", "(", "Object", "parent", ",", "String", "name", ",", "Coordinate", "position", ",", "ShapeStyle", "style", ",", "String", "shapeTypeId", ")", "{", "if", "(", "isAttached", "(", ")", ")", "{", "Element", "useElement", "=", "h...
Draw a symbol, using some predefined ShapeType. @param parent parent group object @param name The symbol's name. @param position The symbol's (X,Y) location on the graphics. @param style The style to apply on the symbol. @param shapeTypeId The name of the predefined ShapeType. This symbol will create a reference to this predefined type and take on it's characteristics.
[ "Draw", "a", "symbol", "using", "some", "predefined", "ShapeType", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L468-L477
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeVTypeHashMap.java
KTypeVTypeHashMap.putAll
@Override public int putAll(Iterable<? extends KTypeVTypeCursor<? extends KType, ? extends VType>> iterable){ final int count = size(); for (KTypeVTypeCursor<? extends KType, ? extends VType> c : iterable) { put(c.key, c.value); } return size() - count; }
java
@Override public int putAll(Iterable<? extends KTypeVTypeCursor<? extends KType, ? extends VType>> iterable){ final int count = size(); for (KTypeVTypeCursor<? extends KType, ? extends VType> c : iterable) { put(c.key, c.value); } return size() - count; }
[ "@", "Override", "public", "int", "putAll", "(", "Iterable", "<", "?", "extends", "KTypeVTypeCursor", "<", "?", "extends", "KType", ",", "?", "extends", "VType", ">", ">", "iterable", ")", "{", "final", "int", "count", "=", "size", "(", ")", ";", "for"...
Puts all key/value pairs from a given iterable into this map.
[ "Puts", "all", "key", "/", "value", "pairs", "from", "a", "given", "iterable", "into", "this", "map", "." ]
train
https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeVTypeHashMap.java#L206-L213
alkacon/opencms-core
src/org/opencms/search/CmsSearchIndex.java
CmsSearchIndex.getTermQueryFilter
protected Query getTermQueryFilter(String field, String term) { return getMultiTermQueryFilter(field, term, Collections.singletonList(term)); }
java
protected Query getTermQueryFilter(String field, String term) { return getMultiTermQueryFilter(field, term, Collections.singletonList(term)); }
[ "protected", "Query", "getTermQueryFilter", "(", "String", "field", ",", "String", "term", ")", "{", "return", "getMultiTermQueryFilter", "(", "field", ",", "term", ",", "Collections", ".", "singletonList", "(", "term", ")", ")", ";", "}" ]
Returns a cached Lucene term query filter for the given field and term.<p> @param field the field to use @param term the term to use @return a cached Lucene term query filter for the given field and term
[ "Returns", "a", "cached", "Lucene", "term", "query", "filter", "for", "the", "given", "field", "and", "term", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchIndex.java#L1745-L1748
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java
MurmurHash3Adaptor.hashToBytes
public static byte[] hashToBytes(final double datum, final long seed) { final double d = (datum == 0.0) ? 0.0 : datum; //canonicalize -0.0, 0.0 final long[] data = { Double.doubleToLongBits(d) }; //canonicalize all NaN forms return toByteArray(hash(data, seed)); }
java
public static byte[] hashToBytes(final double datum, final long seed) { final double d = (datum == 0.0) ? 0.0 : datum; //canonicalize -0.0, 0.0 final long[] data = { Double.doubleToLongBits(d) }; //canonicalize all NaN forms return toByteArray(hash(data, seed)); }
[ "public", "static", "byte", "[", "]", "hashToBytes", "(", "final", "double", "datum", ",", "final", "long", "seed", ")", "{", "final", "double", "d", "=", "(", "datum", "==", "0.0", ")", "?", "0.0", ":", "datum", ";", "//canonicalize -0.0, 0.0", "final",...
Hash a double and long seed. @param datum the input double @param seed A long valued seed. @return The 128-bit hash as a byte[16] in Big Endian order from 2 64-bit longs.
[ "Hash", "a", "double", "and", "long", "seed", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java#L112-L116
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java
MetadataService.removeToken
public CompletableFuture<Revision> removeToken(Author author, String projectName, Token token) { return removeToken(author, projectName, requireNonNull(token, "token").appId()); }
java
public CompletableFuture<Revision> removeToken(Author author, String projectName, Token token) { return removeToken(author, projectName, requireNonNull(token, "token").appId()); }
[ "public", "CompletableFuture", "<", "Revision", ">", "removeToken", "(", "Author", "author", ",", "String", "projectName", ",", "Token", "token", ")", "{", "return", "removeToken", "(", "author", ",", "projectName", ",", "requireNonNull", "(", "token", ",", "\...
Removes the specified {@link Token} from the specified {@code projectName}. It also removes every token permission belonging to the {@link Token} from every {@link RepositoryMetadata}.
[ "Removes", "the", "specified", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L362-L364
craftercms/commons
utilities/src/main/java/org/craftercms/commons/lang/UrlUtils.java
UrlUtils.addQueryStringFragment
public static String addQueryStringFragment(String url, String fragment) { StringBuilder newUrl = new StringBuilder(url); if (fragment.startsWith("?") || fragment.startsWith("&")) { fragment = fragment.substring(1); } if (!url.endsWith("?") && !url.endsWith("&")) { if (url.contains("?")) { newUrl.append('&'); } else { newUrl.append('?'); } } return newUrl.append(fragment).toString(); }
java
public static String addQueryStringFragment(String url, String fragment) { StringBuilder newUrl = new StringBuilder(url); if (fragment.startsWith("?") || fragment.startsWith("&")) { fragment = fragment.substring(1); } if (!url.endsWith("?") && !url.endsWith("&")) { if (url.contains("?")) { newUrl.append('&'); } else { newUrl.append('?'); } } return newUrl.append(fragment).toString(); }
[ "public", "static", "String", "addQueryStringFragment", "(", "String", "url", ",", "String", "fragment", ")", "{", "StringBuilder", "newUrl", "=", "new", "StringBuilder", "(", "url", ")", ";", "if", "(", "fragment", ".", "startsWith", "(", "\"?\"", ")", "||"...
Adds a query string fragment to the URL, adding a '?' if there's no query string yet. @param url the URL @param fragment the query string fragment @return the URL with the query string fragment appended
[ "Adds", "a", "query", "string", "fragment", "to", "the", "URL", "adding", "a", "?", "if", "there", "s", "no", "query", "string", "yet", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/lang/UrlUtils.java#L121-L137
Azure/azure-sdk-for-java
sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java
ManagedInstanceVulnerabilityAssessmentsInner.createOrUpdateAsync
public Observable<ManagedInstanceVulnerabilityAssessmentInner> createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<ManagedInstanceVulnerabilityAssessmentInner>, ManagedInstanceVulnerabilityAssessmentInner>() { @Override public ManagedInstanceVulnerabilityAssessmentInner call(ServiceResponse<ManagedInstanceVulnerabilityAssessmentInner> response) { return response.body(); } }); }
java
public Observable<ManagedInstanceVulnerabilityAssessmentInner> createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<ManagedInstanceVulnerabilityAssessmentInner>, ManagedInstanceVulnerabilityAssessmentInner>() { @Override public ManagedInstanceVulnerabilityAssessmentInner call(ServiceResponse<ManagedInstanceVulnerabilityAssessmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagedInstanceVulnerabilityAssessmentInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "ManagedInstanceVulnerabilityAssessmentInner", "parameters", ")", "{", "return", "createOrUpdateW...
Creates or updates the managed instance's vulnerability assessment. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. @param parameters The requested resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object
[ "Creates", "or", "updates", "the", "managed", "instance", "s", "vulnerability", "assessment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java#L212-L219
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createEventOTag
private void createEventOTag(StringBuilder sb, RepositoryLogRecord record, Locale locale){ sb.append("<CommonBaseEvent creationTime=\""); // create the XML dateTime format // TimeZone is UTC, but since we are dealing with Millis we are already in UTC. sb.append(CBE_DATE_FORMAT.format(record.getMillis())); sb.append("\""); // create and add the globalInstanceId sb.append(" globalInstanceId=\"").append(GUID_PREFIX).append(Guid.generate()).append("\""); // write out the msg sb.append(" msg=\"").append(formatMessage(record, locale)).append("\""); short severity = 0; if (record.getLevel().intValue() >= Level.SEVERE.intValue()) { severity = 50; } else if (record.getLevel().intValue() >= Level.WARNING.intValue()) { severity = 30; } else { severity = 10; } sb.append(" severity=\"").append(severity).append("\""); sb.append(" version=\"1.0.1\">"); }
java
private void createEventOTag(StringBuilder sb, RepositoryLogRecord record, Locale locale){ sb.append("<CommonBaseEvent creationTime=\""); // create the XML dateTime format // TimeZone is UTC, but since we are dealing with Millis we are already in UTC. sb.append(CBE_DATE_FORMAT.format(record.getMillis())); sb.append("\""); // create and add the globalInstanceId sb.append(" globalInstanceId=\"").append(GUID_PREFIX).append(Guid.generate()).append("\""); // write out the msg sb.append(" msg=\"").append(formatMessage(record, locale)).append("\""); short severity = 0; if (record.getLevel().intValue() >= Level.SEVERE.intValue()) { severity = 50; } else if (record.getLevel().intValue() >= Level.WARNING.intValue()) { severity = 30; } else { severity = 10; } sb.append(" severity=\"").append(severity).append("\""); sb.append(" version=\"1.0.1\">"); }
[ "private", "void", "createEventOTag", "(", "StringBuilder", "sb", ",", "RepositoryLogRecord", "record", ",", "Locale", "locale", ")", "{", "sb", ".", "append", "(", "\"<CommonBaseEvent creationTime=\\\"\"", ")", ";", "// create the XML dateTime format", "// TimeZone is UT...
Appends the opening tag of a CommonBaseEvent XML element to a string buffer @param sb the string buffer the tag will be added to @param record the record that represents the common base event @param locale locale to be used for formatting the log record into CBE
[ "Appends", "the", "opening", "tag", "of", "a", "CommonBaseEvent", "XML", "element", "to", "a", "string", "buffer" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L146-L170
astrapi69/jaulp-wicket
jaulp-wicket-annotated-header-contributors/src/main/java/de/alpharogroup/wicket/PackageResourceReferences.java
PackageResourceReferences.initializeResources
public void initializeResources(final String packageName) throws ClassNotFoundException, IOException, URISyntaxException { final Map<Class<?>, ImportResource[]> resourcesMap = ImportResourcesExtensions .getImportResources(packageName); for (final Entry<Class<?>, ImportResource[]> entry : resourcesMap.entrySet()) { final Class<?> key = entry.getKey(); final ImportResource[] value = entry.getValue(); final Set<PackageResourceReferenceWrapper> packageResourceReferences = new LinkedHashSet<>(); for (final ImportResource importResource : value) { if (importResource.resourceType().equalsIgnoreCase("js")) { final PackageResourceReference t = new PackageResourceReference(key, importResource.resourceName()); packageResourceReferences .add(new PackageResourceReferenceWrapper(t, ResourceReferenceType.JS)); } else if (importResource.resourceType().equalsIgnoreCase("css")) { final PackageResourceReference t = new PackageResourceReference(key, importResource.resourceName()); packageResourceReferences .add(new PackageResourceReferenceWrapper(t, ResourceReferenceType.CSS)); } } PackageResourceReferences.getInstance().getPackageResourceReferenceMap().put(key, packageResourceReferences); } }
java
public void initializeResources(final String packageName) throws ClassNotFoundException, IOException, URISyntaxException { final Map<Class<?>, ImportResource[]> resourcesMap = ImportResourcesExtensions .getImportResources(packageName); for (final Entry<Class<?>, ImportResource[]> entry : resourcesMap.entrySet()) { final Class<?> key = entry.getKey(); final ImportResource[] value = entry.getValue(); final Set<PackageResourceReferenceWrapper> packageResourceReferences = new LinkedHashSet<>(); for (final ImportResource importResource : value) { if (importResource.resourceType().equalsIgnoreCase("js")) { final PackageResourceReference t = new PackageResourceReference(key, importResource.resourceName()); packageResourceReferences .add(new PackageResourceReferenceWrapper(t, ResourceReferenceType.JS)); } else if (importResource.resourceType().equalsIgnoreCase("css")) { final PackageResourceReference t = new PackageResourceReference(key, importResource.resourceName()); packageResourceReferences .add(new PackageResourceReferenceWrapper(t, ResourceReferenceType.CSS)); } } PackageResourceReferences.getInstance().getPackageResourceReferenceMap().put(key, packageResourceReferences); } }
[ "public", "void", "initializeResources", "(", "final", "String", "packageName", ")", "throws", "ClassNotFoundException", ",", "IOException", ",", "URISyntaxException", "{", "final", "Map", "<", "Class", "<", "?", ">", ",", "ImportResource", "[", "]", ">", "resou...
Initialize resources from the given package. @param packageName the package name @throws ClassNotFoundException occurs if a given class cannot be located by the specified class loader @throws IOException Signals that an I/O exception has occurred. @throws URISyntaxException is thrown if a string could not be parsed as a URI reference.
[ "Initialize", "resources", "from", "the", "given", "package", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-annotated-header-contributors/src/main/java/de/alpharogroup/wicket/PackageResourceReferences.java#L220-L252
rolfl/MicroBench
src/main/java/net/tuis/ubench/UBench.java
UBench.addLongTask
public UBench addLongTask(String name, LongSupplier task) { return addLongTask(name, task, null); }
java
public UBench addLongTask(String name, LongSupplier task) { return addLongTask(name, task, null); }
[ "public", "UBench", "addLongTask", "(", "String", "name", ",", "LongSupplier", "task", ")", "{", "return", "addLongTask", "(", "name", ",", "task", ",", "null", ")", ";", "}" ]
Include a long-specialized named task in to the benchmark. @param name The name of the task. Only one task with any one name is allowed. @param task The task to perform @return The same object, for chaining calls.
[ "Include", "a", "long", "-", "specialized", "named", "task", "in", "to", "the", "benchmark", "." ]
train
https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UBench.java#L231-L233
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java
AbstractCodeGen.writeRightCurlyBracket
void writeRightCurlyBracket(Writer out, int indent) throws IOException { writeEol(out); writeWithIndent(out, indent, "}\n"); }
java
void writeRightCurlyBracket(Writer out, int indent) throws IOException { writeEol(out); writeWithIndent(out, indent, "}\n"); }
[ "void", "writeRightCurlyBracket", "(", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeEol", "(", "out", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"}\\n\"", ")", ";", "}" ]
Output right curly bracket @param out Writer @param indent space number @throws IOException ioException
[ "Output", "right", "curly", "bracket" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java#L202-L206
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/reader/EventReader.java
EventReader.deleteMessageAfterProcessSource
private void deleteMessageAfterProcessSource(ProgressState progressState, CloudTrailSource source) { ProgressStatus deleteMessageStatus = new ProgressStatus(progressState, new BasicProcessSourceInfo(source, false)); sqsManager.deleteMessageFromQueue(((SQSBasedSource)source).getSqsMessage(), deleteMessageStatus); }
java
private void deleteMessageAfterProcessSource(ProgressState progressState, CloudTrailSource source) { ProgressStatus deleteMessageStatus = new ProgressStatus(progressState, new BasicProcessSourceInfo(source, false)); sqsManager.deleteMessageFromQueue(((SQSBasedSource)source).getSqsMessage(), deleteMessageStatus); }
[ "private", "void", "deleteMessageAfterProcessSource", "(", "ProgressState", "progressState", ",", "CloudTrailSource", "source", ")", "{", "ProgressStatus", "deleteMessageStatus", "=", "new", "ProgressStatus", "(", "progressState", ",", "new", "BasicProcessSourceInfo", "(", ...
Delete SQS message after processing source. @param progressState {@link ProgressState} either {@link ProgressState#deleteMessage}, or {@link ProgressState#deleteFilteredMessage} @param source {@link CloudTrailSource} that contains the SQS message that will be deleted.
[ "Delete", "SQS", "message", "after", "processing", "source", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/reader/EventReader.java#L194-L197
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/Stage.java
Stage.withStageVariables
public Stage withStageVariables(java.util.Map<String, String> stageVariables) { setStageVariables(stageVariables); return this; }
java
public Stage withStageVariables(java.util.Map<String, String> stageVariables) { setStageVariables(stageVariables); return this; }
[ "public", "Stage", "withStageVariables", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "stageVariables", ")", "{", "setStageVariables", "(", "stageVariables", ")", ";", "return", "this", ";", "}" ]
<p> A map that defines the stage variables for a stage resource. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+. </p> @param stageVariables A map that defines the stage variables for a stage resource. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "that", "defines", "the", "stage", "variables", "for", "a", "stage", "resource", ".", "Variable", "names", "can", "have", "alphanumeric", "and", "underscore", "characters", "and", "the", "values", "must", "match", "[", "A", "-", "Za"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/Stage.java#L512-L515