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
28,700
Netflix/spectator
spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/ServerGroup.java
ServerGroup.sequence
public String sequence() { return dN == asg.length() ? null : substr(asg, dN + 1, asg.length()); }
java
public String sequence() { return dN == asg.length() ? null : substr(asg, dN + 1, asg.length()); }
[ "public", "String", "sequence", "(", ")", "{", "return", "dN", "==", "asg", ".", "length", "(", ")", "?", "null", ":", "substr", "(", "asg", ",", "dN", "+", "1", ",", "asg", ".", "length", "(", ")", ")", ";", "}" ]
If the server group has a sequence number, then return it. Otherwise return null.
[ "If", "the", "server", "group", "has", "a", "sequence", "number", "then", "return", "it", ".", "Otherwise", "return", "null", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/ServerGroup.java#L138-L140
28,701
Netflix/spectator
spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcLogger.java
GcLogger.start
public synchronized void start(GcEventListener listener) { // TODO: this class has a bad mix of static fields used from an instance of the class. For now // this has been changed not to throw to make the dependency injection use-cases work. A // more general refactor of the GcLogger class is needed. if ...
java
public synchronized void start(GcEventListener listener) { // TODO: this class has a bad mix of static fields used from an instance of the class. For now // this has been changed not to throw to make the dependency injection use-cases work. A // more general refactor of the GcLogger class is needed. if ...
[ "public", "synchronized", "void", "start", "(", "GcEventListener", "listener", ")", "{", "// TODO: this class has a bad mix of static fields used from an instance of the class. For now", "// this has been changed not to throw to make the dependency injection use-cases work. A", "// more genera...
Start collecting data about GC events. @param listener If not null, the listener will be called with the event objects after metrics and the log buffer is updated.
[ "Start", "collecting", "data", "about", "GC", "events", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcLogger.java#L119-L135
28,702
Netflix/spectator
spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcLogger.java
GcLogger.stop
public synchronized void stop() { Preconditions.checkState(notifListener != null, "logger has not been started"); for (GarbageCollectorMXBean mbean : ManagementFactory.getGarbageCollectorMXBeans()) { if (mbean instanceof NotificationEmitter) { final NotificationEmitter emitter = (NotificationEmitt...
java
public synchronized void stop() { Preconditions.checkState(notifListener != null, "logger has not been started"); for (GarbageCollectorMXBean mbean : ManagementFactory.getGarbageCollectorMXBeans()) { if (mbean instanceof NotificationEmitter) { final NotificationEmitter emitter = (NotificationEmitt...
[ "public", "synchronized", "void", "stop", "(", ")", "{", "Preconditions", ".", "checkState", "(", "notifListener", "!=", "null", ",", "\"logger has not been started\"", ")", ";", "for", "(", "GarbageCollectorMXBean", "mbean", ":", "ManagementFactory", ".", "getGarba...
Stop collecting GC events.
[ "Stop", "collecting", "GC", "events", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcLogger.java#L138-L151
28,703
Netflix/spectator
spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcLogger.java
GcLogger.getLogs
public List<GcEvent> getLogs() { final List<GcEvent> logs = new ArrayList<>(); for (CircularBuffer<GcEvent> buffer : gcLogs.values()) { logs.addAll(buffer.toList()); } Collections.sort(logs, GcEvent.REVERSE_TIME_ORDER); return logs; }
java
public List<GcEvent> getLogs() { final List<GcEvent> logs = new ArrayList<>(); for (CircularBuffer<GcEvent> buffer : gcLogs.values()) { logs.addAll(buffer.toList()); } Collections.sort(logs, GcEvent.REVERSE_TIME_ORDER); return logs; }
[ "public", "List", "<", "GcEvent", ">", "getLogs", "(", ")", "{", "final", "List", "<", "GcEvent", ">", "logs", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "CircularBuffer", "<", "GcEvent", ">", "buffer", ":", "gcLogs", ".", "values", "(...
Return the current set of GC events in the in-memory log.
[ "Return", "the", "current", "set", "of", "GC", "events", "in", "the", "in", "-", "memory", "log", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcLogger.java#L154-L161
28,704
Netflix/spectator
spectator-ext-aws2/src/main/java/com/netflix/spectator/aws2/SpectatorExecutionInterceptor.java
SpectatorExecutionInterceptor.isStatusSet
private boolean isStatusSet(ExecutionAttributes attrs) { Boolean s = attrs.getAttribute(STATUS_IS_SET); return s != null && s; }
java
private boolean isStatusSet(ExecutionAttributes attrs) { Boolean s = attrs.getAttribute(STATUS_IS_SET); return s != null && s; }
[ "private", "boolean", "isStatusSet", "(", "ExecutionAttributes", "attrs", ")", "{", "Boolean", "s", "=", "attrs", ".", "getAttribute", "(", "STATUS_IS_SET", ")", ";", "return", "s", "!=", "null", "&&", "s", ";", "}" ]
For network errors there will not be a response so the status will not have been set. This method looks for a flag in the attributes to see if we need to close off the log entry for the attempt.
[ "For", "network", "errors", "there", "will", "not", "be", "a", "response", "so", "the", "status", "will", "not", "have", "been", "set", ".", "This", "method", "looks", "for", "a", "flag", "in", "the", "attributes", "to", "see", "if", "we", "need", "to"...
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-aws2/src/main/java/com/netflix/spectator/aws2/SpectatorExecutionInterceptor.java#L73-L76
28,705
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Subscriptions.java
Subscriptions.update
public void update(Map<Subscription, Long> subs, long currentTime, long expirationTime) { // Update expiration time for existing subs and log new ones for (Subscription sub : expressions) { if (subs.put(sub, expirationTime) == null) { LOGGER.info("new subscription: {}", sub); } } //...
java
public void update(Map<Subscription, Long> subs, long currentTime, long expirationTime) { // Update expiration time for existing subs and log new ones for (Subscription sub : expressions) { if (subs.put(sub, expirationTime) == null) { LOGGER.info("new subscription: {}", sub); } } //...
[ "public", "void", "update", "(", "Map", "<", "Subscription", ",", "Long", ">", "subs", ",", "long", "currentTime", ",", "long", "expirationTime", ")", "{", "// Update expiration time for existing subs and log new ones", "for", "(", "Subscription", "sub", ":", "expre...
Merge the subscriptions from this update into a map from subscriptions to expiration times. @param subs Existing subscriptions. The map value is the expiration time in millis since the epoch. @param currentTime Current time to use for checking if entries are expired. @param expirationTime Expiration time used for new ...
[ "Merge", "the", "subscriptions", "from", "this", "update", "into", "a", "map", "from", "subscriptions", "to", "expiration", "times", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Subscriptions.java#L56-L73
28,706
Netflix/spectator
spectator-reg-micrometer/src/main/java/com/netflix/spectator/micrometer/MicrometerMeter.java
MicrometerMeter.convert
Iterable<Measurement> convert(Iterable<io.micrometer.core.instrument.Measurement> ms) { long now = Clock.SYSTEM.wallTime(); List<Measurement> measurements = new ArrayList<>(); for (io.micrometer.core.instrument.Measurement m : ms) { Id measurementId = id.withTag("statistic", m.getStatistic().getTagVal...
java
Iterable<Measurement> convert(Iterable<io.micrometer.core.instrument.Measurement> ms) { long now = Clock.SYSTEM.wallTime(); List<Measurement> measurements = new ArrayList<>(); for (io.micrometer.core.instrument.Measurement m : ms) { Id measurementId = id.withTag("statistic", m.getStatistic().getTagVal...
[ "Iterable", "<", "Measurement", ">", "convert", "(", "Iterable", "<", "io", ".", "micrometer", ".", "core", ".", "instrument", ".", "Measurement", ">", "ms", ")", "{", "long", "now", "=", "Clock", ".", "SYSTEM", ".", "wallTime", "(", ")", ";", "List", ...
Helper for converting Micrometer measurements to Spectator measurements.
[ "Helper", "for", "converting", "Micrometer", "measurements", "to", "Spectator", "measurements", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-micrometer/src/main/java/com/netflix/spectator/micrometer/MicrometerMeter.java#L46-L54
28,707
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/ArrayTagSet.java
ArrayTagSet.create
static ArrayTagSet create(Iterable<Tag> tags) { return (tags instanceof ArrayTagSet) ? (ArrayTagSet) tags : EMPTY.addAll(tags); }
java
static ArrayTagSet create(Iterable<Tag> tags) { return (tags instanceof ArrayTagSet) ? (ArrayTagSet) tags : EMPTY.addAll(tags); }
[ "static", "ArrayTagSet", "create", "(", "Iterable", "<", "Tag", ">", "tags", ")", "{", "return", "(", "tags", "instanceof", "ArrayTagSet", ")", "?", "(", "ArrayTagSet", ")", "tags", ":", "EMPTY", ".", "addAll", "(", "tags", ")", ";", "}" ]
Create a new tag set.
[ "Create", "a", "new", "tag", "set", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/ArrayTagSet.java#L48-L50
28,708
Netflix/spectator
spectator-ext-gc/src/main/java/com/netflix/spectator/gc/CircularBuffer.java
CircularBuffer.add
void add(T item) { int i = nextIndex.getAndIncrement() % data.length(); data.set(i, item); }
java
void add(T item) { int i = nextIndex.getAndIncrement() % data.length(); data.set(i, item); }
[ "void", "add", "(", "T", "item", ")", "{", "int", "i", "=", "nextIndex", ".", "getAndIncrement", "(", ")", "%", "data", ".", "length", "(", ")", ";", "data", ".", "set", "(", "i", ",", "item", ")", ";", "}" ]
Add a new item to the buffer. If the buffer is full a previous entry will get overwritten.
[ "Add", "a", "new", "item", "to", "the", "buffer", ".", "If", "the", "buffer", "is", "full", "a", "previous", "entry", "will", "get", "overwritten", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/CircularBuffer.java#L38-L41
28,709
Netflix/spectator
spectator-ext-gc/src/main/java/com/netflix/spectator/gc/CircularBuffer.java
CircularBuffer.toList
List<T> toList() { List<T> items = new ArrayList<>(data.length()); for (int i = 0; i < data.length(); ++i) { T item = data.get(i); if (item != null) { items.add(item); } } return items; }
java
List<T> toList() { List<T> items = new ArrayList<>(data.length()); for (int i = 0; i < data.length(); ++i) { T item = data.get(i); if (item != null) { items.add(item); } } return items; }
[ "List", "<", "T", ">", "toList", "(", ")", "{", "List", "<", "T", ">", "items", "=", "new", "ArrayList", "<>", "(", "data", ".", "length", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "data", ".", "length", "(", ")",...
Return a list with a copy of the data in the buffer.
[ "Return", "a", "list", "with", "a", "copy", "of", "the", "data", "in", "the", "buffer", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/CircularBuffer.java#L54-L63
28,710
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/Scheduler.java
Scheduler.newThreadFactory
private static ThreadFactory newThreadFactory(final String id) { return new ThreadFactory() { private final AtomicInteger next = new AtomicInteger(); @Override public Thread newThread(Runnable r) { final String name = "spectator-" + id + "-" + next.getAndIncrement(); final Thread t = ne...
java
private static ThreadFactory newThreadFactory(final String id) { return new ThreadFactory() { private final AtomicInteger next = new AtomicInteger(); @Override public Thread newThread(Runnable r) { final String name = "spectator-" + id + "-" + next.getAndIncrement(); final Thread t = ne...
[ "private", "static", "ThreadFactory", "newThreadFactory", "(", "final", "String", "id", ")", "{", "return", "new", "ThreadFactory", "(", ")", "{", "private", "final", "AtomicInteger", "next", "=", "new", "AtomicInteger", "(", ")", ";", "@", "Override", "public...
Create a thread factory using thread names based on the id. All threads will be configured as daemon threads.
[ "Create", "a", "thread", "factory", "using", "thread", "names", "based", "on", "the", "id", ".", "All", "threads", "will", "be", "configured", "as", "daemon", "threads", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/Scheduler.java#L88-L99
28,711
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/Scheduler.java
Scheduler.schedule
public ScheduledFuture<?> schedule(Options options, Runnable task) { if (!started) { startThreads(); } DelayedTask t = new DelayedTask(clock, options, task); queue.put(t); return t; }
java
public ScheduledFuture<?> schedule(Options options, Runnable task) { if (!started) { startThreads(); } DelayedTask t = new DelayedTask(clock, options, task); queue.put(t); return t; }
[ "public", "ScheduledFuture", "<", "?", ">", "schedule", "(", "Options", "options", ",", "Runnable", "task", ")", "{", "if", "(", "!", "started", ")", "{", "startThreads", "(", ")", ";", "}", "DelayedTask", "t", "=", "new", "DelayedTask", "(", "clock", ...
Schedule a repetitive task. @param options Options for controlling the execution of the task. See {@link Options} for more information. @param task Task to execute. @return Future that can be used for cancelling the current and future executions of the task. There is no value associated with the task so the future is ...
[ "Schedule", "a", "repetitive", "task", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/Scheduler.java#L158-L165
28,712
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/Scheduler.java
Scheduler.shutdown
public synchronized void shutdown() { shutdown = true; for (int i = 0; i < threads.length; ++i) { if (threads[i] != null && threads[i].isAlive()) { threads[i].interrupt(); threads[i] = null; } } }
java
public synchronized void shutdown() { shutdown = true; for (int i = 0; i < threads.length; ++i) { if (threads[i] != null && threads[i].isAlive()) { threads[i].interrupt(); threads[i] = null; } } }
[ "public", "synchronized", "void", "shutdown", "(", ")", "{", "shutdown", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "threads", ".", "length", ";", "++", "i", ")", "{", "if", "(", "threads", "[", "i", "]", "!=", "null", "...
Shutdown and cleanup resources associated with the scheduler. All threads will be interrupted, but this method does not block for them to all finish execution.
[ "Shutdown", "and", "cleanup", "resources", "associated", "with", "the", "scheduler", ".", "All", "threads", "will", "be", "interrupted", "but", "this", "method", "does", "not", "block", "for", "them", "to", "all", "finish", "execution", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/Scheduler.java#L171-L179
28,713
Netflix/spectator
spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/JmxConfig.java
JmxConfig.from
static JmxConfig from(Config config) { try { ObjectName query = new ObjectName(config.getString("query")); List<JmxMeasurementConfig> ms = new ArrayList<>(); for (Config cfg : config.getConfigList("measurements")) { ms.add(JmxMeasurementConfig.from(cfg)); } return new JmxConfig...
java
static JmxConfig from(Config config) { try { ObjectName query = new ObjectName(config.getString("query")); List<JmxMeasurementConfig> ms = new ArrayList<>(); for (Config cfg : config.getConfigList("measurements")) { ms.add(JmxMeasurementConfig.from(cfg)); } return new JmxConfig...
[ "static", "JmxConfig", "from", "(", "Config", "config", ")", "{", "try", "{", "ObjectName", "query", "=", "new", "ObjectName", "(", "config", ".", "getString", "(", "\"query\"", ")", ")", ";", "List", "<", "JmxMeasurementConfig", ">", "ms", "=", "new", "...
Create a new instance from the Typesafe Config object.
[ "Create", "a", "new", "instance", "from", "the", "Typesafe", "Config", "object", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/JmxConfig.java#L35-L46
28,714
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/SwapMeter.java
SwapMeter.unwrap
@SuppressWarnings("unchecked") private T unwrap(T meter) { T tmp = meter; while (tmp instanceof SwapMeter<?> && registry == ((SwapMeter<?>) tmp).registry) { tmp = ((SwapMeter<T>) tmp).underlying; } return tmp; }
java
@SuppressWarnings("unchecked") private T unwrap(T meter) { T tmp = meter; while (tmp instanceof SwapMeter<?> && registry == ((SwapMeter<?>) tmp).registry) { tmp = ((SwapMeter<T>) tmp).underlying; } return tmp; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "T", "unwrap", "(", "T", "meter", ")", "{", "T", "tmp", "=", "meter", ";", "while", "(", "tmp", "instanceof", "SwapMeter", "<", "?", ">", "&&", "registry", "==", "(", "(", "SwapMeter", "<",...
If the values are nested, then unwrap any that have the same registry instance.
[ "If", "the", "values", "are", "nested", "then", "unwrap", "any", "that", "have", "the", "same", "registry", "instance", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/SwapMeter.java#L85-L92
28,715
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/DoubleDistributionSummary.java
DoubleDistributionSummary.get
static DoubleDistributionSummary get(Registry registry, Id id) { DoubleDistributionSummary instance = INSTANCES.get(id); if (instance == null) { final Clock c = registry.clock(); DoubleDistributionSummary tmp = new DoubleDistributionSummary(c, id, RESET_FREQ); instance = INSTANCES.putIfAbsent(...
java
static DoubleDistributionSummary get(Registry registry, Id id) { DoubleDistributionSummary instance = INSTANCES.get(id); if (instance == null) { final Clock c = registry.clock(); DoubleDistributionSummary tmp = new DoubleDistributionSummary(c, id, RESET_FREQ); instance = INSTANCES.putIfAbsent(...
[ "static", "DoubleDistributionSummary", "get", "(", "Registry", "registry", ",", "Id", "id", ")", "{", "DoubleDistributionSummary", "instance", "=", "INSTANCES", ".", "get", "(", "id", ")", ";", "if", "(", "instance", "==", "null", ")", "{", "final", "Clock",...
Get or create a double distribution summary with the specified id. @param registry Registry to use. @param id Identifier for the metric being registered. @return Distribution summary corresponding to the id.
[ "Get", "or", "create", "a", "double", "distribution", "summary", "with", "the", "specified", "id", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/DoubleDistributionSummary.java#L70-L82
28,716
Pi4J/pi4j
pi4j-example/src/main/java/odroid/xu4/SpiExample.java
SpiExample.read
public static void read() throws IOException, InterruptedException { for(short channel = 0; channel < ADC_CHANNEL_COUNT; channel++){ int conversion_value = getConversionValue(channel); console.print(String.format(" | %04d", conversion_value)); // print 4 digits with leading zeros ...
java
public static void read() throws IOException, InterruptedException { for(short channel = 0; channel < ADC_CHANNEL_COUNT; channel++){ int conversion_value = getConversionValue(channel); console.print(String.format(" | %04d", conversion_value)); // print 4 digits with leading zeros ...
[ "public", "static", "void", "read", "(", ")", "throws", "IOException", ",", "InterruptedException", "{", "for", "(", "short", "channel", "=", "0", ";", "channel", "<", "ADC_CHANNEL_COUNT", ";", "channel", "++", ")", "{", "int", "conversion_value", "=", "getC...
Read data via SPI bus from MCP3002 chip. @throws IOException
[ "Read", "data", "via", "SPI", "bus", "from", "MCP3002", "chip", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-example/src/main/java/odroid/xu4/SpiExample.java#L122-L129
28,717
Pi4J/pi4j
pi4j-example/src/main/java/odroid/xu4/SpiExample.java
SpiExample.getConversionValue
public static int getConversionValue(short channel) throws IOException { // create a data buffer and initialize a conversion request payload byte data[] = new byte[] { (byte) 0b00000001, // first byte, start bit (byte)(0b10000000 |( ((channel...
java
public static int getConversionValue(short channel) throws IOException { // create a data buffer and initialize a conversion request payload byte data[] = new byte[] { (byte) 0b00000001, // first byte, start bit (byte)(0b10000000 |( ((channel...
[ "public", "static", "int", "getConversionValue", "(", "short", "channel", ")", "throws", "IOException", "{", "// create a data buffer and initialize a conversion request payload", "byte", "data", "[", "]", "=", "new", "byte", "[", "]", "{", "(", "byte", ")", "0b0000...
Communicate to the ADC chip via SPI to get single-ended conversion value for a specified channel. @param channel analog input channel on ADC chip @return conversion value for specified analog input channel @throws IOException
[ "Communicate", "to", "the", "ADC", "chip", "via", "SPI", "to", "get", "single", "-", "ended", "conversion", "value", "for", "a", "specified", "channel", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-example/src/main/java/odroid/xu4/SpiExample.java#L138-L154
28,718
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/platform/PlatformManager.java
PlatformManager.setPlatform
public static void setPlatform(Platform platform) throws PlatformAlreadyAssignedException { // prevent changing the platform once it has been initially set if(PlatformManager.platform != null){ throw new PlatformAlreadyAssignedException(PlatformManager.platform); } // set in...
java
public static void setPlatform(Platform platform) throws PlatformAlreadyAssignedException { // prevent changing the platform once it has been initially set if(PlatformManager.platform != null){ throw new PlatformAlreadyAssignedException(PlatformManager.platform); } // set in...
[ "public", "static", "void", "setPlatform", "(", "Platform", "platform", ")", "throws", "PlatformAlreadyAssignedException", "{", "// prevent changing the platform once it has been initially set", "if", "(", "PlatformManager", ".", "platform", "!=", "null", ")", "{", "throw",...
Set the runtime platform for Pi4J to use. This platform selection will be used to determine the default GPIO providers and I2C providers specific to the selected platform. A platform assignment can only be set once. If a second attempt to set a platform is attempted, the 'PlatformAlreadyAssignedException' will be th...
[ "Set", "the", "runtime", "platform", "for", "Pi4J", "to", "use", ".", "This", "platform", "selection", "will", "be", "used", "to", "determine", "the", "default", "GPIO", "providers", "and", "I2C", "providers", "specific", "to", "the", "selected", "platform", ...
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/platform/PlatformManager.java#L82-L93
28,719
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/platform/PlatformManager.java
PlatformManager.getDefaultPlatform
protected static Platform getDefaultPlatform(){ // attempt to get assigned platform identifier from the environment variables String envPlatformId = System.getenv("PI4J_PLATFORM"); // attempt to get assigned platform identifier from the system properties String platformId = System.getPr...
java
protected static Platform getDefaultPlatform(){ // attempt to get assigned platform identifier from the environment variables String envPlatformId = System.getenv("PI4J_PLATFORM"); // attempt to get assigned platform identifier from the system properties String platformId = System.getPr...
[ "protected", "static", "Platform", "getDefaultPlatform", "(", ")", "{", "// attempt to get assigned platform identifier from the environment variables", "String", "envPlatformId", "=", "System", ".", "getenv", "(", "\"PI4J_PLATFORM\"", ")", ";", "// attempt to get assigned platfo...
Internal method to get the default platform. It will attempt to first get the platform using the 'PI4J_PLATFORM' environment variable, if the environment variable is not configured, then it will attempt to use the system property "pi4j.platform". If the system property is not found or the value is not legal, then ret...
[ "Internal", "method", "to", "get", "the", "default", "platform", ".", "It", "will", "attempt", "to", "first", "get", "the", "platform", "using", "the", "PI4J_PLATFORM", "environment", "variable", "if", "the", "environment", "variable", "is", "not", "configured",...
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/platform/PlatformManager.java#L105-L125
28,720
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/w1/W1Master.java
W1Master.getDeviceIDs
public List<String> getDeviceIDs() { final List<String> ids = new ArrayList<>(); for (final File deviceDir : getDeviceDirs()) { ids.add(deviceDir.getName()); } /* * //for (final W1Device device: devices) { ids.add(device.getId()); */ return ids; ...
java
public List<String> getDeviceIDs() { final List<String> ids = new ArrayList<>(); for (final File deviceDir : getDeviceDirs()) { ids.add(deviceDir.getName()); } /* * //for (final W1Device device: devices) { ids.add(device.getId()); */ return ids; ...
[ "public", "List", "<", "String", ">", "getDeviceIDs", "(", ")", "{", "final", "List", "<", "String", ">", "ids", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "File", "deviceDir", ":", "getDeviceDirs", "(", ")", ")", "{", "ids", ...
Gets a list of all registered slave device ids. @return list of slave ids, can be empty, never null.
[ "Gets", "a", "list", "of", "all", "registered", "slave", "device", "ids", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/w1/W1Master.java#L172-L181
28,721
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/w1/W1Master.java
W1Master.getDevices
@SuppressWarnings("unchecked") public <T> List<T> getDevices(final Class<T> type) { final List<W1Device> allDevices = getDevices(); final List<T> filteredDevices = new ArrayList<>(); for (final W1Device device : allDevices) { if (type.isAssignableFrom(device.getClass())) { ...
java
@SuppressWarnings("unchecked") public <T> List<T> getDevices(final Class<T> type) { final List<W1Device> allDevices = getDevices(); final List<T> filteredDevices = new ArrayList<>(); for (final W1Device device : allDevices) { if (type.isAssignableFrom(device.getClass())) { ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "List", "<", "T", ">", "getDevices", "(", "final", "Class", "<", "T", ">", "type", ")", "{", "final", "List", "<", "W1Device", ">", "allDevices", "=", "getDevices", "(", ")", ...
Get a list of devices that implement a certain interface. @param type @param <T> @return
[ "Get", "a", "list", "of", "devices", "that", "implement", "a", "certain", "interface", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/w1/W1Master.java#L239-L249
28,722
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.getDeviceStatus
public DeviceControllerDeviceStatus getDeviceStatus() throws IOException { // get status from device int deviceStatus = read(MEMADDR_STATUS); // check formal criterias int reservedValue = deviceStatus & STATUS_RESERVED_MASK; if (reservedValue != STATUS_RESERVED_VALUE) { throw new IOException( "statu...
java
public DeviceControllerDeviceStatus getDeviceStatus() throws IOException { // get status from device int deviceStatus = read(MEMADDR_STATUS); // check formal criterias int reservedValue = deviceStatus & STATUS_RESERVED_MASK; if (reservedValue != STATUS_RESERVED_VALUE) { throw new IOException( "statu...
[ "public", "DeviceControllerDeviceStatus", "getDeviceStatus", "(", ")", "throws", "IOException", "{", "// get status from device", "int", "deviceStatus", "=", "read", "(", "MEMADDR_STATUS", ")", ";", "// check formal criterias", "int", "reservedValue", "=", "deviceStatus", ...
Returns the status of the device according EEPROM and WiperLocks. @return The device's status @throws IOException Thrown if communication fails or device returned a malformed result
[ "Returns", "the", "status", "of", "the", "device", "according", "EEPROM", "and", "WiperLocks", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L121-L149
28,723
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.increase
public void increase(final DeviceControllerChannel channel, final int steps) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); } // decrease only work...
java
public void increase(final DeviceControllerChannel channel, final int steps) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); } // decrease only work...
[ "public", "void", "increase", "(", "final", "DeviceControllerChannel", "channel", ",", "final", "int", "steps", ")", "throws", "IOException", "{", "if", "(", "channel", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"null-channel is not allowed...
Increments the volatile wiper for the given number steps. @param channel Which wiper @param steps The number of steps @throws IOException Thrown if communication fails or device returned a malformed result
[ "Increments", "the", "volatile", "wiper", "for", "the", "given", "number", "steps", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L158-L172
28,724
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.decrease
public void decrease(final DeviceControllerChannel channel, final int steps) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); } // decrease only work...
java
public void decrease(final DeviceControllerChannel channel, final int steps) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); } // decrease only work...
[ "public", "void", "decrease", "(", "final", "DeviceControllerChannel", "channel", ",", "final", "int", "steps", ")", "throws", "IOException", "{", "if", "(", "channel", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"null-channel is not allowed...
Decrements the volatile wiper for the given number steps. @param channel Which wiper @param steps The number of steps @throws IOException Thrown if communication fails or device returned a malformed result
[ "Decrements", "the", "volatile", "wiper", "for", "the", "given", "number", "steps", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L181-L195
28,725
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.getValue
public int getValue(final DeviceControllerChannel channel, final boolean nonVolatile) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); } // choose pr...
java
public int getValue(final DeviceControllerChannel channel, final boolean nonVolatile) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); } // choose pr...
[ "public", "int", "getValue", "(", "final", "DeviceControllerChannel", "channel", ",", "final", "boolean", "nonVolatile", ")", "throws", "IOException", "{", "if", "(", "channel", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"null-channel is no...
Receives the current wiper's value from the device. @param channel Which wiper @param nonVolatile volatile or non-volatile value @return The wiper's value @throws IOException Thrown if communication fails or device returned a malformed result
[ "Receives", "the", "current", "wiper", "s", "value", "from", "the", "device", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L205-L224
28,726
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.setValue
public void setValue(final DeviceControllerChannel channel, final int value, final boolean nonVolatile) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); ...
java
public void setValue(final DeviceControllerChannel channel, final int value, final boolean nonVolatile) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); ...
[ "public", "void", "setValue", "(", "final", "DeviceControllerChannel", "channel", ",", "final", "int", "value", ",", "final", "boolean", "nonVolatile", ")", "throws", "IOException", "{", "if", "(", "channel", "==", "null", ")", "{", "throw", "new", "RuntimeExc...
Sets the wiper's value in the device. @param channel Which wiper @param value The wiper's value @param nonVolatile volatile or non-volatile value @throws IOException Thrown if communication fails or device returned a malformed result
[ "Sets", "the", "wiper", "s", "value", "in", "the", "device", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L234-L256
28,727
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.getTerminalConfiguration
public DeviceControllerTerminalConfiguration getTerminalConfiguration( final DeviceControllerChannel channel) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel...
java
public DeviceControllerTerminalConfiguration getTerminalConfiguration( final DeviceControllerChannel channel) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel...
[ "public", "DeviceControllerTerminalConfiguration", "getTerminalConfiguration", "(", "final", "DeviceControllerChannel", "channel", ")", "throws", "IOException", "{", "if", "(", "channel", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"null-channel is ...
Fetches the terminal-configuration from the device for a certain channel. @param channel The channel @return The current terminal-configuration @throws IOException Thrown if communication fails or device returned a malformed result
[ "Fetches", "the", "terminal", "-", "configuration", "from", "the", "device", "for", "a", "certain", "channel", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L265-L286
28,728
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.setTerminalConfiguration
public void setTerminalConfiguration(final DeviceControllerTerminalConfiguration config) throws IOException { if (config == null) { throw new RuntimeException("null-config is not allowed!"); } final DeviceControllerChannel channel = config.getChannel(); if (channel == null) { throw new RuntimeExceptio...
java
public void setTerminalConfiguration(final DeviceControllerTerminalConfiguration config) throws IOException { if (config == null) { throw new RuntimeException("null-config is not allowed!"); } final DeviceControllerChannel channel = config.getChannel(); if (channel == null) { throw new RuntimeExceptio...
[ "public", "void", "setTerminalConfiguration", "(", "final", "DeviceControllerTerminalConfiguration", "config", ")", "throws", "IOException", "{", "if", "(", "config", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"null-config is not allowed!\"", ")"...
Sets the given terminal-configuration to the device. @param config A terminal-configuration for a certain channel. @throws IOException Thrown if communication fails or device returned a malformed result
[ "Sets", "the", "given", "terminal", "-", "configuration", "to", "the", "device", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L294-L325
28,729
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.read
private int read(final byte memAddr) throws IOException { // ask device for reading data - see FIGURE 7-5 byte[] cmd = new byte[] { (byte) ((memAddr << 4) | CMD_READ) }; // read two bytes byte[] buf = new byte[2]; int read = i2cDevice.read(cmd, 0, cmd.length, buf, 0, buf.length); if (read != 2) { t...
java
private int read(final byte memAddr) throws IOException { // ask device for reading data - see FIGURE 7-5 byte[] cmd = new byte[] { (byte) ((memAddr << 4) | CMD_READ) }; // read two bytes byte[] buf = new byte[2]; int read = i2cDevice.read(cmd, 0, cmd.length, buf, 0, buf.length); if (read != 2) { t...
[ "private", "int", "read", "(", "final", "byte", "memAddr", ")", "throws", "IOException", "{", "// ask device for reading data - see FIGURE 7-5", "byte", "[", "]", "cmd", "=", "new", "byte", "[", "]", "{", "(", "byte", ")", "(", "(", "memAddr", "<<", "4", "...
Reads two bytes from the devices at the given memory-address. @param memAddr The memory-address to read from @return The two bytes read @throws IOException Thrown if communication fails or device returned a malformed result
[ "Reads", "two", "bytes", "from", "the", "devices", "at", "the", "given", "memory", "-", "address", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L396-L416
28,730
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.write
private void write(final byte memAddr, final int value) throws IOException { // bit 8 of value byte firstBit = (byte) ((value >> 8) & 0x000001); // ask device for setting a value - see FIGURE 7-2 byte cmd = (byte) ((memAddr << 4) | CMD_WRITE | firstBit); // 7 bits of value byte data = (byte) (value & 0x0...
java
private void write(final byte memAddr, final int value) throws IOException { // bit 8 of value byte firstBit = (byte) ((value >> 8) & 0x000001); // ask device for setting a value - see FIGURE 7-2 byte cmd = (byte) ((memAddr << 4) | CMD_WRITE | firstBit); // 7 bits of value byte data = (byte) (value & 0x0...
[ "private", "void", "write", "(", "final", "byte", "memAddr", ",", "final", "int", "value", ")", "throws", "IOException", "{", "// bit 8 of value", "byte", "firstBit", "=", "(", "byte", ")", "(", "(", "value", ">>", "8", ")", "&", "0x000001", ")", ";", ...
Writes 9 bits of the given value to the device. @param memAddr The memory-address to write to @param value The value to be written @throws IOException Thrown if communication fails or device returned a malformed result
[ "Writes", "9", "bits", "of", "the", "given", "value", "to", "the", "device", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L425-L440
28,731
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/i2c/impl/I2CBusImpl.java
I2CBusImpl.selectBusSlave
protected void selectBusSlave(final I2CDevice device) throws IOException { final int addr = device.getAddress(); if (lastAddress != addr) { lastAddress = addr; file.ioctl(I2CConstants.I2C_SLAVE, addr & 0xFF); } }
java
protected void selectBusSlave(final I2CDevice device) throws IOException { final int addr = device.getAddress(); if (lastAddress != addr) { lastAddress = addr; file.ioctl(I2CConstants.I2C_SLAVE, addr & 0xFF); } }
[ "protected", "void", "selectBusSlave", "(", "final", "I2CDevice", "device", ")", "throws", "IOException", "{", "final", "int", "addr", "=", "device", ".", "getAddress", "(", ")", ";", "if", "(", "lastAddress", "!=", "addr", ")", "{", "lastAddress", "=", "a...
Selects the slave device if not already selected on this bus. Uses SharedSecrets to get the POSIX file descriptor, and runs the required ioctl's via JNI. @param device Device to select
[ "Selects", "the", "slave", "device", "if", "not", "already", "selected", "on", "this", "bus", ".", "Uses", "SharedSecrets", "to", "get", "the", "POSIX", "file", "descriptor", "and", "runs", "the", "required", "ioctl", "s", "via", "JNI", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/i2c/impl/I2CBusImpl.java#L285-L293
28,732
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/gpio/PinProvider.java
PinProvider.allPins
public static Pin[] allPins(PinMode ... mode) { List<Pin> results = new ArrayList<>(); for(Pin p : pins.values()){ EnumSet<PinMode> supported_modes = p.getSupportedPinModes(); for(PinMode m : mode){ if(supported_modes.contains(m)){ results.add(...
java
public static Pin[] allPins(PinMode ... mode) { List<Pin> results = new ArrayList<>(); for(Pin p : pins.values()){ EnumSet<PinMode> supported_modes = p.getSupportedPinModes(); for(PinMode m : mode){ if(supported_modes.contains(m)){ results.add(...
[ "public", "static", "Pin", "[", "]", "allPins", "(", "PinMode", "...", "mode", ")", "{", "List", "<", "Pin", ">", "results", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Pin", "p", ":", "pins", ".", "values", "(", ")", ")", "{", "...
Get all pin instances from this provider that support one of the provided pin modes. @param mode one or more pin modes that you wish to include in the result set @return pin instances that support the provided pin modes
[ "Get", "all", "pin", "instances", "from", "this", "provider", "that", "support", "one", "of", "the", "provided", "pin", "modes", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/gpio/PinProvider.java#L119-L131
28,733
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/sensor/impl/GpioSensorComponent.java
GpioSensorComponent.getState
@Override public SensorState getState() { if(pin.isState(openState)) return SensorState.OPEN; else return SensorState.CLOSED; }
java
@Override public SensorState getState() { if(pin.isState(openState)) return SensorState.OPEN; else return SensorState.CLOSED; }
[ "@", "Override", "public", "SensorState", "getState", "(", ")", "{", "if", "(", "pin", ".", "isState", "(", "openState", ")", ")", "return", "SensorState", ".", "OPEN", ";", "else", "return", "SensorState", ".", "CLOSED", ";", "}" ]
Return the current sensor state based on the GPIO digital output pin state. @return PowerState
[ "Return", "the", "current", "sensor", "state", "based", "on", "the", "GPIO", "digital", "output", "pin", "state", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/sensor/impl/GpioSensorComponent.java#L97-L103
28,734
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/spi/SpiFactory.java
SpiFactory.getInstance
public static SpiDevice getInstance(SpiChannel channel, SpiMode mode) throws IOException { return new SpiDeviceImpl(channel, mode); }
java
public static SpiDevice getInstance(SpiChannel channel, SpiMode mode) throws IOException { return new SpiDeviceImpl(channel, mode); }
[ "public", "static", "SpiDevice", "getInstance", "(", "SpiChannel", "channel", ",", "SpiMode", "mode", ")", "throws", "IOException", "{", "return", "new", "SpiDeviceImpl", "(", "channel", ",", "mode", ")", ";", "}" ]
Create new SpiDevice instance @param channel spi channel to use @param mode spi mode (see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_numbers) @return Return a new SpiDevice impl instance. @throws java.io.IOException
[ "Create", "new", "SpiDevice", "instance" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/spi/SpiFactory.java#L75-L77
28,735
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/mcp/MCP4725GpioProvider.java
MCP4725GpioProvider.setValue
@Override public void setValue(Pin pin, double value) { // validate range if(value <= getMinSupportedValue()){ value = getMinSupportedValue(); } else if(value >= getMaxSupportedValue()){ value = getMaxSupportedValue(); } // the DAC only supp...
java
@Override public void setValue(Pin pin, double value) { // validate range if(value <= getMinSupportedValue()){ value = getMinSupportedValue(); } else if(value >= getMaxSupportedValue()){ value = getMaxSupportedValue(); } // the DAC only supp...
[ "@", "Override", "public", "void", "setValue", "(", "Pin", "pin", ",", "double", "value", ")", "{", "// validate range", "if", "(", "value", "<=", "getMinSupportedValue", "(", ")", ")", "{", "value", "=", "getMinSupportedValue", "(", ")", ";", "}", "else",...
Set the analog output value to an output pin on the DAC immediately. @param pin analog output pin @param value raw value to send to the DAC. (Between: 0..4095)
[ "Set", "the", "analog", "output", "value", "to", "an", "output", "pin", "on", "the", "DAC", "immediately", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/mcp/MCP4725GpioProvider.java#L135-L164
28,736
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java
MicrochipPotentiometerBase.initialize
protected void initialize(final int initialValueForVolatileWipers) throws IOException { if (isCapableOfNonVolatileWiper()) { // the device's volatile-wiper will be set to the value stored // in the non-volatile memory. so for those devices the wiper's // current value has to be retrieved currentValue = ...
java
protected void initialize(final int initialValueForVolatileWipers) throws IOException { if (isCapableOfNonVolatileWiper()) { // the device's volatile-wiper will be set to the value stored // in the non-volatile memory. so for those devices the wiper's // current value has to be retrieved currentValue = ...
[ "protected", "void", "initialize", "(", "final", "int", "initialValueForVolatileWipers", ")", "throws", "IOException", "{", "if", "(", "isCapableOfNonVolatileWiper", "(", ")", ")", "{", "// the device's volatile-wiper will be set to the value stored", "// in the non-volatile me...
Initializes the wiper to a defined status. For devices capable of non-volatile-wipers the non-volatile-value is loaded. For devices not capable the given value is set in the device. @param initialValueForVolatileWipers The initial value for devices not capable @throws IOException Thrown if communication fails or devic...
[ "Initializes", "the", "wiper", "to", "a", "defined", "status", ".", "For", "devices", "capable", "of", "non", "-", "volatile", "-", "wipers", "the", "non", "-", "volatile", "-", "value", "is", "loaded", ".", "For", "devices", "not", "capable", "the", "gi...
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java#L208-L232
28,737
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java
MicrochipPotentiometerBase.updateCacheFromDevice
@Override public int updateCacheFromDevice() throws IOException { currentValue = controller.getValue(DeviceControllerChannel.valueOf(channel), false); return currentValue; }
java
@Override public int updateCacheFromDevice() throws IOException { currentValue = controller.getValue(DeviceControllerChannel.valueOf(channel), false); return currentValue; }
[ "@", "Override", "public", "int", "updateCacheFromDevice", "(", ")", "throws", "IOException", "{", "currentValue", "=", "controller", ".", "getValue", "(", "DeviceControllerChannel", ".", "valueOf", "(", "channel", ")", ",", "false", ")", ";", "return", "current...
Updates the cache to the wiper's value. @return The wiper's current value @throws IOException Thrown if communication fails or device returned a malformed result
[ "Updates", "the", "cache", "to", "the", "wiper", "s", "value", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java#L327-L333
28,738
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java
MicrochipPotentiometerBase.decrease
@Override public void decrease(final int steps) throws IOException { if (currentValue == 0) { return; } if (steps < 0) { throw new RuntimeException("Only positive values for parameter 'steps' allowed!"); } if (getNonVolatileMode() != MicrochipPotentiometerNonVolatileMode.VOLATILE_ONLY) { throw new ...
java
@Override public void decrease(final int steps) throws IOException { if (currentValue == 0) { return; } if (steps < 0) { throw new RuntimeException("Only positive values for parameter 'steps' allowed!"); } if (getNonVolatileMode() != MicrochipPotentiometerNonVolatileMode.VOLATILE_ONLY) { throw new ...
[ "@", "Override", "public", "void", "decrease", "(", "final", "int", "steps", ")", "throws", "IOException", "{", "if", "(", "currentValue", "==", "0", ")", "{", "return", ";", "}", "if", "(", "steps", "<", "0", ")", "{", "throw", "new", "RuntimeExceptio...
Decreases the wiper's value for n steps. @param steps The number of steps to decrease @throws IOException Thrown if communication fails or device returned a malformed result
[ "Decreases", "the", "wiper", "s", "value", "for", "n", "steps", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java#L444-L484
28,739
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java
MicrochipPotentiometerBase.increase
@Override public void increase(final int steps) throws IOException { int maxValue = getMaxValue(); if (currentValue == maxValue) { return; } if (steps < 0) { throw new RuntimeException("only positive values for parameter 'steps' allowed!"); } if (getNonVolatileMode() != MicrochipPotentiometerNonVol...
java
@Override public void increase(final int steps) throws IOException { int maxValue = getMaxValue(); if (currentValue == maxValue) { return; } if (steps < 0) { throw new RuntimeException("only positive values for parameter 'steps' allowed!"); } if (getNonVolatileMode() != MicrochipPotentiometerNonVol...
[ "@", "Override", "public", "void", "increase", "(", "final", "int", "steps", ")", "throws", "IOException", "{", "int", "maxValue", "=", "getMaxValue", "(", ")", ";", "if", "(", "currentValue", "==", "maxValue", ")", "{", "return", ";", "}", "if", "(", ...
Increases the wiper's value for n steps. @param steps The number of steps to increase @throws IOException Thrown if communication fails or device returned a malformed result
[ "Increases", "the", "wiper", "s", "value", "for", "n", "steps", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java#L504-L546
28,740
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java
MicrochipPotentiometerBase.setWiperLock
@Override public void setWiperLock(final boolean enabled) throws IOException { controller.setWiperLock(DeviceControllerChannel.valueOf(channel), enabled); }
java
@Override public void setWiperLock(final boolean enabled) throws IOException { controller.setWiperLock(DeviceControllerChannel.valueOf(channel), enabled); }
[ "@", "Override", "public", "void", "setWiperLock", "(", "final", "boolean", "enabled", ")", "throws", "IOException", "{", "controller", ".", "setWiperLock", "(", "DeviceControllerChannel", ".", "valueOf", "(", "channel", ")", ",", "enabled", ")", ";", "}" ]
Enables or disables wiper-lock. See chapter 5.3. @param enabled wiper-lock for the poti's channel has to be enabled @throws IOException Thrown if communication fails or device returned a malformed result
[ "Enables", "or", "disables", "wiper", "-", "lock", ".", "See", "chapter", "5", ".", "3", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java#L620-L625
28,741
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java
MicrochipPotentiometerBase.doWiperAction
private void doWiperAction(final WiperAction wiperAction) throws IOException { // for volatile-wiper switch (nonVolatileMode) { case VOLATILE_ONLY: case VOLATILE_AND_NONVOLATILE: wiperAction.run(MicrochipPotentiometerDeviceController.VOLATILE_WIPER); break; case NONVOLATILE_ONLY: // do nothing } ...
java
private void doWiperAction(final WiperAction wiperAction) throws IOException { // for volatile-wiper switch (nonVolatileMode) { case VOLATILE_ONLY: case VOLATILE_AND_NONVOLATILE: wiperAction.run(MicrochipPotentiometerDeviceController.VOLATILE_WIPER); break; case NONVOLATILE_ONLY: // do nothing } ...
[ "private", "void", "doWiperAction", "(", "final", "WiperAction", "wiperAction", ")", "throws", "IOException", "{", "// for volatile-wiper", "switch", "(", "nonVolatileMode", ")", "{", "case", "VOLATILE_ONLY", ":", "case", "VOLATILE_AND_NONVOLATILE", ":", "wiperAction", ...
Runs a given 'wiperAction' for the volatile-wiper, the non-volatile-wiper or both according the current nonVolatileMode. @param wiperAction The action to be run @throws IOException Thrown if communication fails or device returned a malformed result @see MicrochipPotentiometerBase#nonVolatileMode
[ "Runs", "a", "given", "wiperAction", "for", "the", "volatile", "-", "wiper", "the", "non", "-", "volatile", "-", "wiper", "or", "both", "according", "the", "current", "nonVolatileMode", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerBase.java#L699-L721
28,742
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/power/impl/GpioPowerComponent.java
GpioPowerComponent.getState
@Override public PowerState getState() { if(pin.isState(onState)) return PowerState.ON; else if(pin.isState(offState)) return PowerState.OFF; else return PowerState.UNKNOWN; }
java
@Override public PowerState getState() { if(pin.isState(onState)) return PowerState.ON; else if(pin.isState(offState)) return PowerState.OFF; else return PowerState.UNKNOWN; }
[ "@", "Override", "public", "PowerState", "getState", "(", ")", "{", "if", "(", "pin", ".", "isState", "(", "onState", ")", ")", "return", "PowerState", ".", "ON", ";", "else", "if", "(", "pin", ".", "isState", "(", "offState", ")", ")", "return", "Po...
Return the current power state based on the GPIO digital output pin state. @return PowerState
[ "Return", "the", "current", "power", "state", "based", "on", "the", "GPIO", "digital", "output", "pin", "state", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/power/impl/GpioPowerComponent.java#L95-L103
28,743
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/gpio/RaspiPin.java
RaspiPin.createDigitalPinNoPullDown
protected static Pin createDigitalPinNoPullDown(int address, String name) { return createDigitalPin(RaspiGpioProvider.NAME, address, name, EnumSet.of(PinPullResistance.OFF, PinPullResistance.PULL_UP), PinEdge.all()); }
java
protected static Pin createDigitalPinNoPullDown(int address, String name) { return createDigitalPin(RaspiGpioProvider.NAME, address, name, EnumSet.of(PinPullResistance.OFF, PinPullResistance.PULL_UP), PinEdge.all()); }
[ "protected", "static", "Pin", "createDigitalPinNoPullDown", "(", "int", "address", ",", "String", "name", ")", "{", "return", "createDigitalPin", "(", "RaspiGpioProvider", ".", "NAME", ",", "address", ",", "name", ",", "EnumSet", ".", "of", "(", "PinPullResistan...
SDC.0 pin has a physical pull-up resistor
[ "SDC", ".", "0", "pin", "has", "a", "physical", "pull", "-", "up", "resistor" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/gpio/RaspiPin.java#L84-L88
28,744
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/gpio/RaspiPin.java
RaspiPin.allPins
public static Pin[] allPins(SystemInfo.BoardType board) { List<Pin> pins = new ArrayList<>(); // pins for all Raspberry Pi models pins.add(RaspiPin.GPIO_00); pins.add(RaspiPin.GPIO_01); pins.add(RaspiPin.GPIO_02); pins.add(RaspiPin.GPIO_03); pins.add(RaspiPin.GPI...
java
public static Pin[] allPins(SystemInfo.BoardType board) { List<Pin> pins = new ArrayList<>(); // pins for all Raspberry Pi models pins.add(RaspiPin.GPIO_00); pins.add(RaspiPin.GPIO_01); pins.add(RaspiPin.GPIO_02); pins.add(RaspiPin.GPIO_03); pins.add(RaspiPin.GPI...
[ "public", "static", "Pin", "[", "]", "allPins", "(", "SystemInfo", ".", "BoardType", "board", ")", "{", "List", "<", "Pin", ">", "pins", "=", "new", "ArrayList", "<>", "(", ")", ";", "// pins for all Raspberry Pi models", "pins", ".", "add", "(", "RaspiPin...
so this method definition will hide the subclass static method)
[ "so", "this", "method", "definition", "will", "hide", "the", "subclass", "static", "method", ")" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/gpio/RaspiPin.java#L125-L179
28,745
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/jni/Serial.java
Serial.write
public synchronized static void write(int fd, InputStream input) throws IOException { // ensure bytes are available if(input.available() <= 0){ throw new IOException("No available bytes in input stream to write to serial port."); } ByteArrayOutputStream buffer = new ByteArr...
java
public synchronized static void write(int fd, InputStream input) throws IOException { // ensure bytes are available if(input.available() <= 0){ throw new IOException("No available bytes in input stream to write to serial port."); } ByteArrayOutputStream buffer = new ByteArr...
[ "public", "synchronized", "static", "void", "write", "(", "int", "fd", ",", "InputStream", "input", ")", "throws", "IOException", "{", "// ensure bytes are available", "if", "(", "input", ".", "available", "(", ")", "<=", "0", ")", "{", "throw", "new", "IOEx...
Read content from an input stream of data and write it to the serial port transmit buffer. @param fd The file descriptor of the serial port/device. @param input An InputStream of data to be transmitted
[ "Read", "content", "from", "an", "input", "stream", "of", "data", "and", "write", "it", "to", "the", "serial", "port", "transmit", "buffer", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/jni/Serial.java#L747-L764
28,746
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java
DacGpioProviderBase.setPercentValue
public void setPercentValue(Pin pin, Number percent){ // validate range if(percent.doubleValue() <= 0){ setValue(pin, getMinSupportedValue()); } else if(percent.doubleValue() >= 100){ setValue(pin, getMaxSupportedValue()); } else{ doubl...
java
public void setPercentValue(Pin pin, Number percent){ // validate range if(percent.doubleValue() <= 0){ setValue(pin, getMinSupportedValue()); } else if(percent.doubleValue() >= 100){ setValue(pin, getMaxSupportedValue()); } else{ doubl...
[ "public", "void", "setPercentValue", "(", "Pin", "pin", ",", "Number", "percent", ")", "{", "// validate range", "if", "(", "percent", ".", "doubleValue", "(", ")", "<=", "0", ")", "{", "setValue", "(", "pin", ",", "getMinSupportedValue", "(", ")", ")", ...
Set the current value in a percentage of the available range instead of a raw value. @param pin @param percent percentage value between 0 and 100.
[ "Set", "the", "current", "value", "in", "a", "percentage", "of", "the", "available", "range", "instead", "of", "a", "raw", "value", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java#L80-L92
28,747
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java
DacGpioProviderBase.setPercentValue
@Override public void setPercentValue(GpioPinAnalogOutput pin, Number percent){ setPercentValue(pin.getPin(), percent); }
java
@Override public void setPercentValue(GpioPinAnalogOutput pin, Number percent){ setPercentValue(pin.getPin(), percent); }
[ "@", "Override", "public", "void", "setPercentValue", "(", "GpioPinAnalogOutput", "pin", ",", "Number", "percent", ")", "{", "setPercentValue", "(", "pin", ".", "getPin", "(", ")", ",", "percent", ")", ";", "}" ]
Set the current analog value as a percentage of the available range instead of a raw value. Thr framework will automatically convert the percentage to a scaled number in the ADC's value range. @return percentage value between 0 and 100.
[ "Set", "the", "current", "analog", "value", "as", "a", "percentage", "of", "the", "available", "range", "instead", "of", "a", "raw", "value", ".", "Thr", "framework", "will", "automatically", "convert", "the", "percentage", "to", "a", "scaled", "number", "in...
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java#L100-L103
28,748
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java
DacGpioProviderBase.setValue
@Override public void setValue(Pin pin, Number value) { super.setValue(pin, value.doubleValue()); }
java
@Override public void setValue(Pin pin, Number value) { super.setValue(pin, value.doubleValue()); }
[ "@", "Override", "public", "void", "setValue", "(", "Pin", "pin", ",", "Number", "value", ")", "{", "super", ".", "setValue", "(", "pin", ",", "value", ".", "doubleValue", "(", ")", ")", ";", "}" ]
Set the requested analog output pin's conversion value. @param pin to get conversion values for @param value analog output pin conversion value
[ "Set", "the", "requested", "analog", "output", "pin", "s", "conversion", "value", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java#L111-L114
28,749
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java
DacGpioProviderBase.shutdown
@Override public void shutdown() { // prevent reentrant invocation if(isShutdown()) return; // perform shutdown login in base super.shutdown(); try { // iterate over all pins and apply shutdown values if configured for the pin instance f...
java
@Override public void shutdown() { // prevent reentrant invocation if(isShutdown()) return; // perform shutdown login in base super.shutdown(); try { // iterate over all pins and apply shutdown values if configured for the pin instance f...
[ "@", "Override", "public", "void", "shutdown", "(", ")", "{", "// prevent reentrant invocation", "if", "(", "isShutdown", "(", ")", ")", "return", ";", "// perform shutdown login in base", "super", ".", "shutdown", "(", ")", ";", "try", "{", "// iterate over all p...
This method is used by the framework to shutdown the DAC instance and apply any configured shutdown values to the DAC pins.
[ "This", "method", "is", "used", "by", "the", "framework", "to", "shutdown", "the", "DAC", "instance", "and", "apply", "any", "configured", "shutdown", "values", "to", "the", "DAC", "pins", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java#L120-L141
28,750
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/util/NativeLibraryLoader.java
NativeLibraryLoader.loadLibraryFromClasspath
public static void loadLibraryFromClasspath(String path) throws IOException { Path inputPath = Paths.get(path); if (!inputPath.isAbsolute()) { throw new IllegalArgumentException("The path has to be absolute, but found: " + inputPath); } String fileNameFull = inputPath.getFileName().toString(); int dotInd...
java
public static void loadLibraryFromClasspath(String path) throws IOException { Path inputPath = Paths.get(path); if (!inputPath.isAbsolute()) { throw new IllegalArgumentException("The path has to be absolute, but found: " + inputPath); } String fileNameFull = inputPath.getFileName().toString(); int dotInd...
[ "public", "static", "void", "loadLibraryFromClasspath", "(", "String", "path", ")", "throws", "IOException", "{", "Path", "inputPath", "=", "Paths", ".", "get", "(", "path", ")", ";", "if", "(", "!", "inputPath", ".", "isAbsolute", "(", ")", ")", "{", "t...
Loads library from classpath The file from classpath is copied into system temporary directory and then loaded. The temporary file is deleted after exiting. Method uses String as filename because the pathname is "abstract", not system-dependent. @param path The file path in classpath as an absolute path, e.g. /packag...
[ "Loads", "library", "from", "classpath" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/util/NativeLibraryLoader.java#L132-L160
28,751
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/serial/SerialDataEvent.java
SerialDataEvent.getHexByteString
public String getHexByteString(CharSequence prefix, CharSequence separator, CharSequence suffix) throws IOException { byte data[] = getBytes(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < data.length; i++) { if(i > 0) sb.append(separator); int v = ...
java
public String getHexByteString(CharSequence prefix, CharSequence separator, CharSequence suffix) throws IOException { byte data[] = getBytes(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < data.length; i++) { if(i > 0) sb.append(separator); int v = ...
[ "public", "String", "getHexByteString", "(", "CharSequence", "prefix", ",", "CharSequence", "separator", ",", "CharSequence", "suffix", ")", "throws", "IOException", "{", "byte", "data", "[", "]", "=", "getBytes", "(", ")", ";", "StringBuilder", "sb", "=", "ne...
Get a HEX string representation of the bytes available in the serial data receive buffer @param prefix optional prefix string to append before each data byte @param separator optional separator string to append in between each data byte sequence @param suffix optional suffix string to append after each data byte @ret...
[ "Get", "a", "HEX", "string", "representation", "of", "the", "bytes", "available", "in", "the", "serial", "data", "receive", "buffer" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/serial/SerialDataEvent.java#L187-L200
28,752
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convert
public static double convert(TemperatureScale from, TemperatureScale to, double temperature) { switch(from) { case FARENHEIT: return convertFromFarenheit(to, temperature); case CELSIUS: return convertFromCelsius(to, temperature); case KELVIN:...
java
public static double convert(TemperatureScale from, TemperatureScale to, double temperature) { switch(from) { case FARENHEIT: return convertFromFarenheit(to, temperature); case CELSIUS: return convertFromCelsius(to, temperature); case KELVIN:...
[ "public", "static", "double", "convert", "(", "TemperatureScale", "from", ",", "TemperatureScale", "to", ",", "double", "temperature", ")", "{", "switch", "(", "from", ")", "{", "case", "FARENHEIT", ":", "return", "convertFromFarenheit", "(", "to", ",", "tempe...
Convert a temperature value from one temperature scale to another. @param from TemperatureScale @param to TemperatureScale @param temperature value @return converted temperature value in the requested to scale
[ "Convert", "a", "temperature", "value", "from", "one", "temperature", "scale", "to", "another", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L48-L63
28,753
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertFromFarenheit
public static double convertFromFarenheit (TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return temperature; case CELSIUS: return convertFarenheitToCelsius(temperature); case KELVIN: return convertFar...
java
public static double convertFromFarenheit (TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return temperature; case CELSIUS: return convertFarenheitToCelsius(temperature); case KELVIN: return convertFar...
[ "public", "static", "double", "convertFromFarenheit", "(", "TemperatureScale", "to", ",", "double", "temperature", ")", "{", "switch", "(", "to", ")", "{", "case", "FARENHEIT", ":", "return", "temperature", ";", "case", "CELSIUS", ":", "return", "convertFarenhei...
Convert a temperature value from the Farenheit temperature scale to another. @param to TemperatureScale @param temperature value in degrees Farenheit @return converted temperature value in the requested to scale
[ "Convert", "a", "temperature", "value", "from", "the", "Farenheit", "temperature", "scale", "to", "another", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L73-L88
28,754
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertToFarenheit
public static double convertToFarenheit (TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return temperature; case CELSIUS: return convertCelsiusToFarenheit(temperature); case KELVIN: return convertK...
java
public static double convertToFarenheit (TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return temperature; case CELSIUS: return convertCelsiusToFarenheit(temperature); case KELVIN: return convertK...
[ "public", "static", "double", "convertToFarenheit", "(", "TemperatureScale", "from", ",", "double", "temperature", ")", "{", "switch", "(", "from", ")", "{", "case", "FARENHEIT", ":", "return", "temperature", ";", "case", "CELSIUS", ":", "return", "convertCelsiu...
Convert a temperature value from another temperature scale into the Farenheit temperature scale. @param from TemperatureScale @param temperature value from other scale @return converted temperature value in degrees Farenheit
[ "Convert", "a", "temperature", "value", "from", "another", "temperature", "scale", "into", "the", "Farenheit", "temperature", "scale", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L97-L112
28,755
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertFromCelsius
public static double convertFromCelsius(TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return convertCelsiusToFarenheit(temperature); case CELSIUS: return temperature; case KELVIN: return convertCelsiu...
java
public static double convertFromCelsius(TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return convertCelsiusToFarenheit(temperature); case CELSIUS: return temperature; case KELVIN: return convertCelsiu...
[ "public", "static", "double", "convertFromCelsius", "(", "TemperatureScale", "to", ",", "double", "temperature", ")", "{", "switch", "(", "to", ")", "{", "case", "FARENHEIT", ":", "return", "convertCelsiusToFarenheit", "(", "temperature", ")", ";", "case", "CELS...
Convert a temperature value from the Celsius temperature scale to another. @param to TemperatureScale @param temperature value in degrees centigrade @return converted temperature value in the requested to scale
[ "Convert", "a", "temperature", "value", "from", "the", "Celsius", "temperature", "scale", "to", "another", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L121-L136
28,756
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertToCelsius
public static double convertToCelsius (TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return convertFarenheitToCelsius(temperature); case CELSIUS: return temperature; case KELVIN: return convertKel...
java
public static double convertToCelsius (TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return convertFarenheitToCelsius(temperature); case CELSIUS: return temperature; case KELVIN: return convertKel...
[ "public", "static", "double", "convertToCelsius", "(", "TemperatureScale", "from", ",", "double", "temperature", ")", "{", "switch", "(", "from", ")", "{", "case", "FARENHEIT", ":", "return", "convertFarenheitToCelsius", "(", "temperature", ")", ";", "case", "CE...
Convert a temperature value from another temperature scale into the Celsius temperature scale. @param from TemperatureScale @param temperature value from other scale @return converted temperature value in degrees centigrade
[ "Convert", "a", "temperature", "value", "from", "another", "temperature", "scale", "into", "the", "Celsius", "temperature", "scale", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L145-L160
28,757
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertFromKelvin
public static double convertFromKelvin(TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return convertKelvinToFarenheit(temperature); case CELSIUS: return convertKelvinToCelsius(temperature); case KELVIN: ...
java
public static double convertFromKelvin(TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return convertKelvinToFarenheit(temperature); case CELSIUS: return convertKelvinToCelsius(temperature); case KELVIN: ...
[ "public", "static", "double", "convertFromKelvin", "(", "TemperatureScale", "to", ",", "double", "temperature", ")", "{", "switch", "(", "to", ")", "{", "case", "FARENHEIT", ":", "return", "convertKelvinToFarenheit", "(", "temperature", ")", ";", "case", "CELSIU...
Convert a temperature value from the Kelvin temperature scale to another. @param to TemperatureScale @param temperature value in Kelvin @return converted temperature value in the requested to scale
[ "Convert", "a", "temperature", "value", "from", "the", "Kelvin", "temperature", "scale", "to", "another", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L169-L184
28,758
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertToKelvin
public static double convertToKelvin(TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return convertFarenheitToKelvin(temperature); case CELSIUS: return convertCelsiusToKelvin(temperature); case KELVIN: ...
java
public static double convertToKelvin(TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return convertFarenheitToKelvin(temperature); case CELSIUS: return convertCelsiusToKelvin(temperature); case KELVIN: ...
[ "public", "static", "double", "convertToKelvin", "(", "TemperatureScale", "from", ",", "double", "temperature", ")", "{", "switch", "(", "from", ")", "{", "case", "FARENHEIT", ":", "return", "convertFarenheitToKelvin", "(", "temperature", ")", ";", "case", "CELS...
Convert a temperature value from another temperature scale into the Kelvin temperature scale. @param from TemperatureScale @param temperature value from other scale @return converted temperature value in Kelvin
[ "Convert", "a", "temperature", "value", "from", "another", "temperature", "scale", "into", "the", "Kelvin", "temperature", "scale", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L193-L208
28,759
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertFromRankine
public static double convertFromRankine(TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return convertRankineToFarenheit(temperature); case CELSIUS: return convertRankineToCelsius(temperature); case KELVIN: ...
java
public static double convertFromRankine(TemperatureScale to, double temperature) { switch(to) { case FARENHEIT: return convertRankineToFarenheit(temperature); case CELSIUS: return convertRankineToCelsius(temperature); case KELVIN: ...
[ "public", "static", "double", "convertFromRankine", "(", "TemperatureScale", "to", ",", "double", "temperature", ")", "{", "switch", "(", "to", ")", "{", "case", "FARENHEIT", ":", "return", "convertRankineToFarenheit", "(", "temperature", ")", ";", "case", "CELS...
Convert a temperature value from the Rankine temperature scale to another. @param to TemperatureScale @param temperature value in degrees Rankine @return converted temperature value in the requested to scale
[ "Convert", "a", "temperature", "value", "from", "the", "Rankine", "temperature", "scale", "to", "another", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L217-L232
28,760
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertToRankine
public static double convertToRankine(TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return convertFarenheitToRankine(temperature); case CELSIUS: return convertCelsiusToRankine(temperature); case KELVIN: ...
java
public static double convertToRankine(TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return convertFarenheitToRankine(temperature); case CELSIUS: return convertCelsiusToRankine(temperature); case KELVIN: ...
[ "public", "static", "double", "convertToRankine", "(", "TemperatureScale", "from", ",", "double", "temperature", ")", "{", "switch", "(", "from", ")", "{", "case", "FARENHEIT", ":", "return", "convertFarenheitToRankine", "(", "temperature", ")", ";", "case", "CE...
Convert a temperature value from another temperature scale into the Rankine temperature scale. @param from TemperatureScale @param temperature value from other scale @return converted temperature value in degrees Rankine
[ "Convert", "a", "temperature", "value", "from", "another", "temperature", "scale", "into", "the", "Rankine", "temperature", "scale", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L241-L256
28,761
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java
AdcGpioProviderBase.getPercentValue
public float getPercentValue(Pin pin){ double value = getValue(pin); if(value > INVALID_VALUE) { return (float) (value / (getMaxSupportedValue() - getMinSupportedValue())) * 100f; } return INVALID_VALUE; }
java
public float getPercentValue(Pin pin){ double value = getValue(pin); if(value > INVALID_VALUE) { return (float) (value / (getMaxSupportedValue() - getMinSupportedValue())) * 100f; } return INVALID_VALUE; }
[ "public", "float", "getPercentValue", "(", "Pin", "pin", ")", "{", "double", "value", "=", "getValue", "(", "pin", ")", ";", "if", "(", "value", ">", "INVALID_VALUE", ")", "{", "return", "(", "float", ")", "(", "value", "/", "(", "getMaxSupportedValue", ...
Get the current value in a percentage of the available range instead of a raw value. @return percentage value between 0 and 100.
[ "Get", "the", "current", "value", "in", "a", "percentage", "of", "the", "available", "range", "instead", "of", "a", "raw", "value", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java#L125-L131
28,762
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java
AdcGpioProviderBase.shutdown
@Override public void shutdown() { // prevent reentrant invocation if(isShutdown()) return; // perform shutdown login in base super.shutdown(); try { // if a monitor is running, then shut it down now if (monitor != null) { ...
java
@Override public void shutdown() { // prevent reentrant invocation if(isShutdown()) return; // perform shutdown login in base super.shutdown(); try { // if a monitor is running, then shut it down now if (monitor != null) { ...
[ "@", "Override", "public", "void", "shutdown", "(", ")", "{", "// prevent reentrant invocation", "if", "(", "isShutdown", "(", ")", ")", "return", ";", "// perform shutdown login in base", "super", ".", "shutdown", "(", ")", ";", "try", "{", "// if a monitor is ru...
This method is used by the framework to shutdown the background monitoring thread if needed when the program exits.
[ "This", "method", "is", "used", "by", "the", "framework", "to", "shutdown", "the", "background", "monitoring", "thread", "if", "needed", "when", "the", "program", "exits", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java#L159-L179
28,763
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java
AdcGpioProviderBase.setEventThreshold
@Override public void setEventThreshold(double threshold, GpioPinAnalogInput...pin){ for(GpioPin p : pin){ setEventThreshold(threshold, p.getPin()); } }
java
@Override public void setEventThreshold(double threshold, GpioPinAnalogInput...pin){ for(GpioPin p : pin){ setEventThreshold(threshold, p.getPin()); } }
[ "@", "Override", "public", "void", "setEventThreshold", "(", "double", "threshold", ",", "GpioPinAnalogInput", "...", "pin", ")", "{", "for", "(", "GpioPin", "p", ":", "pin", ")", "{", "setEventThreshold", "(", "threshold", ",", "p", ".", "getPin", "(", ")...
Set the event threshold value for a given analog input pin. The event threshold value determines how much change in the analog input pin's conversion value must occur before the framework issues an analog input pin change event. A threshold is necessary to prevent a significant number of analog input change events fr...
[ "Set", "the", "event", "threshold", "value", "for", "a", "given", "analog", "input", "pin", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java#L258-L263
28,764
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java
AdcGpioProviderBase.setMonitorEnabled
@Override public void setMonitorEnabled(boolean enabled) { if(enabled) { // create and start background monitor if (monitor == null) { monitor = new AdcGpioProviderBase.ADCMonitor(); monitor.start(); } } else{ tr...
java
@Override public void setMonitorEnabled(boolean enabled) { if(enabled) { // create and start background monitor if (monitor == null) { monitor = new AdcGpioProviderBase.ADCMonitor(); monitor.start(); } } else{ tr...
[ "@", "Override", "public", "void", "setMonitorEnabled", "(", "boolean", "enabled", ")", "{", "if", "(", "enabled", ")", "{", "// create and start background monitor", "if", "(", "monitor", "==", "null", ")", "{", "monitor", "=", "new", "AdcGpioProviderBase", "."...
Set the background monitoring thread's enabled state. @param enabled monitoring enabled or disabled state
[ "Set", "the", "background", "monitoring", "thread", "s", "enabled", "state", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java#L310-L331
28,765
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/file/LinuxFile.java
LinuxFile.ioctl
public void ioctl(long command, int value) throws IOException { final int response = directIOCTL(getFileDescriptor(), command, value); if(response < 0) throw new LinuxFileException(); }
java
public void ioctl(long command, int value) throws IOException { final int response = directIOCTL(getFileDescriptor(), command, value); if(response < 0) throw new LinuxFileException(); }
[ "public", "void", "ioctl", "(", "long", "command", ",", "int", "value", ")", "throws", "IOException", "{", "final", "int", "response", "=", "directIOCTL", "(", "getFileDescriptor", "(", ")", ",", "command", ",", "value", ")", ";", "if", "(", "response", ...
Runs an ioctl value command on a file descriptor. @param command ioctl command @param value int ioctl value @return result of operation. Zero if everything is OK, less than zero if there was an error.
[ "Runs", "an", "ioctl", "value", "command", "on", "a", "file", "descriptor", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/file/LinuxFile.java#L102-L107
28,766
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/file/LinuxFile.java
LinuxFile.ioctl
public void ioctl(final long command, ByteBuffer data, IntBuffer offsets) throws IOException { ByteBuffer originalData = data; if(data == null || offsets == null) throw new NullPointerException("data and offsets required!"); if(offsets.order() != ByteOrder.nativeOrder()) ...
java
public void ioctl(final long command, ByteBuffer data, IntBuffer offsets) throws IOException { ByteBuffer originalData = data; if(data == null || offsets == null) throw new NullPointerException("data and offsets required!"); if(offsets.order() != ByteOrder.nativeOrder()) ...
[ "public", "void", "ioctl", "(", "final", "long", "command", ",", "ByteBuffer", "data", ",", "IntBuffer", "offsets", ")", "throws", "IOException", "{", "ByteBuffer", "originalData", "=", "data", ";", "if", "(", "data", "==", "null", "||", "offsets", "==", "...
Runs an ioctl on a file descriptor. Uses special offset buffer to produce real C-like structures with pointers. Advanced use only! Must be able to produce byte-perfect data structures just as gcc would on this system, including struct padding and pointer size. The data ByteBuffer uses the current position to determine...
[ "Runs", "an", "ioctl", "on", "a", "file", "descriptor", ".", "Uses", "special", "offset", "buffer", "to", "produce", "real", "C", "-", "like", "structures", "with", "pointers", ".", "Advanced", "use", "only!", "Must", "be", "able", "to", "produce", "byte",...
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/file/LinuxFile.java#L143-L209
28,767
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/file/LinuxFile.java
LinuxFile.getFileDescriptor
private int getFileDescriptor() throws IOException { final int fd = SharedSecrets.getJavaIOFileDescriptorAccess().get(getFD()); if(fd < 1) throw new IOException("failed to get POSIX file descriptor!"); return fd; }
java
private int getFileDescriptor() throws IOException { final int fd = SharedSecrets.getJavaIOFileDescriptorAccess().get(getFD()); if(fd < 1) throw new IOException("failed to get POSIX file descriptor!"); return fd; }
[ "private", "int", "getFileDescriptor", "(", ")", "throws", "IOException", "{", "final", "int", "fd", "=", "SharedSecrets", ".", "getJavaIOFileDescriptorAccess", "(", ")", ".", "get", "(", "getFD", "(", ")", ")", ";", "if", "(", "fd", "<", "1", ")", "thro...
Gets the real POSIX file descriptor for use by custom jni calls.
[ "Gets", "the", "real", "POSIX", "file", "descriptor", "for", "use", "by", "custom", "jni", "calls", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/file/LinuxFile.java#L214-L221
28,768
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/file/LinuxFile.java
LinuxFile.mmap
public ByteBuffer mmap(int length, MMAPProt prot, MMAPFlags flags, int offset) throws IOException { long pointer = mmap(getFileDescriptor(), length, prot.flag, flags.flag, offset); if(pointer == -1) throw new LinuxFileException(); return newMappedByteBuffer(length, pointer, () -> {...
java
public ByteBuffer mmap(int length, MMAPProt prot, MMAPFlags flags, int offset) throws IOException { long pointer = mmap(getFileDescriptor(), length, prot.flag, flags.flag, offset); if(pointer == -1) throw new LinuxFileException(); return newMappedByteBuffer(length, pointer, () -> {...
[ "public", "ByteBuffer", "mmap", "(", "int", "length", ",", "MMAPProt", "prot", ",", "MMAPFlags", "flags", ",", "int", "offset", ")", "throws", "IOException", "{", "long", "pointer", "=", "mmap", "(", "getFileDescriptor", "(", ")", ",", "length", ",", "prot...
Direct memory mapping from a file descriptor. This is normally possible through the local FileChannel, but NIO will try to truncate files if they don't report a correct size. This will avoid that. @param length length of desired mapping @param prot protocol used for mapping @param flags flags for mapping @param offse...
[ "Direct", "memory", "mapping", "from", "a", "file", "descriptor", ".", "This", "is", "normally", "possible", "through", "the", "local", "FileChannel", "but", "NIO", "will", "try", "to", "truncate", "files", "if", "they", "don", "t", "report", "a", "correct",...
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/file/LinuxFile.java#L284-L293
28,769
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/relay/impl/GpioRelayComponent.java
GpioRelayComponent.getState
@Override public RelayState getState() { if(pin.isState(openState)) return RelayState.OPEN; else return RelayState.CLOSED; }
java
@Override public RelayState getState() { if(pin.isState(openState)) return RelayState.OPEN; else return RelayState.CLOSED; }
[ "@", "Override", "public", "RelayState", "getState", "(", ")", "{", "if", "(", "pin", ".", "isState", "(", "openState", ")", ")", "return", "RelayState", ".", "OPEN", ";", "else", "return", "RelayState", ".", "CLOSED", ";", "}" ]
Return the current relay state based on the GPIO digital output pin state. @return PowerState
[ "Return", "the", "current", "relay", "state", "based", "on", "the", "GPIO", "digital", "output", "pin", "state", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/relay/impl/GpioRelayComponent.java#L96-L102
28,770
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/motor/impl/GpioStepperMotorComponent.java
GpioStepperMotorComponent.setState
@Override public void setState(MotorState state) { switch(state) { case STOP: { // set internal tracking state currentState = MotorState.STOP; // turn all GPIO pins to OFF state for(GpioPinDigitalOutput pin : pins) ...
java
@Override public void setState(MotorState state) { switch(state) { case STOP: { // set internal tracking state currentState = MotorState.STOP; // turn all GPIO pins to OFF state for(GpioPinDigitalOutput pin : pins) ...
[ "@", "Override", "public", "void", "setState", "(", "MotorState", "state", ")", "{", "switch", "(", "state", ")", "{", "case", "STOP", ":", "{", "// set internal tracking state", "currentState", "=", "MotorState", ".", "STOP", ";", "// turn all GPIO pins to OFF st...
change the current stepper motor state @param state new motor state to apply
[ "change", "the", "current", "stepper", "motor", "state" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/motor/impl/GpioStepperMotorComponent.java#L87-L129
28,771
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/motor/impl/GpioStepperMotorComponent.java
GpioStepperMotorComponent.doStep
private void doStep(boolean forward) { // increment or decrement sequence if(forward) sequenceIndex++; else sequenceIndex--; // check sequence bounds; rollover if needed if(sequenceIndex >= stepSequence.length) sequenceIndex = 0; else...
java
private void doStep(boolean forward) { // increment or decrement sequence if(forward) sequenceIndex++; else sequenceIndex--; // check sequence bounds; rollover if needed if(sequenceIndex >= stepSequence.length) sequenceIndex = 0; else...
[ "private", "void", "doStep", "(", "boolean", "forward", ")", "{", "// increment or decrement sequence", "if", "(", "forward", ")", "sequenceIndex", "++", ";", "else", "sequenceIndex", "--", ";", "// check sequence bounds; rollover if needed", "if", "(", "sequenceIndex",...
this method performs the calculations and work to control the GPIO pins to move the stepper motor forward or reverse @param forward
[ "this", "method", "performs", "the", "calculations", "and", "work", "to", "control", "the", "GPIO", "pins", "to", "move", "the", "stepper", "motor", "forward", "or", "reverse" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/motor/impl/GpioStepperMotorComponent.java#L178-L205
28,772
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/pca/PCA9685GpioProvider.java
PCA9685GpioProvider.calculateOffPositionForPulseDuration
public int calculateOffPositionForPulseDuration(int duration) { validatePwmDuration(duration); int result = (PWM_STEPS - 1) * duration / periodDurationMicros; if (result < 1) { result = 1; } else if (result > PWM_STEPS - 1) { result = PWM_STEPS - 1; } ...
java
public int calculateOffPositionForPulseDuration(int duration) { validatePwmDuration(duration); int result = (PWM_STEPS - 1) * duration / periodDurationMicros; if (result < 1) { result = 1; } else if (result > PWM_STEPS - 1) { result = PWM_STEPS - 1; } ...
[ "public", "int", "calculateOffPositionForPulseDuration", "(", "int", "duration", ")", "{", "validatePwmDuration", "(", "duration", ")", ";", "int", "result", "=", "(", "PWM_STEPS", "-", "1", ")", "*", "duration", "/", "periodDurationMicros", ";", "if", "(", "r...
Calculates the OFF position for a certain pulse duration. @param duration pulse duration in microseconds @return OFF position(value between 1 and 4095)
[ "Calculates", "the", "OFF", "position", "for", "a", "certain", "pulse", "duration", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/pca/PCA9685GpioProvider.java#L264-L273
28,773
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/i2c/I2CFactory.java
I2CFactory.getInstance
public static I2CBus getInstance(int busNumber, long lockAquireTimeout, TimeUnit lockAquireTimeoutUnit) throws UnsupportedBusNumberException, IOException { return provider.getBus(busNumber, lockAquireTimeout, lockAquireTimeoutUnit); }
java
public static I2CBus getInstance(int busNumber, long lockAquireTimeout, TimeUnit lockAquireTimeoutUnit) throws UnsupportedBusNumberException, IOException { return provider.getBus(busNumber, lockAquireTimeout, lockAquireTimeoutUnit); }
[ "public", "static", "I2CBus", "getInstance", "(", "int", "busNumber", ",", "long", "lockAquireTimeout", ",", "TimeUnit", "lockAquireTimeoutUnit", ")", "throws", "UnsupportedBusNumberException", ",", "IOException", "{", "return", "provider", ".", "getBus", "(", "busNum...
Create new I2CBus instance. @param busNumber The bus number @param lockAquireTimeout The timeout for locking the bus for exclusive communication @param lockAquireTimeoutUnit The units of lockAquireTimeout @return Return a new I2CBus instance @throws UnsupportedBusNumberException If the given bus-number is not supporte...
[ "Create", "new", "I2CBus", "instance", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/i2c/I2CFactory.java#L94-L96
28,774
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/i2c/I2CFactory.java
I2CFactory.getBusIds
public static int[] getBusIds() throws IOException { Set<Integer> set = null; for (Path device: Files.newDirectoryStream(Paths.get("/sys/bus/i2c/devices"), "*")) { String[] tokens = device.toString().split("-"); if (tokens.length == 2) { if (set == null) { ...
java
public static int[] getBusIds() throws IOException { Set<Integer> set = null; for (Path device: Files.newDirectoryStream(Paths.get("/sys/bus/i2c/devices"), "*")) { String[] tokens = device.toString().split("-"); if (tokens.length == 2) { if (set == null) { ...
[ "public", "static", "int", "[", "]", "getBusIds", "(", ")", "throws", "IOException", "{", "Set", "<", "Integer", ">", "set", "=", "null", ";", "for", "(", "Path", "device", ":", "Files", ".", "newDirectoryStream", "(", "Paths", ".", "get", "(", "\"/sys...
Fetch all available I2C bus numbers from sysfs. Returns null, if nothing was found. @return Return found I2C bus numbers or null @throws IOException If fetching from sysfs interface fails
[ "Fetch", "all", "available", "I2C", "bus", "numbers", "from", "sysfs", ".", "Returns", "null", "if", "nothing", "was", "found", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/i2c/I2CFactory.java#L114-L136
28,775
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/serial/impl/SerialImpl.java
SerialImpl.close
@Override public void close() throws IllegalStateException, IOException { // validate state if (isClosed()) throw new IllegalStateException("Serial connection is not open; cannot 'close()'."); // remove serial port listener SerialInterrupt.removeListener(fileDescriptor); ...
java
@Override public void close() throws IllegalStateException, IOException { // validate state if (isClosed()) throw new IllegalStateException("Serial connection is not open; cannot 'close()'."); // remove serial port listener SerialInterrupt.removeListener(fileDescriptor); ...
[ "@", "Override", "public", "void", "close", "(", ")", "throws", "IllegalStateException", ",", "IOException", "{", "// validate state", "if", "(", "isClosed", "(", ")", ")", "throw", "new", "IllegalStateException", "(", "\"Serial connection is not open; cannot 'close()'....
This method is called to close a currently open open serial port. @throws IllegalStateException thrown if the serial port is not already open. @throws IOException thrown on any error.
[ "This", "method", "is", "called", "to", "close", "a", "currently", "open", "open", "serial", "port", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/serial/impl/SerialImpl.java#L348-L363
28,776
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/wdt/impl/WDTimerImpl.java
WDTimerImpl.open
public void open(String file) throws IOException { filename = file; if(fd>0) { throw new IOException("File "+filename+" already open."); } fd = WDT.open(file); if(fd<0) { throw new IOException("Cannot open file handle for " + fi...
java
public void open(String file) throws IOException { filename = file; if(fd>0) { throw new IOException("File "+filename+" already open."); } fd = WDT.open(file); if(fd<0) { throw new IOException("Cannot open file handle for " + fi...
[ "public", "void", "open", "(", "String", "file", ")", "throws", "IOException", "{", "filename", "=", "file", ";", "if", "(", "fd", ">", "0", ")", "{", "throw", "new", "IOException", "(", "\"File \"", "+", "filename", "+", "\" already open.\"", ")", ";", ...
Open custom Watchdog @param file @throws IOException
[ "Open", "custom", "Watchdog" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/wdt/impl/WDTimerImpl.java#L76-L85
28,777
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/wdt/impl/WDTimerImpl.java
WDTimerImpl.setTimeOut
@Override public void setTimeOut(int timeout) throws IOException { isOpen(); int ret = WDT.setTimeOut(fd, timeout); if(ret<0) { throw new IOException("Cannot set timeout for " + filename + " got " + ret + " back."); } }
java
@Override public void setTimeOut(int timeout) throws IOException { isOpen(); int ret = WDT.setTimeOut(fd, timeout); if(ret<0) { throw new IOException("Cannot set timeout for " + filename + " got " + ret + " back."); } }
[ "@", "Override", "public", "void", "setTimeOut", "(", "int", "timeout", ")", "throws", "IOException", "{", "isOpen", "(", ")", ";", "int", "ret", "=", "WDT", ".", "setTimeOut", "(", "fd", ",", "timeout", ")", ";", "if", "(", "ret", "<", "0", ")", "...
Set new timeout @param timeout @throws IOException
[ "Set", "new", "timeout" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/wdt/impl/WDTimerImpl.java#L93-L100
28,778
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/wdt/impl/WDTimerImpl.java
WDTimerImpl.heartbeat
@Override public void heartbeat() throws IOException { isOpen(); int ret = WDT.ping(fd); if(ret<0) { throw new IOException("Heartbeat error. File " + filename + " got " + ret + " back."); } }
java
@Override public void heartbeat() throws IOException { isOpen(); int ret = WDT.ping(fd); if(ret<0) { throw new IOException("Heartbeat error. File " + filename + " got " + ret + " back."); } }
[ "@", "Override", "public", "void", "heartbeat", "(", ")", "throws", "IOException", "{", "isOpen", "(", ")", ";", "int", "ret", "=", "WDT", ".", "ping", "(", "fd", ")", ";", "if", "(", "ret", "<", "0", ")", "{", "throw", "new", "IOException", "(", ...
Ping a watchdog. @throws IOException
[ "Ping", "a", "watchdog", "." ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/wdt/impl/WDTimerImpl.java#L123-L130
28,779
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/wdt/impl/WDTimerImpl.java
WDTimerImpl.disable
@Override public void disable() throws IOException { isOpen(); int ret = WDT.disable(fd); if(ret<0) { throw new IOException("Cannot disable WatchDog. File " + filename + " got " + ret + " back."); } }
java
@Override public void disable() throws IOException { isOpen(); int ret = WDT.disable(fd); if(ret<0) { throw new IOException("Cannot disable WatchDog. File " + filename + " got " + ret + " back."); } }
[ "@", "Override", "public", "void", "disable", "(", ")", "throws", "IOException", "{", "isOpen", "(", ")", ";", "int", "ret", "=", "WDT", ".", "disable", "(", "fd", ")", ";", "if", "(", "ret", "<", "0", ")", "{", "throw", "new", "IOException", "(", ...
Disable watchdog with "Magic Close". Now watchdog not working. Close watchdog without call disable causes RaspberryPi reboot! @throws IOException
[ "Disable", "watchdog", "with", "Magic", "Close", ".", "Now", "watchdog", "not", "working", ".", "Close", "watchdog", "without", "call", "disable", "causes", "RaspberryPi", "reboot!" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/wdt/impl/WDTimerImpl.java#L137-L144
28,780
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/concurrent/DefaultExecutorServiceFactory.java
DefaultExecutorServiceFactory.getThreadFactory
private static ThreadFactory getThreadFactory(final String nameFormat) { final ThreadFactory defaultThreadFactory = Executors.privilegedThreadFactory(); return new ThreadFactory() { final AtomicLong count = (nameFormat != null) ? new AtomicLong(0) : null; @Override p...
java
private static ThreadFactory getThreadFactory(final String nameFormat) { final ThreadFactory defaultThreadFactory = Executors.privilegedThreadFactory(); return new ThreadFactory() { final AtomicLong count = (nameFormat != null) ? new AtomicLong(0) : null; @Override p...
[ "private", "static", "ThreadFactory", "getThreadFactory", "(", "final", "String", "nameFormat", ")", "{", "final", "ThreadFactory", "defaultThreadFactory", "=", "Executors", ".", "privilegedThreadFactory", "(", ")", ";", "return", "new", "ThreadFactory", "(", ")", "...
return an instance to the thread factory used to create new executor services
[ "return", "an", "instance", "to", "the", "thread", "factory", "used", "to", "create", "new", "executor", "services" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/concurrent/DefaultExecutorServiceFactory.java#L81-L95
28,781
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/concurrent/DefaultExecutorServiceFactory.java
DefaultExecutorServiceFactory.newSingleThreadExecutorService
@Override public ExecutorService newSingleThreadExecutorService() { // create new single thread executor service ExecutorService singleThreadExecutorService = Executors.newSingleThreadExecutor(getThreadFactory("pi4j-single-executor-%d")); // add new instance to managed collection s...
java
@Override public ExecutorService newSingleThreadExecutorService() { // create new single thread executor service ExecutorService singleThreadExecutorService = Executors.newSingleThreadExecutor(getThreadFactory("pi4j-single-executor-%d")); // add new instance to managed collection s...
[ "@", "Override", "public", "ExecutorService", "newSingleThreadExecutorService", "(", ")", "{", "// create new single thread executor service", "ExecutorService", "singleThreadExecutorService", "=", "Executors", ".", "newSingleThreadExecutor", "(", "getThreadFactory", "(", "\"pi4j...
return a new instance of a single thread executor service This method is deprecated in favor of the getGpioEventExecutorService - which provides better guarantees around resource management
[ "return", "a", "new", "instance", "of", "a", "single", "thread", "executor", "service" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/concurrent/DefaultExecutorServiceFactory.java#L119-L130
28,782
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/concurrent/DefaultExecutorServiceFactory.java
DefaultExecutorServiceFactory.shutdown
public void shutdown() { // shutdown each single thread executor in the managed collection for (ExecutorService singleThreadExecutorService : singleThreadExecutorServices) { shutdownExecutor(singleThreadExecutorService); } // shutdown scheduled executor instance shut...
java
public void shutdown() { // shutdown each single thread executor in the managed collection for (ExecutorService singleThreadExecutorService : singleThreadExecutorServices) { shutdownExecutor(singleThreadExecutorService); } // shutdown scheduled executor instance shut...
[ "public", "void", "shutdown", "(", ")", "{", "// shutdown each single thread executor in the managed collection", "for", "(", "ExecutorService", "singleThreadExecutorService", ":", "singleThreadExecutorServices", ")", "{", "shutdownExecutor", "(", "singleThreadExecutorService", "...
shutdown executor threads
[ "shutdown", "executor", "threads" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/concurrent/DefaultExecutorServiceFactory.java#L135-L145
28,783
Pi4J/pi4j
pi4j-example/src/main/java/PibrellaExample.java
PibrellaExample.main
public static void main(String args[]) throws InterruptedException, IOException { System.out.println("<--Pi4J--> Pibrella Example ... started."); // ----------------------------------------------------------------- // create a button listener // ----------------------------------------...
java
public static void main(String args[]) throws InterruptedException, IOException { System.out.println("<--Pi4J--> Pibrella Example ... started."); // ----------------------------------------------------------------- // create a button listener // ----------------------------------------...
[ "public", "static", "void", "main", "(", "String", "args", "[", "]", ")", "throws", "InterruptedException", ",", "IOException", "{", "System", ".", "out", ".", "println", "(", "\"<--Pi4J--> Pibrella Example ... started.\"", ")", ";", "// ------------------------------...
Start Pibrella Example @param args @throws InterruptedException @throws IOException
[ "Start", "Pibrella", "Example" ]
03cacc62223cc59b3118bfcefadabab979fd84c7
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-example/src/main/java/PibrellaExample.java#L56-L104
28,784
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/CharacteristicVector.java
CharacteristicVector.updateGridDensity
public void updateGridDensity(int currTime, double decayFactor, double dl, double dm) { // record the last attribute int lastAtt = this.getAttribute(); // Update the density grid's density double densityOfG = (Math.pow(decayFactor, (currTime-this.getDensityTimeStamp())) * this.getGridDensity()); this.setGr...
java
public void updateGridDensity(int currTime, double decayFactor, double dl, double dm) { // record the last attribute int lastAtt = this.getAttribute(); // Update the density grid's density double densityOfG = (Math.pow(decayFactor, (currTime-this.getDensityTimeStamp())) * this.getGridDensity()); this.setGr...
[ "public", "void", "updateGridDensity", "(", "int", "currTime", ",", "double", "decayFactor", ",", "double", "dl", ",", "double", "dm", ")", "{", "// record the last attribute", "int", "lastAtt", "=", "this", ".", "getAttribute", "(", ")", ";", "// Update the den...
Implements the update the density of all grids step given at line 2 of both Fig 3 and Fig 4 of Chen and Tu 2007. @param currTime the data stream's current internal time @param decayFactor the value of lambda @param dl the threshold for sparse grids @param dm the threshold for dense grids @param addRecord TRUE if a rec...
[ "Implements", "the", "update", "the", "density", "of", "all", "grids", "step", "given", "at", "line", "2", "of", "both", "Fig", "3", "and", "Fig", "4", "of", "Chen", "and", "Tu", "2007", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/CharacteristicVector.java#L235-L258
28,785
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java
SamoaToWekaInstanceConverter.wekaInstance
public weka.core.Instance wekaInstance(Instance inst) { weka.core.Instance wekaInstance; if (((InstanceImpl) inst).instanceData instanceof SparseInstanceData) { InstanceImpl instance = (InstanceImpl) inst; SparseInstanceData sparseInstanceData = (SparseInstanceData) instance.inst...
java
public weka.core.Instance wekaInstance(Instance inst) { weka.core.Instance wekaInstance; if (((InstanceImpl) inst).instanceData instanceof SparseInstanceData) { InstanceImpl instance = (InstanceImpl) inst; SparseInstanceData sparseInstanceData = (SparseInstanceData) instance.inst...
[ "public", "weka", ".", "core", ".", "Instance", "wekaInstance", "(", "Instance", "inst", ")", "{", "weka", ".", "core", ".", "Instance", "wekaInstance", ";", "if", "(", "(", "(", "InstanceImpl", ")", "inst", ")", ".", "instanceData", "instanceof", "SparseI...
Weka instance. @param inst the inst @return the weka.core. instance
[ "Weka", "instance", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java#L37-L72
28,786
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java
SamoaToWekaInstanceConverter.wekaInstances
public weka.core.Instances wekaInstances(Instances instances) { weka.core.Instances wekaInstances = wekaInstancesInformation(instances); //We assume that we have only one WekaInstanceInformation for SamoaToWekaInstanceConverter this.wekaInstanceInformation = wekaInstances; for (int i = 0...
java
public weka.core.Instances wekaInstances(Instances instances) { weka.core.Instances wekaInstances = wekaInstancesInformation(instances); //We assume that we have only one WekaInstanceInformation for SamoaToWekaInstanceConverter this.wekaInstanceInformation = wekaInstances; for (int i = 0...
[ "public", "weka", ".", "core", ".", "Instances", "wekaInstances", "(", "Instances", "instances", ")", "{", "weka", ".", "core", ".", "Instances", "wekaInstances", "=", "wekaInstancesInformation", "(", "instances", ")", ";", "//We assume that we have only one WekaInsta...
Weka instances. @param instances the instances @return the weka.core. instances
[ "Weka", "instances", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java#L80-L88
28,787
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java
SamoaToWekaInstanceConverter.wekaInstancesInformation
public weka.core.Instances wekaInstancesInformation(Instances instances) { weka.core.Instances wekaInstances; ArrayList<weka.core.Attribute> attInfo = new ArrayList<weka.core.Attribute>(); for (int i = 0; i < instances.numAttributes(); i++) { attInfo.add(wekaAttribute(i, instances.at...
java
public weka.core.Instances wekaInstancesInformation(Instances instances) { weka.core.Instances wekaInstances; ArrayList<weka.core.Attribute> attInfo = new ArrayList<weka.core.Attribute>(); for (int i = 0; i < instances.numAttributes(); i++) { attInfo.add(wekaAttribute(i, instances.at...
[ "public", "weka", ".", "core", ".", "Instances", "wekaInstancesInformation", "(", "Instances", "instances", ")", "{", "weka", ".", "core", ".", "Instances", "wekaInstances", ";", "ArrayList", "<", "weka", ".", "core", ".", "Attribute", ">", "attInfo", "=", "...
Weka instances information. @param instances the instances @return the weka.core. instances
[ "Weka", "instances", "information", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java#L96-L115
28,788
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java
SamoaToWekaInstanceConverter.wekaAttribute
protected weka.core.Attribute wekaAttribute(int index, Attribute attribute) { weka.core.Attribute wekaAttribute; if (attribute.isNominal()) { wekaAttribute = new weka.core.Attribute(attribute.name(), attribute.getAttributeValues(), index); } else { wekaAttribut...
java
protected weka.core.Attribute wekaAttribute(int index, Attribute attribute) { weka.core.Attribute wekaAttribute; if (attribute.isNominal()) { wekaAttribute = new weka.core.Attribute(attribute.name(), attribute.getAttributeValues(), index); } else { wekaAttribut...
[ "protected", "weka", ".", "core", ".", "Attribute", "wekaAttribute", "(", "int", "index", ",", "Attribute", "attribute", ")", "{", "weka", ".", "core", ".", "Attribute", "wekaAttribute", ";", "if", "(", "attribute", ".", "isNominal", "(", ")", ")", "{", ...
Weka attribute. @param index the index @param attribute the attribute @return the weka.core. attribute
[ "Weka", "attribute", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java#L124-L135
28,789
Waikato/moa
moa/src/main/java/moa/gui/visualization/AbstractGraphPlot.java
AbstractGraphPlot.setGraph
protected void setGraph(MeasureCollection[] measures, MeasureCollection[] stds, Color[] colors) { this.measures = measures; this.measureStds = stds; this.colors = colors; repaint(); }
java
protected void setGraph(MeasureCollection[] measures, MeasureCollection[] stds, Color[] colors) { this.measures = measures; this.measureStds = stds; this.colors = colors; repaint(); }
[ "protected", "void", "setGraph", "(", "MeasureCollection", "[", "]", "measures", ",", "MeasureCollection", "[", "]", "stds", ",", "Color", "[", "]", "colors", ")", "{", "this", ".", "measures", "=", "measures", ";", "this", ".", "measureStds", "=", "stds",...
Sets the graph by updating the measures and currently measure index. This method should not be directly called, but may be used by subclasses to save space. @param measures measure information @param stds standard deviation of the measures @param colors color encoding for the plots
[ "Sets", "the", "graph", "by", "updating", "the", "measures", "and", "currently", "measure", "index", ".", "This", "method", "should", "not", "be", "directly", "called", "but", "may", "be", "used", "by", "subclasses", "to", "save", "space", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/AbstractGraphPlot.java#L94-L99
28,790
Waikato/moa
moa/src/main/java/com/github/javacliparser/AbstractClassOption.java
AbstractClassOption.stripPackagePrefix
public static String stripPackagePrefix(String className, Class<?> expectedType) { if (className.startsWith(expectedType.getPackage().getName())) { return className.substring(expectedType.getPackage().getName().length() + 1); } return className; }
java
public static String stripPackagePrefix(String className, Class<?> expectedType) { if (className.startsWith(expectedType.getPackage().getName())) { return className.substring(expectedType.getPackage().getName().length() + 1); } return className; }
[ "public", "static", "String", "stripPackagePrefix", "(", "String", "className", ",", "Class", "<", "?", ">", "expectedType", ")", "{", "if", "(", "className", ".", "startsWith", "(", "expectedType", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ")...
Gets the class name without its package name prefix. @param className the name of the class @param expectedType the type of the class @return the class name without its package name prefix
[ "Gets", "the", "class", "name", "without", "its", "package", "name", "prefix", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/github/javacliparser/AbstractClassOption.java#L221-L226
28,791
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/AnyOut/util/EMProjectedClustering.java
EMProjectedClustering.getEMClusteringVariances
public int[][] getEMClusteringVariances(double[][] pointArray, int k) { // initialize field and clustering initFields(pointArray, k); setInitialPartitions(pointArray, k); // iterate M and E double currentExpectation, newExpectation = 0.0; double expectationDeviation; int count = 0; do{ c...
java
public int[][] getEMClusteringVariances(double[][] pointArray, int k) { // initialize field and clustering initFields(pointArray, k); setInitialPartitions(pointArray, k); // iterate M and E double currentExpectation, newExpectation = 0.0; double expectationDeviation; int count = 0; do{ c...
[ "public", "int", "[", "]", "[", "]", "getEMClusteringVariances", "(", "double", "[", "]", "[", "]", "pointArray", ",", "int", "k", ")", "{", "// initialize field and clustering\r", "initFields", "(", "pointArray", ",", "k", ")", ";", "setInitialPartitions", "(...
Performs an EM clustering on the provided data set !! Only the variances are calculated and used for point assignments ! !!! the number k' of returned clusters might be smaller than k !!! @param pointArray the data set as an array[n][d] of n points with d dimensions @param k the number of requested partitions (!might r...
[ "Performs", "an", "EM", "clustering", "on", "the", "provided", "data", "set", "!!", "Only", "the", "variances", "are", "calculated", "and", "used", "for", "point", "assignments", "!", "!!!", "the", "number", "k", "of", "returned", "clusters", "might", "be", ...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/AnyOut/util/EMProjectedClustering.java#L75-L98
28,792
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/AnyOut/util/EMProjectedClustering.java
EMProjectedClustering.setInitialPartitions
private void setInitialPartitions(double[][] pointArray, int k) { if (pointArray.length < k) { System.err.println("cannot cluster less than k points into k clusters..."); System.exit(0); } // select randomly k initial means // TODO: choose more stable initialization (comment: this is run several...
java
private void setInitialPartitions(double[][] pointArray, int k) { if (pointArray.length < k) { System.err.println("cannot cluster less than k points into k clusters..."); System.exit(0); } // select randomly k initial means // TODO: choose more stable initialization (comment: this is run several...
[ "private", "void", "setInitialPartitions", "(", "double", "[", "]", "[", "]", "pointArray", ",", "int", "k", ")", "{", "if", "(", "pointArray", ".", "length", "<", "k", ")", "{", "System", ".", "err", ".", "println", "(", "\"cannot cluster less than k poin...
creates an initial partitioning @param pointArray @param k
[ "creates", "an", "initial", "partitioning" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/AnyOut/util/EMProjectedClustering.java#L150-L187
28,793
Waikato/moa
moa/src/main/java/moa/evaluation/ALWindowClassificationPerformanceEvaluator.java
ALWindowClassificationPerformanceEvaluator.doLabelAcqReport
@Override public void doLabelAcqReport(Example<Instance> trainInst, int labelAcquired) { this.acquisitionRateEstimator.add(labelAcquired); this.acquiredInstances += labelAcquired; }
java
@Override public void doLabelAcqReport(Example<Instance> trainInst, int labelAcquired) { this.acquisitionRateEstimator.add(labelAcquired); this.acquiredInstances += labelAcquired; }
[ "@", "Override", "public", "void", "doLabelAcqReport", "(", "Example", "<", "Instance", ">", "trainInst", ",", "int", "labelAcquired", ")", "{", "this", ".", "acquisitionRateEstimator", ".", "add", "(", "labelAcquired", ")", ";", "this", ".", "acquiredInstances"...
Receives the information if a label has been acquired and increases counters. @param trainInst the instance that was previously considered @param labelAcquired bool type which indicates if trainInst was acquired by the active learner
[ "Receives", "the", "information", "if", "a", "label", "has", "been", "acquired", "and", "increases", "counters", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/evaluation/ALWindowClassificationPerformanceEvaluator.java#L52-L56
28,794
Waikato/moa
moa/src/main/java/moa/core/Utils.java
Utils.removeSubstring
public static String removeSubstring(String inString, String substring) { StringBuffer result = new StringBuffer(); int oldLoc = 0, loc = 0; while ((loc = inString.indexOf(substring, oldLoc))!= -1) { result.append(inString.substring(oldLoc, loc)); oldLoc = loc + substring.length(); } re...
java
public static String removeSubstring(String inString, String substring) { StringBuffer result = new StringBuffer(); int oldLoc = 0, loc = 0; while ((loc = inString.indexOf(substring, oldLoc))!= -1) { result.append(inString.substring(oldLoc, loc)); oldLoc = loc + substring.length(); } re...
[ "public", "static", "String", "removeSubstring", "(", "String", "inString", ",", "String", "substring", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", ")", ";", "int", "oldLoc", "=", "0", ",", "loc", "=", "0", ";", "while", "(", "("...
Removes all occurrences of a string from another string. @param inString the string to remove substrings from. @param substring the substring to remove. @return the input string with occurrences of substring removed.
[ "Removes", "all", "occurrences", "of", "a", "string", "from", "another", "string", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L132-L142
28,795
Waikato/moa
moa/src/main/java/moa/core/Utils.java
Utils.replaceSubstring
public static String replaceSubstring(String inString, String subString, String replaceString) { StringBuffer result = new StringBuffer(); int oldLoc = 0, loc = 0; while ((loc = inString.indexOf(subString, oldLoc))!= -1) { result.append(inString.substring(oldLoc, loc)); result.append(repla...
java
public static String replaceSubstring(String inString, String subString, String replaceString) { StringBuffer result = new StringBuffer(); int oldLoc = 0, loc = 0; while ((loc = inString.indexOf(subString, oldLoc))!= -1) { result.append(inString.substring(oldLoc, loc)); result.append(repla...
[ "public", "static", "String", "replaceSubstring", "(", "String", "inString", ",", "String", "subString", ",", "String", "replaceString", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", ")", ";", "int", "oldLoc", "=", "0", ",", "loc", "="...
Replaces with a new string, all occurrences of a string from another string. @param inString the string to replace substrings in. @param subString the substring to replace. @param replaceString the replacement substring @return the input string with occurrences of substring replaced.
[ "Replaces", "with", "a", "new", "string", "all", "occurrences", "of", "a", "string", "from", "another", "string", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L153-L165
28,796
Waikato/moa
moa/src/main/java/moa/core/Utils.java
Utils.doubleToString
public static /*@pure@*/ String doubleToString(double value, int afterDecimalPoint) { StringBuffer stringBuffer; double temp; int dotPosition; long precisionValue; temp = value * Math.pow(10.0, afterDecimalPoint); if (Math.abs(temp) < Long.MAX_VALUE) { precisionValue = (temp > 0...
java
public static /*@pure@*/ String doubleToString(double value, int afterDecimalPoint) { StringBuffer stringBuffer; double temp; int dotPosition; long precisionValue; temp = value * Math.pow(10.0, afterDecimalPoint); if (Math.abs(temp) < Long.MAX_VALUE) { precisionValue = (temp > 0...
[ "public", "static", "/*@pure@*/", "String", "doubleToString", "(", "double", "value", ",", "int", "afterDecimalPoint", ")", "{", "StringBuffer", "stringBuffer", ";", "double", "temp", ";", "int", "dotPosition", ";", "long", "precisionValue", ";", "temp", "=", "v...
Rounds a double and converts it into String. @param value the double value @param afterDecimalPoint the (maximum) number of digits permitted after the decimal point @return the double as a formatted string
[ "Rounds", "a", "double", "and", "converts", "it", "into", "String", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L227-L274
28,797
Waikato/moa
moa/src/main/java/moa/core/Utils.java
Utils.doubleToString
public static /*@pure@*/ String doubleToString(double value, int width, int afterDecimalPoint) { String tempString = doubleToString(value, afterDecimalPoint); char[] result; int dotPosition; if ((afterDecimalPoint >= width) || (tempString.indexOf('E') != -1)) { // Protects sci n...
java
public static /*@pure@*/ String doubleToString(double value, int width, int afterDecimalPoint) { String tempString = doubleToString(value, afterDecimalPoint); char[] result; int dotPosition; if ((afterDecimalPoint >= width) || (tempString.indexOf('E') != -1)) { // Protects sci n...
[ "public", "static", "/*@pure@*/", "String", "doubleToString", "(", "double", "value", ",", "int", "width", ",", "int", "afterDecimalPoint", ")", "{", "String", "tempString", "=", "doubleToString", "(", "value", ",", "afterDecimalPoint", ")", ";", "char", "[", ...
Rounds a double and converts it into a formatted decimal-justified String. Trailing 0's are replaced with spaces. @param value the double value @param width the width of the string @param afterDecimalPoint the number of digits after the decimal point @return the double as a formatted string
[ "Rounds", "a", "double", "and", "converts", "it", "into", "a", "formatted", "decimal", "-", "justified", "String", ".", "Trailing", "0", "s", "are", "replaced", "with", "spaces", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L285-L337
28,798
Waikato/moa
moa/src/main/java/moa/core/Utils.java
Utils.checkForRemainingOptions
public static void checkForRemainingOptions(String[] options) throws Exception { int illegalOptionsFound = 0; StringBuffer text = new StringBuffer(); if (options == null) { return; } for (int i = 0; i < options.length; i++) { if (options[i].length() > 0) { illegalOptionsFound...
java
public static void checkForRemainingOptions(String[] options) throws Exception { int illegalOptionsFound = 0; StringBuffer text = new StringBuffer(); if (options == null) { return; } for (int i = 0; i < options.length; i++) { if (options[i].length() > 0) { illegalOptionsFound...
[ "public", "static", "void", "checkForRemainingOptions", "(", "String", "[", "]", "options", ")", "throws", "Exception", "{", "int", "illegalOptionsFound", "=", "0", ";", "StringBuffer", "text", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "options", ...
Checks if the given array contains any non-empty options. @param options an array of strings @exception Exception if there are any non-empty options
[ "Checks", "if", "the", "given", "array", "contains", "any", "non", "-", "empty", "options", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L436-L454
28,799
Waikato/moa
moa/src/main/java/moa/core/Utils.java
Utils.convertNewLines
public static String convertNewLines(String string) { int index; // Replace with \n StringBuffer newStringBuffer = new StringBuffer(); while ((index = string.indexOf('\n')) != -1) { if (index > 0) { newStringBuffer.append(string.substring(0, index)); } newStringBuffer.append('\\'); ...
java
public static String convertNewLines(String string) { int index; // Replace with \n StringBuffer newStringBuffer = new StringBuffer(); while ((index = string.indexOf('\n')) != -1) { if (index > 0) { newStringBuffer.append(string.substring(0, index)); } newStringBuffer.append('\\'); ...
[ "public", "static", "String", "convertNewLines", "(", "String", "string", ")", "{", "int", "index", ";", "// Replace with \\n", "StringBuffer", "newStringBuffer", "=", "new", "StringBuffer", "(", ")", ";", "while", "(", "(", "index", "=", "string", ".", "index...
Converts carriage returns and new lines in a string into \r and \n. @param string the string @return the converted string
[ "Converts", "carriage", "returns", "and", "new", "lines", "in", "a", "string", "into", "\\", "r", "and", "\\", "n", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L702-L738