repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/PullerInternal.java
PullerInternal.pullRemoteRevision
@InterfaceAudience.Private public void pullRemoteRevision(final RevisionInternal rev) { Log.d(TAG, "%s: pullRemoteRevision with rev: %s", this, rev); ++httpConnectionCount; // Construct a query. We want the revision history, and the bodies of attachments that have // been added since the latest revisions we have locally. // See: http://wiki.apache.org/couchdb/HTTP_Document_API#Getting_Attachments_With_a_Document StringBuilder path = new StringBuilder(encodeDocumentId(rev.getDocID())); path.append("?rev=").append(URIUtils.encode(rev.getRevID())); path.append("&revs=true"); // TODO: CBL Java does not have implementation of _settings yet. Till then, attachments always true boolean attachments = true; if (attachments) path.append("&attachments=true"); // Include atts_since with a list of possible ancestor revisions of rev. If getting attachments, // this allows the server to skip the bodies of attachments that have not changed since the // local ancestor. The server can also trim the revision history it returns, to not extend past // the local ancestor (not implemented yet in SG but will be soon.) AtomicBoolean haveBodies = new AtomicBoolean(false); List<String> possibleAncestors = null; possibleAncestors = db.getPossibleAncestorRevisionIDs(rev, PullerInternal.MAX_NUMBER_OF_ATTS_SINCE, attachments ? haveBodies : null, true); if (possibleAncestors != null) { path.append(haveBodies.get() ? "&atts_since=" : "&revs_from="); path.append(joinQuotedEscaped(possibleAncestors)); } else { int maxRevTreeDepth = getLocalDatabase().getMaxRevTreeDepth(); if (rev.getGeneration() > maxRevTreeDepth) { path.append("&revs_limit="); path.append(maxRevTreeDepth); } } //create a final version of this variable for the log statement inside //FIXME find a way to avoid this final String pathInside = path.toString(); CustomFuture future = sendAsyncMultipartDownloaderRequest("GET", pathInside, null, db, new RemoteRequestCompletion() { @Override public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) { if (e != null) { Log.w(TAG, "Error pulling remote revision: %s", e, this); if (Utils.isDocumentError(e)) { // Revision is missing or not accessible: revisionFailed(rev, e); } else { // Request failed: setError(e); } } else { Map<String, Object> properties = (Map<String, Object>) result; long size = 0; if (httpResponse != null && httpResponse.body() != null) size = httpResponse.body().contentLength(); PulledRevision gotRev = new PulledRevision(properties, size); gotRev.setSequence(rev.getSequence()); Log.d(TAG, "%s: pullRemoteRevision add rev: %s to batcher: %s", PullerInternal.this, gotRev, downloadsToInsert); // NOTE: should not/not necessary to call Body.compact() // new PulledRevision(Map<string, Object>) creates Body instance only // with `object`. Serializing object to json causes two unnecessary // JSON serializations. if (gotRev.getBody() != null) queuedMemorySize.addAndGet(gotRev.getBody().getSize()); // Add to batcher ... eventually it will be fed to -insertRevisions:. downloadsToInsert.queueObject(gotRev); // if queue memory size is more than maximum, force flush the queue. if (queuedMemorySize.get() > MAX_QUEUE_MEMORY_SIZE) { Log.d(TAG, "Flushing queued memory size at: " + queuedMemorySize); downloadsToInsert.flushAllAndWait(); } } // Note that we've finished this task: --httpConnectionCount; // Start another task if there are still revisions waiting to be pulled: pullRemoteRevisions(); } }); future.setQueue(pendingFutures); pendingFutures.add(future); }
java
@InterfaceAudience.Private public void pullRemoteRevision(final RevisionInternal rev) { Log.d(TAG, "%s: pullRemoteRevision with rev: %s", this, rev); ++httpConnectionCount; // Construct a query. We want the revision history, and the bodies of attachments that have // been added since the latest revisions we have locally. // See: http://wiki.apache.org/couchdb/HTTP_Document_API#Getting_Attachments_With_a_Document StringBuilder path = new StringBuilder(encodeDocumentId(rev.getDocID())); path.append("?rev=").append(URIUtils.encode(rev.getRevID())); path.append("&revs=true"); // TODO: CBL Java does not have implementation of _settings yet. Till then, attachments always true boolean attachments = true; if (attachments) path.append("&attachments=true"); // Include atts_since with a list of possible ancestor revisions of rev. If getting attachments, // this allows the server to skip the bodies of attachments that have not changed since the // local ancestor. The server can also trim the revision history it returns, to not extend past // the local ancestor (not implemented yet in SG but will be soon.) AtomicBoolean haveBodies = new AtomicBoolean(false); List<String> possibleAncestors = null; possibleAncestors = db.getPossibleAncestorRevisionIDs(rev, PullerInternal.MAX_NUMBER_OF_ATTS_SINCE, attachments ? haveBodies : null, true); if (possibleAncestors != null) { path.append(haveBodies.get() ? "&atts_since=" : "&revs_from="); path.append(joinQuotedEscaped(possibleAncestors)); } else { int maxRevTreeDepth = getLocalDatabase().getMaxRevTreeDepth(); if (rev.getGeneration() > maxRevTreeDepth) { path.append("&revs_limit="); path.append(maxRevTreeDepth); } } //create a final version of this variable for the log statement inside //FIXME find a way to avoid this final String pathInside = path.toString(); CustomFuture future = sendAsyncMultipartDownloaderRequest("GET", pathInside, null, db, new RemoteRequestCompletion() { @Override public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) { if (e != null) { Log.w(TAG, "Error pulling remote revision: %s", e, this); if (Utils.isDocumentError(e)) { // Revision is missing or not accessible: revisionFailed(rev, e); } else { // Request failed: setError(e); } } else { Map<String, Object> properties = (Map<String, Object>) result; long size = 0; if (httpResponse != null && httpResponse.body() != null) size = httpResponse.body().contentLength(); PulledRevision gotRev = new PulledRevision(properties, size); gotRev.setSequence(rev.getSequence()); Log.d(TAG, "%s: pullRemoteRevision add rev: %s to batcher: %s", PullerInternal.this, gotRev, downloadsToInsert); // NOTE: should not/not necessary to call Body.compact() // new PulledRevision(Map<string, Object>) creates Body instance only // with `object`. Serializing object to json causes two unnecessary // JSON serializations. if (gotRev.getBody() != null) queuedMemorySize.addAndGet(gotRev.getBody().getSize()); // Add to batcher ... eventually it will be fed to -insertRevisions:. downloadsToInsert.queueObject(gotRev); // if queue memory size is more than maximum, force flush the queue. if (queuedMemorySize.get() > MAX_QUEUE_MEMORY_SIZE) { Log.d(TAG, "Flushing queued memory size at: " + queuedMemorySize); downloadsToInsert.flushAllAndWait(); } } // Note that we've finished this task: --httpConnectionCount; // Start another task if there are still revisions waiting to be pulled: pullRemoteRevisions(); } }); future.setQueue(pendingFutures); pendingFutures.add(future); }
[ "@", "InterfaceAudience", ".", "Private", "public", "void", "pullRemoteRevision", "(", "final", "RevisionInternal", "rev", ")", "{", "Log", ".", "d", "(", "TAG", ",", "\"%s: pullRemoteRevision with rev: %s\"", ",", "this", ",", "rev", ")", ";", "++", "httpConnec...
Fetches the contents of a revision from the remote db, including its parent revision ID. The contents are stored into rev.properties.
[ "Fetches", "the", "contents", "of", "a", "revision", "from", "the", "remote", "db", "including", "its", "parent", "revision", "ID", ".", "The", "contents", "are", "stored", "into", "rev", ".", "properties", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/PullerInternal.java#L673-L767
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/PullerInternal.java
PullerInternal.queueRemoteRevision
@InterfaceAudience.Private protected void queueRemoteRevision(RevisionInternal rev) { if (rev.isDeleted()) { deletedRevsToPull.add(rev); } else { revsToPull.add(rev); } }
java
@InterfaceAudience.Private protected void queueRemoteRevision(RevisionInternal rev) { if (rev.isDeleted()) { deletedRevsToPull.add(rev); } else { revsToPull.add(rev); } }
[ "@", "InterfaceAudience", ".", "Private", "protected", "void", "queueRemoteRevision", "(", "RevisionInternal", "rev", ")", "{", "if", "(", "rev", ".", "isDeleted", "(", ")", ")", "{", "deletedRevsToPull", ".", "add", "(", "rev", ")", ";", "}", "else", "{",...
Add a revision to the appropriate queue of revs to individually GET
[ "Add", "a", "revision", "to", "the", "appropriate", "queue", "of", "revs", "to", "individually", "GET" ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/PullerInternal.java#L786-L793
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/util/URIUtils.java
URIUtils.isAllowed
private static boolean isAllowed(char c, String allow) { return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || "_-!.~'()*".indexOf(c) != NOT_FOUND || (allow != null && allow.indexOf(c) != NOT_FOUND); }
java
private static boolean isAllowed(char c, String allow) { return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || "_-!.~'()*".indexOf(c) != NOT_FOUND || (allow != null && allow.indexOf(c) != NOT_FOUND); }
[ "private", "static", "boolean", "isAllowed", "(", "char", "c", ",", "String", "allow", ")", "{", "return", "(", "c", ">=", "'", "'", "&&", "c", "<=", "'", "'", ")", "||", "(", "c", ">=", "'", "'", "&&", "c", "<=", "'", "'", ")", "||", "(", ...
Returns true if the given character is allowed. @param c character to check @param allow characters to allow @return true if the character is allowed or false if it should be encoded
[ "Returns", "true", "if", "the", "given", "character", "is", "allowed", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/util/URIUtils.java#L170-L176
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/internal/RevisionInternal.java
RevisionInternal.mutateAttachments
public boolean mutateAttachments(CollectionUtils.Functor<Map<String, Object>, Map<String, Object>> functor) { { Map<String, Object> properties = getProperties(); Map<String, Object> editedProperties = null; Map<String, Object> attachments = (Map<String, Object>) properties.get("_attachments"); Map<String, Object> editedAttachments = null; if (attachments != null) { for (String name : attachments.keySet()) { Map<String, Object> attachment = new HashMap<String, Object>( (Map<String, Object>) attachments.get(name)); attachment.put("name", name); Map<String, Object> editedAttachment = functor.invoke(attachment); if (editedAttachment == null) { return false; // block canceled } if (editedAttachment != attachment) { if (editedProperties == null) { // Make the document properties and _attachments dictionary mutable: editedProperties = new HashMap<String, Object>(properties); editedAttachments = new HashMap<String, Object>(attachments); editedProperties.put("_attachments", editedAttachments); } editedAttachment.remove("name"); editedAttachments.put(name, editedAttachment); } } } if (editedProperties != null) { setProperties(editedProperties); return true; } return false; } }
java
public boolean mutateAttachments(CollectionUtils.Functor<Map<String, Object>, Map<String, Object>> functor) { { Map<String, Object> properties = getProperties(); Map<String, Object> editedProperties = null; Map<String, Object> attachments = (Map<String, Object>) properties.get("_attachments"); Map<String, Object> editedAttachments = null; if (attachments != null) { for (String name : attachments.keySet()) { Map<String, Object> attachment = new HashMap<String, Object>( (Map<String, Object>) attachments.get(name)); attachment.put("name", name); Map<String, Object> editedAttachment = functor.invoke(attachment); if (editedAttachment == null) { return false; // block canceled } if (editedAttachment != attachment) { if (editedProperties == null) { // Make the document properties and _attachments dictionary mutable: editedProperties = new HashMap<String, Object>(properties); editedAttachments = new HashMap<String, Object>(attachments); editedProperties.put("_attachments", editedAttachments); } editedAttachment.remove("name"); editedAttachments.put(name, editedAttachment); } } } if (editedProperties != null) { setProperties(editedProperties); return true; } return false; } }
[ "public", "boolean", "mutateAttachments", "(", "CollectionUtils", ".", "Functor", "<", "Map", "<", "String", ",", "Object", ">", ",", "Map", "<", "String", ",", "Object", ">", ">", "functor", ")", "{", "{", "Map", "<", "String", ",", "Object", ">", "pr...
Returns YES if any changes were made.
[ "Returns", "YES", "if", "any", "changes", "were", "made", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/internal/RevisionInternal.java#L237-L272
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/BlobStoreWriter.java
BlobStoreWriter.appendData
public void appendData(byte[] data) throws IOException, SymmetricKeyException { if (data == null) return; appendData(data, 0, data.length); }
java
public void appendData(byte[] data) throws IOException, SymmetricKeyException { if (data == null) return; appendData(data, 0, data.length); }
[ "public", "void", "appendData", "(", "byte", "[", "]", "data", ")", "throws", "IOException", ",", "SymmetricKeyException", "{", "if", "(", "data", "==", "null", ")", "return", ";", "appendData", "(", "data", ",", "0", ",", "data", ".", "length", ")", "...
Appends data to the blob. Call this when new data is available.
[ "Appends", "data", "to", "the", "blob", ".", "Call", "this", "when", "new", "data", "is", "available", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/BlobStoreWriter.java#L108-L112
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/BlobStoreWriter.java
BlobStoreWriter.finish
public void finish() throws IOException, SymmetricKeyException { if (outStream != null) { if (encryptor != null) outStream.write(encryptor.encrypt(null)); // FileOutputStream is also closed cascadingly outStream.close(); outStream = null; // Only create the key if we got all the data successfully blobKey = new BlobKey(sha1Digest.digest()); md5DigestResult = md5Digest.digest(); } }
java
public void finish() throws IOException, SymmetricKeyException { if (outStream != null) { if (encryptor != null) outStream.write(encryptor.encrypt(null)); // FileOutputStream is also closed cascadingly outStream.close(); outStream = null; // Only create the key if we got all the data successfully blobKey = new BlobKey(sha1Digest.digest()); md5DigestResult = md5Digest.digest(); } }
[ "public", "void", "finish", "(", ")", "throws", "IOException", ",", "SymmetricKeyException", "{", "if", "(", "outStream", "!=", "null", ")", "{", "if", "(", "encryptor", "!=", "null", ")", "outStream", ".", "write", "(", "encryptor", ".", "encrypt", "(", ...
Call this after all the data has been added.
[ "Call", "this", "after", "all", "the", "data", "has", "been", "added", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/BlobStoreWriter.java#L150-L163
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/BlobStoreWriter.java
BlobStoreWriter.cancel
public void cancel() { try { // FileOutputStream is also closed cascadingly if (outStream != null) { outStream.close(); outStream = null; } // Clear encryptor: encryptor = null; } catch (IOException e) { Log.w(Log.TAG_BLOB_STORE, "Exception closing buffered output stream", e); } tempFile.delete(); }
java
public void cancel() { try { // FileOutputStream is also closed cascadingly if (outStream != null) { outStream.close(); outStream = null; } // Clear encryptor: encryptor = null; } catch (IOException e) { Log.w(Log.TAG_BLOB_STORE, "Exception closing buffered output stream", e); } tempFile.delete(); }
[ "public", "void", "cancel", "(", ")", "{", "try", "{", "// FileOutputStream is also closed cascadingly", "if", "(", "outStream", "!=", "null", ")", "{", "outStream", ".", "close", "(", ")", ";", "outStream", "=", "null", ";", "}", "// Clear encryptor:", "encry...
Call this to cancel before finishing the data.
[ "Call", "this", "to", "cancel", "before", "finishing", "the", "data", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/BlobStoreWriter.java#L168-L181
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/BlobStoreWriter.java
BlobStoreWriter.install
public boolean install() { if (tempFile == null) return true; // already installed // Move temp file to correct location in blob store: String destPath = store.getRawPathForKey(blobKey); File destPathFile = new File(destPath); if (tempFile.renameTo(destPathFile)) // If the move fails, assume it means a file with the same name already exists; in that // case it must have the identical contents, so we're still OK. tempFile = null; else cancel(); return true; }
java
public boolean install() { if (tempFile == null) return true; // already installed // Move temp file to correct location in blob store: String destPath = store.getRawPathForKey(blobKey); File destPathFile = new File(destPath); if (tempFile.renameTo(destPathFile)) // If the move fails, assume it means a file with the same name already exists; in that // case it must have the identical contents, so we're still OK. tempFile = null; else cancel(); return true; }
[ "public", "boolean", "install", "(", ")", "{", "if", "(", "tempFile", "==", "null", ")", "return", "true", ";", "// already installed", "// Move temp file to correct location in blob store:", "String", "destPath", "=", "store", ".", "getRawPathForKey", "(", "blobKey",...
Installs a finished blob into the store.
[ "Installs", "a", "finished", "blob", "into", "the", "store", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/BlobStoreWriter.java#L186-L199
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/QueryEnumerator.java
QueryEnumerator.next
@Override @InterfaceAudience.Public public QueryRow next() { if (nextRow >= rows.size()) { return null; } return rows.get(nextRow++); }
java
@Override @InterfaceAudience.Public public QueryRow next() { if (nextRow >= rows.size()) { return null; } return rows.get(nextRow++); }
[ "@", "Override", "@", "InterfaceAudience", ".", "Public", "public", "QueryRow", "next", "(", ")", "{", "if", "(", "nextRow", ">=", "rows", ".", "size", "(", ")", ")", "{", "return", "null", ";", "}", "return", "rows", ".", "get", "(", "nextRow", "++"...
Gets the next QueryRow from the results, or null if there are no more results.
[ "Gets", "the", "next", "QueryRow", "from", "the", "results", "or", "null", "if", "there", "are", "no", "more", "results", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/QueryEnumerator.java#L76-L83
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.getProperties
Map<String, Object> getProperties() { // This is basically the inverse of -[CBLManager parseReplicatorProperties:...] Map<String, Object> props = new HashMap<String, Object>(); props.put("continuous", isContinuous()); props.put("create_target", shouldCreateTarget()); props.put("filter", getFilter()); props.put("query_params", getFilterParams()); props.put("doc_ids", getDocIds()); URL remoteURL = this.getRemoteUrl(); // TODO: authenticator is little different from iOS. need to update Map<String, Object> remote = new HashMap<String, Object>(); remote.put("url", remoteURL.toString()); remote.put("headers", getHeaders()); //remote.put("auth", authMap); if (isPull()) { props.put("source", remote); props.put("target", db.getName()); } else { props.put("source", db.getName()); props.put("target", remote); } return props; }
java
Map<String, Object> getProperties() { // This is basically the inverse of -[CBLManager parseReplicatorProperties:...] Map<String, Object> props = new HashMap<String, Object>(); props.put("continuous", isContinuous()); props.put("create_target", shouldCreateTarget()); props.put("filter", getFilter()); props.put("query_params", getFilterParams()); props.put("doc_ids", getDocIds()); URL remoteURL = this.getRemoteUrl(); // TODO: authenticator is little different from iOS. need to update Map<String, Object> remote = new HashMap<String, Object>(); remote.put("url", remoteURL.toString()); remote.put("headers", getHeaders()); //remote.put("auth", authMap); if (isPull()) { props.put("source", remote); props.put("target", db.getName()); } else { props.put("source", db.getName()); props.put("target", remote); } return props; }
[ "Map", "<", "String", ",", "Object", ">", "getProperties", "(", ")", "{", "// This is basically the inverse of -[CBLManager parseReplicatorProperties:...]", "Map", "<", "String", ",", "Object", ">", "props", "=", "new", "HashMap", "<", "String", ",", "Object", ">", ...
Currently only used for test
[ "Currently", "only", "used", "for", "test" ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L130-L154
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.start
@InterfaceAudience.Public public void start() { if (replicationInternal == null) { initReplicationInternal(); } else { if (replicationInternal.stateMachine.isInState(ReplicationState.INITIAL)) { // great, it's ready to be started, nothing to do } else if (replicationInternal.stateMachine.isInState(ReplicationState.STOPPED)) { // if there was a previous internal replication and it's in the STOPPED state, then // start a fresh internal replication initReplicationInternal(); } else { Log.w(Log.TAG_SYNC, String.format(Locale.ENGLISH, "replicationInternal in unexpected state: %s, ignoring start()", replicationInternal.stateMachine.getState())); } } // following is for restarting replicator. // make sure both lastError and ReplicationInternal.error are null. this.lastError = null; replicationInternal.setError(null); replicationInternal.triggerStart(); }
java
@InterfaceAudience.Public public void start() { if (replicationInternal == null) { initReplicationInternal(); } else { if (replicationInternal.stateMachine.isInState(ReplicationState.INITIAL)) { // great, it's ready to be started, nothing to do } else if (replicationInternal.stateMachine.isInState(ReplicationState.STOPPED)) { // if there was a previous internal replication and it's in the STOPPED state, then // start a fresh internal replication initReplicationInternal(); } else { Log.w(Log.TAG_SYNC, String.format(Locale.ENGLISH, "replicationInternal in unexpected state: %s, ignoring start()", replicationInternal.stateMachine.getState())); } } // following is for restarting replicator. // make sure both lastError and ReplicationInternal.error are null. this.lastError = null; replicationInternal.setError(null); replicationInternal.triggerStart(); }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "start", "(", ")", "{", "if", "(", "replicationInternal", "==", "null", ")", "{", "initReplicationInternal", "(", ")", ";", "}", "else", "{", "if", "(", "replicationInternal", ".", "stateMachine", "....
Starts the replication, asynchronously.
[ "Starts", "the", "replication", "asynchronously", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L201-L226
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.setContinuous
@InterfaceAudience.Public public void setContinuous(boolean isContinous) { if (isContinous) { this.lifecycle = Lifecycle.CONTINUOUS; replicationInternal.setLifecycle(Lifecycle.CONTINUOUS); } else { this.lifecycle = Lifecycle.ONESHOT; replicationInternal.setLifecycle(Lifecycle.ONESHOT); } }
java
@InterfaceAudience.Public public void setContinuous(boolean isContinous) { if (isContinous) { this.lifecycle = Lifecycle.CONTINUOUS; replicationInternal.setLifecycle(Lifecycle.CONTINUOUS); } else { this.lifecycle = Lifecycle.ONESHOT; replicationInternal.setLifecycle(Lifecycle.ONESHOT); } }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setContinuous", "(", "boolean", "isContinous", ")", "{", "if", "(", "isContinous", ")", "{", "this", ".", "lifecycle", "=", "Lifecycle", ".", "CONTINUOUS", ";", "replicationInternal", ".", "setLifecycle...
Set whether this replication is continous
[ "Set", "whether", "this", "replication", "is", "continous" ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L319-L328
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.setAuthenticator
@InterfaceAudience.Public public void setAuthenticator(Authenticator authenticator) { properties.put(ReplicationField.AUTHENTICATOR, authenticator); replicationInternal.setAuthenticator(authenticator); }
java
@InterfaceAudience.Public public void setAuthenticator(Authenticator authenticator) { properties.put(ReplicationField.AUTHENTICATOR, authenticator); replicationInternal.setAuthenticator(authenticator); }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setAuthenticator", "(", "Authenticator", "authenticator", ")", "{", "properties", ".", "put", "(", "ReplicationField", ".", "AUTHENTICATOR", ",", "authenticator", ")", ";", "replicationInternal", ".", "setA...
Set the Authenticator used for authenticating with the Sync Gateway
[ "Set", "the", "Authenticator", "used", "for", "authenticating", "with", "the", "Sync", "Gateway" ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L333-L337
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.setCreateTarget
@InterfaceAudience.Public public void setCreateTarget(boolean createTarget) { properties.put(ReplicationField.CREATE_TARGET, createTarget); replicationInternal.setCreateTarget(createTarget); }
java
@InterfaceAudience.Public public void setCreateTarget(boolean createTarget) { properties.put(ReplicationField.CREATE_TARGET, createTarget); replicationInternal.setCreateTarget(createTarget); }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setCreateTarget", "(", "boolean", "createTarget", ")", "{", "properties", ".", "put", "(", "ReplicationField", ".", "CREATE_TARGET", ",", "createTarget", ")", ";", "replicationInternal", ".", "setCreateTarg...
Set whether the target database be created if it doesn't already exist?
[ "Set", "whether", "the", "target", "database", "be", "created", "if", "it", "doesn", "t", "already", "exist?" ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L358-L362
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.changed
@Override public void changed(ChangeEvent event) { // forget cached IDs (Should be executed in workExecutor) final long lastSeqPushed = (isPull() || replicationInternal.lastSequence == null) ? -1L : Long.valueOf(replicationInternal.lastSequence); if (lastSeqPushed >= 0 && lastSeqPushed != _lastSequencePushed) { db.runAsync(new AsyncTask() { @Override public void run(Database database) { synchronized (_lockPendingDocIDs) { _lastSequencePushed = lastSeqPushed; _pendingDocIDs = null; } } }); } for (ChangeListener changeListener : changeListeners) { try { changeListener.changed(event); } catch (Exception e) { Log.e(Log.TAG_SYNC, "Exception calling changeListener.changed", e); } } }
java
@Override public void changed(ChangeEvent event) { // forget cached IDs (Should be executed in workExecutor) final long lastSeqPushed = (isPull() || replicationInternal.lastSequence == null) ? -1L : Long.valueOf(replicationInternal.lastSequence); if (lastSeqPushed >= 0 && lastSeqPushed != _lastSequencePushed) { db.runAsync(new AsyncTask() { @Override public void run(Database database) { synchronized (_lockPendingDocIDs) { _lastSequencePushed = lastSeqPushed; _pendingDocIDs = null; } } }); } for (ChangeListener changeListener : changeListeners) { try { changeListener.changed(event); } catch (Exception e) { Log.e(Log.TAG_SYNC, "Exception calling changeListener.changed", e); } } }
[ "@", "Override", "public", "void", "changed", "(", "ChangeEvent", "event", ")", "{", "// forget cached IDs (Should be executed in workExecutor)", "final", "long", "lastSeqPushed", "=", "(", "isPull", "(", ")", "||", "replicationInternal", ".", "lastSequence", "==", "n...
This is called back for changes from the ReplicationInternal. Simply propagate the events back to all listeners.
[ "This", "is", "called", "back", "for", "changes", "from", "the", "ReplicationInternal", ".", "Simply", "propagate", "the", "events", "back", "to", "all", "listeners", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L418-L442
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.setFilter
@InterfaceAudience.Public public void setFilter(String filterName) { properties.put(ReplicationField.FILTER_NAME, filterName); replicationInternal.setFilter(filterName); }
java
@InterfaceAudience.Public public void setFilter(String filterName) { properties.put(ReplicationField.FILTER_NAME, filterName); replicationInternal.setFilter(filterName); }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setFilter", "(", "String", "filterName", ")", "{", "properties", ".", "put", "(", "ReplicationField", ".", "FILTER_NAME", ",", "filterName", ")", ";", "replicationInternal", ".", "setFilter", "(", "filt...
Set the filter to be used by this replication
[ "Set", "the", "filter", "to", "be", "used", "by", "this", "replication" ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L723-L727
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.setDocIds
@InterfaceAudience.Public public void setDocIds(List<String> docIds) { properties.put(ReplicationField.DOC_IDS, docIds); replicationInternal.setDocIds(docIds); }
java
@InterfaceAudience.Public public void setDocIds(List<String> docIds) { properties.put(ReplicationField.DOC_IDS, docIds); replicationInternal.setDocIds(docIds); }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setDocIds", "(", "List", "<", "String", ">", "docIds", ")", "{", "properties", ".", "put", "(", "ReplicationField", ".", "DOC_IDS", ",", "docIds", ")", ";", "replicationInternal", ".", "setDocIds", ...
Sets the documents to specify as part of the replication.
[ "Sets", "the", "documents", "to", "specify", "as", "part", "of", "the", "replication", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L732-L736
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.setFilterParams
public void setFilterParams(Map<String, Object> filterParams) { properties.put(ReplicationField.FILTER_PARAMS, filterParams); replicationInternal.setFilterParams(filterParams); }
java
public void setFilterParams(Map<String, Object> filterParams) { properties.put(ReplicationField.FILTER_PARAMS, filterParams); replicationInternal.setFilterParams(filterParams); }
[ "public", "void", "setFilterParams", "(", "Map", "<", "String", ",", "Object", ">", "filterParams", ")", "{", "properties", ".", "put", "(", "ReplicationField", ".", "FILTER_PARAMS", ",", "filterParams", ")", ";", "replicationInternal", ".", "setFilterParams", "...
Set parameters to pass to the filter function.
[ "Set", "parameters", "to", "pass", "to", "the", "filter", "function", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L748-L751
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/Replication.java
Replication.setChannels
@InterfaceAudience.Public public void setChannels(List<String> channels) { properties.put(ReplicationField.CHANNELS, channels); replicationInternal.setChannels(channels); }
java
@InterfaceAudience.Public public void setChannels(List<String> channels) { properties.put(ReplicationField.CHANNELS, channels); replicationInternal.setChannels(channels); }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setChannels", "(", "List", "<", "String", ">", "channels", ")", "{", "properties", ".", "put", "(", "ReplicationField", ".", "CHANNELS", ",", "channels", ")", ";", "replicationInternal", ".", "setChan...
Set the list of Sync Gateway channel names
[ "Set", "the", "list", "of", "Sync", "Gateway", "channel", "names" ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L871-L875
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/security/SymmetricKey.java
SymmetricKey.initWithKey
private void initWithKey(byte[] key) throws SymmetricKeyException { if (key == null) throw new SymmetricKeyException("Key cannot be null"); if (key.length != KEY_SIZE) throw new SymmetricKeyException("Key size is not " + KEY_SIZE + "bytes"); keyData = key; }
java
private void initWithKey(byte[] key) throws SymmetricKeyException { if (key == null) throw new SymmetricKeyException("Key cannot be null"); if (key.length != KEY_SIZE) throw new SymmetricKeyException("Key size is not " + KEY_SIZE + "bytes"); keyData = key; }
[ "private", "void", "initWithKey", "(", "byte", "[", "]", "key", ")", "throws", "SymmetricKeyException", "{", "if", "(", "key", "==", "null", ")", "throw", "new", "SymmetricKeyException", "(", "\"Key cannot be null\"", ")", ";", "if", "(", "key", ".", "length...
Initialize the object with a raw key of 32 bytes size. @param key 32 bytes raw key @throws SymmetricKeyException
[ "Initialize", "the", "object", "with", "a", "raw", "key", "of", "32", "bytes", "size", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/security/SymmetricKey.java#L74-L80
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/security/SymmetricKey.java
SymmetricKey.encryptData
public byte[] encryptData(byte[] data) throws SymmetricKeyException { Encryptor encryptor = createEncryptor(); byte[] encrypted = encryptor.encrypt(data); byte[] trailer = encryptor.encrypt(null); if (encrypted == null || trailer == null) throw new SymmetricKeyException("Cannot encrypt data"); byte[] result = ArrayUtils.concat(encrypted, trailer); return result; }
java
public byte[] encryptData(byte[] data) throws SymmetricKeyException { Encryptor encryptor = createEncryptor(); byte[] encrypted = encryptor.encrypt(data); byte[] trailer = encryptor.encrypt(null); if (encrypted == null || trailer == null) throw new SymmetricKeyException("Cannot encrypt data"); byte[] result = ArrayUtils.concat(encrypted, trailer); return result; }
[ "public", "byte", "[", "]", "encryptData", "(", "byte", "[", "]", "data", ")", "throws", "SymmetricKeyException", "{", "Encryptor", "encryptor", "=", "createEncryptor", "(", ")", ";", "byte", "[", "]", "encrypted", "=", "encryptor", ".", "encrypt", "(", "d...
Encrypt the byte array data @param data Input data @return Encrypted data @throws SymmetricKeyException
[ "Encrypt", "the", "byte", "array", "data" ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/security/SymmetricKey.java#L114-L122
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/security/SymmetricKey.java
SymmetricKey.generateKey
private static byte[] generateKey(int size) throws SymmetricKeyException { if (size <= 0) throw new IllegalArgumentException("Size cannot be zero or less than zero."); try { SecureRandom secureRandom = new SecureRandom(); KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); keyGenerator.init(size * 8, secureRandom); return keyGenerator.generateKey().getEncoded(); } catch (NoSuchAlgorithmException e) { throw new SymmetricKeyException(e); } }
java
private static byte[] generateKey(int size) throws SymmetricKeyException { if (size <= 0) throw new IllegalArgumentException("Size cannot be zero or less than zero."); try { SecureRandom secureRandom = new SecureRandom(); KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); keyGenerator.init(size * 8, secureRandom); return keyGenerator.generateKey().getEncoded(); } catch (NoSuchAlgorithmException e) { throw new SymmetricKeyException(e); } }
[ "private", "static", "byte", "[", "]", "generateKey", "(", "int", "size", ")", "throws", "SymmetricKeyException", "{", "if", "(", "size", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Size cannot be zero or less than zero.\"", ")", ";", "try"...
Generate an AES key of the specifies size in bytes. @param size Size in bytes @return An AES key @throws SymmetricKeyException
[ "Generate", "an", "AES", "key", "of", "the", "specifies", "size", "in", "bytes", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/security/SymmetricKey.java#L168-L180
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/security/SymmetricKey.java
SymmetricKey.secureRandom
private static byte[] secureRandom(int size) { if (size <= 0) throw new IllegalArgumentException("Size cannot be zero or less than zero."); SecureRandom secureRandom = new SecureRandom(); byte[] bytes = new byte[size]; secureRandom.nextBytes(bytes); return bytes; }
java
private static byte[] secureRandom(int size) { if (size <= 0) throw new IllegalArgumentException("Size cannot be zero or less than zero."); SecureRandom secureRandom = new SecureRandom(); byte[] bytes = new byte[size]; secureRandom.nextBytes(bytes); return bytes; }
[ "private", "static", "byte", "[", "]", "secureRandom", "(", "int", "size", ")", "{", "if", "(", "size", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Size cannot be zero or less than zero.\"", ")", ";", "SecureRandom", "secureRandom", "=", ...
Secure random bytes of size in bytes @param size Size in bytes @return Random bytes
[ "Secure", "random", "bytes", "of", "size", "in", "bytes" ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/security/SymmetricKey.java#L187-L195
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/security/SymmetricKey.java
SymmetricKey.getCipher
private Cipher getCipher(int mode, byte[] iv) throws SymmetricKeyException { Cipher cipher = null; try { cipher = getCipherInstance("AES/CBC/PKCS7Padding"); if (cipher == null) { throw new SymmetricKeyException("Cannot get a cipher instance for AES/CBC/PKCS7Padding algorithm"); } SecretKey secret = new SecretKeySpec(getKey(), "AES"); cipher.init(mode, secret, new IvParameterSpec(iv)); } catch (InvalidKeyException e) { throw new SymmetricKeyException("Couchbase Lite uses the AES 256-bit key to provide data encryption. " + "Please make sure you have installed 'Java Cryptography Extension (JCE) " + "Unlimited Strength Jurisdiction' Policy provided by Oracle.", e); } catch (SymmetricKeyException e) { throw e; } catch (Exception e) { throw new SymmetricKeyException(e); } return cipher; }
java
private Cipher getCipher(int mode, byte[] iv) throws SymmetricKeyException { Cipher cipher = null; try { cipher = getCipherInstance("AES/CBC/PKCS7Padding"); if (cipher == null) { throw new SymmetricKeyException("Cannot get a cipher instance for AES/CBC/PKCS7Padding algorithm"); } SecretKey secret = new SecretKeySpec(getKey(), "AES"); cipher.init(mode, secret, new IvParameterSpec(iv)); } catch (InvalidKeyException e) { throw new SymmetricKeyException("Couchbase Lite uses the AES 256-bit key to provide data encryption. " + "Please make sure you have installed 'Java Cryptography Extension (JCE) " + "Unlimited Strength Jurisdiction' Policy provided by Oracle.", e); } catch (SymmetricKeyException e) { throw e; } catch (Exception e) { throw new SymmetricKeyException(e); } return cipher; }
[ "private", "Cipher", "getCipher", "(", "int", "mode", ",", "byte", "[", "]", "iv", ")", "throws", "SymmetricKeyException", "{", "Cipher", "cipher", "=", "null", ";", "try", "{", "cipher", "=", "getCipherInstance", "(", "\"AES/CBC/PKCS7Padding\"", ")", ";", "...
Get a cipher instance for either encrypt or decrypt mode with an IV header. @param mode Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE @param iv IV header @return A cipher object @throws SymmetricKeyException
[ "Get", "a", "cipher", "instance", "for", "either", "encrypt", "or", "decrypt", "mode", "with", "an", "IV", "header", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/security/SymmetricKey.java#L204-L223
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/security/SymmetricKey.java
SymmetricKey.getCipherInstance
private Cipher getCipherInstance(String algorithm) { Cipher cipher = null; if (!useBCProvider) { try { cipher = Cipher.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { Log.v(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher (no algorithm); will try with Bouncy Castle provider."); } catch (NoSuchPaddingException e) { Log.v(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher (no padding); will try with Bouncy Castle provider."); } } if (cipher == null) { // Register and use BouncyCastle provider if applicable: try { if (Security.getProvider("BC") == null) { try { Class bc = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Security.addProvider((Provider)bc.newInstance()); } catch (Exception e) { Log.e(Log.TAG_SYMMETRIC_KEY, "Cannot instantiate Bouncy Castle provider", e); return null; } } cipher = Cipher.getInstance(algorithm, "BC"); useBCProvider = true; } catch (Exception e) { Log.e(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher with Bouncy Castle provider", e); } } return cipher; }
java
private Cipher getCipherInstance(String algorithm) { Cipher cipher = null; if (!useBCProvider) { try { cipher = Cipher.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { Log.v(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher (no algorithm); will try with Bouncy Castle provider."); } catch (NoSuchPaddingException e) { Log.v(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher (no padding); will try with Bouncy Castle provider."); } } if (cipher == null) { // Register and use BouncyCastle provider if applicable: try { if (Security.getProvider("BC") == null) { try { Class bc = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Security.addProvider((Provider)bc.newInstance()); } catch (Exception e) { Log.e(Log.TAG_SYMMETRIC_KEY, "Cannot instantiate Bouncy Castle provider", e); return null; } } cipher = Cipher.getInstance(algorithm, "BC"); useBCProvider = true; } catch (Exception e) { Log.e(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher with Bouncy Castle provider", e); } } return cipher; }
[ "private", "Cipher", "getCipherInstance", "(", "String", "algorithm", ")", "{", "Cipher", "cipher", "=", "null", ";", "if", "(", "!", "useBCProvider", ")", "{", "try", "{", "cipher", "=", "Cipher", ".", "getInstance", "(", "algorithm", ")", ";", "}", "ca...
Get a cipher instance for the algorithm. It will try to use the Cipher from the default security provider by the platform. If it couldn't find the cipher, it will try to the cipher from the Bouncy Castle if the BouncyCastle library is available. @param algorithm Algorithm @return A cipher object
[ "Get", "a", "cipher", "instance", "for", "the", "algorithm", ".", "It", "will", "try", "to", "use", "the", "Cipher", "from", "the", "default", "security", "provider", "by", "the", "platform", ".", "If", "it", "couldn", "t", "find", "the", "cipher", "it",...
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/security/SymmetricKey.java#L232-L264
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/SequenceMap.java
SequenceMap.addValue
public synchronized long addValue(String value) { sequences.add(++lastSequence); values.add(value); return lastSequence; }
java
public synchronized long addValue(String value) { sequences.add(++lastSequence); values.add(value); return lastSequence; }
[ "public", "synchronized", "long", "addValue", "(", "String", "value", ")", "{", "sequences", ".", "add", "(", "++", "lastSequence", ")", ";", "values", ".", "add", "(", "value", ")", ";", "return", "lastSequence", ";", "}" ]
Adds a value to the map, assigning it a sequence number and returning it. Sequence numbers start at 1 and increment from there.
[ "Adds", "a", "value", "to", "the", "map", "assigning", "it", "a", "sequence", "number", "and", "returning", "it", ".", "Sequence", "numbers", "start", "at", "1", "and", "increment", "from", "there", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/SequenceMap.java#L42-L46
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/SequenceMap.java
SequenceMap.getCheckpointedSequence
public synchronized long getCheckpointedSequence() { long sequence = lastSequence; if(!sequences.isEmpty()) { sequence = sequences.first() - 1; } if(sequence > firstValueSequence) { // Garbage-collect inaccessible values: int numToRemove = (int)(sequence - firstValueSequence); for(int i = 0; i < numToRemove; i++) { values.remove(0); } firstValueSequence += numToRemove; } return sequence; }
java
public synchronized long getCheckpointedSequence() { long sequence = lastSequence; if(!sequences.isEmpty()) { sequence = sequences.first() - 1; } if(sequence > firstValueSequence) { // Garbage-collect inaccessible values: int numToRemove = (int)(sequence - firstValueSequence); for(int i = 0; i < numToRemove; i++) { values.remove(0); } firstValueSequence += numToRemove; } return sequence; }
[ "public", "synchronized", "long", "getCheckpointedSequence", "(", ")", "{", "long", "sequence", "=", "lastSequence", ";", "if", "(", "!", "sequences", ".", "isEmpty", "(", ")", ")", "{", "sequence", "=", "sequences", ".", "first", "(", ")", "-", "1", ";"...
Returns the maximum consecutively-removed sequence number. This is one less than the minimum remaining sequence number.
[ "Returns", "the", "maximum", "consecutively", "-", "removed", "sequence", "number", ".", "This", "is", "one", "less", "than", "the", "minimum", "remaining", "sequence", "number", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/SequenceMap.java#L67-L83
train
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/SequenceMap.java
SequenceMap.getCheckpointedValue
public synchronized String getCheckpointedValue() { int index = (int)(getCheckpointedSequence() - firstValueSequence); return (index >= 0) ? values.get(index) : null; }
java
public synchronized String getCheckpointedValue() { int index = (int)(getCheckpointedSequence() - firstValueSequence); return (index >= 0) ? values.get(index) : null; }
[ "public", "synchronized", "String", "getCheckpointedValue", "(", ")", "{", "int", "index", "=", "(", "int", ")", "(", "getCheckpointedSequence", "(", ")", "-", "firstValueSequence", ")", ";", "return", "(", "index", ">=", "0", ")", "?", "values", ".", "get...
Returns the value associated with the checkpointedSequence.
[ "Returns", "the", "value", "associated", "with", "the", "checkpointedSequence", "." ]
3b275642e2d2f231fd155ad9def9c5e9eff3118e
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/SequenceMap.java#L88-L91
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/Common.java
Common.serialize
public static void serialize(Serializable obj, ByteArrayOutputStream bout) { try { ObjectOutputStream out = new ObjectOutputStream(bout); out.writeObject(obj); out.close(); } catch (IOException e) { throw new IllegalStateException("Could not serialize " + obj, e); } }
java
public static void serialize(Serializable obj, ByteArrayOutputStream bout) { try { ObjectOutputStream out = new ObjectOutputStream(bout); out.writeObject(obj); out.close(); } catch (IOException e) { throw new IllegalStateException("Could not serialize " + obj, e); } }
[ "public", "static", "void", "serialize", "(", "Serializable", "obj", ",", "ByteArrayOutputStream", "bout", ")", "{", "try", "{", "ObjectOutputStream", "out", "=", "new", "ObjectOutputStream", "(", "bout", ")", ";", "out", ".", "writeObject", "(", "obj", ")", ...
Serialize the given object into the given stream
[ "Serialize", "the", "given", "object", "into", "the", "given", "stream" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/Common.java#L45-L53
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/Common.java
Common.readToList
public static List<String> readToList(File f) throws IOException { try (final Reader reader = asReaderUTF8Lenient(new FileInputStream(f))) { return readToList(reader); } catch (IOException ioe) { throw new IllegalStateException(String.format("Failed to read %s: %s", f.getAbsolutePath(), ioe), ioe); } }
java
public static List<String> readToList(File f) throws IOException { try (final Reader reader = asReaderUTF8Lenient(new FileInputStream(f))) { return readToList(reader); } catch (IOException ioe) { throw new IllegalStateException(String.format("Failed to read %s: %s", f.getAbsolutePath(), ioe), ioe); } }
[ "public", "static", "List", "<", "String", ">", "readToList", "(", "File", "f", ")", "throws", "IOException", "{", "try", "(", "final", "Reader", "reader", "=", "asReaderUTF8Lenient", "(", "new", "FileInputStream", "(", "f", ")", ")", ")", "{", "return", ...
Read the file line for line and return the result in a list @throws IOException upon failure in reading, note that we wrap the underlying IOException with the file name
[ "Read", "the", "file", "line", "for", "line", "and", "return", "the", "result", "in", "a", "list" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/Common.java#L59-L65
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/Common.java
Common.readToList
public static List<String> readToList(Reader r) throws IOException { try ( BufferedReader in = new BufferedReader(r) ) { List<String> l = new ArrayList<>(); String line = null; while ((line = in.readLine()) != null) l.add(line); return Collections.unmodifiableList(l); } }
java
public static List<String> readToList(Reader r) throws IOException { try ( BufferedReader in = new BufferedReader(r) ) { List<String> l = new ArrayList<>(); String line = null; while ((line = in.readLine()) != null) l.add(line); return Collections.unmodifiableList(l); } }
[ "public", "static", "List", "<", "String", ">", "readToList", "(", "Reader", "r", ")", "throws", "IOException", "{", "try", "(", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "r", ")", ")", "{", "List", "<", "String", ">", "l", "=", "new",...
Read the Reader line for line and return the result in a list
[ "Read", "the", "Reader", "line", "for", "line", "and", "return", "the", "result", "in", "a", "list" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/Common.java#L67-L75
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/Common.java
Common.readFileToString
public static String readFileToString(File f) throws IOException { StringWriter sw = new StringWriter(); IO.copyAndCloseBoth(Common.asReaderUTF8Lenient(new FileInputStream(f)), sw); return sw.toString(); }
java
public static String readFileToString(File f) throws IOException { StringWriter sw = new StringWriter(); IO.copyAndCloseBoth(Common.asReaderUTF8Lenient(new FileInputStream(f)), sw); return sw.toString(); }
[ "public", "static", "String", "readFileToString", "(", "File", "f", ")", "throws", "IOException", "{", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "IO", ".", "copyAndCloseBoth", "(", "Common", ".", "asReaderUTF8Lenient", "(", "new", "FileI...
Read the contents of the given file into a string
[ "Read", "the", "contents", "of", "the", "given", "file", "into", "a", "string" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/Common.java#L83-L87
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/ProfilingTimer.java
ProfilingTimer.appendToLog
public void appendToLog(String logAppendMessage) { ProfilingTimerNode currentNode = current.get(); if (currentNode != null) { currentNode.appendToLog(logAppendMessage); } }
java
public void appendToLog(String logAppendMessage) { ProfilingTimerNode currentNode = current.get(); if (currentNode != null) { currentNode.appendToLog(logAppendMessage); } }
[ "public", "void", "appendToLog", "(", "String", "logAppendMessage", ")", "{", "ProfilingTimerNode", "currentNode", "=", "current", ".", "get", "(", ")", ";", "if", "(", "currentNode", "!=", "null", ")", "{", "currentNode", ".", "appendToLog", "(", "logAppendMe...
Append the given string to the log message of the current subtask
[ "Append", "the", "given", "string", "to", "the", "log", "message", "of", "the", "current", "subtask" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/ProfilingTimer.java#L235-L240
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/ProfilingTimer.java
ProfilingTimer.mergeTree
public void mergeTree(ProfilingTimerNode otherRoot) { ProfilingTimerNode currentNode = current.get(); Preconditions.checkNotNull(currentNode); mergeOrAddNode(currentNode, otherRoot); }
java
public void mergeTree(ProfilingTimerNode otherRoot) { ProfilingTimerNode currentNode = current.get(); Preconditions.checkNotNull(currentNode); mergeOrAddNode(currentNode, otherRoot); }
[ "public", "void", "mergeTree", "(", "ProfilingTimerNode", "otherRoot", ")", "{", "ProfilingTimerNode", "currentNode", "=", "current", ".", "get", "(", ")", ";", "Preconditions", ".", "checkNotNull", "(", "currentNode", ")", ";", "mergeOrAddNode", "(", "currentNode...
Merges the specified tree as a child under the current node.
[ "Merges", "the", "specified", "tree", "as", "a", "child", "under", "the", "current", "node", "." ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/ProfilingTimer.java#L302-L306
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/ProfilingTimer.java
ProfilingTimer.writeToLog
private static void writeToLog(int level, long totalNanos, long count, ProfilingTimerNode parent, String taskName, Log log, String logAppendMessage) { if (log == null) { return; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < level; i++) { sb.append('\t'); } String durationText = String.format("%s%s", formatElapsed(totalNanos), count == 1 ? "" : String.format(" across %d invocations, average: %s", count, formatElapsed(totalNanos / count))); String text = parent == null ? String.format("total time %s", durationText) : String.format("[%s] took %s", taskName, durationText); sb.append(text); sb.append(logAppendMessage); log.info(sb.toString()); }
java
private static void writeToLog(int level, long totalNanos, long count, ProfilingTimerNode parent, String taskName, Log log, String logAppendMessage) { if (log == null) { return; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < level; i++) { sb.append('\t'); } String durationText = String.format("%s%s", formatElapsed(totalNanos), count == 1 ? "" : String.format(" across %d invocations, average: %s", count, formatElapsed(totalNanos / count))); String text = parent == null ? String.format("total time %s", durationText) : String.format("[%s] took %s", taskName, durationText); sb.append(text); sb.append(logAppendMessage); log.info(sb.toString()); }
[ "private", "static", "void", "writeToLog", "(", "int", "level", ",", "long", "totalNanos", ",", "long", "count", ",", "ProfilingTimerNode", "parent", ",", "String", "taskName", ",", "Log", "log", ",", "String", "logAppendMessage", ")", "{", "if", "(", "log",...
Writes one profiling line of information to the log
[ "Writes", "one", "profiling", "line", "of", "information", "to", "the", "log" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/ProfilingTimer.java#L336-L356
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/ThriftUtils.java
ThriftUtils.serializeJson
public static <T extends TBase> String serializeJson(T obj) throws TException { // Tried having a static final serializer, but it doesn't seem to be thread safe return new TSerializer(new TJSONProtocol.Factory()).toString(obj, THRIFT_CHARSET); }
java
public static <T extends TBase> String serializeJson(T obj) throws TException { // Tried having a static final serializer, but it doesn't seem to be thread safe return new TSerializer(new TJSONProtocol.Factory()).toString(obj, THRIFT_CHARSET); }
[ "public", "static", "<", "T", "extends", "TBase", ">", "String", "serializeJson", "(", "T", "obj", ")", "throws", "TException", "{", "// Tried having a static final serializer, but it doesn't seem to be thread safe", "return", "new", "TSerializer", "(", "new", "TJSONProto...
Serialize a JSON-encoded thrift object
[ "Serialize", "a", "JSON", "-", "encoded", "thrift", "object" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/ThriftUtils.java#L14-L17
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/ThriftUtils.java
ThriftUtils.deserializeJson
public static <T extends TBase> T deserializeJson(T dest, String thriftJson) throws TException { // Tried having a static final deserializer, but it doesn't seem to be thread safe new TDeserializer(new TJSONProtocol.Factory()).deserialize(dest, thriftJson, THRIFT_CHARSET); return dest; }
java
public static <T extends TBase> T deserializeJson(T dest, String thriftJson) throws TException { // Tried having a static final deserializer, but it doesn't seem to be thread safe new TDeserializer(new TJSONProtocol.Factory()).deserialize(dest, thriftJson, THRIFT_CHARSET); return dest; }
[ "public", "static", "<", "T", "extends", "TBase", ">", "T", "deserializeJson", "(", "T", "dest", ",", "String", "thriftJson", ")", "throws", "TException", "{", "// Tried having a static final deserializer, but it doesn't seem to be thread safe", "new", "TDeserializer", "(...
Deserialize a JSON-encoded thrift object
[ "Deserialize", "a", "JSON", "-", "encoded", "thrift", "object" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/ThriftUtils.java#L20-L24
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/Strings.java
Strings.sepList
public static String sepList(String sep, Iterable<?> os, int max) { return sepList(sep, null, os, max); }
java
public static String sepList(String sep, Iterable<?> os, int max) { return sepList(sep, null, os, max); }
[ "public", "static", "String", "sepList", "(", "String", "sep", ",", "Iterable", "<", "?", ">", "os", ",", "int", "max", ")", "{", "return", "sepList", "(", "sep", ",", "null", ",", "os", ",", "max", ")", ";", "}" ]
Same as sepList with no wrapping
[ "Same", "as", "sepList", "with", "no", "wrapping" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/Strings.java#L38-L40
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/Word2VecTrainer.java
Word2VecTrainer.train
Word2VecModel train(Log log, TrainingProgressListener listener, Iterable<List<String>> sentences) throws InterruptedException { try (ProfilingTimer timer = ProfilingTimer.createLoggingSubtasks(log, "Training word2vec")) { final Multiset<String> counts; try (AC ac = timer.start("Acquiring word frequencies")) { listener.update(Stage.ACQUIRE_VOCAB, 0.0); counts = (vocab.isPresent()) ? vocab.get() : count(Iterables.concat(sentences)); } final ImmutableMultiset<String> vocab; try (AC ac = timer.start("Filtering and sorting vocabulary")) { listener.update(Stage.FILTER_SORT_VOCAB, 0.0); vocab = filterAndSort(counts); } final Map<String, HuffmanNode> huffmanNodes; try (AC task = timer.start("Create Huffman encoding")) { huffmanNodes = new HuffmanCoding(vocab, listener).encode(); } final NeuralNetworkModel model; try (AC task = timer.start("Training model %s", neuralNetworkConfig)) { model = neuralNetworkConfig.createTrainer(vocab, huffmanNodes, listener).train(sentences); } return new Word2VecModel(vocab.elementSet(), model.layerSize(), Doubles.concat(model.vectors())); } }
java
Word2VecModel train(Log log, TrainingProgressListener listener, Iterable<List<String>> sentences) throws InterruptedException { try (ProfilingTimer timer = ProfilingTimer.createLoggingSubtasks(log, "Training word2vec")) { final Multiset<String> counts; try (AC ac = timer.start("Acquiring word frequencies")) { listener.update(Stage.ACQUIRE_VOCAB, 0.0); counts = (vocab.isPresent()) ? vocab.get() : count(Iterables.concat(sentences)); } final ImmutableMultiset<String> vocab; try (AC ac = timer.start("Filtering and sorting vocabulary")) { listener.update(Stage.FILTER_SORT_VOCAB, 0.0); vocab = filterAndSort(counts); } final Map<String, HuffmanNode> huffmanNodes; try (AC task = timer.start("Create Huffman encoding")) { huffmanNodes = new HuffmanCoding(vocab, listener).encode(); } final NeuralNetworkModel model; try (AC task = timer.start("Training model %s", neuralNetworkConfig)) { model = neuralNetworkConfig.createTrainer(vocab, huffmanNodes, listener).train(sentences); } return new Word2VecModel(vocab.elementSet(), model.layerSize(), Doubles.concat(model.vectors())); } }
[ "Word2VecModel", "train", "(", "Log", "log", ",", "TrainingProgressListener", "listener", ",", "Iterable", "<", "List", "<", "String", ">", ">", "sentences", ")", "throws", "InterruptedException", "{", "try", "(", "ProfilingTimer", "timer", "=", "ProfilingTimer", ...
Train a model using the given data
[ "Train", "a", "model", "using", "the", "given", "data" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/Word2VecTrainer.java#L69-L98
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/NormalizedWord2VecModel.java
NormalizedWord2VecModel.normalize
private void normalize() { for(int i = 0; i < vocab.size(); ++i) { double len = 0; for(int j = i * layerSize; j < (i + 1) * layerSize; ++j) len += vectors.get(j) * vectors.get(j); len = Math.sqrt(len); for(int j = i * layerSize; j < (i + 1) * layerSize; ++j) vectors.put(j, vectors.get(j) / len); } }
java
private void normalize() { for(int i = 0; i < vocab.size(); ++i) { double len = 0; for(int j = i * layerSize; j < (i + 1) * layerSize; ++j) len += vectors.get(j) * vectors.get(j); len = Math.sqrt(len); for(int j = i * layerSize; j < (i + 1) * layerSize; ++j) vectors.put(j, vectors.get(j) / len); } }
[ "private", "void", "normalize", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "vocab", ".", "size", "(", ")", ";", "++", "i", ")", "{", "double", "len", "=", "0", ";", "for", "(", "int", "j", "=", "i", "*", "layerSize", ";...
Normalizes the vectors in this model
[ "Normalizes", "the", "vectors", "in", "this", "model" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/NormalizedWord2VecModel.java#L38-L48
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/UnicodeReader.java
UnicodeReader.init
protected void init() throws IOException { if (internalIn2 != null) return; String encoding; byte bom[] = new byte[BOM_SIZE]; int n, unread; n = internalIn.read(bom, 0, bom.length); if ( (bom[0] == (byte)0x00) && (bom[1] == (byte)0x00) && (bom[2] == (byte)0xFE) && (bom[3] == (byte)0xFF) ) { encoding = "UTF-32BE"; unread = n - 4; } else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) && (bom[2] == (byte)0x00) && (bom[3] == (byte)0x00) ) { encoding = "UTF-32LE"; unread = n - 4; } else if ( (bom[0] == (byte)0xEF) && (bom[1] == (byte)0xBB) && (bom[2] == (byte)0xBF) ) { encoding = "UTF-8"; unread = n - 3; } else if ( (bom[0] == (byte)0xFE) && (bom[1] == (byte)0xFF) ) { encoding = "UTF-16BE"; unread = n - 2; } else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) ) { encoding = "UTF-16LE"; unread = n - 2; } else { // Unicode BOM not found, unread all bytes encoding = defaultEnc; unread = n; } if (unread > 0) internalIn.unread(bom, (n - unread), unread); // Use given encoding if (encoding == null) { internalIn2 = new InputStreamReader(internalIn); } else if (strict) { internalIn2 = new InputStreamReader(internalIn, Charset.forName(encoding).newDecoder()); } else { internalIn2 = new InputStreamReader(internalIn, encoding); } }
java
protected void init() throws IOException { if (internalIn2 != null) return; String encoding; byte bom[] = new byte[BOM_SIZE]; int n, unread; n = internalIn.read(bom, 0, bom.length); if ( (bom[0] == (byte)0x00) && (bom[1] == (byte)0x00) && (bom[2] == (byte)0xFE) && (bom[3] == (byte)0xFF) ) { encoding = "UTF-32BE"; unread = n - 4; } else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) && (bom[2] == (byte)0x00) && (bom[3] == (byte)0x00) ) { encoding = "UTF-32LE"; unread = n - 4; } else if ( (bom[0] == (byte)0xEF) && (bom[1] == (byte)0xBB) && (bom[2] == (byte)0xBF) ) { encoding = "UTF-8"; unread = n - 3; } else if ( (bom[0] == (byte)0xFE) && (bom[1] == (byte)0xFF) ) { encoding = "UTF-16BE"; unread = n - 2; } else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) ) { encoding = "UTF-16LE"; unread = n - 2; } else { // Unicode BOM not found, unread all bytes encoding = defaultEnc; unread = n; } if (unread > 0) internalIn.unread(bom, (n - unread), unread); // Use given encoding if (encoding == null) { internalIn2 = new InputStreamReader(internalIn); } else if (strict) { internalIn2 = new InputStreamReader(internalIn, Charset.forName(encoding).newDecoder()); } else { internalIn2 = new InputStreamReader(internalIn, encoding); } }
[ "protected", "void", "init", "(", ")", "throws", "IOException", "{", "if", "(", "internalIn2", "!=", "null", ")", "return", ";", "String", "encoding", ";", "byte", "bom", "[", "]", "=", "new", "byte", "[", "BOM_SIZE", "]", ";", "int", "n", ",", "unre...
Read-ahead four bytes and check for BOM. Extra bytes are unread back to the stream, only BOM bytes are skipped.
[ "Read", "-", "ahead", "four", "bytes", "and", "check", "for", "BOM", ".", "Extra", "bytes", "are", "unread", "back", "to", "the", "stream", "only", "BOM", "bytes", "are", "skipped", "." ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/UnicodeReader.java#L79-L121
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/FileUtils.java
FileUtils.getDir
public static File getDir(File parent, String item) { File dir = new File(parent, item); return (dir.exists() && dir.isDirectory()) ? dir : null; }
java
public static File getDir(File parent, String item) { File dir = new File(parent, item); return (dir.exists() && dir.isDirectory()) ? dir : null; }
[ "public", "static", "File", "getDir", "(", "File", "parent", ",", "String", "item", ")", "{", "File", "dir", "=", "new", "File", "(", "parent", ",", "item", ")", ";", "return", "(", "dir", ".", "exists", "(", ")", "&&", "dir", ".", "isDirectory", "...
Returns a subdirectory of a given directory; the subdirectory is expected to already exist. @param parent the directory in which to find the specified subdirectory @param item the name of the subdirectory @return the subdirectory having the specified name; null if no such directory exists or exists but is a regular file.
[ "Returns", "a", "subdirectory", "of", "a", "given", "directory", ";", "the", "subdirectory", "is", "expected", "to", "already", "exist", "." ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/FileUtils.java#L36-L39
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/FileUtils.java
FileUtils.deleteRecursive
public static boolean deleteRecursive(final File file) { boolean result = true; if (file.isDirectory()) { for (final File inner : file.listFiles()) { result &= deleteRecursive(inner); } } return result & file.delete(); }
java
public static boolean deleteRecursive(final File file) { boolean result = true; if (file.isDirectory()) { for (final File inner : file.listFiles()) { result &= deleteRecursive(inner); } } return result & file.delete(); }
[ "public", "static", "boolean", "deleteRecursive", "(", "final", "File", "file", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "for", "(", "final", "File", "inner", ":", "file", ".", "listFil...
Deletes a file or directory. If the file is a directory it recursively deletes it. @param file file to be deleted @return true if all the files where deleted successfully.
[ "Deletes", "a", "file", "or", "directory", ".", "If", "the", "file", "is", "a", "directory", "it", "recursively", "deletes", "it", "." ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/FileUtils.java#L86-L94
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/IO.java
IO.createTempFile
public static File createTempFile(byte[] fileContents, String namePrefix, String extension) throws IOException { Preconditions.checkNotNull(fileContents, "file contents missing"); File tempFile = File.createTempFile(namePrefix, extension); try (FileOutputStream fos = new FileOutputStream(tempFile)) { fos.write(fileContents); } return tempFile; }
java
public static File createTempFile(byte[] fileContents, String namePrefix, String extension) throws IOException { Preconditions.checkNotNull(fileContents, "file contents missing"); File tempFile = File.createTempFile(namePrefix, extension); try (FileOutputStream fos = new FileOutputStream(tempFile)) { fos.write(fileContents); } return tempFile; }
[ "public", "static", "File", "createTempFile", "(", "byte", "[", "]", "fileContents", ",", "String", "namePrefix", ",", "String", "extension", ")", "throws", "IOException", "{", "Preconditions", ".", "checkNotNull", "(", "fileContents", ",", "\"file contents missing\...
Stores the given contents into a temporary file @param fileContents the raw contents to store in the temporary file @param namePrefix the desired file name prefix (must be at least 3 characters long) @param extension the desired extension including the '.' character (use null for '.tmp') @return a {@link File} reference to the newly created temporary file @throws IOException if the temporary file creation fails
[ "Stores", "the", "given", "contents", "into", "a", "temporary", "file" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/IO.java#L248-L255
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/Word2VecExamples.java
Word2VecExamples.demoWord
public static void demoWord() throws IOException, TException, InterruptedException, UnknownWordException { File f = new File("text8"); if (!f.exists()) throw new IllegalStateException("Please download and unzip the text8 example from http://mattmahoney.net/dc/text8.zip"); List<String> read = Common.readToList(f); List<List<String>> partitioned = Lists.transform(read, new Function<String, List<String>>() { @Override public List<String> apply(String input) { return Arrays.asList(input.split(" ")); } }); Word2VecModel model = Word2VecModel.trainer() .setMinVocabFrequency(5) .useNumThreads(20) .setWindowSize(8) .type(NeuralNetworkType.CBOW) .setLayerSize(200) .useNegativeSamples(25) .setDownSamplingRate(1e-4) .setNumIterations(5) .setListener(new TrainingProgressListener() { @Override public void update(Stage stage, double progress) { System.out.println(String.format("%s is %.2f%% complete", Format.formatEnum(stage), progress * 100)); } }) .train(partitioned); // Writes model to a thrift file try (ProfilingTimer timer = ProfilingTimer.create(LOG, "Writing output to file")) { FileUtils.writeStringToFile(new File("text8.model"), ThriftUtils.serializeJson(model.toThrift())); } // Alternatively, you can write the model to a bin file that's compatible with the C // implementation. try(final OutputStream os = Files.newOutputStream(Paths.get("text8.bin"))) { model.toBinFile(os); } interact(model.forSearch()); }
java
public static void demoWord() throws IOException, TException, InterruptedException, UnknownWordException { File f = new File("text8"); if (!f.exists()) throw new IllegalStateException("Please download and unzip the text8 example from http://mattmahoney.net/dc/text8.zip"); List<String> read = Common.readToList(f); List<List<String>> partitioned = Lists.transform(read, new Function<String, List<String>>() { @Override public List<String> apply(String input) { return Arrays.asList(input.split(" ")); } }); Word2VecModel model = Word2VecModel.trainer() .setMinVocabFrequency(5) .useNumThreads(20) .setWindowSize(8) .type(NeuralNetworkType.CBOW) .setLayerSize(200) .useNegativeSamples(25) .setDownSamplingRate(1e-4) .setNumIterations(5) .setListener(new TrainingProgressListener() { @Override public void update(Stage stage, double progress) { System.out.println(String.format("%s is %.2f%% complete", Format.formatEnum(stage), progress * 100)); } }) .train(partitioned); // Writes model to a thrift file try (ProfilingTimer timer = ProfilingTimer.create(LOG, "Writing output to file")) { FileUtils.writeStringToFile(new File("text8.model"), ThriftUtils.serializeJson(model.toThrift())); } // Alternatively, you can write the model to a bin file that's compatible with the C // implementation. try(final OutputStream os = Files.newOutputStream(Paths.get("text8.bin"))) { model.toBinFile(os); } interact(model.forSearch()); }
[ "public", "static", "void", "demoWord", "(", ")", "throws", "IOException", ",", "TException", ",", "InterruptedException", ",", "UnknownWordException", "{", "File", "f", "=", "new", "File", "(", "\"text8\"", ")", ";", "if", "(", "!", "f", ".", "exists", "(...
Trains a model and allows user to find similar words demo-word.sh example from the open source C implementation
[ "Trains", "a", "model", "and", "allows", "user", "to", "find", "similar", "words", "demo", "-", "word", ".", "sh", "example", "from", "the", "open", "source", "C", "implementation" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/Word2VecExamples.java#L43-L83
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/Word2VecExamples.java
Word2VecExamples.loadModel
public static void loadModel() throws IOException, TException, UnknownWordException { final Word2VecModel model; try (ProfilingTimer timer = ProfilingTimer.create(LOG, "Loading model")) { String json = Common.readFileToString(new File("text8.model")); model = Word2VecModel.fromThrift(ThriftUtils.deserializeJson(new Word2VecModelThrift(), json)); } interact(model.forSearch()); }
java
public static void loadModel() throws IOException, TException, UnknownWordException { final Word2VecModel model; try (ProfilingTimer timer = ProfilingTimer.create(LOG, "Loading model")) { String json = Common.readFileToString(new File("text8.model")); model = Word2VecModel.fromThrift(ThriftUtils.deserializeJson(new Word2VecModelThrift(), json)); } interact(model.forSearch()); }
[ "public", "static", "void", "loadModel", "(", ")", "throws", "IOException", ",", "TException", ",", "UnknownWordException", "{", "final", "Word2VecModel", "model", ";", "try", "(", "ProfilingTimer", "timer", "=", "ProfilingTimer", ".", "create", "(", "LOG", ",",...
Loads a model and allows user to find similar words
[ "Loads", "a", "model", "and", "allows", "user", "to", "find", "similar", "words" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/Word2VecExamples.java#L86-L93
train
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/Word2VecExamples.java
Word2VecExamples.skipGram
public static void skipGram() throws IOException, TException, InterruptedException, UnknownWordException { List<String> read = Common.readToList(new File("sents.cleaned.word2vec.txt")); List<List<String>> partitioned = Lists.transform(read, new Function<String, List<String>>() { @Override public List<String> apply(String input) { return Arrays.asList(input.split(" ")); } }); Word2VecModel model = Word2VecModel.trainer() .setMinVocabFrequency(100) .useNumThreads(20) .setWindowSize(7) .type(NeuralNetworkType.SKIP_GRAM) .useHierarchicalSoftmax() .setLayerSize(300) .useNegativeSamples(0) .setDownSamplingRate(1e-3) .setNumIterations(5) .setListener(new TrainingProgressListener() { @Override public void update(Stage stage, double progress) { System.out.println(String.format("%s is %.2f%% complete", Format.formatEnum(stage), progress * 100)); } }) .train(partitioned); try (ProfilingTimer timer = ProfilingTimer.create(LOG, "Writing output to file")) { FileUtils.writeStringToFile(new File("300layer.20threads.5iter.model"), ThriftUtils.serializeJson(model.toThrift())); } interact(model.forSearch()); }
java
public static void skipGram() throws IOException, TException, InterruptedException, UnknownWordException { List<String> read = Common.readToList(new File("sents.cleaned.word2vec.txt")); List<List<String>> partitioned = Lists.transform(read, new Function<String, List<String>>() { @Override public List<String> apply(String input) { return Arrays.asList(input.split(" ")); } }); Word2VecModel model = Word2VecModel.trainer() .setMinVocabFrequency(100) .useNumThreads(20) .setWindowSize(7) .type(NeuralNetworkType.SKIP_GRAM) .useHierarchicalSoftmax() .setLayerSize(300) .useNegativeSamples(0) .setDownSamplingRate(1e-3) .setNumIterations(5) .setListener(new TrainingProgressListener() { @Override public void update(Stage stage, double progress) { System.out.println(String.format("%s is %.2f%% complete", Format.formatEnum(stage), progress * 100)); } }) .train(partitioned); try (ProfilingTimer timer = ProfilingTimer.create(LOG, "Writing output to file")) { FileUtils.writeStringToFile(new File("300layer.20threads.5iter.model"), ThriftUtils.serializeJson(model.toThrift())); } interact(model.forSearch()); }
[ "public", "static", "void", "skipGram", "(", ")", "throws", "IOException", ",", "TException", ",", "InterruptedException", ",", "UnknownWordException", "{", "List", "<", "String", ">", "read", "=", "Common", ".", "readToList", "(", "new", "File", "(", "\"sents...
Example using Skip-Gram model
[ "Example", "using", "Skip", "-", "Gram", "model" ]
eb31fbb99ac6bbab82d7f807b3e2240edca50eb7
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/Word2VecExamples.java#L96-L127
train
bigdata-mx/factura-electronica
src/main/java/mx/bigdata/sat/contabilidad_electronica/CuentasContablesv11.java
CuentasContablesv11.copy
private Catalogo copy(Catalogo catalogo) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); Marshaller m = context.createMarshaller(); m.marshal(catalogo, doc); Unmarshaller u = context.createUnmarshaller(); return (Catalogo) u.unmarshal(doc); }
java
private Catalogo copy(Catalogo catalogo) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); Marshaller m = context.createMarshaller(); m.marshal(catalogo, doc); Unmarshaller u = context.createUnmarshaller(); return (Catalogo) u.unmarshal(doc); }
[ "private", "Catalogo", "copy", "(", "Catalogo", "catalogo", ")", "throws", "Exception", "{", "DocumentBuilderFactory", "dbf", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "dbf", ".", "setNamespaceAware", "(", "true", ")", ";", "DocumentBuilder...
Defensive deep-copy
[ "Defensive", "deep", "-", "copy" ]
ca9b06039075bc3b06e64b080c3545c937e35003
https://github.com/bigdata-mx/factura-electronica/blob/ca9b06039075bc3b06e64b080c3545c937e35003/src/main/java/mx/bigdata/sat/contabilidad_electronica/CuentasContablesv11.java#L232-L241
train
allure-framework/allure-cucumberjvm
src/main/java/ru/yandex/qatools/allure/cucumberjvm/AllureRunListener.java
AllureRunListener.findFeatureByScenarioName
private String[] findFeatureByScenarioName(String scenarioName) throws IllegalAccessException { List<Description> testClasses = findTestClassesLevel(parentDescription.getChildren()); for (Description testClass : testClasses) { List<Description> features = findFeaturesLevel(testClass.getChildren()); //Feature cycle for (Description feature : features) { //Story cycle for (Description story : feature.getChildren()) { Object scenarioType = getTestEntityType(story); //Scenario if (scenarioType instanceof Scenario && story.getDisplayName().equals(scenarioName)) { return new String[]{feature.getDisplayName(), scenarioName}; //Scenario Outline } else if (scenarioType instanceof ScenarioOutline) { List<Description> examples = story.getChildren().get(0).getChildren(); // we need to go deeper :) for (Description example : examples) { if (example.getDisplayName().equals(scenarioName)) { return new String[]{feature.getDisplayName(), story.getDisplayName()}; } } } } } } return new String[]{"Feature: Undefined Feature", scenarioName}; }
java
private String[] findFeatureByScenarioName(String scenarioName) throws IllegalAccessException { List<Description> testClasses = findTestClassesLevel(parentDescription.getChildren()); for (Description testClass : testClasses) { List<Description> features = findFeaturesLevel(testClass.getChildren()); //Feature cycle for (Description feature : features) { //Story cycle for (Description story : feature.getChildren()) { Object scenarioType = getTestEntityType(story); //Scenario if (scenarioType instanceof Scenario && story.getDisplayName().equals(scenarioName)) { return new String[]{feature.getDisplayName(), scenarioName}; //Scenario Outline } else if (scenarioType instanceof ScenarioOutline) { List<Description> examples = story.getChildren().get(0).getChildren(); // we need to go deeper :) for (Description example : examples) { if (example.getDisplayName().equals(scenarioName)) { return new String[]{feature.getDisplayName(), story.getDisplayName()}; } } } } } } return new String[]{"Feature: Undefined Feature", scenarioName}; }
[ "private", "String", "[", "]", "findFeatureByScenarioName", "(", "String", "scenarioName", ")", "throws", "IllegalAccessException", "{", "List", "<", "Description", ">", "testClasses", "=", "findTestClassesLevel", "(", "parentDescription", ".", "getChildren", "(", ")"...
Find feature and story for given scenario @param scenarioName @return {@link String[]} of ["<FEATURE_NAME>", "<STORY_NAME>"]s @throws IllegalAccessException
[ "Find", "feature", "and", "story", "for", "given", "scenario" ]
dd17fe2ad826faabec751a85f20f0e5e494af8d6
https://github.com/allure-framework/allure-cucumberjvm/blob/dd17fe2ad826faabec751a85f20f0e5e494af8d6/src/main/java/ru/yandex/qatools/allure/cucumberjvm/AllureRunListener.java#L152-L183
train
allure-framework/allure-cucumberjvm
src/main/java/ru/yandex/qatools/allure/cucumberjvm/AllureRunListener.java
AllureRunListener.getStoriesAnnotation
Stories getStoriesAnnotation(final String[] value) { return new Stories() { @Override public String[] value() { return value; } @Override public Class<Stories> annotationType() { return Stories.class; } }; }
java
Stories getStoriesAnnotation(final String[] value) { return new Stories() { @Override public String[] value() { return value; } @Override public Class<Stories> annotationType() { return Stories.class; } }; }
[ "Stories", "getStoriesAnnotation", "(", "final", "String", "[", "]", "value", ")", "{", "return", "new", "Stories", "(", ")", "{", "@", "Override", "public", "String", "[", "]", "value", "(", ")", "{", "return", "value", ";", "}", "@", "Override", "pub...
Creates Story annotation object @param value story names array @return Story annotation object
[ "Creates", "Story", "annotation", "object" ]
dd17fe2ad826faabec751a85f20f0e5e494af8d6
https://github.com/allure-framework/allure-cucumberjvm/blob/dd17fe2ad826faabec751a85f20f0e5e494af8d6/src/main/java/ru/yandex/qatools/allure/cucumberjvm/AllureRunListener.java#L226-L239
train
allure-framework/allure-cucumberjvm
src/main/java/ru/yandex/qatools/allure/cucumberjvm/AllureRunListener.java
AllureRunListener.getFeaturesAnnotation
Features getFeaturesAnnotation(final String[] value) { return new Features() { @Override public String[] value() { return value; } @Override public Class<Features> annotationType() { return Features.class; } }; }
java
Features getFeaturesAnnotation(final String[] value) { return new Features() { @Override public String[] value() { return value; } @Override public Class<Features> annotationType() { return Features.class; } }; }
[ "Features", "getFeaturesAnnotation", "(", "final", "String", "[", "]", "value", ")", "{", "return", "new", "Features", "(", ")", "{", "@", "Override", "public", "String", "[", "]", "value", "(", ")", "{", "return", "value", ";", "}", "@", "Override", "...
Creates Feature annotation object @param value feature names array @return Feature annotation object
[ "Creates", "Feature", "annotation", "object" ]
dd17fe2ad826faabec751a85f20f0e5e494af8d6
https://github.com/allure-framework/allure-cucumberjvm/blob/dd17fe2ad826faabec751a85f20f0e5e494af8d6/src/main/java/ru/yandex/qatools/allure/cucumberjvm/AllureRunListener.java#L247-L260
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/results/AbstractWrapperBase.java
AbstractWrapperBase.getTypeList
public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) { if (typeList.length > 0) { return new ArrayList<>(Arrays.asList(typeList)); } else { return new ArrayList<>(EnumSet.allOf(clz)); } }
java
public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) { if (typeList.length > 0) { return new ArrayList<>(Arrays.asList(typeList)); } else { return new ArrayList<>(EnumSet.allOf(clz)); } }
[ "public", "<", "E", "extends", "Enum", "<", "E", ">", ">", "List", "<", "E", ">", "getTypeList", "(", "Class", "<", "E", ">", "clz", ",", "E", "[", "]", "typeList", ")", "{", "if", "(", "typeList", ".", "length", ">", "0", ")", "{", "return", ...
Get a list of the enums passed @param <E> @param clz Class of the enum @param typeList Array of the enums @return
[ "Get", "a", "list", "of", "the", "enums", "passed" ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/results/AbstractWrapperBase.java#L38-L44
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java
TmdbPeople.getPersonExternalIds
public ExternalID getPersonExternalIds(int personId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, personId); URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.EXTERNAL_IDS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, ExternalID.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person external IDs", url, ex); } }
java
public ExternalID getPersonExternalIds(int personId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, personId); URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.EXTERNAL_IDS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, ExternalID.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person external IDs", url, ex); } }
[ "public", "ExternalID", "getPersonExternalIds", "(", "int", "personId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "personId", ")", ...
Get the external ids for a specific person id. @param personId @return @throws MovieDbException
[ "Get", "the", "external", "ids", "for", "a", "specific", "person", "id", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java#L195-L207
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java
TmdbPeople.getPersonImages
public ResultList<Artwork> getPersonImages(int personId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, personId); URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.IMAGES).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); ResultList<Artwork> results = new ResultList<>(wrapper.getAll(ArtworkType.PROFILE)); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person images", url, ex); } }
java
public ResultList<Artwork> getPersonImages(int personId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, personId); URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.IMAGES).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); ResultList<Artwork> results = new ResultList<>(wrapper.getAll(ArtworkType.PROFILE)); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person images", url, ex); } }
[ "public", "ResultList", "<", "Artwork", ">", "getPersonImages", "(", "int", "personId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",",...
Get the images for a specific person id. @param personId @return @throws MovieDbException
[ "Get", "the", "images", "for", "a", "specific", "person", "id", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java#L216-L231
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java
TmdbPeople.getPersonPopular
public ResultList<PersonFind> getPersonPopular(Integer page) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.PAGE, page); URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.POPULAR).buildUrl(parameters); WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person popular"); return wrapper.getResultsList(); }
java
public ResultList<PersonFind> getPersonPopular(Integer page) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.PAGE, page); URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.POPULAR).buildUrl(parameters); WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person popular"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "PersonFind", ">", "getPersonPopular", "(", "Integer", "page", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "PAGE", ...
Get the list of popular people on The Movie Database. This list refreshes every day. @param page @return @throws MovieDbException
[ "Get", "the", "list", "of", "popular", "people", "on", "The", "Movie", "Database", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java#L287-L294
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/results/WrapperImages.java
WrapperImages.getAll
public List<Artwork> getAll(ArtworkType... artworkList) { List<Artwork> artwork = new ArrayList<>(); List<ArtworkType> types; if (artworkList.length > 0) { types = new ArrayList<>(Arrays.asList(artworkList)); } else { types = new ArrayList<>(Arrays.asList(ArtworkType.values())); } // Add all the posters to the list if (types.contains(ArtworkType.POSTER)) { updateArtworkType(posters, ArtworkType.POSTER); artwork.addAll(posters); } // Add all the backdrops to the list if (types.contains(ArtworkType.BACKDROP)) { updateArtworkType(backdrops, ArtworkType.BACKDROP); artwork.addAll(backdrops); } // Add all the profiles to the list if (types.contains(ArtworkType.PROFILE)) { updateArtworkType(profiles, ArtworkType.PROFILE); artwork.addAll(profiles); } // Add all the stills to the list if (types.contains(ArtworkType.STILL)) { updateArtworkType(stills, ArtworkType.STILL); artwork.addAll(stills); } return artwork; }
java
public List<Artwork> getAll(ArtworkType... artworkList) { List<Artwork> artwork = new ArrayList<>(); List<ArtworkType> types; if (artworkList.length > 0) { types = new ArrayList<>(Arrays.asList(artworkList)); } else { types = new ArrayList<>(Arrays.asList(ArtworkType.values())); } // Add all the posters to the list if (types.contains(ArtworkType.POSTER)) { updateArtworkType(posters, ArtworkType.POSTER); artwork.addAll(posters); } // Add all the backdrops to the list if (types.contains(ArtworkType.BACKDROP)) { updateArtworkType(backdrops, ArtworkType.BACKDROP); artwork.addAll(backdrops); } // Add all the profiles to the list if (types.contains(ArtworkType.PROFILE)) { updateArtworkType(profiles, ArtworkType.PROFILE); artwork.addAll(profiles); } // Add all the stills to the list if (types.contains(ArtworkType.STILL)) { updateArtworkType(stills, ArtworkType.STILL); artwork.addAll(stills); } return artwork; }
[ "public", "List", "<", "Artwork", ">", "getAll", "(", "ArtworkType", "...", "artworkList", ")", "{", "List", "<", "Artwork", ">", "artwork", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "ArtworkType", ">", "types", ";", "if", "(", "artwor...
Return a list of all the artwork with their types. Leaving the parameters blank will return all types @param artworkList @return
[ "Return", "a", "list", "of", "all", "the", "artwork", "with", "their", "types", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/results/WrapperImages.java#L81-L116
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/results/WrapperImages.java
WrapperImages.updateArtworkType
private void updateArtworkType(List<Artwork> artworkList, ArtworkType type) { for (Artwork artwork : artworkList) { artwork.setArtworkType(type); } }
java
private void updateArtworkType(List<Artwork> artworkList, ArtworkType type) { for (Artwork artwork : artworkList) { artwork.setArtworkType(type); } }
[ "private", "void", "updateArtworkType", "(", "List", "<", "Artwork", ">", "artworkList", ",", "ArtworkType", "type", ")", "{", "for", "(", "Artwork", "artwork", ":", "artworkList", ")", "{", "artwork", ".", "setArtworkType", "(", "type", ")", ";", "}", "}"...
Update the artwork type for the artwork list @param artworkList @param type
[ "Update", "the", "artwork", "type", "for", "the", "artwork", "list" ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/results/WrapperImages.java#L124-L128
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java
TmdbAuthentication.getAuthorisationToken
public TokenAuthorisation getAuthorisationToken() throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.TOKEN_NEW).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenAuthorisation.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Failed to get Authorisation Token", url, ex); } }
java
public TokenAuthorisation getAuthorisationToken() throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.TOKEN_NEW).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenAuthorisation.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Failed to get Authorisation Token", url, ex); } }
[ "public", "TokenAuthorisation", "getAuthorisationToken", "(", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "AUTH", ...
This method is used to generate a valid request token for user based authentication. A request token is required in order to request a session id. You can generate any number of request tokens but they will expire after 60 minutes. As soon as a valid session id has been created the token will be destroyed. @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "generate", "a", "valid", "request", "token", "for", "user", "based", "authentication", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java#L67-L78
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java
TmdbAuthentication.getSessionToken
public TokenSession getSessionToken(TokenAuthorisation token) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); if (!token.getSuccess()) { throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!"); } parameters.add(Param.TOKEN, token.getRequestToken()); URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.SESSION_NEW).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenSession.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex); } }
java
public TokenSession getSessionToken(TokenAuthorisation token) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); if (!token.getSuccess()) { throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!"); } parameters.add(Param.TOKEN, token.getRequestToken()); URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.SESSION_NEW).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenSession.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex); } }
[ "public", "TokenSession", "getSessionToken", "(", "TokenAuthorisation", "token", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "if", "(", "!", "token", ".", "getSuccess", "(", ")", ")", "{", ...
This method is used to generate a session id for user based authentication. A session id is required in order to use any of the write methods. @param token @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "generate", "a", "session", "id", "for", "user", "based", "authentication", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java#L90-L106
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java
TmdbAuthentication.getGuestSessionToken
public TokenSession getGuestSessionToken() throws MovieDbException { URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.GUEST_SESSION).buildUrl(); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenSession.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Guest Session Token", url, ex); } }
java
public TokenSession getGuestSessionToken() throws MovieDbException { URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.GUEST_SESSION).buildUrl(); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenSession.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Guest Session Token", url, ex); } }
[ "public", "TokenSession", "getGuestSessionToken", "(", ")", "throws", "MovieDbException", "{", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "AUTH", ")", ".", "subMethod", "(", "MethodSub", ".", "GUEST_SESSION", ")", ".", "buildUrl...
This method is used to generate a guest session id. A guest session can be used to rate movies without having a registered TMDb user account. You should only generate a single guest session per user (or device) as you will be able to attach the ratings to a TMDb user account in the future. There are also IP limits in place so you should always make sure it's the end user doing the guest session actions. If a guest session is not used for the first time within 24 hours, it will be automatically discarded. @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "generate", "a", "guest", "session", "id", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java#L160-L169
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.initialise
private void initialise(String apiKey, HttpTools httpTools) { tmdbAccount = new TmdbAccount(apiKey, httpTools); tmdbAuth = new TmdbAuthentication(apiKey, httpTools); tmdbCertifications = new TmdbCertifications(apiKey, httpTools); tmdbChanges = new TmdbChanges(apiKey, httpTools); tmdbCollections = new TmdbCollections(apiKey, httpTools); tmdbCompany = new TmdbCompanies(apiKey, httpTools); tmdbConfiguration = new TmdbConfiguration(apiKey, httpTools); tmdbCredits = new TmdbCredits(apiKey, httpTools); tmdbDiscover = new TmdbDiscover(apiKey, httpTools); tmdbFind = new TmdbFind(apiKey, httpTools); tmdbGenre = new TmdbGenres(apiKey, httpTools); tmdbKeywords = new TmdbKeywords(apiKey, httpTools); tmdbList = new TmdbLists(apiKey, httpTools); tmdbMovies = new TmdbMovies(apiKey, httpTools); tmdbNetworks = new TmdbNetworks(apiKey, httpTools); tmdbPeople = new TmdbPeople(apiKey, httpTools); tmdbReviews = new TmdbReviews(apiKey, httpTools); tmdbSearch = new TmdbSearch(apiKey, httpTools); tmdbTv = new TmdbTV(apiKey, httpTools); tmdbSeasons = new TmdbSeasons(apiKey, httpTools); tmdbEpisodes = new TmdbEpisodes(apiKey, httpTools); }
java
private void initialise(String apiKey, HttpTools httpTools) { tmdbAccount = new TmdbAccount(apiKey, httpTools); tmdbAuth = new TmdbAuthentication(apiKey, httpTools); tmdbCertifications = new TmdbCertifications(apiKey, httpTools); tmdbChanges = new TmdbChanges(apiKey, httpTools); tmdbCollections = new TmdbCollections(apiKey, httpTools); tmdbCompany = new TmdbCompanies(apiKey, httpTools); tmdbConfiguration = new TmdbConfiguration(apiKey, httpTools); tmdbCredits = new TmdbCredits(apiKey, httpTools); tmdbDiscover = new TmdbDiscover(apiKey, httpTools); tmdbFind = new TmdbFind(apiKey, httpTools); tmdbGenre = new TmdbGenres(apiKey, httpTools); tmdbKeywords = new TmdbKeywords(apiKey, httpTools); tmdbList = new TmdbLists(apiKey, httpTools); tmdbMovies = new TmdbMovies(apiKey, httpTools); tmdbNetworks = new TmdbNetworks(apiKey, httpTools); tmdbPeople = new TmdbPeople(apiKey, httpTools); tmdbReviews = new TmdbReviews(apiKey, httpTools); tmdbSearch = new TmdbSearch(apiKey, httpTools); tmdbTv = new TmdbTV(apiKey, httpTools); tmdbSeasons = new TmdbSeasons(apiKey, httpTools); tmdbEpisodes = new TmdbEpisodes(apiKey, httpTools); }
[ "private", "void", "initialise", "(", "String", "apiKey", ",", "HttpTools", "httpTools", ")", "{", "tmdbAccount", "=", "new", "TmdbAccount", "(", "apiKey", ",", "httpTools", ")", ";", "tmdbAuth", "=", "new", "TmdbAuthentication", "(", "apiKey", ",", "httpTools...
Initialise the sub-classes once the API key and http client are known @param apiKey apiKey @param httpTools httpTools
[ "Initialise", "the", "sub", "-", "classes", "once", "the", "API", "key", "and", "http", "client", "are", "known" ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L162-L184
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getFavoriteMovies
public ResultList<MovieBasic> getFavoriteMovies(String sessionId, int accountId) throws MovieDbException { return tmdbAccount.getFavoriteMovies(sessionId, accountId); }
java
public ResultList<MovieBasic> getFavoriteMovies(String sessionId, int accountId) throws MovieDbException { return tmdbAccount.getFavoriteMovies(sessionId, accountId); }
[ "public", "ResultList", "<", "MovieBasic", ">", "getFavoriteMovies", "(", "String", "sessionId", ",", "int", "accountId", ")", "throws", "MovieDbException", "{", "return", "tmdbAccount", ".", "getFavoriteMovies", "(", "sessionId", ",", "accountId", ")", ";", "}" ]
Get the account favourite movies @param sessionId sessionId @param accountId accountId @return ResultList @throws MovieDbException exception
[ "Get", "the", "account", "favourite", "movies" ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L219-L221
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.modifyFavoriteStatus
public StatusCode modifyFavoriteStatus(String sessionId, int accountId, Integer mediaId, MediaType mediaType, boolean isFavorite) throws MovieDbException { return tmdbAccount.modifyFavoriteStatus(sessionId, accountId, mediaType, mediaId, isFavorite); }
java
public StatusCode modifyFavoriteStatus(String sessionId, int accountId, Integer mediaId, MediaType mediaType, boolean isFavorite) throws MovieDbException { return tmdbAccount.modifyFavoriteStatus(sessionId, accountId, mediaType, mediaId, isFavorite); }
[ "public", "StatusCode", "modifyFavoriteStatus", "(", "String", "sessionId", ",", "int", "accountId", ",", "Integer", "mediaId", ",", "MediaType", "mediaType", ",", "boolean", "isFavorite", ")", "throws", "MovieDbException", "{", "return", "tmdbAccount", ".", "modify...
Add or remove a movie to an accounts favourite list. @param sessionId sessionId @param accountId accountId @param mediaId mediaId @param mediaType mediaType @param isFavorite isFavorite @return StatusCode @throws MovieDbException exception
[ "Add", "or", "remove", "a", "movie", "to", "an", "accounts", "favourite", "list", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L234-L236
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getWatchListTV
public ResultList<TVBasic> getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { return tmdbAccount.getWatchListTV(sessionId, accountId, page, sortBy, language); }
java
public ResultList<TVBasic> getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException { return tmdbAccount.getWatchListTV(sessionId, accountId, page, sortBy, language); }
[ "public", "ResultList", "<", "TVBasic", ">", "getWatchListTV", "(", "String", "sessionId", ",", "int", "accountId", ",", "Integer", "page", ",", "String", "sortBy", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbAccount", ".", ...
Get the list of movies on an accounts watchlist. @param sessionId sessionId @param accountId accountId @param page page @param sortBy sortBy @param language language @return The watchlist of the user @throws MovieDbException exception
[ "Get", "the", "list", "of", "movies", "on", "an", "accounts", "watchlist", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L294-L296
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.addToWatchList
public StatusCode addToWatchList(String sessionId, int accountId, MediaType mediaType, Integer mediaId) throws MovieDbException { return tmdbAccount.modifyWatchList(sessionId, accountId, mediaType, mediaId, true); }
java
public StatusCode addToWatchList(String sessionId, int accountId, MediaType mediaType, Integer mediaId) throws MovieDbException { return tmdbAccount.modifyWatchList(sessionId, accountId, mediaType, mediaId, true); }
[ "public", "StatusCode", "addToWatchList", "(", "String", "sessionId", ",", "int", "accountId", ",", "MediaType", "mediaType", ",", "Integer", "mediaId", ")", "throws", "MovieDbException", "{", "return", "tmdbAccount", ".", "modifyWatchList", "(", "sessionId", ",", ...
Add a movie to an accounts watch list. @param sessionId sessionId @param accountId accountId @param mediaId mediaId @param mediaType mediaType @return StatusCode @throws MovieDbException exception
[ "Add", "a", "movie", "to", "an", "accounts", "watch", "list", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L308-L310
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.removeFromWatchList
public StatusCode removeFromWatchList(String sessionId, int accountId, MediaType mediaType, Integer mediaId) throws MovieDbException { return tmdbAccount.modifyWatchList(sessionId, accountId, mediaType, mediaId, false); }
java
public StatusCode removeFromWatchList(String sessionId, int accountId, MediaType mediaType, Integer mediaId) throws MovieDbException { return tmdbAccount.modifyWatchList(sessionId, accountId, mediaType, mediaId, false); }
[ "public", "StatusCode", "removeFromWatchList", "(", "String", "sessionId", ",", "int", "accountId", ",", "MediaType", "mediaType", ",", "Integer", "mediaId", ")", "throws", "MovieDbException", "{", "return", "tmdbAccount", ".", "modifyWatchList", "(", "sessionId", "...
Remove a movie from an accounts watch list. @param sessionId sessionId @param accountId accountId @param mediaId mediaId @param mediaType mediaType @return StatusCode @throws MovieDbException exception
[ "Remove", "a", "movie", "from", "an", "accounts", "watch", "list", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L322-L324
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getFavoriteTv
public ResultList<TVBasic> getFavoriteTv(String sessionId, int accountId) throws MovieDbException { return tmdbAccount.getFavoriteTv(sessionId, accountId); }
java
public ResultList<TVBasic> getFavoriteTv(String sessionId, int accountId) throws MovieDbException { return tmdbAccount.getFavoriteTv(sessionId, accountId); }
[ "public", "ResultList", "<", "TVBasic", ">", "getFavoriteTv", "(", "String", "sessionId", ",", "int", "accountId", ")", "throws", "MovieDbException", "{", "return", "tmdbAccount", ".", "getFavoriteTv", "(", "sessionId", ",", "accountId", ")", ";", "}" ]
Get the list of favorite TV series for an account. @param sessionId sessionId @param accountId accountId @return ResultList @throws MovieDbException exception
[ "Get", "the", "list", "of", "favorite", "TV", "series", "for", "an", "account", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L334-L336
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getMovieChangeList
public ResultList<ChangeListItem> getMovieChangeList(Integer page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.MOVIE, page, startDate, endDate); }
java
public ResultList<ChangeListItem> getMovieChangeList(Integer page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.MOVIE, page, startDate, endDate); }
[ "public", "ResultList", "<", "ChangeListItem", ">", "getMovieChangeList", "(", "Integer", "page", ",", "String", "startDate", ",", "String", "endDate", ")", "throws", "MovieDbException", "{", "return", "tmdbChanges", ".", "getChangeList", "(", "MethodBase", ".", "...
Get a list of Movie IDs that have been edited. You can then use the movie changes API to get the actual data that has been changed. @param page page @param startDate the start date of the changes, optional @param endDate the end date of the changes, optional @return List of changed movie @throws MovieDbException exception
[ "Get", "a", "list", "of", "Movie", "IDs", "that", "have", "been", "edited", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L462-L464
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getTvChangeList
public ResultList<ChangeListItem> getTvChangeList(Integer page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.TV, page, startDate, endDate); }
java
public ResultList<ChangeListItem> getTvChangeList(Integer page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.TV, page, startDate, endDate); }
[ "public", "ResultList", "<", "ChangeListItem", ">", "getTvChangeList", "(", "Integer", "page", ",", "String", "startDate", ",", "String", "endDate", ")", "throws", "MovieDbException", "{", "return", "tmdbChanges", ".", "getChangeList", "(", "MethodBase", ".", "TV"...
Get a list of TV IDs that have been edited. You can then use the TV changes API to get the actual data that has been changed. @param page page @param startDate the start date of the changes, optional @param endDate the end date of the changes, optional @return List of changed movie @throws MovieDbException exception
[ "Get", "a", "list", "of", "TV", "IDs", "that", "have", "been", "edited", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L478-L480
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getPersonChangeList
public ResultList<ChangeListItem> getPersonChangeList(Integer page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.PERSON, page, startDate, endDate); }
java
public ResultList<ChangeListItem> getPersonChangeList(Integer page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.PERSON, page, startDate, endDate); }
[ "public", "ResultList", "<", "ChangeListItem", ">", "getPersonChangeList", "(", "Integer", "page", ",", "String", "startDate", ",", "String", "endDate", ")", "throws", "MovieDbException", "{", "return", "tmdbChanges", ".", "getChangeList", "(", "MethodBase", ".", ...
Get a list of PersonInfo IDs that have been edited. You can then use the person changes API to get the actual data that has been changed. @param page page @param startDate the start date of the changes, optional @param endDate the end date of the changes, optional @return List of changed movie @throws MovieDbException exception
[ "Get", "a", "list", "of", "PersonInfo", "IDs", "that", "have", "been", "edited", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L494-L496
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getGenreMovies
public ResultList<MovieBasic> getGenreMovies(int genreId, String language, Integer page, Boolean includeAllMovies, Boolean includeAdult) throws MovieDbException { return tmdbGenre.getGenreMovies(genreId, language, page, includeAllMovies, includeAdult); }
java
public ResultList<MovieBasic> getGenreMovies(int genreId, String language, Integer page, Boolean includeAllMovies, Boolean includeAdult) throws MovieDbException { return tmdbGenre.getGenreMovies(genreId, language, page, includeAllMovies, includeAdult); }
[ "public", "ResultList", "<", "MovieBasic", ">", "getGenreMovies", "(", "int", "genreId", ",", "String", "language", ",", "Integer", "page", ",", "Boolean", "includeAllMovies", ",", "Boolean", "includeAdult", ")", "throws", "MovieDbException", "{", "return", "tmdbG...
Get a list of movies per genre. It is important to understand that only movies with more than 10 votes get listed. This prevents movies from 1 10/10 rating from being listed first and for the first 5 pages. @param genreId genreId @param language language @param page page @param includeAllMovies includeAllMovies @param includeAdult includeAdult @return @throws MovieDbException exception
[ "Get", "a", "list", "of", "movies", "per", "genre", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L723-L725
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.checkItemStatus
public boolean checkItemStatus(String listId, Integer mediaId) throws MovieDbException { return tmdbList.checkItemStatus(listId, mediaId); }
java
public boolean checkItemStatus(String listId, Integer mediaId) throws MovieDbException { return tmdbList.checkItemStatus(listId, mediaId); }
[ "public", "boolean", "checkItemStatus", "(", "String", "listId", ",", "Integer", "mediaId", ")", "throws", "MovieDbException", "{", "return", "tmdbList", ".", "checkItemStatus", "(", "listId", ",", "mediaId", ")", ";", "}" ]
Check to see if an item is already on a list. @param listId listId @param mediaId mediaId @return true if the item is on the list @throws MovieDbException exception
[ "Check", "to", "see", "if", "an", "item", "is", "already", "on", "a", "list", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L800-L802
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.removeItemFromList
public StatusCode removeItemFromList(String sessionId, String listId, Integer mediaId) throws MovieDbException { return tmdbList.removeItem(sessionId, listId, mediaId); }
java
public StatusCode removeItemFromList(String sessionId, String listId, Integer mediaId) throws MovieDbException { return tmdbList.removeItem(sessionId, listId, mediaId); }
[ "public", "StatusCode", "removeItemFromList", "(", "String", "sessionId", ",", "String", "listId", ",", "Integer", "mediaId", ")", "throws", "MovieDbException", "{", "return", "tmdbList", ".", "removeItem", "(", "sessionId", ",", "listId", ",", "mediaId", ")", "...
This method lets users remove items from a list that they created. A valid session id is required. @param sessionId sessionId @param listId listId @param mediaId mediaId @return true if the movie is on the list @throws MovieDbException exception
[ "This", "method", "lets", "users", "remove", "items", "from", "a", "list", "that", "they", "created", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L830-L832
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getMovieVideos
public ResultList<Video> getMovieVideos(int movieId, String language) throws MovieDbException { return tmdbMovies.getMovieVideos(movieId, language); }
java
public ResultList<Video> getMovieVideos(int movieId, String language) throws MovieDbException { return tmdbMovies.getMovieVideos(movieId, language); }
[ "public", "ResultList", "<", "Video", ">", "getMovieVideos", "(", "int", "movieId", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbMovies", ".", "getMovieVideos", "(", "movieId", ",", "language", ")", ";", "}" ]
This method is used to retrieve all of the trailers for a particular movie. Supported sites are YouTube and QuickTime. @param movieId movieId @param language language @return @throws MovieDbException exception
[ "This", "method", "is", "used", "to", "retrieve", "all", "of", "the", "trailers", "for", "a", "particular", "movie", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L962-L964
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getMovieReviews
public ResultList<Review> getMovieReviews(int movieId, Integer page, String language) throws MovieDbException { return tmdbMovies.getMovieReviews(movieId, page, language); }
java
public ResultList<Review> getMovieReviews(int movieId, Integer page, String language) throws MovieDbException { return tmdbMovies.getMovieReviews(movieId, page, language); }
[ "public", "ResultList", "<", "Review", ">", "getMovieReviews", "(", "int", "movieId", ",", "Integer", "page", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbMovies", ".", "getMovieReviews", "(", "movieId", ",", "page", ",", "...
Get the reviews for a particular movie id. @param movieId movieId @param page page @param language language @return @throws MovieDbException exception
[ "Get", "the", "reviews", "for", "a", "particular", "movie", "id", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1006-L1008
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getMovieLists
public ResultList<UserList> getMovieLists(int movieId, Integer page, String language) throws MovieDbException { return tmdbMovies.getMovieLists(movieId, page, language); }
java
public ResultList<UserList> getMovieLists(int movieId, Integer page, String language) throws MovieDbException { return tmdbMovies.getMovieLists(movieId, page, language); }
[ "public", "ResultList", "<", "UserList", ">", "getMovieLists", "(", "int", "movieId", ",", "Integer", "page", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbMovies", ".", "getMovieLists", "(", "movieId", ",", "page", ",", "la...
Get the lists that the movie belongs to @param movieId movieId @param language language @param page page @return @throws MovieDbException exception
[ "Get", "the", "lists", "that", "the", "movie", "belongs", "to" ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1019-L1021
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getTopRatedMovies
public ResultList<MovieInfo> getTopRatedMovies(Integer page, String language) throws MovieDbException { return tmdbMovies.getTopRatedMovies(page, language); }
java
public ResultList<MovieInfo> getTopRatedMovies(Integer page, String language) throws MovieDbException { return tmdbMovies.getTopRatedMovies(page, language); }
[ "public", "ResultList", "<", "MovieInfo", ">", "getTopRatedMovies", "(", "Integer", "page", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbMovies", ".", "getTopRatedMovies", "(", "page", ",", "language", ")", ";", "}" ]
This method is used to retrieve the top rated movies that have over 10 votes on TMDb. The default response will return 20 movies. @param language language @param page page @return @throws MovieDbException exception
[ "This", "method", "is", "used", "to", "retrieve", "the", "top", "rated", "movies", "that", "have", "over", "10", "votes", "on", "TMDb", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1127-L1129
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getPersonTVCredits
public PersonCreditList<CreditTVBasic> getPersonTVCredits(int personId, String language) throws MovieDbException { return tmdbPeople.getPersonTVCredits(personId, language); }
java
public PersonCreditList<CreditTVBasic> getPersonTVCredits(int personId, String language) throws MovieDbException { return tmdbPeople.getPersonTVCredits(personId, language); }
[ "public", "PersonCreditList", "<", "CreditTVBasic", ">", "getPersonTVCredits", "(", "int", "personId", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbPeople", ".", "getPersonTVCredits", "(", "personId", ",", "language", ")", ";", ...
Get the TV credits for a specific person id. To get the expanded details for each record, call the /credit method with the provided credit_id. This will provide details about which episode and/or season the credit is for. @param personId personId @param language language @return @throws MovieDbException exception
[ "Get", "the", "TV", "credits", "for", "a", "specific", "person", "id", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1186-L1188
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getPersonChanges
public ResultList<ChangeKeyItem> getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException { return tmdbPeople.getPersonChanges(personId, startDate, endDate); }
java
public ResultList<ChangeKeyItem> getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException { return tmdbPeople.getPersonChanges(personId, startDate, endDate); }
[ "public", "ResultList", "<", "ChangeKeyItem", ">", "getPersonChanges", "(", "int", "personId", ",", "String", "startDate", ",", "String", "endDate", ")", "throws", "MovieDbException", "{", "return", "tmdbPeople", ".", "getPersonChanges", "(", "personId", ",", "sta...
Get the changes for a specific person id. Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable. @param personId personId @param startDate startDate @param endDate endDate @return @throws com.omertron.themoviedbapi.MovieDbException
[ "Get", "the", "changes", "for", "a", "specific", "person", "id", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1264-L1266
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.searchKeyword
public ResultList<Keyword> searchKeyword(String query, Integer page) throws MovieDbException { return tmdbSearch.searchKeyword(query, page); }
java
public ResultList<Keyword> searchKeyword(String query, Integer page) throws MovieDbException { return tmdbSearch.searchKeyword(query, page); }
[ "public", "ResultList", "<", "Keyword", ">", "searchKeyword", "(", "String", "query", ",", "Integer", "page", ")", "throws", "MovieDbException", "{", "return", "tmdbSearch", ".", "searchKeyword", "(", "query", ",", "page", ")", ";", "}" ]
Search for keywords by name @param query query @param page page @return @throws MovieDbException exception
[ "Search", "for", "keywords", "by", "name" ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1342-L1344
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getTVAccountState
public MediaState getTVAccountState(int tvID, String sessionID) throws MovieDbException { return tmdbTv.getTVAccountState(tvID, sessionID); }
java
public MediaState getTVAccountState(int tvID, String sessionID) throws MovieDbException { return tmdbTv.getTVAccountState(tvID, sessionID); }
[ "public", "MediaState", "getTVAccountState", "(", "int", "tvID", ",", "String", "sessionID", ")", "throws", "MovieDbException", "{", "return", "tmdbTv", ".", "getTVAccountState", "(", "tvID", ",", "sessionID", ")", ";", "}" ]
This method lets users get the status of whether or not the TV show has been rated or added to their favourite or watch lists. A valid session id is required. @param tvID tvID @param sessionID sessionID @return @throws com.omertron.themoviedbapi.MovieDbException
[ "This", "method", "lets", "users", "get", "the", "status", "of", "whether", "or", "not", "the", "TV", "show", "has", "been", "rated", "or", "added", "to", "their", "favourite", "or", "watch", "lists", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1450-L1452
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getTVExternalIDs
public ExternalID getTVExternalIDs(int tvID, String language) throws MovieDbException { return tmdbTv.getTVExternalIDs(tvID, language); }
java
public ExternalID getTVExternalIDs(int tvID, String language) throws MovieDbException { return tmdbTv.getTVExternalIDs(tvID, language); }
[ "public", "ExternalID", "getTVExternalIDs", "(", "int", "tvID", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbTv", ".", "getTVExternalIDs", "(", "tvID", ",", "language", ")", ";", "}" ]
Get the external ids that we have stored for a TV series. @param tvID tvID @param language language @return @throws com.omertron.themoviedbapi.MovieDbException
[ "Get", "the", "external", "ids", "that", "we", "have", "stored", "for", "a", "TV", "series", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1509-L1511
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.postTVRating
public StatusCode postTVRating(int tvID, int rating, String sessionID, String guestSessionID) throws MovieDbException { return tmdbTv.postTVRating(tvID, rating, sessionID, guestSessionID); }
java
public StatusCode postTVRating(int tvID, int rating, String sessionID, String guestSessionID) throws MovieDbException { return tmdbTv.postTVRating(tvID, rating, sessionID, guestSessionID); }
[ "public", "StatusCode", "postTVRating", "(", "int", "tvID", ",", "int", "rating", ",", "String", "sessionID", ",", "String", "guestSessionID", ")", "throws", "MovieDbException", "{", "return", "tmdbTv", ".", "postTVRating", "(", "tvID", ",", "rating", ",", "se...
This method lets users rate a TV show. A valid session id or guest session id is required. @param tvID tvID @param rating rating @param sessionID sessionID @param guestSessionID guestSessionID @return @throws com.omertron.themoviedbapi.MovieDbException
[ "This", "method", "lets", "users", "rate", "a", "TV", "show", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1549-L1551
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getTVSimilar
public ResultList<TVInfo> getTVSimilar(int tvID, Integer page, String language) throws MovieDbException { return tmdbTv.getTVSimilar(tvID, page, language); }
java
public ResultList<TVInfo> getTVSimilar(int tvID, Integer page, String language) throws MovieDbException { return tmdbTv.getTVSimilar(tvID, page, language); }
[ "public", "ResultList", "<", "TVInfo", ">", "getTVSimilar", "(", "int", "tvID", ",", "Integer", "page", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbTv", ".", "getTVSimilar", "(", "tvID", ",", "page", ",", "language", ")"...
Get the similar TV shows for a specific tv id. @param tvID tvID @param page page @param language language @return @throws com.omertron.themoviedbapi.MovieDbException
[ "Get", "the", "similar", "TV", "shows", "for", "a", "specific", "tv", "id", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1562-L1564
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getTVOnTheAir
public ResultList<TVInfo> getTVOnTheAir(Integer page, String language) throws MovieDbException { return tmdbTv.getTVOnTheAir(page, language); }
java
public ResultList<TVInfo> getTVOnTheAir(Integer page, String language) throws MovieDbException { return tmdbTv.getTVOnTheAir(page, language); }
[ "public", "ResultList", "<", "TVInfo", ">", "getTVOnTheAir", "(", "Integer", "page", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbTv", ".", "getTVOnTheAir", "(", "page", ",", "language", ")", ";", "}" ]
Get the list of TV shows that are currently on the air. This query looks for any TV show that has an episode with an air date in the next 7 days. @param page page @param language language @return @throws com.omertron.themoviedbapi.MovieDbException
[ "Get", "the", "list", "of", "TV", "shows", "that", "are", "currently", "on", "the", "air", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1612-L1614
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getTVAiringToday
public ResultList<TVInfo> getTVAiringToday(Integer page, String language, String timezone) throws MovieDbException { return tmdbTv.getTVAiringToday(page, language, timezone); }
java
public ResultList<TVInfo> getTVAiringToday(Integer page, String language, String timezone) throws MovieDbException { return tmdbTv.getTVAiringToday(page, language, timezone); }
[ "public", "ResultList", "<", "TVInfo", ">", "getTVAiringToday", "(", "Integer", "page", ",", "String", "language", ",", "String", "timezone", ")", "throws", "MovieDbException", "{", "return", "tmdbTv", ".", "getTVAiringToday", "(", "page", ",", "language", ",", ...
Get the list of TV shows that air today. Without a specified timezone, this query defaults to EST @param page page @param language language @param timezone timezone @return @throws com.omertron.themoviedbapi.MovieDbException
[ "Get", "the", "list", "of", "TV", "shows", "that", "air", "today", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1627-L1629
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getSeasonExternalID
public ExternalID getSeasonExternalID(int tvID, int seasonNumber, String language) throws MovieDbException { return tmdbSeasons.getSeasonExternalID(tvID, seasonNumber, language); }
java
public ExternalID getSeasonExternalID(int tvID, int seasonNumber, String language) throws MovieDbException { return tmdbSeasons.getSeasonExternalID(tvID, seasonNumber, language); }
[ "public", "ExternalID", "getSeasonExternalID", "(", "int", "tvID", ",", "int", "seasonNumber", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbSeasons", ".", "getSeasonExternalID", "(", "tvID", ",", "seasonNumber", ",", "language", ...
Get the external ids that we have stored for a TV season by season number. @param tvID tvID @param seasonNumber seasonNumber @param language language @return @throws MovieDbException exception
[ "Get", "the", "external", "ids", "that", "we", "have", "stored", "for", "a", "TV", "season", "by", "season", "number", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1726-L1728
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getSeasonImages
public ResultList<Artwork> getSeasonImages(int tvID, int seasonNumber, String language, String... includeImageLanguage) throws MovieDbException { return tmdbSeasons.getSeasonImages(tvID, seasonNumber, language, includeImageLanguage); }
java
public ResultList<Artwork> getSeasonImages(int tvID, int seasonNumber, String language, String... includeImageLanguage) throws MovieDbException { return tmdbSeasons.getSeasonImages(tvID, seasonNumber, language, includeImageLanguage); }
[ "public", "ResultList", "<", "Artwork", ">", "getSeasonImages", "(", "int", "tvID", ",", "int", "seasonNumber", ",", "String", "language", ",", "String", "...", "includeImageLanguage", ")", "throws", "MovieDbException", "{", "return", "tmdbSeasons", ".", "getSeaso...
Get the images that we have stored for a TV season by season number. @param tvID tvID @param seasonNumber seasonNumber @param language language @param includeImageLanguage includeImageLanguage @return @throws MovieDbException exception
[ "Get", "the", "images", "that", "we", "have", "stored", "for", "a", "TV", "season", "by", "season", "number", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1740-L1742
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getEpisodeCredits
public MediaCreditList getEpisodeCredits(int tvID, int seasonNumber, int episodeNumber) throws MovieDbException { return tmdbEpisodes.getEpisodeCredits(tvID, seasonNumber, episodeNumber); }
java
public MediaCreditList getEpisodeCredits(int tvID, int seasonNumber, int episodeNumber) throws MovieDbException { return tmdbEpisodes.getEpisodeCredits(tvID, seasonNumber, episodeNumber); }
[ "public", "MediaCreditList", "getEpisodeCredits", "(", "int", "tvID", ",", "int", "seasonNumber", ",", "int", "episodeNumber", ")", "throws", "MovieDbException", "{", "return", "tmdbEpisodes", ".", "getEpisodeCredits", "(", "tvID", ",", "seasonNumber", ",", "episode...
Get the TV episode credits by combination of season and episode number. @param tvID tvID @param seasonNumber seasonNumber @param episodeNumber episodeNumber @return @throws MovieDbException exception
[ "Get", "the", "TV", "episode", "credits", "by", "combination", "of", "season", "and", "episode", "number", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1815-L1817
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getEpisodeExternalID
public ExternalID getEpisodeExternalID(int tvID, int seasonNumber, int episodeNumber, String language) throws MovieDbException { return tmdbEpisodes.getEpisodeExternalID(tvID, seasonNumber, episodeNumber, language); }
java
public ExternalID getEpisodeExternalID(int tvID, int seasonNumber, int episodeNumber, String language) throws MovieDbException { return tmdbEpisodes.getEpisodeExternalID(tvID, seasonNumber, episodeNumber, language); }
[ "public", "ExternalID", "getEpisodeExternalID", "(", "int", "tvID", ",", "int", "seasonNumber", ",", "int", "episodeNumber", ",", "String", "language", ")", "throws", "MovieDbException", "{", "return", "tmdbEpisodes", ".", "getEpisodeExternalID", "(", "tvID", ",", ...
Get the external ids for a TV episode by comabination of a season and episode number. @param tvID tvID @param seasonNumber seasonNumber @param episodeNumber episodeNumber @param language language @return @throws MovieDbException exception
[ "Get", "the", "external", "ids", "for", "a", "TV", "episode", "by", "comabination", "of", "a", "season", "and", "episode", "number", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1830-L1832
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbCertifications.java
TmdbCertifications.getMoviesCertification
public ResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException { URL url = new ApiUrl(apiKey, MethodBase.CERTIFICATION).subMethod(MethodSub.MOVIE_LIST).buildUrl(); String webpage = httpTools.getRequest(url); try { JsonNode node = MAPPER.readTree(webpage); Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() { }); return new ResultsMap<>(results); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie certifications", url, ex); } }
java
public ResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException { URL url = new ApiUrl(apiKey, MethodBase.CERTIFICATION).subMethod(MethodSub.MOVIE_LIST).buildUrl(); String webpage = httpTools.getRequest(url); try { JsonNode node = MAPPER.readTree(webpage); Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() { }); return new ResultsMap<>(results); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie certifications", url, ex); } }
[ "public", "ResultsMap", "<", "String", ",", "List", "<", "Certification", ">", ">", "getMoviesCertification", "(", ")", "throws", "MovieDbException", "{", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "CERTIFICATION", ")", ".", "...
Get a list of movies certification. @return @throws MovieDbException
[ "Get", "a", "list", "of", "movies", "certification", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbCertifications.java#L60-L72
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/Compare.java
Compare.compareTitles
private static boolean compareTitles(String primaryTitle, String firstCompareTitle, String secondCompareTitle, int maxDistance) { // Compare with the first title if (compareDistance(primaryTitle, firstCompareTitle, maxDistance)) { return true; } // Compare with the other title return compareDistance(primaryTitle, secondCompareTitle, maxDistance); }
java
private static boolean compareTitles(String primaryTitle, String firstCompareTitle, String secondCompareTitle, int maxDistance) { // Compare with the first title if (compareDistance(primaryTitle, firstCompareTitle, maxDistance)) { return true; } // Compare with the other title return compareDistance(primaryTitle, secondCompareTitle, maxDistance); }
[ "private", "static", "boolean", "compareTitles", "(", "String", "primaryTitle", ",", "String", "firstCompareTitle", ",", "String", "secondCompareTitle", ",", "int", "maxDistance", ")", "{", "// Compare with the first title", "if", "(", "compareDistance", "(", "primaryTi...
Compare a title with two other titles. @param primaryTitle Primary title @param firstCompareTitle First title to compare with @param secondCompareTitle Second title to compare with @param maxDistance Maximum difference between the titles @return
[ "Compare", "a", "title", "with", "two", "other", "titles", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/Compare.java#L99-L107
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/Compare.java
Compare.movies
public static boolean movies(final MovieInfo moviedb, final String title, final String year, int maxDistance) { return Compare.movies(moviedb, title, year, maxDistance, true); }
java
public static boolean movies(final MovieInfo moviedb, final String title, final String year, int maxDistance) { return Compare.movies(moviedb, title, year, maxDistance, true); }
[ "public", "static", "boolean", "movies", "(", "final", "MovieInfo", "moviedb", ",", "final", "String", "title", ",", "final", "String", "year", ",", "int", "maxDistance", ")", "{", "return", "Compare", ".", "movies", "(", "moviedb", ",", "title", ",", "yea...
Compare the MovieDB object with a title and year, case sensitive @param moviedb movieinfo @param title title @param year year @param maxDistance maximum distance @return true if matched
[ "Compare", "the", "MovieDB", "object", "with", "a", "title", "and", "year", "case", "sensitive" ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/Compare.java#L118-L120
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/Compare.java
Compare.compareDistance
private static boolean compareDistance(final String title1, final String title2, int distance) { return StringUtils.getLevenshteinDistance(title1, title2) <= distance; }
java
private static boolean compareDistance(final String title1, final String title2, int distance) { return StringUtils.getLevenshteinDistance(title1, title2) <= distance; }
[ "private", "static", "boolean", "compareDistance", "(", "final", "String", "title1", ",", "final", "String", "title2", ",", "int", "distance", ")", "{", "return", "StringUtils", ".", "getLevenshteinDistance", "(", "title1", ",", "title2", ")", "<=", "distance", ...
Compare the Levenshtein Distance between the two strings @param title1 title @param title2 title @param distance max distance
[ "Compare", "the", "Levenshtein", "Distance", "between", "the", "two", "strings" ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/Compare.java#L129-L131
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getMovieCredits
public MediaCreditList getMovieCredits(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.CREDITS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, MediaCreditList.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex); } }
java
public MediaCreditList getMovieCredits(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.CREDITS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, MediaCreditList.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex); } }
[ "public", "MediaCreditList", "getMovieCredits", "(", "int", "movieId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "movieId", ")", ...
Get the cast and crew information for a specific movie id. @param movieId @return @throws MovieDbException
[ "Get", "the", "cast", "and", "crew", "information", "for", "a", "specific", "movie", "id", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L200-L211
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getMovieKeywords
public ResultList<Keyword> getMovieKeywords(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.KEYWORDS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperMovieKeywords wrapper = MAPPER.readValue(webpage, WrapperMovieKeywords.class); ResultList<Keyword> results = new ResultList<>(wrapper.getKeywords()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get keywords", url, ex); } }
java
public ResultList<Keyword> getMovieKeywords(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.KEYWORDS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperMovieKeywords wrapper = MAPPER.readValue(webpage, WrapperMovieKeywords.class); ResultList<Keyword> results = new ResultList<>(wrapper.getKeywords()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get keywords", url, ex); } }
[ "public", "ResultList", "<", "Keyword", ">", "getMovieKeywords", "(", "int", "movieId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",",...
This method is used to retrieve all of the keywords that have been added to a particular movie. Currently, only English keywords exist. @param movieId @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "retrieve", "all", "of", "the", "keywords", "that", "have", "been", "added", "to", "a", "particular", "movie", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L248-L263
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getRecommendations
public ResultList<MovieInfo> getRecommendations(int movieId, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RECOMMENDATIONS).buildUrl(parameters); WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "recommendations"); return wrapper.getResultsList(); }
java
public ResultList<MovieInfo> getRecommendations(int movieId, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RECOMMENDATIONS).buildUrl(parameters); WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "recommendations"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "MovieInfo", ">", "getRecommendations", "(", "int", "movieId", ",", "String", "language", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", ...
The recommendations method will let you retrieve the movie recommendations for a particular movie. @param movieId @param language @return @throws MovieDbException
[ "The", "recommendations", "method", "will", "let", "you", "retrieve", "the", "movie", "recommendations", "for", "a", "particular", "movie", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L273-L281
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getReleaseDates
public ResultList<ReleaseDates> getReleaseDates(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RELEASE_DATES).buildUrl(parameters); WrapperGenericList<ReleaseDates> wrapper = processWrapper(getTypeReference(ReleaseDates.class), url, "release dates"); return wrapper.getResultsList(); }
java
public ResultList<ReleaseDates> getReleaseDates(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RELEASE_DATES).buildUrl(parameters); WrapperGenericList<ReleaseDates> wrapper = processWrapper(getTypeReference(ReleaseDates.class), url, "release dates"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "ReleaseDates", ">", "getReleaseDates", "(", "int", "movieId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ...
Get the release dates, certifications and related information by country for a specific movie id. The results are keyed by country code and contain a type value. @param movieId @return @throws MovieDbException
[ "Get", "the", "release", "dates", "certifications", "and", "related", "information", "by", "country", "for", "a", "specific", "movie", "id", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L346-L353
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getMovieTranslations
public ResultList<Translation> getMovieTranslations(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.TRANSLATIONS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class); ResultList<Translation> results = new ResultList<>(wrapper.getTranslations()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get translations", url, ex); } }
java
public ResultList<Translation> getMovieTranslations(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.TRANSLATIONS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class); ResultList<Translation> results = new ResultList<>(wrapper.getTranslations()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get translations", url, ex); } }
[ "public", "ResultList", "<", "Translation", ">", "getMovieTranslations", "(", "int", "movieId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID"...
This method is used to retrieve a list of the available translations for a specific movie. @param movieId @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "retrieve", "a", "list", "of", "the", "available", "translations", "for", "a", "specific", "movie", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L362-L377
train
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getMovieChanges
public ResultList<ChangeKeyItem> getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException { return getMediaChanges(movieId, startDate, endDate); }
java
public ResultList<ChangeKeyItem> getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException { return getMediaChanges(movieId, startDate, endDate); }
[ "public", "ResultList", "<", "ChangeKeyItem", ">", "getMovieChanges", "(", "int", "movieId", ",", "String", "startDate", ",", "String", "endDate", ")", "throws", "MovieDbException", "{", "return", "getMediaChanges", "(", "movieId", ",", "startDate", ",", "endDate"...
Get the changes for a specific movie ID. Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable. @param movieId @param startDate @param endDate @return @throws MovieDbException
[ "Get", "the", "changes", "for", "a", "specific", "movie", "ID", "." ]
bf132d7c7271734e13b58ba3bc92bba46f220118
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L460-L462
train