id
int32
0
165k
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
38,000
sababado/CircularView
library/src/main/java/com/sababado/circularview/CircularViewObject.java
CircularViewObject.setVisibility
public void setVisibility(int visibility) { if (this.visibility != visibility) { final boolean hasSpace = this.visibility == View.VISIBLE || this.visibility == View.INVISIBLE; final boolean removingSpace = visibility == View.GONE; final boolean change = hasSpace && removingSp...
java
public void setVisibility(int visibility) { if (this.visibility != visibility) { final boolean hasSpace = this.visibility == View.VISIBLE || this.visibility == View.INVISIBLE; final boolean removingSpace = visibility == View.GONE; final boolean change = hasSpace && removingSp...
[ "public", "void", "setVisibility", "(", "int", "visibility", ")", "{", "if", "(", "this", ".", "visibility", "!=", "visibility", ")", "{", "final", "boolean", "hasSpace", "=", "this", ".", "visibility", "==", "View", ".", "VISIBLE", "||", "this", ".", "v...
Set the enabled state of this view. @param visibility One of {@link View#VISIBLE}, {@link View#INVISIBLE}, or {@link View#GONE}.
[ "Set", "the", "enabled", "state", "of", "this", "view", "." ]
c9ab818d063bcc0796183616f8a82166a9b80aac
https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularViewObject.java#L387-L400
38,001
sababado/CircularView
library/src/main/java/com/sababado/circularview/CircularViewObject.java
CircularViewObject.onTouchEvent
public int onTouchEvent(final MotionEvent event) { int status = -2; if (visibility != View.GONE) { final int action = event.getAction(); final boolean isEventInCenterCircle = isInCenterCircle(event.getX(), event.getY()); if (action == MotionEvent.ACTION_DOWN) { ...
java
public int onTouchEvent(final MotionEvent event) { int status = -2; if (visibility != View.GONE) { final int action = event.getAction(); final boolean isEventInCenterCircle = isInCenterCircle(event.getX(), event.getY()); if (action == MotionEvent.ACTION_DOWN) { ...
[ "public", "int", "onTouchEvent", "(", "final", "MotionEvent", "event", ")", "{", "int", "status", "=", "-", "2", ";", "if", "(", "visibility", "!=", "View", ".", "GONE", ")", "{", "final", "int", "action", "=", "event", ".", "getAction", "(", ")", ";...
Act on a touch event. Returns a status based on what action was taken. @param event The motion event that was just received. @return Return a negative number if the event wasn't handled. Return a MotionEvent action code if it was handled.
[ "Act", "on", "a", "touch", "event", ".", "Returns", "a", "status", "based", "on", "what", "action", "was", "taken", "." ]
c9ab818d063bcc0796183616f8a82166a9b80aac
https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularViewObject.java#L408-L434
38,002
sualeh/credit_card_number
src/main/java/us/fatehi/creditcardnumber/ExpirationDate.java
ExpirationDate.getExpirationDateAsDate
public Date getExpirationDateAsDate() { if (hasExpirationDate()) { final LocalDateTime endOfMonth = expirationDate.atEndOfMonth() .atStartOfDay().plus(1, ChronoUnit.DAYS).minus(1, ChronoUnit.NANOS); final Instant instant = endOfMonth.atZone(ZoneId.systemDefault()) .toInstant(); ...
java
public Date getExpirationDateAsDate() { if (hasExpirationDate()) { final LocalDateTime endOfMonth = expirationDate.atEndOfMonth() .atStartOfDay().plus(1, ChronoUnit.DAYS).minus(1, ChronoUnit.NANOS); final Instant instant = endOfMonth.atZone(ZoneId.systemDefault()) .toInstant(); ...
[ "public", "Date", "getExpirationDateAsDate", "(", ")", "{", "if", "(", "hasExpirationDate", "(", ")", ")", "{", "final", "LocalDateTime", "endOfMonth", "=", "expirationDate", ".", "atEndOfMonth", "(", ")", ".", "atStartOfDay", "(", ")", ".", "plus", "(", "1"...
Gets the card expiration date, as a java.util.Date object. Returns null if no date is available. @return Card expiration date.
[ "Gets", "the", "card", "expiration", "date", "as", "a", "java", ".", "util", ".", "Date", "object", ".", "Returns", "null", "if", "no", "date", "is", "available", "." ]
75238a84bbfdfe9163a70fd5673cba627e8972b6
https://github.com/sualeh/credit_card_number/blob/75238a84bbfdfe9163a70fd5673cba627e8972b6/src/main/java/us/fatehi/creditcardnumber/ExpirationDate.java#L175-L190
38,003
sababado/CircularView
library/src/main/java/com/sababado/circularview/CircularViewCursorAdapter.java
CircularViewCursorAdapter.getItem
public Cursor getItem(int position) { if (mDataValid && mCursor != null) { mCursor.moveToPosition(position); return mCursor; } else { return null; } }
java
public Cursor getItem(int position) { if (mDataValid && mCursor != null) { mCursor.moveToPosition(position); return mCursor; } else { return null; } }
[ "public", "Cursor", "getItem", "(", "int", "position", ")", "{", "if", "(", "mDataValid", "&&", "mCursor", "!=", "null", ")", "{", "mCursor", ".", "moveToPosition", "(", "position", ")", ";", "return", "mCursor", ";", "}", "else", "{", "return", "null", ...
Returns a cursor pointed to the given position. @param position position to set on the cursor. @return a cursor set to the position.
[ "Returns", "a", "cursor", "pointed", "to", "the", "given", "position", "." ]
c9ab818d063bcc0796183616f8a82166a9b80aac
https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularViewCursorAdapter.java#L162-L169
38,004
francisdb/serviceloader-maven-plugin
src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java
ServiceloaderMojo.execute
public void execute() throws MojoExecutionException { if (skipProject()) { getLog().info("POM project detected; skipping"); }else { URLClassLoader classLoader = new URLClassLoader(generateClassPathUrls()); List<Class<?>> interfaceClasses = loadServiceClasses(classLoad...
java
public void execute() throws MojoExecutionException { if (skipProject()) { getLog().info("POM project detected; skipping"); }else { URLClassLoader classLoader = new URLClassLoader(generateClassPathUrls()); List<Class<?>> interfaceClasses = loadServiceClasses(classLoad...
[ "public", "void", "execute", "(", ")", "throws", "MojoExecutionException", "{", "if", "(", "skipProject", "(", ")", ")", "{", "getLog", "(", ")", ".", "info", "(", "\"POM project detected; skipping\"", ")", ";", "}", "else", "{", "URLClassLoader", "classLoader...
The main entry point for this Mojo. @throws MojoExecutionException
[ "The", "main", "entry", "point", "for", "this", "Mojo", "." ]
521a467ed5c00636749f6c6531be85ddf296565e
https://github.com/francisdb/serviceloader-maven-plugin/blob/521a467ed5c00636749f6c6531be85ddf296565e/src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java#L117-L126
38,005
francisdb/serviceloader-maven-plugin
src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java
ServiceloaderMojo.writeServiceFiles
private void writeServiceFiles( Map<String, List<String>> serviceImplementations) throws MojoExecutionException { // TODO give the user an option to write them to the source folder or // any other folder? File parentFolder = new File(getClassFolder(), "META-INF" + File.se...
java
private void writeServiceFiles( Map<String, List<String>> serviceImplementations) throws MojoExecutionException { // TODO give the user an option to write them to the source folder or // any other folder? File parentFolder = new File(getClassFolder(), "META-INF" + File.se...
[ "private", "void", "writeServiceFiles", "(", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "serviceImplementations", ")", "throws", "MojoExecutionException", "{", "// TODO give the user an option to write them to the source folder or", "// any other folder?", "F...
Writes the output for the service files to disk @param serviceImplementations @throws MojoExecutionException
[ "Writes", "the", "output", "for", "the", "service", "files", "to", "disk" ]
521a467ed5c00636749f6c6531be85ddf296565e
https://github.com/francisdb/serviceloader-maven-plugin/blob/521a467ed5c00636749f6c6531be85ddf296565e/src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java#L134-L167
38,006
francisdb/serviceloader-maven-plugin
src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java
ServiceloaderMojo.loadServiceClasses
private List<Class<?>> loadServiceClasses(ClassLoader loader) throws MojoExecutionException { List<Class<?>> serviceClasses = new ArrayList<Class<?>>(); for (String serviceClassName : getServices()) { try { Class<?> serviceClass = loader.loadClass(serviceClassName...
java
private List<Class<?>> loadServiceClasses(ClassLoader loader) throws MojoExecutionException { List<Class<?>> serviceClasses = new ArrayList<Class<?>>(); for (String serviceClassName : getServices()) { try { Class<?> serviceClass = loader.loadClass(serviceClassName...
[ "private", "List", "<", "Class", "<", "?", ">", ">", "loadServiceClasses", "(", "ClassLoader", "loader", ")", "throws", "MojoExecutionException", "{", "List", "<", "Class", "<", "?", ">", ">", "serviceClasses", "=", "new", "ArrayList", "<", "Class", "<", "...
Loads all interfaces using the provided ClassLoader @param loader the classloader @return thi List of Interface classes @throws MojoExecutionException is the interfaces are not interfaces or can not be found on the classpath
[ "Loads", "all", "interfaces", "using", "the", "provided", "ClassLoader" ]
521a467ed5c00636749f6c6531be85ddf296565e
https://github.com/francisdb/serviceloader-maven-plugin/blob/521a467ed5c00636749f6c6531be85ddf296565e/src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java#L178-L190
38,007
francisdb/serviceloader-maven-plugin
src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java
ServiceloaderMojo.findImplementations
private Map<String, List<String>> findImplementations(ClassLoader loader, List<Class<?>> interfaceClasses) throws MojoExecutionException { Map<String, List<String>> serviceImplementations = new HashMap<String, List<String>>(); for (String interfa...
java
private Map<String, List<String>> findImplementations(ClassLoader loader, List<Class<?>> interfaceClasses) throws MojoExecutionException { Map<String, List<String>> serviceImplementations = new HashMap<String, List<String>>(); for (String interfa...
[ "private", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "findImplementations", "(", "ClassLoader", "loader", ",", "List", "<", "Class", "<", "?", ">", ">", "interfaceClasses", ")", "throws", "MojoExecutionException", "{", "Map", "<", "String",...
Finds all implementations of interfaces in a folder @param loader @param interfaceClasses @return @throws MojoExecutionException
[ "Finds", "all", "implementations", "of", "interfaces", "in", "a", "folder" ]
521a467ed5c00636749f6c6531be85ddf296565e
https://github.com/francisdb/serviceloader-maven-plugin/blob/521a467ed5c00636749f6c6531be85ddf296565e/src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java#L200-L268
38,008
francisdb/serviceloader-maven-plugin
src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java
ServiceloaderMojo.listCompiledClasses
List<String> listCompiledClasses(final File classFolder) { List<String> classNames = new ArrayList<String>(); if (!classFolder.exists()) { getLog().info("Class folder does not exist; skipping scan"); return classNames; } final String extension = ".class"; ...
java
List<String> listCompiledClasses(final File classFolder) { List<String> classNames = new ArrayList<String>(); if (!classFolder.exists()) { getLog().info("Class folder does not exist; skipping scan"); return classNames; } final String extension = ".class"; ...
[ "List", "<", "String", ">", "listCompiledClasses", "(", "final", "File", "classFolder", ")", "{", "List", "<", "String", ">", "classNames", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "!", "classFolder", ".", "exists", "(", "...
Walks the classFolder and finds all classes @param classFolder the folder to scan for .class files @return the list of available class names
[ "Walks", "the", "classFolder", "and", "finds", "all", "classes" ]
521a467ed5c00636749f6c6531be85ddf296565e
https://github.com/francisdb/serviceloader-maven-plugin/blob/521a467ed5c00636749f6c6531be85ddf296565e/src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java#L276-L296
38,009
francisdb/serviceloader-maven-plugin
src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java
ServiceloaderMojo.listCompiledClassesRegex
private List<String> listCompiledClassesRegex(File classFolder) { List<String> classNames = new ArrayList<String>(); Stack<File> todo = new Stack<File>(); todo.push(classFolder); String classFolderPath = classFolder.getAbsolutePath(); getLog().info("ClassFolderPath=" + classFold...
java
private List<String> listCompiledClassesRegex(File classFolder) { List<String> classNames = new ArrayList<String>(); Stack<File> todo = new Stack<File>(); todo.push(classFolder); String classFolderPath = classFolder.getAbsolutePath(); getLog().info("ClassFolderPath=" + classFold...
[ "private", "List", "<", "String", ">", "listCompiledClassesRegex", "(", "File", "classFolder", ")", "{", "List", "<", "String", ">", "classNames", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "Stack", "<", "File", ">", "todo", "=", "new", ...
Walks the classFolder and finds all .class files @param classFolder @return the list of available class names
[ "Walks", "the", "classFolder", "and", "finds", "all", ".", "class", "files" ]
521a467ed5c00636749f6c6531be85ddf296565e
https://github.com/francisdb/serviceloader-maven-plugin/blob/521a467ed5c00636749f6c6531be85ddf296565e/src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java#L304-L333
38,010
kpelykh/docker-java
src/main/java/com/kpelykh/docker/client/DockerClient.java
DockerClient.auth
public void auth() throws DockerException { try { client.resource(restEndpointUrl + "/auth") .header("Content-Type", MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .post(authConfig()); } catch (UniformInterfaceException e) { throw new DockerException(e); } }
java
public void auth() throws DockerException { try { client.resource(restEndpointUrl + "/auth") .header("Content-Type", MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .post(authConfig()); } catch (UniformInterfaceException e) { throw new DockerException(e); } }
[ "public", "void", "auth", "(", ")", "throws", "DockerException", "{", "try", "{", "client", ".", "resource", "(", "restEndpointUrl", "+", "\"/auth\"", ")", ".", "header", "(", "\"Content-Type\"", ",", "MediaType", ".", "APPLICATION_JSON", ")", ".", "accept", ...
Authenticate with the server, useful for checking authentication.
[ "Authenticate", "with", "the", "server", "useful", "for", "checking", "authentication", "." ]
26b4069bb1985a8c293a016aaf9b56979771d75b
https://github.com/kpelykh/docker-java/blob/26b4069bb1985a8c293a016aaf9b56979771d75b/src/main/java/com/kpelykh/docker/client/DockerClient.java#L118-L127
38,011
kpelykh/docker-java
src/main/java/com/kpelykh/docker/client/DockerClient.java
DockerClient.push
public ClientResponse push(final String name) throws DockerException { if (name == null) { throw new IllegalArgumentException("name is null"); } try { final String registryAuth = registryAuth(); return client.resource(restEndpointUrl + "/images/" + name(name) + "/push") .header("X-Registry-Auth", re...
java
public ClientResponse push(final String name) throws DockerException { if (name == null) { throw new IllegalArgumentException("name is null"); } try { final String registryAuth = registryAuth(); return client.resource(restEndpointUrl + "/images/" + name(name) + "/push") .header("X-Registry-Auth", re...
[ "public", "ClientResponse", "push", "(", "final", "String", "name", ")", "throws", "DockerException", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"name is null\"", ")", ";", "}", "try", "{", "final", "St...
Push the latest image to the repository. @param name The name, e.g. "alexec/busybox" or just "busybox" if you want to default. Not null.
[ "Push", "the", "latest", "image", "to", "the", "repository", "." ]
26b4069bb1985a8c293a016aaf9b56979771d75b
https://github.com/kpelykh/docker-java/blob/26b4069bb1985a8c293a016aaf9b56979771d75b/src/main/java/com/kpelykh/docker/client/DockerClient.java#L277-L290
38,012
kpelykh/docker-java
src/main/java/com/kpelykh/docker/client/DockerClient.java
DockerClient.tag
public int tag(String image, String repository, String tag, boolean force) throws DockerException { Preconditions.checkNotNull(image, "image was not specified"); Preconditions.checkNotNull(repository, "repository was not specified"); Preconditions.checkNotNull(tag, " tag was not provided"); MultivaluedMap<Stri...
java
public int tag(String image, String repository, String tag, boolean force) throws DockerException { Preconditions.checkNotNull(image, "image was not specified"); Preconditions.checkNotNull(repository, "repository was not specified"); Preconditions.checkNotNull(tag, " tag was not provided"); MultivaluedMap<Stri...
[ "public", "int", "tag", "(", "String", "image", ",", "String", "repository", ",", "String", "tag", ",", "boolean", "force", ")", "throws", "DockerException", "{", "Preconditions", ".", "checkNotNull", "(", "image", ",", "\"image was not specified\"", ")", ";", ...
Tag an image into a repository @param image the local image to tag (either a name or an id) @param repository the repository to tag in @param tag any tag for this image @param force (not documented) @return the HTTP status code (201 for success)
[ "Tag", "an", "image", "into", "a", "repository" ]
26b4069bb1985a8c293a016aaf9b56979771d75b
https://github.com/kpelykh/docker-java/blob/26b4069bb1985a8c293a016aaf9b56979771d75b/src/main/java/com/kpelykh/docker/client/DockerClient.java#L305-L324
38,013
kpelykh/docker-java
src/main/java/com/kpelykh/docker/client/DockerClient.java
DockerClient.importImage
public ImageCreateResponse importImage(String repository, String tag, InputStream imageStream) throws DockerException { Preconditions.checkNotNull(repository, "Repository was not specified"); Preconditions.checkNotNull(imageStream, "imageStream was not provided"); MultivaluedMap<String, String> params = new Mult...
java
public ImageCreateResponse importImage(String repository, String tag, InputStream imageStream) throws DockerException { Preconditions.checkNotNull(repository, "Repository was not specified"); Preconditions.checkNotNull(imageStream, "imageStream was not provided"); MultivaluedMap<String, String> params = new Mult...
[ "public", "ImageCreateResponse", "importImage", "(", "String", "repository", ",", "String", "tag", ",", "InputStream", "imageStream", ")", "throws", "DockerException", "{", "Preconditions", ".", "checkNotNull", "(", "repository", ",", "\"Repository was not specified\"", ...
Create an image by importing the given stream of a tar file. @param repository the repository to import to @param tag any tag for this image @param imageStream the InputStream of the tar file @return an {@link ImageCreateResponse} containing the id of the imported image @throws DockerException if the import f...
[ "Create", "an", "image", "by", "importing", "the", "given", "stream", "of", "a", "tar", "file", "." ]
26b4069bb1985a8c293a016aaf9b56979771d75b
https://github.com/kpelykh/docker-java/blob/26b4069bb1985a8c293a016aaf9b56979771d75b/src/main/java/com/kpelykh/docker/client/DockerClient.java#L335-L357
38,014
kpelykh/docker-java
src/main/java/com/kpelykh/docker/client/DockerClient.java
DockerClient.removeImage
public void removeImage(String imageId) throws DockerException { Preconditions.checkState(!StringUtils.isEmpty(imageId), "Image ID can't be empty"); try { WebResource webResource = client.resource(restEndpointUrl + "/images/" + imageId) .queryParam("force", "true"); LOGGER.trace("DELETE: {}", webResourc...
java
public void removeImage(String imageId) throws DockerException { Preconditions.checkState(!StringUtils.isEmpty(imageId), "Image ID can't be empty"); try { WebResource webResource = client.resource(restEndpointUrl + "/images/" + imageId) .queryParam("force", "true"); LOGGER.trace("DELETE: {}", webResourc...
[ "public", "void", "removeImage", "(", "String", "imageId", ")", "throws", "DockerException", "{", "Preconditions", ".", "checkState", "(", "!", "StringUtils", ".", "isEmpty", "(", "imageId", ")", ",", "\"Image ID can't be empty\"", ")", ";", "try", "{", "WebReso...
Remove an image, deleting any tags it might have.
[ "Remove", "an", "image", "deleting", "any", "tags", "it", "might", "have", "." ]
26b4069bb1985a8c293a016aaf9b56979771d75b
https://github.com/kpelykh/docker-java/blob/26b4069bb1985a8c293a016aaf9b56979771d75b/src/main/java/com/kpelykh/docker/client/DockerClient.java#L377-L400
38,015
HolmesNL/kafka-spout
src/main/java/nl/minvenj/nfi/storm/kafka/KafkaSpout.java
KafkaSpout.fillBuffer
protected boolean fillBuffer() { if (!_inProgress.isEmpty() || !_queue.isEmpty()) { throw new IllegalStateException("cannot fill buffer when buffer or pending messages are non-empty"); } if (_iterator == null) { // create a stream of messages from _consumer using the str...
java
protected boolean fillBuffer() { if (!_inProgress.isEmpty() || !_queue.isEmpty()) { throw new IllegalStateException("cannot fill buffer when buffer or pending messages are non-empty"); } if (_iterator == null) { // create a stream of messages from _consumer using the str...
[ "protected", "boolean", "fillBuffer", "(", ")", "{", "if", "(", "!", "_inProgress", ".", "isEmpty", "(", ")", "||", "!", "_queue", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"cannot fill buffer when buffer or pending mess...
Refills the buffer with messages from the configured kafka topic if available. @return Whether the buffer contains messages to be emitted after this call. @throws IllegalStateException When current buffer is not empty or messages not acknowledged by topology.
[ "Refills", "the", "buffer", "with", "messages", "from", "the", "configured", "kafka", "topic", "if", "available", "." ]
bef626b9fab6946a7e0d3c85979ec36ae0870233
https://github.com/HolmesNL/kafka-spout/blob/bef626b9fab6946a7e0d3c85979ec36ae0870233/src/main/java/nl/minvenj/nfi/storm/kafka/KafkaSpout.java#L185-L226
38,016
HolmesNL/kafka-spout
src/main/java/nl/minvenj/nfi/storm/kafka/util/ConfigUtils.java
ConfigUtils.checkConfigSanity
public static void checkConfigSanity(final Properties config) { // auto-committing offsets should be disabled final Object autoCommit = config.getProperty("auto.commit.enable"); if (autoCommit == null || Boolean.parseBoolean(String.valueOf(autoCommit))) { throw new IllegalArgumentExc...
java
public static void checkConfigSanity(final Properties config) { // auto-committing offsets should be disabled final Object autoCommit = config.getProperty("auto.commit.enable"); if (autoCommit == null || Boolean.parseBoolean(String.valueOf(autoCommit))) { throw new IllegalArgumentExc...
[ "public", "static", "void", "checkConfigSanity", "(", "final", "Properties", "config", ")", "{", "// auto-committing offsets should be disabled", "final", "Object", "autoCommit", "=", "config", ".", "getProperty", "(", "\"auto.commit.enable\"", ")", ";", "if", "(", "a...
Checks the sanity of a kafka consumer configuration for use in storm. @param config The configuration parameters to check. @throws IllegalArgumentException When a sanity check fails.
[ "Checks", "the", "sanity", "of", "a", "kafka", "consumer", "configuration", "for", "use", "in", "storm", "." ]
bef626b9fab6946a7e0d3c85979ec36ae0870233
https://github.com/HolmesNL/kafka-spout/blob/bef626b9fab6946a7e0d3c85979ec36ae0870233/src/main/java/nl/minvenj/nfi/storm/kafka/util/ConfigUtils.java#L311-L323
38,017
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/resource/ClassPathResource.java
ClassPathResource.resolveURL
protected URL resolveURL() { if (this.clazz != null) { return this.clazz.getResource(this.path); } else if (this.classLoader != null) { return this.classLoader.getResource(this.path); } else { return ClassLoader.getSystemResource(this.path); } }
java
protected URL resolveURL() { if (this.clazz != null) { return this.clazz.getResource(this.path); } else if (this.classLoader != null) { return this.classLoader.getResource(this.path); } else { return ClassLoader.getSystemResource(this.path); } }
[ "protected", "URL", "resolveURL", "(", ")", "{", "if", "(", "this", ".", "clazz", "!=", "null", ")", "{", "return", "this", ".", "clazz", ".", "getResource", "(", "this", ".", "path", ")", ";", "}", "else", "if", "(", "this", ".", "classLoader", "!...
Resolves a URL for the underlying class path resource. @return the resolved URL, or {@code null} if not resolvable
[ "Resolves", "a", "URL", "for", "the", "underlying", "class", "path", "resource", "." ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/resource/ClassPathResource.java#L141-L151
38,018
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/resource/ClassPathResource.java
ClassPathResource.getURL
@Override public URL getURL() throws IOException { URL url = resolveURL(); if (url == null) { throw new FileNotFoundException(getDescription() + " cannot be resolved to URL because it does not exist"); } return url; }
java
@Override public URL getURL() throws IOException { URL url = resolveURL(); if (url == null) { throw new FileNotFoundException(getDescription() + " cannot be resolved to URL because it does not exist"); } return url; }
[ "@", "Override", "public", "URL", "getURL", "(", ")", "throws", "IOException", "{", "URL", "url", "=", "resolveURL", "(", ")", ";", "if", "(", "url", "==", "null", ")", "{", "throw", "new", "FileNotFoundException", "(", "getDescription", "(", ")", "+", ...
This implementation returns a URL for the underlying class path resource, if available. @see java.lang.ClassLoader#getResource(String) @see java.lang.Class#getResource(String)
[ "This", "implementation", "returns", "a", "URL", "for", "the", "underlying", "class", "path", "resource", "if", "available", "." ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/resource/ClassPathResource.java#L182-L189
38,019
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java
AnnotationUtils.adaptValue
static Object adaptValue(Object value, boolean classValuesAsString, boolean nestedAnnotationsAsMap) { if (classValuesAsString) { if (value instanceof Class) { value = ((Class<?>) value).getName(); } else if (value instanceof Class[]) { Class<?>[] clazzArray = (Class[]) value; String[] newValue = ...
java
static Object adaptValue(Object value, boolean classValuesAsString, boolean nestedAnnotationsAsMap) { if (classValuesAsString) { if (value instanceof Class) { value = ((Class<?>) value).getName(); } else if (value instanceof Class[]) { Class<?>[] clazzArray = (Class[]) value; String[] newValue = ...
[ "static", "Object", "adaptValue", "(", "Object", "value", ",", "boolean", "classValuesAsString", ",", "boolean", "nestedAnnotationsAsMap", ")", "{", "if", "(", "classValuesAsString", ")", "{", "if", "(", "value", "instanceof", "Class", ")", "{", "value", "=", ...
Adapt the given value according to the given class and nested annotation settings. @param value the annotation attribute value @param classValuesAsString whether to turn Class references into Strings (for compatibility with {@link com.freetmp.common.type.AnnotatedTypeMetadata} or to preserve them as Class references @p...
[ "Adapt", "the", "given", "value", "according", "to", "the", "given", "class", "and", "nested", "annotation", "settings", "." ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L588-L616
38,020
beihaifeiwu/dolphin
xmbg-maven-plugin/src/main/java/com/freetmp/maven/mbg/extend/plugin/MyBatisGeneratorMojo.java
MyBatisGeneratorMojo.extendCG
private void extendCG(Configuration config, List<Context> contexts) { // just use the extended comment generator PluginConfiguration pluginConfiguration = new PluginConfiguration(); pluginConfiguration.setConfigurationType(CommentsWavePlugin.class.getTypeName()); addToContext(contexts, pluginConfigurat...
java
private void extendCG(Configuration config, List<Context> contexts) { // just use the extended comment generator PluginConfiguration pluginConfiguration = new PluginConfiguration(); pluginConfiguration.setConfigurationType(CommentsWavePlugin.class.getTypeName()); addToContext(contexts, pluginConfigurat...
[ "private", "void", "extendCG", "(", "Configuration", "config", ",", "List", "<", "Context", ">", "contexts", ")", "{", "// just use the extended comment generator", "PluginConfiguration", "pluginConfiguration", "=", "new", "PluginConfiguration", "(", ")", ";", "pluginCo...
extend origin mbg the ability for generating comments
[ "extend", "origin", "mbg", "the", "ability", "for", "generating", "comments" ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/xmbg-maven-plugin/src/main/java/com/freetmp/maven/mbg/extend/plugin/MyBatisGeneratorMojo.java#L392-L413
38,021
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/AbstractMerger.java
AbstractMerger.getMerger
public static <T extends Node> AbstractMerger<T> getMerger(Class<T> clazz) { AbstractMerger<T> merger = null; Class<?> type = clazz; while (merger == null && type != null) { merger = map.get(type); type = type.getSuperclass(); } return merger; }
java
public static <T extends Node> AbstractMerger<T> getMerger(Class<T> clazz) { AbstractMerger<T> merger = null; Class<?> type = clazz; while (merger == null && type != null) { merger = map.get(type); type = type.getSuperclass(); } return merger; }
[ "public", "static", "<", "T", "extends", "Node", ">", "AbstractMerger", "<", "T", ">", "getMerger", "(", "Class", "<", "T", ">", "clazz", ")", "{", "AbstractMerger", "<", "T", ">", "merger", "=", "null", ";", "Class", "<", "?", ">", "type", "=", "c...
first check if mapper of the type T exist, if existed return it else check if mapper of the supper type exist, then return it @param <T> the generic type which extends from Node @param clazz The class of type T @return null if not found else the merger of the type T
[ "first", "check", "if", "mapper", "of", "the", "type", "T", "exist", "if", "existed", "return", "it", "else", "check", "if", "mapper", "of", "the", "supper", "type", "exist", "then", "return", "it" ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/AbstractMerger.java#L336-L348
38,022
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/expression/NormalAnnotationExprMerger.java
NormalAnnotationExprMerger.doIsEquals
@Override public boolean doIsEquals(NormalAnnotationExpr first, NormalAnnotationExpr second) { boolean equals = true; if (!first.getName().equals(second.getName())) equals = false; if (equals == true) { if (first.getPairs() == null) return second.getPairs() == null; if (!isSmallerHasEqual...
java
@Override public boolean doIsEquals(NormalAnnotationExpr first, NormalAnnotationExpr second) { boolean equals = true; if (!first.getName().equals(second.getName())) equals = false; if (equals == true) { if (first.getPairs() == null) return second.getPairs() == null; if (!isSmallerHasEqual...
[ "@", "Override", "public", "boolean", "doIsEquals", "(", "NormalAnnotationExpr", "first", ",", "NormalAnnotationExpr", "second", ")", "{", "boolean", "equals", "=", "true", ";", "if", "(", "!", "first", ".", "getName", "(", ")", ".", "equals", "(", "second",...
1. check the name 2. check the member including key and value if their size is not the same and the less one is all matched in the more one return true
[ "1", ".", "check", "the", "name", "2", ".", "check", "the", "member", "including", "key", "and", "value", "if", "their", "size", "is", "not", "the", "same", "and", "the", "less", "one", "is", "all", "matched", "in", "the", "more", "one", "return", "t...
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/expression/NormalAnnotationExprMerger.java#L29-L45
38,023
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/CompilationUnitMerger.java
CompilationUnitMerger.merge
public static String merge(String first, String second) throws ParseException { JavaParser.setDoNotAssignCommentsPreceedingEmptyLines(false); CompilationUnit cu1 = JavaParser.parse(new StringReader(first), true); CompilationUnit cu2 = JavaParser.parse(new StringReader(second), true); AbstractMerger<Com...
java
public static String merge(String first, String second) throws ParseException { JavaParser.setDoNotAssignCommentsPreceedingEmptyLines(false); CompilationUnit cu1 = JavaParser.parse(new StringReader(first), true); CompilationUnit cu2 = JavaParser.parse(new StringReader(second), true); AbstractMerger<Com...
[ "public", "static", "String", "merge", "(", "String", "first", ",", "String", "second", ")", "throws", "ParseException", "{", "JavaParser", ".", "setDoNotAssignCommentsPreceedingEmptyLines", "(", "false", ")", ";", "CompilationUnit", "cu1", "=", "JavaParser", ".", ...
Util method to make source merge more convenient @param first merge params, specifically for the existing source @param second merge params, specifically for the new source @return merged result @throws ParseException cannot parse the input params
[ "Util", "method", "to", "make", "source", "merge", "more", "convenient" ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/CompilationUnitMerger.java#L57-L65
38,024
orhanobut/mockwebserverplus
mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/Fixture.java
Fixture.parseFrom
public static Fixture parseFrom(String fileName, Parser parser) { if (fileName == null) { throw new NullPointerException("File name should not be null"); } String path = "fixtures/" + fileName + ".yaml"; InputStream inputStream = openPathAsStream(path); Fixture result = parser.parse(inputStrea...
java
public static Fixture parseFrom(String fileName, Parser parser) { if (fileName == null) { throw new NullPointerException("File name should not be null"); } String path = "fixtures/" + fileName + ".yaml"; InputStream inputStream = openPathAsStream(path); Fixture result = parser.parse(inputStrea...
[ "public", "static", "Fixture", "parseFrom", "(", "String", "fileName", ",", "Parser", "parser", ")", "{", "if", "(", "fileName", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"File name should not be null\"", ")", ";", "}", "String", "...
Parse the given filename and returns the Fixture object. @param fileName filename should not contain extension or relative path. ie: login @param parser parser is required for parsing operation, it should not be null
[ "Parse", "the", "given", "filename", "and", "returns", "the", "Fixture", "object", "." ]
bb2c5cb4eece98745688ec562486b6bfc5d1b6c7
https://github.com/orhanobut/mockwebserverplus/blob/bb2c5cb4eece98745688ec562486b6bfc5d1b6c7/mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/Fixture.java#L38-L55
38,025
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/core/OrderComparator.java
OrderComparator.withSourceProvider
public Comparator<Object> withSourceProvider(final OrderSourceProvider sourceProvider) { return new Comparator<Object>() { @Override public int compare(Object o1, Object o2) { return doCompare(o1, o2, sourceProvider); } }; }
java
public Comparator<Object> withSourceProvider(final OrderSourceProvider sourceProvider) { return new Comparator<Object>() { @Override public int compare(Object o1, Object o2) { return doCompare(o1, o2, sourceProvider); } }; }
[ "public", "Comparator", "<", "Object", ">", "withSourceProvider", "(", "final", "OrderSourceProvider", "sourceProvider", ")", "{", "return", "new", "Comparator", "<", "Object", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Object", "o1...
Build an adapted order comparator with the given soruce provider. @param sourceProvider the order source provider to use @return the adapted comparator @since 4.1
[ "Build", "an", "adapted", "order", "comparator", "with", "the", "given", "soruce", "provider", "." ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/core/OrderComparator.java#L52-L59
38,026
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java
StringHelper.collapse
public static String collapse(String name) { if (name == null) { return null; } int breakPoint = name.lastIndexOf('.'); if (breakPoint < 0) { return name; } return collapseQualifier(name.substring(0, breakPoint), true) + name.substring(breakPoint); // includes last '.' }
java
public static String collapse(String name) { if (name == null) { return null; } int breakPoint = name.lastIndexOf('.'); if (breakPoint < 0) { return name; } return collapseQualifier(name.substring(0, breakPoint), true) + name.substring(breakPoint); // includes last '.' }
[ "public", "static", "String", "collapse", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "null", ";", "}", "int", "breakPoint", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "breakPoint", ...
Collapses a name. Mainly intended for use with classnames, where an example might serve best to explain. Imagine you have a class named 'org.hibernate.internal.util.StringHelper'; calling collapse on that classname will result in 'o.h.u.StringHelper'. @param name The name to collapse. @return The collapsed name.
[ "Collapses", "a", "name", ".", "Mainly", "intended", "for", "use", "with", "classnames", "where", "an", "example", "might", "serve", "best", "to", "explain", ".", "Imagine", "you", "have", "a", "class", "named", "org", ".", "hibernate", ".", "internal", "....
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java#L232-L241
38,027
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java
StringHelper.collapseQualifier
public static String collapseQualifier(String qualifier, boolean includeDots) { StringTokenizer tokenizer = new StringTokenizer(qualifier, "."); String collapsed = Character.toString(tokenizer.nextToken().charAt(0)); while (tokenizer.hasMoreTokens()) { if (includeDots) { collapsed += '.'; ...
java
public static String collapseQualifier(String qualifier, boolean includeDots) { StringTokenizer tokenizer = new StringTokenizer(qualifier, "."); String collapsed = Character.toString(tokenizer.nextToken().charAt(0)); while (tokenizer.hasMoreTokens()) { if (includeDots) { collapsed += '.'; ...
[ "public", "static", "String", "collapseQualifier", "(", "String", "qualifier", ",", "boolean", "includeDots", ")", "{", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "qualifier", ",", "\".\"", ")", ";", "String", "collapsed", "=", "Character"...
Given a qualifier, collapse it. @param qualifier The qualifier to collapse. @param includeDots Should we include the dots in the collapsed form? @return The collapsed form.
[ "Given", "a", "qualifier", "collapse", "it", "." ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java#L250-L260
38,028
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java
StringHelper.partiallyUnqualify
public static String partiallyUnqualify(String name, String qualifierBase) { if (name == null || !name.startsWith(qualifierBase)) { return name; } return name.substring(qualifierBase.length() + 1); // +1 to start after the following '.' }
java
public static String partiallyUnqualify(String name, String qualifierBase) { if (name == null || !name.startsWith(qualifierBase)) { return name; } return name.substring(qualifierBase.length() + 1); // +1 to start after the following '.' }
[ "public", "static", "String", "partiallyUnqualify", "(", "String", "name", ",", "String", "qualifierBase", ")", "{", "if", "(", "name", "==", "null", "||", "!", "name", ".", "startsWith", "(", "qualifierBase", ")", ")", "{", "return", "name", ";", "}", "...
Partially unqualifies a qualified name. For example, with a base of 'org.hibernate' the name 'org.hibernate.internal.util.StringHelper' would become 'util.StringHelper'. @param name The (potentially) qualified name. @param qualifierBase The qualifier base. @return The name itself, or the partially unqualifie...
[ "Partially", "unqualifies", "a", "qualified", "name", ".", "For", "example", "with", "a", "base", "of", "org", ".", "hibernate", "the", "name", "org", ".", "hibernate", ".", "internal", ".", "util", ".", "StringHelper", "would", "become", "util", ".", "Str...
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java#L270-L275
38,029
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java
StringHelper.cleanAlias
private static String cleanAlias(String alias) { char[] chars = alias.toCharArray(); // short cut check... if (!Character.isLetter(chars[0])) { for (int i = 1; i < chars.length; i++) { // as soon as we encounter our first letter, return the substring // from that position if (C...
java
private static String cleanAlias(String alias) { char[] chars = alias.toCharArray(); // short cut check... if (!Character.isLetter(chars[0])) { for (int i = 1; i < chars.length; i++) { // as soon as we encounter our first letter, return the substring // from that position if (C...
[ "private", "static", "String", "cleanAlias", "(", "String", "alias", ")", "{", "char", "[", "]", "chars", "=", "alias", ".", "toCharArray", "(", ")", ";", "// short cut check...", "if", "(", "!", "Character", ".", "isLetter", "(", "chars", "[", "0", "]",...
Clean the generated alias by removing any non-alpha characters from the beginning. @param alias The generated alias to be cleaned. @return The cleaned alias, stripped of any leading non-alpha characters.
[ "Clean", "the", "generated", "alias", "by", "removing", "any", "non", "-", "alpha", "characters", "from", "the", "beginning", "." ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java#L495-L508
38,030
sinetja/jauter
src/main/java/jauter/Router.java
Router.path
public String path(M method, T target, Object... params) { MethodlessRouter<T> router = (method == null)? anyMethodRouter : routers.get(method); if (router == null) router = anyMethodRouter; String ret = router.path(target, params); if (ret != null) return ret; return (router == anyMethodRouter)? ...
java
public String path(M method, T target, Object... params) { MethodlessRouter<T> router = (method == null)? anyMethodRouter : routers.get(method); if (router == null) router = anyMethodRouter; String ret = router.path(target, params); if (ret != null) return ret; return (router == anyMethodRouter)? ...
[ "public", "String", "path", "(", "M", "method", ",", "T", "target", ",", "Object", "...", "params", ")", "{", "MethodlessRouter", "<", "T", ">", "router", "=", "(", "method", "==", "null", ")", "?", "anyMethodRouter", ":", "routers", ".", "get", "(", ...
Reverse routing.
[ "Reverse", "routing", "." ]
ae8d97d6e2ddfec6e888b1b375aff8cd69392ec8
https://github.com/sinetja/jauter/blob/ae8d97d6e2ddfec6e888b1b375aff8cd69392ec8/src/main/java/jauter/Router.java#L102-L110
38,031
alexvasilkov/AndroidCommons
library/src/main/java/com/alexvasilkov/android/commons/converters/ConvertUtils.java
ConvertUtils.convert
public static <T, P extends Convertable<T>> T convert(P value) throws ParseException { return value == null ? null : value.convert(); }
java
public static <T, P extends Convertable<T>> T convert(P value) throws ParseException { return value == null ? null : value.convert(); }
[ "public", "static", "<", "T", ",", "P", "extends", "Convertable", "<", "T", ">", ">", "T", "convert", "(", "P", "value", ")", "throws", "ParseException", "{", "return", "value", "==", "null", "?", "null", ":", "value", ".", "convert", "(", ")", ";", ...
Converting single item if it is not null.
[ "Converting", "single", "item", "if", "it", "is", "not", "null", "." ]
aca9f6d5acfc6bd3694984b7f89956e1a0146ddb
https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/converters/ConvertUtils.java#L21-L23
38,032
alexvasilkov/AndroidCommons
library/src/main/java/com/alexvasilkov/android/commons/converters/ConvertUtils.java
ConvertUtils.create
public static <IN, OUT> OUT create(IN obj, Creator<IN, OUT> creator) { return obj == null ? null : creator.create(obj); }
java
public static <IN, OUT> OUT create(IN obj, Creator<IN, OUT> creator) { return obj == null ? null : creator.create(obj); }
[ "public", "static", "<", "IN", ",", "OUT", ">", "OUT", "create", "(", "IN", "obj", ",", "Creator", "<", "IN", ",", "OUT", ">", "creator", ")", "{", "return", "obj", "==", "null", "?", "null", ":", "creator", ".", "create", "(", "obj", ")", ";", ...
Creates output object using provided creator. Returns null if obj null.
[ "Creates", "output", "object", "using", "provided", "creator", ".", "Returns", "null", "if", "obj", "null", "." ]
aca9f6d5acfc6bd3694984b7f89956e1a0146ddb
https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/converters/ConvertUtils.java#L124-L126
38,033
sinetja/jauter
src/main/java/jauter/Routed.java
Routed.instanceFromTarget
public static Object instanceFromTarget(Object target) throws InstantiationException, IllegalAccessException { if (target == null) return null; if (target instanceof Class) { // Create handler from class Class<?> klass = (Class<?>) target; return klass.newInstance(); } else { return...
java
public static Object instanceFromTarget(Object target) throws InstantiationException, IllegalAccessException { if (target == null) return null; if (target instanceof Class) { // Create handler from class Class<?> klass = (Class<?>) target; return klass.newInstance(); } else { return...
[ "public", "static", "Object", "instanceFromTarget", "(", "Object", "target", ")", "throws", "InstantiationException", ",", "IllegalAccessException", "{", "if", "(", "target", "==", "null", ")", "return", "null", ";", "if", "(", "target", "instanceof", "Class", "...
When target is a class, this method calls "newInstance" on the class. Otherwise it returns the target as is. @return null if target is null
[ "When", "target", "is", "a", "class", "this", "method", "calls", "newInstance", "on", "the", "class", ".", "Otherwise", "it", "returns", "the", "target", "as", "is", "." ]
ae8d97d6e2ddfec6e888b1b375aff8cd69392ec8
https://github.com/sinetja/jauter/blob/ae8d97d6e2ddfec6e888b1b375aff8cd69392ec8/src/main/java/jauter/Routed.java#L34-L44
38,034
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/asm/Type.java
Type.getDescriptor
private void getDescriptor(final StringBuilder sb) { if (this.buf == null) { // descriptor is in byte 3 of 'off' for primitive types (buf == // null) sb.append((char) ((off & 0xFF000000) >>> 24)); } else if (sort == OBJECT) { sb.append('L'); sb...
java
private void getDescriptor(final StringBuilder sb) { if (this.buf == null) { // descriptor is in byte 3 of 'off' for primitive types (buf == // null) sb.append((char) ((off & 0xFF000000) >>> 24)); } else if (sort == OBJECT) { sb.append('L'); sb...
[ "private", "void", "getDescriptor", "(", "final", "StringBuilder", "sb", ")", "{", "if", "(", "this", ".", "buf", "==", "null", ")", "{", "// descriptor is in byte 3 of 'off' for primitive types (buf ==", "// null)", "sb", ".", "append", "(", "(", "char", ")", "...
Appends the descriptor corresponding to this Java type to the given string builder. @param sb the string builder to which the descriptor must be appended.
[ "Appends", "the", "descriptor", "corresponding", "to", "this", "Java", "type", "to", "the", "given", "string", "builder", "." ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/asm/Type.java#L663-L675
38,035
alexvasilkov/AndroidCommons
library/src/main/java/com/alexvasilkov/android/commons/ui/KeyboardHelper.java
KeyboardHelper.showSoftKeyboard
public static void showSoftKeyboard(Context context, View view) { if (view == null) { return; } final InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); view.requestFocus(); manager.showSoftInput(...
java
public static void showSoftKeyboard(Context context, View view) { if (view == null) { return; } final InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); view.requestFocus(); manager.showSoftInput(...
[ "public", "static", "void", "showSoftKeyboard", "(", "Context", "context", ",", "View", "view", ")", "{", "if", "(", "view", "==", "null", ")", "{", "return", ";", "}", "final", "InputMethodManager", "manager", "=", "(", "InputMethodManager", ")", "context",...
Shows soft keyboard and requests focus for given view.
[ "Shows", "soft", "keyboard", "and", "requests", "focus", "for", "given", "view", "." ]
aca9f6d5acfc6bd3694984b7f89956e1a0146ddb
https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/ui/KeyboardHelper.java#L49-L58
38,036
orhanobut/mockwebserverplus
mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/MockWebServerPlus.java
MockWebServerPlus.enqueue
public List<MockResponse> enqueue(String... paths) { if (paths == null) { return null; } List<MockResponse> mockResponseList = new ArrayList<>(); for (String path : paths) { Fixture fixture = Fixture.parseFrom(path, parser); MockResponse mockResponse = fixture.toMockResponse(); m...
java
public List<MockResponse> enqueue(String... paths) { if (paths == null) { return null; } List<MockResponse> mockResponseList = new ArrayList<>(); for (String path : paths) { Fixture fixture = Fixture.parseFrom(path, parser); MockResponse mockResponse = fixture.toMockResponse(); m...
[ "public", "List", "<", "MockResponse", ">", "enqueue", "(", "String", "...", "paths", ")", "{", "if", "(", "paths", "==", "null", ")", "{", "return", "null", ";", "}", "List", "<", "MockResponse", ">", "mockResponseList", "=", "new", "ArrayList", "<>", ...
Given paths will be parsed to fixtures and added to the queue. Can be multiple
[ "Given", "paths", "will", "be", "parsed", "to", "fixtures", "and", "added", "to", "the", "queue", ".", "Can", "be", "multiple" ]
bb2c5cb4eece98745688ec562486b6bfc5d1b6c7
https://github.com/orhanobut/mockwebserverplus/blob/bb2c5cb4eece98745688ec562486b6bfc5d1b6c7/mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/MockWebServerPlus.java#L39-L51
38,037
orhanobut/mockwebserverplus
mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/MockWebServerPlus.java
MockWebServerPlus.enqueue
public MockResponse enqueue(SocketPolicy socketPolicy) { MockResponse mockResponse = new MockResponse().setSocketPolicy(socketPolicy); mockWebServer.enqueue(mockResponse); return mockResponse; }
java
public MockResponse enqueue(SocketPolicy socketPolicy) { MockResponse mockResponse = new MockResponse().setSocketPolicy(socketPolicy); mockWebServer.enqueue(mockResponse); return mockResponse; }
[ "public", "MockResponse", "enqueue", "(", "SocketPolicy", "socketPolicy", ")", "{", "MockResponse", "mockResponse", "=", "new", "MockResponse", "(", ")", ".", "setSocketPolicy", "(", "socketPolicy", ")", ";", "mockWebServer", ".", "enqueue", "(", "mockResponse", "...
Given policy will be enqueued as MockResponse
[ "Given", "policy", "will", "be", "enqueued", "as", "MockResponse" ]
bb2c5cb4eece98745688ec562486b6bfc5d1b6c7
https://github.com/orhanobut/mockwebserverplus/blob/bb2c5cb4eece98745688ec562486b6bfc5d1b6c7/mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/MockWebServerPlus.java#L56-L60
38,038
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/type/GenericCollectionTypeResolver.java
GenericCollectionTypeResolver.getMapValueReturnType
public static Class<?> getMapValueReturnType(Method method, int nestingLevel) { return ResolvableType.forMethodReturnType(method).getNested(nestingLevel).asMap().resolveGeneric(1); }
java
public static Class<?> getMapValueReturnType(Method method, int nestingLevel) { return ResolvableType.forMethodReturnType(method).getNested(nestingLevel).asMap().resolveGeneric(1); }
[ "public", "static", "Class", "<", "?", ">", "getMapValueReturnType", "(", "Method", "method", ",", "int", "nestingLevel", ")", "{", "return", "ResolvableType", ".", "forMethodReturnType", "(", "method", ")", ".", "getNested", "(", "nestingLevel", ")", ".", "as...
Determine the generic value type of the given Map return type. @param method the method to check the return type for @param nestingLevel the nesting level of the target type (typically 1; e.g. in case of a List of Lists, 1 would indicate the nested List, whereas 2 would indicate the element of the nested List) @return ...
[ "Determine", "the", "generic", "value", "type", "of", "the", "given", "Map", "return", "type", "." ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/type/GenericCollectionTypeResolver.java#L270-L272
38,039
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/upsert/AbstractUpsertPlugin.java
AbstractUpsertPlugin.addSingleUpsertToSqlMap
protected void addSingleUpsertToSqlMap(Document document, IntrospectedTable introspectedTable) { XmlElement update = new XmlElement("update"); update.addAttribute(new Attribute("id", UPSERT)); update.addAttribute(new Attribute("parameterType", "map")); generateSqlMapContent(introspectedTable, update); ...
java
protected void addSingleUpsertToSqlMap(Document document, IntrospectedTable introspectedTable) { XmlElement update = new XmlElement("update"); update.addAttribute(new Attribute("id", UPSERT)); update.addAttribute(new Attribute("parameterType", "map")); generateSqlMapContent(introspectedTable, update); ...
[ "protected", "void", "addSingleUpsertToSqlMap", "(", "Document", "document", ",", "IntrospectedTable", "introspectedTable", ")", "{", "XmlElement", "update", "=", "new", "XmlElement", "(", "\"update\"", ")", ";", "update", ".", "addAttribute", "(", "new", "Attribute...
add update xml element to mapper.xml for upsert @param document The generated xml mapper dom @param introspectedTable The metadata for database table
[ "add", "update", "xml", "element", "to", "mapper", ".", "xml", "for", "upsert" ]
b100579cc6986dce5eba5593ebb5fbae7bad9d1a
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/upsert/AbstractUpsertPlugin.java#L91-L99
38,040
alexvasilkov/AndroidCommons
library/src/main/java/com/alexvasilkov/android/commons/nav/Navigate.java
Navigate.start
public void start(Intent intent) { intent = setupIntent(intent); if (application != null) { // Extra flag is required when starting from application: intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); application.startActivity(intent); return; // No transiti...
java
public void start(Intent intent) { intent = setupIntent(intent); if (application != null) { // Extra flag is required when starting from application: intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); application.startActivity(intent); return; // No transiti...
[ "public", "void", "start", "(", "Intent", "intent", ")", "{", "intent", "=", "setupIntent", "(", "intent", ")", ";", "if", "(", "application", "!=", "null", ")", "{", "// Extra flag is required when starting from application:", "intent", ".", "addFlags", "(", "I...
Starts activity by intent.
[ "Starts", "activity", "by", "intent", "." ]
aca9f6d5acfc6bd3694984b7f89956e1a0146ddb
https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/nav/Navigate.java#L151-L182
38,041
alexvasilkov/AndroidCommons
library/src/main/java/com/alexvasilkov/android/commons/nav/Navigate.java
Navigate.finish
public void finish(int resultCode, Intent data) { Activity activity = getActivity(); activity.setResult(resultCode, data); activity.finish(); setTransition(true); }
java
public void finish(int resultCode, Intent data) { Activity activity = getActivity(); activity.setResult(resultCode, data); activity.finish(); setTransition(true); }
[ "public", "void", "finish", "(", "int", "resultCode", ",", "Intent", "data", ")", "{", "Activity", "activity", "=", "getActivity", "(", ")", ";", "activity", ".", "setResult", "(", "resultCode", ",", "data", ")", ";", "activity", ".", "finish", "(", ")",...
Finishes current activity with provided result code and data.
[ "Finishes", "current", "activity", "with", "provided", "result", "code", "and", "data", "." ]
aca9f6d5acfc6bd3694984b7f89956e1a0146ddb
https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/nav/Navigate.java#L249-L254
38,042
alexvasilkov/AndroidCommons
library/src/main/java/com/alexvasilkov/android/commons/nav/Navigate.java
Navigate.navigateUp
public void navigateUp(Intent intent) { intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); start(intent); finish(); }
java
public void navigateUp(Intent intent) { intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); start(intent); finish(); }
[ "public", "void", "navigateUp", "(", "Intent", "intent", ")", "{", "intent", ".", "setFlags", "(", "Intent", ".", "FLAG_ACTIVITY_CLEAR_TOP", "|", "Intent", ".", "FLAG_ACTIVITY_SINGLE_TOP", ")", ";", "start", "(", "intent", ")", ";", "finish", "(", ")", ";", ...
Navigates up to specified activity in the back stack skipping intermediate activities
[ "Navigates", "up", "to", "specified", "activity", "in", "the", "back", "stack", "skipping", "intermediate", "activities" ]
aca9f6d5acfc6bd3694984b7f89956e1a0146ddb
https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/nav/Navigate.java#L266-L270
38,043
advantageous/konf
src/main/java/io/advantageous/config/ConfigLoader.java
ConfigLoader.load
public static Config load(final String... resources) { final ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn"); try (final InputStream resourceAsStream = findResource("jjs-config-utils.js")) { engine.eval(new InputStreamReader(resourceAsStream)); loadReso...
java
public static Config load(final String... resources) { final ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn"); try (final InputStream resourceAsStream = findResource("jjs-config-utils.js")) { engine.eval(new InputStreamReader(resourceAsStream)); loadReso...
[ "public", "static", "Config", "load", "(", "final", "String", "...", "resources", ")", "{", "final", "ScriptEngine", "engine", "=", "new", "ScriptEngineManager", "(", ")", ".", "getEngineByName", "(", "\"nashorn\"", ")", ";", "try", "(", "final", "InputStream"...
Loads a config file. @param resources classpath resources to from which to load javascript @return Config.
[ "Loads", "a", "config", "file", "." ]
51f773fdee0467d8e4b3aaed3567b8b40b5ca9a7
https://github.com/advantageous/konf/blob/51f773fdee0467d8e4b3aaed3567b8b40b5ca9a7/src/main/java/io/advantageous/config/ConfigLoader.java#L77-L91
38,044
advantageous/konf
src/main/java/io/advantageous/config/ConfigFromObject.java
ConfigFromObject.parseDurationUsingTypeSafeSpec
private Duration parseDurationUsingTypeSafeSpec(final String path, final String durationString) { /* Check to see if any of the postfixes are at the end of the durationString. */ final Optional<Map.Entry<TimeUnit, List<String>>> entry = timeUnitMap.entrySet().stream() .filter(timeUnitLi...
java
private Duration parseDurationUsingTypeSafeSpec(final String path, final String durationString) { /* Check to see if any of the postfixes are at the end of the durationString. */ final Optional<Map.Entry<TimeUnit, List<String>>> entry = timeUnitMap.entrySet().stream() .filter(timeUnitLi...
[ "private", "Duration", "parseDurationUsingTypeSafeSpec", "(", "final", "String", "path", ",", "final", "String", "durationString", ")", "{", "/* Check to see if any of the postfixes are at the end of the durationString. */", "final", "Optional", "<", "Map", ".", "Entry", "<",...
Parses a string into duration type safe spec format if possible. @param path property path @param durationString duration string using "10 seconds", "10 days", etc. format from type safe. @return Duration parsed from typesafe config format.
[ "Parses", "a", "string", "into", "duration", "type", "safe", "spec", "format", "if", "possible", "." ]
51f773fdee0467d8e4b3aaed3567b8b40b5ca9a7
https://github.com/advantageous/konf/blob/51f773fdee0467d8e4b3aaed3567b8b40b5ca9a7/src/main/java/io/advantageous/config/ConfigFromObject.java#L381-L430
38,045
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/util/IO.java
IO.lowercaseLines
public static Set<String> lowercaseLines(final Class<?> origin, final String resource) throws IOException { return ImmutableSet.copyOf(new HashSet<String>() {{ readResource(origin, resource, new NullReturnLineProcessor() { @Override public boolean processLine(@Nonnull...
java
public static Set<String> lowercaseLines(final Class<?> origin, final String resource) throws IOException { return ImmutableSet.copyOf(new HashSet<String>() {{ readResource(origin, resource, new NullReturnLineProcessor() { @Override public boolean processLine(@Nonnull...
[ "public", "static", "Set", "<", "String", ">", "lowercaseLines", "(", "final", "Class", "<", "?", ">", "origin", ",", "final", "String", "resource", ")", "throws", "IOException", "{", "return", "ImmutableSet", ".", "copyOf", "(", "new", "HashSet", "<", "St...
Return a Set containing trimmed lowercaseLines read from a file, skipping comments.
[ "Return", "a", "Set", "containing", "trimmed", "lowercaseLines", "read", "from", "a", "file", "skipping", "comments", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/util/IO.java#L51-L63
38,046
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/util/IO.java
IO.lowercaseWordSet
public static ImmutableSet<String> lowercaseWordSet(final Class<?> origin, final String resource, final boolean eliminatePrepAndConj) throws IOException { return ImmutableSet.copyOf(new HashSet<String>() {{ readResource(origin, resource, new Nu...
java
public static ImmutableSet<String> lowercaseWordSet(final Class<?> origin, final String resource, final boolean eliminatePrepAndConj) throws IOException { return ImmutableSet.copyOf(new HashSet<String>() {{ readResource(origin, resource, new Nu...
[ "public", "static", "ImmutableSet", "<", "String", ">", "lowercaseWordSet", "(", "final", "Class", "<", "?", ">", "origin", ",", "final", "String", "resource", ",", "final", "boolean", "eliminatePrepAndConj", ")", "throws", "IOException", "{", "return", "Immutab...
Returns a Set containing only single words.
[ "Returns", "a", "Set", "containing", "only", "single", "words", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/util/IO.java#L81-L104
38,047
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/util/IO.java
IO.wordSet
public static ImmutableSet<String> wordSet(final Class<?> origin, final String resource) throws IOException { return ImmutableSet.copyOf(new HashSet<String>() {{ readResource(origin, resource, new NullReturnLineProcessor() { @Override public boolean processLine(@Nonnu...
java
public static ImmutableSet<String> wordSet(final Class<?> origin, final String resource) throws IOException { return ImmutableSet.copyOf(new HashSet<String>() {{ readResource(origin, resource, new NullReturnLineProcessor() { @Override public boolean processLine(@Nonnu...
[ "public", "static", "ImmutableSet", "<", "String", ">", "wordSet", "(", "final", "Class", "<", "?", ">", "origin", ",", "final", "String", "resource", ")", "throws", "IOException", "{", "return", "ImmutableSet", ".", "copyOf", "(", "new", "HashSet", "<", "...
Return a set containing all non-comment non-empty words.
[ "Return", "a", "set", "containing", "all", "non", "-", "comment", "non", "-", "empty", "words", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/util/IO.java#L107-L123
38,048
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/classifier/NameClassifier.java
NameClassifier.process
public void process(final NerResultSet resultSet) { final FeatureMap featureMap = conf.getFeatureMap(); if (conf.tracing) trace = new ArrayList<>(); // store the relationship of _phrases in memory for further use final Map<Phrase, Set<Phrase>> phraseInMemory = new HashMap<>(); ...
java
public void process(final NerResultSet resultSet) { final FeatureMap featureMap = conf.getFeatureMap(); if (conf.tracing) trace = new ArrayList<>(); // store the relationship of _phrases in memory for further use final Map<Phrase, Set<Phrase>> phraseInMemory = new HashMap<>(); ...
[ "public", "void", "process", "(", "final", "NerResultSet", "resultSet", ")", "{", "final", "FeatureMap", "featureMap", "=", "conf", ".", "getFeatureMap", "(", ")", ";", "if", "(", "conf", ".", "tracing", ")", "trace", "=", "new", "ArrayList", "<>", "(", ...
This method process the whole input result set and gives all _phrases in the set a name type - modifies the data of the passed in NerResultSet! @param resultSet set to process - modifies the data of the result set!
[ "This", "method", "process", "the", "whole", "input", "result", "set", "and", "gives", "all", "_phrases", "in", "the", "set", "a", "name", "type", "-", "modifies", "the", "data", "of", "the", "passed", "in", "NerResultSet!" ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/classifier/NameClassifier.java#L54-L102
38,049
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/util/Tokenizer.java
Tokenizer.process
public List<List<Token>> process(final String text) { final List<List<Token>> paragraph = new ArrayList<>(); currentSentence = new ArrayList<>(); final Tokens tokens = splitText(text); while (tokens.hasNext()) { final Token t = tokens.next(); final String trimmed...
java
public List<List<Token>> process(final String text) { final List<List<Token>> paragraph = new ArrayList<>(); currentSentence = new ArrayList<>(); final Tokens tokens = splitText(text); while (tokens.hasNext()) { final Token t = tokens.next(); final String trimmed...
[ "public", "List", "<", "List", "<", "Token", ">", ">", "process", "(", "final", "String", "text", ")", "{", "final", "List", "<", "List", "<", "Token", ">", ">", "paragraph", "=", "new", "ArrayList", "<>", "(", ")", ";", "currentSentence", "=", "new"...
Tokenize some text - not thread safe. @param text tokenize this @return tokenized text
[ "Tokenize", "some", "text", "-", "not", "thread", "safe", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/util/Tokenizer.java#L76-L111
38,050
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java
NameExtractor.detectNameWordInSentenceByPosition
private static boolean detectNameWordInSentenceByPosition(final List<Token> _text, final int _pos) { boolean isFirstWord = false; boolean nextWordIsName = false; if (_pos == 0 || !isLetterOrDigit((_text.get(_pos - 1).text.charAt(0)))) { isFirstWord = true; //noinspection ...
java
private static boolean detectNameWordInSentenceByPosition(final List<Token> _text, final int _pos) { boolean isFirstWord = false; boolean nextWordIsName = false; if (_pos == 0 || !isLetterOrDigit((_text.get(_pos - 1).text.charAt(0)))) { isFirstWord = true; //noinspection ...
[ "private", "static", "boolean", "detectNameWordInSentenceByPosition", "(", "final", "List", "<", "Token", ">", "_text", ",", "final", "int", "_pos", ")", "{", "boolean", "isFirstWord", "=", "false", ";", "boolean", "nextWordIsName", "=", "false", ";", "if", "(...
Detects if a particular word in a sentence is a name.
[ "Detects", "if", "a", "particular", "word", "in", "a", "sentence", "is", "a", "name", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java#L195-L223
38,051
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java
NameExtractor.isName
private static boolean isName(final String _text, final boolean isFirstWord, final boolean nextWordIsName) { if (hasManyCaps(_text)) return true; else if (startsWithCap(_text)) { if (isFirstWord) { // if the word is the first word in a sentence and // ends wit...
java
private static boolean isName(final String _text, final boolean isFirstWord, final boolean nextWordIsName) { if (hasManyCaps(_text)) return true; else if (startsWithCap(_text)) { if (isFirstWord) { // if the word is the first word in a sentence and // ends wit...
[ "private", "static", "boolean", "isName", "(", "final", "String", "_text", ",", "final", "boolean", "isFirstWord", ",", "final", "boolean", "nextWordIsName", ")", "{", "if", "(", "hasManyCaps", "(", "_text", ")", ")", "return", "true", ";", "else", "if", "...
This method detects a word if it is a potential name word.
[ "This", "method", "detects", "a", "word", "if", "it", "is", "a", "potential", "name", "word", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java#L226-L250
38,052
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java
NameExtractor.getAttachedPrep
private static void getAttachedPrep(final List<Token> sentenceToken, final List<Phrase> sentencePhrase, final int index) { final String prep; boolean nameSequenceMeetEnd = true; final Collection<Phrase> phraseSequence = new HashSet<>(); int phrase...
java
private static void getAttachedPrep(final List<Token> sentenceToken, final List<Phrase> sentencePhrase, final int index) { final String prep; boolean nameSequenceMeetEnd = true; final Collection<Phrase> phraseSequence = new HashSet<>(); int phrase...
[ "private", "static", "void", "getAttachedPrep", "(", "final", "List", "<", "Token", ">", "sentenceToken", ",", "final", "List", "<", "Phrase", ">", "sentencePhrase", ",", "final", "int", "index", ")", "{", "final", "String", "prep", ";", "boolean", "nameSequ...
This method will find all the attached preps of a phrase.
[ "This", "method", "will", "find", "all", "the", "attached", "preps", "of", "a", "phrase", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java#L253-L341
38,053
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java
NameExtractor.startsWithCap
private static boolean startsWithCap(final String word) { return !"i".equalsIgnoreCase(word) && isAllowedChar(word.charAt(0)) && isUpperCase(word.charAt(0)); }
java
private static boolean startsWithCap(final String word) { return !"i".equalsIgnoreCase(word) && isAllowedChar(word.charAt(0)) && isUpperCase(word.charAt(0)); }
[ "private", "static", "boolean", "startsWithCap", "(", "final", "String", "word", ")", "{", "return", "!", "\"i\"", ".", "equalsIgnoreCase", "(", "word", ")", "&&", "isAllowedChar", "(", "word", ".", "charAt", "(", "0", ")", ")", "&&", "isUpperCase", "(", ...
This method detects if the word's first character is in capital size. @return true if it is; false if it is not.
[ "This", "method", "detects", "if", "the", "word", "s", "first", "character", "is", "in", "capital", "size", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java#L348-L352
38,054
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java
NameExtractor.hasManyCaps
private static boolean hasManyCaps(final String word) { if ("i".equalsIgnoreCase(word)) return false; int capCharCount = 0; for (int i = 0; i < word.length(); i++) { if (isUpperCase(word.charAt(i))) capCharCount++; if (capCharCount == 2) return true; } ret...
java
private static boolean hasManyCaps(final String word) { if ("i".equalsIgnoreCase(word)) return false; int capCharCount = 0; for (int i = 0; i < word.length(); i++) { if (isUpperCase(word.charAt(i))) capCharCount++; if (capCharCount == 2) return true; } ret...
[ "private", "static", "boolean", "hasManyCaps", "(", "final", "String", "word", ")", "{", "if", "(", "\"i\"", ".", "equalsIgnoreCase", "(", "word", ")", ")", "return", "false", ";", "int", "capCharCount", "=", "0", ";", "for", "(", "int", "i", "=", "0",...
This method detects if the word has more than one character which is capital sized. @return true if there are more than one character upper cased; return false if less than one character is upper cased.
[ "This", "method", "detects", "if", "the", "word", "has", "more", "than", "one", "character", "which", "is", "capital", "sized", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/extractor/NameExtractor.java#L358-L366
38,055
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/util/Dictionary.java
Dictionary.isPlural
public static boolean isPlural(final String _word) { final String word = toEngLowerCase(_word); // word + s if (word.endsWith("s")) { final String wordStub = word.substring(0, word.length() - 1); if (checkup(wordStub) != null) return true; } // word + ed...
java
public static boolean isPlural(final String _word) { final String word = toEngLowerCase(_word); // word + s if (word.endsWith("s")) { final String wordStub = word.substring(0, word.length() - 1); if (checkup(wordStub) != null) return true; } // word + ed...
[ "public", "static", "boolean", "isPlural", "(", "final", "String", "_word", ")", "{", "final", "String", "word", "=", "toEngLowerCase", "(", "_word", ")", ";", "// word + s", "if", "(", "word", ".", "endsWith", "(", "\"s\"", ")", ")", "{", "final", "Stri...
This method checks if the word is a plural form.
[ "This", "method", "checks", "if", "the", "word", "is", "a", "plural", "form", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/util/Dictionary.java#L49-L71
38,056
adamyork/wiremock-velocity-transformer
src/main/java/com/github/adamyork/wiremock/transformer/VelocityResponseTransformer.java
VelocityResponseTransformer.addHeadersToContext
private void addHeadersToContext(final HttpHeaders headers) { for (HttpHeader header : headers.all()) { final String rawKey = header.key(); final String transformedKey = rawKey.replaceAll("-", ""); context.put("requestHeader".concat(transformedKey), header.values() ...
java
private void addHeadersToContext(final HttpHeaders headers) { for (HttpHeader header : headers.all()) { final String rawKey = header.key(); final String transformedKey = rawKey.replaceAll("-", ""); context.put("requestHeader".concat(transformedKey), header.values() ...
[ "private", "void", "addHeadersToContext", "(", "final", "HttpHeaders", "headers", ")", "{", "for", "(", "HttpHeader", "header", ":", "headers", ".", "all", "(", ")", ")", "{", "final", "String", "rawKey", "=", "header", ".", "key", "(", ")", ";", "final"...
Adds the request header information to the Velocity context. @param headers the request headers
[ "Adds", "the", "request", "header", "information", "to", "the", "Velocity", "context", "." ]
3ec0fd9e6d5b0eb04fc92c79e59c34174a729cfd
https://github.com/adamyork/wiremock-velocity-transformer/blob/3ec0fd9e6d5b0eb04fc92c79e59c34174a729cfd/src/main/java/com/github/adamyork/wiremock/transformer/VelocityResponseTransformer.java#L121-L128
38,057
adamyork/wiremock-velocity-transformer
src/main/java/com/github/adamyork/wiremock/transformer/VelocityResponseTransformer.java
VelocityResponseTransformer.addBodyToContext
private void addBodyToContext(final String body) { if(!body.isEmpty()) { final JSONParser parser = new JSONParser(); try { final JSONObject json = (JSONObject) parser.parse(body); context.put("requestBody", json); } catch (final ParseException ...
java
private void addBodyToContext(final String body) { if(!body.isEmpty()) { final JSONParser parser = new JSONParser(); try { final JSONObject json = (JSONObject) parser.parse(body); context.put("requestBody", json); } catch (final ParseException ...
[ "private", "void", "addBodyToContext", "(", "final", "String", "body", ")", "{", "if", "(", "!", "body", ".", "isEmpty", "(", ")", ")", "{", "final", "JSONParser", "parser", "=", "new", "JSONParser", "(", ")", ";", "try", "{", "final", "JSONObject", "j...
Adds the request body to the context if one exists. @param body the request body
[ "Adds", "the", "request", "body", "to", "the", "context", "if", "one", "exists", "." ]
3ec0fd9e6d5b0eb04fc92c79e59c34174a729cfd
https://github.com/adamyork/wiremock-velocity-transformer/blob/3ec0fd9e6d5b0eb04fc92c79e59c34174a729cfd/src/main/java/com/github/adamyork/wiremock/transformer/VelocityResponseTransformer.java#L135-L145
38,058
adamyork/wiremock-velocity-transformer
src/main/java/com/github/adamyork/wiremock/transformer/VelocityResponseTransformer.java
VelocityResponseTransformer.getRenderedBody
private String getRenderedBody(final ResponseDefinition response) { final String templatePath = fileSource.getPath().concat("/" + response.getBodyFileName()); final Template template = Velocity.getTemplate(templatePath); StringWriter writer = new StringWriter(); template.merge(context, w...
java
private String getRenderedBody(final ResponseDefinition response) { final String templatePath = fileSource.getPath().concat("/" + response.getBodyFileName()); final Template template = Velocity.getTemplate(templatePath); StringWriter writer = new StringWriter(); template.merge(context, w...
[ "private", "String", "getRenderedBody", "(", "final", "ResponseDefinition", "response", ")", "{", "final", "String", "templatePath", "=", "fileSource", ".", "getPath", "(", ")", ".", "concat", "(", "\"/\"", "+", "response", ".", "getBodyFileName", "(", ")", ")...
Renders the velocity template. @param response the response definition
[ "Renders", "the", "velocity", "template", "." ]
3ec0fd9e6d5b0eb04fc92c79e59c34174a729cfd
https://github.com/adamyork/wiremock-velocity-transformer/blob/3ec0fd9e6d5b0eb04fc92c79e59c34174a729cfd/src/main/java/com/github/adamyork/wiremock/transformer/VelocityResponseTransformer.java#L152-L159
38,059
NICTA/nicta-ner
conll2003-evaluation/src/main/java/org/t3as/ner/conll2003/Util.java
Util.positionClassificationMap
public static Map<Integer, NerClassification> positionClassificationMap(final NerResultSet nerResultSet) { final Map<Integer, NerClassification> m = new HashMap<>(); for (final List<Phrase> sentence : nerResultSet.phrases) { for (final Phrase p : sentence) { final int phrase...
java
public static Map<Integer, NerClassification> positionClassificationMap(final NerResultSet nerResultSet) { final Map<Integer, NerClassification> m = new HashMap<>(); for (final List<Phrase> sentence : nerResultSet.phrases) { for (final Phrase p : sentence) { final int phrase...
[ "public", "static", "Map", "<", "Integer", ",", "NerClassification", ">", "positionClassificationMap", "(", "final", "NerResultSet", "nerResultSet", ")", "{", "final", "Map", "<", "Integer", ",", "NerClassification", ">", "m", "=", "new", "HashMap", "<>", "(", ...
Return a Map of Token startIndex to classification of the Phrase that Token is a part of.
[ "Return", "a", "Map", "of", "Token", "startIndex", "to", "classification", "of", "the", "Phrase", "that", "Token", "is", "a", "part", "of", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/conll2003-evaluation/src/main/java/org/t3as/ner/conll2003/Util.java#L39-L61
38,060
NICTA/nicta-ner
nicta-ner/src/main/java/org/t3as/ner/classifier/feature/Feature.java
Feature.generateFeatureByName
public static Feature generateFeatureByName(final String featureType, final int weight, final List<String> resourceNames) throws IllegalArgumentException, IOException { switch (featureType) { case "RuledWordFeature": return new RuledWordFeature(resourceNames, weight); ...
java
public static Feature generateFeatureByName(final String featureType, final int weight, final List<String> resourceNames) throws IllegalArgumentException, IOException { switch (featureType) { case "RuledWordFeature": return new RuledWordFeature(resourceNames, weight); ...
[ "public", "static", "Feature", "generateFeatureByName", "(", "final", "String", "featureType", ",", "final", "int", "weight", ",", "final", "List", "<", "String", ">", "resourceNames", ")", "throws", "IllegalArgumentException", ",", "IOException", "{", "switch", "...
Factory method create features by name.
[ "Factory", "method", "create", "features", "by", "name", "." ]
c2156a0e299004e586926777a995b7795f35ff1c
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/nicta-ner/src/main/java/org/t3as/ner/classifier/feature/Feature.java#L48-L66
38,061
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/message/BatteryLevel.java
BatteryLevel.getVoltage
public float getVoltage() { // Range mapping from http://stackoverflow.com/a/7506169/254187 float inMin = 0; float inMax = 100; float outMin = (float) 2.0; float outMax = (float) 3.7; float x = this.percentage; return (x - inMin) * (outMax - outMin) / (inMax - in...
java
public float getVoltage() { // Range mapping from http://stackoverflow.com/a/7506169/254187 float inMin = 0; float inMax = 100; float outMin = (float) 2.0; float outMax = (float) 3.7; float x = this.percentage; return (x - inMin) * (outMax - outMin) / (inMax - in...
[ "public", "float", "getVoltage", "(", ")", "{", "// Range mapping from http://stackoverflow.com/a/7506169/254187", "float", "inMin", "=", "0", ";", "float", "inMax", "=", "100", ";", "float", "outMin", "=", "(", "float", ")", "2.0", ";", "float", "outMax", "=", ...
Get the battery level in volts. @return Voltage of battery, 2.0 to 3.7 volts inclusive
[ "Get", "the", "battery", "level", "in", "volts", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/message/BatteryLevel.java#L30-L39
38,062
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.reset
private void reset() { setState(OADState.INACTIVE); currentImage = null; firmwareBundle = null; nextBlock = 0; oadListener = null; watchdog.stop(); oadApproval.reset(); }
java
private void reset() { setState(OADState.INACTIVE); currentImage = null; firmwareBundle = null; nextBlock = 0; oadListener = null; watchdog.stop(); oadApproval.reset(); }
[ "private", "void", "reset", "(", ")", "{", "setState", "(", "OADState", ".", "INACTIVE", ")", ";", "currentImage", "=", "null", ";", "firmwareBundle", "=", "null", ";", "nextBlock", "=", "0", ";", "oadListener", "=", "null", ";", "watchdog", ".", "stop",...
Set the state to INACTIVE and clear state variables
[ "Set", "the", "state", "to", "INACTIVE", "and", "clear", "state", "variables" ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L120-L128
38,063
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.reconnect
private void reconnect() { if(uploadInProgress()) { setState(OADState.RECONNECTING); BeanManager.getInstance().startDiscovery(); Log.i(TAG, "Waiting for device to reconnect..."); } }
java
private void reconnect() { if(uploadInProgress()) { setState(OADState.RECONNECTING); BeanManager.getInstance().startDiscovery(); Log.i(TAG, "Waiting for device to reconnect..."); } }
[ "private", "void", "reconnect", "(", ")", "{", "if", "(", "uploadInProgress", "(", ")", ")", "{", "setState", "(", "OADState", ".", "RECONNECTING", ")", ";", "BeanManager", ".", "getInstance", "(", ")", ".", "startDiscovery", "(", ")", ";", "Log", ".", ...
Attempt to reconnect to a Bean that is in the middle of OAD process
[ "Attempt", "to", "reconnect", "to", "a", "Bean", "that", "is", "in", "the", "middle", "of", "OAD", "process" ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L133-L139
38,064
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.offerNextImage
private void offerNextImage() { if (oadState == OADState.OFFERING_IMAGES) { try { currentImage = firmwareBundle.getNextImage(); if (currentImage != null) { Log.i(TAG, "Offering image: " + currentImage.name()); writeToCharacteris...
java
private void offerNextImage() { if (oadState == OADState.OFFERING_IMAGES) { try { currentImage = firmwareBundle.getNextImage(); if (currentImage != null) { Log.i(TAG, "Offering image: " + currentImage.name()); writeToCharacteris...
[ "private", "void", "offerNextImage", "(", ")", "{", "if", "(", "oadState", "==", "OADState", ".", "OFFERING_IMAGES", ")", "{", "try", "{", "currentImage", "=", "firmwareBundle", ".", "getNextImage", "(", ")", ";", "if", "(", "currentImage", "!=", "null", "...
Offer the next image available in the Firmware Bundle
[ "Offer", "the", "next", "image", "available", "in", "the", "Firmware", "Bundle" ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L144-L161
38,065
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.onNotificationBlock
private void onNotificationBlock(BluetoothGattCharacteristic characteristic) { int requestedBlock = Convert.twoBytesToInt(characteristic.getValue(), Constants.CC2540_BYTE_ORDER); // Check for First block if (requestedBlock == 0) { Log.i(TAG, String.format("Image accepted (Name: %s)...
java
private void onNotificationBlock(BluetoothGattCharacteristic characteristic) { int requestedBlock = Convert.twoBytesToInt(characteristic.getValue(), Constants.CC2540_BYTE_ORDER); // Check for First block if (requestedBlock == 0) { Log.i(TAG, String.format("Image accepted (Name: %s)...
[ "private", "void", "onNotificationBlock", "(", "BluetoothGattCharacteristic", "characteristic", ")", "{", "int", "requestedBlock", "=", "Convert", ".", "twoBytesToInt", "(", "characteristic", ".", "getValue", "(", ")", ",", "Constants", ".", "CC2540_BYTE_ORDER", ")", ...
Received a notification on Block characteristic A notification to this characteristic means the Bean has accepted the most recent firmware file we have offered, which is stored as `this.currentImage`. It is now time to start sending blocks of FW to the device. @param characteristic BLE characteristic with a value equ...
[ "Received", "a", "notification", "on", "Block", "characteristic" ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L191-L230
38,066
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.setupOAD
private void setupOAD() { BluetoothGattService oadService = mGattClient.getService(Constants.UUID_OAD_SERVICE); if (oadService == null) { fail(BeanError.MISSING_OAD_SERVICE); return; } oadIdentify = oadService.getCharacteristic(Constants.UUID_OAD_CHAR_IDENTIFY); ...
java
private void setupOAD() { BluetoothGattService oadService = mGattClient.getService(Constants.UUID_OAD_SERVICE); if (oadService == null) { fail(BeanError.MISSING_OAD_SERVICE); return; } oadIdentify = oadService.getCharacteristic(Constants.UUID_OAD_CHAR_IDENTIFY); ...
[ "private", "void", "setupOAD", "(", ")", "{", "BluetoothGattService", "oadService", "=", "mGattClient", ".", "getService", "(", "Constants", ".", "UUID_OAD_SERVICE", ")", ";", "if", "(", "oadService", "==", "null", ")", "{", "fail", "(", "BeanError", ".", "M...
Setup BLOCK and IDENTIFY characteristics
[ "Setup", "BLOCK", "and", "IDENTIFY", "characteristics" ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L235-L253
38,067
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.setupNotifications
private void setupNotifications() { Log.i(TAG, "Enabling OAD notifications"); boolean oadIdentifyNotifying = enableNotifyForChar(oadIdentify); boolean oadBlockNotifying = enableNotifyForChar(oadBlock); if (oadIdentifyNotifying && oadBlockNotifying) { Log.i(TAG, "Enable not...
java
private void setupNotifications() { Log.i(TAG, "Enabling OAD notifications"); boolean oadIdentifyNotifying = enableNotifyForChar(oadIdentify); boolean oadBlockNotifying = enableNotifyForChar(oadBlock); if (oadIdentifyNotifying && oadBlockNotifying) { Log.i(TAG, "Enable not...
[ "private", "void", "setupNotifications", "(", ")", "{", "Log", ".", "i", "(", "TAG", ",", "\"Enabling OAD notifications\"", ")", ";", "boolean", "oadIdentifyNotifying", "=", "enableNotifyForChar", "(", "oadIdentify", ")", ";", "boolean", "oadBlockNotifying", "=", ...
Enables notifications for all OAD characteristics.
[ "Enables", "notifications", "for", "all", "OAD", "characteristics", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L258-L271
38,068
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.enableNotifyForChar
private boolean enableNotifyForChar(BluetoothGattCharacteristic characteristic) { boolean success = true; // Enable notifications/indications for this characteristic boolean successEnable = mGattClient.setCharacteristicNotification(characteristic, true); if (successEnable) { ...
java
private boolean enableNotifyForChar(BluetoothGattCharacteristic characteristic) { boolean success = true; // Enable notifications/indications for this characteristic boolean successEnable = mGattClient.setCharacteristicNotification(characteristic, true); if (successEnable) { ...
[ "private", "boolean", "enableNotifyForChar", "(", "BluetoothGattCharacteristic", "characteristic", ")", "{", "boolean", "success", "=", "true", ";", "// Enable notifications/indications for this characteristic", "boolean", "successEnable", "=", "mGattClient", ".", "setCharacter...
Enable notifications for a given characteristic. See <a href="https://developer.android.com/guide/topics/connectivity/bluetooth-le.html#notification"> the Android docs </a> on this subject. @param characteristic The characteristic to enable notifications for @return true if notifications were enab...
[ "Enable", "notifications", "for", "a", "given", "characteristic", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L284-L309
38,069
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.writeToCharacteristic
private boolean writeToCharacteristic(BluetoothGattCharacteristic charc, byte[] data) { charc.setValue(data); boolean result = mGattClient.writeCharacteristic(charc); if (result) { Log.d(TAG, "Wrote to characteristic: " + charc.getUuid() + ", data: " + Arrays.toSt...
java
private boolean writeToCharacteristic(BluetoothGattCharacteristic charc, byte[] data) { charc.setValue(data); boolean result = mGattClient.writeCharacteristic(charc); if (result) { Log.d(TAG, "Wrote to characteristic: " + charc.getUuid() + ", data: " + Arrays.toSt...
[ "private", "boolean", "writeToCharacteristic", "(", "BluetoothGattCharacteristic", "charc", ",", "byte", "[", "]", "data", ")", "{", "charc", ".", "setValue", "(", "data", ")", ";", "boolean", "result", "=", "mGattClient", ".", "writeCharacteristic", "(", "charc...
Write to a OAD characteristic @param charc The characteristic being inspected @return true if it's the OAD Block characteristic
[ "Write", "to", "a", "OAD", "characteristic" ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L317-L328
38,070
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.needsUpdate
private boolean needsUpdate(Long bundleVersion, String beanVersion) { if (beanVersion.contains("OAD")) { Log.i(TAG, "Bundle version: " + bundleVersion); Log.i(TAG, "Bean version: " + beanVersion); return true; } else { try { long parsedVers...
java
private boolean needsUpdate(Long bundleVersion, String beanVersion) { if (beanVersion.contains("OAD")) { Log.i(TAG, "Bundle version: " + bundleVersion); Log.i(TAG, "Bean version: " + beanVersion); return true; } else { try { long parsedVers...
[ "private", "boolean", "needsUpdate", "(", "Long", "bundleVersion", ",", "String", "beanVersion", ")", "{", "if", "(", "beanVersion", ".", "contains", "(", "\"OAD\"", ")", ")", "{", "Log", ".", "i", "(", "TAG", ",", "\"Bundle version: \"", "+", "bundleVersion...
Helper function to determine whether a Bean needs a FW update given a specific Bundle version @param bundleVersion the version string from the provided firmware bundle @param beanVersion the version string provided from the Bean Device Information Service @return boolean value stating whether the Bean needs an update
[ "Helper", "function", "to", "determine", "whether", "a", "Bean", "needs", "a", "FW", "update", "given", "a", "specific", "Bundle", "version" ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L337-L358
38,071
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.checkFirmwareVersion
private void checkFirmwareVersion() { Log.i(TAG, "Checking Firmware version..."); setState(OADState.CHECKING_FW_VERSION); mGattClient.getDeviceProfile().getFirmwareVersion(new DeviceProfile.VersionCallback() { @Override public void onComplete(String version) { ...
java
private void checkFirmwareVersion() { Log.i(TAG, "Checking Firmware version..."); setState(OADState.CHECKING_FW_VERSION); mGattClient.getDeviceProfile().getFirmwareVersion(new DeviceProfile.VersionCallback() { @Override public void onComplete(String version) { ...
[ "private", "void", "checkFirmwareVersion", "(", ")", "{", "Log", ".", "i", "(", "TAG", ",", "\"Checking Firmware version...\"", ")", ";", "setState", "(", "OADState", ".", "CHECKING_FW_VERSION", ")", ";", "mGattClient", ".", "getDeviceProfile", "(", ")", ".", ...
Check the Beans FW version to determine if an update is required
[ "Check", "the", "Beans", "FW", "version", "to", "determine", "if", "an", "update", "is", "required" ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L363-L403
38,072
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.fail
private void fail(BeanError error) { Log.e(TAG, "OAD Error: " + error.toString()); if (uploadInProgress()) { oadListener.error(error); reset(); } }
java
private void fail(BeanError error) { Log.e(TAG, "OAD Error: " + error.toString()); if (uploadInProgress()) { oadListener.error(error); reset(); } }
[ "private", "void", "fail", "(", "BeanError", "error", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"OAD Error: \"", "+", "error", ".", "toString", "(", ")", ")", ";", "if", "(", "uploadInProgress", "(", ")", ")", "{", "oadListener", ".", "error", "(...
Stop the firmware upload and alert the OADListener @param error The error to be returned to the user
[ "Stop", "the", "firmware", "upload", "and", "alert", "the", "OADListener" ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L410-L416
38,073
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java
OADProfile.programWithFirmware
public OADApproval programWithFirmware(final FirmwareBundle bundle, OADListener listener) { if (!mGattClient.isConnected()) { listener.error(BeanError.NOT_CONNECTED); } Log.i(TAG, "Starting firmware update procedure"); // Save state for this firmware procedure this...
java
public OADApproval programWithFirmware(final FirmwareBundle bundle, OADListener listener) { if (!mGattClient.isConnected()) { listener.error(BeanError.NOT_CONNECTED); } Log.i(TAG, "Starting firmware update procedure"); // Save state for this firmware procedure this...
[ "public", "OADApproval", "programWithFirmware", "(", "final", "FirmwareBundle", "bundle", ",", "OADListener", "listener", ")", "{", "if", "(", "!", "mGattClient", ".", "isConnected", "(", ")", ")", "{", "listener", ".", "error", "(", "BeanError", ".", "NOT_CON...
Program the Bean's CC2540 with new firmware. @param bundle The {@link com.punchthrough.bean.sdk.upload.FirmwareBundle} to be sent @param listener Listener object to alert client of events/state of the Firmware update process
[ "Program", "the", "Bean", "s", "CC2540", "with", "new", "firmware", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L508-L524
38,074
comtel2000/jfxvnc
jfxvnc-app/src/main/java/org/jfxvnc/app/persist/SessionContext.java
SessionContext.getBindings
public ObservableMap<String, Property<?>> getBindings() { if (bindings == null) { bindings = FXCollections.observableHashMap(); } return bindings; }
java
public ObservableMap<String, Property<?>> getBindings() { if (bindings == null) { bindings = FXCollections.observableHashMap(); } return bindings; }
[ "public", "ObservableMap", "<", "String", ",", "Property", "<", "?", ">", ">", "getBindings", "(", ")", "{", "if", "(", "bindings", "==", "null", ")", "{", "bindings", "=", "FXCollections", ".", "observableHashMap", "(", ")", ";", "}", "return", "binding...
session scope bindings @return
[ "session", "scope", "bindings" ]
981be16c79ed07afdb294a9a65f0e69dcd9ce4b6
https://github.com/comtel2000/jfxvnc/blob/981be16c79ed07afdb294a9a65f0e69dcd9ce4b6/jfxvnc-app/src/main/java/org/jfxvnc/app/persist/SessionContext.java#L205-L210
38,075
ReactiveX/RxJavaGuava
src/main/java/rx/transformer/GuavaTransformers.java
GuavaTransformers.toImmutableList
public static <T> Observable.Transformer<T,ImmutableList<T>> toImmutableList() { return new Observable.Transformer<T, ImmutableList<T>>() { @Override public Observable<ImmutableList<T>> call(Observable<T> source) { return source.collect(new Func0<ImmutableList.Builder<T>>...
java
public static <T> Observable.Transformer<T,ImmutableList<T>> toImmutableList() { return new Observable.Transformer<T, ImmutableList<T>>() { @Override public Observable<ImmutableList<T>> call(Observable<T> source) { return source.collect(new Func0<ImmutableList.Builder<T>>...
[ "public", "static", "<", "T", ">", "Observable", ".", "Transformer", "<", "T", ",", "ImmutableList", "<", "T", ">", ">", "toImmutableList", "(", ")", "{", "return", "new", "Observable", ".", "Transformer", "<", "T", ",", "ImmutableList", "<", "T", ">", ...
Returns a Transformer&lt;T,ImmutableList&lt;T&gt;&gt that maps an Observable&lt;T&gt; to an Observable&lt;ImmutableList&lt;T&gt;&gt;
[ "Returns", "a", "Transformer&lt", ";", "T", "ImmutableList&lt", ";", "T&gt", ";", "&gt", "that", "maps", "an", "Observable&lt", ";", "T&gt", ";", "to", "an", "Observable&lt", ";", "ImmutableList&lt", ";", "T&gt", ";", "&gt", ";" ]
bfb5da6e073364a96da23d57f47c6b706fb733aa
https://github.com/ReactiveX/RxJavaGuava/blob/bfb5da6e073364a96da23d57f47c6b706fb733aa/src/main/java/rx/transformer/GuavaTransformers.java#L38-L61
38,076
ReactiveX/RxJavaGuava
src/main/java/rx/transformer/GuavaTransformers.java
GuavaTransformers.toImmutableSet
public static <T> Observable.Transformer<T,ImmutableSet<T>> toImmutableSet() { return new Observable.Transformer<T, ImmutableSet<T>>() { @Override public Observable<ImmutableSet<T>> call(Observable<T> source) { return source.collect(new Func0<ImmutableSet.Builder<T>>() { ...
java
public static <T> Observable.Transformer<T,ImmutableSet<T>> toImmutableSet() { return new Observable.Transformer<T, ImmutableSet<T>>() { @Override public Observable<ImmutableSet<T>> call(Observable<T> source) { return source.collect(new Func0<ImmutableSet.Builder<T>>() { ...
[ "public", "static", "<", "T", ">", "Observable", ".", "Transformer", "<", "T", ",", "ImmutableSet", "<", "T", ">", ">", "toImmutableSet", "(", ")", "{", "return", "new", "Observable", ".", "Transformer", "<", "T", ",", "ImmutableSet", "<", "T", ">", ">...
Returns a Transformer&lt;T,ImmutableSet&lt;T&gt;&gt that maps an Observable&lt;T&gt; to an Observable&lt;ImmutableSet&lt;T&gt;&gt;
[ "Returns", "a", "Transformer&lt", ";", "T", "ImmutableSet&lt", ";", "T&gt", ";", "&gt", "that", "maps", "an", "Observable&lt", ";", "T&gt", ";", "to", "an", "Observable&lt", ";", "ImmutableSet&lt", ";", "T&gt", ";", "&gt", ";" ]
bfb5da6e073364a96da23d57f47c6b706fb733aa
https://github.com/ReactiveX/RxJavaGuava/blob/bfb5da6e073364a96da23d57f47c6b706fb733aa/src/main/java/rx/transformer/GuavaTransformers.java#L65-L88
38,077
kwon37xi/hibernate4-memcached
hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/NonstrictReadWriteEntityRegionAccessStrategy.java
NonstrictReadWriteEntityRegionAccessStrategy.update
@Override public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException { log.debug("region access strategy nonstrict-read-write entity update() {} {}", getInternalRegion().getCacheNamespace(), key); return false; }
java
@Override public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException { log.debug("region access strategy nonstrict-read-write entity update() {} {}", getInternalRegion().getCacheNamespace(), key); return false; }
[ "@", "Override", "public", "boolean", "update", "(", "Object", "key", ",", "Object", "value", ",", "Object", "currentVersion", ",", "Object", "previousVersion", ")", "throws", "CacheException", "{", "log", ".", "debug", "(", "\"region access strategy nonstrict-read-...
not necessary in nostrict-read-write @see org.hibernate.cache.spi.access.EntityRegionAccessStrategy
[ "not", "necessary", "in", "nostrict", "-", "read", "-", "write" ]
e0b2839ab257b2602344f54ca53c564044f3585d
https://github.com/kwon37xi/hibernate4-memcached/blob/e0b2839ab257b2602344f54ca53c564044f3585d/hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/NonstrictReadWriteEntityRegionAccessStrategy.java#L38-L42
38,078
kwon37xi/hibernate4-memcached
hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/NonstrictReadWriteEntityRegionAccessStrategy.java
NonstrictReadWriteEntityRegionAccessStrategy.afterUpdate
@Override public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException { log.debug("region access strategy nonstrict-read-write entity afterUpdate() {} {}", getInternalRegion().getCacheNamespace(), key); getInternalRegion()....
java
@Override public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException { log.debug("region access strategy nonstrict-read-write entity afterUpdate() {} {}", getInternalRegion().getCacheNamespace(), key); getInternalRegion()....
[ "@", "Override", "public", "boolean", "afterUpdate", "(", "Object", "key", ",", "Object", "value", ",", "Object", "currentVersion", ",", "Object", "previousVersion", ",", "SoftLock", "lock", ")", "throws", "CacheException", "{", "log", ".", "debug", "(", "\"re...
need evict the key, after update. @see org.hibernate.cache.spi.access.EntityRegionAccessStrategy
[ "need", "evict", "the", "key", "after", "update", "." ]
e0b2839ab257b2602344f54ca53c564044f3585d
https://github.com/kwon37xi/hibernate4-memcached/blob/e0b2839ab257b2602344f54ca53c564044f3585d/hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/NonstrictReadWriteEntityRegionAccessStrategy.java#L49-L54
38,079
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.handleMessage
private void handleMessage(byte[] data) { Buffer buffer = new Buffer(); buffer.write(data); int type = (buffer.readShort() & 0xffff) & ~(APP_MSG_RESPONSE_BIT); if (type == BeanMessageID.SERIAL_DATA.getRawValue()) { beanListener.onSerialMessageReceived(buffer.readByteArray())...
java
private void handleMessage(byte[] data) { Buffer buffer = new Buffer(); buffer.write(data); int type = (buffer.readShort() & 0xffff) & ~(APP_MSG_RESPONSE_BIT); if (type == BeanMessageID.SERIAL_DATA.getRawValue()) { beanListener.onSerialMessageReceived(buffer.readByteArray())...
[ "private", "void", "handleMessage", "(", "byte", "[", "]", "data", ")", "{", "Buffer", "buffer", "=", "new", "Buffer", "(", ")", ";", "buffer", ".", "write", "(", "data", ")", ";", "int", "type", "=", "(", "buffer", ".", "readShort", "(", ")", "&",...
Handles incoming messages from the Bean and dispatches them to the proper handlers. @param data The raw byte data received from the Bean
[ "Handles", "incoming", "messages", "from", "the", "Bean", "and", "dispatches", "them", "to", "the", "proper", "handlers", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L390-L444
38,080
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.handleStatus
private void handleStatus(Status status) { Log.d(TAG, "Handling Bean status: " + status); BeanState beanState = status.beanState(); if (beanState == BeanState.READY) { resetSketchStateTimeout(); if (sketchUploadState == SketchUploadState.SENDING_START_COMMAND) { ...
java
private void handleStatus(Status status) { Log.d(TAG, "Handling Bean status: " + status); BeanState beanState = status.beanState(); if (beanState == BeanState.READY) { resetSketchStateTimeout(); if (sketchUploadState == SketchUploadState.SENDING_START_COMMAND) { ...
[ "private", "void", "handleStatus", "(", "Status", "status", ")", "{", "Log", ".", "d", "(", "TAG", ",", "\"Handling Bean status: \"", "+", "status", ")", ";", "BeanState", "beanState", "=", "status", ".", "beanState", "(", ")", ";", "if", "(", "beanState",...
Fired when the Bean sends a Status message. Updates the client's internal state machine, used for uploading sketches and firmware to the Bean. @param status The status received from the Bean
[ "Fired", "when", "the", "Bean", "sends", "a", "Status", "message", ".", "Updates", "the", "client", "s", "internal", "state", "machine", "used", "for", "uploading", "sketches", "and", "firmware", "to", "the", "Bean", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L452-L481
38,081
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.resetSketchStateTimeout
private void resetSketchStateTimeout() { TimerTask onTimeout = new TimerTask() { @Override public void run() { returnUploadError(BeanError.STATE_TIMEOUT); } }; stopSketchStateTimeout(); sketchStateTimeout = new Timer(); sketchS...
java
private void resetSketchStateTimeout() { TimerTask onTimeout = new TimerTask() { @Override public void run() { returnUploadError(BeanError.STATE_TIMEOUT); } }; stopSketchStateTimeout(); sketchStateTimeout = new Timer(); sketchS...
[ "private", "void", "resetSketchStateTimeout", "(", ")", "{", "TimerTask", "onTimeout", "=", "new", "TimerTask", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "returnUploadError", "(", "BeanError", ".", "STATE_TIMEOUT", ")", ";", "}"...
Reset the state timeout timer. If this timer fires, the client has waited too long for a state update from the Bean and an error will be fired.
[ "Reset", "the", "state", "timeout", "timer", ".", "If", "this", "timer", "fires", "the", "client", "has", "waited", "too", "long", "for", "a", "state", "update", "from", "the", "Bean", "and", "an", "error", "will", "be", "fired", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L507-L518
38,082
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.resetSketchBlockSendTimeout
private void resetSketchBlockSendTimeout() { TimerTask onTimeout = new TimerTask() { @Override public void run() { sendNextSketchBlock(); } }; stopSketchBlockSendTimeout(); sketchBlockSendTimeout = new Timer(); sketchBlockSendT...
java
private void resetSketchBlockSendTimeout() { TimerTask onTimeout = new TimerTask() { @Override public void run() { sendNextSketchBlock(); } }; stopSketchBlockSendTimeout(); sketchBlockSendTimeout = new Timer(); sketchBlockSendT...
[ "private", "void", "resetSketchBlockSendTimeout", "(", ")", "{", "TimerTask", "onTimeout", "=", "new", "TimerTask", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "sendNextSketchBlock", "(", ")", ";", "}", "}", ";", "stopSketchBlockS...
Reset the block send timer. When this timer fires, another sketch block is sent.
[ "Reset", "the", "block", "send", "timer", ".", "When", "this", "timer", "fires", "another", "sketch", "block", "is", "sent", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L523-L534
38,083
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.sendNextSketchBlock
private void sendNextSketchBlock() { byte[] rawBlock = sketchBlocksToSend.get(currSketchBlockNum); Buffer block = new Buffer(); block.write(rawBlock); sendMessage(BeanMessageID.BL_FW_BLOCK, block); resetSketchBlockSendTimeout(); int blocksSent = currSketchBlockNum + 1; ...
java
private void sendNextSketchBlock() { byte[] rawBlock = sketchBlocksToSend.get(currSketchBlockNum); Buffer block = new Buffer(); block.write(rawBlock); sendMessage(BeanMessageID.BL_FW_BLOCK, block); resetSketchBlockSendTimeout(); int blocksSent = currSketchBlockNum + 1; ...
[ "private", "void", "sendNextSketchBlock", "(", ")", "{", "byte", "[", "]", "rawBlock", "=", "sketchBlocksToSend", ".", "get", "(", "currSketchBlockNum", ")", ";", "Buffer", "block", "=", "new", "Buffer", "(", ")", ";", "block", ".", "write", "(", "rawBlock...
Send one block of sketch data to the Bean and increment the block counter.
[ "Send", "one", "block", "of", "sketch", "data", "to", "the", "Bean", "and", "increment", "the", "block", "counter", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L539-L555
38,084
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.addCallback
private void addCallback(BeanMessageID type, Callback<?> callback) { List<Callback<?>> callbacks = beanCallbacks.get(type); if (callbacks == null) { callbacks = new ArrayList<>(16); beanCallbacks.put(type, callbacks); } callbacks.add(callback); }
java
private void addCallback(BeanMessageID type, Callback<?> callback) { List<Callback<?>> callbacks = beanCallbacks.get(type); if (callbacks == null) { callbacks = new ArrayList<>(16); beanCallbacks.put(type, callbacks); } callbacks.add(callback); }
[ "private", "void", "addCallback", "(", "BeanMessageID", "type", ",", "Callback", "<", "?", ">", "callback", ")", "{", "List", "<", "Callback", "<", "?", ">", ">", "callbacks", "=", "beanCallbacks", ".", "get", "(", "type", ")", ";", "if", "(", "callbac...
Add a callback for a Bean message type. @param type The {@link com.punchthrough.bean.sdk.internal.BeanMessageID} the callback will answer to @param callback The callback to store
[ "Add", "a", "callback", "for", "a", "Bean", "message", "type", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L684-L691
38,085
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.getFirstCallback
@SuppressWarnings("unchecked") private <T> Callback<T> getFirstCallback(BeanMessageID type) { List<Callback<?>> callbacks = beanCallbacks.get(type); if (callbacks == null || callbacks.isEmpty()) { Log.w(TAG, "Got response without callback!"); return null; } re...
java
@SuppressWarnings("unchecked") private <T> Callback<T> getFirstCallback(BeanMessageID type) { List<Callback<?>> callbacks = beanCallbacks.get(type); if (callbacks == null || callbacks.isEmpty()) { Log.w(TAG, "Got response without callback!"); return null; } re...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "<", "T", ">", "Callback", "<", "T", ">", "getFirstCallback", "(", "BeanMessageID", "type", ")", "{", "List", "<", "Callback", "<", "?", ">", ">", "callbacks", "=", "beanCallbacks", ".", "get",...
Get the first callback for a Bean message type. @param type The {@link com.punchthrough.bean.sdk.internal.BeanMessageID} for which to find an associated callback @param <T> The parameter type for the callback @return The callback for the given message type, or null if none exists
[ "Get", "the", "first", "callback", "for", "a", "Bean", "message", "type", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L701-L709
38,086
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.connect
public void connect(Context context, BeanListener listener) { lastKnownContext = context; beanListener = listener; gattClient.connect(context, device); }
java
public void connect(Context context, BeanListener listener) { lastKnownContext = context; beanListener = listener; gattClient.connect(context, device); }
[ "public", "void", "connect", "(", "Context", "context", ",", "BeanListener", "listener", ")", "{", "lastKnownContext", "=", "context", ";", "beanListener", "=", "listener", ";", "gattClient", ".", "connect", "(", "context", ",", "device", ")", ";", "}" ]
Attempt to connect to this Bean. @param context the Android Context used for connection, usually the current activity @param listener the Bean listener
[ "Attempt", "to", "connect", "to", "this", "Bean", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L779-L783
38,087
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.setLed
public void setLed(LedColor color) { Buffer buffer = new Buffer(); buffer.writeByte(color.red()); buffer.writeByte(color.green()); buffer.writeByte(color.blue()); sendMessage(BeanMessageID.CC_LED_WRITE_ALL, buffer); }
java
public void setLed(LedColor color) { Buffer buffer = new Buffer(); buffer.writeByte(color.red()); buffer.writeByte(color.green()); buffer.writeByte(color.blue()); sendMessage(BeanMessageID.CC_LED_WRITE_ALL, buffer); }
[ "public", "void", "setLed", "(", "LedColor", "color", ")", "{", "Buffer", "buffer", "=", "new", "Buffer", "(", ")", ";", "buffer", ".", "writeByte", "(", "color", ".", "red", "(", ")", ")", ";", "buffer", ".", "writeByte", "(", "color", ".", "green",...
Set the LED color. @param color The {@link com.punchthrough.bean.sdk.message.LedColor} being sent to the LED
[ "Set", "the", "LED", "color", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L823-L829
38,088
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.readLed
public void readLed(Callback<LedColor> callback) { addCallback(BeanMessageID.CC_LED_READ_ALL, callback); sendMessageWithoutPayload(BeanMessageID.CC_LED_READ_ALL); }
java
public void readLed(Callback<LedColor> callback) { addCallback(BeanMessageID.CC_LED_READ_ALL, callback); sendMessageWithoutPayload(BeanMessageID.CC_LED_READ_ALL); }
[ "public", "void", "readLed", "(", "Callback", "<", "LedColor", ">", "callback", ")", "{", "addCallback", "(", "BeanMessageID", ".", "CC_LED_READ_ALL", ",", "callback", ")", ";", "sendMessageWithoutPayload", "(", "BeanMessageID", ".", "CC_LED_READ_ALL", ")", ";", ...
Read the LED color. @param callback the callback for the {@link com.punchthrough.bean.sdk.message.LedColor} result
[ "Read", "the", "LED", "color", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L837-L840
38,089
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.setAdvertising
public void setAdvertising(boolean enable) { Buffer buffer = new Buffer(); buffer.writeByte(enable ? 1 : 0); sendMessage(BeanMessageID.BT_ADV_ONOFF, buffer); }
java
public void setAdvertising(boolean enable) { Buffer buffer = new Buffer(); buffer.writeByte(enable ? 1 : 0); sendMessage(BeanMessageID.BT_ADV_ONOFF, buffer); }
[ "public", "void", "setAdvertising", "(", "boolean", "enable", ")", "{", "Buffer", "buffer", "=", "new", "Buffer", "(", ")", ";", "buffer", ".", "writeByte", "(", "enable", "?", "1", ":", "0", ")", ";", "sendMessage", "(", "BeanMessageID", ".", "BT_ADV_ON...
Set the advertising flag. @param enable true to enable, false to disable
[ "Set", "the", "advertising", "flag", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L847-L851
38,090
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.readTemperature
public void readTemperature(Callback<Integer> callback) { addCallback(BeanMessageID.CC_TEMP_READ, callback); sendMessageWithoutPayload(BeanMessageID.CC_TEMP_READ); }
java
public void readTemperature(Callback<Integer> callback) { addCallback(BeanMessageID.CC_TEMP_READ, callback); sendMessageWithoutPayload(BeanMessageID.CC_TEMP_READ); }
[ "public", "void", "readTemperature", "(", "Callback", "<", "Integer", ">", "callback", ")", "{", "addCallback", "(", "BeanMessageID", ".", "CC_TEMP_READ", ",", "callback", ")", ";", "sendMessageWithoutPayload", "(", "BeanMessageID", ".", "CC_TEMP_READ", ")", ";", ...
Request a temperature reading. @param callback the callback for the temperature result, in degrees Celsius
[ "Request", "a", "temperature", "reading", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L858-L861
38,091
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.readAcceleration
public void readAcceleration(Callback<Acceleration> callback) { addCallback(BeanMessageID.CC_ACCEL_READ, callback); sendMessageWithoutPayload(BeanMessageID.CC_ACCEL_READ); }
java
public void readAcceleration(Callback<Acceleration> callback) { addCallback(BeanMessageID.CC_ACCEL_READ, callback); sendMessageWithoutPayload(BeanMessageID.CC_ACCEL_READ); }
[ "public", "void", "readAcceleration", "(", "Callback", "<", "Acceleration", ">", "callback", ")", "{", "addCallback", "(", "BeanMessageID", ".", "CC_ACCEL_READ", ",", "callback", ")", ";", "sendMessageWithoutPayload", "(", "BeanMessageID", ".", "CC_ACCEL_READ", ")",...
Request an acceleration sensor reading. @param callback the callback for the {@link com.punchthrough.bean.sdk.message.Acceleration} result
[ "Request", "an", "acceleration", "sensor", "reading", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L869-L872
38,092
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.readSketchMetadata
public void readSketchMetadata(Callback<SketchMetadata> callback) { addCallback(BeanMessageID.BL_GET_META, callback); sendMessageWithoutPayload(BeanMessageID.BL_GET_META); }
java
public void readSketchMetadata(Callback<SketchMetadata> callback) { addCallback(BeanMessageID.BL_GET_META, callback); sendMessageWithoutPayload(BeanMessageID.BL_GET_META); }
[ "public", "void", "readSketchMetadata", "(", "Callback", "<", "SketchMetadata", ">", "callback", ")", "{", "addCallback", "(", "BeanMessageID", ".", "BL_GET_META", ",", "callback", ")", ";", "sendMessageWithoutPayload", "(", "BeanMessageID", ".", "BL_GET_META", ")",...
Request the sketch metadata. @param callback the callback for the {@link com.punchthrough.bean.sdk.message.SketchMetadata} result
[ "Request", "the", "sketch", "metadata", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L880-L883
38,093
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.readScratchData
public void readScratchData(ScratchBank bank, Callback<ScratchData> callback) { addCallback(BeanMessageID.BT_GET_SCRATCH, callback); Buffer buffer = new Buffer(); buffer.writeByte(intToByte(bank.getRawValue())); sendMessage(BeanMessageID.BT_GET_SCRATCH, buffer); }
java
public void readScratchData(ScratchBank bank, Callback<ScratchData> callback) { addCallback(BeanMessageID.BT_GET_SCRATCH, callback); Buffer buffer = new Buffer(); buffer.writeByte(intToByte(bank.getRawValue())); sendMessage(BeanMessageID.BT_GET_SCRATCH, buffer); }
[ "public", "void", "readScratchData", "(", "ScratchBank", "bank", ",", "Callback", "<", "ScratchData", ">", "callback", ")", "{", "addCallback", "(", "BeanMessageID", ".", "BT_GET_SCRATCH", ",", "callback", ")", ";", "Buffer", "buffer", "=", "new", "Buffer", "(...
Request a scratch bank data value. @param bank the {@link com.punchthrough.bean.sdk.message.ScratchBank} for which data is being requested @param callback the callback for the result
[ "Request", "a", "scratch", "bank", "data", "value", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L892-L897
38,094
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.setAccelerometerRange
public void setAccelerometerRange(AccelerometerRange range) { Buffer buffer = new Buffer(); buffer.writeByte(range.getRawValue()); sendMessage(BeanMessageID.CC_ACCEL_SET_RANGE, buffer); }
java
public void setAccelerometerRange(AccelerometerRange range) { Buffer buffer = new Buffer(); buffer.writeByte(range.getRawValue()); sendMessage(BeanMessageID.CC_ACCEL_SET_RANGE, buffer); }
[ "public", "void", "setAccelerometerRange", "(", "AccelerometerRange", "range", ")", "{", "Buffer", "buffer", "=", "new", "Buffer", "(", ")", ";", "buffer", ".", "writeByte", "(", "range", ".", "getRawValue", "(", ")", ")", ";", "sendMessage", "(", "BeanMessa...
Set the accelerometer range. @param range the {@link com.punchthrough.bean.sdk.message.AccelerometerRange} to be set
[ "Set", "the", "accelerometer", "range", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L904-L908
38,095
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.readAccelerometerRange
public void readAccelerometerRange(Callback<AccelerometerRange> callback) { addCallback(BeanMessageID.CC_ACCEL_GET_RANGE, callback); sendMessageWithoutPayload(BeanMessageID.CC_ACCEL_GET_RANGE); }
java
public void readAccelerometerRange(Callback<AccelerometerRange> callback) { addCallback(BeanMessageID.CC_ACCEL_GET_RANGE, callback); sendMessageWithoutPayload(BeanMessageID.CC_ACCEL_GET_RANGE); }
[ "public", "void", "readAccelerometerRange", "(", "Callback", "<", "AccelerometerRange", ">", "callback", ")", "{", "addCallback", "(", "BeanMessageID", ".", "CC_ACCEL_GET_RANGE", ",", "callback", ")", ";", "sendMessageWithoutPayload", "(", "BeanMessageID", ".", "CC_AC...
Read the accelerometer range. @param callback the callback for the result
[ "Read", "the", "accelerometer", "range", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L915-L918
38,096
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.setScratchData
public void setScratchData(ScratchBank bank, byte[] data) { ScratchData sd = ScratchData.create(bank, data); sendMessage(BeanMessageID.BT_SET_SCRATCH, sd); }
java
public void setScratchData(ScratchBank bank, byte[] data) { ScratchData sd = ScratchData.create(bank, data); sendMessage(BeanMessageID.BT_SET_SCRATCH, sd); }
[ "public", "void", "setScratchData", "(", "ScratchBank", "bank", ",", "byte", "[", "]", "data", ")", "{", "ScratchData", "sd", "=", "ScratchData", ".", "create", "(", "bank", ",", "data", ")", ";", "sendMessage", "(", "BeanMessageID", ".", "BT_SET_SCRATCH", ...
Set a scratch bank data value with raw bytes. @param bank The {@link com.punchthrough.bean.sdk.message.ScratchBank} being set @param data The bytes to write into the scratch bank
[ "Set", "a", "scratch", "bank", "data", "value", "with", "raw", "bytes", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L926-L929
38,097
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.setRadioConfig
public void setRadioConfig(RadioConfig config, boolean save) { sendMessage(save ? BeanMessageID.BT_SET_CONFIG : BeanMessageID.BT_SET_CONFIG_NOSAVE, config); }
java
public void setRadioConfig(RadioConfig config, boolean save) { sendMessage(save ? BeanMessageID.BT_SET_CONFIG : BeanMessageID.BT_SET_CONFIG_NOSAVE, config); }
[ "public", "void", "setRadioConfig", "(", "RadioConfig", "config", ",", "boolean", "save", ")", "{", "sendMessage", "(", "save", "?", "BeanMessageID", ".", "BT_SET_CONFIG", ":", "BeanMessageID", ".", "BT_SET_CONFIG_NOSAVE", ",", "config", ")", ";", "}" ]
Set the radio config. @param config the {@link com.punchthrough.bean.sdk.message.RadioConfig} to set @param save true to save the config in non-volatile storage, false otherwise.
[ "Set", "the", "radio", "config", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L965-L967
38,098
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.sendSerialMessage
public void sendSerialMessage(byte[] value) { Buffer buffer = new Buffer(); buffer.write(value); sendMessage(BeanMessageID.SERIAL_DATA, buffer); }
java
public void sendSerialMessage(byte[] value) { Buffer buffer = new Buffer(); buffer.write(value); sendMessage(BeanMessageID.SERIAL_DATA, buffer); }
[ "public", "void", "sendSerialMessage", "(", "byte", "[", "]", "value", ")", "{", "Buffer", "buffer", "=", "new", "Buffer", "(", ")", ";", "buffer", ".", "write", "(", "value", ")", ";", "sendMessage", "(", "BeanMessageID", ".", "SERIAL_DATA", ",", "buffe...
Send raw bytes to the Bean as a serial message. @param value the message payload
[ "Send", "raw", "bytes", "to", "the", "Bean", "as", "a", "serial", "message", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L974-L978
38,099
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.setPin
public void setPin(int pin, boolean active) { Buffer buffer = new Buffer(); buffer.writeIntLe(pin); buffer.writeByte(active ? 1 : 0); sendMessage(BeanMessageID.BT_SET_PIN, buffer); }
java
public void setPin(int pin, boolean active) { Buffer buffer = new Buffer(); buffer.writeIntLe(pin); buffer.writeByte(active ? 1 : 0); sendMessage(BeanMessageID.BT_SET_PIN, buffer); }
[ "public", "void", "setPin", "(", "int", "pin", ",", "boolean", "active", ")", "{", "Buffer", "buffer", "=", "new", "Buffer", "(", ")", ";", "buffer", ".", "writeIntLe", "(", "pin", ")", ";", "buffer", ".", "writeByte", "(", "active", "?", "1", ":", ...
Set the Bean's security code. @param pin the 6 digit pin as a number, e.g. <code>123456</code> @param active true to enable authenticated mode, false to disable the current pin
[ "Set", "the", "Bean", "s", "security", "code", "." ]
dc33e8cc9258d6e028e0788d74735c75b54d1133
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L986-L991