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
150,300
hawkular/hawkular-bus
hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java
MessageProcessor.createMessageWithBinaryData
protected Message createMessageWithBinaryData(ConnectionContext context, BasicMessage basicMessage, InputStream inputStream, Map<String, String> headers) throws JMSException { if (context == null) { throw new IllegalArgumentException("The context is null"); } if (basicMessage == null) { throw new IllegalArgumentException("The message is null"); } if (inputStream == null) { throw new IllegalArgumentException("The binary data is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalArgumentException("The context had a null session"); } // we are going to use BinaryData which allows us to prefix the binary data with the JSON message BinaryData messagePlusBinaryData = new BinaryData(basicMessage.toJSON().getBytes(), inputStream); BytesMessage msg = session.createBytesMessage(); msg.setObjectProperty("JMS_AMQ_InputStream", messagePlusBinaryData); setHeaders(basicMessage, headers, msg); log.infof("Created binary message [%s]", msg); return msg; }
java
protected Message createMessageWithBinaryData(ConnectionContext context, BasicMessage basicMessage, InputStream inputStream, Map<String, String> headers) throws JMSException { if (context == null) { throw new IllegalArgumentException("The context is null"); } if (basicMessage == null) { throw new IllegalArgumentException("The message is null"); } if (inputStream == null) { throw new IllegalArgumentException("The binary data is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalArgumentException("The context had a null session"); } // we are going to use BinaryData which allows us to prefix the binary data with the JSON message BinaryData messagePlusBinaryData = new BinaryData(basicMessage.toJSON().getBytes(), inputStream); BytesMessage msg = session.createBytesMessage(); msg.setObjectProperty("JMS_AMQ_InputStream", messagePlusBinaryData); setHeaders(basicMessage, headers, msg); log.infof("Created binary message [%s]", msg); return msg; }
[ "protected", "Message", "createMessageWithBinaryData", "(", "ConnectionContext", "context", ",", "BasicMessage", "basicMessage", ",", "InputStream", "inputStream", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "throws", "JMSException", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The context is null\"", ")", ";", "}", "if", "(", "basicMessage", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The message is null\"", ")", ";", "}", "if", "(", "inputStream", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The binary data is null\"", ")", ";", "}", "Session", "session", "=", "context", ".", "getSession", "(", ")", ";", "if", "(", "session", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The context had a null session\"", ")", ";", "}", "// we are going to use BinaryData which allows us to prefix the binary data with the JSON message", "BinaryData", "messagePlusBinaryData", "=", "new", "BinaryData", "(", "basicMessage", ".", "toJSON", "(", ")", ".", "getBytes", "(", ")", ",", "inputStream", ")", ";", "BytesMessage", "msg", "=", "session", ".", "createBytesMessage", "(", ")", ";", "msg", ".", "setObjectProperty", "(", "\"JMS_AMQ_InputStream\"", ",", "messagePlusBinaryData", ")", ";", "setHeaders", "(", "basicMessage", ",", "headers", ",", "msg", ")", ";", "log", ".", "infof", "(", "\"Created binary message [%s]\"", ",", "msg", ")", ";", "return", "msg", ";", "}" ]
Creates a blob message that can be send via a producer that contains the given BasicMessage's JSON encoded data along with binary data. @param context the context whose session is used to create the message @param basicMessage contains the data that will be JSON-encoded and encapsulated in the created message, with optional headers included @param inputStream binary data that will be sent with the message @param headers headers for the Message that will override same-named headers in the basic message @return the message that can be produced @throws JMSException any error @throws NullPointerException if the context is null or the context's session is null
[ "Creates", "a", "blob", "message", "that", "can", "be", "send", "via", "a", "producer", "that", "contains", "the", "given", "BasicMessage", "s", "JSON", "encoded", "data", "along", "with", "binary", "data", "." ]
28d6b58bec81a50f8344d39f309b6971271ae627
https://github.com/hawkular/hawkular-bus/blob/28d6b58bec81a50f8344d39f309b6971271ae627/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L436-L464
150,301
mytechia/mytechia_commons
mytechia_commons_library/src/main/java/com/mytechia/commons/util/io/file/Files.java
Files.deleteDirectory
public static boolean deleteDirectory(File dir) { if (dir.canWrite()) { File [] subFiles = dir.listFiles(); for(int i=0; i<subFiles.length; i++) { if (subFiles[i].isDirectory()) deleteDirectory(subFiles[i]); else subFiles[i].delete(); } } return dir.delete(); }
java
public static boolean deleteDirectory(File dir) { if (dir.canWrite()) { File [] subFiles = dir.listFiles(); for(int i=0; i<subFiles.length; i++) { if (subFiles[i].isDirectory()) deleteDirectory(subFiles[i]); else subFiles[i].delete(); } } return dir.delete(); }
[ "public", "static", "boolean", "deleteDirectory", "(", "File", "dir", ")", "{", "if", "(", "dir", ".", "canWrite", "(", ")", ")", "{", "File", "[", "]", "subFiles", "=", "dir", ".", "listFiles", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "subFiles", ".", "length", ";", "i", "++", ")", "{", "if", "(", "subFiles", "[", "i", "]", ".", "isDirectory", "(", ")", ")", "deleteDirectory", "(", "subFiles", "[", "i", "]", ")", ";", "else", "subFiles", "[", "i", "]", ".", "delete", "(", ")", ";", "}", "}", "return", "dir", ".", "delete", "(", ")", ";", "}" ]
Deletes a directory and its contents.
[ "Deletes", "a", "directory", "and", "its", "contents", "." ]
02251879085f271a1fb51663a1c8eddc8be78ae7
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/util/io/file/Files.java#L49-L66
150,302
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/IndexForHeaderIndexFile.java
IndexForHeaderIndexFile.getChunkId
public int getChunkId(byte[] key) { int idx = Arrays.binarySearch(maxKeyPerChunk, 0, filledUpTo + 1, key, comparator); idx = idx < 0 ? -idx - 1 : idx; if (idx > filledUpTo) { return -1; } else { return idx; } }
java
public int getChunkId(byte[] key) { int idx = Arrays.binarySearch(maxKeyPerChunk, 0, filledUpTo + 1, key, comparator); idx = idx < 0 ? -idx - 1 : idx; if (idx > filledUpTo) { return -1; } else { return idx; } }
[ "public", "int", "getChunkId", "(", "byte", "[", "]", "key", ")", "{", "int", "idx", "=", "Arrays", ".", "binarySearch", "(", "maxKeyPerChunk", ",", "0", ",", "filledUpTo", "+", "1", ",", "key", ",", "comparator", ")", ";", "idx", "=", "idx", "<", "0", "?", "-", "idx", "-", "1", ":", "idx", ";", "if", "(", "idx", ">", "filledUpTo", ")", "{", "return", "-", "1", ";", "}", "else", "{", "return", "idx", ";", "}", "}" ]
returns the index of the chunk, where the element could be found. If the element can't be in one of the chunks the method will return -1. @param key the key to look for @return the id of the chunk, where the key could be found. If there is no putative chunk, then -1 will returned.
[ "returns", "the", "index", "of", "the", "chunk", "where", "the", "element", "could", "be", "found", ".", "If", "the", "element", "can", "t", "be", "in", "one", "of", "the", "chunks", "the", "method", "will", "return", "-", "1", "." ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/IndexForHeaderIndexFile.java#L127-L135
150,303
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/IndexForHeaderIndexFile.java
IndexForHeaderIndexFile.isConsistent
public boolean isConsistent() { for (int i = 1; i < filledUpTo; i++) { int comp1 = KeyUtils.compareKey(maxKeyPerChunk[i], maxKeyPerChunk[i - 1]); if (comp1 <= 0) { return false; } } return true; }
java
public boolean isConsistent() { for (int i = 1; i < filledUpTo; i++) { int comp1 = KeyUtils.compareKey(maxKeyPerChunk[i], maxKeyPerChunk[i - 1]); if (comp1 <= 0) { return false; } } return true; }
[ "public", "boolean", "isConsistent", "(", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<", "filledUpTo", ";", "i", "++", ")", "{", "int", "comp1", "=", "KeyUtils", ".", "compareKey", "(", "maxKeyPerChunk", "[", "i", "]", ",", "maxKeyPerChunk", "[", "i", "-", "1", "]", ")", ";", "if", "(", "comp1", "<=", "0", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Checks, if this index is consistent. All inserted keys have to be inserted incrementally. @return boolean
[ "Checks", "if", "this", "index", "is", "consistent", ".", "All", "inserted", "keys", "have", "to", "be", "inserted", "incrementally", "." ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/IndexForHeaderIndexFile.java#L151-L159
150,304
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/IndexForHeaderIndexFile.java
IndexForHeaderIndexFile.setLargestKey
public void setLargestKey(int chunkIdx, byte[] largestKeyInChunk) { maxKeyPerChunk[chunkIdx] = largestKeyInChunk; filledUpTo = Math.max(filledUpTo, chunkIdx); indexBuffer.position(chunkIdx * keySize); indexBuffer.put(largestKeyInChunk); }
java
public void setLargestKey(int chunkIdx, byte[] largestKeyInChunk) { maxKeyPerChunk[chunkIdx] = largestKeyInChunk; filledUpTo = Math.max(filledUpTo, chunkIdx); indexBuffer.position(chunkIdx * keySize); indexBuffer.put(largestKeyInChunk); }
[ "public", "void", "setLargestKey", "(", "int", "chunkIdx", ",", "byte", "[", "]", "largestKeyInChunk", ")", "{", "maxKeyPerChunk", "[", "chunkIdx", "]", "=", "largestKeyInChunk", ";", "filledUpTo", "=", "Math", ".", "max", "(", "filledUpTo", ",", "chunkIdx", ")", ";", "indexBuffer", ".", "position", "(", "chunkIdx", "*", "keySize", ")", ";", "indexBuffer", ".", "put", "(", "largestKeyInChunk", ")", ";", "}" ]
Sets a new largest key in the chunk with the given index. @param chunkIdx @param largestKeyInChunk
[ "Sets", "a", "new", "largest", "key", "in", "the", "chunk", "with", "the", "given", "index", "." ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/IndexForHeaderIndexFile.java#L167-L172
150,305
zmarko/jPasswordObfuscator
jPasswordObfuscator-lib/src/main/java/rs/in/zivanovic/obfuscator/JPasswordObfuscator.java
JPasswordObfuscator.obfuscate
public String obfuscate(char[] masterKey, byte[] data, int version) { Objects.requireNonNull(masterKey); Objects.requireNonNull(data); switch (version) { case 1: return v1Obfuscator.obfuscate(masterKey, data).toString(); default: throw new IllegalArgumentException("Unsupported version: " + version); } }
java
public String obfuscate(char[] masterKey, byte[] data, int version) { Objects.requireNonNull(masterKey); Objects.requireNonNull(data); switch (version) { case 1: return v1Obfuscator.obfuscate(masterKey, data).toString(); default: throw new IllegalArgumentException("Unsupported version: " + version); } }
[ "public", "String", "obfuscate", "(", "char", "[", "]", "masterKey", ",", "byte", "[", "]", "data", ",", "int", "version", ")", "{", "Objects", ".", "requireNonNull", "(", "masterKey", ")", ";", "Objects", ".", "requireNonNull", "(", "data", ")", ";", "switch", "(", "version", ")", "{", "case", "1", ":", "return", "v1Obfuscator", ".", "obfuscate", "(", "masterKey", ",", "data", ")", ".", "toString", "(", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unsupported version: \"", "+", "version", ")", ";", "}", "}" ]
Obfuscate data using supplied master key and algorithm version. @param masterKey master key to use for obfuscation @param data data to obfuscate @param version obfuscation algorithm version to use @return string containing obfuscated data; use {@link #unObfuscate} to get secret data from this string
[ "Obfuscate", "data", "using", "supplied", "master", "key", "and", "algorithm", "version", "." ]
40844a826bb4d6ccac0caa2480cd89c6362cfdd0
https://github.com/zmarko/jPasswordObfuscator/blob/40844a826bb4d6ccac0caa2480cd89c6362cfdd0/jPasswordObfuscator-lib/src/main/java/rs/in/zivanovic/obfuscator/JPasswordObfuscator.java#L62-L71
150,306
amlinv/amq-monitor
amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsCollection.java
QueueStatisticsCollection.updateRates
protected void updateRates (QueueStatMeasurements rateMeasurements, long dequeueCountDelta, long enqueueCountDelta) { double oldDequeueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageDequeueRate(); double oldDequeueRateOneHour = rateMeasurements.messageRates.getOneHourAverageDequeueRate(); double oldDequeueRateOneDay = rateMeasurements.messageRates.getOneDayAverageDequeueRate(); double oldEnqueueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate(); double oldEnqueueRateOneHour = rateMeasurements.messageRates.getOneHourAverageEnqueueRate(); double oldEnqueueRateOneDay = rateMeasurements.messageRates.getOneDayAverageEnqueueRate(); // // Protect against negative changes in Enqueue and Dequeue counts - these metrics are designed to only ever // increase, but can reset in cases such as restarting a broker and manually resetting the statistics through // JMX controls. // if ( dequeueCountDelta < 0 ) { this.log.debug("detected negative change in dequeue count; ignoring: queue={}; delta={}", this.queueName, dequeueCountDelta); dequeueCountDelta = 0; } if ( enqueueCountDelta < 0 ) { this.log.debug("detected negative change in enqueue count; ignoring: queue={}; delta={}", this.queueName, enqueueCountDelta); enqueueCountDelta = 0; } // // Update the rates and add in the changes. // rateMeasurements.messageRates.onTimestampSample(statsClock.getStatsStopWatchTime(), dequeueCountDelta, enqueueCountDelta); aggregateDequeueRateOneMinute -= oldDequeueRateOneMinute; aggregateDequeueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageDequeueRate(); aggregateDequeueRateOneHour -= oldDequeueRateOneHour; aggregateDequeueRateOneHour += rateMeasurements.messageRates.getOneHourAverageDequeueRate(); aggregateDequeueRateOneDay -= oldDequeueRateOneDay; aggregateDequeueRateOneDay += rateMeasurements.messageRates.getOneDayAverageDequeueRate(); aggregateEnqueueRateOneMinute -= oldEnqueueRateOneMinute; aggregateEnqueueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate(); aggregateEnqueueRateOneHour -= oldEnqueueRateOneHour; aggregateEnqueueRateOneHour += rateMeasurements.messageRates.getOneHourAverageEnqueueRate(); aggregateEnqueueRateOneDay -= oldEnqueueRateOneDay; aggregateEnqueueRateOneDay += rateMeasurements.messageRates.getOneDayAverageEnqueueRate(); }
java
protected void updateRates (QueueStatMeasurements rateMeasurements, long dequeueCountDelta, long enqueueCountDelta) { double oldDequeueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageDequeueRate(); double oldDequeueRateOneHour = rateMeasurements.messageRates.getOneHourAverageDequeueRate(); double oldDequeueRateOneDay = rateMeasurements.messageRates.getOneDayAverageDequeueRate(); double oldEnqueueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate(); double oldEnqueueRateOneHour = rateMeasurements.messageRates.getOneHourAverageEnqueueRate(); double oldEnqueueRateOneDay = rateMeasurements.messageRates.getOneDayAverageEnqueueRate(); // // Protect against negative changes in Enqueue and Dequeue counts - these metrics are designed to only ever // increase, but can reset in cases such as restarting a broker and manually resetting the statistics through // JMX controls. // if ( dequeueCountDelta < 0 ) { this.log.debug("detected negative change in dequeue count; ignoring: queue={}; delta={}", this.queueName, dequeueCountDelta); dequeueCountDelta = 0; } if ( enqueueCountDelta < 0 ) { this.log.debug("detected negative change in enqueue count; ignoring: queue={}; delta={}", this.queueName, enqueueCountDelta); enqueueCountDelta = 0; } // // Update the rates and add in the changes. // rateMeasurements.messageRates.onTimestampSample(statsClock.getStatsStopWatchTime(), dequeueCountDelta, enqueueCountDelta); aggregateDequeueRateOneMinute -= oldDequeueRateOneMinute; aggregateDequeueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageDequeueRate(); aggregateDequeueRateOneHour -= oldDequeueRateOneHour; aggregateDequeueRateOneHour += rateMeasurements.messageRates.getOneHourAverageDequeueRate(); aggregateDequeueRateOneDay -= oldDequeueRateOneDay; aggregateDequeueRateOneDay += rateMeasurements.messageRates.getOneDayAverageDequeueRate(); aggregateEnqueueRateOneMinute -= oldEnqueueRateOneMinute; aggregateEnqueueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate(); aggregateEnqueueRateOneHour -= oldEnqueueRateOneHour; aggregateEnqueueRateOneHour += rateMeasurements.messageRates.getOneHourAverageEnqueueRate(); aggregateEnqueueRateOneDay -= oldEnqueueRateOneDay; aggregateEnqueueRateOneDay += rateMeasurements.messageRates.getOneDayAverageEnqueueRate(); }
[ "protected", "void", "updateRates", "(", "QueueStatMeasurements", "rateMeasurements", ",", "long", "dequeueCountDelta", ",", "long", "enqueueCountDelta", ")", "{", "double", "oldDequeueRateOneMinute", "=", "rateMeasurements", ".", "messageRates", ".", "getOneMinuteAverageDequeueRate", "(", ")", ";", "double", "oldDequeueRateOneHour", "=", "rateMeasurements", ".", "messageRates", ".", "getOneHourAverageDequeueRate", "(", ")", ";", "double", "oldDequeueRateOneDay", "=", "rateMeasurements", ".", "messageRates", ".", "getOneDayAverageDequeueRate", "(", ")", ";", "double", "oldEnqueueRateOneMinute", "=", "rateMeasurements", ".", "messageRates", ".", "getOneMinuteAverageEnqueueRate", "(", ")", ";", "double", "oldEnqueueRateOneHour", "=", "rateMeasurements", ".", "messageRates", ".", "getOneHourAverageEnqueueRate", "(", ")", ";", "double", "oldEnqueueRateOneDay", "=", "rateMeasurements", ".", "messageRates", ".", "getOneDayAverageEnqueueRate", "(", ")", ";", "//", "// Protect against negative changes in Enqueue and Dequeue counts - these metrics are designed to only ever", "// increase, but can reset in cases such as restarting a broker and manually resetting the statistics through", "// JMX controls.", "//", "if", "(", "dequeueCountDelta", "<", "0", ")", "{", "this", ".", "log", ".", "debug", "(", "\"detected negative change in dequeue count; ignoring: queue={}; delta={}\"", ",", "this", ".", "queueName", ",", "dequeueCountDelta", ")", ";", "dequeueCountDelta", "=", "0", ";", "}", "if", "(", "enqueueCountDelta", "<", "0", ")", "{", "this", ".", "log", ".", "debug", "(", "\"detected negative change in enqueue count; ignoring: queue={}; delta={}\"", ",", "this", ".", "queueName", ",", "enqueueCountDelta", ")", ";", "enqueueCountDelta", "=", "0", ";", "}", "//", "// Update the rates and add in the changes.", "//", "rateMeasurements", ".", "messageRates", ".", "onTimestampSample", "(", "statsClock", ".", "getStatsStopWatchTime", "(", ")", ",", "dequeueCountDelta", ",", "enqueueCountDelta", ")", ";", "aggregateDequeueRateOneMinute", "-=", "oldDequeueRateOneMinute", ";", "aggregateDequeueRateOneMinute", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneMinuteAverageDequeueRate", "(", ")", ";", "aggregateDequeueRateOneHour", "-=", "oldDequeueRateOneHour", ";", "aggregateDequeueRateOneHour", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneHourAverageDequeueRate", "(", ")", ";", "aggregateDequeueRateOneDay", "-=", "oldDequeueRateOneDay", ";", "aggregateDequeueRateOneDay", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneDayAverageDequeueRate", "(", ")", ";", "aggregateEnqueueRateOneMinute", "-=", "oldEnqueueRateOneMinute", ";", "aggregateEnqueueRateOneMinute", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneMinuteAverageEnqueueRate", "(", ")", ";", "aggregateEnqueueRateOneHour", "-=", "oldEnqueueRateOneHour", ";", "aggregateEnqueueRateOneHour", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneHourAverageEnqueueRate", "(", ")", ";", "aggregateEnqueueRateOneDay", "-=", "oldEnqueueRateOneDay", ";", "aggregateEnqueueRateOneDay", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneDayAverageEnqueueRate", "(", ")", ";", "}" ]
Update message rates given the change in dequeue and enqueue counts for one broker queue. @param rateMeasurements measurements for one broker queue. @param dequeueCountDelta change in the dequeue count since the last measurement for the same broker queue. @param enqueueCountDelta change in the enqueue count since the last measurement for the same broker queue.
[ "Update", "message", "rates", "given", "the", "change", "in", "dequeue", "and", "enqueue", "counts", "for", "one", "broker", "queue", "." ]
0ae0156f56d7d3edf98bca9c30b153b770fe5bfa
https://github.com/amlinv/amq-monitor/blob/0ae0156f56d7d3edf98bca9c30b153b770fe5bfa/amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsCollection.java#L158-L208
150,307
jtrfp/javamod
src/main/java/de/quippy/javamod/io/wav/WaveFile.java
WaveFile.openForWrite
public int openForWrite(String Filename, WaveFile OtherWave) { return openForWrite(Filename, OtherWave.getSamplingRate(), OtherWave.getBitsPerSample(), OtherWave.getNumChannels()); }
java
public int openForWrite(String Filename, WaveFile OtherWave) { return openForWrite(Filename, OtherWave.getSamplingRate(), OtherWave.getBitsPerSample(), OtherWave.getNumChannels()); }
[ "public", "int", "openForWrite", "(", "String", "Filename", ",", "WaveFile", "OtherWave", ")", "{", "return", "openForWrite", "(", "Filename", ",", "OtherWave", ".", "getSamplingRate", "(", ")", ",", "OtherWave", ".", "getBitsPerSample", "(", ")", ",", "OtherWave", ".", "getNumChannels", "(", ")", ")", ";", "}" ]
Open for write using another wave file's parameters...
[ "Open", "for", "write", "using", "another", "wave", "file", "s", "parameters", "..." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/wav/WaveFile.java#L100-L103
150,308
jtrfp/javamod
src/main/java/de/quippy/javamod/io/wav/WaveFile.java
WaveFile.writeSamples
public int writeSamples(short[] data, int numSamples) { int numBytes = numSamples<<1; byte[] theData = new byte[numBytes]; for (int y = 0, yc=0; y<numBytes; y+=2) { theData[y] = (byte) (data[yc] & 0x00FF); theData[y + 1] = (byte) ((data[yc++] >>> 8) & 0x00FF); } return write(theData, numBytes); }
java
public int writeSamples(short[] data, int numSamples) { int numBytes = numSamples<<1; byte[] theData = new byte[numBytes]; for (int y = 0, yc=0; y<numBytes; y+=2) { theData[y] = (byte) (data[yc] & 0x00FF); theData[y + 1] = (byte) ((data[yc++] >>> 8) & 0x00FF); } return write(theData, numBytes); }
[ "public", "int", "writeSamples", "(", "short", "[", "]", "data", ",", "int", "numSamples", ")", "{", "int", "numBytes", "=", "numSamples", "<<", "1", ";", "byte", "[", "]", "theData", "=", "new", "byte", "[", "numBytes", "]", ";", "for", "(", "int", "y", "=", "0", ",", "yc", "=", "0", ";", "y", "<", "numBytes", ";", "y", "+=", "2", ")", "{", "theData", "[", "y", "]", "=", "(", "byte", ")", "(", "data", "[", "yc", "]", "&", "0x00FF", ")", ";", "theData", "[", "y", "+", "1", "]", "=", "(", "byte", ")", "(", "(", "data", "[", "yc", "++", "]", ">>>", "8", ")", "&", "0x00FF", ")", ";", "}", "return", "write", "(", "theData", ",", "numBytes", ")", ";", "}" ]
Write 16-bit audio
[ "Write", "16", "-", "bit", "audio" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/wav/WaveFile.java#L175-L185
150,309
skuzzle/TinyPlugz
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/TinyPlugz.java
TinyPlugz.getInstance
public static TinyPlugz getInstance() { final TinyPlugz plugz = instance; Require.state(plugz != null, "TinyPlugz has not been initialized"); return plugz; }
java
public static TinyPlugz getInstance() { final TinyPlugz plugz = instance; Require.state(plugz != null, "TinyPlugz has not been initialized"); return plugz; }
[ "public", "static", "TinyPlugz", "getInstance", "(", ")", "{", "final", "TinyPlugz", "plugz", "=", "instance", ";", "Require", ".", "state", "(", "plugz", "!=", "null", ",", "\"TinyPlugz has not been initialized\"", ")", ";", "return", "plugz", ";", "}" ]
Gets the single TinyPlugz instance. @return The TinyPlugz instance.
[ "Gets", "the", "single", "TinyPlugz", "instance", "." ]
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/TinyPlugz.java#L70-L74
150,310
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/memory/MemoryManager.java
MemoryManager.logMemory
public static void logMemory(long interval, Level level) { Task<Void,NoException> task = new Task.Cpu<Void,NoException>("Logging memory", Task.PRIORITY_BACKGROUND) { @Override public Void run() { logMemory(level); return null; } }; task.executeEvery(interval, interval); task.start(); }
java
public static void logMemory(long interval, Level level) { Task<Void,NoException> task = new Task.Cpu<Void,NoException>("Logging memory", Task.PRIORITY_BACKGROUND) { @Override public Void run() { logMemory(level); return null; } }; task.executeEvery(interval, interval); task.start(); }
[ "public", "static", "void", "logMemory", "(", "long", "interval", ",", "Level", "level", ")", "{", "Task", "<", "Void", ",", "NoException", ">", "task", "=", "new", "Task", ".", "Cpu", "<", "Void", ",", "NoException", ">", "(", "\"Logging memory\"", ",", "Task", ".", "PRIORITY_BACKGROUND", ")", "{", "@", "Override", "public", "Void", "run", "(", ")", "{", "logMemory", "(", "level", ")", ";", "return", "null", ";", "}", "}", ";", "task", ".", "executeEvery", "(", "interval", ",", "interval", ")", ";", "task", ".", "start", "(", ")", ";", "}" ]
Log memory usage to the console at regular interval.
[ "Log", "memory", "usage", "to", "the", "console", "at", "regular", "interval", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/memory/MemoryManager.java#L214-L224
150,311
danidemi/jlubricant
jlubricant-spring-batch/src/main/java/org/springframework/jdbc/core/namedparam/ExposedParsedSql.java
ExposedParsedSql.addNamedParameter
public void addNamedParameter(String parameterName, int startIndex, int endIndex) { delegate.addNamedParameter(parameterName, startIndex, endIndex); }
java
public void addNamedParameter(String parameterName, int startIndex, int endIndex) { delegate.addNamedParameter(parameterName, startIndex, endIndex); }
[ "public", "void", "addNamedParameter", "(", "String", "parameterName", ",", "int", "startIndex", ",", "int", "endIndex", ")", "{", "delegate", ".", "addNamedParameter", "(", "parameterName", ",", "startIndex", ",", "endIndex", ")", ";", "}" ]
Add a named parameter parsed from this SQL statement. @param parameterName the name of the parameter @param startIndex the start index in the original SQL String @param endIndex the end index in the original SQL String
[ "Add", "a", "named", "parameter", "parsed", "from", "this", "SQL", "statement", "." ]
a9937c141c69ec34b768bd603b8093e496329b3a
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-spring-batch/src/main/java/org/springframework/jdbc/core/namedparam/ExposedParsedSql.java#L41-L43
150,312
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java
RedBlackTreeInteger.containsInstance
@Override public boolean containsInstance(int value, T instance) { if (root == null) return false; if (value < first.value) return false; if (value > last.value) return false; if (value == first.value && instance == first.element) return true; if (value == last.value && instance == last.element) return true; return containsInstance(root, value, instance); }
java
@Override public boolean containsInstance(int value, T instance) { if (root == null) return false; if (value < first.value) return false; if (value > last.value) return false; if (value == first.value && instance == first.element) return true; if (value == last.value && instance == last.element) return true; return containsInstance(root, value, instance); }
[ "@", "Override", "public", "boolean", "containsInstance", "(", "int", "value", ",", "T", "instance", ")", "{", "if", "(", "root", "==", "null", ")", "return", "false", ";", "if", "(", "value", "<", "first", ".", "value", ")", "return", "false", ";", "if", "(", "value", ">", "last", ".", "value", ")", "return", "false", ";", "if", "(", "value", "==", "first", ".", "value", "&&", "instance", "==", "first", ".", "element", ")", "return", "true", ";", "if", "(", "value", "==", "last", ".", "value", "&&", "instance", "==", "last", ".", "element", ")", "return", "true", ";", "return", "containsInstance", "(", "root", ",", "value", ",", "instance", ")", ";", "}" ]
Returns true if the given key exists in the tree and its associated value is the given element. Comparison of the element is using the == operator.
[ "Returns", "true", "if", "the", "given", "key", "exists", "in", "the", "tree", "and", "its", "associated", "value", "is", "the", "given", "element", ".", "Comparison", "of", "the", "element", "is", "using", "the", "==", "operator", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java#L247-L255
150,313
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java
RedBlackTreeInteger.searchNearestLower
public Node<T> searchNearestLower(int value, boolean acceptEquals) { if (root == null) return null; return searchNearestLower(root, value, acceptEquals); }
java
public Node<T> searchNearestLower(int value, boolean acceptEquals) { if (root == null) return null; return searchNearestLower(root, value, acceptEquals); }
[ "public", "Node", "<", "T", ">", "searchNearestLower", "(", "int", "value", ",", "boolean", "acceptEquals", ")", "{", "if", "(", "root", "==", "null", ")", "return", "null", ";", "return", "searchNearestLower", "(", "root", ",", "value", ",", "acceptEquals", ")", ";", "}" ]
Returns the node containing the highest value strictly lower than the given one.
[ "Returns", "the", "node", "containing", "the", "highest", "value", "strictly", "lower", "than", "the", "given", "one", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java#L275-L278
150,314
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java
RedBlackTreeInteger.removeMin
public void removeMin() { if (root == null) return; // if both children of root are black, set root to red if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red)) root.red = true; root = removeMin(root, true); if (root != null) root.red = false; else first = last = null; }
java
public void removeMin() { if (root == null) return; // if both children of root are black, set root to red if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red)) root.red = true; root = removeMin(root, true); if (root != null) root.red = false; else first = last = null; }
[ "public", "void", "removeMin", "(", ")", "{", "if", "(", "root", "==", "null", ")", "return", ";", "// if both children of root are black, set root to red\r", "if", "(", "(", "root", ".", "left", "==", "null", "||", "!", "root", ".", "left", ".", "red", ")", "&&", "(", "root", ".", "right", "==", "null", "||", "!", "root", ".", "right", ".", "red", ")", ")", "root", ".", "red", "=", "true", ";", "root", "=", "removeMin", "(", "root", ",", "true", ")", ";", "if", "(", "root", "!=", "null", ")", "root", ".", "red", "=", "false", ";", "else", "first", "=", "last", "=", "null", ";", "}" ]
Remove the first element.
[ "Remove", "the", "first", "element", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java#L380-L390
150,315
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java
RedBlackTreeInteger.remove
public void remove(Node<T> node) { if (first == node) { removeMin(); return; } if (last == node) { removeMax(); return; } // if both children of root are black, set root to red if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red)) root.red = true; root = remove(root, node); if (root != null) root.red = false; else first = last = null; }
java
public void remove(Node<T> node) { if (first == node) { removeMin(); return; } if (last == node) { removeMax(); return; } // if both children of root are black, set root to red if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red)) root.red = true; root = remove(root, node); if (root != null) root.red = false; else first = last = null; }
[ "public", "void", "remove", "(", "Node", "<", "T", ">", "node", ")", "{", "if", "(", "first", "==", "node", ")", "{", "removeMin", "(", ")", ";", "return", ";", "}", "if", "(", "last", "==", "node", ")", "{", "removeMax", "(", ")", ";", "return", ";", "}", "// if both children of root are black, set root to red\r", "if", "(", "(", "root", ".", "left", "==", "null", "||", "!", "root", ".", "left", ".", "red", ")", "&&", "(", "root", ".", "right", "==", "null", "||", "!", "root", ".", "right", ".", "red", ")", ")", "root", ".", "red", "=", "true", ";", "root", "=", "remove", "(", "root", ",", "node", ")", ";", "if", "(", "root", "!=", "null", ")", "root", ".", "red", "=", "false", ";", "else", "first", "=", "last", "=", "null", ";", "}" ]
Remove the given node.
[ "Remove", "the", "given", "node", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java#L437-L453
150,316
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java
RedBlackTreeInteger.removeKey
public void removeKey(int key) { if (key == first.value) { removeMin(); return; } if (key == last.value) { removeMax(); return; } // if both children of root are black, set root to red if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red)) root.red = true; root = removeKey(root, key); if (root != null) root.red = false; }
java
public void removeKey(int key) { if (key == first.value) { removeMin(); return; } if (key == last.value) { removeMax(); return; } // if both children of root are black, set root to red if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red)) root.red = true; root = removeKey(root, key); if (root != null) root.red = false; }
[ "public", "void", "removeKey", "(", "int", "key", ")", "{", "if", "(", "key", "==", "first", ".", "value", ")", "{", "removeMin", "(", ")", ";", "return", ";", "}", "if", "(", "key", "==", "last", ".", "value", ")", "{", "removeMax", "(", ")", ";", "return", ";", "}", "// if both children of root are black, set root to red\r", "if", "(", "(", "root", ".", "left", "==", "null", "||", "!", "root", ".", "left", ".", "red", ")", "&&", "(", "root", ".", "right", "==", "null", "||", "!", "root", ".", "right", ".", "red", ")", ")", "root", ".", "red", "=", "true", ";", "root", "=", "removeKey", "(", "root", ",", "key", ")", ";", "if", "(", "root", "!=", "null", ")", "root", ".", "red", "=", "false", ";", "}" ]
Remove the given key. The key MUST exists, else the tree won't be valid anymore.
[ "Remove", "the", "given", "key", ".", "The", "key", "MUST", "exists", "else", "the", "tree", "won", "t", "be", "valid", "anymore", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java#L526-L541
150,317
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/filters/Related.java
Related.with
public static Related with(CanonicalPath entityPath, String relationship) { return new Related(entityPath, relationship, EntityRole.SOURCE); }
java
public static Related with(CanonicalPath entityPath, String relationship) { return new Related(entityPath, relationship, EntityRole.SOURCE); }
[ "public", "static", "Related", "with", "(", "CanonicalPath", "entityPath", ",", "String", "relationship", ")", "{", "return", "new", "Related", "(", "entityPath", ",", "relationship", ",", "EntityRole", ".", "SOURCE", ")", ";", "}" ]
Specifies a filter for entities that are sources of a relationship with the specified entity. @param entityPath the entity that is the target of the relationship @param relationship the name of the relationship @return a new "related" filter instance
[ "Specifies", "a", "filter", "for", "entities", "that", "are", "sources", "of", "a", "relationship", "with", "the", "specified", "entity", "." ]
f56dc10323dca21777feb5b609a9e9cc70ffaf62
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/filters/Related.java#L44-L46
150,318
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/filters/Related.java
Related.asTargetWith
public static Related asTargetWith(CanonicalPath entityPath, String relationship) { return new Related(entityPath, relationship, EntityRole.TARGET); }
java
public static Related asTargetWith(CanonicalPath entityPath, String relationship) { return new Related(entityPath, relationship, EntityRole.TARGET); }
[ "public", "static", "Related", "asTargetWith", "(", "CanonicalPath", "entityPath", ",", "String", "relationship", ")", "{", "return", "new", "Related", "(", "entityPath", ",", "relationship", ",", "EntityRole", ".", "TARGET", ")", ";", "}" ]
Specifies a filter for entities that are targets of a relationship with the specified entity. @param entityPath the entity that is the source of the relationship @param relationship the name of the relationship @return a new "related" filter instance
[ "Specifies", "a", "filter", "for", "entities", "that", "are", "targets", "of", "a", "relationship", "with", "the", "specified", "entity", "." ]
f56dc10323dca21777feb5b609a9e9cc70ffaf62
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/filters/Related.java#L100-L102
150,319
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java
JoinPoint.addToJoinDoNotCancel
public synchronized void addToJoinDoNotCancel(ISynchronizationPoint<? extends TError> sp) { nbToJoin++; sp.listenInline(new Runnable() { @Override public void run() { if (sp.hasError()) error(sp.getError()); else joined(); } }); if (Threading.debugSynchronization) ThreadingDebugHelper.registerJoin(this, sp); }
java
public synchronized void addToJoinDoNotCancel(ISynchronizationPoint<? extends TError> sp) { nbToJoin++; sp.listenInline(new Runnable() { @Override public void run() { if (sp.hasError()) error(sp.getError()); else joined(); } }); if (Threading.debugSynchronization) ThreadingDebugHelper.registerJoin(this, sp); }
[ "public", "synchronized", "void", "addToJoinDoNotCancel", "(", "ISynchronizationPoint", "<", "?", "extends", "TError", ">", "sp", ")", "{", "nbToJoin", "++", ";", "sp", ".", "listenInline", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "if", "(", "sp", ".", "hasError", "(", ")", ")", "error", "(", "sp", ".", "getError", "(", ")", ")", ";", "else", "joined", "(", ")", ";", "}", "}", ")", ";", "if", "(", "Threading", ".", "debugSynchronization", ")", "ThreadingDebugHelper", ".", "registerJoin", "(", "this", ",", "sp", ")", ";", "}" ]
Similar to addToJoin, but in case the synchronization point is cancelled, it is simply consider as done, and do not cancel this JoinPoint.
[ "Similar", "to", "addToJoin", "but", "in", "case", "the", "synchronization", "point", "is", "cancelled", "it", "is", "simply", "consider", "as", "done", "and", "do", "not", "cancel", "this", "JoinPoint", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java#L97-L109
150,320
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java
JoinPoint.listenInline
public static void listenInline(Runnable listener, ISynchronizationPoint<?>... synchPoints) { JoinPoint<Exception> jp = new JoinPoint<>(); for (int i = 0; i < synchPoints.length; ++i) if (synchPoints[i] != null) jp.addToJoin(synchPoints[i]); jp.start(); jp.listenInline(listener); }
java
public static void listenInline(Runnable listener, ISynchronizationPoint<?>... synchPoints) { JoinPoint<Exception> jp = new JoinPoint<>(); for (int i = 0; i < synchPoints.length; ++i) if (synchPoints[i] != null) jp.addToJoin(synchPoints[i]); jp.start(); jp.listenInline(listener); }
[ "public", "static", "void", "listenInline", "(", "Runnable", "listener", ",", "ISynchronizationPoint", "<", "?", ">", "...", "synchPoints", ")", "{", "JoinPoint", "<", "Exception", ">", "jp", "=", "new", "JoinPoint", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "synchPoints", ".", "length", ";", "++", "i", ")", "if", "(", "synchPoints", "[", "i", "]", "!=", "null", ")", "jp", ".", "addToJoin", "(", "synchPoints", "[", "i", "]", ")", ";", "jp", ".", "start", "(", ")", ";", "jp", ".", "listenInline", "(", "listener", ")", ";", "}" ]
Shortcut method to create a JoinPoint waiting for the given synchronization points, start the JoinPoint, and add the given listener to be called when the JoinPoint is unblocked. If any synchronization point has an error or is cancelled, the JoinPoint is immediately unblocked. If some given synchronization points are null, they are just skipped.
[ "Shortcut", "method", "to", "create", "a", "JoinPoint", "waiting", "for", "the", "given", "synchronization", "points", "start", "the", "JoinPoint", "and", "add", "the", "given", "listener", "to", "be", "called", "when", "the", "JoinPoint", "is", "unblocked", ".", "If", "any", "synchronization", "point", "has", "an", "error", "or", "is", "cancelled", "the", "JoinPoint", "is", "immediately", "unblocked", ".", "If", "some", "given", "synchronization", "points", "are", "null", "they", "are", "just", "skipped", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java#L275-L282
150,321
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java
JoinPoint.listenInlineOnAllDone
public static void listenInlineOnAllDone(Runnable listener, ISynchronizationPoint<?>... synchPoints) { JoinPoint<NoException> jp = new JoinPoint<>(); jp.addToJoin(synchPoints.length); Runnable jpr = new Runnable() { @Override public void run() { jp.joined(); } }; for (int i = 0; i < synchPoints.length; ++i) synchPoints[i].listenInline(jpr); jp.start(); jp.listenInline(listener); }
java
public static void listenInlineOnAllDone(Runnable listener, ISynchronizationPoint<?>... synchPoints) { JoinPoint<NoException> jp = new JoinPoint<>(); jp.addToJoin(synchPoints.length); Runnable jpr = new Runnable() { @Override public void run() { jp.joined(); } }; for (int i = 0; i < synchPoints.length; ++i) synchPoints[i].listenInline(jpr); jp.start(); jp.listenInline(listener); }
[ "public", "static", "void", "listenInlineOnAllDone", "(", "Runnable", "listener", ",", "ISynchronizationPoint", "<", "?", ">", "...", "synchPoints", ")", "{", "JoinPoint", "<", "NoException", ">", "jp", "=", "new", "JoinPoint", "<>", "(", ")", ";", "jp", ".", "addToJoin", "(", "synchPoints", ".", "length", ")", ";", "Runnable", "jpr", "=", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "jp", ".", "joined", "(", ")", ";", "}", "}", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "synchPoints", ".", "length", ";", "++", "i", ")", "synchPoints", "[", "i", "]", ".", "listenInline", "(", "jpr", ")", ";", "jp", ".", "start", "(", ")", ";", "jp", ".", "listenInline", "(", "listener", ")", ";", "}" ]
Shortcut method to create a JoinPoint waiting for the given synchronization points, start the JoinPoint, and add the given listener to be called when the JoinPoint is unblocked. The JoinPoint is not unblocked until all synchronization points are unblocked. If any has error or is cancel, the error or cancellation reason is not given to the JoinPoint, in contrary of the method listenInline.
[ "Shortcut", "method", "to", "create", "a", "JoinPoint", "waiting", "for", "the", "given", "synchronization", "points", "start", "the", "JoinPoint", "and", "add", "the", "given", "listener", "to", "be", "called", "when", "the", "JoinPoint", "is", "unblocked", ".", "The", "JoinPoint", "is", "not", "unblocked", "until", "all", "synchronization", "points", "are", "unblocked", ".", "If", "any", "has", "error", "or", "is", "cancel", "the", "error", "or", "cancellation", "reason", "is", "not", "given", "to", "the", "JoinPoint", "in", "contrary", "of", "the", "method", "listenInline", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java#L291-L304
150,322
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/da/DirectoryAgentInfo.java
DirectoryAgentInfo.from
public static DirectoryAgentInfo from(DAAdvert daAdvert) { return new DirectoryAgentInfo(daAdvert.getURL(), daAdvert.getScopes(), daAdvert.getAttributes(), daAdvert.getLanguage(), daAdvert.getBootTime()); }
java
public static DirectoryAgentInfo from(DAAdvert daAdvert) { return new DirectoryAgentInfo(daAdvert.getURL(), daAdvert.getScopes(), daAdvert.getAttributes(), daAdvert.getLanguage(), daAdvert.getBootTime()); }
[ "public", "static", "DirectoryAgentInfo", "from", "(", "DAAdvert", "daAdvert", ")", "{", "return", "new", "DirectoryAgentInfo", "(", "daAdvert", ".", "getURL", "(", ")", ",", "daAdvert", ".", "getScopes", "(", ")", ",", "daAdvert", ".", "getAttributes", "(", ")", ",", "daAdvert", ".", "getLanguage", "(", ")", ",", "daAdvert", ".", "getBootTime", "(", ")", ")", ";", "}" ]
Creates a new DirectoryAgentInfo from the given DAAdvert message. @param daAdvert the DAAdvert message from which create the DirectoryAgentInfo @return a new DirectoryAgentInfo from the given DAAdvert message
[ "Creates", "a", "new", "DirectoryAgentInfo", "from", "the", "given", "DAAdvert", "message", "." ]
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/DirectoryAgentInfo.java#L54-L57
150,323
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/da/DirectoryAgentInfo.java
DirectoryAgentInfo.from
public static DirectoryAgentInfo from(String address) { return from(address, Scopes.ANY, Attributes.NONE, null, -1); }
java
public static DirectoryAgentInfo from(String address) { return from(address, Scopes.ANY, Attributes.NONE, null, -1); }
[ "public", "static", "DirectoryAgentInfo", "from", "(", "String", "address", ")", "{", "return", "from", "(", "address", ",", "Scopes", ".", "ANY", ",", "Attributes", ".", "NONE", ",", "null", ",", "-", "1", ")", ";", "}" ]
Creates a new DirectoryAgentInfo from the given IP address. @param address the IP address of the DirectoryAgent @return a new DirectoryAgentInfo with the given address, any scope, no attributes, no language and no boot time. @see #from(String, Scopes, Attributes, String, int)
[ "Creates", "a", "new", "DirectoryAgentInfo", "from", "the", "given", "IP", "address", "." ]
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/DirectoryAgentInfo.java#L66-L69
150,324
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/da/DirectoryAgentInfo.java
DirectoryAgentInfo.from
public static DirectoryAgentInfo from(String address, Scopes scopes, Attributes attributes, String language, int bootTime) { return new DirectoryAgentInfo(SERVICE_TYPE.asString() + "://" + address, scopes, attributes, language, bootTime); }
java
public static DirectoryAgentInfo from(String address, Scopes scopes, Attributes attributes, String language, int bootTime) { return new DirectoryAgentInfo(SERVICE_TYPE.asString() + "://" + address, scopes, attributes, language, bootTime); }
[ "public", "static", "DirectoryAgentInfo", "from", "(", "String", "address", ",", "Scopes", "scopes", ",", "Attributes", "attributes", ",", "String", "language", ",", "int", "bootTime", ")", "{", "return", "new", "DirectoryAgentInfo", "(", "SERVICE_TYPE", ".", "asString", "(", ")", "+", "\"://\"", "+", "address", ",", "scopes", ",", "attributes", ",", "language", ",", "bootTime", ")", ";", "}" ]
Creates a new DirectoryAgentInfo from the given arguments. @param address the IP address of the DirectoryAgent @param scopes the Scopes of the DirectoryAgent @param attributes the Attributes of the DirectoryAgent @param language the language of the DirectoryAgent @param bootTime the boot time, in seconds, of the DirectoryAgent @return a new DirectoryAgentInfo @see #from(String)
[ "Creates", "a", "new", "DirectoryAgentInfo", "from", "the", "given", "arguments", "." ]
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/DirectoryAgentInfo.java#L82-L85
150,325
skuzzle/TinyPlugz
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java
Iterators.singleIterator
public static <T> Iterator<T> singleIterator(T t) { Require.nonNull(t, "t"); return Collections.singleton(t).iterator(); }
java
public static <T> Iterator<T> singleIterator(T t) { Require.nonNull(t, "t"); return Collections.singleton(t).iterator(); }
[ "public", "static", "<", "T", ">", "Iterator", "<", "T", ">", "singleIterator", "(", "T", "t", ")", "{", "Require", ".", "nonNull", "(", "t", ",", "\"t\"", ")", ";", "return", "Collections", ".", "singleton", "(", "t", ")", ".", "iterator", "(", ")", ";", "}" ]
Creates an Iterator over the single given element. @param t The element. @return Iterator returning the single element.
[ "Creates", "an", "Iterator", "over", "the", "single", "given", "element", "." ]
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java#L26-L29
150,326
skuzzle/TinyPlugz
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java
Iterators.filter
public static <T> Iterator<T> filter(Iterator<T> it, Predicate<T> filter) { return new Iterator<T>() { private T cached = null; @Override public boolean hasNext() { if (this.cached != null) { return true; } boolean test = false; while (it.hasNext() && !test) { this.cached = it.next(); test = filter.test(this.cached); } return test; } @Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } final T result = this.cached; this.cached = null; return result; } @Override public void remove() { it.remove(); } }; }
java
public static <T> Iterator<T> filter(Iterator<T> it, Predicate<T> filter) { return new Iterator<T>() { private T cached = null; @Override public boolean hasNext() { if (this.cached != null) { return true; } boolean test = false; while (it.hasNext() && !test) { this.cached = it.next(); test = filter.test(this.cached); } return test; } @Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } final T result = this.cached; this.cached = null; return result; } @Override public void remove() { it.remove(); } }; }
[ "public", "static", "<", "T", ">", "Iterator", "<", "T", ">", "filter", "(", "Iterator", "<", "T", ">", "it", ",", "Predicate", "<", "T", ">", "filter", ")", "{", "return", "new", "Iterator", "<", "T", ">", "(", ")", "{", "private", "T", "cached", "=", "null", ";", "@", "Override", "public", "boolean", "hasNext", "(", ")", "{", "if", "(", "this", ".", "cached", "!=", "null", ")", "{", "return", "true", ";", "}", "boolean", "test", "=", "false", ";", "while", "(", "it", ".", "hasNext", "(", ")", "&&", "!", "test", ")", "{", "this", ".", "cached", "=", "it", ".", "next", "(", ")", ";", "test", "=", "filter", ".", "test", "(", "this", ".", "cached", ")", ";", "}", "return", "test", ";", "}", "@", "Override", "public", "T", "next", "(", ")", "{", "if", "(", "!", "hasNext", "(", ")", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "final", "T", "result", "=", "this", ".", "cached", ";", "this", ".", "cached", "=", "null", ";", "return", "result", ";", "}", "@", "Override", "public", "void", "remove", "(", ")", "{", "it", ".", "remove", "(", ")", ";", "}", "}", ";", "}" ]
Creates an iterator that returns a filtered view of the input iterator. @param it The source iterator. @param filter The predicate to match elements that should occur in the result. @return The filtered iterator.
[ "Creates", "an", "iterator", "that", "returns", "a", "filtered", "view", "of", "the", "input", "iterator", "." ]
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java#L38-L72
150,327
skuzzle/TinyPlugz
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java
Iterators.iterableOf
public static <T> Iterable<T> iterableOf(Iterator<T> it) { final Iterator<T> theIt = Require.nonNull(it, "it"); return new Iterable<T>() { @Override public Iterator<T> iterator() { return theIt; } }; }
java
public static <T> Iterable<T> iterableOf(Iterator<T> it) { final Iterator<T> theIt = Require.nonNull(it, "it"); return new Iterable<T>() { @Override public Iterator<T> iterator() { return theIt; } }; }
[ "public", "static", "<", "T", ">", "Iterable", "<", "T", ">", "iterableOf", "(", "Iterator", "<", "T", ">", "it", ")", "{", "final", "Iterator", "<", "T", ">", "theIt", "=", "Require", ".", "nonNull", "(", "it", ",", "\"it\"", ")", ";", "return", "new", "Iterable", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "Iterator", "<", "T", ">", "iterator", "(", ")", "{", "return", "theIt", ";", "}", "}", ";", "}" ]
Wraps the given Iterator into an Iterable. @param it The Iterator to wrap. @return An {@link Iterable} which returns the given Iterator.
[ "Wraps", "the", "given", "Iterator", "into", "an", "Iterable", "." ]
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java#L80-L89
150,328
skuzzle/TinyPlugz
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java
Iterators.compositeIterator
@SafeVarargs public static <T> ElementIterator<T> compositeIterator(Iterator<T>... iterators) { Require.nonNull(iterators, "iterators"); final Iterator<T> result; if (iterators.length == 0) { result = Collections.emptyIterator(); } else if (iterators.length == 1) { if (iterators[0] instanceof ElementIterator<?>) { return (ElementIterator<T>) iterators[0]; } result = iterators[0]; } else { result = new CompoundIterator<>(iterators); } return ElementIterator.wrap(result); }
java
@SafeVarargs public static <T> ElementIterator<T> compositeIterator(Iterator<T>... iterators) { Require.nonNull(iterators, "iterators"); final Iterator<T> result; if (iterators.length == 0) { result = Collections.emptyIterator(); } else if (iterators.length == 1) { if (iterators[0] instanceof ElementIterator<?>) { return (ElementIterator<T>) iterators[0]; } result = iterators[0]; } else { result = new CompoundIterator<>(iterators); } return ElementIterator.wrap(result); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "ElementIterator", "<", "T", ">", "compositeIterator", "(", "Iterator", "<", "T", ">", "...", "iterators", ")", "{", "Require", ".", "nonNull", "(", "iterators", ",", "\"iterators\"", ")", ";", "final", "Iterator", "<", "T", ">", "result", ";", "if", "(", "iterators", ".", "length", "==", "0", ")", "{", "result", "=", "Collections", ".", "emptyIterator", "(", ")", ";", "}", "else", "if", "(", "iterators", ".", "length", "==", "1", ")", "{", "if", "(", "iterators", "[", "0", "]", "instanceof", "ElementIterator", "<", "?", ">", ")", "{", "return", "(", "ElementIterator", "<", "T", ">", ")", "iterators", "[", "0", "]", ";", "}", "result", "=", "iterators", "[", "0", "]", ";", "}", "else", "{", "result", "=", "new", "CompoundIterator", "<>", "(", "iterators", ")", ";", "}", "return", "ElementIterator", ".", "wrap", "(", "result", ")", ";", "}" ]
Creates an iterator which subsequently iterates over all given iterators. @param iterators An array of iterators. @return A composite iterator iterating the values of all given iterators in given order.
[ "Creates", "an", "iterator", "which", "subsequently", "iterates", "over", "all", "given", "iterators", "." ]
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java#L98-L114
150,329
skuzzle/TinyPlugz
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java
Iterators.compositeIterable
@SafeVarargs @SuppressWarnings("unchecked") public static <T> Iterable<T> compositeIterable(Iterable<T>...iterables) { Require.nonNull(iterables, "iterables"); final Iterator<T> it; if (iterables.length == 0) { it = Collections.emptyIterator(); } else if (iterables.length == 1) { return iterables[0]; } else { final Iterator<T>[] iterators = Arrays.stream(iterables) .map(Iterable::iterator) .toArray(size -> new Iterator[size]); it = new CompoundIterator<T>(iterators); } return iterableOf(it); }
java
@SafeVarargs @SuppressWarnings("unchecked") public static <T> Iterable<T> compositeIterable(Iterable<T>...iterables) { Require.nonNull(iterables, "iterables"); final Iterator<T> it; if (iterables.length == 0) { it = Collections.emptyIterator(); } else if (iterables.length == 1) { return iterables[0]; } else { final Iterator<T>[] iterators = Arrays.stream(iterables) .map(Iterable::iterator) .toArray(size -> new Iterator[size]); it = new CompoundIterator<T>(iterators); } return iterableOf(it); }
[ "@", "SafeVarargs", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Iterable", "<", "T", ">", "compositeIterable", "(", "Iterable", "<", "T", ">", "...", "iterables", ")", "{", "Require", ".", "nonNull", "(", "iterables", ",", "\"iterables\"", ")", ";", "final", "Iterator", "<", "T", ">", "it", ";", "if", "(", "iterables", ".", "length", "==", "0", ")", "{", "it", "=", "Collections", ".", "emptyIterator", "(", ")", ";", "}", "else", "if", "(", "iterables", ".", "length", "==", "1", ")", "{", "return", "iterables", "[", "0", "]", ";", "}", "else", "{", "final", "Iterator", "<", "T", ">", "[", "]", "iterators", "=", "Arrays", ".", "stream", "(", "iterables", ")", ".", "map", "(", "Iterable", "::", "iterator", ")", ".", "toArray", "(", "size", "->", "new", "Iterator", "[", "size", "]", ")", ";", "it", "=", "new", "CompoundIterator", "<", "T", ">", "(", "iterators", ")", ";", "}", "return", "iterableOf", "(", "it", ")", ";", "}" ]
Creates an iterable which returns a composite iterator over all iterators of the given iterables. @param iterables The Iterables to wrap. @return A composite iterable.
[ "Creates", "an", "iterable", "which", "returns", "a", "composite", "iterator", "over", "all", "iterators", "of", "the", "given", "iterables", "." ]
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/util/Iterators.java#L123-L139
150,330
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_permute.java
DZcs_permute.cs_permute
public static DZcs cs_permute(DZcs A, int[] pinv, int[] q, boolean values) { int t, j, k, nz = 0, m, n, Ap[], Ai[], Cp[], Ci[] ; DZcsa Cx = new DZcsa(), Ax = new DZcsa() ; DZcs C ; if (!CS_CSC(A)) return (null); /* check inputs */ m = A.m ; n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ; C = cs_spalloc (m, n, Ap [n], values && Ax.x != null, false); /* alloc result */ Cp = C.p ; Ci = C.i ; Cx.x = C.x ; for (k = 0 ; k < n ; k++) { Cp [k] = nz ; /* column k of C is column q[k] of A */ j = q != null ? (q [k]) : k ; for (t = Ap [j] ; t < Ap [j+1] ; t++) { if (Cx.x != null) Cx.set(nz, Ax.get(t)) ; /* row i of A is row pinv[i] of C */ Ci [nz++] = pinv != null ? (pinv [Ai [t]]) : Ai [t] ; } } Cp [n] = nz ; /* finalize the last column of C */ return C ; }
java
public static DZcs cs_permute(DZcs A, int[] pinv, int[] q, boolean values) { int t, j, k, nz = 0, m, n, Ap[], Ai[], Cp[], Ci[] ; DZcsa Cx = new DZcsa(), Ax = new DZcsa() ; DZcs C ; if (!CS_CSC(A)) return (null); /* check inputs */ m = A.m ; n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ; C = cs_spalloc (m, n, Ap [n], values && Ax.x != null, false); /* alloc result */ Cp = C.p ; Ci = C.i ; Cx.x = C.x ; for (k = 0 ; k < n ; k++) { Cp [k] = nz ; /* column k of C is column q[k] of A */ j = q != null ? (q [k]) : k ; for (t = Ap [j] ; t < Ap [j+1] ; t++) { if (Cx.x != null) Cx.set(nz, Ax.get(t)) ; /* row i of A is row pinv[i] of C */ Ci [nz++] = pinv != null ? (pinv [Ai [t]]) : Ai [t] ; } } Cp [n] = nz ; /* finalize the last column of C */ return C ; }
[ "public", "static", "DZcs", "cs_permute", "(", "DZcs", "A", ",", "int", "[", "]", "pinv", ",", "int", "[", "]", "q", ",", "boolean", "values", ")", "{", "int", "t", ",", "j", ",", "k", ",", "nz", "=", "0", ",", "m", ",", "n", ",", "Ap", "[", "]", ",", "Ai", "[", "]", ",", "Cp", "[", "]", ",", "Ci", "[", "]", ";", "DZcsa", "Cx", "=", "new", "DZcsa", "(", ")", ",", "Ax", "=", "new", "DZcsa", "(", ")", ";", "DZcs", "C", ";", "if", "(", "!", "CS_CSC", "(", "A", ")", ")", "return", "(", "null", ")", ";", "/* check inputs */", "m", "=", "A", ".", "m", ";", "n", "=", "A", ".", "n", ";", "Ap", "=", "A", ".", "p", ";", "Ai", "=", "A", ".", "i", ";", "Ax", ".", "x", "=", "A", ".", "x", ";", "C", "=", "cs_spalloc", "(", "m", ",", "n", ",", "Ap", "[", "n", "]", ",", "values", "&&", "Ax", ".", "x", "!=", "null", ",", "false", ")", ";", "/* alloc result */", "Cp", "=", "C", ".", "p", ";", "Ci", "=", "C", ".", "i", ";", "Cx", ".", "x", "=", "C", ".", "x", ";", "for", "(", "k", "=", "0", ";", "k", "<", "n", ";", "k", "++", ")", "{", "Cp", "[", "k", "]", "=", "nz", ";", "/* column k of C is column q[k] of A */", "j", "=", "q", "!=", "null", "?", "(", "q", "[", "k", "]", ")", ":", "k", ";", "for", "(", "t", "=", "Ap", "[", "j", "]", ";", "t", "<", "Ap", "[", "j", "+", "1", "]", ";", "t", "++", ")", "{", "if", "(", "Cx", ".", "x", "!=", "null", ")", "Cx", ".", "set", "(", "nz", ",", "Ax", ".", "get", "(", "t", ")", ")", ";", "/* row i of A is row pinv[i] of C */", "Ci", "[", "nz", "++", "]", "=", "pinv", "!=", "null", "?", "(", "pinv", "[", "Ai", "[", "t", "]", "]", ")", ":", "Ai", "[", "t", "]", ";", "}", "}", "Cp", "[", "n", "]", "=", "nz", ";", "/* finalize the last column of C */", "return", "C", ";", "}" ]
Permutes a sparse matrix, C = PAQ. @param A m-by-n, column-compressed matrix @param pinv a permutation vector of length m @param q a permutation vector of length n @param values allocate pattern only if false, values and pattern otherwise @return C = PAQ, null on error
[ "Permutes", "a", "sparse", "matrix", "C", "=", "PAQ", "." ]
6a6f66bccce1558156a961494358952603b0ac84
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_permute.java#L55-L77
150,331
GerdHolz/TOVAL
src/de/invation/code/toval/types/Multiset.java
Multiset.size
public int size() { int result = 0; for (O o : multiplicities.keySet()) { result += multiplicity(o); } return result; }
java
public int size() { int result = 0; for (O o : multiplicities.keySet()) { result += multiplicity(o); } return result; }
[ "public", "int", "size", "(", ")", "{", "int", "result", "=", "0", ";", "for", "(", "O", "o", ":", "multiplicities", ".", "keySet", "(", ")", ")", "{", "result", "+=", "multiplicity", "(", "o", ")", ";", "}", "return", "result", ";", "}" ]
Returns the number of elements, i.e. the sum of all multiplicities. @return The number of all elements.
[ "Returns", "the", "number", "of", "elements", "i", ".", "e", ".", "the", "sum", "of", "all", "multiplicities", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/Multiset.java#L61-L67
150,332
GerdHolz/TOVAL
src/de/invation/code/toval/types/Multiset.java
Multiset.addAll
public void addAll(O... objects) throws ParameterException { Validate.notNull(objects); for (O o : objects) { incMultiplicity(o); } }
java
public void addAll(O... objects) throws ParameterException { Validate.notNull(objects); for (O o : objects) { incMultiplicity(o); } }
[ "public", "void", "addAll", "(", "O", "...", "objects", ")", "throws", "ParameterException", "{", "Validate", ".", "notNull", "(", "objects", ")", ";", "for", "(", "O", "o", ":", "objects", ")", "{", "incMultiplicity", "(", "o", ")", ";", "}", "}" ]
Adds all given objects to this multiset. @param objects The objects to be added. @throws ParameterException
[ "Adds", "all", "given", "objects", "to", "this", "multiset", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/Multiset.java#L118-L123
150,333
GerdHolz/TOVAL
src/de/invation/code/toval/types/Multiset.java
Multiset.remove
public boolean remove(O object) { Integer multiplicity = multiplicities.get(object); if (multiplicities.remove(object) == null) { return false; } decMultiplicityCount(multiplicity); return true; }
java
public boolean remove(O object) { Integer multiplicity = multiplicities.get(object); if (multiplicities.remove(object) == null) { return false; } decMultiplicityCount(multiplicity); return true; }
[ "public", "boolean", "remove", "(", "O", "object", ")", "{", "Integer", "multiplicity", "=", "multiplicities", ".", "get", "(", "object", ")", ";", "if", "(", "multiplicities", ".", "remove", "(", "object", ")", "==", "null", ")", "{", "return", "false", ";", "}", "decMultiplicityCount", "(", "multiplicity", ")", ";", "return", "true", ";", "}" ]
Removes the given object from this multiset. @param object The object to remove. @return <code>true</code> if the removal was successful;<br> <code>false</code> if the multiset does not contain the given object.
[ "Removes", "the", "given", "object", "from", "this", "multiset", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/Multiset.java#L132-L139
150,334
netarchivesuite/heritrix3-wrapper
src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XmlValidationResult.java
XmlValidationResult.reset
public void reset() { document = null; systemId = null; xsiNamespaces.clear(); schemas.clear(); bDtdUsed = false; bXsdUsed = false; bWellformed = false; bValid = false; }
java
public void reset() { document = null; systemId = null; xsiNamespaces.clear(); schemas.clear(); bDtdUsed = false; bXsdUsed = false; bWellformed = false; bValid = false; }
[ "public", "void", "reset", "(", ")", "{", "document", "=", "null", ";", "systemId", "=", "null", ";", "xsiNamespaces", ".", "clear", "(", ")", ";", "schemas", ".", "clear", "(", ")", ";", "bDtdUsed", "=", "false", ";", "bXsdUsed", "=", "false", ";", "bWellformed", "=", "false", ";", "bValid", "=", "false", ";", "}" ]
Reset fields.
[ "Reset", "fields", "." ]
e53ec5736cbac0bdd3925b5331737dc905871629
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XmlValidationResult.java#L40-L49
150,335
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java
ReadWriteLockPoint.startRead
public void startRead() { SynchronizationPoint<NoException> sp; synchronized (this) { if (!writer) { // nobody is writing, we can read readers++; return; } // if someone is writing, we need to wait if (readerWaiting == null) readerWaiting = new SynchronizationPoint<NoException>(); sp = readerWaiting; readers++; } sp.block(0); }
java
public void startRead() { SynchronizationPoint<NoException> sp; synchronized (this) { if (!writer) { // nobody is writing, we can read readers++; return; } // if someone is writing, we need to wait if (readerWaiting == null) readerWaiting = new SynchronizationPoint<NoException>(); sp = readerWaiting; readers++; } sp.block(0); }
[ "public", "void", "startRead", "(", ")", "{", "SynchronizationPoint", "<", "NoException", ">", "sp", ";", "synchronized", "(", "this", ")", "{", "if", "(", "!", "writer", ")", "{", "// nobody is writing, we can read", "readers", "++", ";", "return", ";", "}", "// if someone is writing, we need to wait", "if", "(", "readerWaiting", "==", "null", ")", "readerWaiting", "=", "new", "SynchronizationPoint", "<", "NoException", ">", "(", ")", ";", "sp", "=", "readerWaiting", ";", "readers", "++", ";", "}", "sp", ".", "block", "(", "0", ")", ";", "}" ]
To call when a thread wants to enter read mode. If the lock point is used in write mode, this method will block until it is released.
[ "To", "call", "when", "a", "thread", "wants", "to", "enter", "read", "mode", ".", "If", "the", "lock", "point", "is", "used", "in", "write", "mode", "this", "method", "will", "block", "until", "it", "is", "released", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java#L25-L40
150,336
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java
ReadWriteLockPoint.startReadAsync
public SynchronizationPoint<NoException> startReadAsync(boolean returnNullIfReady) { SynchronizationPoint<NoException> sp; synchronized (this) { if (!writer) { // nobody is writing, we can read readers++; return returnNullIfReady ? null : new SynchronizationPoint<>(true); } // if someone is writing, we need to wait if (readerWaiting == null) readerWaiting = new SynchronizationPoint<NoException>(); sp = readerWaiting; readers++; } return sp; }
java
public SynchronizationPoint<NoException> startReadAsync(boolean returnNullIfReady) { SynchronizationPoint<NoException> sp; synchronized (this) { if (!writer) { // nobody is writing, we can read readers++; return returnNullIfReady ? null : new SynchronizationPoint<>(true); } // if someone is writing, we need to wait if (readerWaiting == null) readerWaiting = new SynchronizationPoint<NoException>(); sp = readerWaiting; readers++; } return sp; }
[ "public", "SynchronizationPoint", "<", "NoException", ">", "startReadAsync", "(", "boolean", "returnNullIfReady", ")", "{", "SynchronizationPoint", "<", "NoException", ">", "sp", ";", "synchronized", "(", "this", ")", "{", "if", "(", "!", "writer", ")", "{", "// nobody is writing, we can read", "readers", "++", ";", "return", "returnNullIfReady", "?", "null", ":", "new", "SynchronizationPoint", "<>", "(", "true", ")", ";", "}", "// if someone is writing, we need to wait", "if", "(", "readerWaiting", "==", "null", ")", "readerWaiting", "=", "new", "SynchronizationPoint", "<", "NoException", ">", "(", ")", ";", "sp", "=", "readerWaiting", ";", "readers", "++", ";", "}", "return", "sp", ";", "}" ]
To call when a thread wants to enter read mode. If the lock point is used in write mode, this method will return a SynchronizationPoint unblocked when read can start.
[ "To", "call", "when", "a", "thread", "wants", "to", "enter", "read", "mode", ".", "If", "the", "lock", "point", "is", "used", "in", "write", "mode", "this", "method", "will", "return", "a", "SynchronizationPoint", "unblocked", "when", "read", "can", "start", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java#L53-L68
150,337
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java
ReadWriteLockPoint.endRead
public void endRead() { SynchronizationPoint<NoException> sp; synchronized (this) { // if others are still reading, nothing to do if (--readers > 0) return; // if nobody is waiting to write, nothing to do if (writersWaiting == null) return; sp = writersWaiting.removeFirst(); if (writersWaiting.isEmpty()) writersWaiting = null; writer = true; } sp.unblock(); }
java
public void endRead() { SynchronizationPoint<NoException> sp; synchronized (this) { // if others are still reading, nothing to do if (--readers > 0) return; // if nobody is waiting to write, nothing to do if (writersWaiting == null) return; sp = writersWaiting.removeFirst(); if (writersWaiting.isEmpty()) writersWaiting = null; writer = true; } sp.unblock(); }
[ "public", "void", "endRead", "(", ")", "{", "SynchronizationPoint", "<", "NoException", ">", "sp", ";", "synchronized", "(", "this", ")", "{", "// if others are still reading, nothing to do", "if", "(", "--", "readers", ">", "0", ")", "return", ";", "// if nobody is waiting to write, nothing to do", "if", "(", "writersWaiting", "==", "null", ")", "return", ";", "sp", "=", "writersWaiting", ".", "removeFirst", "(", ")", ";", "if", "(", "writersWaiting", ".", "isEmpty", "(", ")", ")", "writersWaiting", "=", "null", ";", "writer", "=", "true", ";", "}", "sp", ".", "unblock", "(", ")", ";", "}" ]
To call when the thread leaves the read mode and release this lock point.
[ "To", "call", "when", "the", "thread", "leaves", "the", "read", "mode", "and", "release", "this", "lock", "point", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java#L71-L83
150,338
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java
ReadWriteLockPoint.startWrite
public void startWrite() { SynchronizationPoint<NoException> sp; synchronized (this) { // if nobody is using the resource, we can start writing if (readers == 0 && !writer) { writer = true; return; } // someone is doing something, we need to block sp = new SynchronizationPoint<NoException>(); if (writersWaiting == null) writersWaiting = new LinkedList<>(); writersWaiting.add(sp); } sp.block(0); }
java
public void startWrite() { SynchronizationPoint<NoException> sp; synchronized (this) { // if nobody is using the resource, we can start writing if (readers == 0 && !writer) { writer = true; return; } // someone is doing something, we need to block sp = new SynchronizationPoint<NoException>(); if (writersWaiting == null) writersWaiting = new LinkedList<>(); writersWaiting.add(sp); } sp.block(0); }
[ "public", "void", "startWrite", "(", ")", "{", "SynchronizationPoint", "<", "NoException", ">", "sp", ";", "synchronized", "(", "this", ")", "{", "// if nobody is using the resource, we can start writing", "if", "(", "readers", "==", "0", "&&", "!", "writer", ")", "{", "writer", "=", "true", ";", "return", ";", "}", "// someone is doing something, we need to block", "sp", "=", "new", "SynchronizationPoint", "<", "NoException", ">", "(", ")", ";", "if", "(", "writersWaiting", "==", "null", ")", "writersWaiting", "=", "new", "LinkedList", "<>", "(", ")", ";", "writersWaiting", ".", "add", "(", "sp", ")", ";", "}", "sp", ".", "block", "(", "0", ")", ";", "}" ]
To call when a thread wants to enter write mode. If the lock point is used in read mode, this method will block until it is released.
[ "To", "call", "when", "a", "thread", "wants", "to", "enter", "write", "mode", ".", "If", "the", "lock", "point", "is", "used", "in", "read", "mode", "this", "method", "will", "block", "until", "it", "is", "released", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java#L88-L102
150,339
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java
ReadWriteLockPoint.startWriteAsync
public SynchronizationPoint<NoException> startWriteAsync(boolean returnNullIfReady) { SynchronizationPoint<NoException> sp; synchronized (this) { // if nobody is using the resource, we can start writing if (readers == 0 && !writer) { writer = true; return returnNullIfReady ? null : new SynchronizationPoint<>(true); } // someone is doing something, we need to block sp = new SynchronizationPoint<NoException>(); if (writersWaiting == null) writersWaiting = new LinkedList<>(); writersWaiting.add(sp); } return sp; }
java
public SynchronizationPoint<NoException> startWriteAsync(boolean returnNullIfReady) { SynchronizationPoint<NoException> sp; synchronized (this) { // if nobody is using the resource, we can start writing if (readers == 0 && !writer) { writer = true; return returnNullIfReady ? null : new SynchronizationPoint<>(true); } // someone is doing something, we need to block sp = new SynchronizationPoint<NoException>(); if (writersWaiting == null) writersWaiting = new LinkedList<>(); writersWaiting.add(sp); } return sp; }
[ "public", "SynchronizationPoint", "<", "NoException", ">", "startWriteAsync", "(", "boolean", "returnNullIfReady", ")", "{", "SynchronizationPoint", "<", "NoException", ">", "sp", ";", "synchronized", "(", "this", ")", "{", "// if nobody is using the resource, we can start writing", "if", "(", "readers", "==", "0", "&&", "!", "writer", ")", "{", "writer", "=", "true", ";", "return", "returnNullIfReady", "?", "null", ":", "new", "SynchronizationPoint", "<>", "(", "true", ")", ";", "}", "// someone is doing something, we need to block", "sp", "=", "new", "SynchronizationPoint", "<", "NoException", ">", "(", ")", ";", "if", "(", "writersWaiting", "==", "null", ")", "writersWaiting", "=", "new", "LinkedList", "<>", "(", ")", ";", "writersWaiting", ".", "add", "(", "sp", ")", ";", "}", "return", "sp", ";", "}" ]
To call when a thread wants to enter write mode. If write can start immediately, this method returns null. If the lock point is used in read mode, this method will return a SynchronizationPoint unblocked when write can start.
[ "To", "call", "when", "a", "thread", "wants", "to", "enter", "write", "mode", ".", "If", "write", "can", "start", "immediately", "this", "method", "returns", "null", ".", "If", "the", "lock", "point", "is", "used", "in", "read", "mode", "this", "method", "will", "return", "a", "SynchronizationPoint", "unblocked", "when", "write", "can", "start", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java#L116-L130
150,340
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java
ReadWriteLockPoint.endWrite
public void endWrite() { SynchronizationPoint<NoException> sp; synchronized (this) { if (readerWaiting != null) { // some readers are waiting, we unblock them sp = readerWaiting; readerWaiting = null; writer = false; } else if (writersWaiting != null) { sp = writersWaiting.removeFirst(); if (writersWaiting.isEmpty()) writersWaiting = null; // writer stay true } else { // nobody is waiting writer = false; return; } } sp.unblock(); }
java
public void endWrite() { SynchronizationPoint<NoException> sp; synchronized (this) { if (readerWaiting != null) { // some readers are waiting, we unblock them sp = readerWaiting; readerWaiting = null; writer = false; } else if (writersWaiting != null) { sp = writersWaiting.removeFirst(); if (writersWaiting.isEmpty()) writersWaiting = null; // writer stay true } else { // nobody is waiting writer = false; return; } } sp.unblock(); }
[ "public", "void", "endWrite", "(", ")", "{", "SynchronizationPoint", "<", "NoException", ">", "sp", ";", "synchronized", "(", "this", ")", "{", "if", "(", "readerWaiting", "!=", "null", ")", "{", "// some readers are waiting, we unblock them", "sp", "=", "readerWaiting", ";", "readerWaiting", "=", "null", ";", "writer", "=", "false", ";", "}", "else", "if", "(", "writersWaiting", "!=", "null", ")", "{", "sp", "=", "writersWaiting", ".", "removeFirst", "(", ")", ";", "if", "(", "writersWaiting", ".", "isEmpty", "(", ")", ")", "writersWaiting", "=", "null", ";", "// writer stay true", "}", "else", "{", "// nobody is waiting", "writer", "=", "false", ";", "return", ";", "}", "}", "sp", ".", "unblock", "(", ")", ";", "}" ]
To call when the thread leaves the write mode and release this lock point.
[ "To", "call", "when", "the", "thread", "leaves", "the", "write", "mode", "and", "release", "this", "lock", "point", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/ReadWriteLockPoint.java#L133-L152
150,341
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/MonitorObserver.java
MonitorObserver.update
@Override public void update(Observable o, Object arg) { if (arg instanceof String) { lines.add((String) arg); } if (arg instanceof List<?>) { lines.addAll((List<String>) arg); } if (arg instanceof Exception) { Exception e = (Exception) arg; PresentationManager.getPm().error(e); lines.add(e.getMessage()); } }
java
@Override public void update(Observable o, Object arg) { if (arg instanceof String) { lines.add((String) arg); } if (arg instanceof List<?>) { lines.addAll((List<String>) arg); } if (arg instanceof Exception) { Exception e = (Exception) arg; PresentationManager.getPm().error(e); lines.add(e.getMessage()); } }
[ "@", "Override", "public", "void", "update", "(", "Observable", "o", ",", "Object", "arg", ")", "{", "if", "(", "arg", "instanceof", "String", ")", "{", "lines", ".", "add", "(", "(", "String", ")", "arg", ")", ";", "}", "if", "(", "arg", "instanceof", "List", "<", "?", ">", ")", "{", "lines", ".", "addAll", "(", "(", "List", "<", "String", ">", ")", "arg", ")", ";", "}", "if", "(", "arg", "instanceof", "Exception", ")", "{", "Exception", "e", "=", "(", "Exception", ")", "arg", ";", "PresentationManager", ".", "getPm", "(", ")", ".", "error", "(", "e", ")", ";", "lines", ".", "add", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Inherited from Observer @param o @param arg
[ "Inherited", "from", "Observer" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/MonitorObserver.java#L36-L49
150,342
mytechia/mytechia_commons
mytechia_commons_library/src/main/java/com/mytechia/commons/util/net/IPUtil.java
IPUtil.isValidLocalIP
public static boolean isValidLocalIP(InetAddress ip) throws SocketException { String ipStr = ip.getHostAddress(); Iterator ips = getAllIPAddresses().iterator(); while (ips.hasNext()) { InetAddress ip2 = (InetAddress) ips.next(); if (ip2.getHostAddress().equals(ipStr)) { return true; } } return false; }
java
public static boolean isValidLocalIP(InetAddress ip) throws SocketException { String ipStr = ip.getHostAddress(); Iterator ips = getAllIPAddresses().iterator(); while (ips.hasNext()) { InetAddress ip2 = (InetAddress) ips.next(); if (ip2.getHostAddress().equals(ipStr)) { return true; } } return false; }
[ "public", "static", "boolean", "isValidLocalIP", "(", "InetAddress", "ip", ")", "throws", "SocketException", "{", "String", "ipStr", "=", "ip", ".", "getHostAddress", "(", ")", ";", "Iterator", "ips", "=", "getAllIPAddresses", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "ips", ".", "hasNext", "(", ")", ")", "{", "InetAddress", "ip2", "=", "(", "InetAddress", ")", "ips", ".", "next", "(", ")", ";", "if", "(", "ip2", ".", "getHostAddress", "(", ")", ".", "equals", "(", "ipStr", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Decides whether an IP is local or not
[ "Decides", "whether", "an", "IP", "is", "local", "or", "not" ]
02251879085f271a1fb51663a1c8eddc8be78ae7
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/util/net/IPUtil.java#L100-L112
150,343
GerdHolz/TOVAL
src/de/invation/code/toval/reflect/ReflectionUtils.java
ReflectionUtils.getInterfaces
public static LinkedHashSet<Class<?>> getInterfaces(Class<?> clazz) throws ReflectionException { Validate.notNull(clazz); try { LinkedHashSet<Class<?>> interfaces = new LinkedHashSet<>(); interfaces.addAll(Arrays.asList(clazz.getInterfaces())); LinkedHashSet<Class<?>> superclasses = getSuperclasses(clazz); for (Class<?> superclass : superclasses) { interfaces.addAll(Arrays.asList(superclass.getInterfaces())); } return interfaces; } catch (Exception e) { throw new ReflectionException(e); } }
java
public static LinkedHashSet<Class<?>> getInterfaces(Class<?> clazz) throws ReflectionException { Validate.notNull(clazz); try { LinkedHashSet<Class<?>> interfaces = new LinkedHashSet<>(); interfaces.addAll(Arrays.asList(clazz.getInterfaces())); LinkedHashSet<Class<?>> superclasses = getSuperclasses(clazz); for (Class<?> superclass : superclasses) { interfaces.addAll(Arrays.asList(superclass.getInterfaces())); } return interfaces; } catch (Exception e) { throw new ReflectionException(e); } }
[ "public", "static", "LinkedHashSet", "<", "Class", "<", "?", ">", ">", "getInterfaces", "(", "Class", "<", "?", ">", "clazz", ")", "throws", "ReflectionException", "{", "Validate", ".", "notNull", "(", "clazz", ")", ";", "try", "{", "LinkedHashSet", "<", "Class", "<", "?", ">", ">", "interfaces", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "interfaces", ".", "addAll", "(", "Arrays", ".", "asList", "(", "clazz", ".", "getInterfaces", "(", ")", ")", ")", ";", "LinkedHashSet", "<", "Class", "<", "?", ">", ">", "superclasses", "=", "getSuperclasses", "(", "clazz", ")", ";", "for", "(", "Class", "<", "?", ">", "superclass", ":", "superclasses", ")", "{", "interfaces", ".", "addAll", "(", "Arrays", ".", "asList", "(", "superclass", ".", "getInterfaces", "(", ")", ")", ")", ";", "}", "return", "interfaces", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ReflectionException", "(", "e", ")", ";", "}", "}" ]
Returns all implemented interfaces of the given class. @param clazz Class to read interfaces from. @return {@link LinkedHashSet} of interfaces. @throws ReflectionException If interfaces can't be read.
[ "Returns", "all", "implemented", "interfaces", "of", "the", "given", "class", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/reflect/ReflectionUtils.java#L267-L281
150,344
xfcjscn/sudoor-server-lib
src/main/java/net/gplatform/sudoor/server/security/model/DefaultPermissionEvaluator.java
DefaultPermissionEvaluator.getExpressionString
public String getExpressionString(String name, Object permission) { String expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name + "." + permission); //Get generic permit if (expression == null) { expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name); } //Get parent permit if (expression == null && StringUtils.contains(name, ".")) { String parent = StringUtils.substringBeforeLast(name, "."); expression = getExpressionString(parent, permission); } LOG.debug("Get Expression String: [{}] for name: [{}] permission: [{}]", expression, name, permission); return expression; }
java
public String getExpressionString(String name, Object permission) { String expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name + "." + permission); //Get generic permit if (expression == null) { expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name); } //Get parent permit if (expression == null && StringUtils.contains(name, ".")) { String parent = StringUtils.substringBeforeLast(name, "."); expression = getExpressionString(parent, permission); } LOG.debug("Get Expression String: [{}] for name: [{}] permission: [{}]", expression, name, permission); return expression; }
[ "public", "String", "getExpressionString", "(", "String", "name", ",", "Object", "permission", ")", "{", "String", "expression", "=", "properties", ".", "getProperty", "(", "CONFIG_EXPRESSION_PREFIX", "+", "name", "+", "\".\"", "+", "permission", ")", ";", "//Get generic permit", "if", "(", "expression", "==", "null", ")", "{", "expression", "=", "properties", ".", "getProperty", "(", "CONFIG_EXPRESSION_PREFIX", "+", "name", ")", ";", "}", "//Get parent permit", "if", "(", "expression", "==", "null", "&&", "StringUtils", ".", "contains", "(", "name", ",", "\".\"", ")", ")", "{", "String", "parent", "=", "StringUtils", ".", "substringBeforeLast", "(", "name", ",", "\".\"", ")", ";", "expression", "=", "getExpressionString", "(", "parent", ",", "permission", ")", ";", "}", "LOG", ".", "debug", "(", "\"Get Expression String: [{}] for name: [{}] permission: [{}]\"", ",", "expression", ",", "name", ",", "permission", ")", ";", "return", "expression", ";", "}" ]
Find the expression string recursively from the config file @param name @param permission @return
[ "Find", "the", "expression", "string", "recursively", "from", "the", "config", "file" ]
37dc1996eaa9cad25c82abd1de315ba565e32097
https://github.com/xfcjscn/sudoor-server-lib/blob/37dc1996eaa9cad25c82abd1de315ba565e32097/src/main/java/net/gplatform/sudoor/server/security/model/DefaultPermissionEvaluator.java#L75-L91
150,345
ppi-ag/thymeleaf-mailto
src/main/java/de/ppi/fuwesta/thymeleaf/mail/MailAttrProcessor.java
MailAttrProcessor.createMailToLink
private String createMailToLink(String to, String bcc, String cc, String subject, String body) { Validate.notNull(to, "You must define a to-address"); final StringBuilder urlBuilder = new StringBuilder("mailto:"); addEncodedValue(urlBuilder, "to", to); if (bcc != null || cc != null || subject != null || body != null) { urlBuilder.append('?'); } addEncodedValue(urlBuilder, "bcc", bcc); addEncodedValue(urlBuilder, "cc", cc); addEncodedValue(urlBuilder, "subject", subject); if (body != null) { addEncodedValue(urlBuilder, "body", body.replace("$NL$", "\r\n")); } return urlBuilder.toString(); }
java
private String createMailToLink(String to, String bcc, String cc, String subject, String body) { Validate.notNull(to, "You must define a to-address"); final StringBuilder urlBuilder = new StringBuilder("mailto:"); addEncodedValue(urlBuilder, "to", to); if (bcc != null || cc != null || subject != null || body != null) { urlBuilder.append('?'); } addEncodedValue(urlBuilder, "bcc", bcc); addEncodedValue(urlBuilder, "cc", cc); addEncodedValue(urlBuilder, "subject", subject); if (body != null) { addEncodedValue(urlBuilder, "body", body.replace("$NL$", "\r\n")); } return urlBuilder.toString(); }
[ "private", "String", "createMailToLink", "(", "String", "to", ",", "String", "bcc", ",", "String", "cc", ",", "String", "subject", ",", "String", "body", ")", "{", "Validate", ".", "notNull", "(", "to", ",", "\"You must define a to-address\"", ")", ";", "final", "StringBuilder", "urlBuilder", "=", "new", "StringBuilder", "(", "\"mailto:\"", ")", ";", "addEncodedValue", "(", "urlBuilder", ",", "\"to\"", ",", "to", ")", ";", "if", "(", "bcc", "!=", "null", "||", "cc", "!=", "null", "||", "subject", "!=", "null", "||", "body", "!=", "null", ")", "{", "urlBuilder", ".", "append", "(", "'", "'", ")", ";", "}", "addEncodedValue", "(", "urlBuilder", ",", "\"bcc\"", ",", "bcc", ")", ";", "addEncodedValue", "(", "urlBuilder", ",", "\"cc\"", ",", "cc", ")", ";", "addEncodedValue", "(", "urlBuilder", ",", "\"subject\"", ",", "subject", ")", ";", "if", "(", "body", "!=", "null", ")", "{", "addEncodedValue", "(", "urlBuilder", ",", "\"body\"", ",", "body", ".", "replace", "(", "\"$NL$\"", ",", "\"\\r\\n\"", ")", ")", ";", "}", "return", "urlBuilder", ".", "toString", "(", ")", ";", "}" ]
Creates the mailto-link. @param to the to-address @param bcc optional a bcc @param cc optional a cc @param subject optional a subject @param body optional a body @return the link.
[ "Creates", "the", "mailto", "-", "link", "." ]
e44330be1d6906c5d4626d961e95814581f0245f
https://github.com/ppi-ag/thymeleaf-mailto/blob/e44330be1d6906c5d4626d961e95814581f0245f/src/main/java/de/ppi/fuwesta/thymeleaf/mail/MailAttrProcessor.java#L89-L105
150,346
ppi-ag/thymeleaf-mailto
src/main/java/de/ppi/fuwesta/thymeleaf/mail/MailAttrProcessor.java
MailAttrProcessor.addEncodedValue
private void addEncodedValue(final StringBuilder urlBuilder, final String name, String value) { if (value != null) { String encodedValue; if (!"to".equals(name) && !urlBuilder.toString().endsWith("?")) { urlBuilder.append('&'); } try { encodedValue = URLEncoder.encode(value, "utf-8").replace("+", "%20"); } catch (UnsupportedEncodingException e) { LOG.error("UTF-8 encoding not supported during encoding " + value, e); encodedValue = value; } if (!"to".equals(name)) { urlBuilder.append(name).append('='); } urlBuilder.append(encodedValue); } }
java
private void addEncodedValue(final StringBuilder urlBuilder, final String name, String value) { if (value != null) { String encodedValue; if (!"to".equals(name) && !urlBuilder.toString().endsWith("?")) { urlBuilder.append('&'); } try { encodedValue = URLEncoder.encode(value, "utf-8").replace("+", "%20"); } catch (UnsupportedEncodingException e) { LOG.error("UTF-8 encoding not supported during encoding " + value, e); encodedValue = value; } if (!"to".equals(name)) { urlBuilder.append(name).append('='); } urlBuilder.append(encodedValue); } }
[ "private", "void", "addEncodedValue", "(", "final", "StringBuilder", "urlBuilder", ",", "final", "String", "name", ",", "String", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "String", "encodedValue", ";", "if", "(", "!", "\"to\"", ".", "equals", "(", "name", ")", "&&", "!", "urlBuilder", ".", "toString", "(", ")", ".", "endsWith", "(", "\"?\"", ")", ")", "{", "urlBuilder", ".", "append", "(", "'", "'", ")", ";", "}", "try", "{", "encodedValue", "=", "URLEncoder", ".", "encode", "(", "value", ",", "\"utf-8\"", ")", ".", "replace", "(", "\"+\"", ",", "\"%20\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "LOG", ".", "error", "(", "\"UTF-8 encoding not supported during encoding \"", "+", "value", ",", "e", ")", ";", "encodedValue", "=", "value", ";", "}", "if", "(", "!", "\"to\"", ".", "equals", "(", "name", ")", ")", "{", "urlBuilder", ".", "append", "(", "name", ")", ".", "append", "(", "'", "'", ")", ";", "}", "urlBuilder", ".", "append", "(", "encodedValue", ")", ";", "}", "}" ]
Added more information to the urlbuilder. @param urlBuilder an urlbuilder. @param name the name of the attribute. @param value the value.
[ "Added", "more", "information", "to", "the", "urlbuilder", "." ]
e44330be1d6906c5d4626d961e95814581f0245f
https://github.com/ppi-ag/thymeleaf-mailto/blob/e44330be1d6906c5d4626d961e95814581f0245f/src/main/java/de/ppi/fuwesta/thymeleaf/mail/MailAttrProcessor.java#L114-L134
150,347
ppi-ag/thymeleaf-mailto
src/main/java/de/ppi/fuwesta/thymeleaf/mail/MailAttrProcessor.java
MailAttrProcessor.extractAttribute
private String extractAttribute(Element element, Arguments arguments, String attributeName) { final String toExpr = element.getAttributeValue(attributeName); if (toExpr == null) { return null; } final String to; if (toExpr.contains("#") || toExpr.contains("$")) { to = parse(arguments, toExpr); } else { to = toExpr; } element.removeAttribute(attributeName); return to; }
java
private String extractAttribute(Element element, Arguments arguments, String attributeName) { final String toExpr = element.getAttributeValue(attributeName); if (toExpr == null) { return null; } final String to; if (toExpr.contains("#") || toExpr.contains("$")) { to = parse(arguments, toExpr); } else { to = toExpr; } element.removeAttribute(attributeName); return to; }
[ "private", "String", "extractAttribute", "(", "Element", "element", ",", "Arguments", "arguments", ",", "String", "attributeName", ")", "{", "final", "String", "toExpr", "=", "element", ".", "getAttributeValue", "(", "attributeName", ")", ";", "if", "(", "toExpr", "==", "null", ")", "{", "return", "null", ";", "}", "final", "String", "to", ";", "if", "(", "toExpr", ".", "contains", "(", "\"#\"", ")", "||", "toExpr", ".", "contains", "(", "\"$\"", ")", ")", "{", "to", "=", "parse", "(", "arguments", ",", "toExpr", ")", ";", "}", "else", "{", "to", "=", "toExpr", ";", "}", "element", ".", "removeAttribute", "(", "attributeName", ")", ";", "return", "to", ";", "}" ]
Extract the attribute. @param element the element where to search. @param arguments thymeleaf arguments. @param attributeName the name of the attribute. @return the value of the attribute.
[ "Extract", "the", "attribute", "." ]
e44330be1d6906c5d4626d961e95814581f0245f
https://github.com/ppi-ag/thymeleaf-mailto/blob/e44330be1d6906c5d4626d961e95814581f0245f/src/main/java/de/ppi/fuwesta/thymeleaf/mail/MailAttrProcessor.java#L144-L158
150,348
ppi-ag/thymeleaf-mailto
src/main/java/de/ppi/fuwesta/thymeleaf/mail/MailAttrProcessor.java
MailAttrProcessor.parse
private String parse(final Arguments arguments, String input) { final Configuration configuration = arguments.getConfiguration(); final IStandardExpressionParser parser = StandardExpressions.getExpressionParser(configuration); final IStandardExpression expression = parser.parseExpression(configuration, arguments, input); return (String) expression.execute(configuration, arguments); }
java
private String parse(final Arguments arguments, String input) { final Configuration configuration = arguments.getConfiguration(); final IStandardExpressionParser parser = StandardExpressions.getExpressionParser(configuration); final IStandardExpression expression = parser.parseExpression(configuration, arguments, input); return (String) expression.execute(configuration, arguments); }
[ "private", "String", "parse", "(", "final", "Arguments", "arguments", ",", "String", "input", ")", "{", "final", "Configuration", "configuration", "=", "arguments", ".", "getConfiguration", "(", ")", ";", "final", "IStandardExpressionParser", "parser", "=", "StandardExpressions", ".", "getExpressionParser", "(", "configuration", ")", ";", "final", "IStandardExpression", "expression", "=", "parser", ".", "parseExpression", "(", "configuration", ",", "arguments", ",", "input", ")", ";", "return", "(", "String", ")", "expression", ".", "execute", "(", "configuration", ",", "arguments", ")", ";", "}" ]
Parse the expression of an value. @param arguments thymeleaf arguments. @param input the expression. @return the eavluated valued.
[ "Parse", "the", "expression", "of", "an", "value", "." ]
e44330be1d6906c5d4626d961e95814581f0245f
https://github.com/ppi-ag/thymeleaf-mailto/blob/e44330be1d6906c5d4626d961e95814581f0245f/src/main/java/de/ppi/fuwesta/thymeleaf/mail/MailAttrProcessor.java#L175-L185
150,349
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java
ID3v2Header.checkHeader
private boolean checkHeader(RandomAccessInputStream raf) throws IOException { raf.seek(HEAD_LOCATION); byte[] buf = new byte[HEAD_SIZE]; if (raf.read(buf) != HEAD_SIZE) { throw new IOException("Error encountered finding id3v2 header"); } String result = new String(buf, ENC_TYPE); if (result.substring(0, TAG_START.length()).equals(TAG_START)) { if ((((int)buf[3]&0xFF) < 0xff) && (((int)buf[4]&0xFF) < 0xff)) { if ((((int)buf[6]&0xFF) < 0x80) && (((int)buf[7]&0xFF) < 0x80) && (((int)buf[8]&0xFF) < 0x80) && (((int)buf[9]&0xFF) < 0x80)) { return true; } } } return false; }
java
private boolean checkHeader(RandomAccessInputStream raf) throws IOException { raf.seek(HEAD_LOCATION); byte[] buf = new byte[HEAD_SIZE]; if (raf.read(buf) != HEAD_SIZE) { throw new IOException("Error encountered finding id3v2 header"); } String result = new String(buf, ENC_TYPE); if (result.substring(0, TAG_START.length()).equals(TAG_START)) { if ((((int)buf[3]&0xFF) < 0xff) && (((int)buf[4]&0xFF) < 0xff)) { if ((((int)buf[6]&0xFF) < 0x80) && (((int)buf[7]&0xFF) < 0x80) && (((int)buf[8]&0xFF) < 0x80) && (((int)buf[9]&0xFF) < 0x80)) { return true; } } } return false; }
[ "private", "boolean", "checkHeader", "(", "RandomAccessInputStream", "raf", ")", "throws", "IOException", "{", "raf", ".", "seek", "(", "HEAD_LOCATION", ")", ";", "byte", "[", "]", "buf", "=", "new", "byte", "[", "HEAD_SIZE", "]", ";", "if", "(", "raf", ".", "read", "(", "buf", ")", "!=", "HEAD_SIZE", ")", "{", "throw", "new", "IOException", "(", "\"Error encountered finding id3v2 header\"", ")", ";", "}", "String", "result", "=", "new", "String", "(", "buf", ",", "ENC_TYPE", ")", ";", "if", "(", "result", ".", "substring", "(", "0", ",", "TAG_START", ".", "length", "(", ")", ")", ".", "equals", "(", "TAG_START", ")", ")", "{", "if", "(", "(", "(", "(", "int", ")", "buf", "[", "3", "]", "&", "0xFF", ")", "<", "0xff", ")", "&&", "(", "(", "(", "int", ")", "buf", "[", "4", "]", "&", "0xFF", ")", "<", "0xff", ")", ")", "{", "if", "(", "(", "(", "(", "int", ")", "buf", "[", "6", "]", "&", "0xFF", ")", "<", "0x80", ")", "&&", "(", "(", "(", "int", ")", "buf", "[", "7", "]", "&", "0xFF", ")", "<", "0x80", ")", "&&", "(", "(", "(", "int", ")", "buf", "[", "8", "]", "&", "0xFF", ")", "<", "0x80", ")", "&&", "(", "(", "(", "int", ")", "buf", "[", "9", "]", "&", "0xFF", ")", "<", "0x80", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Checks to see if there is an id3v2 header in the file provided to the constructor. @return true if an id3v2 header exists in the file @exception FileNotFoundException if an error occurs @exception IOException if an error occurs
[ "Checks", "to", "see", "if", "there", "is", "an", "id3v2", "header", "in", "the", "file", "provided", "to", "the", "constructor", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java#L80-L103
150,350
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java
ID3v2Header.readHeader
private void readHeader(RandomAccessInputStream raf) throws IOException { raf.seek(HEAD_LOCATION); byte[] head = new byte[HEAD_SIZE]; if (raf.read(head) != HEAD_SIZE) { throw new IOException("Error encountered reading id3v2 header"); } majorVersion = (int) head[3]; if (majorVersion <= NEW_MAJOR_VERSION) { minorVersion = (int) head[4]; unsynchronisation = (head[5]&0x80)!=0; extended = (head[5]&0x40)!=0; experimental = (head[5]&0x20)!=0; footer = (head[5]&0x10)!=0; tagSize = Helpers.convertDWordToInt(head, 6); } }
java
private void readHeader(RandomAccessInputStream raf) throws IOException { raf.seek(HEAD_LOCATION); byte[] head = new byte[HEAD_SIZE]; if (raf.read(head) != HEAD_SIZE) { throw new IOException("Error encountered reading id3v2 header"); } majorVersion = (int) head[3]; if (majorVersion <= NEW_MAJOR_VERSION) { minorVersion = (int) head[4]; unsynchronisation = (head[5]&0x80)!=0; extended = (head[5]&0x40)!=0; experimental = (head[5]&0x20)!=0; footer = (head[5]&0x10)!=0; tagSize = Helpers.convertDWordToInt(head, 6); } }
[ "private", "void", "readHeader", "(", "RandomAccessInputStream", "raf", ")", "throws", "IOException", "{", "raf", ".", "seek", "(", "HEAD_LOCATION", ")", ";", "byte", "[", "]", "head", "=", "new", "byte", "[", "HEAD_SIZE", "]", ";", "if", "(", "raf", ".", "read", "(", "head", ")", "!=", "HEAD_SIZE", ")", "{", "throw", "new", "IOException", "(", "\"Error encountered reading id3v2 header\"", ")", ";", "}", "majorVersion", "=", "(", "int", ")", "head", "[", "3", "]", ";", "if", "(", "majorVersion", "<=", "NEW_MAJOR_VERSION", ")", "{", "minorVersion", "=", "(", "int", ")", "head", "[", "4", "]", ";", "unsynchronisation", "=", "(", "head", "[", "5", "]", "&", "0x80", ")", "!=", "0", ";", "extended", "=", "(", "head", "[", "5", "]", "&", "0x40", ")", "!=", "0", ";", "experimental", "=", "(", "head", "[", "5", "]", "&", "0x20", ")", "!=", "0", ";", "footer", "=", "(", "head", "[", "5", "]", "&", "0x10", ")", "!=", "0", ";", "tagSize", "=", "Helpers", ".", "convertDWordToInt", "(", "head", ",", "6", ")", ";", "}", "}" ]
Extracts the information from the header. @exception FileNotFoundException if an error occurs @exception IOException if an error occurs
[ "Extracts", "the", "information", "from", "the", "header", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java#L111-L132
150,351
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java
ID3v2Header.getBytes
public byte[] getBytes() { byte[] b = new byte[HEAD_SIZE]; int bytesCopied = 0; System.arraycopy(Helpers.getBytesFromString(TAG_START, TAG_START.length(), ENC_TYPE), 0, b, 0, TAG_START.length()); bytesCopied += TAG_START.length(); b[bytesCopied++] = (byte) majorVersion; b[bytesCopied++] = (byte) minorVersion; b[bytesCopied++] = getFlagByte(); System.arraycopy(Helpers.convertIntToDWord(tagSize), 0, b, bytesCopied, 4); bytesCopied += 4; return b; }
java
public byte[] getBytes() { byte[] b = new byte[HEAD_SIZE]; int bytesCopied = 0; System.arraycopy(Helpers.getBytesFromString(TAG_START, TAG_START.length(), ENC_TYPE), 0, b, 0, TAG_START.length()); bytesCopied += TAG_START.length(); b[bytesCopied++] = (byte) majorVersion; b[bytesCopied++] = (byte) minorVersion; b[bytesCopied++] = getFlagByte(); System.arraycopy(Helpers.convertIntToDWord(tagSize), 0, b, bytesCopied, 4); bytesCopied += 4; return b; }
[ "public", "byte", "[", "]", "getBytes", "(", ")", "{", "byte", "[", "]", "b", "=", "new", "byte", "[", "HEAD_SIZE", "]", ";", "int", "bytesCopied", "=", "0", ";", "System", ".", "arraycopy", "(", "Helpers", ".", "getBytesFromString", "(", "TAG_START", ",", "TAG_START", ".", "length", "(", ")", ",", "ENC_TYPE", ")", ",", "0", ",", "b", ",", "0", ",", "TAG_START", ".", "length", "(", ")", ")", ";", "bytesCopied", "+=", "TAG_START", ".", "length", "(", ")", ";", "b", "[", "bytesCopied", "++", "]", "=", "(", "byte", ")", "majorVersion", ";", "b", "[", "bytesCopied", "++", "]", "=", "(", "byte", ")", "minorVersion", ";", "b", "[", "bytesCopied", "++", "]", "=", "getFlagByte", "(", ")", ";", "System", ".", "arraycopy", "(", "Helpers", ".", "convertIntToDWord", "(", "tagSize", ")", ",", "0", ",", "b", ",", "bytesCopied", ",", "4", ")", ";", "bytesCopied", "+=", "4", ";", "return", "b", ";", "}" ]
Return an array of bytes representing the header. This can be used to easily write the header to a file. @return a binary representation of this header
[ "Return", "an", "array", "of", "bytes", "representing", "the", "header", ".", "This", "can", "be", "used", "to", "easily", "write", "the", "header", "to", "a", "file", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java#L140-L154
150,352
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java
ID3v2Header.getFlagByte
private byte getFlagByte() { byte ret = 0; if (unsynchronisation) ret |= 0x80; if (extended) ret |= 0x40; if (experimental) ret |= 0x20; if (footer) ret |= 0x10; return ret; }
java
private byte getFlagByte() { byte ret = 0; if (unsynchronisation) ret |= 0x80; if (extended) ret |= 0x40; if (experimental) ret |= 0x20; if (footer) ret |= 0x10; return ret; }
[ "private", "byte", "getFlagByte", "(", ")", "{", "byte", "ret", "=", "0", ";", "if", "(", "unsynchronisation", ")", "ret", "|=", "0x80", ";", "if", "(", "extended", ")", "ret", "|=", "0x40", ";", "if", "(", "experimental", ")", "ret", "|=", "0x20", ";", "if", "(", "footer", ")", "ret", "|=", "0x10", ";", "return", "ret", ";", "}" ]
A helper function for the getBytes function that returns a byte with the proper flags set. @return the flags byte of this header
[ "A", "helper", "function", "for", "the", "getBytes", "function", "that", "returns", "a", "byte", "with", "the", "proper", "flags", "set", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Header.java#L162-L172
150,353
mytechia/mytechia_commons
mytechia_commons_library/src/main/java/com/mytechia/commons/util/math/MyVector.java
MyVector.module
public double module() { double v = 0; for(int i=0; i<vector.length; i++) { v = Math.pow(vector[i], 2); } return Math.sqrt(v); }
java
public double module() { double v = 0; for(int i=0; i<vector.length; i++) { v = Math.pow(vector[i], 2); } return Math.sqrt(v); }
[ "public", "double", "module", "(", ")", "{", "double", "v", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "vector", ".", "length", ";", "i", "++", ")", "{", "v", "=", "Math", ".", "pow", "(", "vector", "[", "i", "]", ",", "2", ")", ";", "}", "return", "Math", ".", "sqrt", "(", "v", ")", ";", "}" ]
Calculates the module of this vector @return the module of this vector
[ "Calculates", "the", "module", "of", "this", "vector" ]
02251879085f271a1fb51663a1c8eddc8be78ae7
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/util/math/MyVector.java#L87-L98
150,354
mytechia/mytechia_commons
mytechia_commons_library/src/main/java/com/mytechia/commons/util/math/MyVector.java
MyVector.normalize
public MyVector normalize() { double vmodule = module(); double [] associatedVector = new double [vector.length]; for(int i=0; i<vector.length; i++) { associatedVector[i] = (1/vmodule) * vector[i]; } return new MyVector(associatedVector); }
java
public MyVector normalize() { double vmodule = module(); double [] associatedVector = new double [vector.length]; for(int i=0; i<vector.length; i++) { associatedVector[i] = (1/vmodule) * vector[i]; } return new MyVector(associatedVector); }
[ "public", "MyVector", "normalize", "(", ")", "{", "double", "vmodule", "=", "module", "(", ")", ";", "double", "[", "]", "associatedVector", "=", "new", "double", "[", "vector", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "vector", ".", "length", ";", "i", "++", ")", "{", "associatedVector", "[", "i", "]", "=", "(", "1", "/", "vmodule", ")", "*", "vector", "[", "i", "]", ";", "}", "return", "new", "MyVector", "(", "associatedVector", ")", ";", "}" ]
Calculates the associated normalized Vector of this Vector @return the associated normalized Vector of this Vector
[ "Calculates", "the", "associated", "normalized", "Vector", "of", "this", "Vector" ]
02251879085f271a1fb51663a1c8eddc8be78ae7
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/util/math/MyVector.java#L105-L118
150,355
icode/ameba-utils
src/main/java/ameba/util/bean/BeanMap.java
BeanMap.valueIterator
public Iterator<Object> valueIterator() { final Iterator<String> iter = keyIterator(); return new Iterator<Object>() { public boolean hasNext() { return iter.hasNext(); } public Object next() { String key = iter.next(); return get(key); } public void remove() { throw new UnsupportedOperationException("remove() not supported for BeanMap"); } }; }
java
public Iterator<Object> valueIterator() { final Iterator<String> iter = keyIterator(); return new Iterator<Object>() { public boolean hasNext() { return iter.hasNext(); } public Object next() { String key = iter.next(); return get(key); } public void remove() { throw new UnsupportedOperationException("remove() not supported for BeanMap"); } }; }
[ "public", "Iterator", "<", "Object", ">", "valueIterator", "(", ")", "{", "final", "Iterator", "<", "String", ">", "iter", "=", "keyIterator", "(", ")", ";", "return", "new", "Iterator", "<", "Object", ">", "(", ")", "{", "public", "boolean", "hasNext", "(", ")", "{", "return", "iter", ".", "hasNext", "(", ")", ";", "}", "public", "Object", "next", "(", ")", "{", "String", "key", "=", "iter", ".", "next", "(", ")", ";", "return", "get", "(", "key", ")", ";", "}", "public", "void", "remove", "(", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"remove() not supported for BeanMap\"", ")", ";", "}", "}", ";", "}" ]
Convenience method for getting an iterator over the values. @return an iterator over the values
[ "Convenience", "method", "for", "getting", "an", "iterator", "over", "the", "values", "." ]
1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/bean/BeanMap.java#L398-L414
150,356
icode/ameba-utils
src/main/java/ameba/util/bean/BeanMap.java
BeanMap.getReadInvoker
public BeanInvoker getReadInvoker(String name) { BeanInvoker invoker; if (readInvokers.containsKey(name)) { invoker = readInvokers.get(name); } else { invoker = getInvoker(readHandleType.get(name), name); readInvokers.put(name, invoker); } return invoker; }
java
public BeanInvoker getReadInvoker(String name) { BeanInvoker invoker; if (readInvokers.containsKey(name)) { invoker = readInvokers.get(name); } else { invoker = getInvoker(readHandleType.get(name), name); readInvokers.put(name, invoker); } return invoker; }
[ "public", "BeanInvoker", "getReadInvoker", "(", "String", "name", ")", "{", "BeanInvoker", "invoker", ";", "if", "(", "readInvokers", ".", "containsKey", "(", "name", ")", ")", "{", "invoker", "=", "readInvokers", ".", "get", "(", "name", ")", ";", "}", "else", "{", "invoker", "=", "getInvoker", "(", "readHandleType", ".", "get", "(", "name", ")", ",", "name", ")", ";", "readInvokers", ".", "put", "(", "name", ",", "invoker", ")", ";", "}", "return", "invoker", ";", "}" ]
Returns the accessor for the property with the given name. @param name the name of the property @return the accessor method for the property, or null
[ "Returns", "the", "accessor", "for", "the", "property", "with", "the", "given", "name", "." ]
1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/bean/BeanMap.java#L471-L480
150,357
icode/ameba-utils
src/main/java/ameba/util/bean/BeanMap.java
BeanMap.getWriteInvoker
public BeanInvoker getWriteInvoker(String name) { BeanInvoker invoker; if (writeInvokers.containsKey(name)) { invoker = writeInvokers.get(name); } else { invoker = getInvoker(HandleType.SET, name); writeInvokers.put(name, invoker); } return invoker; }
java
public BeanInvoker getWriteInvoker(String name) { BeanInvoker invoker; if (writeInvokers.containsKey(name)) { invoker = writeInvokers.get(name); } else { invoker = getInvoker(HandleType.SET, name); writeInvokers.put(name, invoker); } return invoker; }
[ "public", "BeanInvoker", "getWriteInvoker", "(", "String", "name", ")", "{", "BeanInvoker", "invoker", ";", "if", "(", "writeInvokers", ".", "containsKey", "(", "name", ")", ")", "{", "invoker", "=", "writeInvokers", ".", "get", "(", "name", ")", ";", "}", "else", "{", "invoker", "=", "getInvoker", "(", "HandleType", ".", "SET", ",", "name", ")", ";", "writeInvokers", ".", "put", "(", "name", ",", "invoker", ")", ";", "}", "return", "invoker", ";", "}" ]
Returns the mutator for the property with the given name. @param name the name of the property @return the mutator method for the property, or null
[ "Returns", "the", "mutator", "for", "the", "property", "with", "the", "given", "name", "." ]
1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/bean/BeanMap.java#L488-L497
150,358
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamReader.java
XMLStreamReader.start
public static AsyncWork<XMLStreamReader, Exception> start(IO.Readable.Buffered io, int charactersBufferSize, int maxBuffers) { AsyncWork<XMLStreamReader, Exception> result = new AsyncWork<>(); new Task.Cpu.FromRunnable("Start reading XML " + io.getSourceDescription(), io.getPriority(), () -> { XMLStreamReader reader = new XMLStreamReader(io, charactersBufferSize, maxBuffers); try { Starter start = new Starter(io, reader.defaultEncoding, reader.charactersBuffersSize, reader.maxBuffers); reader.stream = start.start(); reader.stream.canStartReading().listenAsync( new Task.Cpu.FromRunnable("Start reading XML " + io.getSourceDescription(), io.getPriority(), () -> { try { reader.next(); result.unblockSuccess(reader); } catch (Exception e) { result.unblockError(e); } }), true); } catch (Exception e) { result.unblockError(e); } }).startOn(io.canStartReading(), true); return result; }
java
public static AsyncWork<XMLStreamReader, Exception> start(IO.Readable.Buffered io, int charactersBufferSize, int maxBuffers) { AsyncWork<XMLStreamReader, Exception> result = new AsyncWork<>(); new Task.Cpu.FromRunnable("Start reading XML " + io.getSourceDescription(), io.getPriority(), () -> { XMLStreamReader reader = new XMLStreamReader(io, charactersBufferSize, maxBuffers); try { Starter start = new Starter(io, reader.defaultEncoding, reader.charactersBuffersSize, reader.maxBuffers); reader.stream = start.start(); reader.stream.canStartReading().listenAsync( new Task.Cpu.FromRunnable("Start reading XML " + io.getSourceDescription(), io.getPriority(), () -> { try { reader.next(); result.unblockSuccess(reader); } catch (Exception e) { result.unblockError(e); } }), true); } catch (Exception e) { result.unblockError(e); } }).startOn(io.canStartReading(), true); return result; }
[ "public", "static", "AsyncWork", "<", "XMLStreamReader", ",", "Exception", ">", "start", "(", "IO", ".", "Readable", ".", "Buffered", "io", ",", "int", "charactersBufferSize", ",", "int", "maxBuffers", ")", "{", "AsyncWork", "<", "XMLStreamReader", ",", "Exception", ">", "result", "=", "new", "AsyncWork", "<>", "(", ")", ";", "new", "Task", ".", "Cpu", ".", "FromRunnable", "(", "\"Start reading XML \"", "+", "io", ".", "getSourceDescription", "(", ")", ",", "io", ".", "getPriority", "(", ")", ",", "(", ")", "->", "{", "XMLStreamReader", "reader", "=", "new", "XMLStreamReader", "(", "io", ",", "charactersBufferSize", ",", "maxBuffers", ")", ";", "try", "{", "Starter", "start", "=", "new", "Starter", "(", "io", ",", "reader", ".", "defaultEncoding", ",", "reader", ".", "charactersBuffersSize", ",", "reader", ".", "maxBuffers", ")", ";", "reader", ".", "stream", "=", "start", ".", "start", "(", ")", ";", "reader", ".", "stream", ".", "canStartReading", "(", ")", ".", "listenAsync", "(", "new", "Task", ".", "Cpu", ".", "FromRunnable", "(", "\"Start reading XML \"", "+", "io", ".", "getSourceDescription", "(", ")", ",", "io", ".", "getPriority", "(", ")", ",", "(", ")", "->", "{", "try", "{", "reader", ".", "next", "(", ")", ";", "result", ".", "unblockSuccess", "(", "reader", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "result", ".", "unblockError", "(", "e", ")", ";", "}", "}", ")", ",", "true", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "result", ".", "unblockError", "(", "e", ")", ";", "}", "}", ")", ".", "startOn", "(", "io", ".", "canStartReading", "(", ")", ",", "true", ")", ";", "return", "result", ";", "}" ]
Utility method that initialize a XMLStreamReader, initialize it, and return an AsyncWork which is unblocked when characters are available to be read.
[ "Utility", "method", "that", "initialize", "a", "XMLStreamReader", "initialize", "it", "and", "return", "an", "AsyncWork", "which", "is", "unblocked", "when", "characters", "are", "available", "to", "be", "read", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamReader.java#L61-L82
150,359
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamReader.java
XMLStreamReader.next
@Override public void next() throws XMLException, IOException { reset(); char c; if ((c = stream.read()) == '<') readTag(); else readChars(c); }
java
@Override public void next() throws XMLException, IOException { reset(); char c; if ((c = stream.read()) == '<') readTag(); else readChars(c); }
[ "@", "Override", "public", "void", "next", "(", ")", "throws", "XMLException", ",", "IOException", "{", "reset", "(", ")", ";", "char", "c", ";", "if", "(", "(", "c", "=", "stream", ".", "read", "(", ")", ")", "==", "'", "'", ")", "readTag", "(", ")", ";", "else", "readChars", "(", "c", ")", ";", "}" ]
Move forward to the next event.
[ "Move", "forward", "to", "the", "next", "event", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamReader.java#L92-L100
150,360
lkwg82/enforcer-rules
src/main/java/org/apache/maven/plugins/enforcer/EvaluateBeanshell.java
EvaluateBeanshell.evaluateCondition
protected boolean evaluateCondition( String script, Log log ) throws EnforcerRuleException { Boolean evaluation = Boolean.FALSE; try { evaluation = (Boolean) bsh.eval( script ); log.debug( "Echo evaluating : " + evaluation ); } catch ( EvalError ex ) { throw new EnforcerRuleException( "Couldn't evaluate condition: " + script, ex ); } return evaluation.booleanValue(); }
java
protected boolean evaluateCondition( String script, Log log ) throws EnforcerRuleException { Boolean evaluation = Boolean.FALSE; try { evaluation = (Boolean) bsh.eval( script ); log.debug( "Echo evaluating : " + evaluation ); } catch ( EvalError ex ) { throw new EnforcerRuleException( "Couldn't evaluate condition: " + script, ex ); } return evaluation.booleanValue(); }
[ "protected", "boolean", "evaluateCondition", "(", "String", "script", ",", "Log", "log", ")", "throws", "EnforcerRuleException", "{", "Boolean", "evaluation", "=", "Boolean", ".", "FALSE", ";", "try", "{", "evaluation", "=", "(", "Boolean", ")", "bsh", ".", "eval", "(", "script", ")", ";", "log", ".", "debug", "(", "\"Echo evaluating : \"", "+", "evaluation", ")", ";", "}", "catch", "(", "EvalError", "ex", ")", "{", "throw", "new", "EnforcerRuleException", "(", "\"Couldn't evaluate condition: \"", "+", "script", ",", "ex", ")", ";", "}", "return", "evaluation", ".", "booleanValue", "(", ")", ";", "}" ]
Evaluate expression using Beanshell. @param script the expression to be evaluated @param log the logger @return boolean the evaluation of the expression @throws EnforcerRuleException if the script could not be evaluated
[ "Evaluate", "expression", "using", "Beanshell", "." ]
fa2d309af7907b17fc8eaf386f8056d77b654749
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/EvaluateBeanshell.java#L103-L117
150,361
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/ModContainer.java
ModContainer.configurationSave
@Override public void configurationSave(Properties props) { ModConfigPanel configPanel = (ModConfigPanel)getConfigPanel(); props.setProperty(PROPERTY_PLAYER_FREQUENCY, configPanel.getPlayerSetUp_SampleRate().getSelectedItem().toString()); props.setProperty(PROPERTY_PLAYER_MSBUFFERSIZE, configPanel.getPlayerSetUp_BufferSize().getSelectedItem().toString()); props.setProperty(PROPERTY_PLAYER_BITSPERSAMPLE, configPanel.getPlayerSetUp_BitsPerSample().getSelectedItem().toString()); props.setProperty(PROPERTY_PLAYER_STEREO, configPanel.getPlayerSetUp_Channels().getSelectedItem().toString()); props.setProperty(PROPERTY_PLAYER_ISP, Integer.toString(configPanel.getPlayerSetUp_Interpolation().getSelectedIndex())); props.setProperty(PROPERTY_PLAYER_WIDESTEREOMIX, Boolean.toString(configPanel.getPlayerSetUp_WideStereoMix().isSelected())); props.setProperty(PROPERTY_PLAYER_NOISEREDUCTION, Boolean.toString(configPanel.getPlayerSetUp_NoiseReduction().isSelected())); props.setProperty(PROPERTY_PLAYER_MEGABASS, Boolean.toString(configPanel.getPlayerSetUp_MegaBass().isSelected())); props.setProperty(PROPERTY_PLAYER_NOLOOPS, Integer.toString(configPanel.getLoopValue())); }
java
@Override public void configurationSave(Properties props) { ModConfigPanel configPanel = (ModConfigPanel)getConfigPanel(); props.setProperty(PROPERTY_PLAYER_FREQUENCY, configPanel.getPlayerSetUp_SampleRate().getSelectedItem().toString()); props.setProperty(PROPERTY_PLAYER_MSBUFFERSIZE, configPanel.getPlayerSetUp_BufferSize().getSelectedItem().toString()); props.setProperty(PROPERTY_PLAYER_BITSPERSAMPLE, configPanel.getPlayerSetUp_BitsPerSample().getSelectedItem().toString()); props.setProperty(PROPERTY_PLAYER_STEREO, configPanel.getPlayerSetUp_Channels().getSelectedItem().toString()); props.setProperty(PROPERTY_PLAYER_ISP, Integer.toString(configPanel.getPlayerSetUp_Interpolation().getSelectedIndex())); props.setProperty(PROPERTY_PLAYER_WIDESTEREOMIX, Boolean.toString(configPanel.getPlayerSetUp_WideStereoMix().isSelected())); props.setProperty(PROPERTY_PLAYER_NOISEREDUCTION, Boolean.toString(configPanel.getPlayerSetUp_NoiseReduction().isSelected())); props.setProperty(PROPERTY_PLAYER_MEGABASS, Boolean.toString(configPanel.getPlayerSetUp_MegaBass().isSelected())); props.setProperty(PROPERTY_PLAYER_NOLOOPS, Integer.toString(configPanel.getLoopValue())); }
[ "@", "Override", "public", "void", "configurationSave", "(", "Properties", "props", ")", "{", "ModConfigPanel", "configPanel", "=", "(", "ModConfigPanel", ")", "getConfigPanel", "(", ")", ";", "props", ".", "setProperty", "(", "PROPERTY_PLAYER_FREQUENCY", ",", "configPanel", ".", "getPlayerSetUp_SampleRate", "(", ")", ".", "getSelectedItem", "(", ")", ".", "toString", "(", ")", ")", ";", "props", ".", "setProperty", "(", "PROPERTY_PLAYER_MSBUFFERSIZE", ",", "configPanel", ".", "getPlayerSetUp_BufferSize", "(", ")", ".", "getSelectedItem", "(", ")", ".", "toString", "(", ")", ")", ";", "props", ".", "setProperty", "(", "PROPERTY_PLAYER_BITSPERSAMPLE", ",", "configPanel", ".", "getPlayerSetUp_BitsPerSample", "(", ")", ".", "getSelectedItem", "(", ")", ".", "toString", "(", ")", ")", ";", "props", ".", "setProperty", "(", "PROPERTY_PLAYER_STEREO", ",", "configPanel", ".", "getPlayerSetUp_Channels", "(", ")", ".", "getSelectedItem", "(", ")", ".", "toString", "(", ")", ")", ";", "props", ".", "setProperty", "(", "PROPERTY_PLAYER_ISP", ",", "Integer", ".", "toString", "(", "configPanel", ".", "getPlayerSetUp_Interpolation", "(", ")", ".", "getSelectedIndex", "(", ")", ")", ")", ";", "props", ".", "setProperty", "(", "PROPERTY_PLAYER_WIDESTEREOMIX", ",", "Boolean", ".", "toString", "(", "configPanel", ".", "getPlayerSetUp_WideStereoMix", "(", ")", ".", "isSelected", "(", ")", ")", ")", ";", "props", ".", "setProperty", "(", "PROPERTY_PLAYER_NOISEREDUCTION", ",", "Boolean", ".", "toString", "(", "configPanel", ".", "getPlayerSetUp_NoiseReduction", "(", ")", ".", "isSelected", "(", ")", ")", ")", ";", "props", ".", "setProperty", "(", "PROPERTY_PLAYER_MEGABASS", ",", "Boolean", ".", "toString", "(", "configPanel", ".", "getPlayerSetUp_MegaBass", "(", ")", ".", "isSelected", "(", ")", ")", ")", ";", "props", ".", "setProperty", "(", "PROPERTY_PLAYER_NOLOOPS", ",", "Integer", ".", "toString", "(", "configPanel", ".", "getLoopValue", "(", ")", ")", ")", ";", "}" ]
Get the values from the gui and store them into the main Propertys @since 13.10.2007
[ "Get", "the", "values", "from", "the", "gui", "and", "store", "them", "into", "the", "main", "Propertys" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/ModContainer.java#L248-L261
150,362
jtrfp/javamod
src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java
WaveformGenerator.set_chip_model
public void set_chip_model(chip_model model) { if (model == chip_model.MOS6581) { wave__ST = Wave.wave6581__ST; wave_P_T = Wave.wave6581_P_T; wave_PS_ = Wave.wave6581_PS_; wave_PST = Wave.wave6581_PST; } else { wave__ST = Wave.wave8580__ST; wave_P_T = Wave.wave8580_P_T; wave_PS_ = Wave.wave8580_PS_; wave_PST = Wave.wave8580_PST; } }
java
public void set_chip_model(chip_model model) { if (model == chip_model.MOS6581) { wave__ST = Wave.wave6581__ST; wave_P_T = Wave.wave6581_P_T; wave_PS_ = Wave.wave6581_PS_; wave_PST = Wave.wave6581_PST; } else { wave__ST = Wave.wave8580__ST; wave_P_T = Wave.wave8580_P_T; wave_PS_ = Wave.wave8580_PS_; wave_PST = Wave.wave8580_PST; } }
[ "public", "void", "set_chip_model", "(", "chip_model", "model", ")", "{", "if", "(", "model", "==", "chip_model", ".", "MOS6581", ")", "{", "wave__ST", "=", "Wave", ".", "wave6581__ST", ";", "wave_P_T", "=", "Wave", ".", "wave6581_P_T", ";", "wave_PS_", "=", "Wave", ".", "wave6581_PS_", ";", "wave_PST", "=", "Wave", ".", "wave6581_PST", ";", "}", "else", "{", "wave__ST", "=", "Wave", ".", "wave8580__ST", ";", "wave_P_T", "=", "Wave", ".", "wave8580_P_T", ";", "wave_PS_", "=", "Wave", ".", "wave8580_PS_", ";", "wave_PST", "=", "Wave", ".", "wave8580_PST", ";", "}", "}" ]
Set chip model. @param model chip model
[ "Set", "chip", "model", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java#L125-L137
150,363
jtrfp/javamod
src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java
WaveformGenerator.writeCONTROL_REG
public void writeCONTROL_REG(int /* reg8 */control) { waveform = (control >> 4) & 0x0f; ring_mod = control & 0x04; sync = control & 0x02; int /* reg8 */test_next = control & 0x08; if (ANTTI_LANKILA_PATCH) { /* * SounDemoN found out that test bit can be used to control the * noise register. Hear the result in Bojojoing.sid. */ // testbit set. invert bit 19 and write it to bit 1 if (test_next != 0 && test == 0) { accumulator = 0; int /* reg24 */bit19 = (shift_register >> 19) & 1; shift_register = (shift_register & 0x7ffffd) | ((bit19 ^ 1) << 1); } // Test bit cleared. // The accumulator starts counting, and the shift register is reset // to // the value 0x7ffff8. // NB! The shift register will not actually be set to this exact // value // if the // shift register bits have not had time to fade to zero. // This is not modeled. else if (test_next == 0 && test > 0) { int /* reg24 */bit0 = ((shift_register >> 22) ^ (shift_register >> 17)) & 0x1; shift_register <<= 1; shift_register &= 0x7fffff; shift_register |= bit0; } // clear output bits of shift register if noise and other waveforms // are selected simultaneously if (waveform > 8) { shift_register &= 0x7fffff ^ (1 << 22) ^ (1 << 20) ^ (1 << 16) ^ (1 << 13) ^ (1 << 11) ^ (1 << 7) ^ (1 << 4) ^ (1 << 2); } } else { // Test bit set. // The accumulator and the shift register are both cleared. // NB! The shift register is not really cleared immediately. It // seems // like the individual bits in the shift register start to fade down // towards zero when test is set. All bits reach zero within // approximately $2000 - $4000 cycles. // This is not modeled. There should fortunately be little audible // output from this peculiar behavior. if (test_next != 0) { accumulator = 0; shift_register = 0; } // Test bit cleared. // The accumulator starts counting, and the shift register is reset // to // the value 0x7ffff8. // NB! The shift register will not actually be set to this exact // value // if the // shift register bits have not had time to fade to zero. // This is not modeled. else if (test != 0) { shift_register = 0x7ffff8; } } test = test_next; // The gate bit is handled by the EnvelopeGenerator. }
java
public void writeCONTROL_REG(int /* reg8 */control) { waveform = (control >> 4) & 0x0f; ring_mod = control & 0x04; sync = control & 0x02; int /* reg8 */test_next = control & 0x08; if (ANTTI_LANKILA_PATCH) { /* * SounDemoN found out that test bit can be used to control the * noise register. Hear the result in Bojojoing.sid. */ // testbit set. invert bit 19 and write it to bit 1 if (test_next != 0 && test == 0) { accumulator = 0; int /* reg24 */bit19 = (shift_register >> 19) & 1; shift_register = (shift_register & 0x7ffffd) | ((bit19 ^ 1) << 1); } // Test bit cleared. // The accumulator starts counting, and the shift register is reset // to // the value 0x7ffff8. // NB! The shift register will not actually be set to this exact // value // if the // shift register bits have not had time to fade to zero. // This is not modeled. else if (test_next == 0 && test > 0) { int /* reg24 */bit0 = ((shift_register >> 22) ^ (shift_register >> 17)) & 0x1; shift_register <<= 1; shift_register &= 0x7fffff; shift_register |= bit0; } // clear output bits of shift register if noise and other waveforms // are selected simultaneously if (waveform > 8) { shift_register &= 0x7fffff ^ (1 << 22) ^ (1 << 20) ^ (1 << 16) ^ (1 << 13) ^ (1 << 11) ^ (1 << 7) ^ (1 << 4) ^ (1 << 2); } } else { // Test bit set. // The accumulator and the shift register are both cleared. // NB! The shift register is not really cleared immediately. It // seems // like the individual bits in the shift register start to fade down // towards zero when test is set. All bits reach zero within // approximately $2000 - $4000 cycles. // This is not modeled. There should fortunately be little audible // output from this peculiar behavior. if (test_next != 0) { accumulator = 0; shift_register = 0; } // Test bit cleared. // The accumulator starts counting, and the shift register is reset // to // the value 0x7ffff8. // NB! The shift register will not actually be set to this exact // value // if the // shift register bits have not had time to fade to zero. // This is not modeled. else if (test != 0) { shift_register = 0x7ffff8; } } test = test_next; // The gate bit is handled by the EnvelopeGenerator. }
[ "public", "void", "writeCONTROL_REG", "(", "int", "/* reg8 */", "control", ")", "{", "waveform", "=", "(", "control", ">>", "4", ")", "&", "0x0f", ";", "ring_mod", "=", "control", "&", "0x04", ";", "sync", "=", "control", "&", "0x02", ";", "int", "/* reg8 */", "test_next", "=", "control", "&", "0x08", ";", "if", "(", "ANTTI_LANKILA_PATCH", ")", "{", "/*\n\t\t\t * SounDemoN found out that test bit can be used to control the\n\t\t\t * noise register. Hear the result in Bojojoing.sid.\n\t\t\t */", "// testbit set. invert bit 19 and write it to bit 1", "if", "(", "test_next", "!=", "0", "&&", "test", "==", "0", ")", "{", "accumulator", "=", "0", ";", "int", "/* reg24 */", "bit19", "=", "(", "shift_register", ">>", "19", ")", "&", "1", ";", "shift_register", "=", "(", "shift_register", "&", "0x7ffffd", ")", "|", "(", "(", "bit19", "^", "1", ")", "<<", "1", ")", ";", "}", "// Test bit cleared.", "// The accumulator starts counting, and the shift register is reset", "// to", "// the value 0x7ffff8.", "// NB! The shift register will not actually be set to this exact", "// value", "// if the", "// shift register bits have not had time to fade to zero.", "// This is not modeled.", "else", "if", "(", "test_next", "==", "0", "&&", "test", ">", "0", ")", "{", "int", "/* reg24 */", "bit0", "=", "(", "(", "shift_register", ">>", "22", ")", "^", "(", "shift_register", ">>", "17", ")", ")", "&", "0x1", ";", "shift_register", "<<=", "1", ";", "shift_register", "&=", "0x7fffff", ";", "shift_register", "|=", "bit0", ";", "}", "// clear output bits of shift register if noise and other waveforms", "// are selected simultaneously", "if", "(", "waveform", ">", "8", ")", "{", "shift_register", "&=", "0x7fffff", "^", "(", "1", "<<", "22", ")", "^", "(", "1", "<<", "20", ")", "^", "(", "1", "<<", "16", ")", "^", "(", "1", "<<", "13", ")", "^", "(", "1", "<<", "11", ")", "^", "(", "1", "<<", "7", ")", "^", "(", "1", "<<", "4", ")", "^", "(", "1", "<<", "2", ")", ";", "}", "}", "else", "{", "// Test bit set.", "// The accumulator and the shift register are both cleared.", "// NB! The shift register is not really cleared immediately. It", "// seems", "// like the individual bits in the shift register start to fade down", "// towards zero when test is set. All bits reach zero within", "// approximately $2000 - $4000 cycles.", "// This is not modeled. There should fortunately be little audible", "// output from this peculiar behavior.", "if", "(", "test_next", "!=", "0", ")", "{", "accumulator", "=", "0", ";", "shift_register", "=", "0", ";", "}", "// Test bit cleared.", "// The accumulator starts counting, and the shift register is reset", "// to", "// the value 0x7ffff8.", "// NB! The shift register will not actually be set to this exact", "// value", "// if the", "// shift register bits have not had time to fade to zero.", "// This is not modeled.", "else", "if", "(", "test", "!=", "0", ")", "{", "shift_register", "=", "0x7ffff8", ";", "}", "}", "test", "=", "test_next", ";", "// The gate bit is handled by the EnvelopeGenerator.", "}" ]
Register functions. @param control
[ "Register", "functions", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java#L180-L253
150,364
jtrfp/javamod
src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java
WaveformGenerator.reset
public void reset() { accumulator = 0; if (ANTTI_LANKILA_PATCH) shift_register = 0x7ffffc; else shift_register = 0x7ffff8; freq = 0; pw = 0; test = 0; ring_mod = 0; sync = 0; msb_rising = false; }
java
public void reset() { accumulator = 0; if (ANTTI_LANKILA_PATCH) shift_register = 0x7ffffc; else shift_register = 0x7ffff8; freq = 0; pw = 0; test = 0; ring_mod = 0; sync = 0; msb_rising = false; }
[ "public", "void", "reset", "(", ")", "{", "accumulator", "=", "0", ";", "if", "(", "ANTTI_LANKILA_PATCH", ")", "shift_register", "=", "0x7ffffc", ";", "else", "shift_register", "=", "0x7ffff8", ";", "freq", "=", "0", ";", "pw", "=", "0", ";", "test", "=", "0", ";", "ring_mod", "=", "0", ";", "sync", "=", "0", ";", "msb_rising", "=", "false", ";", "}" ]
SID reset.
[ "SID", "reset", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java#L262-L276
150,365
jtrfp/javamod
src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java
WaveformGenerator.clock
public void clock() { // No operation if test bit is set. if (test != 0) { return; } int /* reg24 */accumulator_prev = accumulator; // Calculate new accumulator value; accumulator += freq; accumulator &= 0xffffff; // Check whether the MSB is set high. This is used for synchronization. msb_rising = !((accumulator_prev & 0x800000) != 0) && ((accumulator & 0x800000) != 0); // Shift noise register once for each time accumulator bit 19 is set // high. if (!((accumulator_prev & 0x080000) != 0) && ((accumulator & 0x080000) != 0)) { int /* reg24 */bit0 = ((shift_register >> 22) ^ (shift_register >> 17)) & 0x1; shift_register <<= 1; shift_register &= 0x7fffff; shift_register |= bit0; } }
java
public void clock() { // No operation if test bit is set. if (test != 0) { return; } int /* reg24 */accumulator_prev = accumulator; // Calculate new accumulator value; accumulator += freq; accumulator &= 0xffffff; // Check whether the MSB is set high. This is used for synchronization. msb_rising = !((accumulator_prev & 0x800000) != 0) && ((accumulator & 0x800000) != 0); // Shift noise register once for each time accumulator bit 19 is set // high. if (!((accumulator_prev & 0x080000) != 0) && ((accumulator & 0x080000) != 0)) { int /* reg24 */bit0 = ((shift_register >> 22) ^ (shift_register >> 17)) & 0x1; shift_register <<= 1; shift_register &= 0x7fffff; shift_register |= bit0; } }
[ "public", "void", "clock", "(", ")", "{", "// No operation if test bit is set.", "if", "(", "test", "!=", "0", ")", "{", "return", ";", "}", "int", "/* reg24 */", "accumulator_prev", "=", "accumulator", ";", "// Calculate new accumulator value;", "accumulator", "+=", "freq", ";", "accumulator", "&=", "0xffffff", ";", "// Check whether the MSB is set high. This is used for synchronization.", "msb_rising", "=", "!", "(", "(", "accumulator_prev", "&", "0x800000", ")", "!=", "0", ")", "&&", "(", "(", "accumulator", "&", "0x800000", ")", "!=", "0", ")", ";", "// Shift noise register once for each time accumulator bit 19 is set", "// high.", "if", "(", "!", "(", "(", "accumulator_prev", "&", "0x080000", ")", "!=", "0", ")", "&&", "(", "(", "accumulator", "&", "0x080000", ")", "!=", "0", ")", ")", "{", "int", "/* reg24 */", "bit0", "=", "(", "(", "shift_register", ">>", "22", ")", "^", "(", "shift_register", ">>", "17", ")", ")", "&", "0x1", ";", "shift_register", "<<=", "1", ";", "shift_register", "&=", "0x7fffff", ";", "shift_register", "|=", "bit0", ";", "}", "}" ]
SID clocking - 1 cycle.
[ "SID", "clocking", "-", "1", "cycle", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java#L287-L312
150,366
jtrfp/javamod
src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java
WaveformGenerator.clock
public void clock(int/* cycle_count */delta_t) { // No operation if test bit is set. if (test != 0) { return; } int /* reg24 */accumulator_prev = accumulator; // Calculate new accumulator value; int /* reg24 */delta_accumulator = delta_t * freq; accumulator += delta_accumulator; accumulator &= 0xffffff; // Check whether the MSB is set high. This is used for synchronization. msb_rising = !((accumulator_prev & 0x800000) != 0) && ((accumulator & 0x800000) != 0); // Shift noise register once for each time accumulator bit 19 is set // high. // Bit 19 is set high each time 2^20 (0x100000) is added to the // accumulator. int /* reg24 */shift_period = 0x100000; while (delta_accumulator != 0) { if (delta_accumulator < shift_period) { shift_period = delta_accumulator; // Determine whether bit 19 is set on the last period. // NB! Requires two's complement integer. if (shift_period <= 0x080000) { // Check for flip from 0 to 1. if ((((accumulator - shift_period) & 0x080000) != 0) || !((accumulator & 0x080000) != 0)) { break; } } else { // Check for flip from 0 (to 1 or via 1 to 0) or from 1 via // 0 to 1. if ((((accumulator - shift_period) & 0x080000) != 0) && !((accumulator & 0x080000) != 0)) { break; } } } // Shift the noise/random register. // NB! The shift is actually delayed 2 cycles, this is not modeled. int /* reg24 */bit0 = ((shift_register >> 22) ^ (shift_register >> 17)) & 0x1; shift_register <<= 1; shift_register &= 0x7fffff; shift_register |= bit0; delta_accumulator -= shift_period; } }
java
public void clock(int/* cycle_count */delta_t) { // No operation if test bit is set. if (test != 0) { return; } int /* reg24 */accumulator_prev = accumulator; // Calculate new accumulator value; int /* reg24 */delta_accumulator = delta_t * freq; accumulator += delta_accumulator; accumulator &= 0xffffff; // Check whether the MSB is set high. This is used for synchronization. msb_rising = !((accumulator_prev & 0x800000) != 0) && ((accumulator & 0x800000) != 0); // Shift noise register once for each time accumulator bit 19 is set // high. // Bit 19 is set high each time 2^20 (0x100000) is added to the // accumulator. int /* reg24 */shift_period = 0x100000; while (delta_accumulator != 0) { if (delta_accumulator < shift_period) { shift_period = delta_accumulator; // Determine whether bit 19 is set on the last period. // NB! Requires two's complement integer. if (shift_period <= 0x080000) { // Check for flip from 0 to 1. if ((((accumulator - shift_period) & 0x080000) != 0) || !((accumulator & 0x080000) != 0)) { break; } } else { // Check for flip from 0 (to 1 or via 1 to 0) or from 1 via // 0 to 1. if ((((accumulator - shift_period) & 0x080000) != 0) && !((accumulator & 0x080000) != 0)) { break; } } } // Shift the noise/random register. // NB! The shift is actually delayed 2 cycles, this is not modeled. int /* reg24 */bit0 = ((shift_register >> 22) ^ (shift_register >> 17)) & 0x1; shift_register <<= 1; shift_register &= 0x7fffff; shift_register |= bit0; delta_accumulator -= shift_period; } }
[ "public", "void", "clock", "(", "int", "/* cycle_count */", "delta_t", ")", "{", "// No operation if test bit is set.", "if", "(", "test", "!=", "0", ")", "{", "return", ";", "}", "int", "/* reg24 */", "accumulator_prev", "=", "accumulator", ";", "// Calculate new accumulator value;", "int", "/* reg24 */", "delta_accumulator", "=", "delta_t", "*", "freq", ";", "accumulator", "+=", "delta_accumulator", ";", "accumulator", "&=", "0xffffff", ";", "// Check whether the MSB is set high. This is used for synchronization.", "msb_rising", "=", "!", "(", "(", "accumulator_prev", "&", "0x800000", ")", "!=", "0", ")", "&&", "(", "(", "accumulator", "&", "0x800000", ")", "!=", "0", ")", ";", "// Shift noise register once for each time accumulator bit 19 is set", "// high.", "// Bit 19 is set high each time 2^20 (0x100000) is added to the", "// accumulator.", "int", "/* reg24 */", "shift_period", "=", "0x100000", ";", "while", "(", "delta_accumulator", "!=", "0", ")", "{", "if", "(", "delta_accumulator", "<", "shift_period", ")", "{", "shift_period", "=", "delta_accumulator", ";", "// Determine whether bit 19 is set on the last period.", "// NB! Requires two's complement integer.", "if", "(", "shift_period", "<=", "0x080000", ")", "{", "// Check for flip from 0 to 1.", "if", "(", "(", "(", "(", "accumulator", "-", "shift_period", ")", "&", "0x080000", ")", "!=", "0", ")", "||", "!", "(", "(", "accumulator", "&", "0x080000", ")", "!=", "0", ")", ")", "{", "break", ";", "}", "}", "else", "{", "// Check for flip from 0 (to 1 or via 1 to 0) or from 1 via", "// 0 to 1.", "if", "(", "(", "(", "(", "accumulator", "-", "shift_period", ")", "&", "0x080000", ")", "!=", "0", ")", "&&", "!", "(", "(", "accumulator", "&", "0x080000", ")", "!=", "0", ")", ")", "{", "break", ";", "}", "}", "}", "// Shift the noise/random register.", "// NB! The shift is actually delayed 2 cycles, this is not modeled.", "int", "/* reg24 */", "bit0", "=", "(", "(", "shift_register", ">>", "22", ")", "^", "(", "shift_register", ">>", "17", ")", ")", "&", "0x1", ";", "shift_register", "<<=", "1", ";", "shift_register", "&=", "0x7fffff", ";", "shift_register", "|=", "bit0", ";", "delta_accumulator", "-=", "shift_period", ";", "}", "}" ]
SID clocking - delta_t cycles.
[ "SID", "clocking", "-", "delta_t", "cycles", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/sidplay/resid_builder/resid/WaveformGenerator.java#L317-L370
150,367
mattprovis/fluentmatcher
fluentmatcher-core/src/main/java/com/mattprovis/fluentmatcher/FluentMatcherGenerator.java
FluentMatcherGenerator.filterRelevantFields
private void filterRelevantFields(List<Field> fields) { Iterator<Field> fieldIterator = fields.iterator(); while (fieldIterator.hasNext()) { Field field = fieldIterator.next(); if (Modifier.isStatic(field.getModifiers())) { fieldIterator.remove(); } } }
java
private void filterRelevantFields(List<Field> fields) { Iterator<Field> fieldIterator = fields.iterator(); while (fieldIterator.hasNext()) { Field field = fieldIterator.next(); if (Modifier.isStatic(field.getModifiers())) { fieldIterator.remove(); } } }
[ "private", "void", "filterRelevantFields", "(", "List", "<", "Field", ">", "fields", ")", "{", "Iterator", "<", "Field", ">", "fieldIterator", "=", "fields", ".", "iterator", "(", ")", ";", "while", "(", "fieldIterator", ".", "hasNext", "(", ")", ")", "{", "Field", "field", "=", "fieldIterator", ".", "next", "(", ")", ";", "if", "(", "Modifier", ".", "isStatic", "(", "field", ".", "getModifiers", "(", ")", ")", ")", "{", "fieldIterator", ".", "remove", "(", ")", ";", "}", "}", "}" ]
Filters out fields for which we don't want matcher methods created. This currently only excludes static fields. @param fields
[ "Filters", "out", "fields", "for", "which", "we", "don", "t", "want", "matcher", "methods", "created", ".", "This", "currently", "only", "excludes", "static", "fields", "." ]
49dbe5d995be1685483561f9f2b6b6cfe138a1f9
https://github.com/mattprovis/fluentmatcher/blob/49dbe5d995be1685483561f9f2b6b6cfe138a1f9/fluentmatcher-core/src/main/java/com/mattprovis/fluentmatcher/FluentMatcherGenerator.java#L113-L122
150,368
jtrfp/javamod
src/main/java/de/quippy/jflac/util/ByteData.java
ByteData.setLen
public void setLen(int len) { if (len > data.length) { len = data.length; } this.len = len; }
java
public void setLen(int len) { if (len > data.length) { len = data.length; } this.len = len; }
[ "public", "void", "setLen", "(", "int", "len", ")", "{", "if", "(", "len", ">", "data", ".", "length", ")", "{", "len", "=", "data", ".", "length", ";", "}", "this", ".", "len", "=", "len", ";", "}" ]
Set the length of this ByteData object without re-allocating the underlying array. It is not possible to set the length larger than the underlying byte array.
[ "Set", "the", "length", "of", "this", "ByteData", "object", "without", "re", "-", "allocating", "the", "underlying", "array", ".", "It", "is", "not", "possible", "to", "set", "the", "length", "larger", "than", "the", "underlying", "byte", "array", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/util/ByteData.java#L81-L86
150,369
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java
BasicModMixer.initializeMixer
public void initializeMixer() { // to be a bit faster, we do some precalculations calculateGlobalTuning(); // get Mod specific values frequencyTableType = mod.getFrequencyTable(); currentTempo = mod.getTempo(); currentBPM = mod.getBPMSpeed(); globalVolume = mod.getBaseVolume(); globalVolumSlideValue = 0; useFastSlides = mod.doFastSlides(); samplePerTicks = calculateSamplesPerTick(); currentTick = currentArrangement = currentRow = patternDelayCount = patternTicksDelayCount = 0; currentArrangement = 0; currentPatternIndex = mod.getArrangement()[currentArrangement]; currentPattern = mod.getPatternContainer().getPattern(currentPatternIndex); patternJumpPatternIndex = patternBreakRowIndex = patternBreakJumpPatternIndex = -1; modFinished = false; calculateVolRampLen(); // Reset all rowes played to false mod.resetLoopRecognition(); // Reset FadeOut doFadeOut = false; fadeOutFac = 8; fadeOutValue = 1<<fadeOutFac; fadeOutSub = 0x01; final int nChannels = mod.getNChannels(); // Now initialize every used channel for (int c=0; c<maxChannels; c++) { channelMemory[c] = new ChannelMemory(); if (c<nChannels) { final ChannelMemory aktMemo = channelMemory[c]; aktMemo.panning = mod.getPanningValue(c); aktMemo.channelVolume = mod.getChannelVolume(c); initializeMixer(c, aktMemo); } } }
java
public void initializeMixer() { // to be a bit faster, we do some precalculations calculateGlobalTuning(); // get Mod specific values frequencyTableType = mod.getFrequencyTable(); currentTempo = mod.getTempo(); currentBPM = mod.getBPMSpeed(); globalVolume = mod.getBaseVolume(); globalVolumSlideValue = 0; useFastSlides = mod.doFastSlides(); samplePerTicks = calculateSamplesPerTick(); currentTick = currentArrangement = currentRow = patternDelayCount = patternTicksDelayCount = 0; currentArrangement = 0; currentPatternIndex = mod.getArrangement()[currentArrangement]; currentPattern = mod.getPatternContainer().getPattern(currentPatternIndex); patternJumpPatternIndex = patternBreakRowIndex = patternBreakJumpPatternIndex = -1; modFinished = false; calculateVolRampLen(); // Reset all rowes played to false mod.resetLoopRecognition(); // Reset FadeOut doFadeOut = false; fadeOutFac = 8; fadeOutValue = 1<<fadeOutFac; fadeOutSub = 0x01; final int nChannels = mod.getNChannels(); // Now initialize every used channel for (int c=0; c<maxChannels; c++) { channelMemory[c] = new ChannelMemory(); if (c<nChannels) { final ChannelMemory aktMemo = channelMemory[c]; aktMemo.panning = mod.getPanningValue(c); aktMemo.channelVolume = mod.getChannelVolume(c); initializeMixer(c, aktMemo); } } }
[ "public", "void", "initializeMixer", "(", ")", "{", "// to be a bit faster, we do some precalculations", "calculateGlobalTuning", "(", ")", ";", "// get Mod specific values", "frequencyTableType", "=", "mod", ".", "getFrequencyTable", "(", ")", ";", "currentTempo", "=", "mod", ".", "getTempo", "(", ")", ";", "currentBPM", "=", "mod", ".", "getBPMSpeed", "(", ")", ";", "globalVolume", "=", "mod", ".", "getBaseVolume", "(", ")", ";", "globalVolumSlideValue", "=", "0", ";", "useFastSlides", "=", "mod", ".", "doFastSlides", "(", ")", ";", "samplePerTicks", "=", "calculateSamplesPerTick", "(", ")", ";", "currentTick", "=", "currentArrangement", "=", "currentRow", "=", "patternDelayCount", "=", "patternTicksDelayCount", "=", "0", ";", "currentArrangement", "=", "0", ";", "currentPatternIndex", "=", "mod", ".", "getArrangement", "(", ")", "[", "currentArrangement", "]", ";", "currentPattern", "=", "mod", ".", "getPatternContainer", "(", ")", ".", "getPattern", "(", "currentPatternIndex", ")", ";", "patternJumpPatternIndex", "=", "patternBreakRowIndex", "=", "patternBreakJumpPatternIndex", "=", "-", "1", ";", "modFinished", "=", "false", ";", "calculateVolRampLen", "(", ")", ";", "// Reset all rowes played to false", "mod", ".", "resetLoopRecognition", "(", ")", ";", "// Reset FadeOut", "doFadeOut", "=", "false", ";", "fadeOutFac", "=", "8", ";", "fadeOutValue", "=", "1", "<<", "fadeOutFac", ";", "fadeOutSub", "=", "0x01", ";", "final", "int", "nChannels", "=", "mod", ".", "getNChannels", "(", ")", ";", "// Now initialize every used channel", "for", "(", "int", "c", "=", "0", ";", "c", "<", "maxChannels", ";", "c", "++", ")", "{", "channelMemory", "[", "c", "]", "=", "new", "ChannelMemory", "(", ")", ";", "if", "(", "c", "<", "nChannels", ")", "{", "final", "ChannelMemory", "aktMemo", "=", "channelMemory", "[", "c", "]", ";", "aktMemo", ".", "panning", "=", "mod", ".", "getPanningValue", "(", "c", ")", ";", "aktMemo", ".", "channelVolume", "=", "mod", ".", "getChannelVolume", "(", "c", ")", ";", "initializeMixer", "(", "c", ",", "aktMemo", ")", ";", "}", "}", "}" ]
Call this first!
[ "Call", "this", "first!" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L289-L338
150,370
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java
BasicModMixer.cutOffToFrequency
protected long cutOffToFrequency(long cutOff, int flt_modifier, boolean isExFilterRange) { double fac = (isExFilterRange)?(20.0d*512.0d):(24.0d*512.0d); double fc = 110.0d * Math.pow(2.0d, 0.25d + ((double)(cutOff*(flt_modifier+256))) / fac); long freq = (long)fc; if (freq<120) return 120; if (freq>20000) return 20000; if ((freq<<1) > sampleRate) return ((long)sampleRate)>>1; return freq; }
java
protected long cutOffToFrequency(long cutOff, int flt_modifier, boolean isExFilterRange) { double fac = (isExFilterRange)?(20.0d*512.0d):(24.0d*512.0d); double fc = 110.0d * Math.pow(2.0d, 0.25d + ((double)(cutOff*(flt_modifier+256))) / fac); long freq = (long)fc; if (freq<120) return 120; if (freq>20000) return 20000; if ((freq<<1) > sampleRate) return ((long)sampleRate)>>1; return freq; }
[ "protected", "long", "cutOffToFrequency", "(", "long", "cutOff", ",", "int", "flt_modifier", ",", "boolean", "isExFilterRange", ")", "{", "double", "fac", "=", "(", "isExFilterRange", ")", "?", "(", "20.0d", "*", "512.0d", ")", ":", "(", "24.0d", "*", "512.0d", ")", ";", "double", "fc", "=", "110.0d", "*", "Math", ".", "pow", "(", "2.0d", ",", "0.25d", "+", "(", "(", "double", ")", "(", "cutOff", "*", "(", "flt_modifier", "+", "256", ")", ")", ")", "/", "fac", ")", ";", "long", "freq", "=", "(", "long", ")", "fc", ";", "if", "(", "freq", "<", "120", ")", "return", "120", ";", "if", "(", "freq", ">", "20000", ")", "return", "20000", ";", "if", "(", "(", "freq", "<<", "1", ")", ">", "sampleRate", ")", "return", "(", "(", "long", ")", "sampleRate", ")", ">>", "1", ";", "return", "freq", ";", "}" ]
calc the cut off @param cutOff @param flt_modifier @param isExFilterRange @return
[ "calc", "the", "cut", "off" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L495-L504
150,371
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java
BasicModMixer.setupChannelFilter
protected void setupChannelFilter(ChannelMemory aktMemo, boolean bReset, int flt_modifier) { double cutOff = (double)((aktMemo.nCutOff + aktMemo.nCutSwing)&0x7F); double resonance = (double)((aktMemo.nResonance + aktMemo.nResSwing)&0x7F); double fc = cutOffToFrequency((long)cutOff, flt_modifier, (mod.getSongFlags()&Helpers.SONG_EXFILTERRANGE)!=0); fc *= 2.0d * 3.14159265358 / ((double)sampleRate); double dmpfac = Math.pow(10.0d, -((24.0d / 128.0d) * resonance) / 20.0d); double d = (1.0d - 2.0d * dmpfac) * fc; if (d > 2.0d) d = 2.0d; d = (2.0d * dmpfac - d) / fc; double e = Math.pow(1.0d / fc, 2.0d); double fg = 1.0d / (1.0d + d + e); double fg1 = -e * fg; double fg0 = 1.0d - fg - fg1; switch(aktMemo.nFilterMode) { case Helpers.FLTMODE_HIGHPASS: aktMemo.nFilter_A0 = (long)((1.0d-fg) * Helpers.FILTER_PRECISION); aktMemo.nFilter_B0 = (long)(fg0 * Helpers.FILTER_PRECISION); aktMemo.nFilter_B1 = (long)(fg1 * Helpers.FILTER_PRECISION); aktMemo.nFilter_HP = -1; break; default: aktMemo.nFilter_A0 = (long)(fg * Helpers.FILTER_PRECISION); aktMemo.nFilter_B0 = (long)(fg0 * Helpers.FILTER_PRECISION); aktMemo.nFilter_B1 = (long)(fg1 * Helpers.FILTER_PRECISION); aktMemo.nFilter_HP = 0; break; } if (bReset) aktMemo.nFilter_Y1 = aktMemo.nFilter_Y2 = 0; aktMemo.filterOn = true; }
java
protected void setupChannelFilter(ChannelMemory aktMemo, boolean bReset, int flt_modifier) { double cutOff = (double)((aktMemo.nCutOff + aktMemo.nCutSwing)&0x7F); double resonance = (double)((aktMemo.nResonance + aktMemo.nResSwing)&0x7F); double fc = cutOffToFrequency((long)cutOff, flt_modifier, (mod.getSongFlags()&Helpers.SONG_EXFILTERRANGE)!=0); fc *= 2.0d * 3.14159265358 / ((double)sampleRate); double dmpfac = Math.pow(10.0d, -((24.0d / 128.0d) * resonance) / 20.0d); double d = (1.0d - 2.0d * dmpfac) * fc; if (d > 2.0d) d = 2.0d; d = (2.0d * dmpfac - d) / fc; double e = Math.pow(1.0d / fc, 2.0d); double fg = 1.0d / (1.0d + d + e); double fg1 = -e * fg; double fg0 = 1.0d - fg - fg1; switch(aktMemo.nFilterMode) { case Helpers.FLTMODE_HIGHPASS: aktMemo.nFilter_A0 = (long)((1.0d-fg) * Helpers.FILTER_PRECISION); aktMemo.nFilter_B0 = (long)(fg0 * Helpers.FILTER_PRECISION); aktMemo.nFilter_B1 = (long)(fg1 * Helpers.FILTER_PRECISION); aktMemo.nFilter_HP = -1; break; default: aktMemo.nFilter_A0 = (long)(fg * Helpers.FILTER_PRECISION); aktMemo.nFilter_B0 = (long)(fg0 * Helpers.FILTER_PRECISION); aktMemo.nFilter_B1 = (long)(fg1 * Helpers.FILTER_PRECISION); aktMemo.nFilter_HP = 0; break; } if (bReset) aktMemo.nFilter_Y1 = aktMemo.nFilter_Y2 = 0; aktMemo.filterOn = true; }
[ "protected", "void", "setupChannelFilter", "(", "ChannelMemory", "aktMemo", ",", "boolean", "bReset", ",", "int", "flt_modifier", ")", "{", "double", "cutOff", "=", "(", "double", ")", "(", "(", "aktMemo", ".", "nCutOff", "+", "aktMemo", ".", "nCutSwing", ")", "&", "0x7F", ")", ";", "double", "resonance", "=", "(", "double", ")", "(", "(", "aktMemo", ".", "nResonance", "+", "aktMemo", ".", "nResSwing", ")", "&", "0x7F", ")", ";", "double", "fc", "=", "cutOffToFrequency", "(", "(", "long", ")", "cutOff", ",", "flt_modifier", ",", "(", "mod", ".", "getSongFlags", "(", ")", "&", "Helpers", ".", "SONG_EXFILTERRANGE", ")", "!=", "0", ")", ";", "fc", "*=", "2.0d", "*", "3.14159265358", "/", "(", "(", "double", ")", "sampleRate", ")", ";", "double", "dmpfac", "=", "Math", ".", "pow", "(", "10.0d", ",", "-", "(", "(", "24.0d", "/", "128.0d", ")", "*", "resonance", ")", "/", "20.0d", ")", ";", "double", "d", "=", "(", "1.0d", "-", "2.0d", "*", "dmpfac", ")", "*", "fc", ";", "if", "(", "d", ">", "2.0d", ")", "d", "=", "2.0d", ";", "d", "=", "(", "2.0d", "*", "dmpfac", "-", "d", ")", "/", "fc", ";", "double", "e", "=", "Math", ".", "pow", "(", "1.0d", "/", "fc", ",", "2.0d", ")", ";", "double", "fg", "=", "1.0d", "/", "(", "1.0d", "+", "d", "+", "e", ")", ";", "double", "fg1", "=", "-", "e", "*", "fg", ";", "double", "fg0", "=", "1.0d", "-", "fg", "-", "fg1", ";", "switch", "(", "aktMemo", ".", "nFilterMode", ")", "{", "case", "Helpers", ".", "FLTMODE_HIGHPASS", ":", "aktMemo", ".", "nFilter_A0", "=", "(", "long", ")", "(", "(", "1.0d", "-", "fg", ")", "*", "Helpers", ".", "FILTER_PRECISION", ")", ";", "aktMemo", ".", "nFilter_B0", "=", "(", "long", ")", "(", "fg0", "*", "Helpers", ".", "FILTER_PRECISION", ")", ";", "aktMemo", ".", "nFilter_B1", "=", "(", "long", ")", "(", "fg1", "*", "Helpers", ".", "FILTER_PRECISION", ")", ";", "aktMemo", ".", "nFilter_HP", "=", "-", "1", ";", "break", ";", "default", ":", "aktMemo", ".", "nFilter_A0", "=", "(", "long", ")", "(", "fg", "*", "Helpers", ".", "FILTER_PRECISION", ")", ";", "aktMemo", ".", "nFilter_B0", "=", "(", "long", ")", "(", "fg0", "*", "Helpers", ".", "FILTER_PRECISION", ")", ";", "aktMemo", ".", "nFilter_B1", "=", "(", "long", ")", "(", "fg1", "*", "Helpers", ".", "FILTER_PRECISION", ")", ";", "aktMemo", ".", "nFilter_HP", "=", "0", ";", "break", ";", "}", "if", "(", "bReset", ")", "aktMemo", ".", "nFilter_Y1", "=", "aktMemo", ".", "nFilter_Y2", "=", "0", ";", "aktMemo", ".", "filterOn", "=", "true", ";", "}" ]
Simple 2-poles resonant filter @since 31.03.2010 @param aktMemo @param bReset @param flt_modifier
[ "Simple", "2", "-", "poles", "resonant", "filter" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L512-L550
150,372
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java
BasicModMixer.resetInstrument
protected void resetInstrument(ChannelMemory aktMemo) { aktMemo.autoVibratoTablePos = aktMemo.autoVibratoAmplitude = aktMemo.currentDirection = aktMemo.currentTuningPos = aktMemo.currentSamplePos = 0; aktMemo.volEnvPos = aktMemo.panEnvPos = aktMemo.pitchEnvPos = -1; aktMemo.filterOn = aktMemo.instrumentFinished = false; }
java
protected void resetInstrument(ChannelMemory aktMemo) { aktMemo.autoVibratoTablePos = aktMemo.autoVibratoAmplitude = aktMemo.currentDirection = aktMemo.currentTuningPos = aktMemo.currentSamplePos = 0; aktMemo.volEnvPos = aktMemo.panEnvPos = aktMemo.pitchEnvPos = -1; aktMemo.filterOn = aktMemo.instrumentFinished = false; }
[ "protected", "void", "resetInstrument", "(", "ChannelMemory", "aktMemo", ")", "{", "aktMemo", ".", "autoVibratoTablePos", "=", "aktMemo", ".", "autoVibratoAmplitude", "=", "aktMemo", ".", "currentDirection", "=", "aktMemo", ".", "currentTuningPos", "=", "aktMemo", ".", "currentSamplePos", "=", "0", ";", "aktMemo", ".", "volEnvPos", "=", "aktMemo", ".", "panEnvPos", "=", "aktMemo", ".", "pitchEnvPos", "=", "-", "1", ";", "aktMemo", ".", "filterOn", "=", "aktMemo", ".", "instrumentFinished", "=", "false", ";", "}" ]
Set all index values back to zero! @since 19.06.2006 @param aktMemo
[ "Set", "all", "index", "values", "back", "to", "zero!" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L789-L801
150,373
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java
BasicModMixer.doRowEvent
protected void doRowEvent() { final PatternRow patternRow = currentPattern.getPatternRow(currentRow); if (patternRow==null) return; patternRow.setRowPlayed(); final int nChannels = mod.getNChannels(); for (int c=0; c<nChannels; c++) { // get pattern and channel memory data for current channel final PatternElement element = patternRow.getPatternElement(c); final ChannelMemory aktMemo = channelMemory[c]; // reset all effects on this channel resetAllEffects(aktMemo, element, false); // Now copy the pattern data but remain old values for note and instrument aktMemo.currentElement = element; if (element.getPeriod()>0) aktMemo.assignedNotePeriod = element.getPeriod(); if (element.getNoteIndex()>0) aktMemo.assignedNoteIndex = element.getNoteIndex(); if (element.getInstrument()>0) { aktMemo.assignedInstrumentIndex = element.getInstrument(); aktMemo.assignedInstrument = mod.getInstrumentContainer().getInstrument(element.getInstrument()-1); } aktMemo.effekt = element.getEffekt(); aktMemo.effektParam = element.getEffektOp(); aktMemo.volumeEffekt = element.getVolumeEffekt(); aktMemo.volumeEffektOp = element.getVolumeEffektOp(); // Key Off? if (element.getPeriod()==Helpers.KEY_OFF || element.getNoteIndex()==Helpers.KEY_OFF) { aktMemo.keyOff = true; } else if (element.getPeriod()==Helpers.NOTE_CUT || element.getNoteIndex()==Helpers.NOTE_CUT) { aktMemo.fadeOutVolume = 0; } else if (!isNoteDelayEffekt(aktMemo)) // If this is a noteDelay, we lose for now, this is all done later! { setNewInstrumentAndPeriod(aktMemo); } processEffekts(false, aktMemo); } }
java
protected void doRowEvent() { final PatternRow patternRow = currentPattern.getPatternRow(currentRow); if (patternRow==null) return; patternRow.setRowPlayed(); final int nChannels = mod.getNChannels(); for (int c=0; c<nChannels; c++) { // get pattern and channel memory data for current channel final PatternElement element = patternRow.getPatternElement(c); final ChannelMemory aktMemo = channelMemory[c]; // reset all effects on this channel resetAllEffects(aktMemo, element, false); // Now copy the pattern data but remain old values for note and instrument aktMemo.currentElement = element; if (element.getPeriod()>0) aktMemo.assignedNotePeriod = element.getPeriod(); if (element.getNoteIndex()>0) aktMemo.assignedNoteIndex = element.getNoteIndex(); if (element.getInstrument()>0) { aktMemo.assignedInstrumentIndex = element.getInstrument(); aktMemo.assignedInstrument = mod.getInstrumentContainer().getInstrument(element.getInstrument()-1); } aktMemo.effekt = element.getEffekt(); aktMemo.effektParam = element.getEffektOp(); aktMemo.volumeEffekt = element.getVolumeEffekt(); aktMemo.volumeEffektOp = element.getVolumeEffektOp(); // Key Off? if (element.getPeriod()==Helpers.KEY_OFF || element.getNoteIndex()==Helpers.KEY_OFF) { aktMemo.keyOff = true; } else if (element.getPeriod()==Helpers.NOTE_CUT || element.getNoteIndex()==Helpers.NOTE_CUT) { aktMemo.fadeOutVolume = 0; } else if (!isNoteDelayEffekt(aktMemo)) // If this is a noteDelay, we lose for now, this is all done later! { setNewInstrumentAndPeriod(aktMemo); } processEffekts(false, aktMemo); } }
[ "protected", "void", "doRowEvent", "(", ")", "{", "final", "PatternRow", "patternRow", "=", "currentPattern", ".", "getPatternRow", "(", "currentRow", ")", ";", "if", "(", "patternRow", "==", "null", ")", "return", ";", "patternRow", ".", "setRowPlayed", "(", ")", ";", "final", "int", "nChannels", "=", "mod", ".", "getNChannels", "(", ")", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<", "nChannels", ";", "c", "++", ")", "{", "// get pattern and channel memory data for current channel", "final", "PatternElement", "element", "=", "patternRow", ".", "getPatternElement", "(", "c", ")", ";", "final", "ChannelMemory", "aktMemo", "=", "channelMemory", "[", "c", "]", ";", "// reset all effects on this channel", "resetAllEffects", "(", "aktMemo", ",", "element", ",", "false", ")", ";", "// Now copy the pattern data but remain old values for note and instrument", "aktMemo", ".", "currentElement", "=", "element", ";", "if", "(", "element", ".", "getPeriod", "(", ")", ">", "0", ")", "aktMemo", ".", "assignedNotePeriod", "=", "element", ".", "getPeriod", "(", ")", ";", "if", "(", "element", ".", "getNoteIndex", "(", ")", ">", "0", ")", "aktMemo", ".", "assignedNoteIndex", "=", "element", ".", "getNoteIndex", "(", ")", ";", "if", "(", "element", ".", "getInstrument", "(", ")", ">", "0", ")", "{", "aktMemo", ".", "assignedInstrumentIndex", "=", "element", ".", "getInstrument", "(", ")", ";", "aktMemo", ".", "assignedInstrument", "=", "mod", ".", "getInstrumentContainer", "(", ")", ".", "getInstrument", "(", "element", ".", "getInstrument", "(", ")", "-", "1", ")", ";", "}", "aktMemo", ".", "effekt", "=", "element", ".", "getEffekt", "(", ")", ";", "aktMemo", ".", "effektParam", "=", "element", ".", "getEffektOp", "(", ")", ";", "aktMemo", ".", "volumeEffekt", "=", "element", ".", "getVolumeEffekt", "(", ")", ";", "aktMemo", ".", "volumeEffektOp", "=", "element", ".", "getVolumeEffektOp", "(", ")", ";", "// Key Off?", "if", "(", "element", ".", "getPeriod", "(", ")", "==", "Helpers", ".", "KEY_OFF", "||", "element", ".", "getNoteIndex", "(", ")", "==", "Helpers", ".", "KEY_OFF", ")", "{", "aktMemo", ".", "keyOff", "=", "true", ";", "}", "else", "if", "(", "element", ".", "getPeriod", "(", ")", "==", "Helpers", ".", "NOTE_CUT", "||", "element", ".", "getNoteIndex", "(", ")", "==", "Helpers", ".", "NOTE_CUT", ")", "{", "aktMemo", ".", "fadeOutVolume", "=", "0", ";", "}", "else", "if", "(", "!", "isNoteDelayEffekt", "(", "aktMemo", ")", ")", "// If this is a noteDelay, we lose for now, this is all done later!", "{", "setNewInstrumentAndPeriod", "(", "aktMemo", ")", ";", "}", "processEffekts", "(", "false", ",", "aktMemo", ")", ";", "}", "}" ]
Do the Events of a new Row! @return true, if finished!
[ "Do", "the", "Events", "of", "a", "new", "Row!" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L997-L1045
150,374
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java
BasicModMixer.doTickEvents
protected boolean doTickEvents() { // Global Fade Out if (doFadeOut) { fadeOutValue-=fadeOutSub; if (fadeOutValue <= 0) return true; // We did a fadeout and are finished now } final int nChannels = maxChannels; if (patternTicksDelayCount>0) { for (int c=0; c<nChannels; c++) { final ChannelMemory aktMemo = channelMemory[c]; processEffekts(true, aktMemo); } patternTicksDelayCount--; } else { currentTick--; if (currentTick<=0) { currentTick = currentTempo; // if PatternDelay, do it and return if (patternDelayCount>0) { for (int c=0; c<nChannels; c++) { final ChannelMemory aktMemo = channelMemory[c]; processEffekts(false, aktMemo); } patternDelayCount--; } else if (currentArrangement>=mod.getSongLength()) { return true; // Ticks finished and no new row --> FINITO! } else { // Do the row events doRowEvent(); // and step to the next row... Even if there are no more - we will find out later! currentRow++; if (patternJumpPatternIndex!=-1) // Do not check infinit Loops here, this is never infinit { currentRow = patternJumpPatternIndex; patternJumpPatternIndex = -1; } if (currentRow>=currentPattern.getRowCount() || patternBreakRowIndex!=-1 || patternBreakJumpPatternIndex!=-1) { mod.setArrangementPositionPlayed(currentArrangement); if (patternBreakJumpPatternIndex!=-1) { final int checkRow = (patternBreakRowIndex!=-1)?patternBreakRowIndex:currentRow-1; final boolean infinitLoop = isInfinitLoop(patternBreakJumpPatternIndex, checkRow); if (infinitLoop && doNoLoops==Helpers.PLAYER_LOOP_IGNORE) { patternBreakRowIndex = patternBreakJumpPatternIndex = -1; resetJumpPositionSet(); currentArrangement++; } else { currentArrangement = patternBreakJumpPatternIndex; } patternBreakJumpPatternIndex = -1; // and activate fadeout, if wished if (infinitLoop && doNoLoops == Helpers.PLAYER_LOOP_FADEOUT) doFadeOut = true; } else { resetJumpPositionSet(); currentArrangement++; } if (patternBreakRowIndex!=-1) { currentRow = patternBreakRowIndex; patternBreakRowIndex = -1; } else currentRow = 0; // End of song? Fetch new pattern if not... if (currentArrangement<mod.getSongLength()) { currentPatternIndex = mod.getArrangement()[currentArrangement]; currentPattern = mod.getPatternContainer().getPattern(currentPatternIndex); } else { currentPatternIndex = -1; currentPattern = null; } } } } else { // Do all Tickevents, 'cause we are in a Tick... for (int c=0; c<nChannels; c++) { final ChannelMemory aktMemo = channelMemory[c]; processEffekts(true, aktMemo); } } } return false; }
java
protected boolean doTickEvents() { // Global Fade Out if (doFadeOut) { fadeOutValue-=fadeOutSub; if (fadeOutValue <= 0) return true; // We did a fadeout and are finished now } final int nChannels = maxChannels; if (patternTicksDelayCount>0) { for (int c=0; c<nChannels; c++) { final ChannelMemory aktMemo = channelMemory[c]; processEffekts(true, aktMemo); } patternTicksDelayCount--; } else { currentTick--; if (currentTick<=0) { currentTick = currentTempo; // if PatternDelay, do it and return if (patternDelayCount>0) { for (int c=0; c<nChannels; c++) { final ChannelMemory aktMemo = channelMemory[c]; processEffekts(false, aktMemo); } patternDelayCount--; } else if (currentArrangement>=mod.getSongLength()) { return true; // Ticks finished and no new row --> FINITO! } else { // Do the row events doRowEvent(); // and step to the next row... Even if there are no more - we will find out later! currentRow++; if (patternJumpPatternIndex!=-1) // Do not check infinit Loops here, this is never infinit { currentRow = patternJumpPatternIndex; patternJumpPatternIndex = -1; } if (currentRow>=currentPattern.getRowCount() || patternBreakRowIndex!=-1 || patternBreakJumpPatternIndex!=-1) { mod.setArrangementPositionPlayed(currentArrangement); if (patternBreakJumpPatternIndex!=-1) { final int checkRow = (patternBreakRowIndex!=-1)?patternBreakRowIndex:currentRow-1; final boolean infinitLoop = isInfinitLoop(patternBreakJumpPatternIndex, checkRow); if (infinitLoop && doNoLoops==Helpers.PLAYER_LOOP_IGNORE) { patternBreakRowIndex = patternBreakJumpPatternIndex = -1; resetJumpPositionSet(); currentArrangement++; } else { currentArrangement = patternBreakJumpPatternIndex; } patternBreakJumpPatternIndex = -1; // and activate fadeout, if wished if (infinitLoop && doNoLoops == Helpers.PLAYER_LOOP_FADEOUT) doFadeOut = true; } else { resetJumpPositionSet(); currentArrangement++; } if (patternBreakRowIndex!=-1) { currentRow = patternBreakRowIndex; patternBreakRowIndex = -1; } else currentRow = 0; // End of song? Fetch new pattern if not... if (currentArrangement<mod.getSongLength()) { currentPatternIndex = mod.getArrangement()[currentArrangement]; currentPattern = mod.getPatternContainer().getPattern(currentPatternIndex); } else { currentPatternIndex = -1; currentPattern = null; } } } } else { // Do all Tickevents, 'cause we are in a Tick... for (int c=0; c<nChannels; c++) { final ChannelMemory aktMemo = channelMemory[c]; processEffekts(true, aktMemo); } } } return false; }
[ "protected", "boolean", "doTickEvents", "(", ")", "{", "// Global Fade Out", "if", "(", "doFadeOut", ")", "{", "fadeOutValue", "-=", "fadeOutSub", ";", "if", "(", "fadeOutValue", "<=", "0", ")", "return", "true", ";", "// We did a fadeout and are finished now", "}", "final", "int", "nChannels", "=", "maxChannels", ";", "if", "(", "patternTicksDelayCount", ">", "0", ")", "{", "for", "(", "int", "c", "=", "0", ";", "c", "<", "nChannels", ";", "c", "++", ")", "{", "final", "ChannelMemory", "aktMemo", "=", "channelMemory", "[", "c", "]", ";", "processEffekts", "(", "true", ",", "aktMemo", ")", ";", "}", "patternTicksDelayCount", "--", ";", "}", "else", "{", "currentTick", "--", ";", "if", "(", "currentTick", "<=", "0", ")", "{", "currentTick", "=", "currentTempo", ";", "// if PatternDelay, do it and return", "if", "(", "patternDelayCount", ">", "0", ")", "{", "for", "(", "int", "c", "=", "0", ";", "c", "<", "nChannels", ";", "c", "++", ")", "{", "final", "ChannelMemory", "aktMemo", "=", "channelMemory", "[", "c", "]", ";", "processEffekts", "(", "false", ",", "aktMemo", ")", ";", "}", "patternDelayCount", "--", ";", "}", "else", "if", "(", "currentArrangement", ">=", "mod", ".", "getSongLength", "(", ")", ")", "{", "return", "true", ";", "// Ticks finished and no new row --> FINITO!", "}", "else", "{", "// Do the row events", "doRowEvent", "(", ")", ";", "// and step to the next row... Even if there are no more - we will find out later!", "currentRow", "++", ";", "if", "(", "patternJumpPatternIndex", "!=", "-", "1", ")", "// Do not check infinit Loops here, this is never infinit", "{", "currentRow", "=", "patternJumpPatternIndex", ";", "patternJumpPatternIndex", "=", "-", "1", ";", "}", "if", "(", "currentRow", ">=", "currentPattern", ".", "getRowCount", "(", ")", "||", "patternBreakRowIndex", "!=", "-", "1", "||", "patternBreakJumpPatternIndex", "!=", "-", "1", ")", "{", "mod", ".", "setArrangementPositionPlayed", "(", "currentArrangement", ")", ";", "if", "(", "patternBreakJumpPatternIndex", "!=", "-", "1", ")", "{", "final", "int", "checkRow", "=", "(", "patternBreakRowIndex", "!=", "-", "1", ")", "?", "patternBreakRowIndex", ":", "currentRow", "-", "1", ";", "final", "boolean", "infinitLoop", "=", "isInfinitLoop", "(", "patternBreakJumpPatternIndex", ",", "checkRow", ")", ";", "if", "(", "infinitLoop", "&&", "doNoLoops", "==", "Helpers", ".", "PLAYER_LOOP_IGNORE", ")", "{", "patternBreakRowIndex", "=", "patternBreakJumpPatternIndex", "=", "-", "1", ";", "resetJumpPositionSet", "(", ")", ";", "currentArrangement", "++", ";", "}", "else", "{", "currentArrangement", "=", "patternBreakJumpPatternIndex", ";", "}", "patternBreakJumpPatternIndex", "=", "-", "1", ";", "// and activate fadeout, if wished", "if", "(", "infinitLoop", "&&", "doNoLoops", "==", "Helpers", ".", "PLAYER_LOOP_FADEOUT", ")", "doFadeOut", "=", "true", ";", "}", "else", "{", "resetJumpPositionSet", "(", ")", ";", "currentArrangement", "++", ";", "}", "if", "(", "patternBreakRowIndex", "!=", "-", "1", ")", "{", "currentRow", "=", "patternBreakRowIndex", ";", "patternBreakRowIndex", "=", "-", "1", ";", "}", "else", "currentRow", "=", "0", ";", "// End of song? Fetch new pattern if not...", "if", "(", "currentArrangement", "<", "mod", ".", "getSongLength", "(", ")", ")", "{", "currentPatternIndex", "=", "mod", ".", "getArrangement", "(", ")", "[", "currentArrangement", "]", ";", "currentPattern", "=", "mod", ".", "getPatternContainer", "(", ")", ".", "getPattern", "(", "currentPatternIndex", ")", ";", "}", "else", "{", "currentPatternIndex", "=", "-", "1", ";", "currentPattern", "=", "null", ";", "}", "}", "}", "}", "else", "{", "// Do all Tickevents, 'cause we are in a Tick...", "for", "(", "int", "c", "=", "0", ";", "c", "<", "nChannels", ";", "c", "++", ")", "{", "final", "ChannelMemory", "aktMemo", "=", "channelMemory", "[", "c", "]", ";", "processEffekts", "(", "true", ",", "aktMemo", ")", ";", "}", "}", "}", "return", "false", ";", "}" ]
Do the events during a Tick. @return true, if finished!
[ "Do", "the", "events", "during", "a", "Tick", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L1061-L1173
150,375
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java
BasicModMixer.fitIntoLoops
protected void fitIntoLoops(final ChannelMemory actMemo) { final Sample ins = actMemo.currentSample; // If Forward direction: if (actMemo.currentDirection>=0) { actMemo.currentTuningPos += actMemo.currentTuning; if (actMemo.currentTuningPos >= Helpers.SHIFT_ONE) { actMemo.currentSamplePos += (actMemo.currentTuningPos >> Helpers.SHIFT); actMemo.currentTuningPos &= Helpers.SHIFT_MASK; if ((ins.loopType & Helpers.LOOP_ON)==0) // NoLoop { actMemo.instrumentFinished = actMemo.currentSamplePos>=ins.length; } else // loop is On { if ((ins.loopType & Helpers.LOOP_IS_PINGPONG)==0) // No Ping Pong { if (actMemo.currentSamplePos >= ins.repeatStop) actMemo.currentSamplePos = ins.repeatStart + ((actMemo.currentSamplePos-ins.repeatStart)%ins.repeatLength); } else // is PingPong { if (actMemo.currentSamplePos >= ins.repeatStop) { actMemo.currentDirection = -1; actMemo.currentSamplePos = ins.repeatStop - ((actMemo.currentSamplePos-ins.repeatStart)%ins.repeatLength) - 1; } } } } } else // Loop is on and we have ping pong! { actMemo.currentTuningPos -= actMemo.currentTuning; if (actMemo.currentTuningPos <= 0) { int hi = ((-actMemo.currentTuningPos) >> Helpers.SHIFT) + 1; actMemo.currentSamplePos -= hi; actMemo.currentTuningPos += hi<<Helpers.SHIFT; if (actMemo.currentSamplePos <= ins.repeatStart) { actMemo.currentDirection = 1; actMemo.currentSamplePos = ins.repeatStart + ((ins.repeatStart-actMemo.currentSamplePos)%ins.repeatLength); } } } }
java
protected void fitIntoLoops(final ChannelMemory actMemo) { final Sample ins = actMemo.currentSample; // If Forward direction: if (actMemo.currentDirection>=0) { actMemo.currentTuningPos += actMemo.currentTuning; if (actMemo.currentTuningPos >= Helpers.SHIFT_ONE) { actMemo.currentSamplePos += (actMemo.currentTuningPos >> Helpers.SHIFT); actMemo.currentTuningPos &= Helpers.SHIFT_MASK; if ((ins.loopType & Helpers.LOOP_ON)==0) // NoLoop { actMemo.instrumentFinished = actMemo.currentSamplePos>=ins.length; } else // loop is On { if ((ins.loopType & Helpers.LOOP_IS_PINGPONG)==0) // No Ping Pong { if (actMemo.currentSamplePos >= ins.repeatStop) actMemo.currentSamplePos = ins.repeatStart + ((actMemo.currentSamplePos-ins.repeatStart)%ins.repeatLength); } else // is PingPong { if (actMemo.currentSamplePos >= ins.repeatStop) { actMemo.currentDirection = -1; actMemo.currentSamplePos = ins.repeatStop - ((actMemo.currentSamplePos-ins.repeatStart)%ins.repeatLength) - 1; } } } } } else // Loop is on and we have ping pong! { actMemo.currentTuningPos -= actMemo.currentTuning; if (actMemo.currentTuningPos <= 0) { int hi = ((-actMemo.currentTuningPos) >> Helpers.SHIFT) + 1; actMemo.currentSamplePos -= hi; actMemo.currentTuningPos += hi<<Helpers.SHIFT; if (actMemo.currentSamplePos <= ins.repeatStart) { actMemo.currentDirection = 1; actMemo.currentSamplePos = ins.repeatStart + ((ins.repeatStart-actMemo.currentSamplePos)%ins.repeatLength); } } } }
[ "protected", "void", "fitIntoLoops", "(", "final", "ChannelMemory", "actMemo", ")", "{", "final", "Sample", "ins", "=", "actMemo", ".", "currentSample", ";", "// If Forward direction:", "if", "(", "actMemo", ".", "currentDirection", ">=", "0", ")", "{", "actMemo", ".", "currentTuningPos", "+=", "actMemo", ".", "currentTuning", ";", "if", "(", "actMemo", ".", "currentTuningPos", ">=", "Helpers", ".", "SHIFT_ONE", ")", "{", "actMemo", ".", "currentSamplePos", "+=", "(", "actMemo", ".", "currentTuningPos", ">>", "Helpers", ".", "SHIFT", ")", ";", "actMemo", ".", "currentTuningPos", "&=", "Helpers", ".", "SHIFT_MASK", ";", "if", "(", "(", "ins", ".", "loopType", "&", "Helpers", ".", "LOOP_ON", ")", "==", "0", ")", "// NoLoop", "{", "actMemo", ".", "instrumentFinished", "=", "actMemo", ".", "currentSamplePos", ">=", "ins", ".", "length", ";", "}", "else", "// loop is On", "{", "if", "(", "(", "ins", ".", "loopType", "&", "Helpers", ".", "LOOP_IS_PINGPONG", ")", "==", "0", ")", "// No Ping Pong", "{", "if", "(", "actMemo", ".", "currentSamplePos", ">=", "ins", ".", "repeatStop", ")", "actMemo", ".", "currentSamplePos", "=", "ins", ".", "repeatStart", "+", "(", "(", "actMemo", ".", "currentSamplePos", "-", "ins", ".", "repeatStart", ")", "%", "ins", ".", "repeatLength", ")", ";", "}", "else", "// is PingPong", "{", "if", "(", "actMemo", ".", "currentSamplePos", ">=", "ins", ".", "repeatStop", ")", "{", "actMemo", ".", "currentDirection", "=", "-", "1", ";", "actMemo", ".", "currentSamplePos", "=", "ins", ".", "repeatStop", "-", "(", "(", "actMemo", ".", "currentSamplePos", "-", "ins", ".", "repeatStart", ")", "%", "ins", ".", "repeatLength", ")", "-", "1", ";", "}", "}", "}", "}", "}", "else", "// Loop is on and we have ping pong!", "{", "actMemo", ".", "currentTuningPos", "-=", "actMemo", ".", "currentTuning", ";", "if", "(", "actMemo", ".", "currentTuningPos", "<=", "0", ")", "{", "int", "hi", "=", "(", "(", "-", "actMemo", ".", "currentTuningPos", ")", ">>", "Helpers", ".", "SHIFT", ")", "+", "1", ";", "actMemo", ".", "currentSamplePos", "-=", "hi", ";", "actMemo", ".", "currentTuningPos", "+=", "hi", "<<", "Helpers", ".", "SHIFT", ";", "if", "(", "actMemo", ".", "currentSamplePos", "<=", "ins", ".", "repeatStart", ")", "{", "actMemo", ".", "currentDirection", "=", "1", ";", "actMemo", ".", "currentSamplePos", "=", "ins", ".", "repeatStart", "+", "(", "(", "ins", ".", "repeatStart", "-", "actMemo", ".", "currentSamplePos", ")", "%", "ins", ".", "repeatLength", ")", ";", "}", "}", "}", "}" ]
Add current speed to samplepos and fit currentSamplePos into loop values or signal Sample finished @since 18.06.2006 @param aktMemo
[ "Add", "current", "speed", "to", "samplepos", "and", "fit", "currentSamplePos", "into", "loop", "values", "or", "signal", "Sample", "finished" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L1181-L1230
150,376
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java
BasicModMixer.mixChannelIntoBuffers
private void mixChannelIntoBuffers(final int[] leftBuffer, final int[] rightBuffer, final int startIndex, final int endIndex, final ChannelMemory actMemo) { for (int i=startIndex; i<endIndex; i++) { // Retrieve the Sampledata for this point (interpolated, if necessary) long sample = actMemo.currentSample.getInterpolatedSample(doISP, actMemo.currentSamplePos, actMemo.currentTuningPos); // Resonance Filters if (actMemo.filterOn) sample = doResonance(actMemo, sample); // Volume Ramping (deClick) Left! long volL = actMemo.actRampVolLeft; if ((actMemo.deltaVolLeft>0 && volL>actMemo.actVolumeLeft) || (actMemo.deltaVolLeft<0 && volL<actMemo.actVolumeLeft)) { volL = actMemo.actRampVolLeft = actMemo.actVolumeLeft; actMemo.deltaVolLeft = 0; } else { actMemo.actRampVolLeft += actMemo.deltaVolLeft; } // Volume Ramping (deClick) Right! long volR = actMemo.actRampVolRight; if ((actMemo.deltaVolRight>0 && volR>actMemo.actVolumeRight) || (actMemo.deltaVolRight<0 && volR<actMemo.actVolumeRight)) { volR = actMemo.actRampVolRight = actMemo.actVolumeRight; actMemo.deltaVolRight = 0; } else { actMemo.actRampVolRight += actMemo.deltaVolRight; } // Fit into volume for the two channels leftBuffer[i] += (int)((sample * volL) >> Helpers.MAXVOLUMESHIFT); rightBuffer[i]+= (int)((sample * volR) >> Helpers.MAXVOLUMESHIFT); // Now fit the loops of the current Sample fitIntoLoops(actMemo); if (actMemo.instrumentFinished) break; } }
java
private void mixChannelIntoBuffers(final int[] leftBuffer, final int[] rightBuffer, final int startIndex, final int endIndex, final ChannelMemory actMemo) { for (int i=startIndex; i<endIndex; i++) { // Retrieve the Sampledata for this point (interpolated, if necessary) long sample = actMemo.currentSample.getInterpolatedSample(doISP, actMemo.currentSamplePos, actMemo.currentTuningPos); // Resonance Filters if (actMemo.filterOn) sample = doResonance(actMemo, sample); // Volume Ramping (deClick) Left! long volL = actMemo.actRampVolLeft; if ((actMemo.deltaVolLeft>0 && volL>actMemo.actVolumeLeft) || (actMemo.deltaVolLeft<0 && volL<actMemo.actVolumeLeft)) { volL = actMemo.actRampVolLeft = actMemo.actVolumeLeft; actMemo.deltaVolLeft = 0; } else { actMemo.actRampVolLeft += actMemo.deltaVolLeft; } // Volume Ramping (deClick) Right! long volR = actMemo.actRampVolRight; if ((actMemo.deltaVolRight>0 && volR>actMemo.actVolumeRight) || (actMemo.deltaVolRight<0 && volR<actMemo.actVolumeRight)) { volR = actMemo.actRampVolRight = actMemo.actVolumeRight; actMemo.deltaVolRight = 0; } else { actMemo.actRampVolRight += actMemo.deltaVolRight; } // Fit into volume for the two channels leftBuffer[i] += (int)((sample * volL) >> Helpers.MAXVOLUMESHIFT); rightBuffer[i]+= (int)((sample * volR) >> Helpers.MAXVOLUMESHIFT); // Now fit the loops of the current Sample fitIntoLoops(actMemo); if (actMemo.instrumentFinished) break; } }
[ "private", "void", "mixChannelIntoBuffers", "(", "final", "int", "[", "]", "leftBuffer", ",", "final", "int", "[", "]", "rightBuffer", ",", "final", "int", "startIndex", ",", "final", "int", "endIndex", ",", "final", "ChannelMemory", "actMemo", ")", "{", "for", "(", "int", "i", "=", "startIndex", ";", "i", "<", "endIndex", ";", "i", "++", ")", "{", "// Retrieve the Sampledata for this point (interpolated, if necessary)", "long", "sample", "=", "actMemo", ".", "currentSample", ".", "getInterpolatedSample", "(", "doISP", ",", "actMemo", ".", "currentSamplePos", ",", "actMemo", ".", "currentTuningPos", ")", ";", "// Resonance Filters", "if", "(", "actMemo", ".", "filterOn", ")", "sample", "=", "doResonance", "(", "actMemo", ",", "sample", ")", ";", "// Volume Ramping (deClick) Left!", "long", "volL", "=", "actMemo", ".", "actRampVolLeft", ";", "if", "(", "(", "actMemo", ".", "deltaVolLeft", ">", "0", "&&", "volL", ">", "actMemo", ".", "actVolumeLeft", ")", "||", "(", "actMemo", ".", "deltaVolLeft", "<", "0", "&&", "volL", "<", "actMemo", ".", "actVolumeLeft", ")", ")", "{", "volL", "=", "actMemo", ".", "actRampVolLeft", "=", "actMemo", ".", "actVolumeLeft", ";", "actMemo", ".", "deltaVolLeft", "=", "0", ";", "}", "else", "{", "actMemo", ".", "actRampVolLeft", "+=", "actMemo", ".", "deltaVolLeft", ";", "}", "// Volume Ramping (deClick) Right!", "long", "volR", "=", "actMemo", ".", "actRampVolRight", ";", "if", "(", "(", "actMemo", ".", "deltaVolRight", ">", "0", "&&", "volR", ">", "actMemo", ".", "actVolumeRight", ")", "||", "(", "actMemo", ".", "deltaVolRight", "<", "0", "&&", "volR", "<", "actMemo", ".", "actVolumeRight", ")", ")", "{", "volR", "=", "actMemo", ".", "actRampVolRight", "=", "actMemo", ".", "actVolumeRight", ";", "actMemo", ".", "deltaVolRight", "=", "0", ";", "}", "else", "{", "actMemo", ".", "actRampVolRight", "+=", "actMemo", ".", "deltaVolRight", ";", "}", "// Fit into volume for the two channels", "leftBuffer", "[", "i", "]", "+=", "(", "int", ")", "(", "(", "sample", "*", "volL", ")", ">>", "Helpers", ".", "MAXVOLUMESHIFT", ")", ";", "rightBuffer", "[", "i", "]", "+=", "(", "int", ")", "(", "(", "sample", "*", "volR", ")", ">>", "Helpers", ".", "MAXVOLUMESHIFT", ")", ";", "// Now fit the loops of the current Sample", "fitIntoLoops", "(", "actMemo", ")", ";", "if", "(", "actMemo", ".", "instrumentFinished", ")", "break", ";", "}", "}" ]
Fill the buffers with channel data @since 18.06.2006 @param leftBuffer @param rightBuffer @param startIndex @param amount @param actMemo
[ "Fill", "the", "buffers", "with", "channel", "data" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L1240-L1283
150,377
netarchivesuite/heritrix3-wrapper
src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslTransformer.java
XslTransformer.getTransformer
public static XslTransformer getTransformer(Source source) throws TransformerConfigurationException { if (source == null) { throw new IllegalArgumentException("source is null"); } XslTransformer transformer = new XslTransformer(); transformer.transformerImpl = transformerFactory.newTransformer(source); return transformer; }
java
public static XslTransformer getTransformer(Source source) throws TransformerConfigurationException { if (source == null) { throw new IllegalArgumentException("source is null"); } XslTransformer transformer = new XslTransformer(); transformer.transformerImpl = transformerFactory.newTransformer(source); return transformer; }
[ "public", "static", "XslTransformer", "getTransformer", "(", "Source", "source", ")", "throws", "TransformerConfigurationException", "{", "if", "(", "source", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"source is null\"", ")", ";", "}", "XslTransformer", "transformer", "=", "new", "XslTransformer", "(", ")", ";", "transformer", ".", "transformerImpl", "=", "transformerFactory", ".", "newTransformer", "(", "source", ")", ";", "return", "transformer", ";", "}" ]
Get a wrapped XSL transformer instance for supplied stylesheet source. @param source XSL source @return XSL transformer instance @throws TransformerConfigurationException if an exception occurs while processing
[ "Get", "a", "wrapped", "XSL", "transformer", "instance", "for", "supplied", "stylesheet", "source", "." ]
e53ec5736cbac0bdd3925b5331737dc905871629
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslTransformer.java#L41-L48
150,378
netarchivesuite/heritrix3-wrapper
src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslTransformer.java
XslTransformer.getTransformer
public static XslTransformer getTransformer(File xslFile) throws TransformerConfigurationException { if (xslFile == null) { throw new IllegalArgumentException("xslFile is null"); } return getTransformer(new StreamSource(xslFile)); }
java
public static XslTransformer getTransformer(File xslFile) throws TransformerConfigurationException { if (xslFile == null) { throw new IllegalArgumentException("xslFile is null"); } return getTransformer(new StreamSource(xslFile)); }
[ "public", "static", "XslTransformer", "getTransformer", "(", "File", "xslFile", ")", "throws", "TransformerConfigurationException", "{", "if", "(", "xslFile", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"xslFile is null\"", ")", ";", "}", "return", "getTransformer", "(", "new", "StreamSource", "(", "xslFile", ")", ")", ";", "}" ]
Get a wrapped XSL transformer instance for supplied stylesheet file. @param xslFile XSL file @return XSL transformer instance @throws TransformerConfigurationException if an error occurs while processing
[ "Get", "a", "wrapped", "XSL", "transformer", "instance", "for", "supplied", "stylesheet", "file", "." ]
e53ec5736cbac0bdd3925b5331737dc905871629
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslTransformer.java#L56-L61
150,379
netarchivesuite/heritrix3-wrapper
src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslTransformer.java
XslTransformer.transform
public void transform(Source xmlSource, URIResolver uriResolver, ErrorListener errorListener, Result outputTarget) throws TransformerException { if (xmlSource == null) { throw new IllegalArgumentException("xmlSource is null"); } if (outputTarget == null) { throw new IllegalArgumentException("outputTarget is null"); } transformerImpl.reset(); transformerImpl.setOutputProperty(OutputKeys.INDENT, "yes"); transformerImpl.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); transformerImpl.setURIResolver(uriResolver); transformerImpl.setErrorListener(errorListener); // Feature: Add parameters, if required. transformerImpl.transform(xmlSource, outputTarget); }
java
public void transform(Source xmlSource, URIResolver uriResolver, ErrorListener errorListener, Result outputTarget) throws TransformerException { if (xmlSource == null) { throw new IllegalArgumentException("xmlSource is null"); } if (outputTarget == null) { throw new IllegalArgumentException("outputTarget is null"); } transformerImpl.reset(); transformerImpl.setOutputProperty(OutputKeys.INDENT, "yes"); transformerImpl.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); transformerImpl.setURIResolver(uriResolver); transformerImpl.setErrorListener(errorListener); // Feature: Add parameters, if required. transformerImpl.transform(xmlSource, outputTarget); }
[ "public", "void", "transform", "(", "Source", "xmlSource", ",", "URIResolver", "uriResolver", ",", "ErrorListener", "errorListener", ",", "Result", "outputTarget", ")", "throws", "TransformerException", "{", "if", "(", "xmlSource", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"xmlSource is null\"", ")", ";", "}", "if", "(", "outputTarget", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"outputTarget is null\"", ")", ";", "}", "transformerImpl", ".", "reset", "(", ")", ";", "transformerImpl", ".", "setOutputProperty", "(", "OutputKeys", ".", "INDENT", ",", "\"yes\"", ")", ";", "transformerImpl", ".", "setOutputProperty", "(", "\"{http://xml.apache.org/xslt}indent-amount\"", ",", "\"4\"", ")", ";", "transformerImpl", ".", "setURIResolver", "(", "uriResolver", ")", ";", "transformerImpl", ".", "setErrorListener", "(", "errorListener", ")", ";", "// Feature: Add parameters, if required.", "transformerImpl", ".", "transform", "(", "xmlSource", ",", "outputTarget", ")", ";", "}" ]
Transform XML source using the wrapped XSL transformer of this instance and output to supplied target. @param xmlSource source XML @param uriResolver URI resolver or null @param errorListener error listener or null @param outputTarget output result target to use @throws TransformerException if an exception occurs while transforming
[ "Transform", "XML", "source", "using", "the", "wrapped", "XSL", "transformer", "of", "this", "instance", "and", "output", "to", "supplied", "target", "." ]
e53ec5736cbac0bdd3925b5331737dc905871629
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslTransformer.java#L79-L93
150,380
netarchivesuite/heritrix3-wrapper
src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslTransformer.java
XslTransformer.transform
public byte[] transform(Source xmlSource, URIResolver uriResolver, ErrorListener errorListener) throws TransformerException { if (xmlSource == null) { throw new IllegalArgumentException("xmlSource is null"); } ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamResult result = new StreamResult(out); transform(xmlSource, uriResolver, errorListener, result); return out.toByteArray(); }
java
public byte[] transform(Source xmlSource, URIResolver uriResolver, ErrorListener errorListener) throws TransformerException { if (xmlSource == null) { throw new IllegalArgumentException("xmlSource is null"); } ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamResult result = new StreamResult(out); transform(xmlSource, uriResolver, errorListener, result); return out.toByteArray(); }
[ "public", "byte", "[", "]", "transform", "(", "Source", "xmlSource", ",", "URIResolver", "uriResolver", ",", "ErrorListener", "errorListener", ")", "throws", "TransformerException", "{", "if", "(", "xmlSource", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"xmlSource is null\"", ")", ";", "}", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "StreamResult", "result", "=", "new", "StreamResult", "(", "out", ")", ";", "transform", "(", "xmlSource", ",", "uriResolver", ",", "errorListener", ",", "result", ")", ";", "return", "out", ".", "toByteArray", "(", ")", ";", "}" ]
Transform XML source using the wrapped XSL transformer of this instance and return a byte array of the result. @param xmlSource source XML @param uriResolver URI resolver or null @param errorListener error listener or null @return byte array of the result @throws TransformerException if an exception occurs while transforming
[ "Transform", "XML", "source", "using", "the", "wrapped", "XSL", "transformer", "of", "this", "instance", "and", "return", "a", "byte", "array", "of", "the", "result", "." ]
e53ec5736cbac0bdd3925b5331737dc905871629
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/xmlutils/XslTransformer.java#L103-L111
150,381
danidemi/jlubricant
jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/database/utils/DatasourceTemplate.java
DatasourceTemplate.execute
public void execute(String statement) throws SQLException { if (logger.isDebugEnabled()) { logger.debug("Executing SQL statement [" + statement + "]"); } Connection connection = null; Statement stm = null; try{ connection = ds.getConnection(); stm = connection.createStatement(); stm.execute(statement); } catch (SQLException e) { throw e; }finally{ if(stm!=null) stm.close(); if(connection!=null) connection.close(); } }
java
public void execute(String statement) throws SQLException { if (logger.isDebugEnabled()) { logger.debug("Executing SQL statement [" + statement + "]"); } Connection connection = null; Statement stm = null; try{ connection = ds.getConnection(); stm = connection.createStatement(); stm.execute(statement); } catch (SQLException e) { throw e; }finally{ if(stm!=null) stm.close(); if(connection!=null) connection.close(); } }
[ "public", "void", "execute", "(", "String", "statement", ")", "throws", "SQLException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Executing SQL statement [\"", "+", "statement", "+", "\"]\"", ")", ";", "}", "Connection", "connection", "=", "null", ";", "Statement", "stm", "=", "null", ";", "try", "{", "connection", "=", "ds", ".", "getConnection", "(", ")", ";", "stm", "=", "connection", ".", "createStatement", "(", ")", ";", "stm", ".", "execute", "(", "statement", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "e", ";", "}", "finally", "{", "if", "(", "stm", "!=", "null", ")", "stm", ".", "close", "(", ")", ";", "if", "(", "connection", "!=", "null", ")", "connection", ".", "close", "(", ")", ";", "}", "}" ]
Execute a statement.
[ "Execute", "a", "statement", "." ]
a9937c141c69ec34b768bd603b8093e496329b3a
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/database/utils/DatasourceTemplate.java#L39-L58
150,382
danidemi/jlubricant
jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/database/utils/DatasourceTemplate.java
DatasourceTemplate.queryForInt
public int queryForInt(String sql) throws SQLException { Number number = queryForObject(sql, Integer.class); return (number != null ? number.intValue() : 0); }
java
public int queryForInt(String sql) throws SQLException { Number number = queryForObject(sql, Integer.class); return (number != null ? number.intValue() : 0); }
[ "public", "int", "queryForInt", "(", "String", "sql", ")", "throws", "SQLException", "{", "Number", "number", "=", "queryForObject", "(", "sql", ",", "Integer", ".", "class", ")", ";", "return", "(", "number", "!=", "null", "?", "number", ".", "intValue", "(", ")", ":", "0", ")", ";", "}" ]
Execute a query that returns a single int field.
[ "Execute", "a", "query", "that", "returns", "a", "single", "int", "field", "." ]
a9937c141c69ec34b768bd603b8093e496329b3a
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/database/utils/DatasourceTemplate.java#L63-L66
150,383
danidemi/jlubricant
jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/database/utils/DatasourceTemplate.java
DatasourceTemplate.queryForObject
public <T> T queryForObject(String sql, Class<T> requiredType) throws SQLException { return queryForObject(sql, getSingleColumnRowMapper(requiredType)); }
java
public <T> T queryForObject(String sql, Class<T> requiredType) throws SQLException { return queryForObject(sql, getSingleColumnRowMapper(requiredType)); }
[ "public", "<", "T", ">", "T", "queryForObject", "(", "String", "sql", ",", "Class", "<", "T", ">", "requiredType", ")", "throws", "SQLException", "{", "return", "queryForObject", "(", "sql", ",", "getSingleColumnRowMapper", "(", "requiredType", ")", ")", ";", "}" ]
Execute a query that returns a single value that can be cast to the given type.
[ "Execute", "a", "query", "that", "returns", "a", "single", "value", "that", "can", "be", "cast", "to", "the", "given", "type", "." ]
a9937c141c69ec34b768bd603b8093e496329b3a
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/database/utils/DatasourceTemplate.java#L71-L73
150,384
jtrfp/javamod
src/main/java/de/quippy/jflac/io/BitInputStream.java
BitInputStream.skipBitsNoCRC
public void skipBitsNoCRC(int bits) throws IOException { if (bits == 0) return; int bitsToAlign = getBit & 7; if (bitsToAlign != 0) { int bitsToTake = Math.min(8 - bitsToAlign, bits); readRawUInt(bitsToTake); bits -= bitsToTake; } int bytesNeeded = bits / 8; if (bytesNeeded > 0) { readByteBlockAlignedNoCRC(null, bytesNeeded); bits %= 8; } if (bits > 0) { readRawUInt(bits); } }
java
public void skipBitsNoCRC(int bits) throws IOException { if (bits == 0) return; int bitsToAlign = getBit & 7; if (bitsToAlign != 0) { int bitsToTake = Math.min(8 - bitsToAlign, bits); readRawUInt(bitsToTake); bits -= bitsToTake; } int bytesNeeded = bits / 8; if (bytesNeeded > 0) { readByteBlockAlignedNoCRC(null, bytesNeeded); bits %= 8; } if (bits > 0) { readRawUInt(bits); } }
[ "public", "void", "skipBitsNoCRC", "(", "int", "bits", ")", "throws", "IOException", "{", "if", "(", "bits", "==", "0", ")", "return", ";", "int", "bitsToAlign", "=", "getBit", "&", "7", ";", "if", "(", "bitsToAlign", "!=", "0", ")", "{", "int", "bitsToTake", "=", "Math", ".", "min", "(", "8", "-", "bitsToAlign", ",", "bits", ")", ";", "readRawUInt", "(", "bitsToTake", ")", ";", "bits", "-=", "bitsToTake", ";", "}", "int", "bytesNeeded", "=", "bits", "/", "8", ";", "if", "(", "bytesNeeded", ">", "0", ")", "{", "readByteBlockAlignedNoCRC", "(", "null", ",", "bytesNeeded", ")", ";", "bits", "%=", "8", ";", "}", "if", "(", "bits", ">", "0", ")", "{", "readRawUInt", "(", "bits", ")", ";", "}", "}" ]
skip over bits in bit stream without updating CRC. @param bits Number of bits to skip @throws IOException Thrown if error reading from input stream
[ "skip", "over", "bits", "in", "bit", "stream", "without", "updating", "CRC", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitInputStream.java#L176-L192
150,385
jtrfp/javamod
src/main/java/de/quippy/jflac/io/BitInputStream.java
BitInputStream.readBit
public int readBit() throws IOException { while (true) { if (availBits > 0) { int val = ((buffer[getByte] & (0x80 >> getBit)) != 0) ? 1 : 0; getBit++; if (getBit == BITS_PER_BLURB) { readCRC16 = CRC16.update(buffer[getByte], readCRC16); getByte++; getBit = 0; } availBits--; totalBitsRead++; return val; } else { readFromStream(); } } }
java
public int readBit() throws IOException { while (true) { if (availBits > 0) { int val = ((buffer[getByte] & (0x80 >> getBit)) != 0) ? 1 : 0; getBit++; if (getBit == BITS_PER_BLURB) { readCRC16 = CRC16.update(buffer[getByte], readCRC16); getByte++; getBit = 0; } availBits--; totalBitsRead++; return val; } else { readFromStream(); } } }
[ "public", "int", "readBit", "(", ")", "throws", "IOException", "{", "while", "(", "true", ")", "{", "if", "(", "availBits", ">", "0", ")", "{", "int", "val", "=", "(", "(", "buffer", "[", "getByte", "]", "&", "(", "0x80", ">>", "getBit", ")", ")", "!=", "0", ")", "?", "1", ":", "0", ";", "getBit", "++", ";", "if", "(", "getBit", "==", "BITS_PER_BLURB", ")", "{", "readCRC16", "=", "CRC16", ".", "update", "(", "buffer", "[", "getByte", "]", ",", "readCRC16", ")", ";", "getByte", "++", ";", "getBit", "=", "0", ";", "}", "availBits", "--", ";", "totalBitsRead", "++", ";", "return", "val", ";", "}", "else", "{", "readFromStream", "(", ")", ";", "}", "}", "}" ]
read a single bit. @return The bit @throws IOException Thrown if error reading input stream
[ "read", "a", "single", "bit", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitInputStream.java#L199-L216
150,386
jtrfp/javamod
src/main/java/de/quippy/jflac/io/BitInputStream.java
BitInputStream.peekBitToInt
public int peekBitToInt(int val, int bit) throws IOException { while (true) { if (bit < availBits) { val <<= 1; if ((getBit + bit) >= BITS_PER_BLURB) { bit = (getBit + bit) % BITS_PER_BLURB; val |= ((buffer[getByte + 1] & (0x80 >> bit)) != 0) ? 1 : 0; } else { val |= ((buffer[getByte] & (0x80 >> (getBit + bit))) != 0) ? 1 : 0; } return val; } else { readFromStream(); } } }
java
public int peekBitToInt(int val, int bit) throws IOException { while (true) { if (bit < availBits) { val <<= 1; if ((getBit + bit) >= BITS_PER_BLURB) { bit = (getBit + bit) % BITS_PER_BLURB; val |= ((buffer[getByte + 1] & (0x80 >> bit)) != 0) ? 1 : 0; } else { val |= ((buffer[getByte] & (0x80 >> (getBit + bit))) != 0) ? 1 : 0; } return val; } else { readFromStream(); } } }
[ "public", "int", "peekBitToInt", "(", "int", "val", ",", "int", "bit", ")", "throws", "IOException", "{", "while", "(", "true", ")", "{", "if", "(", "bit", "<", "availBits", ")", "{", "val", "<<=", "1", ";", "if", "(", "(", "getBit", "+", "bit", ")", ">=", "BITS_PER_BLURB", ")", "{", "bit", "=", "(", "getBit", "+", "bit", ")", "%", "BITS_PER_BLURB", ";", "val", "|=", "(", "(", "buffer", "[", "getByte", "+", "1", "]", "&", "(", "0x80", ">>", "bit", ")", ")", "!=", "0", ")", "?", "1", ":", "0", ";", "}", "else", "{", "val", "|=", "(", "(", "buffer", "[", "getByte", "]", "&", "(", "0x80", ">>", "(", "getBit", "+", "bit", ")", ")", ")", "!=", "0", ")", "?", "1", ":", "0", ";", "}", "return", "val", ";", "}", "else", "{", "readFromStream", "(", ")", ";", "}", "}", "}" ]
peek at the next bit and add it to the input integer. The bits of the input integer are shifted left and the read bit is placed into bit 0. @param val The input integer @param bit The bit to peek at @return The updated integer value @throws IOException Thrown if error reading input stream
[ "peek", "at", "the", "next", "bit", "and", "add", "it", "to", "the", "input", "integer", ".", "The", "bits", "of", "the", "input", "integer", "are", "shifted", "left", "and", "the", "read", "bit", "is", "placed", "into", "bit", "0", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitInputStream.java#L255-L270
150,387
jtrfp/javamod
src/main/java/de/quippy/jflac/io/BitInputStream.java
BitInputStream.readRawUInt
public int readRawUInt(int bits) throws IOException { int val = 0; for (int i = 0; i < bits; i++) { val = readBitToInt(val); } return val; }
java
public int readRawUInt(int bits) throws IOException { int val = 0; for (int i = 0; i < bits; i++) { val = readBitToInt(val); } return val; }
[ "public", "int", "readRawUInt", "(", "int", "bits", ")", "throws", "IOException", "{", "int", "val", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bits", ";", "i", "++", ")", "{", "val", "=", "readBitToInt", "(", "val", ")", ";", "}", "return", "val", ";", "}" ]
read bits into an unsigned integer. @param bits The number of bits to read @return The bits as an unsigned integer @throws IOException Thrown if error reading input stream
[ "read", "bits", "into", "an", "unsigned", "integer", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitInputStream.java#L306-L312
150,388
jtrfp/javamod
src/main/java/de/quippy/jflac/io/BitInputStream.java
BitInputStream.peekRawUInt
public int peekRawUInt(int bits) throws IOException { int val = 0; for (int i = 0; i < bits; i++) { val = peekBitToInt(val, i); } return val; }
java
public int peekRawUInt(int bits) throws IOException { int val = 0; for (int i = 0; i < bits; i++) { val = peekBitToInt(val, i); } return val; }
[ "public", "int", "peekRawUInt", "(", "int", "bits", ")", "throws", "IOException", "{", "int", "val", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bits", ";", "i", "++", ")", "{", "val", "=", "peekBitToInt", "(", "val", ",", "i", ")", ";", "}", "return", "val", ";", "}" ]
peek at bits into an unsigned integer without advancing the input stream. @param bits The number of bits to read @return The bits as an unsigned integer @throws IOException Thrown if error reading input stream
[ "peek", "at", "bits", "into", "an", "unsigned", "integer", "without", "advancing", "the", "input", "stream", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitInputStream.java#L320-L326
150,389
jtrfp/javamod
src/main/java/de/quippy/jflac/io/BitInputStream.java
BitInputStream.readRawInt
public int readRawInt(int bits) throws IOException { if (bits == 0) { return 0; } int uval = 0; for (int i = 0; i < bits; i++) { uval = readBitToInt(uval); } // fix the sign int val; int bitsToleft = 32 - bits; if (bitsToleft != 0) { uval <<= bitsToleft; val = uval; val >>= bitsToleft; } else { val = uval; } return val; }
java
public int readRawInt(int bits) throws IOException { if (bits == 0) { return 0; } int uval = 0; for (int i = 0; i < bits; i++) { uval = readBitToInt(uval); } // fix the sign int val; int bitsToleft = 32 - bits; if (bitsToleft != 0) { uval <<= bitsToleft; val = uval; val >>= bitsToleft; } else { val = uval; } return val; }
[ "public", "int", "readRawInt", "(", "int", "bits", ")", "throws", "IOException", "{", "if", "(", "bits", "==", "0", ")", "{", "return", "0", ";", "}", "int", "uval", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bits", ";", "i", "++", ")", "{", "uval", "=", "readBitToInt", "(", "uval", ")", ";", "}", "// fix the sign", "int", "val", ";", "int", "bitsToleft", "=", "32", "-", "bits", ";", "if", "(", "bitsToleft", "!=", "0", ")", "{", "uval", "<<=", "bitsToleft", ";", "val", "=", "uval", ";", "val", ">>=", "bitsToleft", ";", "}", "else", "{", "val", "=", "uval", ";", "}", "return", "val", ";", "}" ]
read bits into a signed integer. @param bits The number of bits to read @return The bits as a signed integer @throws IOException Thrown if error reading input stream
[ "read", "bits", "into", "a", "signed", "integer", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitInputStream.java#L334-L352
150,390
jtrfp/javamod
src/main/java/de/quippy/jflac/io/BitInputStream.java
BitInputStream.readRawULong
public long readRawULong(int bits) throws IOException { long val = 0; for (int i = 0; i < bits; i++) { val = readBitToLong(val); } return val; }
java
public long readRawULong(int bits) throws IOException { long val = 0; for (int i = 0; i < bits; i++) { val = readBitToLong(val); } return val; }
[ "public", "long", "readRawULong", "(", "int", "bits", ")", "throws", "IOException", "{", "long", "val", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bits", ";", "i", "++", ")", "{", "val", "=", "readBitToLong", "(", "val", ")", ";", "}", "return", "val", ";", "}" ]
read bits into an unsigned long. @param bits The number of bits to read @return The bits as an unsigned long @throws IOException Thrown if error reading input stream
[ "read", "bits", "into", "an", "unsigned", "long", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitInputStream.java#L360-L366
150,391
jtrfp/javamod
src/main/java/de/quippy/jflac/io/BitInputStream.java
BitInputStream.readRawIntLittleEndian
public int readRawIntLittleEndian() throws IOException { int x32 = readRawUInt(8); int x8 = readRawUInt(8); x32 |= (x8 << 8); x8 = readRawUInt(8); x32 |= (x8 << 16); x8 = readRawUInt(8); x32 |= (x8 << 24); return x32; }
java
public int readRawIntLittleEndian() throws IOException { int x32 = readRawUInt(8); int x8 = readRawUInt(8); x32 |= (x8 << 8); x8 = readRawUInt(8); x32 |= (x8 << 16); x8 = readRawUInt(8); x32 |= (x8 << 24); return x32; }
[ "public", "int", "readRawIntLittleEndian", "(", ")", "throws", "IOException", "{", "int", "x32", "=", "readRawUInt", "(", "8", ")", ";", "int", "x8", "=", "readRawUInt", "(", "8", ")", ";", "x32", "|=", "(", "x8", "<<", "8", ")", ";", "x8", "=", "readRawUInt", "(", "8", ")", ";", "x32", "|=", "(", "x8", "<<", "16", ")", ";", "x8", "=", "readRawUInt", "(", "8", ")", ";", "x32", "|=", "(", "x8", "<<", "24", ")", ";", "return", "x32", ";", "}" ]
read bits into an unsigned little endian integer. @return The bits as an unsigned integer @throws IOException Thrown if error reading input stream
[ "read", "bits", "into", "an", "unsigned", "little", "endian", "integer", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitInputStream.java#L373-L382
150,392
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/sync/synchronizer/UpdateOnlySynchronizer.java
UpdateOnlySynchronizer.updateElementInReadBuffer
private int updateElementInReadBuffer(Data data, int indexInChunk) { workingBuffer.position(indexInChunk); int minElement = indexInChunk / gp.getElementSize(); int numberOfEntries = workingBuffer.limit() / gp.getElementSize(); byte[] actualKey = data.getKey(); // binary search int maxElement = numberOfEntries - 1; int midElement; int compare; byte[] tmpKey = new byte[actualKey.length]; while (minElement <= maxElement) { midElement = minElement + (maxElement - minElement) / 2; indexInChunk = midElement * gp.getElementSize(); workingBuffer.position(indexInChunk); workingBuffer.get(tmpKey); compare = KeyUtils.compareKey(actualKey, tmpKey); if (compare == 0) { // first read the old element workingBuffer.position(indexInChunk); byte[] b = new byte[gp.getElementSize()]; workingBuffer.get(b); @SuppressWarnings("unchecked") Data toUpdate = (Data)prototype.fromByteBuffer(ByteBuffer.wrap(b)); // update the old element and write it toUpdate.update(data); workingBuffer.position(indexInChunk); workingBuffer.put(data.toByteBuffer()); return indexInChunk; } else if (compare < 0) { maxElement = midElement - 1; } else { minElement = midElement + 1; } } return -1; }
java
private int updateElementInReadBuffer(Data data, int indexInChunk) { workingBuffer.position(indexInChunk); int minElement = indexInChunk / gp.getElementSize(); int numberOfEntries = workingBuffer.limit() / gp.getElementSize(); byte[] actualKey = data.getKey(); // binary search int maxElement = numberOfEntries - 1; int midElement; int compare; byte[] tmpKey = new byte[actualKey.length]; while (minElement <= maxElement) { midElement = minElement + (maxElement - minElement) / 2; indexInChunk = midElement * gp.getElementSize(); workingBuffer.position(indexInChunk); workingBuffer.get(tmpKey); compare = KeyUtils.compareKey(actualKey, tmpKey); if (compare == 0) { // first read the old element workingBuffer.position(indexInChunk); byte[] b = new byte[gp.getElementSize()]; workingBuffer.get(b); @SuppressWarnings("unchecked") Data toUpdate = (Data)prototype.fromByteBuffer(ByteBuffer.wrap(b)); // update the old element and write it toUpdate.update(data); workingBuffer.position(indexInChunk); workingBuffer.put(data.toByteBuffer()); return indexInChunk; } else if (compare < 0) { maxElement = midElement - 1; } else { minElement = midElement + 1; } } return -1; }
[ "private", "int", "updateElementInReadBuffer", "(", "Data", "data", ",", "int", "indexInChunk", ")", "{", "workingBuffer", ".", "position", "(", "indexInChunk", ")", ";", "int", "minElement", "=", "indexInChunk", "/", "gp", ".", "getElementSize", "(", ")", ";", "int", "numberOfEntries", "=", "workingBuffer", ".", "limit", "(", ")", "/", "gp", ".", "getElementSize", "(", ")", ";", "byte", "[", "]", "actualKey", "=", "data", ".", "getKey", "(", ")", ";", "// binary search\r", "int", "maxElement", "=", "numberOfEntries", "-", "1", ";", "int", "midElement", ";", "int", "compare", ";", "byte", "[", "]", "tmpKey", "=", "new", "byte", "[", "actualKey", ".", "length", "]", ";", "while", "(", "minElement", "<=", "maxElement", ")", "{", "midElement", "=", "minElement", "+", "(", "maxElement", "-", "minElement", ")", "/", "2", ";", "indexInChunk", "=", "midElement", "*", "gp", ".", "getElementSize", "(", ")", ";", "workingBuffer", ".", "position", "(", "indexInChunk", ")", ";", "workingBuffer", ".", "get", "(", "tmpKey", ")", ";", "compare", "=", "KeyUtils", ".", "compareKey", "(", "actualKey", ",", "tmpKey", ")", ";", "if", "(", "compare", "==", "0", ")", "{", "// first read the old element\r", "workingBuffer", ".", "position", "(", "indexInChunk", ")", ";", "byte", "[", "]", "b", "=", "new", "byte", "[", "gp", ".", "getElementSize", "(", ")", "]", ";", "workingBuffer", ".", "get", "(", "b", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Data", "toUpdate", "=", "(", "Data", ")", "prototype", ".", "fromByteBuffer", "(", "ByteBuffer", ".", "wrap", "(", "b", ")", ")", ";", "// update the old element and write it\r", "toUpdate", ".", "update", "(", "data", ")", ";", "workingBuffer", ".", "position", "(", "indexInChunk", ")", ";", "workingBuffer", ".", "put", "(", "data", ".", "toByteBuffer", "(", ")", ")", ";", "return", "indexInChunk", ";", "}", "else", "if", "(", "compare", "<", "0", ")", "{", "maxElement", "=", "midElement", "-", "1", ";", "}", "else", "{", "minElement", "=", "midElement", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
traverses the readBuffer
[ "traverses", "the", "readBuffer" ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/sync/synchronizer/UpdateOnlySynchronizer.java#L152-L187
150,393
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/util/GUIDUtil.java
GUIDUtil.toGUID
public static byte[] toGUID(long p1, int p2, int p3, int p4, long p5) { byte[] guid = new byte[16]; guid[0] = (byte)(p1 & 0xFF); guid[1] = (byte)((p1 >> 8) & 0xFF); guid[2] = (byte)((p1 >> 16) & 0xFF); guid[3] = (byte)((p1 >> 24) & 0xFF); guid[4] = (byte)(p2 & 0xFF); guid[5] = (byte)((p2 >> 8) & 0xFF); guid[6] = (byte)(p3 & 0xFF); guid[7] = (byte)((p3 >> 8) & 0xFF); guid[8] = (byte)((p4 >> 8) & 0xFF); guid[9] = (byte)(p4 & 0xFF); guid[10] = (byte)((p5 >> 40) & 0xFF); guid[11] = (byte)((p5 >> 32) & 0xFF); guid[12] = (byte)((p5 >> 24) & 0xFF); guid[13] = (byte)((p5 >> 16) & 0xFF); guid[14] = (byte)((p5 >> 8) & 0xFF); guid[15] = (byte)(p5 & 0xFF); return guid; }
java
public static byte[] toGUID(long p1, int p2, int p3, int p4, long p5) { byte[] guid = new byte[16]; guid[0] = (byte)(p1 & 0xFF); guid[1] = (byte)((p1 >> 8) & 0xFF); guid[2] = (byte)((p1 >> 16) & 0xFF); guid[3] = (byte)((p1 >> 24) & 0xFF); guid[4] = (byte)(p2 & 0xFF); guid[5] = (byte)((p2 >> 8) & 0xFF); guid[6] = (byte)(p3 & 0xFF); guid[7] = (byte)((p3 >> 8) & 0xFF); guid[8] = (byte)((p4 >> 8) & 0xFF); guid[9] = (byte)(p4 & 0xFF); guid[10] = (byte)((p5 >> 40) & 0xFF); guid[11] = (byte)((p5 >> 32) & 0xFF); guid[12] = (byte)((p5 >> 24) & 0xFF); guid[13] = (byte)((p5 >> 16) & 0xFF); guid[14] = (byte)((p5 >> 8) & 0xFF); guid[15] = (byte)(p5 & 0xFF); return guid; }
[ "public", "static", "byte", "[", "]", "toGUID", "(", "long", "p1", ",", "int", "p2", ",", "int", "p3", ",", "int", "p4", ",", "long", "p5", ")", "{", "byte", "[", "]", "guid", "=", "new", "byte", "[", "16", "]", ";", "guid", "[", "0", "]", "=", "(", "byte", ")", "(", "p1", "&", "0xFF", ")", ";", "guid", "[", "1", "]", "=", "(", "byte", ")", "(", "(", "p1", ">>", "8", ")", "&", "0xFF", ")", ";", "guid", "[", "2", "]", "=", "(", "byte", ")", "(", "(", "p1", ">>", "16", ")", "&", "0xFF", ")", ";", "guid", "[", "3", "]", "=", "(", "byte", ")", "(", "(", "p1", ">>", "24", ")", "&", "0xFF", ")", ";", "guid", "[", "4", "]", "=", "(", "byte", ")", "(", "p2", "&", "0xFF", ")", ";", "guid", "[", "5", "]", "=", "(", "byte", ")", "(", "(", "p2", ">>", "8", ")", "&", "0xFF", ")", ";", "guid", "[", "6", "]", "=", "(", "byte", ")", "(", "p3", "&", "0xFF", ")", ";", "guid", "[", "7", "]", "=", "(", "byte", ")", "(", "(", "p3", ">>", "8", ")", "&", "0xFF", ")", ";", "guid", "[", "8", "]", "=", "(", "byte", ")", "(", "(", "p4", ">>", "8", ")", "&", "0xFF", ")", ";", "guid", "[", "9", "]", "=", "(", "byte", ")", "(", "p4", "&", "0xFF", ")", ";", "guid", "[", "10", "]", "=", "(", "byte", ")", "(", "(", "p5", ">>", "40", ")", "&", "0xFF", ")", ";", "guid", "[", "11", "]", "=", "(", "byte", ")", "(", "(", "p5", ">>", "32", ")", "&", "0xFF", ")", ";", "guid", "[", "12", "]", "=", "(", "byte", ")", "(", "(", "p5", ">>", "24", ")", "&", "0xFF", ")", ";", "guid", "[", "13", "]", "=", "(", "byte", ")", "(", "(", "p5", ">>", "16", ")", "&", "0xFF", ")", ";", "guid", "[", "14", "]", "=", "(", "byte", ")", "(", "(", "p5", ">>", "8", ")", "&", "0xFF", ")", ";", "guid", "[", "15", "]", "=", "(", "byte", ")", "(", "p5", "&", "0xFF", ")", ";", "return", "guid", ";", "}" ]
Create a GUID.
[ "Create", "a", "GUID", "." ]
b0c893b44bfde2c03f90ea846a49ef5749d598f3
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/GUIDUtil.java#L11-L30
150,394
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/info/StgFileSource.java
StgFileSource.init
protected void init(File file, String directory, String fileName, InfoLocationOptions option){ super.init(file, directory, fileName, option); if(!this.errors.hasErrors()){ if(!"stg".equals(this.getFileExtension())){ this.errors.addError("file name must have '.stg' extension"); this.reset(); } else{ } } }
java
protected void init(File file, String directory, String fileName, InfoLocationOptions option){ super.init(file, directory, fileName, option); if(!this.errors.hasErrors()){ if(!"stg".equals(this.getFileExtension())){ this.errors.addError("file name must have '.stg' extension"); this.reset(); } else{ } } }
[ "protected", "void", "init", "(", "File", "file", ",", "String", "directory", ",", "String", "fileName", ",", "InfoLocationOptions", "option", ")", "{", "super", ".", "init", "(", "file", ",", "directory", ",", "fileName", ",", "option", ")", ";", "if", "(", "!", "this", ".", "errors", ".", "hasErrors", "(", ")", ")", "{", "if", "(", "!", "\"stg\"", ".", "equals", "(", "this", ".", "getFileExtension", "(", ")", ")", ")", "{", "this", ".", "errors", ".", "addError", "(", "\"file name must have '.stg' extension\"", ")", ";", "this", ".", "reset", "(", ")", ";", "}", "else", "{", "}", "}", "}" ]
Initialize the file source with any parameters presented by the constructors. @param file a file with all information @param directory a directory to locate a file in @param fileName a file name with or without path information @param option an option on how to locate the file (not used if parameter file is set)
[ "Initialize", "the", "file", "source", "with", "any", "parameters", "presented", "by", "the", "constructors", "." ]
6d845bcc482aa9344d016e80c0c3455aeae13a13
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/StgFileSource.java#L99-L109
150,395
danidemi/jlubricant
jlubricant-spring-batch/src/main/java/com/danidemi/jlubricant/springbatch/NamedJdbcCursorItemReader.java
NamedJdbcCursorItemReader.afterPropertiesSet
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.notNull(sql, "The SQL query must be provided"); Assert.notNull(rowMapper, "RowMapper must be provided"); }
java
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.notNull(sql, "The SQL query must be provided"); Assert.notNull(rowMapper, "RowMapper must be provided"); }
[ "@", "Override", "public", "void", "afterPropertiesSet", "(", ")", "throws", "Exception", "{", "super", ".", "afterPropertiesSet", "(", ")", ";", "Assert", ".", "notNull", "(", "sql", ",", "\"The SQL query must be provided\"", ")", ";", "Assert", ".", "notNull", "(", "rowMapper", ",", "\"RowMapper must be provided\"", ")", ";", "}" ]
Assert that mandatory properties are set. @throws IllegalArgumentException if either data source or sql properties not set.
[ "Assert", "that", "mandatory", "properties", "are", "set", "." ]
a9937c141c69ec34b768bd603b8093e496329b3a
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-spring-batch/src/main/java/com/danidemi/jlubricant/springbatch/NamedJdbcCursorItemReader.java#L223-L228
150,396
GerdHolz/TOVAL
src/de/invation/code/toval/misc/ArrayUtils.java
ArrayUtils.getRandomItem
public static <T> T getRandomItem(T[] arr) { return arr[rand.nextInt(arr.length)]; }
java
public static <T> T getRandomItem(T[] arr) { return arr[rand.nextInt(arr.length)]; }
[ "public", "static", "<", "T", ">", "T", "getRandomItem", "(", "T", "[", "]", "arr", ")", "{", "return", "arr", "[", "rand", ".", "nextInt", "(", "arr", ".", "length", ")", "]", ";", "}" ]
Returns a random element of the given array. @param <T> Type of array elements @param arr Array @return Random element of <code>arr</code>
[ "Returns", "a", "random", "element", "of", "the", "given", "array", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ArrayUtils.java#L151-L153
150,397
GerdHolz/TOVAL
src/de/invation/code/toval/misc/ArrayUtils.java
ArrayUtils.reverseArray
public static <T> T[] reverseArray(T[] arr) { for (int left = 0, right = arr.length - 1; left < right; left++, right--) { T temp = arr[left]; arr[left] = arr[right]; arr[right] = temp; } return arr; }
java
public static <T> T[] reverseArray(T[] arr) { for (int left = 0, right = arr.length - 1; left < right; left++, right--) { T temp = arr[left]; arr[left] = arr[right]; arr[right] = temp; } return arr; }
[ "public", "static", "<", "T", ">", "T", "[", "]", "reverseArray", "(", "T", "[", "]", "arr", ")", "{", "for", "(", "int", "left", "=", "0", ",", "right", "=", "arr", ".", "length", "-", "1", ";", "left", "<", "right", ";", "left", "++", ",", "right", "--", ")", "{", "T", "temp", "=", "arr", "[", "left", "]", ";", "arr", "[", "left", "]", "=", "arr", "[", "right", "]", ";", "arr", "[", "right", "]", "=", "temp", ";", "}", "return", "arr", ";", "}" ]
Reverses the entries of a given array. @param <T> Type of array elements @param arr Array to reverse @return The same array in reverse order
[ "Reverses", "the", "entries", "of", "a", "given", "array", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ArrayUtils.java#L164-L171
150,398
GerdHolz/TOVAL
src/de/invation/code/toval/misc/ArrayUtils.java
ArrayUtils.shuffleArray
public static <T> void shuffleArray(T[] arr) { for (int i = arr.length; i > 1; i--) swap(arr, i - 1, rand.nextInt(i)); }
java
public static <T> void shuffleArray(T[] arr) { for (int i = arr.length; i > 1; i--) swap(arr, i - 1, rand.nextInt(i)); }
[ "public", "static", "<", "T", ">", "void", "shuffleArray", "(", "T", "[", "]", "arr", ")", "{", "for", "(", "int", "i", "=", "arr", ".", "length", ";", "i", ">", "1", ";", "i", "--", ")", "swap", "(", "arr", ",", "i", "-", "1", ",", "rand", ".", "nextInt", "(", "i", ")", ")", ";", "}" ]
Permutes the elements of the given array. @param <T> Array-type @param arr Array to shuffle
[ "Permutes", "the", "elements", "of", "the", "given", "array", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ArrayUtils.java#L216-L219
150,399
GerdHolz/TOVAL
src/de/invation/code/toval/misc/ArrayUtils.java
ArrayUtils.getFormat
private static <T> String getFormat(T[] arr, int precision, char valueSeparation) { StringBuilder builder = new StringBuilder(); builder.append('['); for (int i = 0; i < arr.length - 1; i++) { builder.append(FormatUtils.getFormat(arr[i], precision)); builder.append(valueSeparation); } builder.append(FormatUtils.getFormat(arr[arr.length - 1], precision)); builder.append(']'); return builder.toString(); }
java
private static <T> String getFormat(T[] arr, int precision, char valueSeparation) { StringBuilder builder = new StringBuilder(); builder.append('['); for (int i = 0; i < arr.length - 1; i++) { builder.append(FormatUtils.getFormat(arr[i], precision)); builder.append(valueSeparation); } builder.append(FormatUtils.getFormat(arr[arr.length - 1], precision)); builder.append(']'); return builder.toString(); }
[ "private", "static", "<", "T", ">", "String", "getFormat", "(", "T", "[", "]", "arr", ",", "int", "precision", ",", "char", "valueSeparation", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "'", "'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "length", "-", "1", ";", "i", "++", ")", "{", "builder", ".", "append", "(", "FormatUtils", ".", "getFormat", "(", "arr", "[", "i", "]", ",", "precision", ")", ")", ";", "builder", ".", "append", "(", "valueSeparation", ")", ";", "}", "builder", ".", "append", "(", "FormatUtils", ".", "getFormat", "(", "arr", "[", "arr", ".", "length", "-", "1", "]", ",", "precision", ")", ")", ";", "builder", ".", "append", "(", "'", "'", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Returns a format-String that can be used to generate a String representation of an array using the String.format method. @param arr Array for which a String representation is desired @param precision Desired precision for <code>Float</code> and <code>Double</code> elements @return Format-String for <code>arr</code> @see Formatter @see String#format(String, Object...)
[ "Returns", "a", "format", "-", "String", "that", "can", "be", "used", "to", "generate", "a", "String", "representation", "of", "an", "array", "using", "the", "String", ".", "format", "method", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ArrayUtils.java#L424-L434