repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
quattor/pan
panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java
AbstractElement.rput
public void rput(Term[] terms, int index, Element value) throws InvalidTermException { throw new EvaluationException(MessageUtils.format(MSG_CANNOT_ADD_CHILD, this.getTypeAsString())); }
java
public void rput(Term[] terms, int index, Element value) throws InvalidTermException { throw new EvaluationException(MessageUtils.format(MSG_CANNOT_ADD_CHILD, this.getTypeAsString())); }
[ "public", "void", "rput", "(", "Term", "[", "]", "terms", ",", "int", "index", ",", "Element", "value", ")", "throws", "InvalidTermException", "{", "throw", "new", "EvaluationException", "(", "MessageUtils", ".", "format", "(", "MSG_CANNOT_ADD_CHILD", ",", "th...
Add the given child to this resource, creating intermediate resources as necessary. If this Element is not a resource, then this will throw an InvalidTermException. The default implementation of this method throws such an exception. This resource must be a writable resource, otherwise an exception will be thrown. @throws org.quattor.pan.exceptions.InvalidTermException thrown if an trying to dereference a list with a key or a hash with an index
[ "Add", "the", "given", "child", "to", "this", "resource", "creating", "intermediate", "resources", "as", "necessary", ".", "If", "this", "Element", "is", "not", "a", "resource", "then", "this", "will", "throw", "an", "InvalidTermException", ".", "The", "defaul...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java#L257-L261
train
saxsys/SynchronizeFX
demos/sliderdemo/src/main/java/de/saxsys/synchronizefx/sliderdemo/server/ServerApp.java
ServerApp.main
public static void main(final String... args) { System.out.println("starting server"); final Model model = new Model(); final SynchronizeFxServer syncFxServer = SynchronizeFxBuilder.create().server().model(model).callback(new ServerCallback() { @Override public void onError(final SynchronizeFXException exception) { System.err.println("Server Error:" + exception.getLocalizedMessage()); } @Override public void onClientConnectionError(final Object client, final SynchronizeFXException exception) { System.err.println("An exception in the communication to a client occurred." + exception); } }).build(); syncFxServer.start(); final Scanner console = new Scanner(System.in); boolean exit = false; while (!exit) { System.out.println("press 'q' for quit"); final String input = console.next(); if ("q".equals(input)) { exit = true; } } console.close(); syncFxServer.shutdown(); }
java
public static void main(final String... args) { System.out.println("starting server"); final Model model = new Model(); final SynchronizeFxServer syncFxServer = SynchronizeFxBuilder.create().server().model(model).callback(new ServerCallback() { @Override public void onError(final SynchronizeFXException exception) { System.err.println("Server Error:" + exception.getLocalizedMessage()); } @Override public void onClientConnectionError(final Object client, final SynchronizeFXException exception) { System.err.println("An exception in the communication to a client occurred." + exception); } }).build(); syncFxServer.start(); final Scanner console = new Scanner(System.in); boolean exit = false; while (!exit) { System.out.println("press 'q' for quit"); final String input = console.next(); if ("q".equals(input)) { exit = true; } } console.close(); syncFxServer.shutdown(); }
[ "public", "static", "void", "main", "(", "final", "String", "...", "args", ")", "{", "System", ".", "out", ".", "println", "(", "\"starting server\"", ")", ";", "final", "Model", "model", "=", "new", "Model", "(", ")", ";", "final", "SynchronizeFxServer", ...
The main entry point to the server application. @param args the CLI arguments.
[ "The", "main", "entry", "point", "to", "the", "server", "application", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/demos/sliderdemo/src/main/java/de/saxsys/synchronizefx/sliderdemo/server/ServerApp.java#L26-L64
train
quattor/pan
panc/src/main/java/org/quattor/pan/utils/TermFactory.java
TermFactory.checkNumericIndex
private static void checkNumericIndex(long index) { if (index > Integer.MAX_VALUE) { throw EvaluationException.create(MSG_INDEX_EXCEEDS_MAXIMUM, index, Integer.MAX_VALUE); } else if (index < Integer.MIN_VALUE) { throw EvaluationException.create(MSG_INDEX_BELOW_MINIMUM, index, Integer.MIN_VALUE); } }
java
private static void checkNumericIndex(long index) { if (index > Integer.MAX_VALUE) { throw EvaluationException.create(MSG_INDEX_EXCEEDS_MAXIMUM, index, Integer.MAX_VALUE); } else if (index < Integer.MIN_VALUE) { throw EvaluationException.create(MSG_INDEX_BELOW_MINIMUM, index, Integer.MIN_VALUE); } }
[ "private", "static", "void", "checkNumericIndex", "(", "long", "index", ")", "{", "if", "(", "index", ">", "Integer", ".", "MAX_VALUE", ")", "{", "throw", "EvaluationException", ".", "create", "(", "MSG_INDEX_EXCEEDS_MAXIMUM", ",", "index", ",", "Integer", "."...
An internal method to check that a numeric index is valid. It must be a non-negative integer. @param index @return validated index as an Integer
[ "An", "internal", "method", "to", "check", "that", "a", "numeric", "index", "is", "valid", ".", "It", "must", "be", "a", "non", "-", "negative", "integer", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/TermFactory.java#L85-L93
train
quattor/pan
panc/src/main/java/org/quattor/pan/utils/TermFactory.java
TermFactory.checkStringIndex
private static long[] checkStringIndex(String term) { assert (term != null); // If second element is < 0, this is a dict key long[] result = {0L, 1L}; // Empty strings are not allowed. if ("".equals(term)) { //$NON-NLS-1$ throw EvaluationException.create(MSG_KEY_CANNOT_BE_EMPTY_STRING); } if (isIndexPattern.matcher(term).matches()) { if (isIndexLeadingZerosPattern.matcher(term).matches()) { throw EvaluationException.create( MSG_INVALID_LEADING_ZEROS_INDEX, term); } else { // This is digits only, so try to convert it to a long. try { result[0] = Long.decode(term).longValue(); checkNumericIndex(result[0]); } catch (NumberFormatException nfe) { throw EvaluationException.create( MSG_KEY_CANNOT_BEGIN_WITH_DIGIT, term); } } } else if (isKeyPattern.matcher(term).matches()) { // Return a negative number to indicate that this is an OK key // value. result[1] = -1L; } else { // Doesn't work for either a key or index. throw EvaluationException.create(MSG_INVALID_KEY, term); } return result; }
java
private static long[] checkStringIndex(String term) { assert (term != null); // If second element is < 0, this is a dict key long[] result = {0L, 1L}; // Empty strings are not allowed. if ("".equals(term)) { //$NON-NLS-1$ throw EvaluationException.create(MSG_KEY_CANNOT_BE_EMPTY_STRING); } if (isIndexPattern.matcher(term).matches()) { if (isIndexLeadingZerosPattern.matcher(term).matches()) { throw EvaluationException.create( MSG_INVALID_LEADING_ZEROS_INDEX, term); } else { // This is digits only, so try to convert it to a long. try { result[0] = Long.decode(term).longValue(); checkNumericIndex(result[0]); } catch (NumberFormatException nfe) { throw EvaluationException.create( MSG_KEY_CANNOT_BEGIN_WITH_DIGIT, term); } } } else if (isKeyPattern.matcher(term).matches()) { // Return a negative number to indicate that this is an OK key // value. result[1] = -1L; } else { // Doesn't work for either a key or index. throw EvaluationException.create(MSG_INVALID_KEY, term); } return result; }
[ "private", "static", "long", "[", "]", "checkStringIndex", "(", "String", "term", ")", "{", "assert", "(", "term", "!=", "null", ")", ";", "// If second element is < 0, this is a dict key", "long", "[", "]", "result", "=", "{", "0L", ",", "1L", "}", ";", "...
An internal method to check that a string value is valid. It can either be an Integer or String which is returned. @param term @return validated term as Integer or String
[ "An", "internal", "method", "to", "check", "that", "a", "string", "value", "is", "valid", ".", "It", "can", "either", "be", "an", "Integer", "or", "String", "which", "is", "returned", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/TermFactory.java#L102-L141
train
quattor/pan
panc/src/main/java/org/quattor/pan/utils/TermFactory.java
TermFactory.create
public static Term create(String term) { Term res = createStringCache.get(term); if (res == null) { if (term != null && term.length() >= 2 && term.charAt(0) == '{' && term.charAt(term.length() - 1) == '}') { term = EscapeUtils.escape(term.substring(1, term.length() - 1)); } long[] value = checkStringIndex(term); if (value[1] < 0L) { res = (Term) StringProperty.getInstance(term); } else { res = (Term) create(value[0]); } createStringCache.put(term, res); } // no clone/copy needed for cached result return res; }
java
public static Term create(String term) { Term res = createStringCache.get(term); if (res == null) { if (term != null && term.length() >= 2 && term.charAt(0) == '{' && term.charAt(term.length() - 1) == '}') { term = EscapeUtils.escape(term.substring(1, term.length() - 1)); } long[] value = checkStringIndex(term); if (value[1] < 0L) { res = (Term) StringProperty.getInstance(term); } else { res = (Term) create(value[0]); } createStringCache.put(term, res); } // no clone/copy needed for cached result return res; }
[ "public", "static", "Term", "create", "(", "String", "term", ")", "{", "Term", "res", "=", "createStringCache", ".", "get", "(", "term", ")", ";", "if", "(", "res", "==", "null", ")", "{", "if", "(", "term", "!=", "null", "&&", "term", ".", "length...
Constructor of a path from a String. If the path does not have the correct syntax, an IllegalArgumentException will be thrown.
[ "Constructor", "of", "a", "path", "from", "a", "String", ".", "If", "the", "path", "does", "not", "have", "the", "correct", "syntax", "an", "IllegalArgumentException", "will", "be", "thrown", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/TermFactory.java#L147-L167
train
quattor/pan
panc/src/main/java/org/quattor/pan/utils/TermFactory.java
TermFactory.create
public static Term create(long index) { Term res = createLongCache.get(index); if (res == null) { checkNumericIndex(index); // Generate a new property. res = (Term) LongProperty.getInstance(index); createLongCache.put(index, res); return res; } // no clone/copy needed for cached result return res; }
java
public static Term create(long index) { Term res = createLongCache.get(index); if (res == null) { checkNumericIndex(index); // Generate a new property. res = (Term) LongProperty.getInstance(index); createLongCache.put(index, res); return res; } // no clone/copy needed for cached result return res; }
[ "public", "static", "Term", "create", "(", "long", "index", ")", "{", "Term", "res", "=", "createLongCache", ".", "get", "(", "index", ")", ";", "if", "(", "res", "==", "null", ")", "{", "checkNumericIndex", "(", "index", ")", ";", "// Generate a new pro...
Create a term directly from a long index. @param index the index to use for this term
[ "Create", "a", "term", "directly", "from", "a", "long", "index", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/TermFactory.java#L175-L188
train
quattor/pan
panc/src/main/java/org/quattor/pan/utils/TermFactory.java
TermFactory.create
public static Term create(Element element) { if (element instanceof StringProperty) { return create(((StringProperty) element).getValue()); } else if (element instanceof LongProperty) { return create(((LongProperty) element).getValue().longValue()); } else { throw EvaluationException.create(MSG_INVALID_ELEMENT_FOR_INDEX, element.getTypeAsString()); } }
java
public static Term create(Element element) { if (element instanceof StringProperty) { return create(((StringProperty) element).getValue()); } else if (element instanceof LongProperty) { return create(((LongProperty) element).getValue().longValue()); } else { throw EvaluationException.create(MSG_INVALID_ELEMENT_FOR_INDEX, element.getTypeAsString()); } }
[ "public", "static", "Term", "create", "(", "Element", "element", ")", "{", "if", "(", "element", "instanceof", "StringProperty", ")", "{", "return", "create", "(", "(", "(", "StringProperty", ")", "element", ")", ".", "getValue", "(", ")", ")", ";", "}",...
Create a term from a given element. @param element the element to create the term from
[ "Create", "a", "term", "from", "a", "given", "element", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/TermFactory.java#L196-L205
train
quattor/pan
panc/src/main/java/org/quattor/pan/utils/TermFactory.java
TermFactory.compare
public static int compare(Term self, Term other) { // Sanity check. if (self == null || other == null) { throw new NullPointerException(); } // Identical objects are always equal. if (self == other) { return 0; } // Easy case is when they are not the same type of term. if (self.isKey() != other.isKey()) { return (self.isKey()) ? 1 : -1; } // Compare the underlying values. try { if (self.isKey()) { return self.getKey().compareTo(other.getKey()); } else { return self.getIndex().compareTo(other.getIndex()); } } catch (InvalidTermException consumed) { // This statement can never be reached because both objects are // either keys or indexes. This try/catch block is only here to make // the compiler happy. assert (false); return 0; } }
java
public static int compare(Term self, Term other) { // Sanity check. if (self == null || other == null) { throw new NullPointerException(); } // Identical objects are always equal. if (self == other) { return 0; } // Easy case is when they are not the same type of term. if (self.isKey() != other.isKey()) { return (self.isKey()) ? 1 : -1; } // Compare the underlying values. try { if (self.isKey()) { return self.getKey().compareTo(other.getKey()); } else { return self.getIndex().compareTo(other.getIndex()); } } catch (InvalidTermException consumed) { // This statement can never be reached because both objects are // either keys or indexes. This try/catch block is only here to make // the compiler happy. assert (false); return 0; } }
[ "public", "static", "int", "compare", "(", "Term", "self", ",", "Term", "other", ")", "{", "// Sanity check.", "if", "(", "self", "==", "null", "||", "other", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "// Identic...
A utility method to allow the comparison of any two terms.
[ "A", "utility", "method", "to", "allow", "the", "comparison", "of", "any", "two", "terms", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/TermFactory.java#L210-L241
train
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/MetaModel.java
MetaModel.execute
public void execute(final List<Command> commands) { try { modelWalkingSynchronizer.doWhenModelWalkerFinished(ActionType.INCOMMING_COMMANDS, new Runnable() { @Override public void run() { for (Object command : commands) { execute(command); } } }); } catch (final SynchronizeFXException e) { topology.onError(e); } }
java
public void execute(final List<Command> commands) { try { modelWalkingSynchronizer.doWhenModelWalkerFinished(ActionType.INCOMMING_COMMANDS, new Runnable() { @Override public void run() { for (Object command : commands) { execute(command); } } }); } catch (final SynchronizeFXException e) { topology.onError(e); } }
[ "public", "void", "execute", "(", "final", "List", "<", "Command", ">", "commands", ")", "{", "try", "{", "modelWalkingSynchronizer", ".", "doWhenModelWalkerFinished", "(", "ActionType", ".", "INCOMMING_COMMANDS", ",", "new", "Runnable", "(", ")", "{", "@", "O...
Executes commands to change the domain model of the user. <p> This method is <em>not</em> Thread-safe. All callers must make sure that this method is called sequentially e.g by using a single-thread executor. The thread in which this method is called will also be used to execute changes on JavaFX properties so clients that have bound the GUI to properties of the domain model should make sure that this method is called in the JavaFX GUI thread. </p> <p> These commands have usually been created by an other instance of {@link MetaModel} in an other JVM which send them via {@link TopologyLayerCallback#sendCommands(List)} or produced them through {@link MetaModel#commandsForDomainModel(CommandsForDomainModelCallback)}. </p> @param commands The commands that should be executed.
[ "Executes", "commands", "to", "change", "the", "domain", "model", "of", "the", "user", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/MetaModel.java#L168-L181
train
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/MetaModel.java
MetaModel.commandsForDomainModel
public void commandsForDomainModel(final CommandsForDomainModelCallback callback) { if (this.root == null) { topology.onError( new SynchronizeFXException("Request to create necessary commands to reproduce the domain model " + " but the root object of the domain model is not set.")); return; } try { modelWalkingSynchronizer.startModelWalking(); creator.commandsForDomainModel(this.root, callback); modelWalkingSynchronizer.finishedModelWalking(); } catch (final SynchronizeFXException e) { topology.onError(e); } }
java
public void commandsForDomainModel(final CommandsForDomainModelCallback callback) { if (this.root == null) { topology.onError( new SynchronizeFXException("Request to create necessary commands to reproduce the domain model " + " but the root object of the domain model is not set.")); return; } try { modelWalkingSynchronizer.startModelWalking(); creator.commandsForDomainModel(this.root, callback); modelWalkingSynchronizer.finishedModelWalking(); } catch (final SynchronizeFXException e) { topology.onError(e); } }
[ "public", "void", "commandsForDomainModel", "(", "final", "CommandsForDomainModelCallback", "callback", ")", "{", "if", "(", "this", ".", "root", "==", "null", ")", "{", "topology", ".", "onError", "(", "new", "SynchronizeFXException", "(", "\"Request to create nece...
This method creates the commands necessary to reproduce the entire domain model. <p> The API of this method may looks a bit odd as the commands produced are returned via a callback instead of return but this is necessary to ensure that no updated are lost for newly connecting peers. </p> <p> Make sure that commands you receive via {@link TopologyLayerCallback#sendCommands(List)} are not send to the peer you've requested this initial set of commands for before your callback is called. Make also sure that future calls of {@link TopologyLayerCallback#sendCommands(List)} will send the changes to this new peer before your callback returns. </p> <p> It is guaranteed that your callback is only called once and that this call happens before {@link MetaModel#commandsForDomainModel(CommandsForDomainModelCallback)} returns. </p> @param callback The callback that takes the commands.
[ "This", "method", "creates", "the", "commands", "necessary", "to", "reproduce", "the", "entire", "domain", "model", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/MetaModel.java#L205-L219
train
saxsys/SynchronizeFX
transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SychronizeFXWebsocketServer.java
SychronizeFXWebsocketServer.shutDown
public void shutDown() { synchronized (channels) { isCurrentlyShutingDown = true; for (final SynchronizeFXWebsocketChannel server : channels.values()) { server.shutdown(); } servers.clear(); channels.clear(); clients.clear(); isCurrentlyShutingDown = false; } }
java
public void shutDown() { synchronized (channels) { isCurrentlyShutingDown = true; for (final SynchronizeFXWebsocketChannel server : channels.values()) { server.shutdown(); } servers.clear(); channels.clear(); clients.clear(); isCurrentlyShutingDown = false; } }
[ "public", "void", "shutDown", "(", ")", "{", "synchronized", "(", "channels", ")", "{", "isCurrentlyShutingDown", "=", "true", ";", "for", "(", "final", "SynchronizeFXWebsocketChannel", "server", ":", "channels", ".", "values", "(", ")", ")", "{", "server", ...
Shuts down this servers with all its channels and disconnects all remaining clients.
[ "Shuts", "down", "this", "servers", "with", "all", "its", "channels", "and", "disconnects", "all", "remaining", "clients", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SychronizeFXWebsocketServer.java#L215-L226
train
quattor/pan
panc/src/main/java/org/quattor/pan/Compiler.java
Compiler.ensureMinimumBuildThreadLimit
public void ensureMinimumBuildThreadLimit(int minLimit) { if (buildThreadLimit.get() < minLimit) { synchronized (buildThreadLock) { buildThreadLimit.set(minLimit); ThreadPoolExecutor buildExecutor = executors.get(TaskResult.ResultType.BUILD); // Must set both the maximum and the core limits. If the core is // not set, then the thread pool will not be forced to expand to // the minimum number of threads required. buildExecutor.setMaximumPoolSize(minLimit); buildExecutor.setCorePoolSize(minLimit); } } }
java
public void ensureMinimumBuildThreadLimit(int minLimit) { if (buildThreadLimit.get() < minLimit) { synchronized (buildThreadLock) { buildThreadLimit.set(minLimit); ThreadPoolExecutor buildExecutor = executors.get(TaskResult.ResultType.BUILD); // Must set both the maximum and the core limits. If the core is // not set, then the thread pool will not be forced to expand to // the minimum number of threads required. buildExecutor.setMaximumPoolSize(minLimit); buildExecutor.setCorePoolSize(minLimit); } } }
[ "public", "void", "ensureMinimumBuildThreadLimit", "(", "int", "minLimit", ")", "{", "if", "(", "buildThreadLimit", ".", "get", "(", ")", "<", "minLimit", ")", "{", "synchronized", "(", "buildThreadLock", ")", "{", "buildThreadLimit", ".", "set", "(", "minLimi...
Ensures that the number of threads in the build pool is at least as large as the number given. Because object templates can have dependencies on each other, it is possible to deadlock the compilation with a rigidly fixed build queue. To avoid this, allow the build queue limit to be increased. @param minLimit minimum build queue limit
[ "Ensures", "that", "the", "number", "of", "threads", "in", "the", "build", "pool", "is", "at", "least", "as", "large", "as", "the", "number", "given", ".", "Because", "object", "templates", "can", "have", "dependencies", "on", "each", "other", "it", "is", ...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/Compiler.java#L226-L239
train
quattor/pan
panc/src/main/java/org/quattor/pan/Compiler.java
Compiler.process
public synchronized CompilerResults process() { // Create the list to hold all of the exceptions. Set<Throwable> exceptions = new TreeSet<Throwable>(new ThrowableComparator()); long start = new Date().getTime(); stats.setFileCount(files.size()); // Trigger the compilation of the templates via the template cache. If // no building is going on, then the compile() method is used which // doesn't actually save the templates. This reduces drastically the // memory requirements. if (options.formatters.size() > 0) { for (File f : files) { ccache.retrieve(f.getAbsolutePath(), false); } } else { // FIXME: Determine if this does the correct thing (nothing) for a syntax check. for (File f : files) { if (!f.isAbsolute() && options.annotationBaseDirectory != null) { f = new File(options.annotationBaseDirectory, f.getPath()); } ccache.compile(f.getAbsolutePath()); } } // Now continually loop through the result queue until we have all // of the results. while (remainingTasks.get() > 0) { try { Future<? extends TaskResult> future = resultsQueue.take(); try { stats.incrementFinishedTasks(future.get().type); } catch (ExecutionException ee) { exceptions.add(ee.getCause()); } remainingTasks.decrementAndGet(); stats.updateMemoryInfo(); } catch (InterruptedException consumed) { } } // Shutdown the executors. In certain environments (e.g. eclipse) the // required "modifyThread" permission may not have been granted. Not // having this permission may cause a thread leak. try { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(new RuntimePermission("modifyThread")); } // We've got the correct permission, so tell all of the executors to // shutdown. for (TaskResult.ResultType t : TaskResult.ResultType.values()) { executors.get(t).shutdown(); } } catch (SecurityException se) { // Emit a warning about the missing permission. System.err.println("WARNING: missing modifyThread permission"); } // Finalize the statistics. long end = new Date().getTime(); stats.setBuildTime(end - start); return new CompilerResults(stats, exceptions); }
java
public synchronized CompilerResults process() { // Create the list to hold all of the exceptions. Set<Throwable> exceptions = new TreeSet<Throwable>(new ThrowableComparator()); long start = new Date().getTime(); stats.setFileCount(files.size()); // Trigger the compilation of the templates via the template cache. If // no building is going on, then the compile() method is used which // doesn't actually save the templates. This reduces drastically the // memory requirements. if (options.formatters.size() > 0) { for (File f : files) { ccache.retrieve(f.getAbsolutePath(), false); } } else { // FIXME: Determine if this does the correct thing (nothing) for a syntax check. for (File f : files) { if (!f.isAbsolute() && options.annotationBaseDirectory != null) { f = new File(options.annotationBaseDirectory, f.getPath()); } ccache.compile(f.getAbsolutePath()); } } // Now continually loop through the result queue until we have all // of the results. while (remainingTasks.get() > 0) { try { Future<? extends TaskResult> future = resultsQueue.take(); try { stats.incrementFinishedTasks(future.get().type); } catch (ExecutionException ee) { exceptions.add(ee.getCause()); } remainingTasks.decrementAndGet(); stats.updateMemoryInfo(); } catch (InterruptedException consumed) { } } // Shutdown the executors. In certain environments (e.g. eclipse) the // required "modifyThread" permission may not have been granted. Not // having this permission may cause a thread leak. try { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(new RuntimePermission("modifyThread")); } // We've got the correct permission, so tell all of the executors to // shutdown. for (TaskResult.ResultType t : TaskResult.ResultType.values()) { executors.get(t).shutdown(); } } catch (SecurityException se) { // Emit a warning about the missing permission. System.err.println("WARNING: missing modifyThread permission"); } // Finalize the statistics. long end = new Date().getTime(); stats.setBuildTime(end - start); return new CompilerResults(stats, exceptions); }
[ "public", "synchronized", "CompilerResults", "process", "(", ")", "{", "// Create the list to hold all of the exceptions.", "Set", "<", "Throwable", ">", "exceptions", "=", "new", "TreeSet", "<", "Throwable", ">", "(", "new", "ThrowableComparator", "(", ")", ")", ";...
Process the templates referenced by the CompilerOptions object used to initialize this instance. This will run through the complete compiling, building, and validation stages as requested. This method should only be invoked once per instance. @return the statistics of the compilation and any exceptions which were thrown
[ "Process", "the", "templates", "referenced", "by", "the", "CompilerOptions", "object", "used", "to", "initialize", "this", "instance", ".", "This", "will", "run", "through", "the", "complete", "compiling", "building", "and", "validation", "stages", "as", "requeste...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/Compiler.java#L248-L318
train
quattor/pan
panc/src/main/java/org/quattor/pan/Compiler.java
Compiler.submit
public void submit(Task<? extends TaskResult> task) { // Increment the counter which indicates the number of results to // expect. This must be done BEFORE actually submitting the task for // execution. remainingTasks.incrementAndGet(); // Increment the statistics and put the task on the correct queue. stats.incrementStartedTasks(task.resultType); executors.get(task.resultType).submit(task); // Make sure that the task gets added to the results queue. resultsQueue.add(task); stats.updateMemoryInfo(); }
java
public void submit(Task<? extends TaskResult> task) { // Increment the counter which indicates the number of results to // expect. This must be done BEFORE actually submitting the task for // execution. remainingTasks.incrementAndGet(); // Increment the statistics and put the task on the correct queue. stats.incrementStartedTasks(task.resultType); executors.get(task.resultType).submit(task); // Make sure that the task gets added to the results queue. resultsQueue.add(task); stats.updateMemoryInfo(); }
[ "public", "void", "submit", "(", "Task", "<", "?", "extends", "TaskResult", ">", "task", ")", "{", "// Increment the counter which indicates the number of results to", "// expect. This must be done BEFORE actually submitting the task for", "// execution.", "remainingTasks", ".", ...
Submits a task to one of the compiler's task queues for processing. Although public, this method should only be called by tasks started by the compiler itself. @param task task to run on one of the compiler's task queues
[ "Submits", "a", "task", "to", "one", "of", "the", "compiler", "s", "task", "queues", "for", "processing", ".", "Although", "public", "this", "method", "should", "only", "be", "called", "by", "tasks", "started", "by", "the", "compiler", "itself", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/Compiler.java#L357-L371
train
saxsys/SynchronizeFX
transmitter/netty-transmitter/src/main/java/de/saxsys/synchronizefx/netty/base/NonValidatingSSLEngineFactory.java
NonValidatingSSLEngineFactory.createEngine
public static SSLEngine createEngine(final boolean clientMode) { if (context == null) { context = createContext(); } SSLEngine engine = context.createSSLEngine(); engine.setUseClientMode(clientMode); return engine; }
java
public static SSLEngine createEngine(final boolean clientMode) { if (context == null) { context = createContext(); } SSLEngine engine = context.createSSLEngine(); engine.setUseClientMode(clientMode); return engine; }
[ "public", "static", "SSLEngine", "createEngine", "(", "final", "boolean", "clientMode", ")", "{", "if", "(", "context", "==", "null", ")", "{", "context", "=", "createContext", "(", ")", ";", "}", "SSLEngine", "engine", "=", "context", ".", "createSSLEngine"...
Creates a new engine for TLS communication in client or server mode. @param clientMode if <code>true</code> a client engine is created, if <code>false</code> a server engine. @return The new engine
[ "Creates", "a", "new", "engine", "for", "TLS", "communication", "in", "client", "or", "server", "mode", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/netty-transmitter/src/main/java/de/saxsys/synchronizefx/netty/base/NonValidatingSSLEngineFactory.java#L81-L88
train
quattor/pan
panc/src/main/java/org/quattor/pan/output/PanTxtFormatter.java
PanTxtFormatter.readChild
public void readChild(Element element, PrintWriter ps, int level, String name) { String nbTab = tabMaker(level); if (element instanceof Resource) { Resource resource = (Resource) element; writeBegin(ps, nbTab, name, level, element.getTypeAsString()); for (Resource.Entry entry : resource) { Property key = entry.getKey(); Element value = entry.getValue(); level++; readChild(value, ps, level, key.toString()); level--; } writeEnd(ps, nbTab, element.getTypeAsString()); } else { Property elem = (Property) element; writeProperties(ps, nbTab, name, element.getTypeAsString(), elem.toString()); } }
java
public void readChild(Element element, PrintWriter ps, int level, String name) { String nbTab = tabMaker(level); if (element instanceof Resource) { Resource resource = (Resource) element; writeBegin(ps, nbTab, name, level, element.getTypeAsString()); for (Resource.Entry entry : resource) { Property key = entry.getKey(); Element value = entry.getValue(); level++; readChild(value, ps, level, key.toString()); level--; } writeEnd(ps, nbTab, element.getTypeAsString()); } else { Property elem = (Property) element; writeProperties(ps, nbTab, name, element.getTypeAsString(), elem.toString()); } }
[ "public", "void", "readChild", "(", "Element", "element", ",", "PrintWriter", "ps", ",", "int", "level", ",", "String", "name", ")", "{", "String", "nbTab", "=", "tabMaker", "(", "level", ")", ";", "if", "(", "element", "instanceof", "Resource", ")", "{"...
Reads each child. @param element element to treat @param ps PrintWriter @param level Level of the node in the tree @param name name of the element
[ "Reads", "each", "child", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/output/PanTxtFormatter.java#L61-L86
train
quattor/pan
panc/src/main/java/org/quattor/pan/output/PanTxtFormatter.java
PanTxtFormatter.tabMaker
public String tabMaker(int n) { StringBuilder buf = new StringBuilder(""); for (int i = 1; i <= n; i++) { buf.append(" "); } String tab = buf.toString(); return tab; }
java
public String tabMaker(int n) { StringBuilder buf = new StringBuilder(""); for (int i = 1; i <= n; i++) { buf.append(" "); } String tab = buf.toString(); return tab; }
[ "public", "String", "tabMaker", "(", "int", "n", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "\"\"", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "n", ";", "i", "++", ")", "{", "buf", ".", "append", "(", "...
Calculates the number of tabulations to write at the beginning of a line @param n number of tabulations @return string with the given number of 'spaced' tabs
[ "Calculates", "the", "number", "of", "tabulations", "to", "write", "at", "the", "beginning", "of", "a", "line" ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/output/PanTxtFormatter.java#L141-L149
train
quattor/pan
panc/src/main/java/org/quattor/pan/ttemplate/LocalVariableMap.java
LocalVariableMap.put
public Element put(String name, Element value) { assert (name != null); Element oldValue = null; if (value != null) { // Set the value and ensure that the replacement can be done. oldValue = map.put(name, value); if (oldValue != null) { oldValue.checkValidReplacement(value); } } else { // Remove the referenced variable. oldValue = map.remove(name); } return oldValue; }
java
public Element put(String name, Element value) { assert (name != null); Element oldValue = null; if (value != null) { // Set the value and ensure that the replacement can be done. oldValue = map.put(name, value); if (oldValue != null) { oldValue.checkValidReplacement(value); } } else { // Remove the referenced variable. oldValue = map.remove(name); } return oldValue; }
[ "public", "Element", "put", "(", "String", "name", ",", "Element", "value", ")", "{", "assert", "(", "name", "!=", "null", ")", ";", "Element", "oldValue", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "// Set the value and ensure that the ...
Assign the value to the given variable name. If the value is null, then the variable is undefined. If an old value existed, then this method will check that the new value is a valid replacement for the old one. If not, an exception will be thrown. @param name variable name to assign value to @param value Element to assign to the given variable name; variable is removed if the value is null @return old value of the named variable or null if it wasn't defined
[ "Assign", "the", "value", "to", "the", "given", "variable", "name", ".", "If", "the", "value", "is", "null", "then", "the", "variable", "is", "undefined", ".", "If", "an", "old", "value", "existed", "then", "this", "method", "will", "check", "that", "the...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/LocalVariableMap.java#L74-L95
train
tvbarthel/Cheerleader
sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/PickActivity.java
PickActivity.checkField
private boolean checkField(EditText editText) { boolean valid = true; if (TextUtils.isEmpty(editText.getText())) { editText.startAnimation(mWiggle); editText.requestFocus(); valid = false; } return valid; }
java
private boolean checkField(EditText editText) { boolean valid = true; if (TextUtils.isEmpty(editText.getText())) { editText.startAnimation(mWiggle); editText.requestFocus(); valid = false; } return valid; }
[ "private", "boolean", "checkField", "(", "EditText", "editText", ")", "{", "boolean", "valid", "=", "true", ";", "if", "(", "TextUtils", ".", "isEmpty", "(", "editText", ".", "getText", "(", ")", ")", ")", "{", "editText", ".", "startAnimation", "(", "mW...
Check if the edit text is valid or not. @param editText field to check. @return true if the edit text isn't empty
[ "Check", "if", "the", "edit", "text", "is", "valid", "or", "not", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/PickActivity.java#L70-L78
train
quattor/pan
panc/src/main/java/org/quattor/pan/dml/data/ListResource.java
ListResource.put
public Element put(int index, Element newValue) { Element oldValue = null; int size = list.size(); if (index < 0) { if (index < -size) { // negative indices do not auto-prepend // (asopposed to positive ones that grow the list by appending undef) throw new EvaluationException(MessageUtils.format( MSG_INVALID_NEGATIVE_LIST_INDEX, Integer.toString(index), size)); } else { index += size; } } try { if ((newValue != null) && !(newValue instanceof Null)) { if (index >= size) { for (int i = 0; i < index - size; i++) { list.add(Undef.VALUE); } list.add(newValue); } else { oldValue = list.set(index, newValue); if (oldValue != null) { oldValue.checkValidReplacement(newValue); } } } else { try { oldValue = list.remove(index); } catch (IndexOutOfBoundsException ioobe) { // Ignore this error; removing non-existant element is OK. } } } catch (IndexOutOfBoundsException ioobe) { throw new EvaluationException(MessageUtils.format( MSG_NONEXISTANT_LIST_ELEMENT, Integer.toString(index))); } return oldValue; }
java
public Element put(int index, Element newValue) { Element oldValue = null; int size = list.size(); if (index < 0) { if (index < -size) { // negative indices do not auto-prepend // (asopposed to positive ones that grow the list by appending undef) throw new EvaluationException(MessageUtils.format( MSG_INVALID_NEGATIVE_LIST_INDEX, Integer.toString(index), size)); } else { index += size; } } try { if ((newValue != null) && !(newValue instanceof Null)) { if (index >= size) { for (int i = 0; i < index - size; i++) { list.add(Undef.VALUE); } list.add(newValue); } else { oldValue = list.set(index, newValue); if (oldValue != null) { oldValue.checkValidReplacement(newValue); } } } else { try { oldValue = list.remove(index); } catch (IndexOutOfBoundsException ioobe) { // Ignore this error; removing non-existant element is OK. } } } catch (IndexOutOfBoundsException ioobe) { throw new EvaluationException(MessageUtils.format( MSG_NONEXISTANT_LIST_ELEMENT, Integer.toString(index))); } return oldValue; }
[ "public", "Element", "put", "(", "int", "index", ",", "Element", "newValue", ")", "{", "Element", "oldValue", "=", "null", ";", "int", "size", "=", "list", ".", "size", "(", ")", ";", "if", "(", "index", "<", "0", ")", "{", "if", "(", "index", "<...
This is an optimized version of the put method which doesn't require creating a Term object. @param index index of the element to insert @param newValue value to insert into the list @return old value if it existed
[ "This", "is", "an", "optimized", "version", "of", "the", "put", "method", "which", "doesn", "t", "require", "creating", "a", "Term", "object", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/data/ListResource.java#L140-L182
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java
PlayerPlaylist.getCurrentTrack
public SoundCloudTrack getCurrentTrack() { if (mCurrentTrackIndex > -1 && mCurrentTrackIndex < mSoundCloudPlaylist.getTracks().size()) { return mSoundCloudPlaylist.getTracks().get(mCurrentTrackIndex); } return null; }
java
public SoundCloudTrack getCurrentTrack() { if (mCurrentTrackIndex > -1 && mCurrentTrackIndex < mSoundCloudPlaylist.getTracks().size()) { return mSoundCloudPlaylist.getTracks().get(mCurrentTrackIndex); } return null; }
[ "public", "SoundCloudTrack", "getCurrentTrack", "(", ")", "{", "if", "(", "mCurrentTrackIndex", ">", "-", "1", "&&", "mCurrentTrackIndex", "<", "mSoundCloudPlaylist", ".", "getTracks", "(", ")", ".", "size", "(", ")", ")", "{", "return", "mSoundCloudPlaylist", ...
Return the current track. @return current track or null if none has been added to the player playlist.
[ "Return", "the", "current", "track", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java#L63-L68
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java
PlayerPlaylist.addAll
public void addAll(List<SoundCloudTrack> tracks) { for (SoundCloudTrack track : tracks) { add(mSoundCloudPlaylist.getTracks().size(), track); } }
java
public void addAll(List<SoundCloudTrack> tracks) { for (SoundCloudTrack track : tracks) { add(mSoundCloudPlaylist.getTracks().size(), track); } }
[ "public", "void", "addAll", "(", "List", "<", "SoundCloudTrack", ">", "tracks", ")", "{", "for", "(", "SoundCloudTrack", "track", ":", "tracks", ")", "{", "add", "(", "mSoundCloudPlaylist", ".", "getTracks", "(", ")", ".", "size", "(", ")", ",", "track",...
Add all tracks at the end of the playlist. @param tracks tracks to add.
[ "Add", "all", "tracks", "at", "the", "end", "of", "the", "playlist", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java#L93-L97
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java
PlayerPlaylist.add
public void add(int position, SoundCloudTrack track) { if (mCurrentTrackIndex == -1) { mCurrentTrackIndex = 0; } mSoundCloudPlaylist.addTrack(position, track); }
java
public void add(int position, SoundCloudTrack track) { if (mCurrentTrackIndex == -1) { mCurrentTrackIndex = 0; } mSoundCloudPlaylist.addTrack(position, track); }
[ "public", "void", "add", "(", "int", "position", ",", "SoundCloudTrack", "track", ")", "{", "if", "(", "mCurrentTrackIndex", "==", "-", "1", ")", "{", "mCurrentTrackIndex", "=", "0", ";", "}", "mSoundCloudPlaylist", ".", "addTrack", "(", "position", ",", "...
Add a track to the given position. @param position position of the track to insert @param track track to insert.
[ "Add", "a", "track", "to", "the", "given", "position", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java#L105-L110
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java
PlayerPlaylist.next
public SoundCloudTrack next() { mCurrentTrackIndex = (mCurrentTrackIndex + 1) % mSoundCloudPlaylist.getTracks().size(); return mSoundCloudPlaylist.getTracks().get(mCurrentTrackIndex); }
java
public SoundCloudTrack next() { mCurrentTrackIndex = (mCurrentTrackIndex + 1) % mSoundCloudPlaylist.getTracks().size(); return mSoundCloudPlaylist.getTracks().get(mCurrentTrackIndex); }
[ "public", "SoundCloudTrack", "next", "(", ")", "{", "mCurrentTrackIndex", "=", "(", "mCurrentTrackIndex", "+", "1", ")", "%", "mSoundCloudPlaylist", ".", "getTracks", "(", ")", ".", "size", "(", ")", ";", "return", "mSoundCloudPlaylist", ".", "getTracks", "(",...
Retrieve the next track. @return next track to be played.
[ "Retrieve", "the", "next", "track", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java#L149-L152
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java
PlayerPlaylist.previous
public SoundCloudTrack previous() { int tracks = mSoundCloudPlaylist.getTracks().size(); mCurrentTrackIndex = (tracks + mCurrentTrackIndex - 1) % tracks; return mSoundCloudPlaylist.getTracks().get(mCurrentTrackIndex); }
java
public SoundCloudTrack previous() { int tracks = mSoundCloudPlaylist.getTracks().size(); mCurrentTrackIndex = (tracks + mCurrentTrackIndex - 1) % tracks; return mSoundCloudPlaylist.getTracks().get(mCurrentTrackIndex); }
[ "public", "SoundCloudTrack", "previous", "(", ")", "{", "int", "tracks", "=", "mSoundCloudPlaylist", ".", "getTracks", "(", ")", ".", "size", "(", ")", ";", "mCurrentTrackIndex", "=", "(", "tracks", "+", "mCurrentTrackIndex", "-", "1", ")", "%", "tracks", ...
Retrieve the previous track. @return previous track to be played.
[ "Retrieve", "the", "previous", "track", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java#L159-L163
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java
PlayerPlaylist.setPlayingTrack
void setPlayingTrack(int playingTrackPosition) { if (playingTrackPosition < 0 || playingTrackPosition >= mSoundCloudPlaylist.getTracks().size()) { throw new IllegalArgumentException("No tracks a the position " + playingTrackPosition); } mCurrentTrackIndex = playingTrackPosition; }
java
void setPlayingTrack(int playingTrackPosition) { if (playingTrackPosition < 0 || playingTrackPosition >= mSoundCloudPlaylist.getTracks().size()) { throw new IllegalArgumentException("No tracks a the position " + playingTrackPosition); } mCurrentTrackIndex = playingTrackPosition; }
[ "void", "setPlayingTrack", "(", "int", "playingTrackPosition", ")", "{", "if", "(", "playingTrackPosition", "<", "0", "||", "playingTrackPosition", ">=", "mSoundCloudPlaylist", ".", "getTracks", "(", ")", ".", "size", "(", ")", ")", "{", "throw", "new", "Illeg...
Allow to set the current playing song index. private package. @param playingTrackPosition current playing song index.
[ "Allow", "to", "set", "the", "current", "playing", "song", "index", ".", "private", "package", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlayerPlaylist.java#L190-L195
train
saxsys/SynchronizeFX
transmitter/tomcat-transmitter/src/main/java/de/saxsys/synchronizefx/tomcat/SynchronizeFXTomcatServlet.java
SynchronizeFXTomcatServlet.getChannelName
protected String getChannelName(final HttpServletRequest request) { final String path = request.getPathInfo(); return path == null ? "" : path.startsWith("/") ? path.substring(1) : path; }
java
protected String getChannelName(final HttpServletRequest request) { final String path = request.getPathInfo(); return path == null ? "" : path.startsWith("/") ? path.substring(1) : path; }
[ "protected", "String", "getChannelName", "(", "final", "HttpServletRequest", "request", ")", "{", "final", "String", "path", "=", "request", ".", "getPathInfo", "(", ")", ";", "return", "path", "==", "null", "?", "\"\"", ":", "path", ".", "startsWith", "(", ...
Extracts the name of the channel the client that invoked a request wants to connect to. @param request The request to connect to a channel. @return The channel that the client want's to connect to. It is irrelevant if this channel does or does not exist.
[ "Extracts", "the", "name", "of", "the", "channel", "the", "client", "that", "invoked", "a", "request", "wants", "to", "connect", "to", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/tomcat-transmitter/src/main/java/de/saxsys/synchronizefx/tomcat/SynchronizeFXTomcatServlet.java#L132-L135
train
saxsys/SynchronizeFX
transmitter/tomcat-transmitter/src/main/java/de/saxsys/synchronizefx/tomcat/SynchronizeFXTomcatServlet.java
SynchronizeFXTomcatServlet.destroy
@Override public void destroy() { synchronized (channels) { isCurrentlyShutingDown = true; for (final SynchronizeFXTomcatChannel server : channels.values()) { server.shutdown(); } servers.clear(); channels.clear(); isCurrentlyShutingDown = false; } }
java
@Override public void destroy() { synchronized (channels) { isCurrentlyShutingDown = true; for (final SynchronizeFXTomcatChannel server : channels.values()) { server.shutdown(); } servers.clear(); channels.clear(); isCurrentlyShutingDown = false; } }
[ "@", "Override", "public", "void", "destroy", "(", ")", "{", "synchronized", "(", "channels", ")", "{", "isCurrentlyShutingDown", "=", "true", ";", "for", "(", "final", "SynchronizeFXTomcatChannel", "server", ":", "channels", ".", "values", "(", ")", ")", "{...
Disconnect all clients an clear the connections when the handler is destroyed by CDI.
[ "Disconnect", "all", "clients", "an", "clear", "the", "connections", "when", "the", "handler", "is", "destroyed", "by", "CDI", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/tomcat-transmitter/src/main/java/de/saxsys/synchronizefx/tomcat/SynchronizeFXTomcatServlet.java#L142-L154
train
saxsys/SynchronizeFX
kryo-serializer/src/main/java/de/saxsys/synchronizefx/kryo/KryoSerializer.java
KryoSerializer.registerSerializableClass
public <T> void registerSerializableClass(final Class<T> clazz, final Serializer<T> serializer) { kryo.registerSerializableClass(clazz, serializer); }
java
public <T> void registerSerializableClass(final Class<T> clazz, final Serializer<T> serializer) { kryo.registerSerializableClass(clazz, serializer); }
[ "public", "<", "T", ">", "void", "registerSerializableClass", "(", "final", "Class", "<", "T", ">", "clazz", ",", "final", "Serializer", "<", "T", ">", "serializer", ")", "{", "kryo", ".", "registerSerializableClass", "(", "clazz", ",", "serializer", ")", ...
Registers a class that may be send over the network. Use this method only before the first invocation of either {@link KryoSerializer#serialize(List)} or {@link KryoSerializer#deserialize(byte[])}. If you invoke it after these methods it is not guaranteed that the {@link Kryo} used by these methods will actually use your serializers. @param clazz The class that's maybe send. @param serializer An optional serializer for this class. If it's null than the default serialization of kryo is used. @param <T> see clazz parameter.
[ "Registers", "a", "class", "that", "may", "be", "send", "over", "the", "network", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/kryo-serializer/src/main/java/de/saxsys/synchronizefx/kryo/KryoSerializer.java#L52-L54
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java
NotificationManager.getInstance
public static NotificationManager getInstance(Context context) { if (sInstance == null) { sInstance = new NotificationManager(context); } return sInstance; }
java
public static NotificationManager getInstance(Context context) { if (sInstance == null) { sInstance = new NotificationManager(context); } return sInstance; }
[ "public", "static", "NotificationManager", "getInstance", "(", "Context", "context", ")", "{", "if", "(", "sInstance", "==", "null", ")", "{", "sInstance", "=", "new", "NotificationManager", "(", "context", ")", ";", "}", "return", "sInstance", ";", "}" ]
Encapsulate player notification behaviour. @param context context used to instantiate internal component. @return unique instance of the notification manager.
[ "Encapsulate", "player", "notification", "behaviour", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java#L171-L176
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java
NotificationManager.initializeArtworkTarget
private void initializeArtworkTarget() { mThumbnailArtworkTarget = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { mNotificationView.setImageViewBitmap( R.id.simple_sound_cloud_notification_thumbnail, bitmap); mNotificationExpandedView.setImageViewBitmap( R.id.simple_sound_cloud_notification_thumbnail, bitmap); mNotificationManager.notify(NOTIFICATION_ID, buildNotification()); } @Override public void onBitmapFailed(Drawable errorDrawable) { } @Override public void onPrepareLoad(Drawable placeHolderDrawable) { } }; }
java
private void initializeArtworkTarget() { mThumbnailArtworkTarget = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { mNotificationView.setImageViewBitmap( R.id.simple_sound_cloud_notification_thumbnail, bitmap); mNotificationExpandedView.setImageViewBitmap( R.id.simple_sound_cloud_notification_thumbnail, bitmap); mNotificationManager.notify(NOTIFICATION_ID, buildNotification()); } @Override public void onBitmapFailed(Drawable errorDrawable) { } @Override public void onPrepareLoad(Drawable placeHolderDrawable) { } }; }
[ "private", "void", "initializeArtworkTarget", "(", ")", "{", "mThumbnailArtworkTarget", "=", "new", "Target", "(", ")", "{", "@", "Override", "public", "void", "onBitmapLoaded", "(", "Bitmap", "bitmap", ",", "Picasso", ".", "LoadedFrom", "from", ")", "{", "mNo...
Initialize target used to load artwork asynchronously.
[ "Initialize", "target", "used", "to", "load", "artwork", "asynchronously", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java#L286-L306
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java
NotificationManager.initNotificationBuilder
private void initNotificationBuilder(Context context) { // inti builder. mNotificationBuilder = new NotificationCompat.Builder(context); mNotificationView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification); mNotificationExpandedView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification_expanded); // add right icon on Lollipop. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addSmallIcon(mNotificationView); addSmallIcon(mNotificationExpandedView); } // set pending intents mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); // add icon for action bar. mNotificationBuilder.setSmallIcon(mNotificationConfig.getNotificationIcon()); // set the remote view. mNotificationBuilder.setContent(mNotificationView); // set the notification priority. mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_HIGH); mNotificationBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle()); // set the content intent. Class<?> playerActivity = mNotificationConfig.getNotificationActivity(); if (playerActivity != null) { Intent i = new Intent(context, playerActivity); PendingIntent contentIntent = PendingIntent.getActivity(context, REQUEST_DISPLAYING_CONTROLLER, i, PendingIntent.FLAG_UPDATE_CURRENT); mNotificationBuilder.setContentIntent(contentIntent); } }
java
private void initNotificationBuilder(Context context) { // inti builder. mNotificationBuilder = new NotificationCompat.Builder(context); mNotificationView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification); mNotificationExpandedView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification_expanded); // add right icon on Lollipop. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addSmallIcon(mNotificationView); addSmallIcon(mNotificationExpandedView); } // set pending intents mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); // add icon for action bar. mNotificationBuilder.setSmallIcon(mNotificationConfig.getNotificationIcon()); // set the remote view. mNotificationBuilder.setContent(mNotificationView); // set the notification priority. mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_HIGH); mNotificationBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle()); // set the content intent. Class<?> playerActivity = mNotificationConfig.getNotificationActivity(); if (playerActivity != null) { Intent i = new Intent(context, playerActivity); PendingIntent contentIntent = PendingIntent.getActivity(context, REQUEST_DISPLAYING_CONTROLLER, i, PendingIntent.FLAG_UPDATE_CURRENT); mNotificationBuilder.setContentIntent(contentIntent); } }
[ "private", "void", "initNotificationBuilder", "(", "Context", "context", ")", "{", "// inti builder.", "mNotificationBuilder", "=", "new", "NotificationCompat", ".", "Builder", "(", "context", ")", ";", "mNotificationView", "=", "new", "RemoteViews", "(", "context", ...
Init all static components of the notification. @param context context used to instantiate the builder.
[ "Init", "all", "static", "components", "of", "the", "notification", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java#L313-L365
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java
NotificationManager.addSmallIcon
private void addSmallIcon(RemoteViews notificationView) { notificationView.setInt(R.id.simple_sound_cloud_notification_icon, "setBackgroundResource", mNotificationConfig.getNotificationIconBackground()); notificationView.setImageViewResource(R.id.simple_sound_cloud_notification_icon, mNotificationConfig.getNotificationIcon()); }
java
private void addSmallIcon(RemoteViews notificationView) { notificationView.setInt(R.id.simple_sound_cloud_notification_icon, "setBackgroundResource", mNotificationConfig.getNotificationIconBackground()); notificationView.setImageViewResource(R.id.simple_sound_cloud_notification_icon, mNotificationConfig.getNotificationIcon()); }
[ "private", "void", "addSmallIcon", "(", "RemoteViews", "notificationView", ")", "{", "notificationView", ".", "setInt", "(", "R", ".", "id", ".", "simple_sound_cloud_notification_icon", ",", "\"setBackgroundResource\"", ",", "mNotificationConfig", ".", "getNotificationIco...
Add the small right icon for Lollipop device. @param notificationView remotesview used in the notification.
[ "Add", "the", "small", "right", "icon", "for", "Lollipop", "device", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java#L385-L390
train
quattor/pan
panc/src/main/java/org/quattor/pan/ttemplate/Template.java
Template.isValidTemplateName
static public boolean isValidTemplateName(String name) { // First do the easy check to make sure that the string isn't empty and // contains only valid characters. if (!validTemplateNameChars.matcher(name).matches()) { return false; } // Split the string on slashes and ensure that each one of the terms is // valid. Cannot be empty or start with a period. (Above check already // guarantees that only allowed characters are in the string.) for (String t : name.split("/")) { if ("".equals(t) || t.startsWith(".")) { return false; } } // If we make it to this point, then the string has passed all of the // checks and is valid. return true; }
java
static public boolean isValidTemplateName(String name) { // First do the easy check to make sure that the string isn't empty and // contains only valid characters. if (!validTemplateNameChars.matcher(name).matches()) { return false; } // Split the string on slashes and ensure that each one of the terms is // valid. Cannot be empty or start with a period. (Above check already // guarantees that only allowed characters are in the string.) for (String t : name.split("/")) { if ("".equals(t) || t.startsWith(".")) { return false; } } // If we make it to this point, then the string has passed all of the // checks and is valid. return true; }
[ "static", "public", "boolean", "isValidTemplateName", "(", "String", "name", ")", "{", "// First do the easy check to make sure that the string isn't empty and", "// contains only valid characters.", "if", "(", "!", "validTemplateNameChars", ".", "matcher", "(", "name", ")", ...
Check to see if the given name is a valid template name. Valid template names may include only letters, digits, underscores, hyphens, periods, pluses, and slashes. In addition, each term when split by slashes must not be empty and must not start with a period. The second case excludes potential hidden files and special names like "." and "..". @param name template name to check for validity @return boolean value indicating if the given name is a valid template name
[ "Check", "to", "see", "if", "the", "given", "name", "is", "a", "valid", "template", "name", ".", "Valid", "template", "names", "may", "include", "only", "letters", "digits", "underscores", "hyphens", "periods", "pluses", "and", "slashes", ".", "In", "additio...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/Template.java#L361-L381
train
quattor/pan
panc/src/main/java/org/quattor/pan/ttemplate/Template.java
Template.execute
public Object execute(Context context, boolean runStatic) { for (Statement s : ((runStatic) ? staticStatements : normalStatements)) { s.execute(context); } return null; }
java
public Object execute(Context context, boolean runStatic) { for (Statement s : ((runStatic) ? staticStatements : normalStatements)) { s.execute(context); } return null; }
[ "public", "Object", "execute", "(", "Context", "context", ",", "boolean", "runStatic", ")", "{", "for", "(", "Statement", "s", ":", "(", "(", "runStatic", ")", "?", "staticStatements", ":", "normalStatements", ")", ")", "{", "s", ".", "execute", "(", "co...
Execute each of the statements in turn. @param context context for the evaluation of the template @param runStatic flag which indicates whether to run the static statements or not
[ "Execute", "each", "of", "the", "statements", "in", "turn", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/Template.java#L411-L416
train
quattor/pan
panc/src/main/java/org/quattor/pan/ttemplate/Template.java
Template.checkValidInclude
public static boolean checkValidInclude(TemplateType includeeType, TemplateType includedType) { return allowedIncludes[includeeType.ordinal()][includedType.ordinal()]; }
java
public static boolean checkValidInclude(TemplateType includeeType, TemplateType includedType) { return allowedIncludes[includeeType.ordinal()][includedType.ordinal()]; }
[ "public", "static", "boolean", "checkValidInclude", "(", "TemplateType", "includeeType", ",", "TemplateType", "includedType", ")", "{", "return", "allowedIncludes", "[", "includeeType", ".", "ordinal", "(", ")", "]", "[", "includedType", ".", "ordinal", "(", ")", ...
Determine whether a particular include combination is legal. @param includeeType type of the template that is including another one @param includedType type of the included template @return flag indicating whether this is a legal combination
[ "Determine", "whether", "a", "particular", "include", "combination", "is", "legal", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/Template.java#L428-L431
train
quattor/pan
panc/src/main/java/org/quattor/pan/ttemplate/Template.java
Template.templateNameVerification
public void templateNameVerification(String expectedName) throws SyntaxException { if (!name.equals(expectedName)) { throw SyntaxException.create(null, source, MSG_MISNAMED_TPL, expectedName); } }
java
public void templateNameVerification(String expectedName) throws SyntaxException { if (!name.equals(expectedName)) { throw SyntaxException.create(null, source, MSG_MISNAMED_TPL, expectedName); } }
[ "public", "void", "templateNameVerification", "(", "String", "expectedName", ")", "throws", "SyntaxException", "{", "if", "(", "!", "name", ".", "equals", "(", "expectedName", ")", ")", "{", "throw", "SyntaxException", ".", "create", "(", "null", ",", "source"...
Check that the internal template name matches the expected template name. @param expectedName expected name of the compiled template
[ "Check", "that", "the", "internal", "template", "name", "matches", "the", "expected", "template", "name", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/Template.java#L439-L446
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java
CheerleaderClient.getArtistTracks
public Observable<ArrayList<SoundCloudTrack>> getArtistTracks() { checkState(); if (mCacheRam.tracks.size() != 0) { return Observable.create(new Observable.OnSubscribe<ArrayList<SoundCloudTrack>>() { @Override public void call(Subscriber<? super ArrayList<SoundCloudTrack>> subscriber) { subscriber.onNext(mCacheRam.tracks); subscriber.onCompleted(); } }); } else { return mRetrofitService.getUserTracks(mArtistName) .map(RxParser.PARSE_USER_TRACKS) .map(cacheTracks()); } }
java
public Observable<ArrayList<SoundCloudTrack>> getArtistTracks() { checkState(); if (mCacheRam.tracks.size() != 0) { return Observable.create(new Observable.OnSubscribe<ArrayList<SoundCloudTrack>>() { @Override public void call(Subscriber<? super ArrayList<SoundCloudTrack>> subscriber) { subscriber.onNext(mCacheRam.tracks); subscriber.onCompleted(); } }); } else { return mRetrofitService.getUserTracks(mArtistName) .map(RxParser.PARSE_USER_TRACKS) .map(cacheTracks()); } }
[ "public", "Observable", "<", "ArrayList", "<", "SoundCloudTrack", ">", ">", "getArtistTracks", "(", ")", "{", "checkState", "(", ")", ";", "if", "(", "mCacheRam", ".", "tracks", ".", "size", "(", ")", "!=", "0", ")", "{", "return", "Observable", ".", "...
Retrieve the public tracks of the supported artist. @return {@link rx.Observable} on an ArrayList of the artist's tracks.
[ "Retrieve", "the", "public", "tracks", "of", "the", "supported", "artist", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java#L214-L229
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java
CheerleaderClient.getArtistProfile
public Observable<SoundCloudUser> getArtistProfile() { checkState(); if (mCacheRam.artistProfile != null) { return Observable.create(new Observable.OnSubscribe<SoundCloudUser>() { @Override public void call(Subscriber<? super SoundCloudUser> subscriber) { subscriber.onNext(mCacheRam.artistProfile); subscriber.onCompleted(); } }); } else { return mRetrofitService.getUser(mArtistName) .map(RxParser.PARSE_USER) .map(cacheArtistProfile()); } }
java
public Observable<SoundCloudUser> getArtistProfile() { checkState(); if (mCacheRam.artistProfile != null) { return Observable.create(new Observable.OnSubscribe<SoundCloudUser>() { @Override public void call(Subscriber<? super SoundCloudUser> subscriber) { subscriber.onNext(mCacheRam.artistProfile); subscriber.onCompleted(); } }); } else { return mRetrofitService.getUser(mArtistName) .map(RxParser.PARSE_USER) .map(cacheArtistProfile()); } }
[ "public", "Observable", "<", "SoundCloudUser", ">", "getArtistProfile", "(", ")", "{", "checkState", "(", ")", ";", "if", "(", "mCacheRam", ".", "artistProfile", "!=", "null", ")", "{", "return", "Observable", ".", "create", "(", "new", "Observable", ".", ...
Retrieve SoundCloud artist profile. @return {@link rx.Observable} on {@link SoundCloudUser}
[ "Retrieve", "SoundCloud", "artist", "profile", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java#L236-L251
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java
CheerleaderClient.getTrackComments
public Observable<ArrayList<SoundCloudComment>> getTrackComments(final SoundCloudTrack track) { checkState(); if (mCacheRam.tracksComments.get(track.getId()) != null) { return Observable.create(new Observable.OnSubscribe<ArrayList<SoundCloudComment>>() { @Override public void call(Subscriber<? super ArrayList<SoundCloudComment>> subscriber) { subscriber.onNext(mCacheRam.tracksComments.get(track.getId())); subscriber.onCompleted(); } }); } else { return mRetrofitService.getTrackComments(track.getId()) .map(RxParser.PARSE_COMMENTS) .map(cacheTrackComments()); } }
java
public Observable<ArrayList<SoundCloudComment>> getTrackComments(final SoundCloudTrack track) { checkState(); if (mCacheRam.tracksComments.get(track.getId()) != null) { return Observable.create(new Observable.OnSubscribe<ArrayList<SoundCloudComment>>() { @Override public void call(Subscriber<? super ArrayList<SoundCloudComment>> subscriber) { subscriber.onNext(mCacheRam.tracksComments.get(track.getId())); subscriber.onCompleted(); } }); } else { return mRetrofitService.getTrackComments(track.getId()) .map(RxParser.PARSE_COMMENTS) .map(cacheTrackComments()); } }
[ "public", "Observable", "<", "ArrayList", "<", "SoundCloudComment", ">", ">", "getTrackComments", "(", "final", "SoundCloudTrack", "track", ")", "{", "checkState", "(", ")", ";", "if", "(", "mCacheRam", ".", "tracksComments", ".", "get", "(", "track", ".", "...
Retrieve comments related to a track of the supported artist. @param track track of which comment are related. @return {@link rx.Observable} on {@link java.util.ArrayList} of {@link SoundCloudComment}
[ "Retrieve", "comments", "related", "to", "a", "track", "of", "the", "supported", "artist", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java#L260-L275
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java
CheerleaderClient.cacheArtistProfile
private Func1<SoundCloudUser, SoundCloudUser> cacheArtistProfile() { return new Func1<SoundCloudUser, SoundCloudUser>() { @Override public SoundCloudUser call(SoundCloudUser soundCloudUser) { mCacheRam.artistProfile = soundCloudUser; return soundCloudUser; } }; }
java
private Func1<SoundCloudUser, SoundCloudUser> cacheArtistProfile() { return new Func1<SoundCloudUser, SoundCloudUser>() { @Override public SoundCloudUser call(SoundCloudUser soundCloudUser) { mCacheRam.artistProfile = soundCloudUser; return soundCloudUser; } }; }
[ "private", "Func1", "<", "SoundCloudUser", ",", "SoundCloudUser", ">", "cacheArtistProfile", "(", ")", "{", "return", "new", "Func1", "<", "SoundCloudUser", ",", "SoundCloudUser", ">", "(", ")", "{", "@", "Override", "public", "SoundCloudUser", "call", "(", "S...
"Cache" the artist profile retrieved from network in RAM to avoid requesting SoundCloud API for next call. @return {@link rx.functions.Func1} used to save the retrieved artist
[ "Cache", "the", "artist", "profile", "retrieved", "from", "network", "in", "RAM", "to", "avoid", "requesting", "SoundCloud", "API", "for", "next", "call", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java#L332-L340
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java
CheerleaderClient.cacheTrackComments
private Func1<ArrayList<SoundCloudComment>, ArrayList<SoundCloudComment>> cacheTrackComments() { return new Func1<ArrayList<SoundCloudComment>, ArrayList<SoundCloudComment>>() { @Override public ArrayList<SoundCloudComment> call(ArrayList<SoundCloudComment> trackComments) { if (trackComments.size() > 0) { mCacheRam.tracksComments.put(trackComments.get(0).getTrackId(), trackComments); } return trackComments; } }; }
java
private Func1<ArrayList<SoundCloudComment>, ArrayList<SoundCloudComment>> cacheTrackComments() { return new Func1<ArrayList<SoundCloudComment>, ArrayList<SoundCloudComment>>() { @Override public ArrayList<SoundCloudComment> call(ArrayList<SoundCloudComment> trackComments) { if (trackComments.size() > 0) { mCacheRam.tracksComments.put(trackComments.get(0).getTrackId(), trackComments); } return trackComments; } }; }
[ "private", "Func1", "<", "ArrayList", "<", "SoundCloudComment", ">", ",", "ArrayList", "<", "SoundCloudComment", ">", ">", "cacheTrackComments", "(", ")", "{", "return", "new", "Func1", "<", "ArrayList", "<", "SoundCloudComment", ">", ",", "ArrayList", "<", "S...
"Cache" the comments linked to a track retrieved from network in RAM to avoid requesting SoundCloud API for next call. @return {@link rx.functions.Func1} used to save the retrieved comments list
[ "Cache", "the", "comments", "linked", "to", "a", "track", "retrieved", "from", "network", "in", "RAM", "to", "avoid", "requesting", "SoundCloud", "API", "for", "next", "call", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java#L348-L358
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java
CheerleaderClient.cacheTracks
private Func1<ArrayList<SoundCloudTrack>, ArrayList<SoundCloudTrack>> cacheTracks() { return new Func1<ArrayList<SoundCloudTrack>, ArrayList<SoundCloudTrack>>() { @Override public ArrayList<SoundCloudTrack> call(ArrayList<SoundCloudTrack> soundCloudTracks) { if (soundCloudTracks.size() > 0) { mCacheRam.tracks = soundCloudTracks; } return soundCloudTracks; } }; }
java
private Func1<ArrayList<SoundCloudTrack>, ArrayList<SoundCloudTrack>> cacheTracks() { return new Func1<ArrayList<SoundCloudTrack>, ArrayList<SoundCloudTrack>>() { @Override public ArrayList<SoundCloudTrack> call(ArrayList<SoundCloudTrack> soundCloudTracks) { if (soundCloudTracks.size() > 0) { mCacheRam.tracks = soundCloudTracks; } return soundCloudTracks; } }; }
[ "private", "Func1", "<", "ArrayList", "<", "SoundCloudTrack", ">", ",", "ArrayList", "<", "SoundCloudTrack", ">", ">", "cacheTracks", "(", ")", "{", "return", "new", "Func1", "<", "ArrayList", "<", "SoundCloudTrack", ">", ",", "ArrayList", "<", "SoundCloudTrac...
"Cache" the tracks list of the supported artist retrieved from network in RAM to avoid requesting SoundCloud API for next call. @return {@link rx.functions.Func1} used to save the retrieved tracks list
[ "Cache", "the", "tracks", "list", "of", "the", "supported", "artist", "retrieved", "from", "network", "in", "RAM", "to", "avoid", "requesting", "SoundCloud", "API", "for", "next", "call", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/client/CheerleaderClient.java#L366-L376
train
quattor/pan
panc/src/main/java/org/quattor/pan/dml/AbstractOperation.java
AbstractOperation.calculateTerms
protected Term[] calculateTerms(Context context) throws EvaluationException { Term[] terms = new Term[ops.length]; for (int i = 0; i < ops.length; i++) { terms[i] = TermFactory.create(ops[i].execute(context)); } return terms; }
java
protected Term[] calculateTerms(Context context) throws EvaluationException { Term[] terms = new Term[ops.length]; for (int i = 0; i < ops.length; i++) { terms[i] = TermFactory.create(ops[i].execute(context)); } return terms; }
[ "protected", "Term", "[", "]", "calculateTerms", "(", "Context", "context", ")", "throws", "EvaluationException", "{", "Term", "[", "]", "terms", "=", "new", "Term", "[", "ops", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<"...
A utility method that creates a list of terms from the given arguments. @param context evaluation context to use @return array of terms calculated from the operations @throws EvaluationException if any error occurs when evaluating the arguments or if the resulting value is not a valid Term
[ "A", "utility", "method", "that", "creates", "a", "list", "of", "terms", "from", "the", "given", "arguments", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/AbstractOperation.java#L156-L164
train
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/TemporaryReferenceKeeper.java
TemporaryReferenceKeeper.cleanReferenceCache
public void cleanReferenceCache() { final long now = currentDateSupplier.get().getTime(); final Iterator<HardReference> it = hardReferences.iterator(); while (it.hasNext()) { if (it.next().keeptSince.getTime() + REFERENCE_KEEPING_TIME <= now) { it.remove(); } } }
java
public void cleanReferenceCache() { final long now = currentDateSupplier.get().getTime(); final Iterator<HardReference> it = hardReferences.iterator(); while (it.hasNext()) { if (it.next().keeptSince.getTime() + REFERENCE_KEEPING_TIME <= now) { it.remove(); } } }
[ "public", "void", "cleanReferenceCache", "(", ")", "{", "final", "long", "now", "=", "currentDateSupplier", ".", "get", "(", ")", ".", "getTime", "(", ")", ";", "final", "Iterator", "<", "HardReference", ">", "it", "=", "hardReferences", ".", "iterator", "...
Checks and cleans cached references that have timed out.
[ "Checks", "and", "cleans", "cached", "references", "that", "have", "timed", "out", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/TemporaryReferenceKeeper.java#L74-L82
train
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/TemporaryReferenceKeeper.java
TemporaryReferenceKeeper.getHardReferences
Iterable<Object> getHardReferences() { final List<Object> references = new ArrayList<Object>(hardReferences.size()); for (final HardReference reference : hardReferences) { references.add(reference.referenceToKeep); } return references; }
java
Iterable<Object> getHardReferences() { final List<Object> references = new ArrayList<Object>(hardReferences.size()); for (final HardReference reference : hardReferences) { references.add(reference.referenceToKeep); } return references; }
[ "Iterable", "<", "Object", ">", "getHardReferences", "(", ")", "{", "final", "List", "<", "Object", ">", "references", "=", "new", "ArrayList", "<", "Object", ">", "(", "hardReferences", ".", "size", "(", ")", ")", ";", "for", "(", "final", "HardReferenc...
The list of all references that are currently kept. <p> This is only intended to be used by tests. </p> @return All references that are currently held by this instance.
[ "The", "list", "of", "all", "references", "that", "are", "currently", "kept", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/TemporaryReferenceKeeper.java#L93-L99
train
quattor/pan
panc/src/main/java/org/quattor/pan/dml/operators/IfElse.java
IfElse.execute
@Override public Element execute(Context context) { assert (ops.length == 2 || ops.length == 3); // Pop the condition from the data stack. boolean condition = false; try { condition = ((BooleanProperty) ops[0].execute(context)).getValue(); } catch (ClassCastException cce) { throw new EvaluationException(MessageUtils .format(MSG_INVALID_IF_ELSE_TEST), sourceRange); } // Choose the correct operation and execute it. Operation op = null; if (condition) { op = ops[1]; } else if (ops.length > 2) { op = ops[2]; } else { op = Undef.VALUE; } return op.execute(context); }
java
@Override public Element execute(Context context) { assert (ops.length == 2 || ops.length == 3); // Pop the condition from the data stack. boolean condition = false; try { condition = ((BooleanProperty) ops[0].execute(context)).getValue(); } catch (ClassCastException cce) { throw new EvaluationException(MessageUtils .format(MSG_INVALID_IF_ELSE_TEST), sourceRange); } // Choose the correct operation and execute it. Operation op = null; if (condition) { op = ops[1]; } else if (ops.length > 2) { op = ops[2]; } else { op = Undef.VALUE; } return op.execute(context); }
[ "@", "Override", "public", "Element", "execute", "(", "Context", "context", ")", "{", "assert", "(", "ops", ".", "length", "==", "2", "||", "ops", ".", "length", "==", "3", ")", ";", "// Pop the condition from the data stack.", "boolean", "condition", "=", "...
Perform the if statement. It will pop a boolean from the data stack. If that boolean is false the next operand if popped from the operand stack; if true, nothing is done.
[ "Perform", "the", "if", "statement", ".", "It", "will", "pop", "a", "boolean", "from", "the", "data", "stack", ".", "If", "that", "boolean", "is", "false", "the", "next", "operand", "if", "popped", "from", "the", "operand", "stack", ";", "if", "true", ...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/operators/IfElse.java#L86-L110
train
saxsys/SynchronizeFX
demos/sliderdemo/src/main/java/de/saxsys/synchronizefx/sliderdemo/client/ClientApp.java
ClientApp.stop
@Override public void stop() { System.out.print("Stopping the client..."); client.disconnect(); System.out.println("done"); }
java
@Override public void stop() { System.out.print("Stopping the client..."); client.disconnect(); System.out.println("done"); }
[ "@", "Override", "public", "void", "stop", "(", ")", "{", "System", ".", "out", ".", "print", "(", "\"Stopping the client...\"", ")", ";", "client", ".", "disconnect", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"done\"", ")", ";", "}" ...
Disconnect the client when the application is closed.
[ "Disconnect", "the", "client", "when", "the", "application", "is", "closed", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/demos/sliderdemo/src/main/java/de/saxsys/synchronizefx/sliderdemo/client/ClientApp.java#L69-L74
train
quattor/pan
panc/src/main/java/org/quattor/pan/CompilerOptions.java
CompilerOptions.getDeprecationWarnings
public static DeprecationWarnings getDeprecationWarnings( int deprecationLevel, boolean failOnWarn) { if (deprecationLevel < 0) { return DeprecationWarnings.OFF; } else { return failOnWarn ? DeprecationWarnings.FATAL : DeprecationWarnings.ON; } }
java
public static DeprecationWarnings getDeprecationWarnings( int deprecationLevel, boolean failOnWarn) { if (deprecationLevel < 0) { return DeprecationWarnings.OFF; } else { return failOnWarn ? DeprecationWarnings.FATAL : DeprecationWarnings.ON; } }
[ "public", "static", "DeprecationWarnings", "getDeprecationWarnings", "(", "int", "deprecationLevel", ",", "boolean", "failOnWarn", ")", "{", "if", "(", "deprecationLevel", "<", "0", ")", "{", "return", "DeprecationWarnings", ".", "OFF", ";", "}", "else", "{", "r...
Utility method to turn old options into new deprecation flag.
[ "Utility", "method", "to", "turn", "old", "options", "into", "new", "deprecation", "flag", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerOptions.java#L268-L277
train
quattor/pan
panc/src/main/java/org/quattor/pan/CompilerOptions.java
CompilerOptions.createCheckSyntaxOptions
public static CompilerOptions createCheckSyntaxOptions( DeprecationWarnings deprecationWarnings) { Pattern debugNsInclude = null; Pattern debugNsExclude = null; int maxIteration = 5000; int maxRecursion = 50; Set<Formatter> formatters = new HashSet<Formatter>(); File outputDirectory = null; File annotationDirectory = null; File annotationBaseDirectory = null; LinkedList<File> includeDirectories = new LinkedList<File>(); try { return new CompilerOptions(debugNsInclude, debugNsExclude, maxIteration, maxRecursion, formatters, outputDirectory, includeDirectories, deprecationWarnings, annotationDirectory, annotationBaseDirectory, null, 0); } catch (SyntaxException consumed) { throw CompilerError.create(MSG_FILE_BUG_REPORT); } }
java
public static CompilerOptions createCheckSyntaxOptions( DeprecationWarnings deprecationWarnings) { Pattern debugNsInclude = null; Pattern debugNsExclude = null; int maxIteration = 5000; int maxRecursion = 50; Set<Formatter> formatters = new HashSet<Formatter>(); File outputDirectory = null; File annotationDirectory = null; File annotationBaseDirectory = null; LinkedList<File> includeDirectories = new LinkedList<File>(); try { return new CompilerOptions(debugNsInclude, debugNsExclude, maxIteration, maxRecursion, formatters, outputDirectory, includeDirectories, deprecationWarnings, annotationDirectory, annotationBaseDirectory, null, 0); } catch (SyntaxException consumed) { throw CompilerError.create(MSG_FILE_BUG_REPORT); } }
[ "public", "static", "CompilerOptions", "createCheckSyntaxOptions", "(", "DeprecationWarnings", "deprecationWarnings", ")", "{", "Pattern", "debugNsInclude", "=", "null", ";", "Pattern", "debugNsExclude", "=", "null", ";", "int", "maxIteration", "=", "5000", ";", "int"...
Create a CompilerOptions object that is appropriate for just doing a syntax check. @param deprecationWarnings determine what deprecation warnings are provided @return CompilerOptions object configured for a syntax check.
[ "Create", "a", "CompilerOptions", "object", "that", "is", "appropriate", "for", "just", "doing", "a", "syntax", "check", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerOptions.java#L287-L309
train
quattor/pan
panc/src/main/java/org/quattor/pan/CompilerOptions.java
CompilerOptions.checkDirectory
private void checkDirectory(File d, String dtype) { if (!d.isAbsolute()) { throw new IllegalArgumentException(dtype + " directory must be an absolute path (" + d.getPath() + ")"); } if (!d.exists()) { throw new IllegalArgumentException(dtype + " directory does not exist (" + d.getPath() + ")"); } if (!d.isDirectory()) { throw new IllegalArgumentException(dtype + " directory value is not a directory (" + d.getPath() + ")"); } }
java
private void checkDirectory(File d, String dtype) { if (!d.isAbsolute()) { throw new IllegalArgumentException(dtype + " directory must be an absolute path (" + d.getPath() + ")"); } if (!d.exists()) { throw new IllegalArgumentException(dtype + " directory does not exist (" + d.getPath() + ")"); } if (!d.isDirectory()) { throw new IllegalArgumentException(dtype + " directory value is not a directory (" + d.getPath() + ")"); } }
[ "private", "void", "checkDirectory", "(", "File", "d", ",", "String", "dtype", ")", "{", "if", "(", "!", "d", ".", "isAbsolute", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "dtype", "+", "\" directory must be an absolute path (\"", "+"...
A private utility function to verify that the directory is really a directory, exists, and absolute. @param dirs directory to check @param dtype name to use in case of errors
[ "A", "private", "utility", "function", "to", "verify", "that", "the", "directory", "is", "really", "a", "directory", "exists", "and", "absolute", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerOptions.java#L378-L393
train
quattor/pan
panc/src/main/java/org/quattor/pan/CompilerOptions.java
CompilerOptions.resolveFileList
public Set<File> resolveFileList(List<String> objectNames, Collection<File> tplFiles) { // First just copy the named templates. Set<File> filesToProcess = new TreeSet<File>(); if (tplFiles != null) { filesToProcess.addAll(tplFiles); } // Now loop over all of the object template names, lookup the files, and // add them to the set of files to process. if (objectNames != null) { for (String oname : objectNames) { SourceFile source = sourceRepository.retrievePanSource(oname); if (!source.isAbsent()) { filesToProcess.add(source.getPath()); } else { throw EvaluationException.create((SourceRange) null, (Context) null, MSG_CANNOT_LOCATE_OBJECT_TEMPLATE, oname); } } } return Collections.unmodifiableSet(filesToProcess); }
java
public Set<File> resolveFileList(List<String> objectNames, Collection<File> tplFiles) { // First just copy the named templates. Set<File> filesToProcess = new TreeSet<File>(); if (tplFiles != null) { filesToProcess.addAll(tplFiles); } // Now loop over all of the object template names, lookup the files, and // add them to the set of files to process. if (objectNames != null) { for (String oname : objectNames) { SourceFile source = sourceRepository.retrievePanSource(oname); if (!source.isAbsent()) { filesToProcess.add(source.getPath()); } else { throw EvaluationException.create((SourceRange) null, (Context) null, MSG_CANNOT_LOCATE_OBJECT_TEMPLATE, oname); } } } return Collections.unmodifiableSet(filesToProcess); }
[ "public", "Set", "<", "File", ">", "resolveFileList", "(", "List", "<", "String", ">", "objectNames", ",", "Collection", "<", "File", ">", "tplFiles", ")", "{", "// First just copy the named templates.", "Set", "<", "File", ">", "filesToProcess", "=", "new", "...
Resolve a list of object template names and template Files to a set of files based on this instance's include directories. @param objectNames object template names to lookup @param tplFiles template Files to process @return unmodifiable set of the resolved file names
[ "Resolve", "a", "list", "of", "object", "template", "names", "and", "template", "Files", "to", "a", "set", "of", "files", "based", "on", "this", "instance", "s", "include", "directories", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerOptions.java#L406-L431
train
quattor/pan
panc/src/main/java/org/quattor/pan/CompilerOptions.java
CompilerOptions.checkDebugEnabled
public boolean checkDebugEnabled(String tplName) { // Check first the exclude patterns. Any matching pattern in the exclude // list means that the debugging is disabled for the given template. if (debugNsExclude != null && debugNsExclude.matcher(tplName).matches()) { return false; } // Now check the include patterns. Any matching pattern here means that // the debugging for this template is enabled. if (debugNsInclude != null && debugNsInclude.matcher(tplName).matches()) { return true; } // If we get here, then the template didn't match anything. By default, // the debugging is turned off. return false; }
java
public boolean checkDebugEnabled(String tplName) { // Check first the exclude patterns. Any matching pattern in the exclude // list means that the debugging is disabled for the given template. if (debugNsExclude != null && debugNsExclude.matcher(tplName).matches()) { return false; } // Now check the include patterns. Any matching pattern here means that // the debugging for this template is enabled. if (debugNsInclude != null && debugNsInclude.matcher(tplName).matches()) { return true; } // If we get here, then the template didn't match anything. By default, // the debugging is turned off. return false; }
[ "public", "boolean", "checkDebugEnabled", "(", "String", "tplName", ")", "{", "// Check first the exclude patterns. Any matching pattern in the exclude", "// list means that the debugging is disabled for the given template.", "if", "(", "debugNsExclude", "!=", "null", "&&", "debugNsE...
A utility function that checks a given template name against the list of debug include and exclude patterns. @param tplName name of the template to check @return flag indicating whether debugging should be activated or not
[ "A", "utility", "function", "that", "checks", "a", "given", "template", "name", "against", "the", "list", "of", "debug", "include", "and", "exclude", "patterns", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerOptions.java#L442-L459
train
quattor/pan
panc/src/main/java/org/quattor/pan/CompilerOptions.java
CompilerOptions.getFormatters
public static Set<Formatter> getFormatters(String s) { HashSet<Formatter> formatters = new HashSet<Formatter>(); String[] names = s.trim().split("\\s*,\\s*"); for (String fname : names) { if ("text".equals(fname)) { formatters.add(TxtFormatter.getInstance()); } else if ("json".equals(fname)) { formatters.add(JsonFormatter.getInstance()); } else if ("json.gz".equals(fname)) { formatters.add(JsonGzipFormatter.getInstance()); } else if ("dot".equals(fname)) { formatters.add(DotFormatter.getInstance()); } else if ("pan".equals(fname)) { formatters.add(PanFormatter.getInstance()); } else if ("pan.gz".equals(fname)) { formatters.add(PanGzipFormatter.getInstance()); } else if ("xml".equals(fname)) { formatters.add(XmlFormatter.getInstance()); } else if ("xml.gz".equals(fname)) { formatters.add(XmlGzipFormatter.getInstance()); } else if ("dep".equals(fname)) { formatters.add(DepFormatter.getInstance()); } else if ("dep.gz".equals(fname)) { formatters.add(DepGzipFormatter.getInstance()); } else if ("null".equals(fname)) { formatters.add(NullFormatter.getInstance()); } else if ("none".equals(fname)) { // No-op } } return formatters; }
java
public static Set<Formatter> getFormatters(String s) { HashSet<Formatter> formatters = new HashSet<Formatter>(); String[] names = s.trim().split("\\s*,\\s*"); for (String fname : names) { if ("text".equals(fname)) { formatters.add(TxtFormatter.getInstance()); } else if ("json".equals(fname)) { formatters.add(JsonFormatter.getInstance()); } else if ("json.gz".equals(fname)) { formatters.add(JsonGzipFormatter.getInstance()); } else if ("dot".equals(fname)) { formatters.add(DotFormatter.getInstance()); } else if ("pan".equals(fname)) { formatters.add(PanFormatter.getInstance()); } else if ("pan.gz".equals(fname)) { formatters.add(PanGzipFormatter.getInstance()); } else if ("xml".equals(fname)) { formatters.add(XmlFormatter.getInstance()); } else if ("xml.gz".equals(fname)) { formatters.add(XmlGzipFormatter.getInstance()); } else if ("dep".equals(fname)) { formatters.add(DepFormatter.getInstance()); } else if ("dep.gz".equals(fname)) { formatters.add(DepGzipFormatter.getInstance()); } else if ("null".equals(fname)) { formatters.add(NullFormatter.getInstance()); } else if ("none".equals(fname)) { // No-op } } return formatters; }
[ "public", "static", "Set", "<", "Formatter", ">", "getFormatters", "(", "String", "s", ")", "{", "HashSet", "<", "Formatter", ">", "formatters", "=", "new", "HashSet", "<", "Formatter", ">", "(", ")", ";", "String", "[", "]", "names", "=", "s", ".", ...
be used for a compilation.
[ "be", "used", "for", "a", "compilation", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerOptions.java#L464-L498
train
tvbarthel/Cheerleader
sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ArtistActivity.java
ArtistActivity.startActivity
public static void startActivity(Context context, String artistName) { Intent i = new Intent(context, ArtistActivity.class); i.putExtra(BUNDLE_KEY_ARTIST_NAME, artistName); context.startActivity(i); }
java
public static void startActivity(Context context, String artistName) { Intent i = new Intent(context, ArtistActivity.class); i.putExtra(BUNDLE_KEY_ARTIST_NAME, artistName); context.startActivity(i); }
[ "public", "static", "void", "startActivity", "(", "Context", "context", ",", "String", "artistName", ")", "{", "Intent", "i", "=", "new", "Intent", "(", "context", ",", "ArtistActivity", ".", "class", ")", ";", "i", ".", "putExtra", "(", "BUNDLE_KEY_ARTIST_N...
Start an ArtistActivity for a given artist name. Start activity pattern. @param context context used to start the activity. @param artistName name of the artist.
[ "Start", "an", "ArtistActivity", "for", "a", "given", "artist", "name", ".", "Start", "activity", "pattern", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ArtistActivity.java#L85-L89
train
tvbarthel/Cheerleader
sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ArtistActivity.java
ArtistActivity.setTrackListPadding
private void setTrackListPadding() { mPlaylistRecyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { mPlaylistRecyclerView.getViewTreeObserver().removeOnPreDrawListener(this); int headerListHeight = getResources().getDimensionPixelOffset(R.dimen.playback_view_height); mPlaylistRecyclerView.setPadding(0, mPlaylistRecyclerView.getHeight() - headerListHeight, 0, 0); mPlaylistRecyclerView.setAdapter(mPlaylistAdapter); // attach the dismiss gesture. new SwipeToDismissGesture.Builder(SwipeToDismissDirection.HORIZONTAL) .on(mPlaylistRecyclerView) .apply(new DismissStrategy()) .backgroundColor(getResources().getColor(R.color.grey)) .build(); // hide if current play playlist is empty. if (mPlaylistTracks.isEmpty()) { mPlaybackView.setTranslationY(headerListHeight); } return true; } }); }
java
private void setTrackListPadding() { mPlaylistRecyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { mPlaylistRecyclerView.getViewTreeObserver().removeOnPreDrawListener(this); int headerListHeight = getResources().getDimensionPixelOffset(R.dimen.playback_view_height); mPlaylistRecyclerView.setPadding(0, mPlaylistRecyclerView.getHeight() - headerListHeight, 0, 0); mPlaylistRecyclerView.setAdapter(mPlaylistAdapter); // attach the dismiss gesture. new SwipeToDismissGesture.Builder(SwipeToDismissDirection.HORIZONTAL) .on(mPlaylistRecyclerView) .apply(new DismissStrategy()) .backgroundColor(getResources().getColor(R.color.grey)) .build(); // hide if current play playlist is empty. if (mPlaylistTracks.isEmpty()) { mPlaybackView.setTranslationY(headerListHeight); } return true; } }); }
[ "private", "void", "setTrackListPadding", "(", ")", "{", "mPlaylistRecyclerView", ".", "getViewTreeObserver", "(", ")", ".", "addOnPreDrawListener", "(", "new", "ViewTreeObserver", ".", "OnPreDrawListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPre...
Used to position the track list at the bottom of the screen.
[ "Used", "to", "position", "the", "track", "list", "at", "the", "bottom", "of", "the", "screen", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ArtistActivity.java#L220-L243
train
tvbarthel/Cheerleader
sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ArtistActivity.java
ArtistActivity.getArtistData
private void getArtistData() { mRetrievedTracks.clear(); mAdapter.notifyDataSetChanged(); mTracksSubscription = mCheerleaderClient.getArtistTracks() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(displayTracks()); mProfileSubscription = mCheerleaderClient.getArtistProfile() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(displayArtist()); }
java
private void getArtistData() { mRetrievedTracks.clear(); mAdapter.notifyDataSetChanged(); mTracksSubscription = mCheerleaderClient.getArtistTracks() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(displayTracks()); mProfileSubscription = mCheerleaderClient.getArtistProfile() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(displayArtist()); }
[ "private", "void", "getArtistData", "(", ")", "{", "mRetrievedTracks", ".", "clear", "(", ")", ";", "mAdapter", ".", "notifyDataSetChanged", "(", ")", ";", "mTracksSubscription", "=", "mCheerleaderClient", ".", "getArtistTracks", "(", ")", ".", "subscribeOn", "(...
Used to retrieved the tracks of the artist as well as artist details.
[ "Used", "to", "retrieved", "the", "tracks", "of", "the", "artist", "as", "well", "as", "artist", "details", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ArtistActivity.java#L248-L263
train
tvbarthel/Cheerleader
sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ArtistActivity.java
ArtistActivity.getExtraArtistName
private String getExtraArtistName() { Bundle extras = getIntent().getExtras(); if (extras == null || !extras.containsKey(BUNDLE_KEY_ARTIST_NAME)) { return ""; // activity started through the notification pending intent } return extras.getString(BUNDLE_KEY_ARTIST_NAME); }
java
private String getExtraArtistName() { Bundle extras = getIntent().getExtras(); if (extras == null || !extras.containsKey(BUNDLE_KEY_ARTIST_NAME)) { return ""; // activity started through the notification pending intent } return extras.getString(BUNDLE_KEY_ARTIST_NAME); }
[ "private", "String", "getExtraArtistName", "(", ")", "{", "Bundle", "extras", "=", "getIntent", "(", ")", ".", "getExtras", "(", ")", ";", "if", "(", "extras", "==", "null", "||", "!", "extras", ".", "containsKey", "(", "BUNDLE_KEY_ARTIST_NAME", ")", ")", ...
Used to retrieve the artist name for the bundle. @return artist name.
[ "Used", "to", "retrieve", "the", "artist", "name", "for", "the", "bundle", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ArtistActivity.java#L270-L276
train
saxsys/SynchronizeFX
transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SynchronizeFXWebsocketChannel.java
SynchronizeFXWebsocketChannel.newMessage
void newMessage(final byte[] message, final Session session) { callback.recive(serializer.deserialize(message), session); }
java
void newMessage(final byte[] message, final Session session) { callback.recive(serializer.deserialize(message), session); }
[ "void", "newMessage", "(", "final", "byte", "[", "]", "message", ",", "final", "Session", "session", ")", "{", "callback", ".", "recive", "(", "serializer", ".", "deserialize", "(", "message", ")", ",", "session", ")", ";", "}" ]
Inform this channel that one of its client has send a message. @param message The message that was send. @param session The client that send the message.
[ "Inform", "this", "channel", "that", "one", "of", "its", "client", "has", "send", "a", "message", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SynchronizeFXWebsocketChannel.java#L87-L89
train
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/ModelWalkingSynchronizer.java
ModelWalkingSynchronizer.startModelWalking
public void startModelWalking() { doWhenModelWalkerFinished(ActionType.MODEL_WALKNG, new Runnable() { @Override public void run() { memberLock.lock(); modelWalkingInProgess = true; memberLock.unlock(); } }); }
java
public void startModelWalking() { doWhenModelWalkerFinished(ActionType.MODEL_WALKNG, new Runnable() { @Override public void run() { memberLock.lock(); modelWalkingInProgess = true; memberLock.unlock(); } }); }
[ "public", "void", "startModelWalking", "(", ")", "{", "doWhenModelWalkerFinished", "(", "ActionType", ".", "MODEL_WALKNG", ",", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "memberLock", ".", "lock", "(", ")", ...
Informs this synchronizer, that a new model walking process has started. <p> If an other model walking process is currently in progress, this blocks until it has finished. </p>
[ "Informs", "this", "synchronizer", "that", "a", "new", "model", "walking", "process", "has", "started", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/ModelWalkingSynchronizer.java#L103-L112
train
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/ModelWalkingSynchronizer.java
ModelWalkingSynchronizer.doWhenModelWalkerFinished
public void doWhenModelWalkerFinished(final ActionType type, final Runnable action) { memberLock.lock(); if (!modelWalkingInProgess) { memberLock.unlock(); action.run(); return; } CountDownLatch latch = new CountDownLatch(1); Set<CountDownLatch> latches = getLocksForAction(type); latches.add(latch); // FIXME There may be a race condition between the following unlock and lock. memberLock.unlock(); awaitUninterupptetly(latch); action.run(); memberLock.lock(); latches.remove(latch); runNext(); memberLock.unlock(); }
java
public void doWhenModelWalkerFinished(final ActionType type, final Runnable action) { memberLock.lock(); if (!modelWalkingInProgess) { memberLock.unlock(); action.run(); return; } CountDownLatch latch = new CountDownLatch(1); Set<CountDownLatch> latches = getLocksForAction(type); latches.add(latch); // FIXME There may be a race condition between the following unlock and lock. memberLock.unlock(); awaitUninterupptetly(latch); action.run(); memberLock.lock(); latches.remove(latch); runNext(); memberLock.unlock(); }
[ "public", "void", "doWhenModelWalkerFinished", "(", "final", "ActionType", "type", ",", "final", "Runnable", "action", ")", "{", "memberLock", ".", "lock", "(", ")", ";", "if", "(", "!", "modelWalkingInProgess", ")", "{", "memberLock", ".", "unlock", "(", ")...
Lets the current thread sleep until a currently running model walking thread has finished. <p> If no model walking is currently in progress, nothing happens. </p> @param type The type of the action that waits for model walking to finish. @param action The action that should be performed.
[ "Lets", "the", "current", "thread", "sleep", "until", "a", "currently", "running", "model", "walking", "thread", "has", "finished", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/ModelWalkingSynchronizer.java#L133-L153
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java
PlaybackService.pause
public static void pause(Context context, String clientId) { Intent intent = new Intent(context, PlaybackService.class); intent.setAction(ACTION_PAUSE_PLAYER); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID, clientId); context.startService(intent); }
java
public static void pause(Context context, String clientId) { Intent intent = new Intent(context, PlaybackService.class); intent.setAction(ACTION_PAUSE_PLAYER); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID, clientId); context.startService(intent); }
[ "public", "static", "void", "pause", "(", "Context", "context", ",", "String", "clientId", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "context", ",", "PlaybackService", ".", "class", ")", ";", "intent", ".", "setAction", "(", "ACTION_PAUSE_PLAY...
Pause the SoundCloud player. @param context context from which the service will be started. @param clientId SoundCloud api client id.
[ "Pause", "the", "SoundCloud", "player", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L310-L315
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java
PlaybackService.resume
public static void resume(Context context, String clientId) { Intent intent = new Intent(context, PlaybackService.class); intent.setAction(ACTION_RESUME_PLAYER); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID, clientId); context.startService(intent); }
java
public static void resume(Context context, String clientId) { Intent intent = new Intent(context, PlaybackService.class); intent.setAction(ACTION_RESUME_PLAYER); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID, clientId); context.startService(intent); }
[ "public", "static", "void", "resume", "(", "Context", "context", ",", "String", "clientId", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "context", ",", "PlaybackService", ".", "class", ")", ";", "intent", ".", "setAction", "(", "ACTION_RESUME_PL...
Resume the SoundCloud player. @param context context from which the service will be started. @param clientId SoundCloud api client id.
[ "Resume", "the", "SoundCloud", "player", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L323-L328
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java
PlaybackService.stop
public static void stop(Context context, String clientId) { Intent intent = new Intent(context, PlaybackService.class); intent.setAction(ACTION_STOP_PLAYER); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID, clientId); context.startService(intent); }
java
public static void stop(Context context, String clientId) { Intent intent = new Intent(context, PlaybackService.class); intent.setAction(ACTION_STOP_PLAYER); intent.putExtra(BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID, clientId); context.startService(intent); }
[ "public", "static", "void", "stop", "(", "Context", "context", ",", "String", "clientId", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "context", ",", "PlaybackService", ".", "class", ")", ";", "intent", ".", "setAction", "(", "ACTION_STOP_PLAYER...
Stop the SoundCloud player. @param context context from which the service will be started. @param clientId SoundCloud api client id.
[ "Stop", "the", "SoundCloud", "player", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L336-L341
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java
PlaybackService.registerListener
public static void registerListener(Context context, PlaybackListener listener) { IntentFilter filter = new IntentFilter(); filter.addAction(PlaybackListener.ACTION_ON_TRACK_PLAYED); filter.addAction(PlaybackListener.ACTION_ON_PLAYER_PAUSED); filter.addAction(PlaybackListener.ACTION_ON_SEEK_COMPLETE); filter.addAction(PlaybackListener.ACTION_ON_PLAYER_DESTROYED); filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_STARTED); filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_ENDED); filter.addAction(PlaybackListener.ACTION_ON_PROGRESS_CHANGED); LocalBroadcastManager.getInstance(context.getApplicationContext()) .registerReceiver(listener, filter); }
java
public static void registerListener(Context context, PlaybackListener listener) { IntentFilter filter = new IntentFilter(); filter.addAction(PlaybackListener.ACTION_ON_TRACK_PLAYED); filter.addAction(PlaybackListener.ACTION_ON_PLAYER_PAUSED); filter.addAction(PlaybackListener.ACTION_ON_SEEK_COMPLETE); filter.addAction(PlaybackListener.ACTION_ON_PLAYER_DESTROYED); filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_STARTED); filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_ENDED); filter.addAction(PlaybackListener.ACTION_ON_PROGRESS_CHANGED); LocalBroadcastManager.getInstance(context.getApplicationContext()) .registerReceiver(listener, filter); }
[ "public", "static", "void", "registerListener", "(", "Context", "context", ",", "PlaybackListener", "listener", ")", "{", "IntentFilter", "filter", "=", "new", "IntentFilter", "(", ")", ";", "filter", ".", "addAction", "(", "PlaybackListener", ".", "ACTION_ON_TRAC...
Register a listener to catch player event. @param context context used to register the listener. @param listener listener to register.
[ "Register", "a", "listener", "to", "catch", "player", "event", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L368-L380
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java
PlaybackService.unregisterListener
public static void unregisterListener(Context context, PlaybackListener listener) { LocalBroadcastManager.getInstance(context.getApplicationContext()) .unregisterReceiver(listener); }
java
public static void unregisterListener(Context context, PlaybackListener listener) { LocalBroadcastManager.getInstance(context.getApplicationContext()) .unregisterReceiver(listener); }
[ "public", "static", "void", "unregisterListener", "(", "Context", "context", ",", "PlaybackListener", "listener", ")", "{", "LocalBroadcastManager", ".", "getInstance", "(", "context", ".", "getApplicationContext", "(", ")", ")", ".", "unregisterReceiver", "(", "lis...
Unregister a registered listener. @param context context used to unregister the listener. @param listener listener to unregister.
[ "Unregister", "a", "registered", "listener", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L388-L391
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java
PlaybackService.resume
private void resume() { if (mIsPaused) { mIsPaused = false; mIsPausedAfterAudioFocusChanged = false; // Try to gain the audio focus before preparing and starting the media player. if (mAudioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN) == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { mMediaPlayer.start(); Intent intent = new Intent(PlaybackListener.ACTION_ON_TRACK_PLAYED); intent.putExtra(PlaybackListener.EXTRA_KEY_TRACK, mPlayerPlaylist.getCurrentTrack()); mLocalBroadcastManager.sendBroadcast(intent); updateNotification(); mMediaSession.setPlaybackState(MediaSessionWrapper.PLAYBACK_STATE_PLAYING); resumeTimer(); } } }
java
private void resume() { if (mIsPaused) { mIsPaused = false; mIsPausedAfterAudioFocusChanged = false; // Try to gain the audio focus before preparing and starting the media player. if (mAudioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN) == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { mMediaPlayer.start(); Intent intent = new Intent(PlaybackListener.ACTION_ON_TRACK_PLAYED); intent.putExtra(PlaybackListener.EXTRA_KEY_TRACK, mPlayerPlaylist.getCurrentTrack()); mLocalBroadcastManager.sendBroadcast(intent); updateNotification(); mMediaSession.setPlaybackState(MediaSessionWrapper.PLAYBACK_STATE_PLAYING); resumeTimer(); } } }
[ "private", "void", "resume", "(", ")", "{", "if", "(", "mIsPaused", ")", "{", "mIsPaused", "=", "false", ";", "mIsPausedAfterAudioFocusChanged", "=", "false", ";", "// Try to gain the audio focus before preparing and starting the media player.", "if", "(", "mAudioManager"...
Resume the playback.
[ "Resume", "the", "playback", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L645-L664
train
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java
PlaybackService.startTimer
private void startTimer(long duration) { if (mCountDown != null) { mCountDown.cancel(); mCountDown = null; } // refresh progress every seconds. mCountDown = new CountDownTimer(duration, 1000) { @Override public void onTick(long millisUntilFinished) { Intent i = new Intent(PlaybackListener.ACTION_ON_PROGRESS_CHANGED); i.putExtra(PlaybackListener.EXTRA_KEY_CURRENT_TIME, mMediaPlayer.getCurrentPosition()); mLocalBroadcastManager.sendBroadcast(i); } @Override public void onFinish() { Intent i = new Intent(PlaybackListener.ACTION_ON_PROGRESS_CHANGED); i.putExtra(PlaybackListener.EXTRA_KEY_CURRENT_TIME , (int) mPlayerPlaylist.getCurrentTrack().getDurationInMilli()); mLocalBroadcastManager.sendBroadcast(i); } }; mCountDown.start(); }
java
private void startTimer(long duration) { if (mCountDown != null) { mCountDown.cancel(); mCountDown = null; } // refresh progress every seconds. mCountDown = new CountDownTimer(duration, 1000) { @Override public void onTick(long millisUntilFinished) { Intent i = new Intent(PlaybackListener.ACTION_ON_PROGRESS_CHANGED); i.putExtra(PlaybackListener.EXTRA_KEY_CURRENT_TIME, mMediaPlayer.getCurrentPosition()); mLocalBroadcastManager.sendBroadcast(i); } @Override public void onFinish() { Intent i = new Intent(PlaybackListener.ACTION_ON_PROGRESS_CHANGED); i.putExtra(PlaybackListener.EXTRA_KEY_CURRENT_TIME , (int) mPlayerPlaylist.getCurrentTrack().getDurationInMilli()); mLocalBroadcastManager.sendBroadcast(i); } }; mCountDown.start(); }
[ "private", "void", "startTimer", "(", "long", "duration", ")", "{", "if", "(", "mCountDown", "!=", "null", ")", "{", "mCountDown", ".", "cancel", "(", ")", ";", "mCountDown", "=", "null", ";", "}", "// refresh progress every seconds.", "mCountDown", "=", "ne...
Start internal timer used to propagate the playback position. @param duration duration for which the timer should be started.
[ "Start", "internal", "timer", "used", "to", "propagate", "the", "playback", "position", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L797-L821
train
quattor/pan
panc/src/main/java/org/quattor/pan/dml/data/Property.java
Property.readObject
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); hashcode = value.hashCode(); }
java
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); hashcode = value.hashCode(); }
[ "private", "void", "readObject", "(", "java", ".", "io", ".", "ObjectInputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "in", ".", "defaultReadObject", "(", ")", ";", "hashcode", "=", "value", ".", "hashCode", "(", ")", ";"...
This method is used to restore the volatile hashcode value when deserializing a Property object. @param in @throws IOException @throws ClassNotFoundException
[ "This", "method", "is", "used", "to", "restore", "the", "volatile", "hashcode", "value", "when", "deserializing", "a", "Property", "object", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/data/Property.java#L95-L100
train
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/WeakObjectRegistry.java
WeakObjectRegistry.registerIfUnknown
public UUID registerIfUnknown(final Object object) { final Optional<UUID> id = getId(object); if (!id.isPresent()) { return registerObject(object); } return id.get(); }
java
public UUID registerIfUnknown(final Object object) { final Optional<UUID> id = getId(object); if (!id.isPresent()) { return registerObject(object); } return id.get(); }
[ "public", "UUID", "registerIfUnknown", "(", "final", "Object", "object", ")", "{", "final", "Optional", "<", "UUID", ">", "id", "=", "getId", "(", "object", ")", ";", "if", "(", "!", "id", ".", "isPresent", "(", ")", ")", "{", "return", "registerObject...
Registers an object in the meta model if it is not already registered. @param object The object to register. @return The id of the object. It doesn't matter if the object was just registered or already known.
[ "Registers", "an", "object", "in", "the", "meta", "model", "if", "it", "is", "not", "already", "registered", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/WeakObjectRegistry.java#L119-L125
train
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/WeakObjectRegistry.java
WeakObjectRegistry.registerObject
public void registerObject(final Object object, final UUID id) { objectToId.put(object, id); idToObject.put(id, object); }
java
public void registerObject(final Object object, final UUID id) { objectToId.put(object, id); idToObject.put(id, object); }
[ "public", "void", "registerObject", "(", "final", "Object", "object", ",", "final", "UUID", "id", ")", "{", "objectToId", ".", "put", "(", "object", ",", "id", ")", ";", "idToObject", ".", "put", "(", "id", ",", "object", ")", ";", "}" ]
Registers an object in this model identified by a pre existing id. @param object The object to register. @param id The id by which this object is identified.
[ "Registers", "an", "object", "in", "this", "model", "identified", "by", "a", "pre", "existing", "id", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/WeakObjectRegistry.java#L135-L138
train
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/WeakObjectRegistry.java
WeakObjectRegistry.registerObject
private UUID registerObject(final Object object) { UUID id = UUID.randomUUID(); registerObject(object, id); return id; }
java
private UUID registerObject(final Object object) { UUID id = UUID.randomUUID(); registerObject(object, id); return id; }
[ "private", "UUID", "registerObject", "(", "final", "Object", "object", ")", "{", "UUID", "id", "=", "UUID", ".", "randomUUID", "(", ")", ";", "registerObject", "(", "object", ",", "id", ")", ";", "return", "id", ";", "}" ]
Registers an object in this model identified by a newly created id. @param object The object to register. @return The generated id.
[ "Registers", "an", "object", "in", "this", "model", "identified", "by", "a", "newly", "created", "id", "." ]
f3683020e4749110b38514eb5bc73a247998b579
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/WeakObjectRegistry.java#L147-L151
train
quattor/pan
panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java
XMLFormatterUtils.isXMLNameStart
public static boolean isXMLNameStart(int codepoint) { if (codepoint >= Character.codePointAt("A", 0) && codepoint <= Character.codePointAt("Z", 0)) { return true; } else if (codepoint == Character.codePointAt("_", 0)) { return true; } else if (codepoint >= Character.codePointAt("a", 0) && codepoint <= Character.codePointAt("z", 0)) { return true; } else if (codepoint >= 0xC0 && codepoint <= 0xD6) { return true; } else if (codepoint >= 0xD8 && codepoint <= 0xF6) { return true; } else if (codepoint >= 0xF8 && codepoint <= 0x2FF) { return true; } else if (codepoint >= 0x370 && codepoint <= 0x37D) { return true; } else if (codepoint >= 0x37F && codepoint <= 0x1FFF) { return true; } else if (codepoint >= 0x200C && codepoint <= 0x200D) { return true; } else if (codepoint >= 0x2070 && codepoint <= 0x218F) { return true; } else if (codepoint >= 0x2C00 && codepoint <= 0x2FEF) { return true; } else if (codepoint >= 0x3001 && codepoint <= 0xD7FF) { return true; } else if (codepoint >= 0xF900 && codepoint <= 0xFDCF) { return true; } else if (codepoint >= 0xFDF0 && codepoint <= 0xFFFD) { return true; } else if (codepoint >= 0x10000 && codepoint <= 0xEFFFF) { return true; } else { return false; } }
java
public static boolean isXMLNameStart(int codepoint) { if (codepoint >= Character.codePointAt("A", 0) && codepoint <= Character.codePointAt("Z", 0)) { return true; } else if (codepoint == Character.codePointAt("_", 0)) { return true; } else if (codepoint >= Character.codePointAt("a", 0) && codepoint <= Character.codePointAt("z", 0)) { return true; } else if (codepoint >= 0xC0 && codepoint <= 0xD6) { return true; } else if (codepoint >= 0xD8 && codepoint <= 0xF6) { return true; } else if (codepoint >= 0xF8 && codepoint <= 0x2FF) { return true; } else if (codepoint >= 0x370 && codepoint <= 0x37D) { return true; } else if (codepoint >= 0x37F && codepoint <= 0x1FFF) { return true; } else if (codepoint >= 0x200C && codepoint <= 0x200D) { return true; } else if (codepoint >= 0x2070 && codepoint <= 0x218F) { return true; } else if (codepoint >= 0x2C00 && codepoint <= 0x2FEF) { return true; } else if (codepoint >= 0x3001 && codepoint <= 0xD7FF) { return true; } else if (codepoint >= 0xF900 && codepoint <= 0xFDCF) { return true; } else if (codepoint >= 0xFDF0 && codepoint <= 0xFFFD) { return true; } else if (codepoint >= 0x10000 && codepoint <= 0xEFFFF) { return true; } else { return false; } }
[ "public", "static", "boolean", "isXMLNameStart", "(", "int", "codepoint", ")", "{", "if", "(", "codepoint", ">=", "Character", ".", "codePointAt", "(", "\"A\"", ",", "0", ")", "&&", "codepoint", "<=", "Character", ".", "codePointAt", "(", "\"Z\"", ",", "0"...
Determine if the given character is a legal starting character for an XML name. Note that although a colon is a legal value its use is strongly discouraged and this method will return false for a colon. The list of valid characters can be found in the <a href="http://www.w3.org/TR/xml/0sec-common-syn">Common Syntactic Constructs section</a> of the XML specification. @param codepoint int value of the code point to check @return true if the character may appear as the first letter of an XML name; false otherwise
[ "Determine", "if", "the", "given", "character", "is", "a", "legal", "starting", "character", "for", "an", "XML", "name", ".", "Note", "that", "although", "a", "colon", "is", "a", "legal", "value", "its", "use", "is", "strongly", "discouraged", "and", "this...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java#L21-L58
train
quattor/pan
panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java
XMLFormatterUtils.isXMLNamePart
public static boolean isXMLNamePart(int codepoint) { if (isXMLNameStart(codepoint)) { return true; } else if (codepoint >= Character.codePointAt("0", 0) && codepoint <= Character.codePointAt("9", 0)) { return true; } else if (codepoint == Character.codePointAt("-", 0)) { return true; } else if (codepoint == Character.codePointAt(".", 0)) { return true; } else if (codepoint == 0xB7) { return true; } else if (codepoint >= 0x0300 && codepoint <= 0x036F) { return true; } else if (codepoint >= 0x203F && codepoint <= 0x2040) { return true; } else { return false; } }
java
public static boolean isXMLNamePart(int codepoint) { if (isXMLNameStart(codepoint)) { return true; } else if (codepoint >= Character.codePointAt("0", 0) && codepoint <= Character.codePointAt("9", 0)) { return true; } else if (codepoint == Character.codePointAt("-", 0)) { return true; } else if (codepoint == Character.codePointAt(".", 0)) { return true; } else if (codepoint == 0xB7) { return true; } else if (codepoint >= 0x0300 && codepoint <= 0x036F) { return true; } else if (codepoint >= 0x203F && codepoint <= 0x2040) { return true; } else { return false; } }
[ "public", "static", "boolean", "isXMLNamePart", "(", "int", "codepoint", ")", "{", "if", "(", "isXMLNameStart", "(", "codepoint", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "codepoint", ">=", "Character", ".", "codePointAt", "(", "\"0\""...
Determine if the given character is a legal non-starting character for an XML name. Note that although a colon is a legal value its use is strongly discouraged and this method will return false for a colon. The list of valid characters can be found in the <a href="http://www.w3.org/TR/xml/0sec-common-syn">Common Syntactic Constructs section</a> of the XML specification. @param codepoint int value of the code point to check @return true if the character may appear as a non-starting letter of an XML name; false otherwise
[ "Determine", "if", "the", "given", "character", "is", "a", "legal", "non", "-", "starting", "character", "for", "an", "XML", "name", ".", "Note", "that", "although", "a", "colon", "is", "a", "legal", "value", "its", "use", "is", "strongly", "discouraged", ...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java#L74-L94
train
quattor/pan
panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java
XMLFormatterUtils.isValidXMLCharacter
public static boolean isValidXMLCharacter(int codepoint) { // Most of the time the character will be valid. Order the tests such // that most valid characters will be found in the minimum number of // tests. if (codepoint >= 0x20 && codepoint <= 0xD7FF) { return true; } else if (codepoint == 0x9 || codepoint == 0xA || codepoint == 0xD) { return true; } else if (codepoint >= 0xE000 && codepoint <= 0xFFFD) { return true; } else if (codepoint >= 0x10000 && codepoint <= 0x10FFFF) { return true; } else { return false; } }
java
public static boolean isValidXMLCharacter(int codepoint) { // Most of the time the character will be valid. Order the tests such // that most valid characters will be found in the minimum number of // tests. if (codepoint >= 0x20 && codepoint <= 0xD7FF) { return true; } else if (codepoint == 0x9 || codepoint == 0xA || codepoint == 0xD) { return true; } else if (codepoint >= 0xE000 && codepoint <= 0xFFFD) { return true; } else if (codepoint >= 0x10000 && codepoint <= 0x10FFFF) { return true; } else { return false; } }
[ "public", "static", "boolean", "isValidXMLCharacter", "(", "int", "codepoint", ")", "{", "// Most of the time the character will be valid. Order the tests such", "// that most valid characters will be found in the minimum number of", "// tests.", "if", "(", "codepoint", ">=", "0x20",...
Determine if a given UNICODE character can appear in a valid XML file. The allowed characters are 0x9, 0xA, 0xD, 0x20-0xD7FF, 0xE000-0xFFFD, and 0x100000-0x10FFFF; all other characters may not appear in an XML file. @param codepoint int value of the code point to check @return true if the character may appear in a valid XML file; false otherwise
[ "Determine", "if", "a", "given", "UNICODE", "character", "can", "appear", "in", "a", "valid", "XML", "file", ".", "The", "allowed", "characters", "are", "0x9", "0xA", "0xD", "0x20", "-", "0xD7FF", "0xE000", "-", "0xFFFD", "and", "0x100000", "-", "0x10FFFF"...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java#L106-L122
train
quattor/pan
panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java
XMLFormatterUtils.isValidXMLName
public static boolean isValidXMLName(String s) { // Catch the empty string or null. if (s == null || "".equals(s)) { return false; } // Since the string isn't empty, check that the first character is a // valid starting character. if (!isXMLNameStart(s.codePointAt(0))) { return false; } // Loop through the string by UNICODE codepoints. This is NOT equivalent // to looping through the characters because some UNICODE codepoints can // occupy more than one character. int length = s.length(); int index = 1; while (index < length) { int codePoint = s.codePointAt(index); if (!isXMLNamePart(codePoint)) { return false; } index += Character.charCount(codePoint); } // Names that begin with "xml" with letters in any case are reserved by // the XML specification. if (s.toLowerCase().startsWith("xml")) { return false; } // If we get here then all of the characters have been checked and are // valid. Unfortunately the usual case takes the longest to verify. return true; }
java
public static boolean isValidXMLName(String s) { // Catch the empty string or null. if (s == null || "".equals(s)) { return false; } // Since the string isn't empty, check that the first character is a // valid starting character. if (!isXMLNameStart(s.codePointAt(0))) { return false; } // Loop through the string by UNICODE codepoints. This is NOT equivalent // to looping through the characters because some UNICODE codepoints can // occupy more than one character. int length = s.length(); int index = 1; while (index < length) { int codePoint = s.codePointAt(index); if (!isXMLNamePart(codePoint)) { return false; } index += Character.charCount(codePoint); } // Names that begin with "xml" with letters in any case are reserved by // the XML specification. if (s.toLowerCase().startsWith("xml")) { return false; } // If we get here then all of the characters have been checked and are // valid. Unfortunately the usual case takes the longest to verify. return true; }
[ "public", "static", "boolean", "isValidXMLName", "(", "String", "s", ")", "{", "// Catch the empty string or null.", "if", "(", "s", "==", "null", "||", "\"\"", ".", "equals", "(", "s", ")", ")", "{", "return", "false", ";", "}", "// Since the string isn't emp...
Determine if the given string is a valid XML name. @param s String to examine for illegal XML characters @return true if the String can be written to an XML file without encoding; false otherwise
[ "Determine", "if", "the", "given", "string", "is", "a", "valid", "XML", "name", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java#L132-L167
train
quattor/pan
panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java
XMLFormatterUtils.isValidXMLString
public static boolean isValidXMLString(String s) { int length = s.length(); // Loop through the string by UNICODE codepoints. This is NOT equivalent // to looping through the characters because some UNICODE codepoints can // occupy more than one character. int index = 0; while (index < length) { int codePoint = s.codePointAt(index); if (!isValidXMLCharacter(codePoint)) { return false; } index += Character.charCount(codePoint); } // If we get here then all of the characters have been checked and are // valid. Unfortunately the usual case takes the longest to verify. return true; }
java
public static boolean isValidXMLString(String s) { int length = s.length(); // Loop through the string by UNICODE codepoints. This is NOT equivalent // to looping through the characters because some UNICODE codepoints can // occupy more than one character. int index = 0; while (index < length) { int codePoint = s.codePointAt(index); if (!isValidXMLCharacter(codePoint)) { return false; } index += Character.charCount(codePoint); } // If we get here then all of the characters have been checked and are // valid. Unfortunately the usual case takes the longest to verify. return true; }
[ "public", "static", "boolean", "isValidXMLString", "(", "String", "s", ")", "{", "int", "length", "=", "s", ".", "length", "(", ")", ";", "// Loop through the string by UNICODE codepoints. This is NOT equivalent", "// to looping through the characters because some UNICODE codep...
Determine if the given string can be written to an XML file without encoding. This will be the case so long as the string does not contain illegal XML characters. @param s String to examine for illegal XML characters @return true if the String can be written to an XML file without encoding; false otherwise
[ "Determine", "if", "the", "given", "string", "can", "be", "written", "to", "an", "XML", "file", "without", "encoding", ".", "This", "will", "be", "the", "case", "so", "long", "as", "the", "string", "does", "not", "contain", "illegal", "XML", "characters", ...
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java#L179-L198
train
quattor/pan
panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java
XMLFormatterUtils.encodeAsXMLName
public static String encodeAsXMLName(String s) { StringBuilder sb = new StringBuilder("_"); for (byte b : s.getBytes(Charset.forName("UTF-8"))) { sb.append(Integer.toHexString((b >>> 4) & 0xF)); sb.append(Integer.toHexString(b & 0xF)); } return sb.toString(); }
java
public static String encodeAsXMLName(String s) { StringBuilder sb = new StringBuilder("_"); for (byte b : s.getBytes(Charset.forName("UTF-8"))) { sb.append(Integer.toHexString((b >>> 4) & 0xF)); sb.append(Integer.toHexString(b & 0xF)); } return sb.toString(); }
[ "public", "static", "String", "encodeAsXMLName", "(", "String", "s", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"_\"", ")", ";", "for", "(", "byte", "b", ":", "s", ".", "getBytes", "(", "Charset", ".", "forName", "(", "\"UTF-8\"...
This will encode the given string as a valid XML name. The format will be an initial underscore followed by the hexadecimal representation of the string. The method will throw an exception if the argument is null. @param s String to encode as an XML name @return valid XML name from String @throws NullPointerException if the argument is null
[ "This", "will", "encode", "the", "given", "string", "as", "a", "valid", "XML", "name", ".", "The", "format", "will", "be", "an", "initial", "underscore", "followed", "by", "the", "hexadecimal", "representation", "of", "the", "string", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/output/XMLFormatterUtils.java#L214-L223
train
quattor/pan
panc/src/main/java/org/quattor/pan/CompilerResults.java
CompilerResults.formatErrors
public String formatErrors() { if (errors.size() > 0) { StringBuilder results = new StringBuilder(); for (Throwable t : errors) { results.append(t.getMessage()); results.append("\n"); if (t instanceof NullPointerException || t instanceof CompilerError) { results.append(formatStackTrace(t)); } else if (t instanceof SystemException) { results.append(formatStackTrace(t)); Throwable cause = t.getCause(); if (cause != null) { results.append("\nCause:\n"); results.append(cause.getMessage()); results.append("\n"); } results.append(formatStackTrace(t)); } } return results.toString(); } else { return null; } }
java
public String formatErrors() { if (errors.size() > 0) { StringBuilder results = new StringBuilder(); for (Throwable t : errors) { results.append(t.getMessage()); results.append("\n"); if (t instanceof NullPointerException || t instanceof CompilerError) { results.append(formatStackTrace(t)); } else if (t instanceof SystemException) { results.append(formatStackTrace(t)); Throwable cause = t.getCause(); if (cause != null) { results.append("\nCause:\n"); results.append(cause.getMessage()); results.append("\n"); } results.append(formatStackTrace(t)); } } return results.toString(); } else { return null; } }
[ "public", "String", "formatErrors", "(", ")", "{", "if", "(", "errors", ".", "size", "(", ")", ">", "0", ")", "{", "StringBuilder", "results", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Throwable", "t", ":", "errors", ")", "{", "results...
Format the exceptions thrown during the compilation process. A null value will be returned if no exceptions were thrown. @return String containing exceptions thrown during execution or null if none were thrown
[ "Format", "the", "exceptions", "thrown", "during", "the", "compilation", "process", ".", "A", "null", "value", "will", "be", "returned", "if", "no", "exceptions", "were", "thrown", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerResults.java#L99-L130
train
tvbarthel/Cheerleader
sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ui/SimpleSoundCloudUserView.java
SimpleSoundCloudUserView.init
private void init() { this.setOrientation(LinearLayout.VERTICAL); mLayoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); }
java
private void init() { this.setOrientation(LinearLayout.VERTICAL); mLayoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); }
[ "private", "void", "init", "(", ")", "{", "this", ".", "setOrientation", "(", "LinearLayout", ".", "VERTICAL", ")", ";", "mLayoutParams", "=", "new", "LayoutParams", "(", "ViewGroup", ".", "LayoutParams", ".", "MATCH_PARENT", ",", "ViewGroup", ".", "LayoutPara...
Initialize the view.
[ "Initialize", "the", "view", "." ]
f61527e4cc44fcd0ed2e1e98aca285f8c236f24e
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ui/SimpleSoundCloudUserView.java#L86-L89
train
quattor/pan
panc/src/main/java/org/quattor/pan/output/FormatterUtils.java
FormatterUtils.createParentDirectories
public static void createParentDirectories(File file) { File parent = file.getParentFile(); if (!parent.isDirectory()) { // Test the creation separately as there appears to be a race // condition that causes unit tests to sometimes fail. boolean created = parent.mkdirs(); if (!created && !parent.isDirectory()) { throw new SystemException(MessageUtils.format( MSG_CANNOT_CREATE_OUTPUT_DIRECTORY, parent.getAbsolutePath()), parent); } } }
java
public static void createParentDirectories(File file) { File parent = file.getParentFile(); if (!parent.isDirectory()) { // Test the creation separately as there appears to be a race // condition that causes unit tests to sometimes fail. boolean created = parent.mkdirs(); if (!created && !parent.isDirectory()) { throw new SystemException(MessageUtils.format( MSG_CANNOT_CREATE_OUTPUT_DIRECTORY, parent.getAbsolutePath()), parent); } } }
[ "public", "static", "void", "createParentDirectories", "(", "File", "file", ")", "{", "File", "parent", "=", "file", ".", "getParentFile", "(", ")", ";", "if", "(", "!", "parent", ".", "isDirectory", "(", ")", ")", "{", "// Test the creation separately as ther...
Creates parent directories of the given file. The file must be absolute. @param file absolute file to use for creating parent directories @throws SystemException if directory or directories cannot be created
[ "Creates", "parent", "directories", "of", "the", "given", "file", ".", "The", "file", "must", "be", "absolute", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/output/FormatterUtils.java#L78-L91
train
quattor/pan
panc/src/main/java/org/quattor/pan/dml/operators/SetValue.java
SetValue.checkStaticIndexes
protected static void checkStaticIndexes(SourceRange sourceRange, Operation... operations) throws SyntaxException { for (int i = 0; i < operations.length; i++) { if (operations[i] instanceof Element) { try { TermFactory.create((Element) operations[i]); } catch (EvaluationException ee) { throw SyntaxException.create(sourceRange, MSG_INVALID_TERM, i); } } } }
java
protected static void checkStaticIndexes(SourceRange sourceRange, Operation... operations) throws SyntaxException { for (int i = 0; i < operations.length; i++) { if (operations[i] instanceof Element) { try { TermFactory.create((Element) operations[i]); } catch (EvaluationException ee) { throw SyntaxException.create(sourceRange, MSG_INVALID_TERM, i); } } } }
[ "protected", "static", "void", "checkStaticIndexes", "(", "SourceRange", "sourceRange", ",", "Operation", "...", "operations", ")", "throws", "SyntaxException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "operations", ".", "length", ";", "i", "++"...
Ensure that any constant indexes in the operation list are valid terms.
[ "Ensure", "that", "any", "constant", "indexes", "in", "the", "operation", "list", "are", "valid", "terms", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/operators/SetValue.java#L74-L87
train
quattor/pan
panc/src/main/java/org/quattor/pan/dml/operators/SetValue.java
SetValue.validName
protected void validName(String name) throws SyntaxException { for (String varName : automaticVariables) { if (varName.equals(name)) { throw SyntaxException.create(getSourceRange(), MSG_AUTO_VAR_CANNOT_BE_SET, varName); } } }
java
protected void validName(String name) throws SyntaxException { for (String varName : automaticVariables) { if (varName.equals(name)) { throw SyntaxException.create(getSourceRange(), MSG_AUTO_VAR_CANNOT_BE_SET, varName); } } }
[ "protected", "void", "validName", "(", "String", "name", ")", "throws", "SyntaxException", "{", "for", "(", "String", "varName", ":", "automaticVariables", ")", "{", "if", "(", "varName", ".", "equals", "(", "name", ")", ")", "{", "throw", "SyntaxException",...
A utility method to determine if the variable name collides with one of the reserved 'automatic' variables. @param name variable name to check @throws SyntaxException when syntax error is detected
[ "A", "utility", "method", "to", "determine", "if", "the", "variable", "name", "collides", "with", "one", "of", "the", "reserved", "automatic", "variables", "." ]
009934a603dd0c08d3fa4bb7d9389c380a916f54
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/operators/SetValue.java#L97-L104
train
legsem/legstar.avro
legstar.avro.translator/src/main/java/com/legstar/avro/translator/Xsd2AvroTranslatorMain.java
Xsd2AvroTranslatorMain.getVersion
private String getVersion(boolean verbose) { try { InputStream stream = getClass().getResourceAsStream("/version.properties"); Properties props = new Properties(); props.load(stream); if (verbose) { return String.format("Version=%s, build date=%s", props.getProperty("version"), props.getProperty("buildDate")); } else { return props.getProperty("version"); } } catch (IOException e) { log.error("Unable to retrieve version", e); return "unknown"; } }
java
private String getVersion(boolean verbose) { try { InputStream stream = getClass().getResourceAsStream("/version.properties"); Properties props = new Properties(); props.load(stream); if (verbose) { return String.format("Version=%s, build date=%s", props.getProperty("version"), props.getProperty("buildDate")); } else { return props.getProperty("version"); } } catch (IOException e) { log.error("Unable to retrieve version", e); return "unknown"; } }
[ "private", "String", "getVersion", "(", "boolean", "verbose", ")", "{", "try", "{", "InputStream", "stream", "=", "getClass", "(", ")", ".", "getResourceAsStream", "(", "\"/version.properties\"", ")", ";", "Properties", "props", "=", "new", "Properties", "(", ...
Retrieve the current version. @parm verbose when true will also return the build date @return the version number and build date
[ "Retrieve", "the", "current", "version", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.translator/src/main/java/com/legstar/avro/translator/Xsd2AvroTranslatorMain.java#L200-L216
train
legsem/legstar.avro
legstar.avro.translator/src/main/java/com/legstar/avro/translator/Xsd2AvroTranslatorMain.java
Xsd2AvroTranslatorMain.setDefaults
private void setDefaults() { if (xsdInput == null) { setXsdInput(DEFAULT_INPUT_FOLDER_PATH); } if (output == null) { setOutput(DEFAULT_OUTPUT_FOLDER_PATH); } if (avroNamespacePrefix == null) { setAvroNamespacePrefix(DEFAULT_AVRO_NAMESPACE_PREFIX); } }
java
private void setDefaults() { if (xsdInput == null) { setXsdInput(DEFAULT_INPUT_FOLDER_PATH); } if (output == null) { setOutput(DEFAULT_OUTPUT_FOLDER_PATH); } if (avroNamespacePrefix == null) { setAvroNamespacePrefix(DEFAULT_AVRO_NAMESPACE_PREFIX); } }
[ "private", "void", "setDefaults", "(", ")", "{", "if", "(", "xsdInput", "==", "null", ")", "{", "setXsdInput", "(", "DEFAULT_INPUT_FOLDER_PATH", ")", ";", "}", "if", "(", "output", "==", "null", ")", "{", "setOutput", "(", "DEFAULT_OUTPUT_FOLDER_PATH", ")", ...
Make sure mandatory parameters have default values.
[ "Make", "sure", "mandatory", "parameters", "have", "default", "values", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.translator/src/main/java/com/legstar/avro/translator/Xsd2AvroTranslatorMain.java#L232-L243
train
caduandrade/japura-gui
src/main/java/org/japura/gui/CollapsibleRootPanel.java
CollapsibleRootPanel.applyMax
private void applyMax(Dimension dim) { if (getMaxHeight() > 0) { dim.height = Math.min(dim.height, getMaxHeight()); } if (getMaxWidth() > 0) { dim.width = Math.min(dim.width, getMaxWidth()); } }
java
private void applyMax(Dimension dim) { if (getMaxHeight() > 0) { dim.height = Math.min(dim.height, getMaxHeight()); } if (getMaxWidth() > 0) { dim.width = Math.min(dim.width, getMaxWidth()); } }
[ "private", "void", "applyMax", "(", "Dimension", "dim", ")", "{", "if", "(", "getMaxHeight", "(", ")", ">", "0", ")", "{", "dim", ".", "height", "=", "Math", ".", "min", "(", "dim", ".", "height", ",", "getMaxHeight", "(", ")", ")", ";", "}", "if...
Applies the maximum height and width to the dimension. @param dim the dimension to be limited
[ "Applies", "the", "maximum", "height", "and", "width", "to", "the", "dimension", "." ]
0ea556329843c978d2863d3731a6df244d18d4ca
https://github.com/caduandrade/japura-gui/blob/0ea556329843c978d2863d3731a6df244d18d4ca/src/main/java/org/japura/gui/CollapsibleRootPanel.java#L120-L127
train
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/AbstractCommandExtension.java
AbstractCommandExtension.analyzeElVars
protected void analyzeElVars(final T descriptor, final DescriptorContext context) { descriptor.el = ElAnalyzer.analyzeQuery(context.generics, descriptor.command); }
java
protected void analyzeElVars(final T descriptor, final DescriptorContext context) { descriptor.el = ElAnalyzer.analyzeQuery(context.generics, descriptor.command); }
[ "protected", "void", "analyzeElVars", "(", "final", "T", "descriptor", ",", "final", "DescriptorContext", "context", ")", "{", "descriptor", ".", "el", "=", "ElAnalyzer", ".", "analyzeQuery", "(", "context", ".", "generics", ",", "descriptor", ".", "command", ...
Analyze query string for el variables and creates el descriptor. @param descriptor repository method descriptor @param context repository method context
[ "Analyze", "query", "string", "for", "el", "variables", "and", "creates", "el", "descriptor", "." ]
5ef06fb4f734360512e9824a3b875c4906c56b5b
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/AbstractCommandExtension.java#L50-L52
train
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/AbstractCommandExtension.java
AbstractCommandExtension.analyzeParameters
protected void analyzeParameters(final T descriptor, final DescriptorContext context) { final CommandParamsContext paramsContext = new CommandParamsContext(context); spiService.process(descriptor, paramsContext); }
java
protected void analyzeParameters(final T descriptor, final DescriptorContext context) { final CommandParamsContext paramsContext = new CommandParamsContext(context); spiService.process(descriptor, paramsContext); }
[ "protected", "void", "analyzeParameters", "(", "final", "T", "descriptor", ",", "final", "DescriptorContext", "context", ")", "{", "final", "CommandParamsContext", "paramsContext", "=", "new", "CommandParamsContext", "(", "context", ")", ";", "spiService", ".", "pro...
Analyze method parameters, search for extensions and prepare parameters context. @param descriptor repository method descriptor @param context repository method context
[ "Analyze", "method", "parameters", "search", "for", "extensions", "and", "prepare", "parameters", "context", "." ]
5ef06fb4f734360512e9824a3b875c4906c56b5b
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/AbstractCommandExtension.java#L60-L63
train
caduandrade/japura-gui
src/main/java/org/japura/gui/WrapLabel.java
WrapLabel.wrapText
private void wrapText() { if (getFont() == null || text == null) { return; } FontMetrics fm = getFontMetrics(getFont()); StringBuilder tempText = new StringBuilder(); StringBuilder finalText = new StringBuilder("<html>"); finalText.append("<STYLE type='text/css'>BODY { text-align: "); finalText.append(align.name().toLowerCase()); finalText.append("}</STYLE><BODY>"); ArrayList<String> words = new ArrayList<String>(); text = text.replaceAll("\n", "<BR>"); String split[] = text.split("<BR>"); for (int i = 0; i < split.length; i++) { if (split[i].length() > 0) { String split2[] = split[i].split("[ \\t\\x0B\\f\\r]+"); for (int j = 0; j < split2.length; j++) { if (split2[j].length() > 0) { words.add(split2[j]); } } } if (i < split.length - 1) { words.add("<BR>"); } } for (String word : words) { if (word.equals("<BR>")) { finalText.append("<BR>"); tempText.setLength(0); } else { tempText.append(" "); tempText.append(word); int tempWidth = SwingUtilities.computeStringWidth(fm, tempText.toString().trim()); if ((wrapWidth > 0 && tempWidth > wrapWidth)) { int wordSize = SwingUtilities.computeStringWidth(fm, word); if (wordSize >= wrapWidth) { finalText.append("..."); break; } finalText.append("<BR>"); tempText.setLength(0); tempText.append(word); } if (tempText.length() > 0) { finalText.append(" "); } finalText.append(word); } } finalText.append("</BODY></html>"); super.setText(finalText.toString()); }
java
private void wrapText() { if (getFont() == null || text == null) { return; } FontMetrics fm = getFontMetrics(getFont()); StringBuilder tempText = new StringBuilder(); StringBuilder finalText = new StringBuilder("<html>"); finalText.append("<STYLE type='text/css'>BODY { text-align: "); finalText.append(align.name().toLowerCase()); finalText.append("}</STYLE><BODY>"); ArrayList<String> words = new ArrayList<String>(); text = text.replaceAll("\n", "<BR>"); String split[] = text.split("<BR>"); for (int i = 0; i < split.length; i++) { if (split[i].length() > 0) { String split2[] = split[i].split("[ \\t\\x0B\\f\\r]+"); for (int j = 0; j < split2.length; j++) { if (split2[j].length() > 0) { words.add(split2[j]); } } } if (i < split.length - 1) { words.add("<BR>"); } } for (String word : words) { if (word.equals("<BR>")) { finalText.append("<BR>"); tempText.setLength(0); } else { tempText.append(" "); tempText.append(word); int tempWidth = SwingUtilities.computeStringWidth(fm, tempText.toString().trim()); if ((wrapWidth > 0 && tempWidth > wrapWidth)) { int wordSize = SwingUtilities.computeStringWidth(fm, word); if (wordSize >= wrapWidth) { finalText.append("..."); break; } finalText.append("<BR>"); tempText.setLength(0); tempText.append(word); } if (tempText.length() > 0) { finalText.append(" "); } finalText.append(word); } } finalText.append("</BODY></html>"); super.setText(finalText.toString()); }
[ "private", "void", "wrapText", "(", ")", "{", "if", "(", "getFont", "(", ")", "==", "null", "||", "text", "==", "null", ")", "{", "return", ";", "}", "FontMetrics", "fm", "=", "getFontMetrics", "(", "getFont", "(", ")", ")", ";", "StringBuilder", "te...
The plain text is converted to HTML code. The wrap locations are calculated with the defined wrap width and component width.
[ "The", "plain", "text", "is", "converted", "to", "HTML", "code", ".", "The", "wrap", "locations", "are", "calculated", "with", "the", "defined", "wrap", "width", "and", "component", "width", "." ]
0ea556329843c978d2863d3731a6df244d18d4ca
https://github.com/caduandrade/japura-gui/blob/0ea556329843c978d2863d3731a6df244d18d4ca/src/main/java/org/japura/gui/WrapLabel.java#L83-L146
train
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/db/scheme/initializer/ext/field/index/IndexValidationSupport.java
IndexValidationSupport.checkFieldsCompatible
public void checkFieldsCompatible(final String... fields) { final Set<String> indexFields = Sets.newHashSet(index.getDefinition().getFields()); final Joiner joiner = Joiner.on(","); check(indexFields.equals(Sets.newHashSet(fields)), "Existing index '%s' (class '%s') fields '%s' are different from '%s'.", index.getName(), index.getDefinition().getClassName(), joiner.join(indexFields), joiner.join(fields)); }
java
public void checkFieldsCompatible(final String... fields) { final Set<String> indexFields = Sets.newHashSet(index.getDefinition().getFields()); final Joiner joiner = Joiner.on(","); check(indexFields.equals(Sets.newHashSet(fields)), "Existing index '%s' (class '%s') fields '%s' are different from '%s'.", index.getName(), index.getDefinition().getClassName(), joiner.join(indexFields), joiner.join(fields)); }
[ "public", "void", "checkFieldsCompatible", "(", "final", "String", "...", "fields", ")", "{", "final", "Set", "<", "String", ">", "indexFields", "=", "Sets", ".", "newHashSet", "(", "index", ".", "getDefinition", "(", ")", ".", "getFields", "(", ")", ")", ...
Checks if existing index consists of exactly the same fields. If not, error thrown to indicate probable programmer error. @param fields new signature index fields
[ "Checks", "if", "existing", "index", "consists", "of", "exactly", "the", "same", "fields", ".", "If", "not", "error", "thrown", "to", "indicate", "probable", "programmer", "error", "." ]
5ef06fb4f734360512e9824a3b875c4906c56b5b
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/db/scheme/initializer/ext/field/index/IndexValidationSupport.java#L75-L81
train
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/db/scheme/initializer/ext/field/index/IndexValidationSupport.java
IndexValidationSupport.dropIndex
public void dropIndex(final ODatabaseObject db) { final String name = index.getName(); logger.info("Dropping existing index '{}' (class '{}'), because of definition mismatch", name, index.getDefinition().getClassName()); SchemeUtils.dropIndex(db, name); }
java
public void dropIndex(final ODatabaseObject db) { final String name = index.getName(); logger.info("Dropping existing index '{}' (class '{}'), because of definition mismatch", name, index.getDefinition().getClassName()); SchemeUtils.dropIndex(db, name); }
[ "public", "void", "dropIndex", "(", "final", "ODatabaseObject", "db", ")", "{", "final", "String", "name", "=", "index", ".", "getName", "(", ")", ";", "logger", ".", "info", "(", "\"Dropping existing index '{}' (class '{}'), because of definition mismatch\"", ",", ...
Drops index. @param db database object
[ "Drops", "index", "." ]
5ef06fb4f734360512e9824a3b875c4906c56b5b
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/db/scheme/initializer/ext/field/index/IndexValidationSupport.java#L88-L93
train
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/db/scheme/initializer/ext/field/index/IndexValidationSupport.java
IndexValidationSupport.isIndexSigns
@SuppressWarnings("PMD.LinguisticNaming") public IndexMatchVerifier isIndexSigns(final Object... signs) { final List<Object> idxsigns = Lists.newArrayList(); idxsigns.add(index.getType()); idxsigns.addAll(Arrays.asList(signs)); return new IndexMatchVerifier(idxsigns); }
java
@SuppressWarnings("PMD.LinguisticNaming") public IndexMatchVerifier isIndexSigns(final Object... signs) { final List<Object> idxsigns = Lists.newArrayList(); idxsigns.add(index.getType()); idxsigns.addAll(Arrays.asList(signs)); return new IndexMatchVerifier(idxsigns); }
[ "@", "SuppressWarnings", "(", "\"PMD.LinguisticNaming\"", ")", "public", "IndexMatchVerifier", "isIndexSigns", "(", "final", "Object", "...", "signs", ")", "{", "final", "List", "<", "Object", ">", "idxsigns", "=", "Lists", ".", "newArrayList", "(", ")", ";", ...
Compares current index configuration with new signature. Used to decide if index should be dropped and re-created or its completely equal to new signature. @param signs original index signs to compare @return matcher object to specify new signature signs (order is important!)
[ "Compares", "current", "index", "configuration", "with", "new", "signature", ".", "Used", "to", "decide", "if", "index", "should", "be", "dropped", "and", "re", "-", "created", "or", "its", "completely", "equal", "to", "new", "signature", "." ]
5ef06fb4f734360512e9824a3b875c4906c56b5b
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/db/scheme/initializer/ext/field/index/IndexValidationSupport.java#L102-L108
train
legsem/legstar.avro
legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java
Cob2AvroJob.getInputKeyCobolContext
public static Class<? extends CobolContext> getInputKeyCobolContext(Configuration conf) { return conf.getClass(CONF_INPUT_KEY_COBOL_CONTEXT, null, CobolContext.class); }
java
public static Class<? extends CobolContext> getInputKeyCobolContext(Configuration conf) { return conf.getClass(CONF_INPUT_KEY_COBOL_CONTEXT, null, CobolContext.class); }
[ "public", "static", "Class", "<", "?", "extends", "CobolContext", ">", "getInputKeyCobolContext", "(", "Configuration", "conf", ")", "{", "return", "conf", ".", "getClass", "(", "CONF_INPUT_KEY_COBOL_CONTEXT", ",", "null", ",", "CobolContext", ".", "class", ")", ...
Gets the job input key mainframe COBOL parameters. @param conf The job configuration. @return The job input key mainframe COBOL parameters, or null if not set.
[ "Gets", "the", "job", "input", "key", "mainframe", "COBOL", "parameters", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java#L50-L52
train
legsem/legstar.avro
legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java
Cob2AvroJob.setInputKeyRecordType
public static void setInputKeyRecordType(Job job, Class<? extends CobolComplexType> cobolType) { job.getConfiguration().setClass(CONF_INPUT_KEY_RECORD_TYPE, cobolType, CobolComplexType.class); }
java
public static void setInputKeyRecordType(Job job, Class<? extends CobolComplexType> cobolType) { job.getConfiguration().setClass(CONF_INPUT_KEY_RECORD_TYPE, cobolType, CobolComplexType.class); }
[ "public", "static", "void", "setInputKeyRecordType", "(", "Job", "job", ",", "Class", "<", "?", "extends", "CobolComplexType", ">", "cobolType", ")", "{", "job", ".", "getConfiguration", "(", ")", ".", "setClass", "(", "CONF_INPUT_KEY_RECORD_TYPE", ",", "cobolTy...
Sets the job input key mainframe record type. @param job The job to configure. @param cobolType The input key mainframe record type.
[ "Sets", "the", "job", "input", "key", "mainframe", "record", "type", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java#L60-L62
train
legsem/legstar.avro
legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java
Cob2AvroJob.getInputKeyRecordType
public static Class<? extends CobolComplexType> getInputKeyRecordType(Configuration conf) { return conf.getClass(CONF_INPUT_KEY_RECORD_TYPE, null, CobolComplexType.class); }
java
public static Class<? extends CobolComplexType> getInputKeyRecordType(Configuration conf) { return conf.getClass(CONF_INPUT_KEY_RECORD_TYPE, null, CobolComplexType.class); }
[ "public", "static", "Class", "<", "?", "extends", "CobolComplexType", ">", "getInputKeyRecordType", "(", "Configuration", "conf", ")", "{", "return", "conf", ".", "getClass", "(", "CONF_INPUT_KEY_RECORD_TYPE", ",", "null", ",", "CobolComplexType", ".", "class", ")...
Gets the job input key mainframe record type. @param conf The job configuration. @return The job input key mainframe record type, or null if not set.
[ "Gets", "the", "job", "input", "key", "mainframe", "record", "type", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java#L70-L72
train
legsem/legstar.avro
legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java
Cob2AvroJob.setInputRecordMatcher
public static void setInputRecordMatcher(Job job, Class<? extends CobolTypeFinder> matcherClass) { job.getConfiguration().setClass(CONF_INPUT_RECORD_MATCHER_CLASS, matcherClass, CobolTypeFinder.class); }
java
public static void setInputRecordMatcher(Job job, Class<? extends CobolTypeFinder> matcherClass) { job.getConfiguration().setClass(CONF_INPUT_RECORD_MATCHER_CLASS, matcherClass, CobolTypeFinder.class); }
[ "public", "static", "void", "setInputRecordMatcher", "(", "Job", "job", ",", "Class", "<", "?", "extends", "CobolTypeFinder", ">", "matcherClass", ")", "{", "job", ".", "getConfiguration", "(", ")", ".", "setClass", "(", "CONF_INPUT_RECORD_MATCHER_CLASS", ",", "...
Sets the job input record matcher class. @param job The job to configure. @param matcherClass The input record matcher class.
[ "Sets", "the", "job", "input", "record", "matcher", "class", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java#L80-L82
train
legsem/legstar.avro
legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java
Cob2AvroJob.getInputRecordMatcher
public static Class<? extends CobolTypeFinder> getInputRecordMatcher(Configuration conf) { return conf.getClass(CONF_INPUT_RECORD_MATCHER_CLASS, null, CobolTypeFinder.class); }
java
public static Class<? extends CobolTypeFinder> getInputRecordMatcher(Configuration conf) { return conf.getClass(CONF_INPUT_RECORD_MATCHER_CLASS, null, CobolTypeFinder.class); }
[ "public", "static", "Class", "<", "?", "extends", "CobolTypeFinder", ">", "getInputRecordMatcher", "(", "Configuration", "conf", ")", "{", "return", "conf", ".", "getClass", "(", "CONF_INPUT_RECORD_MATCHER_CLASS", ",", "null", ",", "CobolTypeFinder", ".", "class", ...
Gets the job input record matcher class. @param conf The job configuration. @return The job input record matcher class, or null if not set.
[ "Gets", "the", "job", "input", "record", "matcher", "class", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java#L90-L92
train
legsem/legstar.avro
legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java
Cob2AvroJob.setInputChoiceStrategy
public static void setInputChoiceStrategy(Job job, Class<? extends FromCobolChoiceStrategy> choiceStrategyClass) { job.getConfiguration().setClass(CONF_INPUT_RECORD_CHOICE_STRATEGY_CLASS, choiceStrategyClass, FromCobolChoiceStrategy.class); }
java
public static void setInputChoiceStrategy(Job job, Class<? extends FromCobolChoiceStrategy> choiceStrategyClass) { job.getConfiguration().setClass(CONF_INPUT_RECORD_CHOICE_STRATEGY_CLASS, choiceStrategyClass, FromCobolChoiceStrategy.class); }
[ "public", "static", "void", "setInputChoiceStrategy", "(", "Job", "job", ",", "Class", "<", "?", "extends", "FromCobolChoiceStrategy", ">", "choiceStrategyClass", ")", "{", "job", ".", "getConfiguration", "(", ")", ".", "setClass", "(", "CONF_INPUT_RECORD_CHOICE_STR...
Sets the job input record choice strategy class. @param job The job to configure. @param choiceStrategyClass The input record choice strategy class.
[ "Sets", "the", "job", "input", "record", "choice", "strategy", "class", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java#L100-L102
train
legsem/legstar.avro
legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java
Cob2AvroJob.getInputChoiceStrategy
public static Class<? extends FromCobolChoiceStrategy> getInputChoiceStrategy(Configuration conf) { return conf.getClass(CONF_INPUT_RECORD_CHOICE_STRATEGY_CLASS, null, FromCobolChoiceStrategy.class); }
java
public static Class<? extends FromCobolChoiceStrategy> getInputChoiceStrategy(Configuration conf) { return conf.getClass(CONF_INPUT_RECORD_CHOICE_STRATEGY_CLASS, null, FromCobolChoiceStrategy.class); }
[ "public", "static", "Class", "<", "?", "extends", "FromCobolChoiceStrategy", ">", "getInputChoiceStrategy", "(", "Configuration", "conf", ")", "{", "return", "conf", ".", "getClass", "(", "CONF_INPUT_RECORD_CHOICE_STRATEGY_CLASS", ",", "null", ",", "FromCobolChoiceStrat...
Gets the job input record choice strategy class. @param conf The job configuration. @return The job input record choice strategy class, or null if not set.
[ "Gets", "the", "job", "input", "record", "choice", "strategy", "class", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java#L110-L112
train
legsem/legstar.avro
legstar.avro.cob2avro/src/main/java/com/legstar/avro/cob2avro/io/AbstractZosDatumReader.java
AbstractZosDatumReader.readFully
public int readFully(byte b[], int off, int len) throws IOException { IOUtils.readFully(inStream, b, off, len); return len; }
java
public int readFully(byte b[], int off, int len) throws IOException { IOUtils.readFully(inStream, b, off, len); return len; }
[ "public", "int", "readFully", "(", "byte", "b", "[", "]", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "IOUtils", ".", "readFully", "(", "inStream", ",", "b", ",", "off", ",", "len", ")", ";", "return", "len", ";", "}" ]
Read a number of bytes from the input stream, blocking until all requested bytes are read or end of file is reached. @param b the buffer to bill @param off offset in buffer where to start filling @param len how many bytes we should read @return the total number of bytes read @throws IOException if end of file reached without getting all requested bytes
[ "Read", "a", "number", "of", "bytes", "from", "the", "input", "stream", "blocking", "until", "all", "requested", "bytes", "are", "read", "or", "end", "of", "file", "is", "reached", "." ]
bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro/src/main/java/com/legstar/avro/cob2avro/io/AbstractZosDatumReader.java#L255-L258
train