repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/internal/Transport.java
Transport.addObject
public <T> T addObject(T object, NameValuePair... params) throws RedmineException { final EntityConfig<T> config = getConfig(object.getClass()); if (config.writer == null) { throw new RuntimeException("can't create object: writer is not implemented or is not registered in RedmineJSONBuilder for object " + object); } URI uri = getURIConfigurator().getObjectsURI(object.getClass(), params); HttpPost httpPost = new HttpPost(uri); String body = RedmineJSONBuilder.toSimpleJSON(config.singleObjectName, object, config.writer); setEntity(httpPost, body); String response = send(httpPost); logger.debug(response); return parseResponse(response, config.singleObjectName, config.parser); }
java
public <T> T addObject(T object, NameValuePair... params) throws RedmineException { final EntityConfig<T> config = getConfig(object.getClass()); if (config.writer == null) { throw new RuntimeException("can't create object: writer is not implemented or is not registered in RedmineJSONBuilder for object " + object); } URI uri = getURIConfigurator().getObjectsURI(object.getClass(), params); HttpPost httpPost = new HttpPost(uri); String body = RedmineJSONBuilder.toSimpleJSON(config.singleObjectName, object, config.writer); setEntity(httpPost, body); String response = send(httpPost); logger.debug(response); return parseResponse(response, config.singleObjectName, config.parser); }
[ "public", "<", "T", ">", "T", "addObject", "(", "T", "object", ",", "NameValuePair", "...", "params", ")", "throws", "RedmineException", "{", "final", "EntityConfig", "<", "T", ">", "config", "=", "getConfig", "(", "object", ".", "getClass", "(", ")", ")...
Performs an "add object" request. @param object object to use. @param params name params. @return object to use. @throws RedmineException if something goes wrong.
[ "Performs", "an", "add", "object", "request", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/internal/Transport.java#L220-L233
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/ApptentiveInternal.java
ApptentiveInternal.updateApptentiveInteractionTheme
public void updateApptentiveInteractionTheme(Context context, Resources.Theme interactionTheme) { /* Step 1: Apply Apptentive default theme layer. * If host activity is an activity, the base theme already has Apptentive defaults applied, so skip Step 1. * If parent activity is NOT an activity, first apply Apptentive defaults. */ if (!(context instanceof Activity)) { // If host context is not an activity, i.e. application context, treat it as initial theme setup interactionTheme.applyStyle(R.style.ApptentiveTheme_Base_Versioned, true); } // Step 2: Inherit app default appcompat theme if there is one specified in app's AndroidManifest if (appDefaultAppCompatThemeId != 0) { interactionTheme.applyStyle(appDefaultAppCompatThemeId, true); } // Step 3: Restore Apptentive UI window properties that may have been overridden in Step 2. This theme // is to ensure Apptentive interaction has a modal feel-n-look. interactionTheme.applyStyle(R.style.ApptentiveBaseFrameTheme, true); // Step 4: Apply optional theme override specified in host app's style int themeOverrideResId = context.getResources().getIdentifier("ApptentiveThemeOverride", "style", getApplicationContext().getPackageName()); if (themeOverrideResId != 0) { interactionTheme.applyStyle(themeOverrideResId, true); } // Step 5: Update status bar color /* Obtain the default status bar color. When an Apptentive Modal interaction is shown, * a translucent overlay would be applied on top of statusBarColorDefault */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int transparentColor = ContextCompat.getColor(context, android.R.color.transparent); TypedArray a = interactionTheme.obtainStyledAttributes(new int[]{android.R.attr.statusBarColor}); try { statusBarColorDefault = a.getColor(0, transparentColor); } finally { a.recycle(); } } // Step 6: Update toolbar overlay theme int toolbarThemeId = Util.getResourceIdFromAttribute(interactionTheme, R.attr.apptentiveToolbarTheme); apptentiveToolbarTheme.setTo(interactionTheme); apptentiveToolbarTheme.applyStyle(toolbarThemeId, true); }
java
public void updateApptentiveInteractionTheme(Context context, Resources.Theme interactionTheme) { /* Step 1: Apply Apptentive default theme layer. * If host activity is an activity, the base theme already has Apptentive defaults applied, so skip Step 1. * If parent activity is NOT an activity, first apply Apptentive defaults. */ if (!(context instanceof Activity)) { // If host context is not an activity, i.e. application context, treat it as initial theme setup interactionTheme.applyStyle(R.style.ApptentiveTheme_Base_Versioned, true); } // Step 2: Inherit app default appcompat theme if there is one specified in app's AndroidManifest if (appDefaultAppCompatThemeId != 0) { interactionTheme.applyStyle(appDefaultAppCompatThemeId, true); } // Step 3: Restore Apptentive UI window properties that may have been overridden in Step 2. This theme // is to ensure Apptentive interaction has a modal feel-n-look. interactionTheme.applyStyle(R.style.ApptentiveBaseFrameTheme, true); // Step 4: Apply optional theme override specified in host app's style int themeOverrideResId = context.getResources().getIdentifier("ApptentiveThemeOverride", "style", getApplicationContext().getPackageName()); if (themeOverrideResId != 0) { interactionTheme.applyStyle(themeOverrideResId, true); } // Step 5: Update status bar color /* Obtain the default status bar color. When an Apptentive Modal interaction is shown, * a translucent overlay would be applied on top of statusBarColorDefault */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int transparentColor = ContextCompat.getColor(context, android.R.color.transparent); TypedArray a = interactionTheme.obtainStyledAttributes(new int[]{android.R.attr.statusBarColor}); try { statusBarColorDefault = a.getColor(0, transparentColor); } finally { a.recycle(); } } // Step 6: Update toolbar overlay theme int toolbarThemeId = Util.getResourceIdFromAttribute(interactionTheme, R.attr.apptentiveToolbarTheme); apptentiveToolbarTheme.setTo(interactionTheme); apptentiveToolbarTheme.applyStyle(toolbarThemeId, true); }
[ "public", "void", "updateApptentiveInteractionTheme", "(", "Context", "context", ",", "Resources", ".", "Theme", "interactionTheme", ")", "{", "/* Step 1: Apply Apptentive default theme layer.\n\t\t * If host activity is an activity, the base theme already has Apptentive defaults applied, ...
/* Apply Apptentive styling layers to the theme to be used by interaction. The layers include Apptentive defaults, and app/activity theme inheritance and app specific overrides. When the Apptentive fragments are hosted by ApptentiveViewActivity(by default), the value of theme attributes are obtained in the following order: ApptentiveTheme.Base.Versioned specified in Apptentive's AndroidManifest.xml -> app default theme specified in app AndroidManifest.xml (force) -> ApptentiveThemeOverride (force) @param interactionTheme The base theme to apply Apptentive styling layers @param context The context that will host Apptentive interaction fragment, either ApptentiveViewActivity or application context
[ "/", "*", "Apply", "Apptentive", "styling", "layers", "to", "the", "theme", "to", "be", "used", "by", "interaction", ".", "The", "layers", "include", "Apptentive", "defaults", "and", "app", "/", "activity", "theme", "inheritance", "and", "app", "specific", "...
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/ApptentiveInternal.java#L463-L507
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableWriteItems.java
TableWriteItems.addHashOnlyPrimaryKeysToDelete
public TableWriteItems addHashOnlyPrimaryKeysToDelete(String hashKeyName, Object ... hashKeyValues) { for (Object hashKeyValue: hashKeyValues) { this.addPrimaryKeyToDelete(new PrimaryKey(hashKeyName, hashKeyValue)); } return this; }
java
public TableWriteItems addHashOnlyPrimaryKeysToDelete(String hashKeyName, Object ... hashKeyValues) { for (Object hashKeyValue: hashKeyValues) { this.addPrimaryKeyToDelete(new PrimaryKey(hashKeyName, hashKeyValue)); } return this; }
[ "public", "TableWriteItems", "addHashOnlyPrimaryKeysToDelete", "(", "String", "hashKeyName", ",", "Object", "...", "hashKeyValues", ")", "{", "for", "(", "Object", "hashKeyValue", ":", "hashKeyValues", ")", "{", "this", ".", "addPrimaryKeyToDelete", "(", "new", "Pri...
Adds multiple hash-only primary keys to be deleted in a batch write operation. @param hashKeyName name of the hash key attribute name @param hashKeyValues multiple hash key values @return the current instance for method chaining purposes
[ "Adds", "multiple", "hash", "-", "only", "primary", "keys", "to", "be", "deleted", "in", "a", "batch", "write", "operation", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableWriteItems.java#L170-L176
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
FileSupport.getContentsInDirectoryTree
private static ArrayList<File> getContentsInDirectoryTree(File directory, String includeMask, boolean returnFiles, boolean returnDirs) { return getContentsInDirectoryTree(directory, new FileFilterRuleSet(directory.getPath()).setIncludeFilesWithNameMask(includeMask), returnFiles, returnDirs); }
java
private static ArrayList<File> getContentsInDirectoryTree(File directory, String includeMask, boolean returnFiles, boolean returnDirs) { return getContentsInDirectoryTree(directory, new FileFilterRuleSet(directory.getPath()).setIncludeFilesWithNameMask(includeMask), returnFiles, returnDirs); }
[ "private", "static", "ArrayList", "<", "File", ">", "getContentsInDirectoryTree", "(", "File", "directory", ",", "String", "includeMask", ",", "boolean", "returnFiles", ",", "boolean", "returnDirs", ")", "{", "return", "getContentsInDirectoryTree", "(", "directory", ...
Retrieves contents from a directory and its subdirectories matching a given mask. @param directory directory @param includeMask file name to match @param returnFiles return files @param returnDirs return directories @return a list containing the found contents
[ "Retrieves", "contents", "from", "a", "directory", "and", "its", "subdirectories", "matching", "a", "given", "mask", "." ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L127-L129
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/message/query/GenericQueryRequest.java
GenericQueryRequest.jsonQuery
public static GenericQueryRequest jsonQuery(String jsonQuery, String bucket, String password, String contextId) { return new GenericQueryRequest(jsonQuery, true, bucket, bucket, password, null, contextId, null); }
java
public static GenericQueryRequest jsonQuery(String jsonQuery, String bucket, String password, String contextId) { return new GenericQueryRequest(jsonQuery, true, bucket, bucket, password, null, contextId, null); }
[ "public", "static", "GenericQueryRequest", "jsonQuery", "(", "String", "jsonQuery", ",", "String", "bucket", ",", "String", "password", ",", "String", "contextId", ")", "{", "return", "new", "GenericQueryRequest", "(", "jsonQuery", ",", "true", ",", "bucket", ",...
Create a {@link GenericQueryRequest} and mark it as containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...). The simplest form of such a query is a single statement encapsulated in a json query object: <pre>{"statement":"SELECT * FROM default"}</pre>. @param jsonQuery the N1QL query in json form. @param bucket the bucket on which to perform the query. @param password the password for the target bucket. @param contextId the context id to store and use for tracing purposes. @return a {@link GenericQueryRequest} for this full query.
[ "Create", "a", "{", "@link", "GenericQueryRequest", "}", "and", "mark", "it", "as", "containing", "a", "full", "N1QL", "query", "in", "Json", "form", "(", "including", "additional", "query", "parameters", "like", "named", "arguments", "etc", "...", ")", "." ...
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/query/GenericQueryRequest.java#L124-L127
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java
Transactions.begin
public Transaction begin() throws NotSupportedException, SystemException, RollbackException { // check if there isn't an active transaction already NestableThreadLocalTransaction localTx = LOCAL_TRANSACTION.get(); if (localTx != null) { // we have an existing local transaction so we need to be aware of nesting by calling 'begin' if (logger.isTraceEnabled()) { logger.trace("Found active ModeShape transaction '{0}' ", localTx); } return localTx.begin(); } // Get the transaction currently associated with this thread (if there is one) ... javax.transaction.Transaction txn = txnMgr.getTransaction(); if (txn != null && Status.STATUS_ACTIVE != txn.getStatus()) { // there is a user transaction which is not valid, so abort everything throw new IllegalStateException(JcrI18n.errorInvalidUserTransaction.text(txn)); } if (txn == null) { // There is no transaction or a leftover one which isn't active, so start a local one ... txnMgr.begin(); // create our wrapper ... localTx = new NestableThreadLocalTransaction(txnMgr); localTx.begin(); // notify the listener localTx.started(); return logTransactionInformation(localTx); } // There's an existing tx, meaning user transactions are being used SynchronizedTransaction synchronizedTransaction = transactionTable.get(txn); if (synchronizedTransaction != null) { // notify the listener synchronizedTransaction.started(); // we've already started our own transaction so just return it as is return logTransactionInformation(synchronizedTransaction); } else { synchronizedTransaction = new SynchronizedTransaction(txnMgr, txn); transactionTable.put(txn, synchronizedTransaction); // and register a synchronization txn.registerSynchronization(synchronizedTransaction); // and notify the listener synchronizedTransaction.started(); return logTransactionInformation(synchronizedTransaction); } }
java
public Transaction begin() throws NotSupportedException, SystemException, RollbackException { // check if there isn't an active transaction already NestableThreadLocalTransaction localTx = LOCAL_TRANSACTION.get(); if (localTx != null) { // we have an existing local transaction so we need to be aware of nesting by calling 'begin' if (logger.isTraceEnabled()) { logger.trace("Found active ModeShape transaction '{0}' ", localTx); } return localTx.begin(); } // Get the transaction currently associated with this thread (if there is one) ... javax.transaction.Transaction txn = txnMgr.getTransaction(); if (txn != null && Status.STATUS_ACTIVE != txn.getStatus()) { // there is a user transaction which is not valid, so abort everything throw new IllegalStateException(JcrI18n.errorInvalidUserTransaction.text(txn)); } if (txn == null) { // There is no transaction or a leftover one which isn't active, so start a local one ... txnMgr.begin(); // create our wrapper ... localTx = new NestableThreadLocalTransaction(txnMgr); localTx.begin(); // notify the listener localTx.started(); return logTransactionInformation(localTx); } // There's an existing tx, meaning user transactions are being used SynchronizedTransaction synchronizedTransaction = transactionTable.get(txn); if (synchronizedTransaction != null) { // notify the listener synchronizedTransaction.started(); // we've already started our own transaction so just return it as is return logTransactionInformation(synchronizedTransaction); } else { synchronizedTransaction = new SynchronizedTransaction(txnMgr, txn); transactionTable.put(txn, synchronizedTransaction); // and register a synchronization txn.registerSynchronization(synchronizedTransaction); // and notify the listener synchronizedTransaction.started(); return logTransactionInformation(synchronizedTransaction); } }
[ "public", "Transaction", "begin", "(", ")", "throws", "NotSupportedException", ",", "SystemException", ",", "RollbackException", "{", "// check if there isn't an active transaction already", "NestableThreadLocalTransaction", "localTx", "=", "LOCAL_TRANSACTION", ".", "get", "(",...
Starts a new transaction if one does not already exist, and associate it with the calling thread. @return the ModeShape transaction @throws NotSupportedException If the calling thread is already associated with a transaction, and nested transactions are not supported. @throws SystemException If the transaction service fails in an unexpected way.
[ "Starts", "a", "new", "transaction", "if", "one", "does", "not", "already", "exist", "and", "associate", "it", "with", "the", "calling", "thread", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java#L141-L186
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.listFirewallRulesAsync
public Observable<Page<FirewallRuleInner>> listFirewallRulesAsync(final String resourceGroupName, final String accountName) { return listFirewallRulesWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() { @Override public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) { return response.body(); } }); }
java
public Observable<Page<FirewallRuleInner>> listFirewallRulesAsync(final String resourceGroupName, final String accountName) { return listFirewallRulesWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() { @Override public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "FirewallRuleInner", ">", ">", "listFirewallRulesAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ")", "{", "return", "listFirewallRulesWithServiceResponseAsync", "(", "resourceGroupName"...
Lists the Data Lake Store firewall rules within the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param accountName The name of the Data Lake Store account from which to get the firewall rules. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;FirewallRuleInner&gt; object
[ "Lists", "the", "Data", "Lake", "Store", "firewall", "rules", "within", "the", "specified", "Data", "Lake", "Store", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L374-L382
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java
SquareRegularClustersIntoGrids.pickNot
static SquareNode pickNot( SquareNode target , SquareNode child0 , SquareNode child1 ) { for (int i = 0; i < 4; i++) { SquareEdge e = target.edges[i]; if( e == null ) continue; SquareNode c = e.destination(target); if( c != child0 && c != child1 ) return c; } throw new RuntimeException("There was no odd one out some how"); }
java
static SquareNode pickNot( SquareNode target , SquareNode child0 , SquareNode child1 ) { for (int i = 0; i < 4; i++) { SquareEdge e = target.edges[i]; if( e == null ) continue; SquareNode c = e.destination(target); if( c != child0 && c != child1 ) return c; } throw new RuntimeException("There was no odd one out some how"); }
[ "static", "SquareNode", "pickNot", "(", "SquareNode", "target", ",", "SquareNode", "child0", ",", "SquareNode", "child1", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "SquareEdge", "e", "=", "target", ".",...
There are only three edges on target and two of them are known. Pick the one which isn't an inptu child
[ "There", "are", "only", "three", "edges", "on", "target", "and", "two", "of", "them", "are", "known", ".", "Pick", "the", "one", "which", "isn", "t", "an", "inptu", "child" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java#L349-L358
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendTextBlocking
public static void sendTextBlocking(final ByteBuffer message, final WebSocketChannel wsChannel) throws IOException { sendBlockingInternal(message, WebSocketFrameType.TEXT, wsChannel); }
java
public static void sendTextBlocking(final ByteBuffer message, final WebSocketChannel wsChannel) throws IOException { sendBlockingInternal(message, WebSocketFrameType.TEXT, wsChannel); }
[ "public", "static", "void", "sendTextBlocking", "(", "final", "ByteBuffer", "message", ",", "final", "WebSocketChannel", "wsChannel", ")", "throws", "IOException", "{", "sendBlockingInternal", "(", "message", ",", "WebSocketFrameType", ".", "TEXT", ",", "wsChannel", ...
Sends a complete text message, invoking the callback when complete @param message The text to send @param wsChannel The web socket channel
[ "Sends", "a", "complete", "text", "message", "invoking", "the", "callback", "when", "complete" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L209-L211
BioPAX/Paxtools
paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java
BioPAXIOHandlerAdapter.convertToOWL
public void convertToOWL(Model model, OutputStream outputStream, String... ids) { if (ids.length == 0) { convertToOWL(model, outputStream); } else { Model m = model.getLevel().getDefaultFactory().createModel(); m.setXmlBase(model.getXmlBase()); Fetcher fetcher = new Fetcher(SimpleEditorMap.get(model.getLevel())); //no Filters anymore for (String uri : ids) { BioPAXElement bpe = model.getByID(uri); if (bpe != null) { fetcher.fetch(bpe, m); } } convertToOWL(m, outputStream); } }
java
public void convertToOWL(Model model, OutputStream outputStream, String... ids) { if (ids.length == 0) { convertToOWL(model, outputStream); } else { Model m = model.getLevel().getDefaultFactory().createModel(); m.setXmlBase(model.getXmlBase()); Fetcher fetcher = new Fetcher(SimpleEditorMap.get(model.getLevel())); //no Filters anymore for (String uri : ids) { BioPAXElement bpe = model.getByID(uri); if (bpe != null) { fetcher.fetch(bpe, m); } } convertToOWL(m, outputStream); } }
[ "public", "void", "convertToOWL", "(", "Model", "model", ",", "OutputStream", "outputStream", ",", "String", "...", "ids", ")", "{", "if", "(", "ids", ".", "length", "==", "0", ")", "{", "convertToOWL", "(", "model", ",", "outputStream", ")", ";", "}", ...
Similar to {@link BioPAXIOHandler#convertToOWL(org.biopax.paxtools.model.Model, java.io.OutputStream)} (org.biopax.paxtools.model.Model, Object)}, but extracts a sub-model, converts it into BioPAX (OWL) format, and writes it into the outputStream. Saved data can be then read via {@link BioPAXIOHandler} interface (e.g., {@link SimpleIOHandler}). @param model model to be converted into OWL format @param outputStream output stream into which the output will be written @param ids optional list of "root" element absolute URIs; direct/indirect child objects are auto-exported as well.
[ "Similar", "to", "{" ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java#L372-L395
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
ExecutionEnvironment.createRemoteEnvironment
public static ExecutionEnvironment createRemoteEnvironment( String host, int port, Configuration clientConfiguration, String... jarFiles) { return new RemoteEnvironment(host, port, clientConfiguration, jarFiles, null); }
java
public static ExecutionEnvironment createRemoteEnvironment( String host, int port, Configuration clientConfiguration, String... jarFiles) { return new RemoteEnvironment(host, port, clientConfiguration, jarFiles, null); }
[ "public", "static", "ExecutionEnvironment", "createRemoteEnvironment", "(", "String", "host", ",", "int", "port", ",", "Configuration", "clientConfiguration", ",", "String", "...", "jarFiles", ")", "{", "return", "new", "RemoteEnvironment", "(", "host", ",", "port",...
Creates a {@link RemoteEnvironment}. The remote environment sends (parts of) the program to a cluster for execution. Note that all file paths used in the program must be accessible from the cluster. The custom configuration file is used to configure Akka specific configuration parameters for the Client only; Program parallelism can be set via {@link ExecutionEnvironment#setParallelism(int)}. <p>Cluster configuration has to be done in the remotely running Flink instance. @param host The host name or address of the master (JobManager), where the program should be executed. @param port The port of the master (JobManager), where the program should be executed. @param clientConfiguration Configuration used by the client that connects to the cluster. @param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses user-defined functions, user-defined input formats, or any libraries, those must be provided in the JAR files. @return A remote environment that executes the program on a cluster.
[ "Creates", "a", "{", "@link", "RemoteEnvironment", "}", ".", "The", "remote", "environment", "sends", "(", "parts", "of", ")", "the", "program", "to", "a", "cluster", "for", "execution", ".", "Note", "that", "all", "file", "paths", "used", "in", "the", "...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L1192-L1195
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteConnectionPool.java
SQLiteConnectionPool.shouldYieldConnection
public boolean shouldYieldConnection(SQLiteConnection connection, int connectionFlags) { synchronized (mLock) { if (!mAcquiredConnections.containsKey(connection)) { throw new IllegalStateException("Cannot perform this operation " + "because the specified connection was not acquired " + "from this pool or has already been released."); } if (!mIsOpen) { return false; } return isSessionBlockingImportantConnectionWaitersLocked( connection.isPrimaryConnection(), connectionFlags); } }
java
public boolean shouldYieldConnection(SQLiteConnection connection, int connectionFlags) { synchronized (mLock) { if (!mAcquiredConnections.containsKey(connection)) { throw new IllegalStateException("Cannot perform this operation " + "because the specified connection was not acquired " + "from this pool or has already been released."); } if (!mIsOpen) { return false; } return isSessionBlockingImportantConnectionWaitersLocked( connection.isPrimaryConnection(), connectionFlags); } }
[ "public", "boolean", "shouldYieldConnection", "(", "SQLiteConnection", "connection", ",", "int", "connectionFlags", ")", "{", "synchronized", "(", "mLock", ")", "{", "if", "(", "!", "mAcquiredConnections", ".", "containsKey", "(", "connection", ")", ")", "{", "t...
Returns true if the session should yield the connection due to contention over available database connections. @param connection The connection owned by the session. @param connectionFlags The connection request flags. @return True if the session should yield its connection. @throws IllegalStateException if the connection was not acquired from this pool or if it has already been released.
[ "Returns", "true", "if", "the", "session", "should", "yield", "the", "connection", "due", "to", "contention", "over", "available", "database", "connections", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteConnectionPool.java#L424-L439
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/map/impl/MapDatastoreProvider.java
MapDatastoreProvider.readLock
public void readLock(EntityKey key, int timeout) { ReadWriteLock lock = getLock( key ); Lock readLock = lock.readLock(); acquireLock( key, timeout, readLock ); }
java
public void readLock(EntityKey key, int timeout) { ReadWriteLock lock = getLock( key ); Lock readLock = lock.readLock(); acquireLock( key, timeout, readLock ); }
[ "public", "void", "readLock", "(", "EntityKey", "key", ",", "int", "timeout", ")", "{", "ReadWriteLock", "lock", "=", "getLock", "(", "key", ")", ";", "Lock", "readLock", "=", "lock", ".", "readLock", "(", ")", ";", "acquireLock", "(", "key", ",", "tim...
Acquires a read lock on a specific key. @param key The key to lock @param timeout in milliseconds; -1 means wait indefinitely, 0 means no wait.
[ "Acquires", "a", "read", "lock", "on", "a", "specific", "key", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/map/impl/MapDatastoreProvider.java#L105-L109
moleculer-java/moleculer-java
src/main/java/services/moleculer/ServiceBroker.java
ServiceBroker.waitForServices
public Promise waitForServices(long timeoutMillis, Collection<String> services) { return serviceRegistry.waitForServices(timeoutMillis, services); }
java
public Promise waitForServices(long timeoutMillis, Collection<String> services) { return serviceRegistry.waitForServices(timeoutMillis, services); }
[ "public", "Promise", "waitForServices", "(", "long", "timeoutMillis", ",", "Collection", "<", "String", ">", "services", ")", "{", "return", "serviceRegistry", ".", "waitForServices", "(", "timeoutMillis", ",", "services", ")", ";", "}" ]
Waits for a collection of services. Sample code:<br> <br> Set&lt;String&gt; serviceNames = ...<br> broker.waitForServices(5000, serviceNames).then(in -&gt; {<br> broker.getLogger().info("Ok");<br> }.catchError(error -&gt; {<br> broker.getLogger().info("Failed / timeout");<br> } @param timeoutMillis timeout in milliseconds @param services collection of service names @return listenable Promise
[ "Waits", "for", "a", "collection", "of", "services", ".", "Sample", "code", ":", "<br", ">", "<br", ">", "Set&lt", ";", "String&gt", ";", "serviceNames", "=", "...", "<br", ">", "broker", ".", "waitForServices", "(", "5000", "serviceNames", ")", ".", "th...
train
https://github.com/moleculer-java/moleculer-java/blob/27575c44b9ecacc17c4456ceacf5d1851abf1cc4/src/main/java/services/moleculer/ServiceBroker.java#L826-L828
michael-rapp/AndroidBottomSheet
library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java
BottomSheet.addItem
public final void addItem(final int id, @StringRes final int titleId) { Item item = new Item(getContext(), id, titleId); adapter.add(item); adaptGridViewHeight(); }
java
public final void addItem(final int id, @StringRes final int titleId) { Item item = new Item(getContext(), id, titleId); adapter.add(item); adaptGridViewHeight(); }
[ "public", "final", "void", "addItem", "(", "final", "int", "id", ",", "@", "StringRes", "final", "int", "titleId", ")", "{", "Item", "item", "=", "new", "Item", "(", "getContext", "(", ")", ",", "id", ",", "titleId", ")", ";", "adapter", ".", "add", ...
Adds a new item to the bottom sheet. @param id The id of the item, which should be added, as an {@link Integer} value. The id must be at least 0 @param titleId The resource id of the title of the item, which should be added, as an {@link Integer} value. The resource id must correspond to a valid string resource
[ "Adds", "a", "new", "item", "to", "the", "bottom", "sheet", "." ]
train
https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2019-L2023
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbConnection.java
MariaDbConnection.prepareStatement
public PreparedStatement prepareStatement(final String sql, final int autoGeneratedKeys) throws SQLException { return internalPrepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, autoGeneratedKeys); }
java
public PreparedStatement prepareStatement(final String sql, final int autoGeneratedKeys) throws SQLException { return internalPrepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, autoGeneratedKeys); }
[ "public", "PreparedStatement", "prepareStatement", "(", "final", "String", "sql", ",", "final", "int", "autoGeneratedKeys", ")", "throws", "SQLException", "{", "return", "internalPrepareStatement", "(", "sql", ",", "ResultSet", ".", "TYPE_FORWARD_ONLY", ",", "ResultSe...
<p>Creates a default <code>PreparedStatement</code> object that has the capability to retrieve auto-generated keys. The given constant tells the driver whether it should make auto-generated keys available for retrieval. This parameter is ignored if the SQL statement is not an <code>INSERT</code> statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).</p> <p><B>Note:</B> This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method <code>prepareStatement</code> will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the <code>PreparedStatement</code> object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.</p> <p>Result sets created using the returned <code>PreparedStatement</code> object will by default be type <code>TYPE_FORWARD_ONLY</code> and have a concurrency level of <code>CONCUR_READ_ONLY</code>. The holdability of the created result sets can be determined by calling {@link #getHoldability}.</p> @param sql an SQL statement that may contain one or more '?' IN parameter placeholders @param autoGeneratedKeys a flag indicating whether auto-generated keys should be returned; one of <code>Statement.RETURN_GENERATED_KEYS</code> or <code>Statement.NO_GENERATED_KEYS</code> @return a new <code>PreparedStatement</code> object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys @throws SQLException if a database access error occurs, this method is called on a closed connection or the given parameter is not a <code>Statement</code> constant indicating whether auto-generated keys should be returned
[ "<p", ">", "Creates", "a", "default", "<code", ">", "PreparedStatement<", "/", "code", ">", "object", "that", "has", "the", "capability", "to", "retrieve", "auto", "-", "generated", "keys", ".", "The", "given", "constant", "tells", "the", "driver", "whether"...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbConnection.java#L415-L421
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.rotateTowards
public Matrix4d rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) { return rotateTowards(dirX, dirY, dirZ, upX, upY, upZ, this); }
java
public Matrix4d rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) { return rotateTowards(dirX, dirY, dirZ, upX, upY, upZ, this); }
[ "public", "Matrix4d", "rotateTowards", "(", "double", "dirX", ",", "double", "dirY", ",", "double", "dirZ", ",", "double", "upX", ",", "double", "upY", ",", "double", "upZ", ")", "{", "return", "rotateTowards", "(", "dirX", ",", "dirY", ",", "dirZ", ",",...
Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local <code>+Z</code> axis with <code>(dirX, dirY, dirZ)</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix, then the new matrix will be <code>M * L</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the lookat transformation will be applied first! <p> In order to set the matrix to a rotation transformation without post-multiplying it, use {@link #rotationTowards(double, double, double, double, double, double) rotationTowards()}. <p> This method is equivalent to calling: <code>mulAffine(new Matrix4d().lookAt(0, 0, 0, -dirX, -dirY, -dirZ, upX, upY, upZ).invertAffine())</code> @see #rotateTowards(Vector3dc, Vector3dc) @see #rotationTowards(double, double, double, double, double, double) @param dirX the x-coordinate of the direction to rotate towards @param dirY the y-coordinate of the direction to rotate towards @param dirZ the z-coordinate of the direction to rotate towards @param upX the x-coordinate of the up vector @param upY the y-coordinate of the up vector @param upZ the z-coordinate of the up vector @return this
[ "Apply", "a", "model", "transformation", "to", "this", "matrix", "for", "a", "right", "-", "handed", "coordinate", "system", "that", "aligns", "the", "local", "<code", ">", "+", "Z<", "/", "code", ">", "axis", "with", "<code", ">", "(", "dirX", "dirY", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L15181-L15183
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getCharacterEquipment
public void getCharacterEquipment(String API, String name, Callback<CharacterEquipment> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacterEquipment(name, API).enqueue(callback); }
java
public void getCharacterEquipment(String API, String name, Callback<CharacterEquipment> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacterEquipment(name, API).enqueue(callback); }
[ "public", "void", "getCharacterEquipment", "(", "String", "API", ",", "String", "name", ",", "Callback", "<", "CharacterEquipment", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "...
For more info on character equipment API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Equipment">here</a><br/> @param API API key @param name name of character @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key | empty character name @throws NullPointerException if given {@link Callback} is empty @see CharacterEquipment equipment info
[ "For", "more", "info", "on", "character", "equipment", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "characters#Equipment", ">", "here<", "/", "a", ">", "<br", "/",...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L751-L754
aws/aws-sdk-java
aws-java-sdk-servicediscovery/src/main/java/com/amazonaws/services/servicediscovery/model/DiscoverInstancesRequest.java
DiscoverInstancesRequest.withQueryParameters
public DiscoverInstancesRequest withQueryParameters(java.util.Map<String, String> queryParameters) { setQueryParameters(queryParameters); return this; }
java
public DiscoverInstancesRequest withQueryParameters(java.util.Map<String, String> queryParameters) { setQueryParameters(queryParameters); return this; }
[ "public", "DiscoverInstancesRequest", "withQueryParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "queryParameters", ")", "{", "setQueryParameters", "(", "queryParameters", ")", ";", "return", "this", ";", "}" ]
<p> A string map that contains attributes with values that you can use to filter instances by any custom attribute that you specified when you registered the instance. Only instances that match all the specified key/value pairs will be returned. </p> @param queryParameters A string map that contains attributes with values that you can use to filter instances by any custom attribute that you specified when you registered the instance. Only instances that match all the specified key/value pairs will be returned. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "string", "map", "that", "contains", "attributes", "with", "values", "that", "you", "can", "use", "to", "filter", "instances", "by", "any", "custom", "attribute", "that", "you", "specified", "when", "you", "registered", "the", "instance", "."...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicediscovery/src/main/java/com/amazonaws/services/servicediscovery/model/DiscoverInstancesRequest.java#L242-L245
elvishew/xLog
library/src/main/java/com/elvishew/xlog/Logger.java
Logger.println
private void println(int logLevel, String format, Object... args) { if (logLevel < logConfiguration.logLevel) { return; } printlnInternal(logLevel, formatArgs(format, args)); }
java
private void println(int logLevel, String format, Object... args) { if (logLevel < logConfiguration.logLevel) { return; } printlnInternal(logLevel, formatArgs(format, args)); }
[ "private", "void", "println", "(", "int", "logLevel", ",", "String", "format", ",", "Object", "...", "args", ")", "{", "if", "(", "logLevel", "<", "logConfiguration", ".", "logLevel", ")", "{", "return", ";", "}", "printlnInternal", "(", "logLevel", ",", ...
Print a log in a new line. @param logLevel the log level of the printing log @param format the format of the printing log, null if just need to concat arguments @param args the arguments of the printing log
[ "Print", "a", "log", "in", "a", "new", "line", "." ]
train
https://github.com/elvishew/xLog/blob/c6fb95555ce619d3e527f5ba6c45d4d247c5a838/library/src/main/java/com/elvishew/xlog/Logger.java#L515-L520
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.deletePropertyDefinition
public void deletePropertyDefinition(CmsDbContext dbc, String name) throws CmsException { CmsPropertyDefinition propertyDefinition = null; try { // first read and then delete the metadefinition. propertyDefinition = readPropertyDefinition(dbc, name); getVfsDriver(dbc).deletePropertyDefinition(dbc, propertyDefinition); getHistoryDriver(dbc).deletePropertyDefinition(dbc, propertyDefinition); } finally { // fire an event that a property of a resource has been deleted OpenCms.fireCmsEvent( new CmsEvent( I_CmsEventListener.EVENT_PROPERTY_DEFINITION_MODIFIED, Collections.<String, Object> singletonMap("propertyDefinition", propertyDefinition))); } }
java
public void deletePropertyDefinition(CmsDbContext dbc, String name) throws CmsException { CmsPropertyDefinition propertyDefinition = null; try { // first read and then delete the metadefinition. propertyDefinition = readPropertyDefinition(dbc, name); getVfsDriver(dbc).deletePropertyDefinition(dbc, propertyDefinition); getHistoryDriver(dbc).deletePropertyDefinition(dbc, propertyDefinition); } finally { // fire an event that a property of a resource has been deleted OpenCms.fireCmsEvent( new CmsEvent( I_CmsEventListener.EVENT_PROPERTY_DEFINITION_MODIFIED, Collections.<String, Object> singletonMap("propertyDefinition", propertyDefinition))); } }
[ "public", "void", "deletePropertyDefinition", "(", "CmsDbContext", "dbc", ",", "String", "name", ")", "throws", "CmsException", "{", "CmsPropertyDefinition", "propertyDefinition", "=", "null", ";", "try", "{", "// first read and then delete the metadefinition.", "propertyDe...
Deletes a property definition.<p> @param dbc the current database context @param name the name of the property definition to delete @throws CmsException if something goes wrong
[ "Deletes", "a", "property", "definition", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2748-L2765
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java
CommonsOJBLockManager.tryLock
public boolean tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant, Object isolationId) { timeoutCheck(ownerId); OJBLock lock = atomicGetOrCreateLock(resourceId, isolationId); boolean acquired = lock.tryLock(ownerId, targetLockLevel, reentrant ? GenericLock.COMPATIBILITY_REENTRANT : GenericLock.COMPATIBILITY_NONE, false); if(acquired) { addOwner(ownerId, lock); } return acquired; }
java
public boolean tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant, Object isolationId) { timeoutCheck(ownerId); OJBLock lock = atomicGetOrCreateLock(resourceId, isolationId); boolean acquired = lock.tryLock(ownerId, targetLockLevel, reentrant ? GenericLock.COMPATIBILITY_REENTRANT : GenericLock.COMPATIBILITY_NONE, false); if(acquired) { addOwner(ownerId, lock); } return acquired; }
[ "public", "boolean", "tryLock", "(", "Object", "ownerId", ",", "Object", "resourceId", ",", "int", "targetLockLevel", ",", "boolean", "reentrant", ",", "Object", "isolationId", ")", "{", "timeoutCheck", "(", "ownerId", ")", ";", "OJBLock", "lock", "=", "atomic...
Tries to acquire a lock on a resource. <br> <br> This method does not block, but immediatly returns. If a lock is not available <code>false</code> will be returned. @param ownerId a unique id identifying the entity that wants to acquire this lock @param resourceId the resource to get the level for @param targetLockLevel the lock level to acquire @param reentrant <code>true</code> if this request shall not be influenced by other locks held by the same owner @param isolationId the isolation level identity key. See {@link CommonsOJBLockManager}. @return <code>true</code> if the lock has been acquired, <code>false</code> otherwise
[ "Tries", "to", "acquire", "a", "lock", "on", "a", "resource", ".", "<br", ">", "<br", ">", "This", "method", "does", "not", "block", "but", "immediatly", "returns", ".", "If", "a", "lock", "is", "not", "available", "<code", ">", "false<", "/", "code", ...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java#L73-L87
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/BatchItemRequestSerializer.java
BatchItemRequestSerializer.getObjectMapper
private ObjectMapper getObjectMapper() { ObjectMapper mapper = new ObjectMapper(); AnnotationIntrospector primary = new JacksonAnnotationIntrospector(); AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(); AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary); mapper.setAnnotationIntrospector(pair); mapper.setSerializationInclusion(Include.NON_NULL); return mapper; }
java
private ObjectMapper getObjectMapper() { ObjectMapper mapper = new ObjectMapper(); AnnotationIntrospector primary = new JacksonAnnotationIntrospector(); AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(); AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary); mapper.setAnnotationIntrospector(pair); mapper.setSerializationInclusion(Include.NON_NULL); return mapper; }
[ "private", "ObjectMapper", "getObjectMapper", "(", ")", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "AnnotationIntrospector", "primary", "=", "new", "JacksonAnnotationIntrospector", "(", ")", ";", "AnnotationIntrospector", "secondary", "=...
Method to get the Jackson object mapper @return ObjectMapper the object mapper
[ "Method", "to", "get", "the", "Jackson", "object", "mapper" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/BatchItemRequestSerializer.java#L163-L173
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.costRateTableWriteRequired
private boolean costRateTableWriteRequired(CostRateTableEntry entry, Date from) { boolean fromDate = (DateHelper.compare(from, DateHelper.FIRST_DATE) > 0); boolean toDate = (DateHelper.compare(entry.getEndDate(), DateHelper.LAST_DATE) > 0); boolean costPerUse = (NumberHelper.getDouble(entry.getCostPerUse()) != 0); boolean overtimeRate = (entry.getOvertimeRate() != null && entry.getOvertimeRate().getAmount() != 0); boolean standardRate = (entry.getStandardRate() != null && entry.getStandardRate().getAmount() != 0); return (fromDate || toDate || costPerUse || overtimeRate || standardRate); }
java
private boolean costRateTableWriteRequired(CostRateTableEntry entry, Date from) { boolean fromDate = (DateHelper.compare(from, DateHelper.FIRST_DATE) > 0); boolean toDate = (DateHelper.compare(entry.getEndDate(), DateHelper.LAST_DATE) > 0); boolean costPerUse = (NumberHelper.getDouble(entry.getCostPerUse()) != 0); boolean overtimeRate = (entry.getOvertimeRate() != null && entry.getOvertimeRate().getAmount() != 0); boolean standardRate = (entry.getStandardRate() != null && entry.getStandardRate().getAmount() != 0); return (fromDate || toDate || costPerUse || overtimeRate || standardRate); }
[ "private", "boolean", "costRateTableWriteRequired", "(", "CostRateTableEntry", "entry", ",", "Date", "from", ")", "{", "boolean", "fromDate", "=", "(", "DateHelper", ".", "compare", "(", "from", ",", "DateHelper", ".", "FIRST_DATE", ")", ">", "0", ")", ";", ...
This method determines whether the cost rate table should be written. A default cost rate table should not be written to the file. @param entry cost rate table entry @param from from date @return boolean flag
[ "This", "method", "determines", "whether", "the", "cost", "rate", "table", "should", "be", "written", ".", "A", "default", "cost", "rate", "table", "should", "not", "be", "written", "to", "the", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L996-L1004
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_number_serviceName_changeFeatureType_POST
public OvhTask billingAccount_number_serviceName_changeFeatureType_POST(String billingAccount, String serviceName, OvhTypeEnum featureType) throws IOException { String qPath = "/telephony/{billingAccount}/number/{serviceName}/changeFeatureType"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "featureType", featureType); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask billingAccount_number_serviceName_changeFeatureType_POST(String billingAccount, String serviceName, OvhTypeEnum featureType) throws IOException { String qPath = "/telephony/{billingAccount}/number/{serviceName}/changeFeatureType"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "featureType", featureType); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "billingAccount_number_serviceName_changeFeatureType_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhTypeEnum", "featureType", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/number/{s...
Change the feature type of the phone number REST: POST /telephony/{billingAccount}/number/{serviceName}/changeFeatureType @param featureType [required] The new feature of the number @param billingAccount [required] The name of your billingAccount @param serviceName [required] Name of the service
[ "Change", "the", "feature", "type", "of", "the", "phone", "number" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5711-L5718
primefaces-extensions/core
src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java
DynaFormRow.addLabel
public DynaFormLabel addLabel(final String value, final int colspan, final int rowspan) { return addLabel(value, true, colspan, rowspan); }
java
public DynaFormLabel addLabel(final String value, final int colspan, final int rowspan) { return addLabel(value, true, colspan, rowspan); }
[ "public", "DynaFormLabel", "addLabel", "(", "final", "String", "value", ",", "final", "int", "colspan", ",", "final", "int", "rowspan", ")", "{", "return", "addLabel", "(", "value", ",", "true", ",", "colspan", ",", "rowspan", ")", ";", "}" ]
Adds a label with given text, colspan and rowspan. @param value label text @param colspan colspan @param rowspan rowspan @return DynaFormLabel added label
[ "Adds", "a", "label", "with", "given", "text", "colspan", "and", "rowspan", "." ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java#L164-L166
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfStamperImp.java
PdfStamperImp.setAdditionalAction
public void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException { if (!(actionType.equals(DOCUMENT_CLOSE) || actionType.equals(WILL_SAVE) || actionType.equals(DID_SAVE) || actionType.equals(WILL_PRINT) || actionType.equals(DID_PRINT))) { throw new PdfException("Invalid additional action type: " + actionType.toString()); } PdfDictionary aa = reader.getCatalog().getAsDict(PdfName.AA); if (aa == null) { if (action == null) return; aa = new PdfDictionary(); reader.getCatalog().put(PdfName.AA, aa); } markUsed(aa); if (action == null) aa.remove(actionType); else aa.put(actionType, action); }
java
public void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException { if (!(actionType.equals(DOCUMENT_CLOSE) || actionType.equals(WILL_SAVE) || actionType.equals(DID_SAVE) || actionType.equals(WILL_PRINT) || actionType.equals(DID_PRINT))) { throw new PdfException("Invalid additional action type: " + actionType.toString()); } PdfDictionary aa = reader.getCatalog().getAsDict(PdfName.AA); if (aa == null) { if (action == null) return; aa = new PdfDictionary(); reader.getCatalog().put(PdfName.AA, aa); } markUsed(aa); if (action == null) aa.remove(actionType); else aa.put(actionType, action); }
[ "public", "void", "setAdditionalAction", "(", "PdfName", "actionType", ",", "PdfAction", "action", ")", "throws", "PdfException", "{", "if", "(", "!", "(", "actionType", ".", "equals", "(", "DOCUMENT_CLOSE", ")", "||", "actionType", ".", "equals", "(", "WILL_S...
Additional-actions defining the actions to be taken in response to various trigger events affecting the document as a whole. The actions types allowed are: <CODE>DOCUMENT_CLOSE</CODE>, <CODE>WILL_SAVE</CODE>, <CODE>DID_SAVE</CODE>, <CODE>WILL_PRINT</CODE> and <CODE>DID_PRINT</CODE>. @param actionType the action type @param action the action to execute in response to the trigger @throws PdfException on invalid action type
[ "Additional", "-", "actions", "defining", "the", "actions", "to", "be", "taken", "in", "response", "to", "various", "trigger", "events", "affecting", "the", "document", "as", "a", "whole", ".", "The", "actions", "types", "allowed", "are", ":", "<CODE", ">", ...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java#L1476-L1496
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
CommitLogSegmentManager.discardSegment
private void discardSegment(final CommitLogSegment segment, final boolean deleteFile) { logger.debug("Segment {} is no longer active and will be deleted {}", segment, deleteFile ? "now" : "by the archive script"); size.addAndGet(-DatabaseDescriptor.getCommitLogSegmentSize()); segmentManagementTasks.add(new Callable<CommitLogSegment>() { public CommitLogSegment call() { segment.close(); if (deleteFile) segment.delete(); return null; } }); }
java
private void discardSegment(final CommitLogSegment segment, final boolean deleteFile) { logger.debug("Segment {} is no longer active and will be deleted {}", segment, deleteFile ? "now" : "by the archive script"); size.addAndGet(-DatabaseDescriptor.getCommitLogSegmentSize()); segmentManagementTasks.add(new Callable<CommitLogSegment>() { public CommitLogSegment call() { segment.close(); if (deleteFile) segment.delete(); return null; } }); }
[ "private", "void", "discardSegment", "(", "final", "CommitLogSegment", "segment", ",", "final", "boolean", "deleteFile", ")", "{", "logger", ".", "debug", "(", "\"Segment {} is no longer active and will be deleted {}\"", ",", "segment", ",", "deleteFile", "?", "\"now\""...
Indicates that a segment file should be deleted. @param segment segment to be discarded
[ "Indicates", "that", "a", "segment", "file", "should", "be", "deleted", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java#L407-L422
h2oai/h2o-3
h2o-core/src/main/java/water/util/ReflectionUtils.java
ReflectionUtils.findActualFieldClass
public static Class findActualFieldClass(Class clz, Field f) { // schema.getClass().getGenericSuperclass() instanceof ParameterizedType Type generic_type = f.getGenericType(); if (! (generic_type instanceof TypeVariable)) return f.getType(); // field is a parameterized type // ((TypeVariable)schema.getClass().getField("parameters").getGenericType()) TypeVariable[] tvs = clz.getSuperclass().getTypeParameters(); TypeVariable tv = (TypeVariable)generic_type; String type_param_name = tv.getName(); int which_tv = -1; for(int i = 0; i < tvs.length; i++) if (type_param_name.equals(tvs[i].getName())) which_tv = i; if (-1 == which_tv) { // We topped out in the type heirarchy, so just use the type from f. // E.g., this happens when getting the metadata for the parameters field of ModelSchemaV3. // It has no generic parent, so we need to use the base class. return f.getType(); } ParameterizedType generic_super = (ParameterizedType)clz.getGenericSuperclass(); if (generic_super.getActualTypeArguments()[which_tv] instanceof Class) return (Class)generic_super.getActualTypeArguments()[which_tv]; return findActualFieldClass(clz.getSuperclass(), f); }
java
public static Class findActualFieldClass(Class clz, Field f) { // schema.getClass().getGenericSuperclass() instanceof ParameterizedType Type generic_type = f.getGenericType(); if (! (generic_type instanceof TypeVariable)) return f.getType(); // field is a parameterized type // ((TypeVariable)schema.getClass().getField("parameters").getGenericType()) TypeVariable[] tvs = clz.getSuperclass().getTypeParameters(); TypeVariable tv = (TypeVariable)generic_type; String type_param_name = tv.getName(); int which_tv = -1; for(int i = 0; i < tvs.length; i++) if (type_param_name.equals(tvs[i].getName())) which_tv = i; if (-1 == which_tv) { // We topped out in the type heirarchy, so just use the type from f. // E.g., this happens when getting the metadata for the parameters field of ModelSchemaV3. // It has no generic parent, so we need to use the base class. return f.getType(); } ParameterizedType generic_super = (ParameterizedType)clz.getGenericSuperclass(); if (generic_super.getActualTypeArguments()[which_tv] instanceof Class) return (Class)generic_super.getActualTypeArguments()[which_tv]; return findActualFieldClass(clz.getSuperclass(), f); }
[ "public", "static", "Class", "findActualFieldClass", "(", "Class", "clz", ",", "Field", "f", ")", "{", "// schema.getClass().getGenericSuperclass() instanceof ParameterizedType", "Type", "generic_type", "=", "f", ".", "getGenericType", "(", ")", ";", "if", "(", "!", ...
Reflection helper which returns the actual class for a field which has a parameterized type. E.g., DeepLearningV2's "parameters" class is in parent ModelBuilderSchema, and is parameterized by type parameter P.
[ "Reflection", "helper", "which", "returns", "the", "actual", "class", "for", "a", "field", "which", "has", "a", "parameterized", "type", ".", "E", ".", "g", ".", "DeepLearningV2", "s", "parameters", "class", "is", "in", "parent", "ModelBuilderSchema", "and", ...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/ReflectionUtils.java#L65-L94
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.getQuantileLowerBound
public T getQuantileLowerBound(final double fraction) { return getQuantile(max(0, fraction - Util.getNormalizedRankError(k_, false))); }
java
public T getQuantileLowerBound(final double fraction) { return getQuantile(max(0, fraction - Util.getNormalizedRankError(k_, false))); }
[ "public", "T", "getQuantileLowerBound", "(", "final", "double", "fraction", ")", "{", "return", "getQuantile", "(", "max", "(", "0", ",", "fraction", "-", "Util", ".", "getNormalizedRankError", "(", "k_", ",", "false", ")", ")", ")", ";", "}" ]
Gets the lower bound of the value interval in which the true quantile of the given rank exists with a confidence of at least 99%. @param fraction the given normalized rank as a fraction @return the lower bound of the value interval in which the true quantile of the given rank exists with a confidence of at least 99%. Returns NaN if the sketch is empty.
[ "Gets", "the", "lower", "bound", "of", "the", "value", "interval", "in", "which", "the", "true", "quantile", "of", "the", "given", "rank", "exists", "with", "a", "confidence", "of", "at", "least", "99%", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L293-L295
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java
Environment.processLinesOfEnvironmentVariables
private static void processLinesOfEnvironmentVariables( BufferedReader reader, Properties properties ) throws IOException { String line = reader.readLine(); while( null != line ) { int index = line.indexOf( '=' ); if( -1 == index && line.length() != 0 ) { String message = "Skipping line - could not find '=' in line: '" + line + "'"; System.err.println( message ); } else { String name = line.substring( 0, index ); String value = line.substring( index + 1, line.length() ); properties.setProperty( name, value ); } line = reader.readLine(); } }
java
private static void processLinesOfEnvironmentVariables( BufferedReader reader, Properties properties ) throws IOException { String line = reader.readLine(); while( null != line ) { int index = line.indexOf( '=' ); if( -1 == index && line.length() != 0 ) { String message = "Skipping line - could not find '=' in line: '" + line + "'"; System.err.println( message ); } else { String name = line.substring( 0, index ); String value = line.substring( index + 1, line.length() ); properties.setProperty( name, value ); } line = reader.readLine(); } }
[ "private", "static", "void", "processLinesOfEnvironmentVariables", "(", "BufferedReader", "reader", ",", "Properties", "properties", ")", "throws", "IOException", "{", "String", "line", "=", "reader", ".", "readLine", "(", ")", ";", "while", "(", "null", "!=", "...
Process the lines of the environment variables returned. @param reader The Reader that containes the lines to be parsed. @param properties The Properties objects to be populated with the environment variable names and values. @throws IOException if an underlying I/O problem occurs.
[ "Process", "the", "lines", "of", "the", "environment", "variables", "returned", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L559-L580
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createSSHKey
public GitlabSSHKey createSSHKey(String title, String key) throws IOException { Query query = new Query() .append("title", title) .append("key", key); String tailUrl = GitlabUser.USER_URL + GitlabSSHKey.KEYS_URL + query.toString(); return dispatch().to(tailUrl, GitlabSSHKey.class); }
java
public GitlabSSHKey createSSHKey(String title, String key) throws IOException { Query query = new Query() .append("title", title) .append("key", key); String tailUrl = GitlabUser.USER_URL + GitlabSSHKey.KEYS_URL + query.toString(); return dispatch().to(tailUrl, GitlabSSHKey.class); }
[ "public", "GitlabSSHKey", "createSSHKey", "(", "String", "title", ",", "String", "key", ")", "throws", "IOException", "{", "Query", "query", "=", "new", "Query", "(", ")", ".", "append", "(", "\"title\"", ",", "title", ")", ".", "append", "(", "\"key\"", ...
Create a new ssh key for the authenticated user. @param title The title of the ssh key @param key The public key @return The new GitlabSSHKey @throws IOException on gitlab api call error
[ "Create", "a", "new", "ssh", "key", "for", "the", "authenticated", "user", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L404-L413
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java
LinkedConverter.setData
public int setData(Object state, boolean bDisplayOption, int iMoveMode) { // Must be overidden if (this.getNextConverter() != null) return this.getNextConverter().setData(state, bDisplayOption, iMoveMode); else return super.setData(state, bDisplayOption, iMoveMode); }
java
public int setData(Object state, boolean bDisplayOption, int iMoveMode) { // Must be overidden if (this.getNextConverter() != null) return this.getNextConverter().setData(state, bDisplayOption, iMoveMode); else return super.setData(state, bDisplayOption, iMoveMode); }
[ "public", "int", "setData", "(", "Object", "state", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "// Must be overidden", "if", "(", "this", ".", "getNextConverter", "(", ")", "!=", "null", ")", "return", "this", ".", "getNextConverter",...
For binary fields, set the current state. @param state The state to set this field. @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "For", "binary", "fields", "set", "the", "current", "state", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java#L167-L173
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Bindings.java
Bindings.bindVisible
public static void bindVisible (Value<Boolean> value, final Widget... targets) { value.addListenerAndTrigger(new Value.Listener<Boolean>() { public void valueChanged (Boolean visible) { for (Widget target : targets) { target.setVisible(visible); } } }); }
java
public static void bindVisible (Value<Boolean> value, final Widget... targets) { value.addListenerAndTrigger(new Value.Listener<Boolean>() { public void valueChanged (Boolean visible) { for (Widget target : targets) { target.setVisible(visible); } } }); }
[ "public", "static", "void", "bindVisible", "(", "Value", "<", "Boolean", ">", "value", ",", "final", "Widget", "...", "targets", ")", "{", "value", ".", "addListenerAndTrigger", "(", "new", "Value", ".", "Listener", "<", "Boolean", ">", "(", ")", "{", "p...
Binds the visible state of the target widget to the supplied boolean value.
[ "Binds", "the", "visible", "state", "of", "the", "target", "widget", "to", "the", "supplied", "boolean", "value", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Bindings.java#L73-L82
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/ir/transform/GosuClassTransformer.java
GosuClassTransformer.addCovarientProxyBridgeMethods
private boolean addCovarientProxyBridgeMethods( DynamicFunctionSymbol dfs ) { IGosuClassInternal gsProxyClass = dfs.getGosuClass(); if( gsProxyClass == null || !gsProxyClass.isProxy() ) { // Not a proxy class so no java method to override return false; } if( dfs.getReturnType().isPrimitive() ) { // Void or primitive return means no covariant override possible return false; } IJavaTypeInternal javaType = (IJavaTypeInternal)gsProxyClass.getJavaType(); if( javaType.isInterface() ) { IJavaClassMethod m = getMethodOverridableFromDfs( dfs, javaType.getBackingClassInfo() ); if( m != null && Modifier.isAbstract( m.getModifiers() ) ) { return genInterfaceProxyBridgeMethod( m, javaType.getBackingClassInfo() ); } } return false; }
java
private boolean addCovarientProxyBridgeMethods( DynamicFunctionSymbol dfs ) { IGosuClassInternal gsProxyClass = dfs.getGosuClass(); if( gsProxyClass == null || !gsProxyClass.isProxy() ) { // Not a proxy class so no java method to override return false; } if( dfs.getReturnType().isPrimitive() ) { // Void or primitive return means no covariant override possible return false; } IJavaTypeInternal javaType = (IJavaTypeInternal)gsProxyClass.getJavaType(); if( javaType.isInterface() ) { IJavaClassMethod m = getMethodOverridableFromDfs( dfs, javaType.getBackingClassInfo() ); if( m != null && Modifier.isAbstract( m.getModifiers() ) ) { return genInterfaceProxyBridgeMethod( m, javaType.getBackingClassInfo() ); } } return false; }
[ "private", "boolean", "addCovarientProxyBridgeMethods", "(", "DynamicFunctionSymbol", "dfs", ")", "{", "IGosuClassInternal", "gsProxyClass", "=", "dfs", ".", "getGosuClass", "(", ")", ";", "if", "(", "gsProxyClass", "==", "null", "||", "!", "gsProxyClass", ".", "i...
Add a bridge method for a Java interface method that is not only implemented by a method in this Gosu class, but is also itself a covariant "override" of its super interface E.g., <pre> interface JavaBase { public CharSequence makeText(); } interface JavaSub extends JavaBase { public String makeText(); } class GosuSub extends JavaSub { function makeText() : String ... } </pre> Here we need for this class to define a bridge method implementing JavaBase#makeText() : CharSequence
[ "Add", "a", "bridge", "method", "for", "a", "Java", "interface", "method", "that", "is", "not", "only", "implemented", "by", "a", "method", "in", "this", "Gosu", "class", "but", "is", "also", "itself", "a", "covariant", "override", "of", "its", "super", ...
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/GosuClassTransformer.java#L1208-L1233
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.withObjectOutputStream
public static <T> T withObjectOutputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectOutputStream") Closure<T> closure) throws IOException { return IOGroovyMethods.withStream(newObjectOutputStream(file), closure); }
java
public static <T> T withObjectOutputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.ObjectOutputStream") Closure<T> closure) throws IOException { return IOGroovyMethods.withStream(newObjectOutputStream(file), closure); }
[ "public", "static", "<", "T", ">", "T", "withObjectOutputStream", "(", "File", "file", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.ObjectOutputStream\"", ")", "Closure", "<", "T", ">", "closure", ...
Create a new ObjectOutputStream for this file and then pass it to the closure. This method ensures the stream is closed after the closure returns. @param file a File @param closure a closure @return the value returned by the closure @throws IOException if an IOException occurs. @see IOGroovyMethods#withStream(java.io.OutputStream, groovy.lang.Closure) @since 1.5.0
[ "Create", "a", "new", "ObjectOutputStream", "for", "this", "file", "and", "then", "pass", "it", "to", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L149-L151
CloudSlang/cs-actions
cs-vmware/src/main/java/io/cloudslang/content/vmware/services/VmService.java
VmService.cloneVM
public Map<String, String> cloneVM(HttpInputs httpInputs, VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { ManagedObjectReference vmMor = new MorObjectHandler().getMor(connectionResources, ManagedObjectType.VIRTUAL_MACHINE.getValue(), vmInputs.getVirtualMachineName()); if (vmMor != null) { VmUtils utils = new VmUtils(); ManagedObjectReference folder = utils.getMorFolder(vmInputs.getFolderName(), connectionResources); ManagedObjectReference resourcePool = utils.getMorResourcePool(vmInputs.getCloneResourcePool(), connectionResources); ManagedObjectReference host = utils.getMorHost(vmInputs.getCloneHost(), connectionResources, vmMor); ManagedObjectReference dataStore = utils.getMorDataStore(vmInputs.getCloneDataStore(), connectionResources, vmMor, vmInputs); VirtualMachineRelocateSpec vmRelocateSpec = utils.getVirtualMachineRelocateSpec(resourcePool, host, dataStore, vmInputs); VirtualMachineCloneSpec cloneSpec = new VmConfigSpecs().getCloneSpec(vmInputs, vmRelocateSpec); ManagedObjectReference taskMor = connectionResources.getVimPortType() .cloneVMTask(vmMor, folder, vmInputs.getCloneName(), cloneSpec); return new ResponseHelper(connectionResources, taskMor).getResultsMap("Success: The [" + vmInputs.getVirtualMachineName() + "] VM was successfully cloned. The taskId is: " + taskMor.getValue(), "Failure: The [" + vmInputs.getVirtualMachineName() + "] VM could not be cloned."); } else { return ResponseUtils.getVmNotFoundResultsMap(vmInputs); } } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
java
public Map<String, String> cloneVM(HttpInputs httpInputs, VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { ManagedObjectReference vmMor = new MorObjectHandler().getMor(connectionResources, ManagedObjectType.VIRTUAL_MACHINE.getValue(), vmInputs.getVirtualMachineName()); if (vmMor != null) { VmUtils utils = new VmUtils(); ManagedObjectReference folder = utils.getMorFolder(vmInputs.getFolderName(), connectionResources); ManagedObjectReference resourcePool = utils.getMorResourcePool(vmInputs.getCloneResourcePool(), connectionResources); ManagedObjectReference host = utils.getMorHost(vmInputs.getCloneHost(), connectionResources, vmMor); ManagedObjectReference dataStore = utils.getMorDataStore(vmInputs.getCloneDataStore(), connectionResources, vmMor, vmInputs); VirtualMachineRelocateSpec vmRelocateSpec = utils.getVirtualMachineRelocateSpec(resourcePool, host, dataStore, vmInputs); VirtualMachineCloneSpec cloneSpec = new VmConfigSpecs().getCloneSpec(vmInputs, vmRelocateSpec); ManagedObjectReference taskMor = connectionResources.getVimPortType() .cloneVMTask(vmMor, folder, vmInputs.getCloneName(), cloneSpec); return new ResponseHelper(connectionResources, taskMor).getResultsMap("Success: The [" + vmInputs.getVirtualMachineName() + "] VM was successfully cloned. The taskId is: " + taskMor.getValue(), "Failure: The [" + vmInputs.getVirtualMachineName() + "] VM could not be cloned."); } else { return ResponseUtils.getVmNotFoundResultsMap(vmInputs); } } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
[ "public", "Map", "<", "String", ",", "String", ">", "cloneVM", "(", "HttpInputs", "httpInputs", ",", "VmInputs", "vmInputs", ")", "throws", "Exception", "{", "ConnectionResources", "connectionResources", "=", "new", "ConnectionResources", "(", "httpInputs", ",", "...
Method used to connect to data center and clone a virtual machine identified by the inputs provided. @param httpInputs Object that has all the inputs necessary to made a connection to data center @param vmInputs Object that has all the specific inputs necessary to identify the virtual machine that will be cloned @return Map with String as key and value that contains returnCode of the operation, success message with task id of the execution or failure message and the exception if there is one @throws Exception
[ "Method", "used", "to", "connect", "to", "data", "center", "and", "clone", "a", "virtual", "machine", "identified", "by", "the", "inputs", "provided", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-vmware/src/main/java/io/cloudslang/content/vmware/services/VmService.java#L337-L372
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java
GVRAssetLoader.loadJassimpModel
private GVRSceneObject loadJassimpModel(AssetRequest request, final GVRSceneObject model) throws IOException { Jassimp.setWrapperProvider(GVRJassimpAdapter.sWrapperProvider); org.gearvrf.jassimp.AiScene assimpScene = null; String filePath = request.getBaseName(); GVRJassimpAdapter jassimpAdapter = new GVRJassimpAdapter(this, filePath); model.setName(filePath); ResourceVolumeIO jassimpIO = new ResourceVolumeIO(request.getVolume()); try { assimpScene = Jassimp.importFile(FileNameUtils.getFilename(filePath), jassimpAdapter.toJassimpSettings(request.getImportSettings()), jassimpIO); } catch (IOException ex) { String errmsg = "Cannot load model: " + ex.getMessage() + " " + jassimpIO.getLastError(); request.onModelError(mContext, errmsg, filePath); throw new IOException(errmsg); } if (assimpScene == null) { String errmsg = "Cannot load model: " + filePath; request.onModelError(mContext, errmsg, filePath); throw new IOException(errmsg); } jassimpAdapter.processScene(request, model, assimpScene); request.onModelLoaded(mContext, model, filePath); mContext.runOnTheFrameworkThread(new Runnable() { public void run() { // Inform the loaded object after it has been attached to the scene graph mContext.getEventManager().sendEvent( model, ISceneObjectEvents.class, "onLoaded"); } }); return model; }
java
private GVRSceneObject loadJassimpModel(AssetRequest request, final GVRSceneObject model) throws IOException { Jassimp.setWrapperProvider(GVRJassimpAdapter.sWrapperProvider); org.gearvrf.jassimp.AiScene assimpScene = null; String filePath = request.getBaseName(); GVRJassimpAdapter jassimpAdapter = new GVRJassimpAdapter(this, filePath); model.setName(filePath); ResourceVolumeIO jassimpIO = new ResourceVolumeIO(request.getVolume()); try { assimpScene = Jassimp.importFile(FileNameUtils.getFilename(filePath), jassimpAdapter.toJassimpSettings(request.getImportSettings()), jassimpIO); } catch (IOException ex) { String errmsg = "Cannot load model: " + ex.getMessage() + " " + jassimpIO.getLastError(); request.onModelError(mContext, errmsg, filePath); throw new IOException(errmsg); } if (assimpScene == null) { String errmsg = "Cannot load model: " + filePath; request.onModelError(mContext, errmsg, filePath); throw new IOException(errmsg); } jassimpAdapter.processScene(request, model, assimpScene); request.onModelLoaded(mContext, model, filePath); mContext.runOnTheFrameworkThread(new Runnable() { public void run() { // Inform the loaded object after it has been attached to the scene graph mContext.getEventManager().sendEvent( model, ISceneObjectEvents.class, "onLoaded"); } }); return model; }
[ "private", "GVRSceneObject", "loadJassimpModel", "(", "AssetRequest", "request", ",", "final", "GVRSceneObject", "model", ")", "throws", "IOException", "{", "Jassimp", ".", "setWrapperProvider", "(", "GVRJassimpAdapter", ".", "sWrapperProvider", ")", ";", "org", ".", ...
Loads a scene object {@link GVRSceneObject} from a 3D model. @param request AssetRequest with the filename, relative to the root of the volume. @param model GVRSceneObject that is the root of the loaded asset @return A {@link GVRSceneObject} that contains the meshes with textures and bones and animations. @throws IOException
[ "Loads", "a", "scene", "object", "{", "@link", "GVRSceneObject", "}", "from", "a", "3D", "model", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java#L1812-L1851
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/session/SessionCookie.java
SessionCookie.getInstance
public static Session getInstance(String name, PageContext pc, Log log) { if (!StringUtil.isEmpty(name)) name = StringUtil.toUpperCase(StringUtil.toVariableName(name)); String cookieName = "CF_" + TYPE + "_" + name; return new SessionCookie(pc, cookieName, _loadData(pc, cookieName, SCOPE_SESSION, "session", log)); }
java
public static Session getInstance(String name, PageContext pc, Log log) { if (!StringUtil.isEmpty(name)) name = StringUtil.toUpperCase(StringUtil.toVariableName(name)); String cookieName = "CF_" + TYPE + "_" + name; return new SessionCookie(pc, cookieName, _loadData(pc, cookieName, SCOPE_SESSION, "session", log)); }
[ "public", "static", "Session", "getInstance", "(", "String", "name", ",", "PageContext", "pc", ",", "Log", "log", ")", "{", "if", "(", "!", "StringUtil", ".", "isEmpty", "(", "name", ")", ")", "name", "=", "StringUtil", ".", "toUpperCase", "(", "StringUt...
load new instance of the class @param name @param pc @return
[ "load", "new", "instance", "of", "the", "class" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/session/SessionCookie.java#L60-L64
splitwise/TokenAutoComplete
library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java
TokenCompleteTextView.removeSpan
private void removeSpan(Editable text, TokenImageSpan span) { //We usually add whitespace after a token, so let's try to remove it as well if it's present int end = text.getSpanEnd(span); if (end < text.length() && text.charAt(end) == ' ') { end += 1; } internalEditInProgress = true; text.delete(text.getSpanStart(span), end); internalEditInProgress = false; if (allowCollapse && !isFocused()) { updateCountSpan(); } }
java
private void removeSpan(Editable text, TokenImageSpan span) { //We usually add whitespace after a token, so let's try to remove it as well if it's present int end = text.getSpanEnd(span); if (end < text.length() && text.charAt(end) == ' ') { end += 1; } internalEditInProgress = true; text.delete(text.getSpanStart(span), end); internalEditInProgress = false; if (allowCollapse && !isFocused()) { updateCountSpan(); } }
[ "private", "void", "removeSpan", "(", "Editable", "text", ",", "TokenImageSpan", "span", ")", "{", "//We usually add whitespace after a token, so let's try to remove it as well if it's present", "int", "end", "=", "text", ".", "getSpanEnd", "(", "span", ")", ";", "if", ...
Remove a span from the current EditText and fire the appropriate callback @param text Editable to remove the span from @param span TokenImageSpan to be removed
[ "Remove", "a", "span", "from", "the", "current", "EditText", "and", "fire", "the", "appropriate", "callback" ]
train
https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L1040-L1054
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.multipleQueries
public JSONObject multipleQueries(List<IndexQuery> queries, RequestOptions requestOptions) throws AlgoliaException { return multipleQueries(queries, "none", requestOptions); }
java
public JSONObject multipleQueries(List<IndexQuery> queries, RequestOptions requestOptions) throws AlgoliaException { return multipleQueries(queries, "none", requestOptions); }
[ "public", "JSONObject", "multipleQueries", "(", "List", "<", "IndexQuery", ">", "queries", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaException", "{", "return", "multipleQueries", "(", "queries", ",", "\"none\"", ",", "requestOptions", ")", ";",...
This method allows to query multiple indexes with one API call @param requestOptions Options to pass to this request
[ "This", "method", "allows", "to", "query", "multiple", "indexes", "with", "one", "API", "call" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L1264-L1266
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.metaClass
public static MetaClass metaClass (Class self, Closure closure){ MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry(); MetaClass mc = metaClassRegistry.getMetaClass(self); if (mc instanceof ExpandoMetaClass) { ((ExpandoMetaClass) mc).define(closure); return mc; } else { if (mc instanceof DelegatingMetaClass && ((DelegatingMetaClass) mc).getAdaptee() instanceof ExpandoMetaClass) { ((ExpandoMetaClass)((DelegatingMetaClass) mc).getAdaptee()).define(closure); return mc; } else { if (mc instanceof DelegatingMetaClass && ((DelegatingMetaClass) mc).getAdaptee().getClass() == MetaClassImpl.class) { ExpandoMetaClass emc = new ExpandoMetaClass(self, false, true); emc.initialize(); emc.define(closure); ((DelegatingMetaClass) mc).setAdaptee(emc); return mc; } else { if (mc.getClass() == MetaClassImpl.class) { // default case mc = new ExpandoMetaClass(self, false, true); mc.initialize(); ((ExpandoMetaClass)mc).define(closure); metaClassRegistry.setMetaClass(self, mc); return mc; } else { throw new GroovyRuntimeException("Can't add methods to custom meta class " + mc); } } } } }
java
public static MetaClass metaClass (Class self, Closure closure){ MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry(); MetaClass mc = metaClassRegistry.getMetaClass(self); if (mc instanceof ExpandoMetaClass) { ((ExpandoMetaClass) mc).define(closure); return mc; } else { if (mc instanceof DelegatingMetaClass && ((DelegatingMetaClass) mc).getAdaptee() instanceof ExpandoMetaClass) { ((ExpandoMetaClass)((DelegatingMetaClass) mc).getAdaptee()).define(closure); return mc; } else { if (mc instanceof DelegatingMetaClass && ((DelegatingMetaClass) mc).getAdaptee().getClass() == MetaClassImpl.class) { ExpandoMetaClass emc = new ExpandoMetaClass(self, false, true); emc.initialize(); emc.define(closure); ((DelegatingMetaClass) mc).setAdaptee(emc); return mc; } else { if (mc.getClass() == MetaClassImpl.class) { // default case mc = new ExpandoMetaClass(self, false, true); mc.initialize(); ((ExpandoMetaClass)mc).define(closure); metaClassRegistry.setMetaClass(self, mc); return mc; } else { throw new GroovyRuntimeException("Can't add methods to custom meta class " + mc); } } } } }
[ "public", "static", "MetaClass", "metaClass", "(", "Class", "self", ",", "Closure", "closure", ")", "{", "MetaClassRegistry", "metaClassRegistry", "=", "GroovySystem", ".", "getMetaClassRegistry", "(", ")", ";", "MetaClass", "mc", "=", "metaClassRegistry", ".", "g...
Sets/updates the metaclass for a given class to a closure. @param self the class whose metaclass we wish to update @param closure the closure representing the new metaclass @return the new metaclass value @throws GroovyRuntimeException if the metaclass can't be set for this class @since 1.6.0
[ "Sets", "/", "updates", "the", "metaclass", "for", "a", "given", "class", "to", "a", "closure", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17338-L17374
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java
GlobalConfiguration.loadConfiguration
public static Configuration loadConfiguration(final String configDir, @Nullable final Configuration dynamicProperties) { if (configDir == null) { throw new IllegalArgumentException("Given configuration directory is null, cannot load configuration"); } final File confDirFile = new File(configDir); if (!(confDirFile.exists())) { throw new IllegalConfigurationException( "The given configuration directory name '" + configDir + "' (" + confDirFile.getAbsolutePath() + ") does not describe an existing directory."); } // get Flink yaml configuration file final File yamlConfigFile = new File(confDirFile, FLINK_CONF_FILENAME); if (!yamlConfigFile.exists()) { throw new IllegalConfigurationException( "The Flink config file '" + yamlConfigFile + "' (" + confDirFile.getAbsolutePath() + ") does not exist."); } Configuration configuration = loadYAMLResource(yamlConfigFile); if (dynamicProperties != null) { configuration.addAll(dynamicProperties); } return configuration; }
java
public static Configuration loadConfiguration(final String configDir, @Nullable final Configuration dynamicProperties) { if (configDir == null) { throw new IllegalArgumentException("Given configuration directory is null, cannot load configuration"); } final File confDirFile = new File(configDir); if (!(confDirFile.exists())) { throw new IllegalConfigurationException( "The given configuration directory name '" + configDir + "' (" + confDirFile.getAbsolutePath() + ") does not describe an existing directory."); } // get Flink yaml configuration file final File yamlConfigFile = new File(confDirFile, FLINK_CONF_FILENAME); if (!yamlConfigFile.exists()) { throw new IllegalConfigurationException( "The Flink config file '" + yamlConfigFile + "' (" + confDirFile.getAbsolutePath() + ") does not exist."); } Configuration configuration = loadYAMLResource(yamlConfigFile); if (dynamicProperties != null) { configuration.addAll(dynamicProperties); } return configuration; }
[ "public", "static", "Configuration", "loadConfiguration", "(", "final", "String", "configDir", ",", "@", "Nullable", "final", "Configuration", "dynamicProperties", ")", "{", "if", "(", "configDir", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", ...
Loads the configuration files from the specified directory. If the dynamic properties configuration is not null, then it is added to the loaded configuration. @param configDir directory to load the configuration from @param dynamicProperties configuration file containing the dynamic properties. Null if none. @return The configuration loaded from the given configuration directory
[ "Loads", "the", "configuration", "files", "from", "the", "specified", "directory", ".", "If", "the", "dynamic", "properties", "configuration", "is", "not", "null", "then", "it", "is", "added", "to", "the", "loaded", "configuration", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java#L93-L122
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/metrics/export/Metric.java
Metric.createInternal
private static Metric createInternal( MetricDescriptor metricDescriptor, List<TimeSeries> timeSeriesList) { Utils.checkNotNull(metricDescriptor, "metricDescriptor"); checkTypeMatch(metricDescriptor.getType(), timeSeriesList); return new AutoValue_Metric(metricDescriptor, timeSeriesList); }
java
private static Metric createInternal( MetricDescriptor metricDescriptor, List<TimeSeries> timeSeriesList) { Utils.checkNotNull(metricDescriptor, "metricDescriptor"); checkTypeMatch(metricDescriptor.getType(), timeSeriesList); return new AutoValue_Metric(metricDescriptor, timeSeriesList); }
[ "private", "static", "Metric", "createInternal", "(", "MetricDescriptor", "metricDescriptor", ",", "List", "<", "TimeSeries", ">", "timeSeriesList", ")", "{", "Utils", ".", "checkNotNull", "(", "metricDescriptor", ",", "\"metricDescriptor\"", ")", ";", "checkTypeMatch...
Creates a {@link Metric}. @param metricDescriptor the {@link MetricDescriptor}. @param timeSeriesList the {@link TimeSeries} list for this metric. @return a {@code Metric}. @since 0.17
[ "Creates", "a", "{", "@link", "Metric", "}", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/metrics/export/Metric.java#L80-L85
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/TieredBlockStore.java
TieredBlockStore.checkTempBlockOwnedBySession
private void checkTempBlockOwnedBySession(long sessionId, long blockId) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException { if (mMetaManager.hasBlockMeta(blockId)) { throw new BlockAlreadyExistsException(ExceptionMessage.TEMP_BLOCK_ID_COMMITTED, blockId); } TempBlockMeta tempBlockMeta = mMetaManager.getTempBlockMeta(blockId); long ownerSessionId = tempBlockMeta.getSessionId(); if (ownerSessionId != sessionId) { throw new InvalidWorkerStateException(ExceptionMessage.BLOCK_ID_FOR_DIFFERENT_SESSION, blockId, ownerSessionId, sessionId); } }
java
private void checkTempBlockOwnedBySession(long sessionId, long blockId) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException { if (mMetaManager.hasBlockMeta(blockId)) { throw new BlockAlreadyExistsException(ExceptionMessage.TEMP_BLOCK_ID_COMMITTED, blockId); } TempBlockMeta tempBlockMeta = mMetaManager.getTempBlockMeta(blockId); long ownerSessionId = tempBlockMeta.getSessionId(); if (ownerSessionId != sessionId) { throw new InvalidWorkerStateException(ExceptionMessage.BLOCK_ID_FOR_DIFFERENT_SESSION, blockId, ownerSessionId, sessionId); } }
[ "private", "void", "checkTempBlockOwnedBySession", "(", "long", "sessionId", ",", "long", "blockId", ")", "throws", "BlockDoesNotExistException", ",", "BlockAlreadyExistsException", ",", "InvalidWorkerStateException", "{", "if", "(", "mMetaManager", ".", "hasBlockMeta", "...
Checks if block id is a temporary block and owned by session id. This method must be enclosed by {@link #mMetadataLock}. @param sessionId the id of session @param blockId the id of block @throws BlockDoesNotExistException if block id can not be found in temporary blocks @throws BlockAlreadyExistsException if block id already exists in committed blocks @throws InvalidWorkerStateException if block id is not owned by session id
[ "Checks", "if", "block", "id", "is", "a", "temporary", "block", "and", "owned", "by", "session", "id", ".", "This", "method", "must", "be", "enclosed", "by", "{", "@link", "#mMetadataLock", "}", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/TieredBlockStore.java#L533-L544
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java
WatchUtil.createModify
public static WatchMonitor createModify(Path path, int maxDepth, Watcher watcher) { final WatchMonitor watchMonitor = create(path, maxDepth, WatchMonitor.ENTRY_MODIFY); watchMonitor.setWatcher(watcher); return watchMonitor; }
java
public static WatchMonitor createModify(Path path, int maxDepth, Watcher watcher) { final WatchMonitor watchMonitor = create(path, maxDepth, WatchMonitor.ENTRY_MODIFY); watchMonitor.setWatcher(watcher); return watchMonitor; }
[ "public", "static", "WatchMonitor", "createModify", "(", "Path", "path", ",", "int", "maxDepth", ",", "Watcher", "watcher", ")", "{", "final", "WatchMonitor", "watchMonitor", "=", "create", "(", "path", ",", "maxDepth", ",", "WatchMonitor", ".", "ENTRY_MODIFY", ...
创建并初始化监听,监听修改事件 @param path 路径 @param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录 @param watcher {@link Watcher} @return {@link WatchMonitor} @since 4.5.2
[ "创建并初始化监听,监听修改事件" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java#L375-L379
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java
BookKeeperLog.executeWrites
private boolean executeWrites(List<Write> toExecute) { log.debug("{}: Executing {} writes.", this.traceObjectId, toExecute.size()); for (int i = 0; i < toExecute.size(); i++) { Write w = toExecute.get(i); try { // Record the beginning of a new attempt. int attemptCount = w.beginAttempt(); if (attemptCount > this.config.getMaxWriteAttempts()) { // Retried too many times. throw new RetriesExhaustedException(w.getFailureCause()); } // Invoke the BookKeeper write. w.getWriteLedger().ledger.asyncAddEntry(w.data.array(), w.data.arrayOffset(), w.data.getLength(), this::addCallback, w); } catch (Throwable ex) { // Synchronous failure (or RetriesExhausted). Fail current write. boolean isFinal = !isRetryable(ex); w.fail(ex, isFinal); // And fail all remaining writes as well. for (int j = i + 1; j < toExecute.size(); j++) { toExecute.get(j).fail(new DurableDataLogException("Previous write failed.", ex), isFinal); } return false; } } // Success. return true; }
java
private boolean executeWrites(List<Write> toExecute) { log.debug("{}: Executing {} writes.", this.traceObjectId, toExecute.size()); for (int i = 0; i < toExecute.size(); i++) { Write w = toExecute.get(i); try { // Record the beginning of a new attempt. int attemptCount = w.beginAttempt(); if (attemptCount > this.config.getMaxWriteAttempts()) { // Retried too many times. throw new RetriesExhaustedException(w.getFailureCause()); } // Invoke the BookKeeper write. w.getWriteLedger().ledger.asyncAddEntry(w.data.array(), w.data.arrayOffset(), w.data.getLength(), this::addCallback, w); } catch (Throwable ex) { // Synchronous failure (or RetriesExhausted). Fail current write. boolean isFinal = !isRetryable(ex); w.fail(ex, isFinal); // And fail all remaining writes as well. for (int j = i + 1; j < toExecute.size(); j++) { toExecute.get(j).fail(new DurableDataLogException("Previous write failed.", ex), isFinal); } return false; } } // Success. return true; }
[ "private", "boolean", "executeWrites", "(", "List", "<", "Write", ">", "toExecute", ")", "{", "log", ".", "debug", "(", "\"{}: Executing {} writes.\"", ",", "this", ".", "traceObjectId", ",", "toExecute", ".", "size", "(", ")", ")", ";", "for", "(", "int",...
Executes the given Writes to BookKeeper. @param toExecute The Writes to execute. @return True if all the writes succeeded, false if at least one failed (if a Write failed, all subsequent writes will be failed as well).
[ "Executes", "the", "given", "Writes", "to", "BookKeeper", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java#L441-L471
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.Custom
public JBBPDslBuilder Custom(final String type, final String name) { return this.Custom(type, name, null); }
java
public JBBPDslBuilder Custom(final String type, final String name) { return this.Custom(type, name, null); }
[ "public", "JBBPDslBuilder", "Custom", "(", "final", "String", "type", ",", "final", "String", "name", ")", "{", "return", "this", ".", "Custom", "(", "type", ",", "name", ",", "null", ")", ";", "}" ]
Add named custom variable. @param type custom type, must not be null @param name name of the field, can be null for anonymous @return the builder instance, must not be null
[ "Add", "named", "custom", "variable", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L298-L300
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/selection/AbstractSelection.java
AbstractSelection.addToAtomContainer
protected void addToAtomContainer(IAtomContainer ac, IChemObject item) { if (item instanceof IAtomContainer) { ac.add((IAtomContainer) item); } else if (item instanceof IAtom) { ac.addAtom((IAtom) item); } else if (item instanceof IBond) { ac.addBond((IBond) item); } }
java
protected void addToAtomContainer(IAtomContainer ac, IChemObject item) { if (item instanceof IAtomContainer) { ac.add((IAtomContainer) item); } else if (item instanceof IAtom) { ac.addAtom((IAtom) item); } else if (item instanceof IBond) { ac.addBond((IBond) item); } }
[ "protected", "void", "addToAtomContainer", "(", "IAtomContainer", "ac", ",", "IChemObject", "item", ")", "{", "if", "(", "item", "instanceof", "IAtomContainer", ")", "{", "ac", ".", "add", "(", "(", "IAtomContainer", ")", "item", ")", ";", "}", "else", "if...
Utility method to add an {@link IChemObject} to an {@link IAtomContainer}. @param ac the {@link IAtomContainer} to add to @param item the {@link IChemObject} to add
[ "Utility", "method", "to", "add", "an", "{", "@link", "IChemObject", "}", "to", "an", "{", "@link", "IAtomContainer", "}", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/selection/AbstractSelection.java#L84-L92
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener listener) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "addConnectionEventListener", listener); if (listener == null) throw new NullPointerException( "Cannot add null ConnectionEventListener."); // Not synchronized because of the contract that add/remove event listeners will only // be used on ManagedConnection create/destroy, when the ManagedConnection is not // used by any other threads. // Add the listener to the end of the array -- if the array is full, // then need to create a new, bigger one // check if the array is already full if (numListeners >= ivEventListeners.length) { // there is not enough room for the listener in the array // create a new, bigger array // Use the standard interface for event listeners instead of J2C's. ConnectionEventListener[] tempArray = ivEventListeners; ivEventListeners = new ConnectionEventListener[numListeners + CEL_ARRAY_INCREMENT_SIZE]; // parms: arraycopy(Object source, int srcIndex, Object dest, int destIndex, int length) System.arraycopy(tempArray, 0, ivEventListeners, 0, tempArray.length); // point out in the trace that we had to do this - consider code changes if there // are new CELs to handle (change KNOWN_NUMBER_OF_CELS, new events?, ...) if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "received more ConnectionEventListeners than expected, " + "increased array size to " + ivEventListeners.length); } // add listener to the array, increment listener counter ivEventListeners[numListeners++] = listener; }
java
public void addConnectionEventListener(ConnectionEventListener listener) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "addConnectionEventListener", listener); if (listener == null) throw new NullPointerException( "Cannot add null ConnectionEventListener."); // Not synchronized because of the contract that add/remove event listeners will only // be used on ManagedConnection create/destroy, when the ManagedConnection is not // used by any other threads. // Add the listener to the end of the array -- if the array is full, // then need to create a new, bigger one // check if the array is already full if (numListeners >= ivEventListeners.length) { // there is not enough room for the listener in the array // create a new, bigger array // Use the standard interface for event listeners instead of J2C's. ConnectionEventListener[] tempArray = ivEventListeners; ivEventListeners = new ConnectionEventListener[numListeners + CEL_ARRAY_INCREMENT_SIZE]; // parms: arraycopy(Object source, int srcIndex, Object dest, int destIndex, int length) System.arraycopy(tempArray, 0, ivEventListeners, 0, tempArray.length); // point out in the trace that we had to do this - consider code changes if there // are new CELs to handle (change KNOWN_NUMBER_OF_CELS, new events?, ...) if (isTraceOn && tc.isDebugEnabled()) Tr.debug(this, tc, "received more ConnectionEventListeners than expected, " + "increased array size to " + ivEventListeners.length); } // add listener to the array, increment listener counter ivEventListeners[numListeners++] = listener; }
[ "public", "void", "addConnectionEventListener", "(", "ConnectionEventListener", "listener", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isDebugEnabled", "(", ...
Adds a connection event listener to the ManagedConnection instance. <p> The registered ConnectionEventListener instances are notified of connection close and error events, also of local transaction related events on the Managed Connection. @param listener - a new ConnectionEventListener to be registered @throws NullPointerException if you try to add a null listener.
[ "Adds", "a", "connection", "event", "listener", "to", "the", "ManagedConnection", "instance", ".", "<p", ">", "The", "registered", "ConnectionEventListener", "instances", "are", "notified", "of", "connection", "close", "and", "error", "events", "also", "of", "loca...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3672-L3707
mangstadt/biweekly
src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java
ICalPropertyScribe.parseXml
public final T parseXml(Element element, ICalParameters parameters, ParseContext context) { T property = _parseXml(new XCalElement(element), parameters, context); property.setParameters(parameters); return property; }
java
public final T parseXml(Element element, ICalParameters parameters, ParseContext context) { T property = _parseXml(new XCalElement(element), parameters, context); property.setParameters(parameters); return property; }
[ "public", "final", "T", "parseXml", "(", "Element", "element", ",", "ICalParameters", "parameters", ",", "ParseContext", "context", ")", "{", "T", "property", "=", "_parseXml", "(", "new", "XCalElement", "(", "element", ")", ",", "parameters", ",", "context", ...
Unmarshals a property's value from an XML document (xCal). @param element the property's XML element @param parameters the property's parameters @param context the context @return the unmarshalled property @throws CannotParseException if the scribe could not parse the property's value @throws SkipMeException if the property should not be added to the final {@link ICalendar} object
[ "Unmarshals", "a", "property", "s", "value", "from", "an", "XML", "document", "(", "xCal", ")", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java#L261-L265
google/closure-compiler
src/com/google/javascript/jscomp/CrossChunkMethodMotion.java
CrossChunkMethodMotion.movePrototypeDotMethodAssignment
private void movePrototypeDotMethodAssignment(Node destParent, Node functionNode) { checkState(functionNode.isFunction(), functionNode); Node assignNode = functionNode.getParent(); checkState(assignNode.isAssign() && functionNode.isSecondChildOf(assignNode), assignNode); Node definitionStatement = assignNode.getParent(); checkState(definitionStatement.isExprResult(), assignNode); if (noStubFunctions) { // Remove the definition statement from its current location Node assignStatementParent = definitionStatement.getParent(); definitionStatement.detach(); compiler.reportChangeToEnclosingScope(assignStatementParent); // Prepend definition to new chunk // Foo.prototype.propName = function() {}; destParent.addChildToFront(definitionStatement); compiler.reportChangeToEnclosingScope(destParent); } else { int stubId = idGenerator.newId(); // replace function definition with temporary placeholder so we can clone the whole // assignment statement without cloning the function definition itself. Node originalDefinitionPlaceholder = astFactory.createEmpty(); functionNode.replaceWith(originalDefinitionPlaceholder); Node newDefinitionStatement = definitionStatement.cloneTree(); Node newDefinitionPlaceholder = newDefinitionStatement // EXPR_RESULT .getOnlyChild() // ASSIGN .getLastChild(); // EMPTY RHS node // convert original assignment statement to // owner.prototype.propName = JSCompiler_stubMethod(0); Node stubCall = createStubCall(functionNode, stubId); originalDefinitionPlaceholder.replaceWith(stubCall); compiler.reportChangeToEnclosingScope(definitionStatement); // Prepend new definition to new chunk // Foo.prototype.propName = JSCompiler_unstubMethod(0, function() {}); Node unstubCall = createUnstubCall(functionNode, stubId); newDefinitionPlaceholder.replaceWith(unstubCall); destParent.addChildToFront(newDefinitionStatement); compiler.reportChangeToEnclosingScope(destParent); } }
java
private void movePrototypeDotMethodAssignment(Node destParent, Node functionNode) { checkState(functionNode.isFunction(), functionNode); Node assignNode = functionNode.getParent(); checkState(assignNode.isAssign() && functionNode.isSecondChildOf(assignNode), assignNode); Node definitionStatement = assignNode.getParent(); checkState(definitionStatement.isExprResult(), assignNode); if (noStubFunctions) { // Remove the definition statement from its current location Node assignStatementParent = definitionStatement.getParent(); definitionStatement.detach(); compiler.reportChangeToEnclosingScope(assignStatementParent); // Prepend definition to new chunk // Foo.prototype.propName = function() {}; destParent.addChildToFront(definitionStatement); compiler.reportChangeToEnclosingScope(destParent); } else { int stubId = idGenerator.newId(); // replace function definition with temporary placeholder so we can clone the whole // assignment statement without cloning the function definition itself. Node originalDefinitionPlaceholder = astFactory.createEmpty(); functionNode.replaceWith(originalDefinitionPlaceholder); Node newDefinitionStatement = definitionStatement.cloneTree(); Node newDefinitionPlaceholder = newDefinitionStatement // EXPR_RESULT .getOnlyChild() // ASSIGN .getLastChild(); // EMPTY RHS node // convert original assignment statement to // owner.prototype.propName = JSCompiler_stubMethod(0); Node stubCall = createStubCall(functionNode, stubId); originalDefinitionPlaceholder.replaceWith(stubCall); compiler.reportChangeToEnclosingScope(definitionStatement); // Prepend new definition to new chunk // Foo.prototype.propName = JSCompiler_unstubMethod(0, function() {}); Node unstubCall = createUnstubCall(functionNode, stubId); newDefinitionPlaceholder.replaceWith(unstubCall); destParent.addChildToFront(newDefinitionStatement); compiler.reportChangeToEnclosingScope(destParent); } }
[ "private", "void", "movePrototypeDotMethodAssignment", "(", "Node", "destParent", ",", "Node", "functionNode", ")", "{", "checkState", "(", "functionNode", ".", "isFunction", "(", ")", ",", "functionNode", ")", ";", "Node", "assignNode", "=", "functionNode", ".", ...
Move a property defined by assignment to `.prototype` or `.prototype.propName`. <pre><code> Foo.prototype.propName = function() {}; </code></pre>
[ "Move", "a", "property", "defined", "by", "assignment", "to", ".", "prototype", "or", ".", "prototype", ".", "propName", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CrossChunkMethodMotion.java#L272-L315
unbescape/unbescape
src/main/java/org/unbescape/css/CssEscape.java
CssEscape.escapeCssString
public static void escapeCssString(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeCssString(text, offset, len, writer, CssStringEscapeType.BACKSLASH_ESCAPES_DEFAULT_TO_COMPACT_HEXA, CssStringEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
java
public static void escapeCssString(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeCssString(text, offset, len, writer, CssStringEscapeType.BACKSLASH_ESCAPES_DEFAULT_TO_COMPACT_HEXA, CssStringEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapeCssString", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeCssString", "(", "text", ",", "off...
<p> Perform a CSS String level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation on a <tt>char[]</tt> input. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The CSS String basic escape set: <ul> <li>The <em>Backslash Escapes</em>: <tt>&#92;&quot;</tt> (<tt>U+0022</tt>) and <tt>&#92;&#39;</tt> (<tt>U+0027</tt>). </li> <li> Two ranges of non-displayable, control characters: <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> </li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by using Backslash escapes whenever possible. For escaped characters that do not have an associated Backslash, default to <tt>&#92;FF </tt> Hexadecimal Escapes. </p> <p> This method calls {@link #escapeCssString(char[], int, int, java.io.Writer, CssStringEscapeType, CssStringEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link CssStringEscapeType#BACKSLASH_ESCAPES_DEFAULT_TO_COMPACT_HEXA}</li> <li><tt>level</tt>: {@link CssStringEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be escaped. @param offset the position in <tt>text</tt> at which the escape operation should start. @param len the number of characters in <tt>text</tt> that should be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "a", "CSS", "String", "level", "2", "(", "basic", "set", "and", "all", "non", "-", "ASCII", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/css/CssEscape.java#L725-L730
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointUnionAxiomImpl_CustomFieldSerializer.java
OWLDisjointUnionAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDisjointUnionAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDisjointUnionAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLDisjointUnionAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointUnionAxiomImpl_CustomFieldSerializer.java#L98-L101
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.doIsNull
private ZealotKhala doIsNull(String prefix, String field, boolean match, boolean positive) { if (match) { // 判断是"IS NULL"还是"IS NOT NULL"来设置source实例. this.source = this.source.setPrefix(prefix) .setSuffix(positive ? ZealotConst.IS_NULL_SUFFIX : ZealotConst.IS_NOT_NULL_SUFFIX); SqlInfoBuilder.newInstace(this.source).buildIsNullSql(field); this.source.resetPrefix(); } return this; }
java
private ZealotKhala doIsNull(String prefix, String field, boolean match, boolean positive) { if (match) { // 判断是"IS NULL"还是"IS NOT NULL"来设置source实例. this.source = this.source.setPrefix(prefix) .setSuffix(positive ? ZealotConst.IS_NULL_SUFFIX : ZealotConst.IS_NOT_NULL_SUFFIX); SqlInfoBuilder.newInstace(this.source).buildIsNullSql(field); this.source.resetPrefix(); } return this; }
[ "private", "ZealotKhala", "doIsNull", "(", "String", "prefix", ",", "String", "field", ",", "boolean", "match", ",", "boolean", "positive", ")", "{", "if", "(", "match", ")", "{", "// 判断是\"IS NULL\"还是\"IS NOT NULL\"来设置source实例.", "this", ".", "source", "=", "thi...
执行生成" IS NULL "SQL片段的方法. @param prefix 前缀 @param field 数据库字段 @param match 是否匹配 @param positive true则表示是 IS NULL,否则是IS NOT NULL @return ZealotKhala实例的当前实例
[ "执行生成", "IS", "NULL", "SQL片段的方法", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L505-L514
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.readExcel2List
public List<List<String>> readExcel2List(InputStream is, int offsetLine) throws IOException, InvalidFormatException { try (Workbook workbook = WorkbookFactory.create(is)) { return readExcel2ObjectsHandler(workbook, offsetLine, Integer.MAX_VALUE, 0); } }
java
public List<List<String>> readExcel2List(InputStream is, int offsetLine) throws IOException, InvalidFormatException { try (Workbook workbook = WorkbookFactory.create(is)) { return readExcel2ObjectsHandler(workbook, offsetLine, Integer.MAX_VALUE, 0); } }
[ "public", "List", "<", "List", "<", "String", ">", ">", "readExcel2List", "(", "InputStream", "is", ",", "int", "offsetLine", ")", "throws", "IOException", ",", "InvalidFormatException", "{", "try", "(", "Workbook", "workbook", "=", "WorkbookFactory", ".", "cr...
读取Excel表格数据,返回{@code List[List[String]]}类型的数据集合 @param is 待读取Excel的数据流 @param offsetLine Excel表头行(默认是0) @return 返回{@code List<List<String>>}类型的数据集合 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died
[ "读取Excel表格数据", "返回", "{", "@code", "List", "[", "List", "[", "String", "]]", "}", "类型的数据集合" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L375-L381
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java
SessionManager.releaseSession
@Override public void releaseSession(Object sessionObject, SessionAffinityContext affinityContext) { ISession session = (ISession) sessionObject; if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, "releaseSession", "sessionID = " + session.getId()); } // XD change: both the decrement of the ref count, and the potential check // of the ref count // in _store.releaseSession(session) need to be synchronized in case of // multi-threaded access synchronized (session) { session.decrementRefCount(); if (session.isValid()) { session.updateLastAccessTime(); session.setIsNew(false); boolean fromCookie = false; // not always used ... if affinityContext is // null, just default to false if (affinityContext != null) { fromCookie = affinityContext.isRequestedSessionIDFromCookie(); } _storer.storeSession(session, fromCookie); } _store.releaseSession(session); _sessionEventDispatcher.sessionReleased(session); } }
java
@Override public void releaseSession(Object sessionObject, SessionAffinityContext affinityContext) { ISession session = (ISession) sessionObject; if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, "releaseSession", "sessionID = " + session.getId()); } // XD change: both the decrement of the ref count, and the potential check // of the ref count // in _store.releaseSession(session) need to be synchronized in case of // multi-threaded access synchronized (session) { session.decrementRefCount(); if (session.isValid()) { session.updateLastAccessTime(); session.setIsNew(false); boolean fromCookie = false; // not always used ... if affinityContext is // null, just default to false if (affinityContext != null) { fromCookie = affinityContext.isRequestedSessionIDFromCookie(); } _storer.storeSession(session, fromCookie); } _store.releaseSession(session); _sessionEventDispatcher.sessionReleased(session); } }
[ "@", "Override", "public", "void", "releaseSession", "(", "Object", "sessionObject", ",", "SessionAffinityContext", "affinityContext", ")", "{", "ISession", "session", "=", "(", "ISession", ")", "sessionObject", ";", "if", "(", "com", ".", "ibm", ".", "ejs", "...
Method releaseSession <p> @param sessionObject @param affinityContext associated with a given request.
[ "Method", "releaseSession", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java#L480-L507
linroid/FilterMenu
library/src/main/java/com/linroid/filtermenu/library/FilterMenuLayout.java
FilterMenuLayout.threePointsAngle
private static double threePointsAngle(Point vertex, Point A, Point B) { double b = pointsDistance(vertex, A); double c = pointsDistance(A, B); double a = pointsDistance(B, vertex); return Math.toDegrees(Math.acos((a * a + b * b - c * c) / (2 * a * b))); }
java
private static double threePointsAngle(Point vertex, Point A, Point B) { double b = pointsDistance(vertex, A); double c = pointsDistance(A, B); double a = pointsDistance(B, vertex); return Math.toDegrees(Math.acos((a * a + b * b - c * c) / (2 * a * b))); }
[ "private", "static", "double", "threePointsAngle", "(", "Point", "vertex", ",", "Point", "A", ",", "Point", "B", ")", "{", "double", "b", "=", "pointsDistance", "(", "vertex", ",", "A", ")", ";", "double", "c", "=", "pointsDistance", "(", "A", ",", "B"...
calculate the point a's angle of rectangle consist of point a,point b, point c; @param vertex @param A @param B @return
[ "calculate", "the", "point", "a", "s", "angle", "of", "rectangle", "consist", "of", "point", "a", "point", "b", "point", "c", ";" ]
train
https://github.com/linroid/FilterMenu/blob/5a6e5472631c2304b71a51034683f38271962ef5/library/src/main/java/com/linroid/filtermenu/library/FilterMenuLayout.java#L226-L233
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.cut
public static void cut(Image srcImage, OutputStream out, Rectangle rectangle) throws IORuntimeException { cut(srcImage, getImageOutputStream(out), rectangle); }
java
public static void cut(Image srcImage, OutputStream out, Rectangle rectangle) throws IORuntimeException { cut(srcImage, getImageOutputStream(out), rectangle); }
[ "public", "static", "void", "cut", "(", "Image", "srcImage", ",", "OutputStream", "out", ",", "Rectangle", "rectangle", ")", "throws", "IORuntimeException", "{", "cut", "(", "srcImage", ",", "getImageOutputStream", "(", "out", ")", ",", "rectangle", ")", ";", ...
图像切割(按指定起点坐标和宽高切割),此方法并不关闭流 @param srcImage 源图像 @param out 切片后的图像输出流 @param rectangle 矩形对象,表示矩形区域的x,y,width,height @since 3.1.0 @throws IORuntimeException IO异常
[ "图像切割", "(", "按指定起点坐标和宽高切割", ")", ",此方法并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L306-L308
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java
PrimitiveUtils.readCharacter
public static Character readCharacter(String value, Character defaultValue) { if (!StringUtils.hasText(value)) return defaultValue; return Character.valueOf((char)Integer.parseInt(value)); }
java
public static Character readCharacter(String value, Character defaultValue) { if (!StringUtils.hasText(value)) return defaultValue; return Character.valueOf((char)Integer.parseInt(value)); }
[ "public", "static", "Character", "readCharacter", "(", "String", "value", ",", "Character", "defaultValue", ")", "{", "if", "(", "!", "StringUtils", ".", "hasText", "(", "value", ")", ")", "return", "defaultValue", ";", "return", "Character", ".", "valueOf", ...
Read character. @param value the value @param defaultValue the default value @return the character
[ "Read", "character", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java#L80-L84
facebookarchive/swift
swift-codec/src/main/java/com/facebook/swift/codec/metadata/AbstractThriftMetadataBuilder.java
AbstractThriftMetadataBuilder.verifyFieldType
protected final void verifyFieldType(short id, String name, Collection<FieldMetadata> fields, ThriftCatalog catalog) { boolean isSupportedType = true; for (FieldMetadata field : fields) { if (!catalog.isSupportedStructFieldType(field.getJavaType())) { metadataErrors.addError("Thrift class '%s' field '%s(%s)' type '%s' is not a supported Java type", structName, name, id, TypeToken.of(field.getJavaType())); isSupportedType = false; // only report the error once break; } } // fields must have the same type if (isSupportedType) { Set<ThriftTypeReference> types = new HashSet<>(); for (FieldMetadata field : fields) { types.add(catalog.getFieldThriftTypeReference(field)); } if (types.size() > 1) { metadataErrors.addError("Thrift class '%s' field '%s(%s)' has multiple types: %s", structName, name, id, types); } } }
java
protected final void verifyFieldType(short id, String name, Collection<FieldMetadata> fields, ThriftCatalog catalog) { boolean isSupportedType = true; for (FieldMetadata field : fields) { if (!catalog.isSupportedStructFieldType(field.getJavaType())) { metadataErrors.addError("Thrift class '%s' field '%s(%s)' type '%s' is not a supported Java type", structName, name, id, TypeToken.of(field.getJavaType())); isSupportedType = false; // only report the error once break; } } // fields must have the same type if (isSupportedType) { Set<ThriftTypeReference> types = new HashSet<>(); for (FieldMetadata field : fields) { types.add(catalog.getFieldThriftTypeReference(field)); } if (types.size() > 1) { metadataErrors.addError("Thrift class '%s' field '%s(%s)' has multiple types: %s", structName, name, id, types); } } }
[ "protected", "final", "void", "verifyFieldType", "(", "short", "id", ",", "String", "name", ",", "Collection", "<", "FieldMetadata", ">", "fields", ",", "ThriftCatalog", "catalog", ")", "{", "boolean", "isSupportedType", "=", "true", ";", "for", "(", "FieldMet...
Verifies that the the fields all have a supported Java type and that all fields map to the exact same ThriftType.
[ "Verifies", "that", "the", "the", "fields", "all", "have", "a", "supported", "Java", "type", "and", "that", "all", "fields", "map", "to", "the", "exact", "same", "ThriftType", "." ]
train
https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-codec/src/main/java/com/facebook/swift/codec/metadata/AbstractThriftMetadataBuilder.java#L716-L738
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.hosting_web_serviceName_upgrade_duration_GET
public OvhOrder hosting_web_serviceName_upgrade_duration_GET(String serviceName, String duration, net.minidev.ovh.api.hosting.web.OvhOfferEnum offer, Boolean waiveRetractationPeriod) throws IOException { String qPath = "/order/hosting/web/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "offer", offer); query(sb, "waiveRetractationPeriod", waiveRetractationPeriod); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder hosting_web_serviceName_upgrade_duration_GET(String serviceName, String duration, net.minidev.ovh.api.hosting.web.OvhOfferEnum offer, Boolean waiveRetractationPeriod) throws IOException { String qPath = "/order/hosting/web/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "offer", offer); query(sb, "waiveRetractationPeriod", waiveRetractationPeriod); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "hosting_web_serviceName_upgrade_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "hosting", ".", "web", ".", "OvhOfferEnum", "offer", ",", "Boolean", "waiveRetra...
Get prices and contracts information REST: GET /order/hosting/web/{serviceName}/upgrade/{duration} @param offer [required] New offers for your hosting account @param waiveRetractationPeriod [required] Indicates that order will be processed with waiving retractation period @param serviceName [required] The internal name of your hosting @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4944-L4951
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java
LoggingSubsystemParser.parsePropertyElement
static void parsePropertyElement(final ModelNode operation, final XMLExtendedStreamReader reader) throws XMLStreamException { parsePropertyElement(operation, reader, PROPERTIES.getName()); }
java
static void parsePropertyElement(final ModelNode operation, final XMLExtendedStreamReader reader) throws XMLStreamException { parsePropertyElement(operation, reader, PROPERTIES.getName()); }
[ "static", "void", "parsePropertyElement", "(", "final", "ModelNode", "operation", ",", "final", "XMLExtendedStreamReader", "reader", ")", "throws", "XMLStreamException", "{", "parsePropertyElement", "(", "operation", ",", "reader", ",", "PROPERTIES", ".", "getName", "...
Parses a property element. <p> Example of the expected XML: <code> <pre> &lt;properties&gt; &lt;property name=&quot;propertyName&quot; value=&quot;propertyValue&quot;/&gt; &lt;/properties&gt; </pre> </code> The {@code name} attribute is required. If the {@code value} attribute is not present an {@linkplain org.jboss.dmr.ModelNode UNDEFINED ModelNode} will set on the operation. </p> @param operation the operation to add the parsed properties to @param reader the reader to use @throws XMLStreamException if a parsing error occurs
[ "Parses", "a", "property", "element", ".", "<p", ">", "Example", "of", "the", "expected", "XML", ":", "<code", ">", "<pre", ">", "&lt", ";", "properties&gt", ";", "&lt", ";", "property", "name", "=", "&quot", ";", "propertyName&quot", ";", "value", "=", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java#L122-L124
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitInheritDoc
@Override public R visitInheritDoc(InheritDocTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitInheritDoc(InheritDocTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitInheritDoc", "(", "InheritDocTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L249-L252
ocelotds/ocelot
ocelot-dashboard/src/main/java/org/ocelotds/dashboard/services/ServiceTools.java
ServiceTools.getTemplateOfType
public String getTemplateOfType(Type type, IJsonMarshaller jsonMarshaller) throws JsonMarshallerException { if (jsonMarshaller == null) { jsonMarshaller = argumentServices.getIJsonMarshallerInstance(TemplateMarshaller.class); } return _getTemplateOfType(type, jsonMarshaller); }
java
public String getTemplateOfType(Type type, IJsonMarshaller jsonMarshaller) throws JsonMarshallerException { if (jsonMarshaller == null) { jsonMarshaller = argumentServices.getIJsonMarshallerInstance(TemplateMarshaller.class); } return _getTemplateOfType(type, jsonMarshaller); }
[ "public", "String", "getTemplateOfType", "(", "Type", "type", ",", "IJsonMarshaller", "jsonMarshaller", ")", "throws", "JsonMarshallerException", "{", "if", "(", "jsonMarshaller", "==", "null", ")", "{", "jsonMarshaller", "=", "argumentServices", ".", "getIJsonMarshal...
Get template for unknown type (class or parameterizedType) @param type @param jsonMarshaller @return @throws org.ocelotds.marshalling.exceptions.JsonMarshallerException
[ "Get", "template", "for", "unknown", "type", "(", "class", "or", "parameterizedType", ")" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-dashboard/src/main/java/org/ocelotds/dashboard/services/ServiceTools.java#L112-L117
samskivert/samskivert
src/main/java/com/samskivert/util/IntListUtil.java
IntListUtil.removeAt
public static int removeAt (int[] list, int index) { int llength = list.length; if (llength <= index) { return 0; } int val = list[index]; System.arraycopy(list, index+1, list, index, llength-(index+1)); list[llength-1] = 0; return val; }
java
public static int removeAt (int[] list, int index) { int llength = list.length; if (llength <= index) { return 0; } int val = list[index]; System.arraycopy(list, index+1, list, index, llength-(index+1)); list[llength-1] = 0; return val; }
[ "public", "static", "int", "removeAt", "(", "int", "[", "]", "list", ",", "int", "index", ")", "{", "int", "llength", "=", "list", ".", "length", ";", "if", "(", "llength", "<=", "index", ")", "{", "return", "0", ";", "}", "int", "val", "=", "lis...
Removes the value at the specified index. The values after the removed value will be slid down the array one spot to fill the place of the removed value. If a null array is supplied or one that is not large enough to accomodate this index, zero is returned. @return the value that was removed from the array or zero if no value existed at that location.
[ "Removes", "the", "value", "at", "the", "specified", "index", ".", "The", "values", "after", "the", "removed", "value", "will", "be", "slid", "down", "the", "array", "one", "spot", "to", "fill", "the", "place", "of", "the", "removed", "value", ".", "If",...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntListUtil.java#L246-L257
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlFieldBuilderImpl.java
SarlFieldBuilderImpl.eInit
public void eInit(XtendTypeDeclaration container, String name, String modifier, IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.sarlField == null) { this.container = container; this.sarlField = SarlFactory.eINSTANCE.createSarlField(); this.sarlField.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); this.sarlField.setName(name); if (Strings.equal(modifier, "var") || Strings.equal(modifier, "val")) { this.sarlField.getModifiers().add(modifier); } else { throw new IllegalStateException("Invalid modifier"); } container.getMembers().add(this.sarlField); } }
java
public void eInit(XtendTypeDeclaration container, String name, String modifier, IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.sarlField == null) { this.container = container; this.sarlField = SarlFactory.eINSTANCE.createSarlField(); this.sarlField.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); this.sarlField.setName(name); if (Strings.equal(modifier, "var") || Strings.equal(modifier, "val")) { this.sarlField.getModifiers().add(modifier); } else { throw new IllegalStateException("Invalid modifier"); } container.getMembers().add(this.sarlField); } }
[ "public", "void", "eInit", "(", "XtendTypeDeclaration", "container", ",", "String", "name", ",", "String", "modifier", ",", "IJvmTypeProvider", "context", ")", "{", "setTypeResolutionContext", "(", "context", ")", ";", "if", "(", "this", ".", "sarlField", "==", ...
Initialize the Ecore element. @param container the container of the SarlField. @param name the name of the SarlField.
[ "Initialize", "the", "Ecore", "element", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlFieldBuilderImpl.java#L64-L79
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.perspectiveLH
public Matrix4d perspectiveLH(double fovy, double aspect, double zNear, double zFar, Matrix4d dest) { return perspectiveLH(fovy, aspect, zNear, zFar, false, dest); }
java
public Matrix4d perspectiveLH(double fovy, double aspect, double zNear, double zFar, Matrix4d dest) { return perspectiveLH(fovy, aspect, zNear, zFar, false, dest); }
[ "public", "Matrix4d", "perspectiveLH", "(", "double", "fovy", ",", "double", "aspect", ",", "double", "zNear", ",", "double", "zFar", ",", "Matrix4d", "dest", ")", "{", "return", "perspectiveLH", "(", "fovy", ",", "aspect", ",", "zNear", ",", "zFar", ",", ...
Apply a symmetric perspective projection frustum transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix, then the new matrix will be <code>M * P</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * P * v</code>, the perspective projection will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveLH(double, double, double, double) setPerspectiveLH}. @see #setPerspectiveLH(double, double, double, double) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param dest will hold the result @return dest
[ "Apply", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", "..", "+", "1", "]", "<", "/",...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L12949-L12951
protostuff/protostuff
protostuff-json/src/main/java/io/protostuff/SmileIOUtil.java
SmileIOUtil.newSmileGenerator
public static SmileGenerator newSmileGenerator(OutputStream out, byte[] buf) { return newSmileGenerator(out, buf, 0, false, new IOContext( DEFAULT_SMILE_FACTORY._getBufferRecycler(), out, false)); }
java
public static SmileGenerator newSmileGenerator(OutputStream out, byte[] buf) { return newSmileGenerator(out, buf, 0, false, new IOContext( DEFAULT_SMILE_FACTORY._getBufferRecycler(), out, false)); }
[ "public", "static", "SmileGenerator", "newSmileGenerator", "(", "OutputStream", "out", ",", "byte", "[", "]", "buf", ")", "{", "return", "newSmileGenerator", "(", "out", ",", "buf", ",", "0", ",", "false", ",", "new", "IOContext", "(", "DEFAULT_SMILE_FACTORY",...
Creates a {@link SmileGenerator} for the outputstream with the supplied buf {@code outBuffer} to use.
[ "Creates", "a", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-json/src/main/java/io/protostuff/SmileIOUtil.java#L170-L174
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/nosql/lucene/BaseLuceneStorage.java
BaseLuceneStorage.createDocument
protected Document createDocument(String spaceId, String key) { Document doc = new Document(); doc.add(new StringField(FIELD_SPACE_ID, spaceId.trim(), Store.YES)); doc.add(new StringField(FIELD_KEY, key.trim(), Store.YES)); doc.add(new StringField(FIELD_ID, spaceId.trim() + ":" + key.trim(), Store.NO)); return doc; }
java
protected Document createDocument(String spaceId, String key) { Document doc = new Document(); doc.add(new StringField(FIELD_SPACE_ID, spaceId.trim(), Store.YES)); doc.add(new StringField(FIELD_KEY, key.trim(), Store.YES)); doc.add(new StringField(FIELD_ID, spaceId.trim() + ":" + key.trim(), Store.NO)); return doc; }
[ "protected", "Document", "createDocument", "(", "String", "spaceId", ",", "String", "key", ")", "{", "Document", "doc", "=", "new", "Document", "(", ")", ";", "doc", ".", "add", "(", "new", "StringField", "(", "FIELD_SPACE_ID", ",", "spaceId", ".", "trim",...
Create a {@link Document}, pre-filled with space-id and key fields. @param spaceId @param key @return
[ "Create", "a", "{", "@link", "Document", "}", "pre", "-", "filled", "with", "space", "-", "id", "and", "key", "fields", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/nosql/lucene/BaseLuceneStorage.java#L261-L267
webmetrics/browsermob-proxy
src/main/java/org/xbill/DNS/security/DSASignature.java
DSASignature.toDNS
public static byte [] toDNS(DSAParams params, byte [] sig) throws SignatureException { int rLength, sLength; int rOffset, sOffset; if ((sig[0] != ASN1_SEQ) || (sig[2] != ASN1_INT)) throw new SignatureException("Expected SEQ, INT"); rLength = sig[3]; rOffset = 4; if (sig[rOffset] == 0) { rLength--; rOffset++; } if (sig[rOffset+rLength] != ASN1_INT) throw new SignatureException("Expected INT"); sLength = sig[rOffset + rLength + 1]; sOffset = rOffset + rLength + 2; if (sig[sOffset] == 0) { sLength--; sOffset++; } if ((rLength > 20) || (sLength > 20)) throw new SignatureException("DSA R/S too long"); byte[] newSig = new byte[41]; Arrays.fill(newSig, (byte) 0); newSig[0] = (byte) ((params.getP().bitLength() - 512)/64); System.arraycopy(sig, rOffset, newSig, 1 + (20 - rLength), rLength); System.arraycopy(sig, sOffset, newSig, 21 + (20 - sLength), sLength); return newSig; }
java
public static byte [] toDNS(DSAParams params, byte [] sig) throws SignatureException { int rLength, sLength; int rOffset, sOffset; if ((sig[0] != ASN1_SEQ) || (sig[2] != ASN1_INT)) throw new SignatureException("Expected SEQ, INT"); rLength = sig[3]; rOffset = 4; if (sig[rOffset] == 0) { rLength--; rOffset++; } if (sig[rOffset+rLength] != ASN1_INT) throw new SignatureException("Expected INT"); sLength = sig[rOffset + rLength + 1]; sOffset = rOffset + rLength + 2; if (sig[sOffset] == 0) { sLength--; sOffset++; } if ((rLength > 20) || (sLength > 20)) throw new SignatureException("DSA R/S too long"); byte[] newSig = new byte[41]; Arrays.fill(newSig, (byte) 0); newSig[0] = (byte) ((params.getP().bitLength() - 512)/64); System.arraycopy(sig, rOffset, newSig, 1 + (20 - rLength), rLength); System.arraycopy(sig, sOffset, newSig, 21 + (20 - sLength), sLength); return newSig; }
[ "public", "static", "byte", "[", "]", "toDNS", "(", "DSAParams", "params", ",", "byte", "[", "]", "sig", ")", "throws", "SignatureException", "{", "int", "rLength", ",", "sLength", ";", "int", "rOffset", ",", "sOffset", ";", "if", "(", "(", "sig", "[",...
Converts the signature generated by DSA signature routines to the one expected inside an RRSIG/SIG record.
[ "Converts", "the", "signature", "generated", "by", "DSA", "signature", "routines", "to", "the", "one", "expected", "inside", "an", "RRSIG", "/", "SIG", "record", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/xbill/DNS/security/DSASignature.java#L68-L100
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/Collectors.java
Collectors.first
public static <T> Collector<T, ?, List<T>> first(final int n) { N.checkArgNotNegative(n, "n"); final Supplier<List<T>> supplier = new Supplier<List<T>>() { @Override public List<T> get() { return new ArrayList<T>(N.min(256, n)); } }; final BiConsumer<List<T>, T> accumulator = new BiConsumer<List<T>, T>() { @Override public void accept(List<T> c, T t) { if (c.size() < n) { c.add(t); } } }; final BinaryOperator<List<T>> combiner = new BinaryOperator<List<T>>() { @Override public List<T> apply(List<T> a, List<T> b) { if (N.notNullOrEmpty(a) && N.notNullOrEmpty(b)) { throw new UnsupportedOperationException("The 'first' and 'last' Collector only can be used in sequential stream"); } return a.size() > 0 ? a : b; } }; return new CollectorImpl<>(supplier, accumulator, combiner, CH_ID); }
java
public static <T> Collector<T, ?, List<T>> first(final int n) { N.checkArgNotNegative(n, "n"); final Supplier<List<T>> supplier = new Supplier<List<T>>() { @Override public List<T> get() { return new ArrayList<T>(N.min(256, n)); } }; final BiConsumer<List<T>, T> accumulator = new BiConsumer<List<T>, T>() { @Override public void accept(List<T> c, T t) { if (c.size() < n) { c.add(t); } } }; final BinaryOperator<List<T>> combiner = new BinaryOperator<List<T>>() { @Override public List<T> apply(List<T> a, List<T> b) { if (N.notNullOrEmpty(a) && N.notNullOrEmpty(b)) { throw new UnsupportedOperationException("The 'first' and 'last' Collector only can be used in sequential stream"); } return a.size() > 0 ? a : b; } }; return new CollectorImpl<>(supplier, accumulator, combiner, CH_ID); }
[ "public", "static", "<", "T", ">", "Collector", "<", "T", ",", "?", ",", "List", "<", "T", ">", ">", "first", "(", "final", "int", "n", ")", "{", "N", ".", "checkArgNotNegative", "(", "n", ",", "\"n\"", ")", ";", "final", "Supplier", "<", "List",...
Only works for sequential Stream. @param n @return @throws UnsupportedOperationException operated by multiple threads
[ "Only", "works", "for", "sequential", "Stream", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Collectors.java#L1461-L1492
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/FinanceUtils.java
FinanceUtils.toCovariances
public static PrimitiveMatrix toCovariances(Access1D<?> volatilities, Access2D<?> correlations) { int tmpSize = (int) volatilities.count(); PrimitiveMatrix.DenseReceiver retVal = PrimitiveMatrix.FACTORY.makeDense(tmpSize, tmpSize); for (int j = 0; j < tmpSize; j++) { double tmpColumnVolatility = volatilities.doubleValue(j); retVal.set(j, j, tmpColumnVolatility * tmpColumnVolatility); for (int i = j + 1; i < tmpSize; i++) { double tmpCovariance = volatilities.doubleValue(i) * correlations.doubleValue(i, j) * tmpColumnVolatility; retVal.set(i, j, tmpCovariance); retVal.set(j, i, tmpCovariance); } } return retVal.get(); }
java
public static PrimitiveMatrix toCovariances(Access1D<?> volatilities, Access2D<?> correlations) { int tmpSize = (int) volatilities.count(); PrimitiveMatrix.DenseReceiver retVal = PrimitiveMatrix.FACTORY.makeDense(tmpSize, tmpSize); for (int j = 0; j < tmpSize; j++) { double tmpColumnVolatility = volatilities.doubleValue(j); retVal.set(j, j, tmpColumnVolatility * tmpColumnVolatility); for (int i = j + 1; i < tmpSize; i++) { double tmpCovariance = volatilities.doubleValue(i) * correlations.doubleValue(i, j) * tmpColumnVolatility; retVal.set(i, j, tmpCovariance); retVal.set(j, i, tmpCovariance); } } return retVal.get(); }
[ "public", "static", "PrimitiveMatrix", "toCovariances", "(", "Access1D", "<", "?", ">", "volatilities", ",", "Access2D", "<", "?", ">", "correlations", ")", "{", "int", "tmpSize", "=", "(", "int", ")", "volatilities", ".", "count", "(", ")", ";", "Primitiv...
Vill constract a covariance matrix from the standard deviations (volatilities) and correlation coefficient,
[ "Vill", "constract", "a", "covariance", "matrix", "from", "the", "standard", "deviations", "(", "volatilities", ")", "and", "correlation", "coefficient" ]
train
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/FinanceUtils.java#L418-L435
molgenis/molgenis
molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/NameValidator.java
NameValidator.validateAttributeName
public static void validateAttributeName(String name) { checkForKeyword(name); validateName(name); if (!name.matches("[a-zA-Z0-9_#]+(-[a-z]{2,3})??$")) { throw new MolgenisDataException( "Invalid characters in: [" + name + "] Only letters (a-z, A-Z), digits (0-9), underscores (_) and hashes (#) are allowed."); } }
java
public static void validateAttributeName(String name) { checkForKeyword(name); validateName(name); if (!name.matches("[a-zA-Z0-9_#]+(-[a-z]{2,3})??$")) { throw new MolgenisDataException( "Invalid characters in: [" + name + "] Only letters (a-z, A-Z), digits (0-9), underscores (_) and hashes (#) are allowed."); } }
[ "public", "static", "void", "validateAttributeName", "(", "String", "name", ")", "{", "checkForKeyword", "(", "name", ")", ";", "validateName", "(", "name", ")", ";", "if", "(", "!", "name", ".", "matches", "(", "\"[a-zA-Z0-9_#]+(-[a-z]{2,3})??$\"", ")", ")", ...
Validates names of entities, packages and attributes. Rules: only [a-zA-Z0-9_#] are allowed, name must start with a letter
[ "Validates", "names", "of", "entities", "packages", "and", "attributes", ".", "Rules", ":", "only", "[", "a", "-", "zA", "-", "Z0", "-", "9_#", "]", "are", "allowed", "name", "must", "start", "with", "a", "letter" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/NameValidator.java#L28-L39
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.multTransB
public static void multTransB(double realAlpha , double imagAlpha, ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { // TODO add a matrix vectory multiply here MatrixMatrixMult_ZDRM.multTransB(realAlpha,imagAlpha,a,b,c); }
java
public static void multTransB(double realAlpha , double imagAlpha, ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { // TODO add a matrix vectory multiply here MatrixMatrixMult_ZDRM.multTransB(realAlpha,imagAlpha,a,b,c); }
[ "public", "static", "void", "multTransB", "(", "double", "realAlpha", ",", "double", "imagAlpha", ",", "ZMatrixRMaj", "a", ",", "ZMatrixRMaj", "b", ",", "ZMatrixRMaj", "c", ")", "{", "// TODO add a matrix vectory multiply here", "MatrixMatrixMult_ZDRM", ".", "multTran...
<p> Performs the following operation:<br> <br> c = &alpha; * a * b<sup>H</sup> <br> c<sub>ij</sub> = &alpha; &sum;<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>jk</sub>} </p> @param realAlpha Real component of scaling factor. @param imagAlpha Imaginary component of scaling factor. @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "&alpha", ";", "*", "a", "*", "b<sup", ">", "H<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&alpha", ";", "&sum", ";",...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L520-L524
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
HtmlSerialFieldWriter.addMemberTags
public void addMemberTags(FieldDoc field, Content contentTree) { Content tagContent = new ContentBuilder(); TagletWriter.genTagOuput(configuration.tagletManager, field, configuration.tagletManager.getCustomTaglets(field), writer.getTagletWriterInstance(false), tagContent); Content dlTags = new HtmlTree(HtmlTag.DL); dlTags.addContent(tagContent); contentTree.addContent(dlTags); // TODO: what if empty? }
java
public void addMemberTags(FieldDoc field, Content contentTree) { Content tagContent = new ContentBuilder(); TagletWriter.genTagOuput(configuration.tagletManager, field, configuration.tagletManager.getCustomTaglets(field), writer.getTagletWriterInstance(false), tagContent); Content dlTags = new HtmlTree(HtmlTag.DL); dlTags.addContent(tagContent); contentTree.addContent(dlTags); // TODO: what if empty? }
[ "public", "void", "addMemberTags", "(", "FieldDoc", "field", ",", "Content", "contentTree", ")", "{", "Content", "tagContent", "=", "new", "ContentBuilder", "(", ")", ";", "TagletWriter", ".", "genTagOuput", "(", "configuration", ".", "tagletManager", ",", "fiel...
Add the tag information for this member. @param field the field to document. @param contentTree the tree to which the member tags info will be added
[ "Add", "the", "tag", "information", "for", "this", "member", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java#L183-L191
mnlipp/jgrapes
org.jgrapes.http/src/org/jgrapes/http/HttpConnector.java
HttpConnector.onClosed
@Handler(channels = NetworkChannel.class) public void onClosed(Closed event, TcpChannel netConnChannel) { netConnChannel.associated(WebAppMsgChannel.class).ifPresent( appChannel -> appChannel.handleClosed(event)); pooled.remove(netConnChannel.remoteAddress(), netConnChannel); }
java
@Handler(channels = NetworkChannel.class) public void onClosed(Closed event, TcpChannel netConnChannel) { netConnChannel.associated(WebAppMsgChannel.class).ifPresent( appChannel -> appChannel.handleClosed(event)); pooled.remove(netConnChannel.remoteAddress(), netConnChannel); }
[ "@", "Handler", "(", "channels", "=", "NetworkChannel", ".", "class", ")", "public", "void", "onClosed", "(", "Closed", "event", ",", "TcpChannel", "netConnChannel", ")", "{", "netConnChannel", ".", "associated", "(", "WebAppMsgChannel", ".", "class", ")", "."...
Called when the network connection is closed. @param event the event @param netConnChannel the net conn channel
[ "Called", "when", "the", "network", "connection", "is", "closed", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/HttpConnector.java#L255-L260
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.putLong
public static int putLong(byte[] bytes, int offset, long val) { if (bytes.length - offset < SIZEOF_LONG) { throw new IllegalArgumentException("Not enough room to put a long at" + " offset " + offset + " in a " + bytes.length + " byte array"); } for (int i = offset + 7; i > offset; i--) { bytes[i] = (byte) val; val >>>= 8; } bytes[offset] = (byte) val; return offset + SIZEOF_LONG; }
java
public static int putLong(byte[] bytes, int offset, long val) { if (bytes.length - offset < SIZEOF_LONG) { throw new IllegalArgumentException("Not enough room to put a long at" + " offset " + offset + " in a " + bytes.length + " byte array"); } for (int i = offset + 7; i > offset; i--) { bytes[i] = (byte) val; val >>>= 8; } bytes[offset] = (byte) val; return offset + SIZEOF_LONG; }
[ "public", "static", "int", "putLong", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "long", "val", ")", "{", "if", "(", "bytes", ".", "length", "-", "offset", "<", "SIZEOF_LONG", ")", "{", "throw", "new", "IllegalArgumentException", "(", "...
Put a long value out to the specified byte array position. @param bytes the byte array @param offset position in the array @param val long to write out @return incremented offset @throws IllegalArgumentException if the byte array given doesn't have enough room at the offset specified.
[ "Put", "a", "long", "value", "out", "to", "the", "specified", "byte", "array", "position", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L430-L441
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GroupApi.java
GroupApi.addLdapGroupLink
public void addLdapGroupLink(Object groupIdOrPath, String cn, AccessLevel groupAccess, String provider) throws GitLabApiException { if (groupAccess == null) { throw new RuntimeException("groupAccess cannot be null or empty"); } addLdapGroupLink(groupIdOrPath, cn, groupAccess.toValue(), provider); }
java
public void addLdapGroupLink(Object groupIdOrPath, String cn, AccessLevel groupAccess, String provider) throws GitLabApiException { if (groupAccess == null) { throw new RuntimeException("groupAccess cannot be null or empty"); } addLdapGroupLink(groupIdOrPath, cn, groupAccess.toValue(), provider); }
[ "public", "void", "addLdapGroupLink", "(", "Object", "groupIdOrPath", ",", "String", "cn", ",", "AccessLevel", "groupAccess", ",", "String", "provider", ")", "throws", "GitLabApiException", "{", "if", "(", "groupAccess", "==", "null", ")", "{", "throw", "new", ...
Adds an LDAP group link. <pre><code>GitLab Endpoint: POST /groups/:id/ldap_group_links</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path @param cn the CN of a LDAP group @param groupAccess the minimum access level for members of the LDAP group @param provider the LDAP provider for the LDAP group @throws GitLabApiException if any exception occurs
[ "Adds", "an", "LDAP", "group", "link", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GroupApi.java#L924-L931
Axway/Grapes
server/src/main/java/org/axway/grapes/server/webapp/resources/PromotionReportTranslator.java
PromotionReportTranslator.buildErrorMsg
private static String buildErrorMsg(List<String> dependencies, String message) { final StringBuilder buffer = new StringBuilder(); boolean isFirstElement = true; for (String dependency : dependencies) { if (!isFirstElement) { buffer.append(", "); } // check if it is an instance of Artifact - add the gavc else append the object buffer.append(dependency); isFirstElement = false; } return String.format(message, buffer.toString()); }
java
private static String buildErrorMsg(List<String> dependencies, String message) { final StringBuilder buffer = new StringBuilder(); boolean isFirstElement = true; for (String dependency : dependencies) { if (!isFirstElement) { buffer.append(", "); } // check if it is an instance of Artifact - add the gavc else append the object buffer.append(dependency); isFirstElement = false; } return String.format(message, buffer.toString()); }
[ "private", "static", "String", "buildErrorMsg", "(", "List", "<", "String", ">", "dependencies", ",", "String", "message", ")", "{", "final", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "boolean", "isFirstElement", "=", "true", ";", ...
Get the error message with the dependencies appended @param dependencies - the list with dependencies to be attached to the message @param message - the custom error message to be displayed to the user @return String
[ "Get", "the", "error", "message", "with", "the", "dependencies", "appended" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/PromotionReportTranslator.java#L161-L174
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/interestrate/products/SimpleZeroSwap.java
SimpleZeroSwap.getValue
@Override public RandomVariableInterface getValue(double evaluationTime, LIBORModelMonteCarloSimulationInterface model) throws CalculationException { RandomVariableInterface values = model.getRandomVariableForConstant(0.0); RandomVariableInterface notional = model.getRandomVariableForConstant(1.0); for(int period=0; period<fixingDates.length; period++) { double fixingDate = fixingDates[period]; double paymentDate = paymentDates[period]; double swaprate = swaprates[period]; double periodLength = paymentDate - fixingDate; if(paymentDate < evaluationTime) { continue; } // Get random variables RandomVariableInterface index = floatIndex != null ? floatIndex.getValue(fixingDate, model) : model.getLIBOR(fixingDate, fixingDate, paymentDate); RandomVariableInterface payoff = index.sub(swaprate).mult(periodLength).mult(notional); if(!isPayFix) { payoff = payoff.mult(-1.0); } RandomVariableInterface numeraire = model.getNumeraire(paymentDate); RandomVariableInterface monteCarloProbabilities = model.getMonteCarloWeights(paymentDate); payoff = payoff.div(numeraire).mult(monteCarloProbabilities); values = values.add(payoff); notional = notional.mult(swaprate*periodLength); } RandomVariableInterface numeraireAtEvalTime = model.getNumeraire(evaluationTime); RandomVariableInterface monteCarloProbabilitiesAtEvalTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvalTime).div(monteCarloProbabilitiesAtEvalTime); return values; }
java
@Override public RandomVariableInterface getValue(double evaluationTime, LIBORModelMonteCarloSimulationInterface model) throws CalculationException { RandomVariableInterface values = model.getRandomVariableForConstant(0.0); RandomVariableInterface notional = model.getRandomVariableForConstant(1.0); for(int period=0; period<fixingDates.length; period++) { double fixingDate = fixingDates[period]; double paymentDate = paymentDates[period]; double swaprate = swaprates[period]; double periodLength = paymentDate - fixingDate; if(paymentDate < evaluationTime) { continue; } // Get random variables RandomVariableInterface index = floatIndex != null ? floatIndex.getValue(fixingDate, model) : model.getLIBOR(fixingDate, fixingDate, paymentDate); RandomVariableInterface payoff = index.sub(swaprate).mult(periodLength).mult(notional); if(!isPayFix) { payoff = payoff.mult(-1.0); } RandomVariableInterface numeraire = model.getNumeraire(paymentDate); RandomVariableInterface monteCarloProbabilities = model.getMonteCarloWeights(paymentDate); payoff = payoff.div(numeraire).mult(monteCarloProbabilities); values = values.add(payoff); notional = notional.mult(swaprate*periodLength); } RandomVariableInterface numeraireAtEvalTime = model.getNumeraire(evaluationTime); RandomVariableInterface monteCarloProbabilitiesAtEvalTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvalTime).div(monteCarloProbabilitiesAtEvalTime); return values; }
[ "@", "Override", "public", "RandomVariableInterface", "getValue", "(", "double", "evaluationTime", ",", "LIBORModelMonteCarloSimulationInterface", "model", ")", "throws", "CalculationException", "{", "RandomVariableInterface", "values", "=", "model", ".", "getRandomVariableFo...
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "valu...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/products/SimpleZeroSwap.java#L93-L130
GerdHolz/TOVAL
src/de/invation/code/toval/types/HashList.java
HashList.addAll
public boolean addAll(int index, Collection<? extends E> c) { removeNulls(c); c.removeAll(this); return super.addAll(index, c); }
java
public boolean addAll(int index, Collection<? extends E> c) { removeNulls(c); c.removeAll(this); return super.addAll(index, c); }
[ "public", "boolean", "addAll", "(", "int", "index", ",", "Collection", "<", "?", "extends", "E", ">", "c", ")", "{", "removeNulls", "(", "c", ")", ";", "c", ".", "removeAll", "(", "this", ")", ";", "return", "super", ".", "addAll", "(", "index", ",...
Inserts all of the elements in the specified Collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified Collection's iterator. @param index index at which to insert first element from the specified collection. @param c elements to be inserted into this list. @return <tt>true</tt> if this list changed as a result of the call. @throws IndexOutOfBoundsException if index out of range <tt>(index &lt; 0 || index &gt; size())</tt>. @throws NullPointerException if the specified Collection is null.
[ "Inserts", "all", "of", "the", "elements", "in", "the", "specified", "Collection", "into", "this", "list", "starting", "at", "the", "specified", "position", ".", "Shifts", "the", "element", "currently", "at", "that", "position", "(", "if", "any", ")", "and",...
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/HashList.java#L124-L128
JosePaumard/streams-utils
src/main/java/org/paumard/streams/StreamsUtils.java
StreamsUtils.shiftingWindowCollect
public static <E, T> Stream<T> shiftingWindowCollect(Stream<E> stream, int rollingFactor, Collector<? super E, ?, ? extends T> collector) { Objects.requireNonNull(stream); Objects.requireNonNull(collector); return roll(stream, rollingFactor).map(str -> str.collect(collector)); }
java
public static <E, T> Stream<T> shiftingWindowCollect(Stream<E> stream, int rollingFactor, Collector<? super E, ?, ? extends T> collector) { Objects.requireNonNull(stream); Objects.requireNonNull(collector); return roll(stream, rollingFactor).map(str -> str.collect(collector)); }
[ "public", "static", "<", "E", ",", "T", ">", "Stream", "<", "T", ">", "shiftingWindowCollect", "(", "Stream", "<", "E", ">", "stream", ",", "int", "rollingFactor", ",", "Collector", "<", "?", "super", "E", ",", "?", ",", "?", "extends", "T", ">", "...
<p>Generates a stream that is computed from a provided stream following two steps.</p> <p>The first steps consists in building a rolling stream with the <code>rollingFactor</code> passed as a parameter. This rolling stream is the same the one built using the <code>roll()</code> method. </p> <p>Then each substream is collected using the collector passed as the third parameter.</p> <p>The result is set up in a stream that has the same number of elements as the provided stream, minus the size of the window width, to preserve consistency of each collection. </p> <p>A <code>NullPointerException</code> will be thrown if the provided stream or the collector is null.</p> @param stream the processed stream @param rollingFactor the size of the window to apply the collector on @param collector the collector to be applied @param <E> the type of the provided stream @param <T>the type of the returned stream @return a stream in which each value is the collection of the provided stream
[ "<p", ">", "Generates", "a", "stream", "that", "is", "computed", "from", "a", "provided", "stream", "following", "two", "steps", ".", "<", "/", "p", ">", "<p", ">", "The", "first", "steps", "consists", "in", "building", "a", "rolling", "stream", "with", ...
train
https://github.com/JosePaumard/streams-utils/blob/56152574af0aca44c5f679761202a8f90984ab73/src/main/java/org/paumard/streams/StreamsUtils.java#L536-L541
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java
ExpressRouteCrossConnectionsInner.listRoutesTable
public ExpressRouteCircuitsRoutesTableListResultInner listRoutesTable(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) { return listRoutesTableWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).toBlocking().last().body(); }
java
public ExpressRouteCircuitsRoutesTableListResultInner listRoutesTable(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) { return listRoutesTableWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).toBlocking().last().body(); }
[ "public", "ExpressRouteCircuitsRoutesTableListResultInner", "listRoutesTable", "(", "String", "resourceGroupName", ",", "String", "crossConnectionName", ",", "String", "peeringName", ",", "String", "devicePath", ")", "{", "return", "listRoutesTableWithServiceResponseAsync", "("...
Gets the currently advertised routes table associated with the express route cross connection in a resource group. @param resourceGroupName The name of the resource group. @param crossConnectionName The name of the ExpressRouteCrossConnection. @param peeringName The name of the peering. @param devicePath The path of the device. @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 ExpressRouteCircuitsRoutesTableListResultInner object if successful.
[ "Gets", "the", "currently", "advertised", "routes", "table", "associated", "with", "the", "express", "route", "cross", "connection", "in", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L1286-L1288
json-path/JsonPath
json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
JsonPath.read
@SuppressWarnings({"unchecked"}) public static <T> T read(File jsonFile, String jsonPath, Predicate... filters) throws IOException { return new ParseContextImpl().parse(jsonFile).read(jsonPath, filters); }
java
@SuppressWarnings({"unchecked"}) public static <T> T read(File jsonFile, String jsonPath, Predicate... filters) throws IOException { return new ParseContextImpl().parse(jsonFile).read(jsonPath, filters); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "public", "static", "<", "T", ">", "T", "read", "(", "File", "jsonFile", ",", "String", "jsonPath", ",", "Predicate", "...", "filters", ")", "throws", "IOException", "{", "return", "new", "Parse...
Creates a new JsonPath and applies it to the provided Json object @param jsonFile json file @param jsonPath the json path @param filters filters to be applied to the filter place holders [?] in the path @param <T> expected return type @return list of objects matched by the given path
[ "Creates", "a", "new", "JsonPath", "and", "applies", "it", "to", "the", "provided", "Json", "object" ]
train
https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java#L526-L529
phax/ph-commons
ph-tree/src/main/java/com/helger/tree/sort/TreeWithIDSorter.java
TreeWithIDSorter.sortByValue
public static <KEYTYPE, DATATYPE extends Comparable <? super DATATYPE>, ITEMTYPE extends ITreeItemWithID <KEYTYPE, DATATYPE, ITEMTYPE>> void sortByValue (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree) { _sort (aTree, (o1, o2) -> o1.getData ().compareTo (o2.getData ())); }
java
public static <KEYTYPE, DATATYPE extends Comparable <? super DATATYPE>, ITEMTYPE extends ITreeItemWithID <KEYTYPE, DATATYPE, ITEMTYPE>> void sortByValue (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree) { _sort (aTree, (o1, o2) -> o1.getData ().compareTo (o2.getData ())); }
[ "public", "static", "<", "KEYTYPE", ",", "DATATYPE", "extends", "Comparable", "<", "?", "super", "DATATYPE", ">", ",", "ITEMTYPE", "extends", "ITreeItemWithID", "<", "KEYTYPE", ",", "DATATYPE", ",", "ITEMTYPE", ">", ">", "void", "sortByValue", "(", "@", "Non...
Sort each level of the passed tree on the value with the specified comparator. This method assumes that the values in the tree item implement the {@link Comparable} interface. @param <KEYTYPE> Tree item key type @param <DATATYPE> Tree item data type @param <ITEMTYPE> Tree item type @param aTree The tree to be sorted.
[ "Sort", "each", "level", "of", "the", "passed", "tree", "on", "the", "value", "with", "the", "specified", "comparator", ".", "This", "method", "assumes", "that", "the", "values", "in", "the", "tree", "item", "implement", "the", "{", "@link", "Comparable", ...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-tree/src/main/java/com/helger/tree/sort/TreeWithIDSorter.java#L148-L151
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/LocalFileResource.java
LocalFileResource.newResourceFromResource
public static LocalFileResource newResourceFromResource(String normalizedPath, String repositoryPath, InternalWsResource related) { SymbolicRootResource root = null; if (related != null) root = related.getSymbolicRoot(); return new LocalFileResource(normalizedPath, repositoryPath, root); }
java
public static LocalFileResource newResourceFromResource(String normalizedPath, String repositoryPath, InternalWsResource related) { SymbolicRootResource root = null; if (related != null) root = related.getSymbolicRoot(); return new LocalFileResource(normalizedPath, repositoryPath, root); }
[ "public", "static", "LocalFileResource", "newResourceFromResource", "(", "String", "normalizedPath", ",", "String", "repositoryPath", ",", "InternalWsResource", "related", ")", "{", "SymbolicRootResource", "root", "=", "null", ";", "if", "(", "related", "!=", "null", ...
Create a new local resource @param normalizedPath Normalized file path for this resource; can not be null. @param repositoryPath An abstraction of the file location; may be null. @param related LocalFileResource with shared attributes (like the SymbolicRoot)
[ "Create", "a", "new", "local", "resource" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/LocalFileResource.java#L110-L116
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DevicesSharesApi.java
DevicesSharesApi.createShareForDevice
public DeviceSharingId createShareForDevice(String deviceId, DeviceShareInfo deviceShareInfo) throws ApiException { ApiResponse<DeviceSharingId> resp = createShareForDeviceWithHttpInfo(deviceId, deviceShareInfo); return resp.getData(); }
java
public DeviceSharingId createShareForDevice(String deviceId, DeviceShareInfo deviceShareInfo) throws ApiException { ApiResponse<DeviceSharingId> resp = createShareForDeviceWithHttpInfo(deviceId, deviceShareInfo); return resp.getData(); }
[ "public", "DeviceSharingId", "createShareForDevice", "(", "String", "deviceId", ",", "DeviceShareInfo", "deviceShareInfo", ")", "throws", "ApiException", "{", "ApiResponse", "<", "DeviceSharingId", ">", "resp", "=", "createShareForDeviceWithHttpInfo", "(", "deviceId", ","...
Share a device Share a device @param deviceId Device ID. (required) @param deviceShareInfo Device object that needs to be added (required) @return DeviceSharingId @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Share", "a", "device", "Share", "a", "device" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesSharesApi.java#L133-L136
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java
MathBindings.nextAfter
public static FloatBinding nextAfter(final float start, final ObservableFloatValue direction) { return createFloatBinding(() -> Math.nextAfter(start, direction.get()), direction); }
java
public static FloatBinding nextAfter(final float start, final ObservableFloatValue direction) { return createFloatBinding(() -> Math.nextAfter(start, direction.get()), direction); }
[ "public", "static", "FloatBinding", "nextAfter", "(", "final", "float", "start", ",", "final", "ObservableFloatValue", "direction", ")", "{", "return", "createFloatBinding", "(", "(", ")", "->", "Math", ".", "nextAfter", "(", "start", ",", "direction", ".", "g...
Binding for {@link java.lang.Math#nextAfter(float, double)} @param start starting floating-point value @param direction value indicating which of {@code start}'s neighbors or {@code start} should be returned @return The floating-point number adjacent to {@code start} in the direction of {@code direction}.
[ "Binding", "for", "{", "@link", "java", ".", "lang", ".", "Math#nextAfter", "(", "float", "double", ")", "}" ]
train
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L1141-L1143
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.escapeUriPathSegment
public static void escapeUriPathSegment(final String text, final Writer writer) throws IOException { escapeUriPathSegment(text, writer, DEFAULT_ENCODING); }
java
public static void escapeUriPathSegment(final String text, final Writer writer) throws IOException { escapeUriPathSegment(text, writer, DEFAULT_ENCODING); }
[ "public", "static", "void", "escapeUriPathSegment", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeUriPathSegment", "(", "text", ",", "writer", ",", "DEFAULT_ENCODING", ")", ";", "}" ]
<p> Perform am URI path segment <strong>escape</strong> operation on a <tt>String</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>. </p> <p> The following are the only allowed chars in an URI path segment (will not be escaped): </p> <ul> <li><tt>A-Z a-z 0-9</tt></li> <li><tt>- . _ ~</tt></li> <li><tt>! $ &amp; ' ( ) * + , ; =</tt></li> <li><tt>: @</tt></li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the <tt>UTF-8</tt> and then representing each byte in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "path", "segment", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "using", "<tt", ">", "UTF", "-", "8<", "/", "tt", ">", "as", "encoding", "w...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L533-L536
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/SubqueryPlanner.java
SubqueryPlanner.appendExistSubqueryApplyNode
private PlanBuilder appendExistSubqueryApplyNode(PlanBuilder subPlan, ExistsPredicate existsPredicate, boolean correlationAllowed) { if (subPlan.canTranslate(existsPredicate)) { // given subquery is already appended return subPlan; } PlanBuilder subqueryPlan = createPlanBuilder(existsPredicate.getSubquery()); PlanNode subqueryPlanRoot = subqueryPlan.getRoot(); if (isAggregationWithEmptyGroupBy(subqueryPlanRoot)) { subPlan.getTranslations().put(existsPredicate, BooleanLiteral.TRUE_LITERAL); return subPlan; } // add an explicit projection that removes all columns PlanNode subqueryNode = new ProjectNode(idAllocator.getNextId(), subqueryPlan.getRoot(), Assignments.of()); Symbol exists = symbolAllocator.newSymbol("exists", BOOLEAN); subPlan.getTranslations().put(existsPredicate, exists); ExistsPredicate rewrittenExistsPredicate = new ExistsPredicate(BooleanLiteral.TRUE_LITERAL); return appendApplyNode( subPlan, existsPredicate.getSubquery(), subqueryNode, Assignments.of(exists, rewrittenExistsPredicate), correlationAllowed); }
java
private PlanBuilder appendExistSubqueryApplyNode(PlanBuilder subPlan, ExistsPredicate existsPredicate, boolean correlationAllowed) { if (subPlan.canTranslate(existsPredicate)) { // given subquery is already appended return subPlan; } PlanBuilder subqueryPlan = createPlanBuilder(existsPredicate.getSubquery()); PlanNode subqueryPlanRoot = subqueryPlan.getRoot(); if (isAggregationWithEmptyGroupBy(subqueryPlanRoot)) { subPlan.getTranslations().put(existsPredicate, BooleanLiteral.TRUE_LITERAL); return subPlan; } // add an explicit projection that removes all columns PlanNode subqueryNode = new ProjectNode(idAllocator.getNextId(), subqueryPlan.getRoot(), Assignments.of()); Symbol exists = symbolAllocator.newSymbol("exists", BOOLEAN); subPlan.getTranslations().put(existsPredicate, exists); ExistsPredicate rewrittenExistsPredicate = new ExistsPredicate(BooleanLiteral.TRUE_LITERAL); return appendApplyNode( subPlan, existsPredicate.getSubquery(), subqueryNode, Assignments.of(exists, rewrittenExistsPredicate), correlationAllowed); }
[ "private", "PlanBuilder", "appendExistSubqueryApplyNode", "(", "PlanBuilder", "subPlan", ",", "ExistsPredicate", "existsPredicate", ",", "boolean", "correlationAllowed", ")", "{", "if", "(", "subPlan", ".", "canTranslate", "(", "existsPredicate", ")", ")", "{", "// gi...
Exists is modeled as: <pre> - Project($0 > 0) - Aggregation(COUNT(*)) - Limit(1) -- subquery </pre>
[ "Exists", "is", "modeled", "as", ":", "<pre", ">", "-", "Project", "(", "$0", ">", "0", ")", "-", "Aggregation", "(", "COUNT", "(", "*", "))", "-", "Limit", "(", "1", ")", "--", "subquery", "<", "/", "pre", ">" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/SubqueryPlanner.java#L275-L302
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ClassUtils.java
ClassUtils.getAbbreviatedName
public static String getAbbreviatedName(final Class<?> cls, final int len) { if (cls == null) { return StringUtils.EMPTY; } return getAbbreviatedName(cls.getName(), len); }
java
public static String getAbbreviatedName(final Class<?> cls, final int len) { if (cls == null) { return StringUtils.EMPTY; } return getAbbreviatedName(cls.getName(), len); }
[ "public", "static", "String", "getAbbreviatedName", "(", "final", "Class", "<", "?", ">", "cls", ",", "final", "int", "len", ")", "{", "if", "(", "cls", "==", "null", ")", "{", "return", "StringUtils", ".", "EMPTY", ";", "}", "return", "getAbbreviatedNam...
<p>Gets the abbreviated name of a {@code Class}.</p> @param cls the class to get the abbreviated name for, may be {@code null} @param len the desired length of the abbreviated name @return the abbreviated name or an empty string @throws IllegalArgumentException if len &lt;= 0 @see #getAbbreviatedName(String, int) @since 3.4
[ "<p", ">", "Gets", "the", "abbreviated", "name", "of", "a", "{", "@code", "Class", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L416-L421
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/CFFFontSubset.java
CFFFontSubset.CreateNonCIDSubrs
void CreateNonCIDSubrs(int Font,IndexBaseItem PrivateBase,OffsetItem Subrs) { // Mark the beginning of the Subrs index OutputList.addLast(new SubrMarkerItem(Subrs,PrivateBase)); // Put the subsetted new subrs index OutputList.addLast(new RangeItem(new RandomAccessFileOrArray(NewSubrsIndexNonCID),0,NewSubrsIndexNonCID.length)); }
java
void CreateNonCIDSubrs(int Font,IndexBaseItem PrivateBase,OffsetItem Subrs) { // Mark the beginning of the Subrs index OutputList.addLast(new SubrMarkerItem(Subrs,PrivateBase)); // Put the subsetted new subrs index OutputList.addLast(new RangeItem(new RandomAccessFileOrArray(NewSubrsIndexNonCID),0,NewSubrsIndexNonCID.length)); }
[ "void", "CreateNonCIDSubrs", "(", "int", "Font", ",", "IndexBaseItem", "PrivateBase", ",", "OffsetItem", "Subrs", ")", "{", "// Mark the beginning of the Subrs index", "OutputList", ".", "addLast", "(", "new", "SubrMarkerItem", "(", "Subrs", ",", "PrivateBase", ")", ...
the function marks the beginning of the subrs index and adds the subsetted subrs index to the output list. @param Font the font @param PrivateBase IndexBaseItem for the private that's referencing to the subrs @param Subrs OffsetItem for the subrs
[ "the", "function", "marks", "the", "beginning", "of", "the", "subrs", "index", "and", "adds", "the", "subsetted", "subrs", "index", "to", "the", "output", "list", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/CFFFontSubset.java#L1639-L1645
gfk-ba/senbot
SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java
ElementService.dragElementTo
public void dragElementTo(By draggable, By droppable) throws InterruptedException { WebDriver driver = getWebDriver(); Actions clickAndDrag = new Actions(getWebDriver()); clickAndDrag.dragAndDrop(driver.findElement(draggable), driver.findElement(droppable)); clickAndDrag.perform(); }
java
public void dragElementTo(By draggable, By droppable) throws InterruptedException { WebDriver driver = getWebDriver(); Actions clickAndDrag = new Actions(getWebDriver()); clickAndDrag.dragAndDrop(driver.findElement(draggable), driver.findElement(droppable)); clickAndDrag.perform(); }
[ "public", "void", "dragElementTo", "(", "By", "draggable", ",", "By", "droppable", ")", "throws", "InterruptedException", "{", "WebDriver", "driver", "=", "getWebDriver", "(", ")", ";", "Actions", "clickAndDrag", "=", "new", "Actions", "(", "getWebDriver", "(", ...
Drags an element some place else @param draggable The element to drag @param droppable The drop aim @throws InterruptedException
[ "Drags", "an", "element", "some", "place", "else" ]
train
https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java#L332-L338
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/cache/tile/VectorTile.java
VectorTile.apply
public void apply(final String filter, final TileFunction<VectorTile> callback) { switch (getStatus()) { case EMPTY: fetch(filter, callback); break; case LOADING: if (needsReload(filter)) { deferred.cancel(); fetch(filter, callback); } else { final VectorTile self = this; deferred.addCallback(new AbstractCommandCallback<GetVectorTileResponse>() { public void execute(GetVectorTileResponse response) { callback.execute(self); } }); } break; case LOADED: if (needsReload(filter)) { // Check if the labels need to be fetched as well: fetch(filter, callback); } else { callback.execute(this); } break; default: throw new IllegalStateException("Unknown status " + getStatus()); } }
java
public void apply(final String filter, final TileFunction<VectorTile> callback) { switch (getStatus()) { case EMPTY: fetch(filter, callback); break; case LOADING: if (needsReload(filter)) { deferred.cancel(); fetch(filter, callback); } else { final VectorTile self = this; deferred.addCallback(new AbstractCommandCallback<GetVectorTileResponse>() { public void execute(GetVectorTileResponse response) { callback.execute(self); } }); } break; case LOADED: if (needsReload(filter)) { // Check if the labels need to be fetched as well: fetch(filter, callback); } else { callback.execute(this); } break; default: throw new IllegalStateException("Unknown status " + getStatus()); } }
[ "public", "void", "apply", "(", "final", "String", "filter", ",", "final", "TileFunction", "<", "VectorTile", ">", "callback", ")", "{", "switch", "(", "getStatus", "(", ")", ")", "{", "case", "EMPTY", ":", "fetch", "(", "filter", ",", "callback", ")", ...
Execute a TileFunction on this tile. If the tile is not yet loaded, attach it to the isLoaded event. @param filter filter which needs to be applied when fetching @param callback callback to call
[ "Execute", "a", "TileFunction", "on", "this", "tile", ".", "If", "the", "tile", "is", "not", "yet", "loaded", "attach", "it", "to", "the", "isLoaded", "event", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/cache/tile/VectorTile.java#L149-L179
jayantk/jklol
src/com/jayantkrish/jklol/ccg/CcgParser.java
CcgParser.replaceLexicon
public CcgParser replaceLexicon(int index, CcgLexicon newLexicon) { List<CcgLexicon> newLexicons = Lists.newArrayList(lexicons); newLexicons.set(index, newLexicon); return new CcgParser(newLexicons, lexiconScorers, wordSkipWordVar, wordSkipFactor, dependencyHeadVar, dependencySyntaxVar, dependencyArgNumVar, dependencyArgVar, dependencyHeadPosVar, dependencyArgPosVar, dependencyDistribution, wordDistanceVar, wordDistanceFactor, puncDistanceVar, puncDistanceFactor, puncTagSet, verbDistanceVar, verbDistanceFactor, verbTagSet, leftSyntaxVar, rightSyntaxVar, combinatorVar, binaryRuleDistribution, unaryRuleInputVar, unaryRuleVar, unaryRuleFactor, headedBinaryPredicateVar, headedBinaryPosVar, headedBinaryRuleDistribution, searchMoveVar, compiledSyntaxDistribution, rootSyntaxVar, rootPredicateVar, rootPosVar, rootSyntaxDistribution, headedRootSyntaxDistribution, normalFormOnly); }
java
public CcgParser replaceLexicon(int index, CcgLexicon newLexicon) { List<CcgLexicon> newLexicons = Lists.newArrayList(lexicons); newLexicons.set(index, newLexicon); return new CcgParser(newLexicons, lexiconScorers, wordSkipWordVar, wordSkipFactor, dependencyHeadVar, dependencySyntaxVar, dependencyArgNumVar, dependencyArgVar, dependencyHeadPosVar, dependencyArgPosVar, dependencyDistribution, wordDistanceVar, wordDistanceFactor, puncDistanceVar, puncDistanceFactor, puncTagSet, verbDistanceVar, verbDistanceFactor, verbTagSet, leftSyntaxVar, rightSyntaxVar, combinatorVar, binaryRuleDistribution, unaryRuleInputVar, unaryRuleVar, unaryRuleFactor, headedBinaryPredicateVar, headedBinaryPosVar, headedBinaryRuleDistribution, searchMoveVar, compiledSyntaxDistribution, rootSyntaxVar, rootPredicateVar, rootPosVar, rootSyntaxDistribution, headedRootSyntaxDistribution, normalFormOnly); }
[ "public", "CcgParser", "replaceLexicon", "(", "int", "index", ",", "CcgLexicon", "newLexicon", ")", "{", "List", "<", "CcgLexicon", ">", "newLexicons", "=", "Lists", ".", "newArrayList", "(", "lexicons", ")", ";", "newLexicons", ".", "set", "(", "index", ","...
Creates a new CCG parser by replacing a lexicon of this parser with {@code newLexicon}. @param index @param newLexicon @return
[ "Creates", "a", "new", "CCG", "parser", "by", "replacing", "a", "lexicon", "of", "this", "parser", "with", "{", "@code", "newLexicon", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/CcgParser.java#L403-L416
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.removeElement
public static <E> boolean removeElement(Collection<E> self, Object o) { return self.remove(o); }
java
public static <E> boolean removeElement(Collection<E> self, Object o) { return self.remove(o); }
[ "public", "static", "<", "E", ">", "boolean", "removeElement", "(", "Collection", "<", "E", ">", "self", ",", "Object", "o", ")", "{", "return", "self", ".", "remove", "(", "o", ")", ";", "}" ]
Modifies this collection by removing a single instance of the specified element from this collection, if it is present. Essentially an alias for {@link Collection#remove(Object)} but with no ambiguity for Collection&lt;Integer&gt;. <p/> Example: <pre class="groovyTestCase"> def list = [1, 2, 3, 2] list.removeElement(2) assert [1, 3, 2] == list </pre> @param self a Collection @param o element to be removed from this collection, if present @return true if an element was removed as a result of this call @since 2.4.0
[ "Modifies", "this", "collection", "by", "removing", "a", "single", "instance", "of", "the", "specified", "element", "from", "this", "collection", "if", "it", "is", "present", ".", "Essentially", "an", "alias", "for", "{", "@link", "Collection#remove", "(", "Ob...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17867-L17869
waldheinz/fat32-lib
src/main/java/de/waldheinz/fs/fat/LittleEndian.java
LittleEndian.setInt32
public static void setInt32(byte[] dst, int offset, long value) throws IllegalArgumentException { assert value <= Integer.MAX_VALUE : "value out of range"; dst[offset + 0] = (byte) (value & 0xFF); dst[offset + 1] = (byte) ((value >>> 8) & 0xFF); dst[offset + 2] = (byte) ((value >>> 16) & 0xFF); dst[offset + 3] = (byte) ((value >>> 24) & 0xFF); }
java
public static void setInt32(byte[] dst, int offset, long value) throws IllegalArgumentException { assert value <= Integer.MAX_VALUE : "value out of range"; dst[offset + 0] = (byte) (value & 0xFF); dst[offset + 1] = (byte) ((value >>> 8) & 0xFF); dst[offset + 2] = (byte) ((value >>> 16) & 0xFF); dst[offset + 3] = (byte) ((value >>> 24) & 0xFF); }
[ "public", "static", "void", "setInt32", "(", "byte", "[", "]", "dst", ",", "int", "offset", ",", "long", "value", ")", "throws", "IllegalArgumentException", "{", "assert", "value", "<=", "Integer", ".", "MAX_VALUE", ":", "\"value out of range\"", ";", "dst", ...
Sets a 32-bit integer in the given byte array at the given offset.
[ "Sets", "a", "32", "-", "bit", "integer", "in", "the", "given", "byte", "array", "at", "the", "given", "offset", "." ]
train
https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/LittleEndian.java#L92-L101
audit4j/audit4j-core
src/main/java/org/audit4j/core/annotation/AuditAnnotationAttributes.java
AuditAnnotationAttributes.getAction
private String getAction(final Annotation[] annotations, final Method method) { for (final Annotation annotation : annotations) { if (annotation instanceof Audit) { final Audit audit = (Audit) annotation; String action = audit.action(); if (ACTION.equals(action)) { return method.getName(); } else { return action; } } } return null; }
java
private String getAction(final Annotation[] annotations, final Method method) { for (final Annotation annotation : annotations) { if (annotation instanceof Audit) { final Audit audit = (Audit) annotation; String action = audit.action(); if (ACTION.equals(action)) { return method.getName(); } else { return action; } } } return null; }
[ "private", "String", "getAction", "(", "final", "Annotation", "[", "]", "annotations", ",", "final", "Method", "method", ")", "{", "for", "(", "final", "Annotation", "annotation", ":", "annotations", ")", "{", "if", "(", "annotation", "instanceof", "Audit", ...
Gets the action. @param annotations the annotations @param method the method @return the action
[ "Gets", "the", "action", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/annotation/AuditAnnotationAttributes.java#L168-L181
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuGraphAddEmptyNode
public static int cuGraphAddEmptyNode(CUgraphNode phGraphNode, CUgraph hGraph, CUgraphNode dependencies[], long numDependencies) { return checkResult(cuGraphAddEmptyNodeNative(phGraphNode, hGraph, dependencies, numDependencies)); }
java
public static int cuGraphAddEmptyNode(CUgraphNode phGraphNode, CUgraph hGraph, CUgraphNode dependencies[], long numDependencies) { return checkResult(cuGraphAddEmptyNodeNative(phGraphNode, hGraph, dependencies, numDependencies)); }
[ "public", "static", "int", "cuGraphAddEmptyNode", "(", "CUgraphNode", "phGraphNode", ",", "CUgraph", "hGraph", ",", "CUgraphNode", "dependencies", "[", "]", ",", "long", "numDependencies", ")", "{", "return", "checkResult", "(", "cuGraphAddEmptyNodeNative", "(", "ph...
Creates an empty node and adds it to a graph.<br> <br> Creates a new node which performs no operation, and adds it to \p hGraph with \p numDependencies dependencies specified via \p dependencies. It is possible for \p numDependencies to be 0, in which case the node will be placed at the root of the graph. \p dependencies may not have any duplicate entries. A handle to the new node will be returned in \p phGraphNode. An empty node performs no operation during execution, but can be used for transitive ordering. For example, a phased execution graph with 2 groups of n nodes with a barrier between them can be represented using an empty node and 2*n dependency edges, rather than no empty node and n^2 dependency edges. @param phGraphNode - Returns newly created node @param hGraph - Graph to which to add the node @param dependencies - Dependencies of the node @param numDependencies - Number of dependencies @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_VALUE, @see JCudaDriver#cuGraphCreate JCudaDriver#cuGraphDestroyNode JCudaDriver#cuGraphAddChildGraphNode JCudaDriver#cuGraphAddKernelNode JCudaDriver#cuGraphAddHostNode JCudaDriver#cuGraphAddMemcpyNode JCudaDriver#cuGraphAddMemsetNode
[ "Creates", "an", "empty", "node", "and", "adds", "it", "to", "a", "graph", ".", "<br", ">", "<br", ">", "Creates", "a", "new", "node", "which", "performs", "no", "operation", "and", "adds", "it", "to", "\\", "p", "hGraph", "with", "\\", "p", "numDepe...
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12551-L12554