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
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.fireOnUnbind
private void fireOnUnbind(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onUnbind(e); } }
java
private void fireOnUnbind(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onUnbind(e); } }
[ "private", "void", "fireOnUnbind", "(", "ChannelEvent", "e", ")", "{", "List", "<", "EventListener", ">", "listeners", "=", "changes", ".", "getListenerList", "(", "AMQP", ")", ";", "for", "(", "EventListener", "listener", ":", "listeners", ")", "{", "Channe...
Fired on Unbind event @param e
[ "Fired", "on", "Unbind", "event" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L1402-L1408
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.fireOnDeleteQueue
private void fireOnDeleteQueue(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onDeleteQueue(e); } }
java
private void fireOnDeleteQueue(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onDeleteQueue(e); } }
[ "private", "void", "fireOnDeleteQueue", "(", "ChannelEvent", "e", ")", "{", "List", "<", "EventListener", ">", "listeners", "=", "changes", ".", "getListenerList", "(", "AMQP", ")", ";", "for", "(", "EventListener", "listener", ":", "listeners", ")", "{", "C...
Fired when queue is deleted @param e
[ "Fired", "when", "queue", "is", "deleted" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L1415-L1421
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.fireOnDeleteExchange
private void fireOnDeleteExchange(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onDeleteExchange(e); } }
java
private void fireOnDeleteExchange(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onDeleteExchange(e); } }
[ "private", "void", "fireOnDeleteExchange", "(", "ChannelEvent", "e", ")", "{", "List", "<", "EventListener", ">", "listeners", "=", "changes", ".", "getListenerList", "(", "AMQP", ")", ";", "for", "(", "EventListener", "listener", ":", "listeners", ")", "{", ...
Fired when exchange is deleted @param e
[ "Fired", "when", "exchange", "is", "deleted" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L1428-L1434
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.fireOnCancelBasic
private void fireOnCancelBasic(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onCancelBasic(e); } }
java
private void fireOnCancelBasic(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onCancelBasic(e); } }
[ "private", "void", "fireOnCancelBasic", "(", "ChannelEvent", "e", ")", "{", "List", "<", "EventListener", ">", "listeners", "=", "changes", ".", "getListenerList", "(", "AMQP", ")", ";", "for", "(", "EventListener", "listener", ":", "listeners", ")", "{", "C...
Fired on cancel basic @param e
[ "Fired", "on", "cancel", "basic" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L1441-L1447
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.fireOnGetBasic
private void fireOnGetBasic(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onGetBasic(e); } }
java
private void fireOnGetBasic(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onGetBasic(e); } }
[ "private", "void", "fireOnGetBasic", "(", "ChannelEvent", "e", ")", "{", "List", "<", "EventListener", ">", "listeners", "=", "changes", ".", "getListenerList", "(", "AMQP", ")", ";", "for", "(", "EventListener", "listener", ":", "listeners", ")", "{", "Chan...
Fired on get basic @param e
[ "Fired", "on", "get", "basic" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L1454-L1460
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.fireOnPurgeQueue
private void fireOnPurgeQueue(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onPurgeQueue(e); } }
java
private void fireOnPurgeQueue(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onPurgeQueue(e); } }
[ "private", "void", "fireOnPurgeQueue", "(", "ChannelEvent", "e", ")", "{", "List", "<", "EventListener", ">", "listeners", "=", "changes", ".", "getListenerList", "(", "AMQP", ")", ";", "for", "(", "EventListener", "listener", ":", "listeners", ")", "{", "Ch...
Fired on purge queue @param e
[ "Fired", "on", "purge", "queue" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L1467-L1473
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.fireOnRecoverBasic
private void fireOnRecoverBasic(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onRecoverBasic(e); } }
java
private void fireOnRecoverBasic(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onRecoverBasic(e); } }
[ "private", "void", "fireOnRecoverBasic", "(", "ChannelEvent", "e", ")", "{", "List", "<", "EventListener", ">", "listeners", "=", "changes", ".", "getListenerList", "(", "AMQP", ")", ";", "for", "(", "EventListener", "listener", ":", "listeners", ")", "{", "...
Fired on recover basic @param e
[ "Fired", "on", "recover", "basic" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L1480-L1486
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.fireOnRejectBasic
private void fireOnRejectBasic(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onRejectBasic(e); } }
java
private void fireOnRejectBasic(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onRejectBasic(e); } }
[ "private", "void", "fireOnRejectBasic", "(", "ChannelEvent", "e", ")", "{", "List", "<", "EventListener", ">", "listeners", "=", "changes", ".", "getListenerList", "(", "AMQP", ")", ";", "for", "(", "EventListener", "listener", ":", "listeners", ")", "{", "C...
Fired on reject basic @param e
[ "Fired", "on", "reject", "basic" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L1493-L1499
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/impl/ws/WebSocketCompositeHandler.java
WebSocketCompositeHandler.processConnect
@Override public void processConnect(WebSocketChannel channel, WSURI location, String[] protocols) { LOG.entering(CLASS_NAME, "connect", channel); WebSocketCompositeChannel compositeChannel = (WebSocketCompositeChannel)channel; if (compositeChannel.readyState != ReadyState.CLOSED) { LOG.warning("Attempt to reconnect an existing open WebSocket to a different location"); throw new IllegalStateException("Attempt to reconnect an existing open WebSocket to a different location"); } compositeChannel.readyState = ReadyState.CONNECTING; compositeChannel.requestedProtocols = protocols; String scheme = compositeChannel.getCompositeScheme(); if (scheme.indexOf(":") >= 0) { // qualified scheme: e.g. "java:wse" WebSocketStrategy strategy = strategyMap.get(scheme); if (strategy == null) { throw new IllegalArgumentException("Invalid connection scheme: "+scheme); } LOG.finest("Turning off fallback since the URL is prefixed with java:"); compositeChannel.connectionStrategies.add(scheme); } else { String[] connectionStrategies = strategyChoices.get(scheme); if (connectionStrategies != null) { for (String each : connectionStrategies) { compositeChannel.connectionStrategies.add(each); } } else { throw new IllegalArgumentException("Invalid connection scheme: "+scheme); } } fallbackNext(compositeChannel, null); }
java
@Override public void processConnect(WebSocketChannel channel, WSURI location, String[] protocols) { LOG.entering(CLASS_NAME, "connect", channel); WebSocketCompositeChannel compositeChannel = (WebSocketCompositeChannel)channel; if (compositeChannel.readyState != ReadyState.CLOSED) { LOG.warning("Attempt to reconnect an existing open WebSocket to a different location"); throw new IllegalStateException("Attempt to reconnect an existing open WebSocket to a different location"); } compositeChannel.readyState = ReadyState.CONNECTING; compositeChannel.requestedProtocols = protocols; String scheme = compositeChannel.getCompositeScheme(); if (scheme.indexOf(":") >= 0) { // qualified scheme: e.g. "java:wse" WebSocketStrategy strategy = strategyMap.get(scheme); if (strategy == null) { throw new IllegalArgumentException("Invalid connection scheme: "+scheme); } LOG.finest("Turning off fallback since the URL is prefixed with java:"); compositeChannel.connectionStrategies.add(scheme); } else { String[] connectionStrategies = strategyChoices.get(scheme); if (connectionStrategies != null) { for (String each : connectionStrategies) { compositeChannel.connectionStrategies.add(each); } } else { throw new IllegalArgumentException("Invalid connection scheme: "+scheme); } } fallbackNext(compositeChannel, null); }
[ "@", "Override", "public", "void", "processConnect", "(", "WebSocketChannel", "channel", ",", "WSURI", "location", ",", "String", "[", "]", "protocols", ")", "{", "LOG", ".", "entering", "(", "CLASS_NAME", ",", "\"connect\"", ",", "channel", ")", ";", "WebSo...
Connect the WebSocket object to the remote location @param channel WebSocket channel @param location location of the WebSocket @param protocol protocol spoken over the WebSocket
[ "Connect", "the", "WebSocket", "object", "to", "the", "remote", "location" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/impl/ws/WebSocketCompositeHandler.java#L145-L182
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/impl/ws/WebSocketCompositeHandler.java
WebSocketCompositeHandler.processTextMessage
@Override public void processTextMessage(WebSocketChannel channel, String message) { LOG.entering(CLASS_NAME, "send", message); WebSocketCompositeChannel parent = (WebSocketCompositeChannel)channel; if (parent.readyState != ReadyState.OPEN) { LOG.warning("Attempt to post message on unopened or closed web socket"); throw new IllegalStateException("Attempt to post message on unopened or closed web socket"); } WebSocketSelectedChannel selectedChannel = parent.selectedChannel; selectedChannel.handler.processTextMessage(selectedChannel, message); }
java
@Override public void processTextMessage(WebSocketChannel channel, String message) { LOG.entering(CLASS_NAME, "send", message); WebSocketCompositeChannel parent = (WebSocketCompositeChannel)channel; if (parent.readyState != ReadyState.OPEN) { LOG.warning("Attempt to post message on unopened or closed web socket"); throw new IllegalStateException("Attempt to post message on unopened or closed web socket"); } WebSocketSelectedChannel selectedChannel = parent.selectedChannel; selectedChannel.handler.processTextMessage(selectedChannel, message); }
[ "@", "Override", "public", "void", "processTextMessage", "(", "WebSocketChannel", "channel", ",", "String", "message", ")", "{", "LOG", ".", "entering", "(", "CLASS_NAME", ",", "\"send\"", ",", "message", ")", ";", "WebSocketCompositeChannel", "parent", "=", "("...
Writes the message to the WebSocket. @param message String to be written @throws Exception if contents cannot be written successfully
[ "Writes", "the", "message", "to", "the", "WebSocket", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/impl/ws/WebSocketCompositeHandler.java#L228-L240
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyDispatcher.java
KeyDispatcher.removeChatGrabber
public void removeChatGrabber (JTextComponent comp) { // remove the component from the list of grabbers comp.removeAncestorListener(this); _chatGrabbers.remove(comp); // update the current chat grabbing component _curChatGrabber = _chatGrabbers.isEmpty() ? null : _chatGrabbers.getLast(); }
java
public void removeChatGrabber (JTextComponent comp) { // remove the component from the list of grabbers comp.removeAncestorListener(this); _chatGrabbers.remove(comp); // update the current chat grabbing component _curChatGrabber = _chatGrabbers.isEmpty() ? null : _chatGrabbers.getLast(); }
[ "public", "void", "removeChatGrabber", "(", "JTextComponent", "comp", ")", "{", "// remove the component from the list of grabbers", "comp", ".", "removeAncestorListener", "(", "this", ")", ";", "_chatGrabbers", ".", "remove", "(", "comp", ")", ";", "// update the curre...
Removes the specified component from the list of chat grabbers so that it will no longer be notified of chat-like key events.
[ "Removes", "the", "specified", "component", "from", "the", "list", "of", "chat", "grabbers", "so", "that", "it", "will", "no", "longer", "be", "notified", "of", "chat", "-", "like", "key", "events", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyDispatcher.java#L113-L122
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyDispatcher.java
KeyDispatcher.isTypeableTarget
protected boolean isTypeableTarget (Component target) { return target.isShowing() && (((target instanceof JTextComponent) && ((JTextComponent) target).isEditable()) || (target instanceof JComboBox) || (target instanceof JTable) || (target instanceof JRootPane)); }
java
protected boolean isTypeableTarget (Component target) { return target.isShowing() && (((target instanceof JTextComponent) && ((JTextComponent) target).isEditable()) || (target instanceof JComboBox) || (target instanceof JTable) || (target instanceof JRootPane)); }
[ "protected", "boolean", "isTypeableTarget", "(", "Component", "target", ")", "{", "return", "target", ".", "isShowing", "(", ")", "&&", "(", "(", "(", "target", "instanceof", "JTextComponent", ")", "&&", "(", "(", "JTextComponent", ")", "target", ")", ".", ...
Returns true if the specified target component supports being typed into, and thus we shouldn't steal focus away from it if the user starts typing.
[ "Returns", "true", "if", "the", "specified", "target", "component", "supports", "being", "typed", "into", "and", "thus", "we", "shouldn", "t", "steal", "focus", "away", "from", "it", "if", "the", "user", "starts", "typing", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyDispatcher.java#L197-L204
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyDispatcher.java
KeyDispatcher.windowLostFocus
public void windowLostFocus (WindowEvent e) { // un-press any keys that were left down if (!_downKeys.isEmpty()) { long now = System.currentTimeMillis(); for (KeyEvent down : _downKeys.values()) { KeyEvent up = new KeyEvent( down.getComponent(), KeyEvent.KEY_RELEASED, now, down.getModifiers(), down.getKeyCode(), down.getKeyChar(), down.getKeyLocation()); for (int ii = 0, nn = _listeners.size(); ii < nn; ii++) { _listeners.get(ii).keyReleased(up); } } _downKeys.clear(); } }
java
public void windowLostFocus (WindowEvent e) { // un-press any keys that were left down if (!_downKeys.isEmpty()) { long now = System.currentTimeMillis(); for (KeyEvent down : _downKeys.values()) { KeyEvent up = new KeyEvent( down.getComponent(), KeyEvent.KEY_RELEASED, now, down.getModifiers(), down.getKeyCode(), down.getKeyChar(), down.getKeyLocation()); for (int ii = 0, nn = _listeners.size(); ii < nn; ii++) { _listeners.get(ii).keyReleased(up); } } _downKeys.clear(); } }
[ "public", "void", "windowLostFocus", "(", "WindowEvent", "e", ")", "{", "// un-press any keys that were left down", "if", "(", "!", "_downKeys", ".", "isEmpty", "(", ")", ")", "{", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "for", ...
documentation inherited from interface WindowFocusListener
[ "documentation", "inherited", "from", "interface", "WindowFocusListener" ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyDispatcher.java#L221-L237
train
calrissian/mango
mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterables.java
CloseableIterables.distinct
public static <T> CloseableIterable<T> distinct(final CloseableIterable<T> iterable) { return wrap(Iterables2.distinct(iterable), iterable); }
java
public static <T> CloseableIterable<T> distinct(final CloseableIterable<T> iterable) { return wrap(Iterables2.distinct(iterable), iterable); }
[ "public", "static", "<", "T", ">", "CloseableIterable", "<", "T", ">", "distinct", "(", "final", "CloseableIterable", "<", "T", ">", "iterable", ")", "{", "return", "wrap", "(", "Iterables2", ".", "distinct", "(", "iterable", ")", ",", "iterable", ")", "...
If we can assume the closeable iterable is sorted, return the distinct elements. This only works if the data provided is sorted.
[ "If", "we", "can", "assume", "the", "closeable", "iterable", "is", "sorted", "return", "the", "distinct", "elements", ".", "This", "only", "works", "if", "the", "data", "provided", "is", "sorted", "." ]
a95aa5e77af9aa0e629787228d80806560023452
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterables.java#L90-L92
train
threerings/nenya
core/src/main/java/com/threerings/openal/Buffer.java
Buffer.delete
public void delete () { IntBuffer idbuf = BufferUtils.createIntBuffer(1); idbuf.put(_id).rewind(); AL10.alDeleteBuffers(idbuf); _id = 0; }
java
public void delete () { IntBuffer idbuf = BufferUtils.createIntBuffer(1); idbuf.put(_id).rewind(); AL10.alDeleteBuffers(idbuf); _id = 0; }
[ "public", "void", "delete", "(", ")", "{", "IntBuffer", "idbuf", "=", "BufferUtils", ".", "createIntBuffer", "(", "1", ")", ";", "idbuf", ".", "put", "(", "_id", ")", ".", "rewind", "(", ")", ";", "AL10", ".", "alDeleteBuffers", "(", "idbuf", ")", ";...
Deletes this buffer, rendering it unusable.
[ "Deletes", "this", "buffer", "rendering", "it", "unusable", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Buffer.java#L88-L94
train
threerings/nenya
core/src/main/java/com/threerings/miso/data/SparseMisoSceneModel.java
SparseMisoSceneModel.visitObjects
public void visitObjects (ObjectVisitor visitor, boolean interestingOnly) { for (Iterator<Section> iter = getSections(); iter.hasNext(); ) { Section sect = iter.next(); for (ObjectInfo oinfo : sect.objectInfo) { visitor.visit(oinfo); } if (!interestingOnly) { for (int oo = 0; oo < sect.objectTileIds.length; oo++) { ObjectInfo info = new ObjectInfo(); info.tileId = sect.objectTileIds[oo]; info.x = sect.objectXs[oo]; info.y = sect.objectYs[oo]; visitor.visit(info); } } } }
java
public void visitObjects (ObjectVisitor visitor, boolean interestingOnly) { for (Iterator<Section> iter = getSections(); iter.hasNext(); ) { Section sect = iter.next(); for (ObjectInfo oinfo : sect.objectInfo) { visitor.visit(oinfo); } if (!interestingOnly) { for (int oo = 0; oo < sect.objectTileIds.length; oo++) { ObjectInfo info = new ObjectInfo(); info.tileId = sect.objectTileIds[oo]; info.x = sect.objectXs[oo]; info.y = sect.objectYs[oo]; visitor.visit(info); } } } }
[ "public", "void", "visitObjects", "(", "ObjectVisitor", "visitor", ",", "boolean", "interestingOnly", ")", "{", "for", "(", "Iterator", "<", "Section", ">", "iter", "=", "getSections", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "Sect...
Informs the supplied visitor of each object in this scene. @param interestingOnly if true, only the interesting objects will be visited.
[ "Informs", "the", "supplied", "visitor", "of", "each", "object", "in", "this", "scene", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/data/SparseMisoSceneModel.java#L318-L335
train
threerings/nenya
core/src/main/java/com/threerings/miso/data/SparseMisoSceneModel.java
SparseMisoSceneModel.setSection
public void setSection (Section section) { _sections.put(key(section.x, section.y), section); }
java
public void setSection (Section section) { _sections.put(key(section.x, section.y), section); }
[ "public", "void", "setSection", "(", "Section", "section", ")", "{", "_sections", ".", "put", "(", "key", "(", "section", ".", "x", ",", "section", ".", "y", ")", ",", "section", ")", ";", "}" ]
Don't call this method! This is only public so that the scene parser can construct a scene from raw data. If only Java supported class friendship.
[ "Don", "t", "call", "this", "method!", "This", "is", "only", "public", "so", "that", "the", "scene", "parser", "can", "construct", "a", "scene", "from", "raw", "data", ".", "If", "only", "Java", "supported", "class", "friendship", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/data/SparseMisoSceneModel.java#L410-L413
train
threerings/nenya
core/src/main/java/com/threerings/miso/data/SparseMisoSceneModel.java
SparseMisoSceneModel.key
protected final int key (int x, int y) { int sx = MathUtil.floorDiv(x, swidth); int sy = MathUtil.floorDiv(y, sheight); return (sx << 16) | (sy & 0xFFFF); }
java
protected final int key (int x, int y) { int sx = MathUtil.floorDiv(x, swidth); int sy = MathUtil.floorDiv(y, sheight); return (sx << 16) | (sy & 0xFFFF); }
[ "protected", "final", "int", "key", "(", "int", "x", ",", "int", "y", ")", "{", "int", "sx", "=", "MathUtil", ".", "floorDiv", "(", "x", ",", "swidth", ")", ";", "int", "sy", "=", "MathUtil", ".", "floorDiv", "(", "y", ",", "sheight", ")", ";", ...
Returns the key for the specified section.
[ "Returns", "the", "key", "for", "the", "specified", "section", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/data/SparseMisoSceneModel.java#L435-L440
train
threerings/nenya
core/src/main/java/com/threerings/miso/data/SparseMisoSceneModel.java
SparseMisoSceneModel.getSection
protected final Section getSection (int x, int y, boolean create) { int key = key(x, y); Section sect = _sections.get(key); if (sect == null && create) { short sx = (short)(MathUtil.floorDiv(x, swidth)*swidth); short sy = (short)(MathUtil.floorDiv(y, sheight)*sheight); _sections.put(key, sect = new Section(sx, sy, swidth, sheight)); // Log.info("Created new section " + sect + "."); } return sect; }
java
protected final Section getSection (int x, int y, boolean create) { int key = key(x, y); Section sect = _sections.get(key); if (sect == null && create) { short sx = (short)(MathUtil.floorDiv(x, swidth)*swidth); short sy = (short)(MathUtil.floorDiv(y, sheight)*sheight); _sections.put(key, sect = new Section(sx, sy, swidth, sheight)); // Log.info("Created new section " + sect + "."); } return sect; }
[ "protected", "final", "Section", "getSection", "(", "int", "x", ",", "int", "y", ",", "boolean", "create", ")", "{", "int", "key", "=", "key", "(", "x", ",", "y", ")", ";", "Section", "sect", "=", "_sections", ".", "get", "(", "key", ")", ";", "i...
Returns the section for the specified tile coordinate.
[ "Returns", "the", "section", "for", "the", "specified", "tile", "coordinate", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/data/SparseMisoSceneModel.java#L443-L454
train
soabase/soabase
soabase-core/src/main/java/io/soabase/core/listening/ListenerContainer.java
ListenerContainer.forEach
public void forEach(final Function<T, Void> function) { for ( final ListenerEntry<T> entry : listeners.values() ) { entry.executor.execute ( new Runnable() { @Override public void run() { try { function.apply(entry.listener); } catch ( Throwable e ) { log.error(String.format("Listener (%s) threw an exception", entry.listener), e); } } } ); } }
java
public void forEach(final Function<T, Void> function) { for ( final ListenerEntry<T> entry : listeners.values() ) { entry.executor.execute ( new Runnable() { @Override public void run() { try { function.apply(entry.listener); } catch ( Throwable e ) { log.error(String.format("Listener (%s) threw an exception", entry.listener), e); } } } ); } }
[ "public", "void", "forEach", "(", "final", "Function", "<", "T", ",", "Void", ">", "function", ")", "{", "for", "(", "final", "ListenerEntry", "<", "T", ">", "entry", ":", "listeners", ".", "values", "(", ")", ")", "{", "entry", ".", "executor", ".",...
Utility - apply the given function to each listener. The function receives the listener as an argument. @param function function to call for each listener
[ "Utility", "-", "apply", "the", "given", "function", "to", "each", "listener", ".", "The", "function", "receives", "the", "listener", "as", "an", "argument", "." ]
4c27b090c09d3b2901cace91c3021505b187276d
https://github.com/soabase/soabase/blob/4c27b090c09d3b2901cace91c3021505b187276d/soabase-core/src/main/java/io/soabase/core/listening/ListenerContainer.java#L58-L81
train
threerings/nenya
core/src/main/java/com/threerings/media/sound/SoundPlayer.java
SoundPlayer.summarizeState
public String summarizeState () { StringBuilder buf = new StringBuilder(); buf.append("clipVol=").append(_clipVol); buf.append(", disabled=["); int ii = 0; for (SoundType soundType : _disabledTypes) { if (ii++ > 0) { buf.append(", "); } buf.append(soundType); } return buf.append("]").toString(); }
java
public String summarizeState () { StringBuilder buf = new StringBuilder(); buf.append("clipVol=").append(_clipVol); buf.append(", disabled=["); int ii = 0; for (SoundType soundType : _disabledTypes) { if (ii++ > 0) { buf.append(", "); } buf.append(soundType); } return buf.append("]").toString(); }
[ "public", "String", "summarizeState", "(", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "\"clipVol=\"", ")", ".", "append", "(", "_clipVol", ")", ";", "buf", ".", "append", "(", "\", disabled=[\""...
Returns a string summarizing our volume settings and disabled sound types.
[ "Returns", "a", "string", "summarizing", "our", "volume", "settings", "and", "disabled", "sound", "types", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sound/SoundPlayer.java#L116-L129
train
threerings/nenya
core/src/main/java/com/threerings/media/sound/SoundPlayer.java
SoundPlayer.shouldPlay
public boolean shouldPlay (SoundType type) { if (type == null) { type = DEFAULT; // let the lazy kids play too } return _clipVol != 0f && isEnabled(type); }
java
public boolean shouldPlay (SoundType type) { if (type == null) { type = DEFAULT; // let the lazy kids play too } return _clipVol != 0f && isEnabled(type); }
[ "public", "boolean", "shouldPlay", "(", "SoundType", "type", ")", "{", "if", "(", "type", "==", "null", ")", "{", "type", "=", "DEFAULT", ";", "// let the lazy kids play too", "}", "return", "_clipVol", "!=", "0f", "&&", "isEnabled", "(", "type", ")", ";",...
Is sound on and is the specified soundtype enabled?
[ "Is", "sound", "on", "and", "is", "the", "specified", "soundtype", "enabled?" ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sound/SoundPlayer.java#L143-L150
train
threerings/nenya
core/src/main/java/com/threerings/media/sound/SoundPlayer.java
SoundPlayer.setEnabled
public void setEnabled (final SoundType type, final boolean enabled) { boolean changed; if (enabled) { changed = _disabledTypes.remove(type); } else { changed = _disabledTypes.add(type); } if (changed) { _enabledObservers.apply(new ObserverOp<SoundEnabledObserver>() { public boolean apply (SoundEnabledObserver observer) { observer.enabledChanged(type, enabled); return true; } }); } }
java
public void setEnabled (final SoundType type, final boolean enabled) { boolean changed; if (enabled) { changed = _disabledTypes.remove(type); } else { changed = _disabledTypes.add(type); } if (changed) { _enabledObservers.apply(new ObserverOp<SoundEnabledObserver>() { public boolean apply (SoundEnabledObserver observer) { observer.enabledChanged(type, enabled); return true; } }); } }
[ "public", "void", "setEnabled", "(", "final", "SoundType", "type", ",", "final", "boolean", "enabled", ")", "{", "boolean", "changed", ";", "if", "(", "enabled", ")", "{", "changed", "=", "_disabledTypes", ".", "remove", "(", "type", ")", ";", "}", "else...
Turns on or off the specified sound type.
[ "Turns", "on", "or", "off", "the", "specified", "sound", "type", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sound/SoundPlayer.java#L155-L171
train
threerings/nenya
core/src/main/java/com/threerings/media/sound/SoundPlayer.java
SoundPlayer.play
public boolean play (SoundType type, String pkgPath, String key, float pan) { return play(type, pkgPath, key, 0, pan); }
java
public boolean play (SoundType type, String pkgPath, String key, float pan) { return play(type, pkgPath, key, 0, pan); }
[ "public", "boolean", "play", "(", "SoundType", "type", ",", "String", "pkgPath", ",", "String", "key", ",", "float", "pan", ")", "{", "return", "play", "(", "type", ",", "pkgPath", ",", "key", ",", "0", ",", "pan", ")", ";", "}" ]
Play the specified sound as the specified type of sound, immediately, with the specified pan value. Note that a sound need not be locked prior to playing. @param pan a value from -1f (all left) to +1f (all right). @return true if the sound actually played, or false if its sound type was disabled or if sound is off altogether.
[ "Play", "the", "specified", "sound", "as", "the", "specified", "type", "of", "sound", "immediately", "with", "the", "specified", "pan", "value", ".", "Note", "that", "a", "sound", "need", "not", "be", "locked", "prior", "to", "playing", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sound/SoundPlayer.java#L232-L235
train
jdillon/gshell
gshell-core/src/main/java/com/planet57/gshell/internal/HelpPageManagerImpl.java
HelpPageManagerImpl.addMetaPageInternal
private void addMetaPageInternal(final MetaHelpPage page) { log.debug("Adding meta-page: {}", page); metaPages.put(page.getName(), page); events.publish(new MetaHelpPageAddedEvent(page)); }
java
private void addMetaPageInternal(final MetaHelpPage page) { log.debug("Adding meta-page: {}", page); metaPages.put(page.getName(), page); events.publish(new MetaHelpPageAddedEvent(page)); }
[ "private", "void", "addMetaPageInternal", "(", "final", "MetaHelpPage", "page", ")", "{", "log", ".", "debug", "(", "\"Adding meta-page: {}\"", ",", "page", ")", ";", "metaPages", ".", "put", "(", "page", ".", "getName", "(", ")", ",", "page", ")", ";", ...
Exposed for discovery; which is before lifecycle has been started.
[ "Exposed", "for", "discovery", ";", "which", "is", "before", "lifecycle", "has", "been", "started", "." ]
b587c1a4672d2e4905871462fa3b38a1f7b94e90
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-core/src/main/java/com/planet57/gshell/internal/HelpPageManagerImpl.java#L206-L210
train
threerings/nenya
core/src/main/java/com/threerings/util/keybd/Keyboard.java
Keyboard.main
public static void main (String[] args) { boolean enabled = (args.length > 0 && args[0].equals("on")); Keyboard.setKeyRepeat(enabled); }
java
public static void main (String[] args) { boolean enabled = (args.length > 0 && args[0].equals("on")); Keyboard.setKeyRepeat(enabled); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "boolean", "enabled", "=", "(", "args", ".", "length", ">", "0", "&&", "args", "[", "0", "]", ".", "equals", "(", "\"on\"", ")", ")", ";", "Keyboard", ".", "setKeyRepeat...
Tests keyboard functionality.
[ "Tests", "keyboard", "functionality", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/keybd/Keyboard.java#L43-L47
train
threerings/nenya
core/src/main/java/com/threerings/media/animation/ScaleAnimation.java
ScaleAnimation.getSize
public static Point getSize (float scale, Mirage image) { int width = Math.max(0, Math.round(image.getWidth() * scale)); int height = Math.max(0, Math.round(image.getHeight() * scale)); return new Point(width, height); }
java
public static Point getSize (float scale, Mirage image) { int width = Math.max(0, Math.round(image.getWidth() * scale)); int height = Math.max(0, Math.round(image.getHeight() * scale)); return new Point(width, height); }
[ "public", "static", "Point", "getSize", "(", "float", "scale", ",", "Mirage", "image", ")", "{", "int", "width", "=", "Math", ".", "max", "(", "0", ",", "Math", ".", "round", "(", "image", ".", "getWidth", "(", ")", "*", "scale", ")", ")", ";", "...
Computes the width and height to which an image should be scaled.
[ "Computes", "the", "width", "and", "height", "to", "which", "an", "image", "should", "be", "scaled", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/animation/ScaleAnimation.java#L94-L99
train
threerings/nenya
core/src/main/java/com/threerings/media/animation/ScaleAnimation.java
ScaleAnimation.getCorner
public static Point getCorner (Point center, Point size) { return new Point(center.x - size.x/2, center.y - size.y/2); }
java
public static Point getCorner (Point center, Point size) { return new Point(center.x - size.x/2, center.y - size.y/2); }
[ "public", "static", "Point", "getCorner", "(", "Point", "center", ",", "Point", "size", ")", "{", "return", "new", "Point", "(", "center", ".", "x", "-", "size", ".", "x", "/", "2", ",", "center", ".", "y", "-", "size", ".", "y", "/", "2", ")", ...
Computes the upper left corner where the image should be drawn, given the center and dimensions to which the image should be scaled.
[ "Computes", "the", "upper", "left", "corner", "where", "the", "image", "should", "be", "drawn", "given", "the", "center", "and", "dimensions", "to", "which", "the", "image", "should", "be", "scaled", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/animation/ScaleAnimation.java#L105-L108
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/config/impl/MatchTransformerImpl.java
MatchTransformerImpl.group_map_
private static DecoratorMap group_map_(Map<String, PathMatcher> paths) { if (paths.isEmpty()) return concat(); return new DecoratorMap() { @Override public Stream<Consumer<MutableContext>> map(Stream<Consumer<MutableContext>> in, Context ctx) { final Map<String, TimeSeriesValueSet> pathMapping = paths.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, pmEntry -> { return ctx.getTSData() .getCurrentCollection() .get(p -> pmEntry.getValue().match(p.getPath()), x -> true); })); for (final Map.Entry<String, TimeSeriesValueSet> pm : pathMapping.entrySet()) { final String identifier = pm.getKey(); final List<Consumer<MutableContext>> applications = pm.getValue().stream() .map(group -> { Consumer<MutableContext> application = (nestedCtx) -> nestedCtx.putGroupAliasByName(identifier, group::getGroup); return application; }) .collect(Collectors.toList()); in = in.flatMap(inApplication -> applications.stream().map(inApplication::andThen)); } return in; } }; }
java
private static DecoratorMap group_map_(Map<String, PathMatcher> paths) { if (paths.isEmpty()) return concat(); return new DecoratorMap() { @Override public Stream<Consumer<MutableContext>> map(Stream<Consumer<MutableContext>> in, Context ctx) { final Map<String, TimeSeriesValueSet> pathMapping = paths.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, pmEntry -> { return ctx.getTSData() .getCurrentCollection() .get(p -> pmEntry.getValue().match(p.getPath()), x -> true); })); for (final Map.Entry<String, TimeSeriesValueSet> pm : pathMapping.entrySet()) { final String identifier = pm.getKey(); final List<Consumer<MutableContext>> applications = pm.getValue().stream() .map(group -> { Consumer<MutableContext> application = (nestedCtx) -> nestedCtx.putGroupAliasByName(identifier, group::getGroup); return application; }) .collect(Collectors.toList()); in = in.flatMap(inApplication -> applications.stream().map(inApplication::andThen)); } return in; } }; }
[ "private", "static", "DecoratorMap", "group_map_", "(", "Map", "<", "String", ",", "PathMatcher", ">", "paths", ")", "{", "if", "(", "paths", ".", "isEmpty", "(", ")", ")", "return", "concat", "(", ")", ";", "return", "new", "DecoratorMap", "(", ")", "...
Create a decorator map from a mapping of GroupMatchers.
[ "Create", "a", "decorator", "map", "from", "a", "mapping", "of", "GroupMatchers", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/config/impl/MatchTransformerImpl.java#L82-L111
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/config/impl/MatchTransformerImpl.java
MatchTransformerImpl.metric_map_
private static DecoratorMap metric_map_(Map<IdentifierPair, MetricMatcher> matchers) { if (matchers.isEmpty()) return concat(); return new DecoratorMap() { @Override public Stream<Consumer<MutableContext>> map(Stream<Consumer<MutableContext>> in, Context ctx) { final Map<IdentifierPair, List<Map.Entry<MetricMatcher.MatchedName, MetricValue>>> metricMapping = matchers.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, mmEntry -> mmEntry.getValue().filter(ctx).collect(Collectors.toList()))); for (final Map.Entry<IdentifierPair, List<Map.Entry<MetricMatcher.MatchedName, MetricValue>>> mm : metricMapping.entrySet()) { final String groupIdentifier = mm.getKey().getGroup(); final String metricIdentifier = mm.getKey().getMetric(); final List<Consumer<MutableContext>> applications = mm.getValue().stream() .map(matchedMetric -> { Consumer<MutableContext> application = (nestedCtx) -> { nestedCtx.putGroupAliasByName(groupIdentifier, matchedMetric.getKey().getMatchedGroup()::getGroup); nestedCtx.putMetricAliasByName(metricIdentifier, matchedMetric.getKey().getMatchedGroup()::getGroup, matchedMetric.getKey()::getMetric); }; return application; }) .collect(Collectors.toList()); in = in.flatMap(inApplication -> applications.stream().map(inApplication::andThen)); } return in; } }; }
java
private static DecoratorMap metric_map_(Map<IdentifierPair, MetricMatcher> matchers) { if (matchers.isEmpty()) return concat(); return new DecoratorMap() { @Override public Stream<Consumer<MutableContext>> map(Stream<Consumer<MutableContext>> in, Context ctx) { final Map<IdentifierPair, List<Map.Entry<MetricMatcher.MatchedName, MetricValue>>> metricMapping = matchers.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, mmEntry -> mmEntry.getValue().filter(ctx).collect(Collectors.toList()))); for (final Map.Entry<IdentifierPair, List<Map.Entry<MetricMatcher.MatchedName, MetricValue>>> mm : metricMapping.entrySet()) { final String groupIdentifier = mm.getKey().getGroup(); final String metricIdentifier = mm.getKey().getMetric(); final List<Consumer<MutableContext>> applications = mm.getValue().stream() .map(matchedMetric -> { Consumer<MutableContext> application = (nestedCtx) -> { nestedCtx.putGroupAliasByName(groupIdentifier, matchedMetric.getKey().getMatchedGroup()::getGroup); nestedCtx.putMetricAliasByName(metricIdentifier, matchedMetric.getKey().getMatchedGroup()::getGroup, matchedMetric.getKey()::getMetric); }; return application; }) .collect(Collectors.toList()); in = in.flatMap(inApplication -> applications.stream().map(inApplication::andThen)); } return in; } }; }
[ "private", "static", "DecoratorMap", "metric_map_", "(", "Map", "<", "IdentifierPair", ",", "MetricMatcher", ">", "matchers", ")", "{", "if", "(", "matchers", ".", "isEmpty", "(", ")", ")", "return", "concat", "(", ")", ";", "return", "new", "DecoratorMap", ...
Create a decorator map from a mapping of metric matchers.
[ "Create", "a", "decorator", "map", "from", "a", "mapping", "of", "metric", "matchers", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/config/impl/MatchTransformerImpl.java#L116-L145
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/config/impl/MatchTransformerImpl.java
MatchTransformerImpl.concat
private static DecoratorMap concat(DecoratorMap... d_maps) { return (Stream<Consumer<MutableContext>> in, Context ctx) -> { for (DecoratorMap d_map : d_maps) { in = d_map.map(in, ctx); } return in; }; }
java
private static DecoratorMap concat(DecoratorMap... d_maps) { return (Stream<Consumer<MutableContext>> in, Context ctx) -> { for (DecoratorMap d_map : d_maps) { in = d_map.map(in, ctx); } return in; }; }
[ "private", "static", "DecoratorMap", "concat", "(", "DecoratorMap", "...", "d_maps", ")", "{", "return", "(", "Stream", "<", "Consumer", "<", "MutableContext", ">", ">", "in", ",", "Context", "ctx", ")", "->", "{", "for", "(", "DecoratorMap", "d_map", ":",...
Create a decorator map, by chaining zero or more decorator maps.
[ "Create", "a", "decorator", "map", "by", "chaining", "zero", "or", "more", "decorator", "maps", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/config/impl/MatchTransformerImpl.java#L150-L157
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/SimpleMetricGroup.java
SimpleMetricGroup.add
public void add(Metric m) { final MetricName key = m.getName(); metrics_.put(key, m); }
java
public void add(Metric m) { final MetricName key = m.getName(); metrics_.put(key, m); }
[ "public", "void", "add", "(", "Metric", "m", ")", "{", "final", "MetricName", "key", "=", "m", ".", "getName", "(", ")", ";", "metrics_", ".", "put", "(", "key", ",", "m", ")", ";", "}" ]
Add a new metric to the metric group. If the metric is already present, it will be overwritten. @param m The metric to be added.
[ "Add", "a", "new", "metric", "to", "the", "metric", "group", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/SimpleMetricGroup.java#L107-L110
train
jdillon/gshell
gshell-core/src/main/java/com/planet57/gshell/internal/ShellImpl.java
ShellImpl.waitForJobCompletion
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") private void waitForJobCompletion(final CommandSessionImpl session) throws InterruptedException { while (true) { Job job = session.foregroundJob(); if (job == null) break; log.debug("Waiting for job completion: {}", job); synchronized (job) { if (job.status() == Job.Status.Foreground) { job.wait(); } } } }
java
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") private void waitForJobCompletion(final CommandSessionImpl session) throws InterruptedException { while (true) { Job job = session.foregroundJob(); if (job == null) break; log.debug("Waiting for job completion: {}", job); synchronized (job) { if (job.status() == Job.Status.Foreground) { job.wait(); } } } }
[ "@", "SuppressWarnings", "(", "\"SynchronizationOnLocalVariableOrMethodParameter\"", ")", "private", "void", "waitForJobCompletion", "(", "final", "CommandSessionImpl", "session", ")", "throws", "InterruptedException", "{", "while", "(", "true", ")", "{", "Job", "job", ...
Wait for current job, if any, to complete.
[ "Wait", "for", "current", "job", "if", "any", "to", "complete", "." ]
b587c1a4672d2e4905871462fa3b38a1f7b94e90
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-core/src/main/java/com/planet57/gshell/internal/ShellImpl.java#L366-L379
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/RoboRemoteServer.java
RoboRemoteServer.getInstantiatedClass
protected Object getInstantiatedClass(String query) { if (query.equals(Constants.ROBOTIUM_SOLO)) { return solo; } else if (query.equals(Constants.REMOTE_TEST_CLASS)) { return testClass; } return null; }
java
protected Object getInstantiatedClass(String query) { if (query.equals(Constants.ROBOTIUM_SOLO)) { return solo; } else if (query.equals(Constants.REMOTE_TEST_CLASS)) { return testClass; } return null; }
[ "protected", "Object", "getInstantiatedClass", "(", "String", "query", ")", "{", "if", "(", "query", ".", "equals", "(", "Constants", ".", "ROBOTIUM_SOLO", ")", ")", "{", "return", "solo", ";", "}", "else", "if", "(", "query", ".", "equals", "(", "Consta...
Get the instantiated solo if it is requested @param query @return
[ "Get", "the", "instantiated", "solo", "if", "it", "is", "requested" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/RoboRemoteServer.java#L50-L57
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/RoboRemoteServer.java
RoboRemoteServer.getView
protected View getView(String viewName) { for (View view: solo.getCurrentViews()) { if (view.toString().contains(viewName)) { return view; } } return null; }
java
protected View getView(String viewName) { for (View view: solo.getCurrentViews()) { if (view.toString().contains(viewName)) { return view; } } return null; }
[ "protected", "View", "getView", "(", "String", "viewName", ")", "{", "for", "(", "View", "view", ":", "solo", ".", "getCurrentViews", "(", ")", ")", "{", "if", "(", "view", ".", "toString", "(", ")", ".", "contains", "(", "viewName", ")", ")", "{", ...
Return a view with the specified name or null @param viewName @return
[ "Return", "a", "view", "with", "the", "specified", "name", "or", "null" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/RoboRemoteServer.java#L64-L72
train
soabase/soabase
soabase-core/src/main/java/io/soabase/core/features/config/ComposedConfigurationAccessor.java
ComposedConfigurationAccessor.access
public <T> T access(Class<T> clazz) { if ( configuration.getClass().equals(clazz) ) { return clazz.cast(configuration); } try { return clazz.cast(fieldCache.get(clazz).get(configuration)); } catch ( Exception e ) { log.error("Could not access field for " + clazz, e); throw new RuntimeException(e); } }
java
public <T> T access(Class<T> clazz) { if ( configuration.getClass().equals(clazz) ) { return clazz.cast(configuration); } try { return clazz.cast(fieldCache.get(clazz).get(configuration)); } catch ( Exception e ) { log.error("Could not access field for " + clazz, e); throw new RuntimeException(e); } }
[ "public", "<", "T", ">", "T", "access", "(", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "configuration", ".", "getClass", "(", ")", ".", "equals", "(", "clazz", ")", ")", "{", "return", "clazz", ".", "cast", "(", "configuration", ")", ...
Access a custom configuration of the given type. The fields of the configuration object are searched for one that is of the given type. @param clazz type to look for @return the configuration
[ "Access", "a", "custom", "configuration", "of", "the", "given", "type", ".", "The", "fields", "of", "the", "configuration", "object", "are", "searched", "for", "one", "that", "is", "of", "the", "given", "type", "." ]
4c27b090c09d3b2901cace91c3021505b187276d
https://github.com/soabase/soabase/blob/4c27b090c09d3b2901cace91c3021505b187276d/soabase-core/src/main/java/io/soabase/core/features/config/ComposedConfigurationAccessor.java#L101-L117
train
soabase/soabase
soabase-core/src/main/java/io/soabase/core/features/config/ComposedConfigurationAccessor.java
ComposedConfigurationAccessor.has
public <T> boolean has(Class<T> clazz) { return configuration.getClass().equals(clazz) || (fieldCache.getIfPresent(clazz) != null); }
java
public <T> boolean has(Class<T> clazz) { return configuration.getClass().equals(clazz) || (fieldCache.getIfPresent(clazz) != null); }
[ "public", "<", "T", ">", "boolean", "has", "(", "Class", "<", "T", ">", "clazz", ")", "{", "return", "configuration", ".", "getClass", "(", ")", ".", "equals", "(", "clazz", ")", "||", "(", "fieldCache", ".", "getIfPresent", "(", "clazz", ")", "!=", ...
Return true if there is a custom configuration of the given type. @param clazz type to loof for @return true/false
[ "Return", "true", "if", "there", "is", "a", "custom", "configuration", "of", "the", "given", "type", "." ]
4c27b090c09d3b2901cace91c3021505b187276d
https://github.com/soabase/soabase/blob/4c27b090c09d3b2901cace91c3021505b187276d/soabase-core/src/main/java/io/soabase/core/features/config/ComposedConfigurationAccessor.java#L125-L128
train
threerings/nenya
core/src/main/java/com/threerings/openal/StreamDecoder.java
StreamDecoder.createInstance
public static StreamDecoder createInstance (URL url) throws IOException { String path = url.getPath(); int idx = path.lastIndexOf('.'); if (idx == -1) { log.warning("Missing extension for URL.", "url", url); return null; } String extension = path.substring(idx+1); Class<? extends StreamDecoder> clazz = _extensions.get(extension); if (clazz == null) { log.warning("No decoder registered for extension.", "extension", extension, "url", url); return null; } StreamDecoder decoder; try { decoder = clazz.newInstance(); } catch (Exception e) { log.warning("Error instantiating decoder.", "url", url, e); return null; } decoder.init(url.openStream()); return decoder; }
java
public static StreamDecoder createInstance (URL url) throws IOException { String path = url.getPath(); int idx = path.lastIndexOf('.'); if (idx == -1) { log.warning("Missing extension for URL.", "url", url); return null; } String extension = path.substring(idx+1); Class<? extends StreamDecoder> clazz = _extensions.get(extension); if (clazz == null) { log.warning("No decoder registered for extension.", "extension", extension, "url", url); return null; } StreamDecoder decoder; try { decoder = clazz.newInstance(); } catch (Exception e) { log.warning("Error instantiating decoder.", "url", url, e); return null; } decoder.init(url.openStream()); return decoder; }
[ "public", "static", "StreamDecoder", "createInstance", "(", "URL", "url", ")", "throws", "IOException", "{", "String", "path", "=", "url", ".", "getPath", "(", ")", ";", "int", "idx", "=", "path", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(",...
Creates and initializes a stream decoder for the specified URL.
[ "Creates", "and", "initializes", "a", "stream", "decoder", "for", "the", "specified", "URL", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/StreamDecoder.java#L61-L86
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyboardManager.java
KeyboardManager.setTarget
public void setTarget (JComponent target, KeyTranslator xlate) { setEnabled(false); // save off references _target = target; _xlate = xlate; }
java
public void setTarget (JComponent target, KeyTranslator xlate) { setEnabled(false); // save off references _target = target; _xlate = xlate; }
[ "public", "void", "setTarget", "(", "JComponent", "target", ",", "KeyTranslator", "xlate", ")", "{", "setEnabled", "(", "false", ")", ";", "// save off references", "_target", "=", "target", ";", "_xlate", "=", "xlate", ";", "}" ]
Initializes the keyboard manager with the supplied target component and key translator and disables the keyboard manager if it is currently active. @param target the component whose keyboard events are to be observed. @param xlate the key translator used to map keyboard events to controller action commands.
[ "Initializes", "the", "keyboard", "manager", "with", "the", "supplied", "target", "component", "and", "key", "translator", "and", "disables", "the", "keyboard", "manager", "if", "it", "is", "currently", "active", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L107-L114
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyboardManager.java
KeyboardManager.setEnabled
public void setEnabled (boolean enabled) { // report incorrect usage if (enabled && _target == null) { log.warning("Attempt to enable uninitialized keyboard manager!", new Exception()); return; } // ignore NOOPs if (enabled == _enabled) { return; } if (!enabled) { if (Keyboard.isAvailable()) { // restore the original key auto-repeat settings Keyboard.setKeyRepeat(_nativeRepeat); } // clear out all of our key states releaseAllKeys(); _keys.clear(); // cease listening to all of our business if (_window != null) { _window.removeWindowFocusListener(this); _window = null; } _target.removeAncestorListener(this); // note that we no longer have the focus _focus = false; } else { // listen to ancestor events so that we can cease our business // if we lose the focus _target.addAncestorListener(this); // if we're already showing, listen to window focus events, // else we have to wait until the target is added since it // doesn't currently have a window if (_target.isShowing() && _window == null) { _window = SwingUtilities.getWindowAncestor(_target); if (_window != null) { _window.addWindowFocusListener(this); } } // assume the keyboard focus since we were just enabled _focus = true; if (Keyboard.isAvailable()) { // note whether key auto-repeating was enabled _nativeRepeat = Keyboard.isKeyRepeatEnabled(); // Disable native key auto-repeating so that we can definitively ascertain key // pressed/released events. // Or not, if we've discovered we don't want to. Keyboard.setKeyRepeat(!_shouldDisableNativeRepeat); } } // save off our new enabled state _enabled = enabled; }
java
public void setEnabled (boolean enabled) { // report incorrect usage if (enabled && _target == null) { log.warning("Attempt to enable uninitialized keyboard manager!", new Exception()); return; } // ignore NOOPs if (enabled == _enabled) { return; } if (!enabled) { if (Keyboard.isAvailable()) { // restore the original key auto-repeat settings Keyboard.setKeyRepeat(_nativeRepeat); } // clear out all of our key states releaseAllKeys(); _keys.clear(); // cease listening to all of our business if (_window != null) { _window.removeWindowFocusListener(this); _window = null; } _target.removeAncestorListener(this); // note that we no longer have the focus _focus = false; } else { // listen to ancestor events so that we can cease our business // if we lose the focus _target.addAncestorListener(this); // if we're already showing, listen to window focus events, // else we have to wait until the target is added since it // doesn't currently have a window if (_target.isShowing() && _window == null) { _window = SwingUtilities.getWindowAncestor(_target); if (_window != null) { _window.addWindowFocusListener(this); } } // assume the keyboard focus since we were just enabled _focus = true; if (Keyboard.isAvailable()) { // note whether key auto-repeating was enabled _nativeRepeat = Keyboard.isKeyRepeatEnabled(); // Disable native key auto-repeating so that we can definitively ascertain key // pressed/released events. // Or not, if we've discovered we don't want to. Keyboard.setKeyRepeat(!_shouldDisableNativeRepeat); } } // save off our new enabled state _enabled = enabled; }
[ "public", "void", "setEnabled", "(", "boolean", "enabled", ")", "{", "// report incorrect usage", "if", "(", "enabled", "&&", "_target", "==", "null", ")", "{", "log", ".", "warning", "(", "\"Attempt to enable uninitialized keyboard manager!\"", ",", "new", "Excepti...
Sets whether the keyboard manager processes keyboard input.
[ "Sets", "whether", "the", "keyboard", "manager", "processes", "keyboard", "input", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L137-L201
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyboardManager.java
KeyboardManager.releaseAllKeys
public void releaseAllKeys () { long now = System.currentTimeMillis(); Iterator<KeyInfo> iter = _keys.elements(); while (iter.hasNext()) { iter.next().release(now); } }
java
public void releaseAllKeys () { long now = System.currentTimeMillis(); Iterator<KeyInfo> iter = _keys.elements(); while (iter.hasNext()) { iter.next().release(now); } }
[ "public", "void", "releaseAllKeys", "(", ")", "{", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Iterator", "<", "KeyInfo", ">", "iter", "=", "_keys", ".", "elements", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ...
Releases all keys and ceases any hot repeating action that may be going on.
[ "Releases", "all", "keys", "and", "ceases", "any", "hot", "repeating", "action", "that", "may", "be", "going", "on", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L215-L222
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyboardManager.java
KeyboardManager.keyPressed
protected boolean keyPressed (KeyEvent e) { logKey("keyPressed", e); // get the action command associated with this key int keyCode = e.getKeyCode(); boolean hasCommand = _xlate.hasCommand(keyCode); if (hasCommand) { // get the info object for this key, creating one if necessary KeyInfo info = _keys.get(keyCode); if (info == null) { info = new KeyInfo(keyCode); _keys.put(keyCode, info); } // remember the last time this key was pressed info.setPressTime(RunAnywhere.getWhen(e)); } // notify any key observers of the key press notifyObservers(KeyEvent.KEY_PRESSED, e.getKeyCode(), RunAnywhere.getWhen(e)); return hasCommand; }
java
protected boolean keyPressed (KeyEvent e) { logKey("keyPressed", e); // get the action command associated with this key int keyCode = e.getKeyCode(); boolean hasCommand = _xlate.hasCommand(keyCode); if (hasCommand) { // get the info object for this key, creating one if necessary KeyInfo info = _keys.get(keyCode); if (info == null) { info = new KeyInfo(keyCode); _keys.put(keyCode, info); } // remember the last time this key was pressed info.setPressTime(RunAnywhere.getWhen(e)); } // notify any key observers of the key press notifyObservers(KeyEvent.KEY_PRESSED, e.getKeyCode(), RunAnywhere.getWhen(e)); return hasCommand; }
[ "protected", "boolean", "keyPressed", "(", "KeyEvent", "e", ")", "{", "logKey", "(", "\"keyPressed\"", ",", "e", ")", ";", "// get the action command associated with this key", "int", "keyCode", "=", "e", ".", "getKeyCode", "(", ")", ";", "boolean", "hasCommand", ...
Called when Swing notifies us that a key has been pressed while the keyboard manager is active. @return true to swallow the key event
[ "Called", "when", "Swing", "notifies", "us", "that", "a", "key", "has", "been", "pressed", "while", "the", "keyboard", "manager", "is", "active", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L290-L313
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyboardManager.java
KeyboardManager.keyTyped
protected boolean keyTyped (KeyEvent e) { logKey("keyTyped", e); // get the action command associated with this key char keyChar = e.getKeyChar(); boolean hasCommand = _xlate.hasCommand(keyChar); if (hasCommand) { // Okay, we're clearly doing actions based on key typing, so we're going to need native // keyboard repeating turned on. Oh well. if (_shouldDisableNativeRepeat) { _shouldDisableNativeRepeat = false; if (Keyboard.isAvailable()) { Keyboard.setKeyRepeat(!_shouldDisableNativeRepeat); } } KeyInfo info = _chars.get(keyChar); if (info == null) { info = new KeyInfo(keyChar); _chars.put(keyChar, info); } // remember the last time this key was pressed info.setPressTime(RunAnywhere.getWhen(e)); } // notify any key observers of the key press notifyObservers(KeyEvent.KEY_TYPED, e.getKeyChar(), RunAnywhere.getWhen(e)); return hasCommand; }
java
protected boolean keyTyped (KeyEvent e) { logKey("keyTyped", e); // get the action command associated with this key char keyChar = e.getKeyChar(); boolean hasCommand = _xlate.hasCommand(keyChar); if (hasCommand) { // Okay, we're clearly doing actions based on key typing, so we're going to need native // keyboard repeating turned on. Oh well. if (_shouldDisableNativeRepeat) { _shouldDisableNativeRepeat = false; if (Keyboard.isAvailable()) { Keyboard.setKeyRepeat(!_shouldDisableNativeRepeat); } } KeyInfo info = _chars.get(keyChar); if (info == null) { info = new KeyInfo(keyChar); _chars.put(keyChar, info); } // remember the last time this key was pressed info.setPressTime(RunAnywhere.getWhen(e)); } // notify any key observers of the key press notifyObservers(KeyEvent.KEY_TYPED, e.getKeyChar(), RunAnywhere.getWhen(e)); return hasCommand; }
[ "protected", "boolean", "keyTyped", "(", "KeyEvent", "e", ")", "{", "logKey", "(", "\"keyTyped\"", ",", "e", ")", ";", "// get the action command associated with this key", "char", "keyChar", "=", "e", ".", "getKeyChar", "(", ")", ";", "boolean", "hasCommand", "...
Called when Swing notifies us that a key has been typed while the keyboard manager is active. @return true to swallow the key event
[ "Called", "when", "Swing", "notifies", "us", "that", "a", "key", "has", "been", "typed", "while", "the", "keyboard", "manager", "is", "active", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L321-L353
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyboardManager.java
KeyboardManager.keyReleased
protected boolean keyReleased (KeyEvent e) { logKey("keyReleased", e); // get the info object for this key KeyInfo info = _keys.get(e.getKeyCode()); if (info != null) { // remember the last time we received a key release info.setReleaseTime(RunAnywhere.getWhen(e)); } // notify any key observers of the key release notifyObservers(KeyEvent.KEY_RELEASED, e.getKeyCode(), RunAnywhere.getWhen(e)); return (info != null); }
java
protected boolean keyReleased (KeyEvent e) { logKey("keyReleased", e); // get the info object for this key KeyInfo info = _keys.get(e.getKeyCode()); if (info != null) { // remember the last time we received a key release info.setReleaseTime(RunAnywhere.getWhen(e)); } // notify any key observers of the key release notifyObservers(KeyEvent.KEY_RELEASED, e.getKeyCode(), RunAnywhere.getWhen(e)); return (info != null); }
[ "protected", "boolean", "keyReleased", "(", "KeyEvent", "e", ")", "{", "logKey", "(", "\"keyReleased\"", ",", "e", ")", ";", "// get the info object for this key", "KeyInfo", "info", "=", "_keys", ".", "get", "(", "e", ".", "getKeyCode", "(", ")", ")", ";", ...
Called when Swing notifies us that a key has been released while the keyboard manager is active. @return true to swallow the key event
[ "Called", "when", "Swing", "notifies", "us", "that", "a", "key", "has", "been", "released", "while", "the", "keyboard", "manager", "is", "active", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L361-L376
train
threerings/nenya
core/src/main/java/com/threerings/util/KeyboardManager.java
KeyboardManager.logKey
protected void logKey (String msg, KeyEvent e) { if (DEBUG_EVENTS || _debugTyping.getValue()) { int keyCode = e.getKeyCode(); log.info(msg, "key", KeyEvent.getKeyText(keyCode)); } }
java
protected void logKey (String msg, KeyEvent e) { if (DEBUG_EVENTS || _debugTyping.getValue()) { int keyCode = e.getKeyCode(); log.info(msg, "key", KeyEvent.getKeyText(keyCode)); } }
[ "protected", "void", "logKey", "(", "String", "msg", ",", "KeyEvent", "e", ")", "{", "if", "(", "DEBUG_EVENTS", "||", "_debugTyping", ".", "getValue", "(", ")", ")", "{", "int", "keyCode", "=", "e", ".", "getKeyCode", "(", ")", ";", "log", ".", "info...
Logs the given message and key.
[ "Logs", "the", "given", "message", "and", "key", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L393-L399
train
threerings/nenya
core/src/main/java/com/threerings/media/util/BackgroundTiler.java
BackgroundTiler.paint
public void paint (Graphics g, int x, int y, int width, int height) { // bail out now if we were passed a bogus source image at construct time if (_tiles == null) { return; } int rwid = width-2*_w3, rhei = height-2*_h3; g.drawImage(_tiles[0], x, y, _w3, _h3, null); g.drawImage(_tiles[1], x + _w3, y, rwid, _h3, null); g.drawImage(_tiles[2], x + _w3 + rwid, y, _w3, _h3, null); y += _h3; g.drawImage(_tiles[3], x, y, _w3, rhei, null); g.drawImage(_tiles[4], x + _w3, y, rwid, rhei, null); g.drawImage(_tiles[5], x + _w3 + rwid, y, _w3, rhei, null); y += rhei; g.drawImage(_tiles[6], x, y, _w3, _h3, null); g.drawImage(_tiles[7], x + _w3, y, rwid, _h3, null); g.drawImage(_tiles[8], x + _w3 + rwid, y, _w3, _h3, null); }
java
public void paint (Graphics g, int x, int y, int width, int height) { // bail out now if we were passed a bogus source image at construct time if (_tiles == null) { return; } int rwid = width-2*_w3, rhei = height-2*_h3; g.drawImage(_tiles[0], x, y, _w3, _h3, null); g.drawImage(_tiles[1], x + _w3, y, rwid, _h3, null); g.drawImage(_tiles[2], x + _w3 + rwid, y, _w3, _h3, null); y += _h3; g.drawImage(_tiles[3], x, y, _w3, rhei, null); g.drawImage(_tiles[4], x + _w3, y, rwid, rhei, null); g.drawImage(_tiles[5], x + _w3 + rwid, y, _w3, rhei, null); y += rhei; g.drawImage(_tiles[6], x, y, _w3, _h3, null); g.drawImage(_tiles[7], x + _w3, y, rwid, _h3, null); g.drawImage(_tiles[8], x + _w3 + rwid, y, _w3, _h3, null); }
[ "public", "void", "paint", "(", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "// bail out now if we were passed a bogus source image at construct time", "if", "(", "_tiles", "==", "null", ")", "{", "re...
Fills the requested region with the background defined by our source image.
[ "Fills", "the", "requested", "region", "with", "the", "background", "defined", "by", "our", "source", "image", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/BackgroundTiler.java#L92-L114
train
threerings/nenya
core/src/main/java/com/threerings/media/IconManager.java
IconManager.getIcon
public Icon getIcon (String iconSet, int index) { try { // see if the tileset is already loaded TileSet set = _icons.get(iconSet); // load it up if not if (set == null) { String path = _config.getProperty(iconSet + PATH_SUFFIX); if (StringUtil.isBlank(path)) { throw new Exception("No path specified for icon set"); } String metstr = _config.getProperty(iconSet + METRICS_SUFFIX); if (StringUtil.isBlank(metstr)) { throw new Exception("No metrics specified for icon set"); } int[] metrics = StringUtil.parseIntArray(metstr); if (metrics == null || metrics.length != 2) { throw new Exception("Invalid icon set metrics " + "[metrics=" + metstr + "]"); } // load up the tileset if (_rsrcSet == null) { set = _tilemgr.loadTileSet( path, metrics[0], metrics[1]); } else { set = _tilemgr.loadTileSet( _rsrcSet, path, metrics[0], metrics[1]); } // cache it _icons.put(iconSet, set); } // fetch the appropriate image and create an image icon return new TileIcon(set.getTile(index)); } catch (Exception e) { log.warning("Unable to load icon [iconSet=" + iconSet + ", index=" + index + ", error=" + e + "]."); } // return an error icon return new ImageIcon(ImageUtil.createErrorImage(32, 32)); }
java
public Icon getIcon (String iconSet, int index) { try { // see if the tileset is already loaded TileSet set = _icons.get(iconSet); // load it up if not if (set == null) { String path = _config.getProperty(iconSet + PATH_SUFFIX); if (StringUtil.isBlank(path)) { throw new Exception("No path specified for icon set"); } String metstr = _config.getProperty(iconSet + METRICS_SUFFIX); if (StringUtil.isBlank(metstr)) { throw new Exception("No metrics specified for icon set"); } int[] metrics = StringUtil.parseIntArray(metstr); if (metrics == null || metrics.length != 2) { throw new Exception("Invalid icon set metrics " + "[metrics=" + metstr + "]"); } // load up the tileset if (_rsrcSet == null) { set = _tilemgr.loadTileSet( path, metrics[0], metrics[1]); } else { set = _tilemgr.loadTileSet( _rsrcSet, path, metrics[0], metrics[1]); } // cache it _icons.put(iconSet, set); } // fetch the appropriate image and create an image icon return new TileIcon(set.getTile(index)); } catch (Exception e) { log.warning("Unable to load icon [iconSet=" + iconSet + ", index=" + index + ", error=" + e + "]."); } // return an error icon return new ImageIcon(ImageUtil.createErrorImage(32, 32)); }
[ "public", "Icon", "getIcon", "(", "String", "iconSet", ",", "int", "index", ")", "{", "try", "{", "// see if the tileset is already loaded", "TileSet", "set", "=", "_icons", ".", "get", "(", "iconSet", ")", ";", "// load it up if not", "if", "(", "set", "==", ...
Fetches the icon with the specified index from the named icon set.
[ "Fetches", "the", "icon", "with", "the", "specified", "index", "from", "the", "named", "icon", "set", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/IconManager.java#L108-L155
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.order
public ByteOrder order(ByteOrder o) { // TODO: In the next release, return WrappedByteBuffer - use return _buf.order(o) _isBigEndian = "BIG_ENDIAN".equals(o.toString()); _buf.order(o); return o; }
java
public ByteOrder order(ByteOrder o) { // TODO: In the next release, return WrappedByteBuffer - use return _buf.order(o) _isBigEndian = "BIG_ENDIAN".equals(o.toString()); _buf.order(o); return o; }
[ "public", "ByteOrder", "order", "(", "ByteOrder", "o", ")", "{", "// TODO: In the next release, return WrappedByteBuffer - use return _buf.order(o)", "_isBigEndian", "=", "\"BIG_ENDIAN\"", ".", "equals", "(", "o", ".", "toString", "(", ")", ")", ";", "_buf", ".", "ord...
Set the byte order for this buffer @param o ByteOrder @return the ByteOrder specified @deprecated Will return WrappedByteBuffer in future releases to match java.nio.ByteBuffer
[ "Set", "the", "byte", "order", "for", "this", "buffer" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L168-L173
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.compact
public WrappedByteBuffer compact() { int remaining = remaining(); int capacity = capacity(); if (capacity == 0) { return this; } if (remaining <= capacity >>> 2 && capacity > _minimumCapacity) { int newCapacity = capacity; int minCapacity = max(_minimumCapacity, remaining << 1); for (;;) { if (newCapacity >>> 1 < minCapacity) { break; } newCapacity >>>= 1; } newCapacity = max(minCapacity, newCapacity); if (newCapacity == capacity) { if (_buf.remaining() == 0) { _buf.position(0); _buf.limit(_buf.capacity()); } else { java.nio.ByteBuffer dup = _buf.duplicate(); _buf.position(0); _buf.limit(_buf.capacity()); _buf.put(dup); } return this; } // Shrink and compact: // // Save the state. ByteOrder bo = order(); // // Sanity check. if (remaining > newCapacity) { throw new IllegalStateException("The amount of the remaining bytes is greater than " + "the new capacity."); } // // Reallocate. java.nio.ByteBuffer oldBuf = _buf; java.nio.ByteBuffer newBuf = java.nio.ByteBuffer.allocate(newCapacity); newBuf.put(oldBuf); _buf = newBuf; // // Restore the state. _buf.order(bo); } else { _buf.compact(); } return this; }
java
public WrappedByteBuffer compact() { int remaining = remaining(); int capacity = capacity(); if (capacity == 0) { return this; } if (remaining <= capacity >>> 2 && capacity > _minimumCapacity) { int newCapacity = capacity; int minCapacity = max(_minimumCapacity, remaining << 1); for (;;) { if (newCapacity >>> 1 < minCapacity) { break; } newCapacity >>>= 1; } newCapacity = max(minCapacity, newCapacity); if (newCapacity == capacity) { if (_buf.remaining() == 0) { _buf.position(0); _buf.limit(_buf.capacity()); } else { java.nio.ByteBuffer dup = _buf.duplicate(); _buf.position(0); _buf.limit(_buf.capacity()); _buf.put(dup); } return this; } // Shrink and compact: // // Save the state. ByteOrder bo = order(); // // Sanity check. if (remaining > newCapacity) { throw new IllegalStateException("The amount of the remaining bytes is greater than " + "the new capacity."); } // // Reallocate. java.nio.ByteBuffer oldBuf = _buf; java.nio.ByteBuffer newBuf = java.nio.ByteBuffer.allocate(newCapacity); newBuf.put(oldBuf); _buf = newBuf; // // Restore the state. _buf.order(bo); } else { _buf.compact(); } return this; }
[ "public", "WrappedByteBuffer", "compact", "(", ")", "{", "int", "remaining", "=", "remaining", "(", ")", ";", "int", "capacity", "=", "capacity", "(", ")", ";", "if", "(", "capacity", "==", "0", ")", "{", "return", "this", ";", "}", "if", "(", "remai...
Compacts the buffer by removing leading bytes up to the buffer position, and decrements the limit and position values accordingly. @return the buffer
[ "Compacts", "the", "buffer", "by", "removing", "leading", "bytes", "up", "to", "the", "buffer", "position", "and", "decrements", "the", "limit", "and", "position", "values", "accordingly", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L212-L268
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.fillWith
public WrappedByteBuffer fillWith(byte b, int size) { _autoExpand(size); while (size-- > 0) { _buf.put(b); } return this; }
java
public WrappedByteBuffer fillWith(byte b, int size) { _autoExpand(size); while (size-- > 0) { _buf.put(b); } return this; }
[ "public", "WrappedByteBuffer", "fillWith", "(", "byte", "b", ",", "int", "size", ")", "{", "_autoExpand", "(", "size", ")", ";", "while", "(", "size", "--", ">", "0", ")", "{", "_buf", ".", "put", "(", "b", ")", ";", "}", "return", "this", ";", "...
Fills the buffer with a specific number of repeated bytes. @param b the byte to repeat @param size the number of times to repeat @return the buffer
[ "Fills", "the", "buffer", "with", "a", "specific", "number", "of", "repeated", "bytes", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L305-L311
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.indexOf
public int indexOf(byte b) { if (_buf.hasArray()) { byte[] array = _buf.array(); int arrayOffset = _buf.arrayOffset(); int startAt = arrayOffset + position(); int endAt = arrayOffset + limit(); for (int i = startAt; i < endAt; i++) { if (array[i] == b) { return i - arrayOffset; } } return -1; } else { int startAt = _buf.position(); int endAt = _buf.limit(); for (int i = startAt; i < endAt; i++) { if (_buf.get(i) == b) { return i; } } return -1; } }
java
public int indexOf(byte b) { if (_buf.hasArray()) { byte[] array = _buf.array(); int arrayOffset = _buf.arrayOffset(); int startAt = arrayOffset + position(); int endAt = arrayOffset + limit(); for (int i = startAt; i < endAt; i++) { if (array[i] == b) { return i - arrayOffset; } } return -1; } else { int startAt = _buf.position(); int endAt = _buf.limit(); for (int i = startAt; i < endAt; i++) { if (_buf.get(i) == b) { return i; } } return -1; } }
[ "public", "int", "indexOf", "(", "byte", "b", ")", "{", "if", "(", "_buf", ".", "hasArray", "(", ")", ")", "{", "byte", "[", "]", "array", "=", "_buf", ".", "array", "(", ")", ";", "int", "arrayOffset", "=", "_buf", ".", "arrayOffset", "(", ")", ...
Returns the index of the specified byte in the buffer. @param b the byte to find @return the index of the byte in the buffer, or -1 if not found
[ "Returns", "the", "index", "of", "the", "specified", "byte", "in", "the", "buffer", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L321-L345
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.put
public WrappedByteBuffer put(byte[] v, int offset, int length) { _autoExpand(length); for (int i = 0; i < length; i++) { _buf.put(v[offset + i]); } return this; }
java
public WrappedByteBuffer put(byte[] v, int offset, int length) { _autoExpand(length); for (int i = 0; i < length; i++) { _buf.put(v[offset + i]); } return this; }
[ "public", "WrappedByteBuffer", "put", "(", "byte", "[", "]", "v", ",", "int", "offset", ",", "int", "length", ")", "{", "_autoExpand", "(", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", ...
Puts segment of a single-byte array into the buffer at the current position. @param v the source single-byte array @offset the start position of source array @length the length to put into WrappedByteBuffer @return the buffer
[ "Puts", "segment", "of", "a", "single", "-", "byte", "array", "into", "the", "buffer", "at", "the", "current", "position", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L372-L378
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putAt
public WrappedByteBuffer putAt(int index, byte v) { _checkForWriteAt(index, 1); _buf.put(index, v); return this; }
java
public WrappedByteBuffer putAt(int index, byte v) { _checkForWriteAt(index, 1); _buf.put(index, v); return this; }
[ "public", "WrappedByteBuffer", "putAt", "(", "int", "index", ",", "byte", "v", ")", "{", "_checkForWriteAt", "(", "index", ",", "1", ")", ";", "_buf", ".", "put", "(", "index", ",", "v", ")", ";", "return", "this", ";", "}" ]
Puts a single byte number into the buffer at the specified index. @param index the index @param v the byte @return the buffer
[ "Puts", "a", "single", "byte", "number", "into", "the", "buffer", "at", "the", "specified", "index", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L388-L392
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putUnsignedAt
public WrappedByteBuffer putUnsignedAt(int index, int v) { _checkForWriteAt(index, 1); byte b = (byte)(v & 0xFF); return this.putAt(index, b); }
java
public WrappedByteBuffer putUnsignedAt(int index, int v) { _checkForWriteAt(index, 1); byte b = (byte)(v & 0xFF); return this.putAt(index, b); }
[ "public", "WrappedByteBuffer", "putUnsignedAt", "(", "int", "index", ",", "int", "v", ")", "{", "_checkForWriteAt", "(", "index", ",", "1", ")", ";", "byte", "b", "=", "(", "byte", ")", "(", "v", "&", "0xFF", ")", ";", "return", "this", ".", "putAt",...
Puts an unsigned single byte into the buffer at the specified position. @param v the unsigned byte as an int @return the buffer
[ "Puts", "an", "unsigned", "single", "byte", "into", "the", "buffer", "at", "the", "specified", "position", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L413-L417
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putShortAt
public WrappedByteBuffer putShortAt(int index, short v) { _checkForWriteAt(index, 2); _buf.putShort(index, v); return this; }
java
public WrappedByteBuffer putShortAt(int index, short v) { _checkForWriteAt(index, 2); _buf.putShort(index, v); return this; }
[ "public", "WrappedByteBuffer", "putShortAt", "(", "int", "index", ",", "short", "v", ")", "{", "_checkForWriteAt", "(", "index", ",", "2", ")", ";", "_buf", ".", "putShort", "(", "index", ",", "v", ")", ";", "return", "this", ";", "}" ]
Puts a two-byte short into the buffer at the specified index. @param index the index @param v the two-byte short @return the buffer
[ "Puts", "a", "two", "-", "byte", "short", "into", "the", "buffer", "at", "the", "specified", "index", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L440-L444
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putIntAt
public WrappedByteBuffer putIntAt(int index, int v) { _checkForWriteAt(index, 4); _buf.putInt(index, v); return this; }
java
public WrappedByteBuffer putIntAt(int index, int v) { _checkForWriteAt(index, 4); _buf.putInt(index, v); return this; }
[ "public", "WrappedByteBuffer", "putIntAt", "(", "int", "index", ",", "int", "v", ")", "{", "_checkForWriteAt", "(", "index", ",", "4", ")", ";", "_buf", ".", "putInt", "(", "index", ",", "v", ")", ";", "return", "this", ";", "}" ]
Puts a four-byte int into the buffer at the specified index. @param index the index @param v the four-byte int @return the buffer
[ "Puts", "a", "four", "-", "byte", "int", "into", "the", "buffer", "at", "the", "specified", "index", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L493-L497
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putLongAt
public WrappedByteBuffer putLongAt(int index, long v) { _checkForWriteAt(index, 8); _buf.putLong(index, v); return this; }
java
public WrappedByteBuffer putLongAt(int index, long v) { _checkForWriteAt(index, 8); _buf.putLong(index, v); return this; }
[ "public", "WrappedByteBuffer", "putLongAt", "(", "int", "index", ",", "long", "v", ")", "{", "_checkForWriteAt", "(", "index", ",", "8", ")", ";", "_buf", ".", "putLong", "(", "index", ",", "v", ")", ";", "return", "this", ";", "}" ]
Puts an eight-byte long into the buffer at the specified index. @param index the index @param v the eight-byte long @return the buffer
[ "Puts", "an", "eight", "-", "byte", "long", "into", "the", "buffer", "at", "the", "specified", "index", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L546-L550
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putString
public WrappedByteBuffer putString(String v, Charset cs) { java.nio.ByteBuffer strBuf = cs.encode(v); _autoExpand(strBuf.limit()); _buf.put(strBuf); return this; }
java
public WrappedByteBuffer putString(String v, Charset cs) { java.nio.ByteBuffer strBuf = cs.encode(v); _autoExpand(strBuf.limit()); _buf.put(strBuf); return this; }
[ "public", "WrappedByteBuffer", "putString", "(", "String", "v", ",", "Charset", "cs", ")", "{", "java", ".", "nio", ".", "ByteBuffer", "strBuf", "=", "cs", ".", "encode", "(", "v", ")", ";", "_autoExpand", "(", "strBuf", ".", "limit", "(", ")", ")", ...
Puts a string into the buffer at the current position, using the character set to encode the string as bytes. @param v the string @param cs the character set @return the buffer
[ "Puts", "a", "string", "into", "the", "buffer", "at", "the", "current", "position", "using", "the", "character", "set", "to", "encode", "the", "string", "as", "bytes", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L562-L567
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putPrefixedString
public WrappedByteBuffer putPrefixedString(int fieldSize, String v, Charset cs) { if (fieldSize == 0) { return this; } boolean utf16 = cs.name().startsWith("UTF-16"); if (utf16 && (fieldSize == 1)) { throw new IllegalArgumentException("fieldSize is not even for UTF-16 character set"); } java.nio.ByteBuffer strBuf = cs.encode(v); _autoExpand(fieldSize + strBuf.limit()); int len = strBuf.remaining(); switch (fieldSize) { case 1: put((byte) len); break; case 2: putShort((short) len); break; case 4: putInt(len); break; default: throw new IllegalArgumentException("Illegal argument, field size should be 1,2 or 4 and fieldSize is: " + fieldSize); } _buf.put(strBuf); return this; }
java
public WrappedByteBuffer putPrefixedString(int fieldSize, String v, Charset cs) { if (fieldSize == 0) { return this; } boolean utf16 = cs.name().startsWith("UTF-16"); if (utf16 && (fieldSize == 1)) { throw new IllegalArgumentException("fieldSize is not even for UTF-16 character set"); } java.nio.ByteBuffer strBuf = cs.encode(v); _autoExpand(fieldSize + strBuf.limit()); int len = strBuf.remaining(); switch (fieldSize) { case 1: put((byte) len); break; case 2: putShort((short) len); break; case 4: putInt(len); break; default: throw new IllegalArgumentException("Illegal argument, field size should be 1,2 or 4 and fieldSize is: " + fieldSize); } _buf.put(strBuf); return this; }
[ "public", "WrappedByteBuffer", "putPrefixedString", "(", "int", "fieldSize", ",", "String", "v", ",", "Charset", "cs", ")", "{", "if", "(", "fieldSize", "==", "0", ")", "{", "return", "this", ";", "}", "boolean", "utf16", "=", "cs", ".", "name", "(", "...
Puts a string into the buffer at the specified index, using the character set to encode the string as bytes. @param fieldSize the width in bytes of the prefixed length field @param v the string @param cs the character set @return the buffer
[ "Puts", "a", "string", "into", "the", "buffer", "at", "the", "specified", "index", "using", "the", "character", "set", "to", "encode", "the", "string", "as", "bytes", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L581-L611
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putBytesAt
public WrappedByteBuffer putBytesAt(int index, byte[] b) { _checkForWriteAt(index, b.length); int pos = _buf.position(); _buf.position(index); _buf.put(b, 0, b.length); _buf.position(pos); return this; }
java
public WrappedByteBuffer putBytesAt(int index, byte[] b) { _checkForWriteAt(index, b.length); int pos = _buf.position(); _buf.position(index); _buf.put(b, 0, b.length); _buf.position(pos); return this; }
[ "public", "WrappedByteBuffer", "putBytesAt", "(", "int", "index", ",", "byte", "[", "]", "b", ")", "{", "_checkForWriteAt", "(", "index", ",", "b", ".", "length", ")", ";", "int", "pos", "=", "_buf", ".", "position", "(", ")", ";", "_buf", ".", "posi...
Puts a single-byte array into the buffer at the specified index. @param index the index @param v the single-byte array @return the buffer
[ "Puts", "a", "single", "-", "byte", "array", "into", "the", "buffer", "at", "the", "specified", "index", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L635-L642
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putBuffer
public WrappedByteBuffer putBuffer(WrappedByteBuffer v) { _autoExpand(v.remaining()); _buf.put(v._buf); return this; }
java
public WrappedByteBuffer putBuffer(WrappedByteBuffer v) { _autoExpand(v.remaining()); _buf.put(v._buf); return this; }
[ "public", "WrappedByteBuffer", "putBuffer", "(", "WrappedByteBuffer", "v", ")", "{", "_autoExpand", "(", "v", ".", "remaining", "(", ")", ")", ";", "_buf", ".", "put", "(", "v", ".", "_buf", ")", ";", "return", "this", ";", "}" ]
Puts a buffer into the buffer at the current position. @param v the WrappedByteBuffer @return the buffer
[ "Puts", "a", "buffer", "into", "the", "buffer", "at", "the", "current", "position", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L651-L655
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putBufferAt
public WrappedByteBuffer putBufferAt(int index, WrappedByteBuffer v) { // TODO: I believe this method incorrectly moves the position! // Can't change it without a code analysis - and this is a public API! int pos = _buf.position(); _buf.position(index); _buf.put(v._buf); _buf.position(pos); return this; }
java
public WrappedByteBuffer putBufferAt(int index, WrappedByteBuffer v) { // TODO: I believe this method incorrectly moves the position! // Can't change it without a code analysis - and this is a public API! int pos = _buf.position(); _buf.position(index); _buf.put(v._buf); _buf.position(pos); return this; }
[ "public", "WrappedByteBuffer", "putBufferAt", "(", "int", "index", ",", "WrappedByteBuffer", "v", ")", "{", "// TODO: I believe this method incorrectly moves the position!", "// Can't change it without a code analysis - and this is a public API!", "int", "pos", "=", "_buf", ".", ...
Puts a buffer into the buffer at the specified index. @param index the index @param v the WrappedByteBuffer @return the buffer
[ "Puts", "a", "buffer", "into", "the", "buffer", "at", "the", "specified", "index", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L665-L673
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.getBytes
public byte[] getBytes(int size){ _checkForRead(size); byte[] dst = new byte[size]; _buf.get(dst, 0, size); return dst; }
java
public byte[] getBytes(int size){ _checkForRead(size); byte[] dst = new byte[size]; _buf.get(dst, 0, size); return dst; }
[ "public", "byte", "[", "]", "getBytes", "(", "int", "size", ")", "{", "_checkForRead", "(", "size", ")", ";", "byte", "[", "]", "dst", "=", "new", "byte", "[", "size", "]", ";", "_buf", ".", "get", "(", "dst", ",", "0", ",", "size", ")", ";", ...
Returns a byte array of length size from the buffer from current position @param size @return a new byte array with bytes read from the buffer
[ "Returns", "a", "byte", "array", "of", "length", "size", "from", "the", "buffer", "from", "current", "position" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L744-L749
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.getBytesAt
public byte[] getBytesAt(int index,int size){ _checkForReadAt(index,size); byte[] dst = new byte[size]; int i=0; int j=index; while (i<size) { dst[i++] = _buf.get(j++); } return dst; }
java
public byte[] getBytesAt(int index,int size){ _checkForReadAt(index,size); byte[] dst = new byte[size]; int i=0; int j=index; while (i<size) { dst[i++] = _buf.get(j++); } return dst; }
[ "public", "byte", "[", "]", "getBytesAt", "(", "int", "index", ",", "int", "size", ")", "{", "_checkForReadAt", "(", "index", ",", "size", ")", ";", "byte", "[", "]", "dst", "=", "new", "byte", "[", "size", "]", ";", "int", "i", "=", "0", ";", ...
Returns a byte array of length size from the buffer starting from the specified position. @param index the index @param size the size of the buffer to be returned @return a new byte array with bytes read from the buffer
[ "Returns", "a", "byte", "array", "of", "length", "size", "from", "the", "buffer", "starting", "from", "the", "specified", "position", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L756-L765
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.getUnsignedMediumInt
public int getUnsignedMediumInt() { int b1 = getUnsigned(); int b2 = getUnsigned(); int b3 = getUnsigned(); if (_isBigEndian) { return (b1<<16) | (b2<<8) | b3; } else { return (b3<<16) | (b2<<8) | b1; } }
java
public int getUnsignedMediumInt() { int b1 = getUnsigned(); int b2 = getUnsigned(); int b3 = getUnsigned(); if (_isBigEndian) { return (b1<<16) | (b2<<8) | b3; } else { return (b3<<16) | (b2<<8) | b1; } }
[ "public", "int", "getUnsignedMediumInt", "(", ")", "{", "int", "b1", "=", "getUnsigned", "(", ")", ";", "int", "b2", "=", "getUnsigned", "(", ")", ";", "int", "b3", "=", "getUnsigned", "(", ")", ";", "if", "(", "_isBigEndian", ")", "{", "return", "("...
Returns an unsigned three-byte medium int from the buffer at the current position @return the three-byte medium int as an int
[ "Returns", "an", "unsigned", "three", "-", "byte", "medium", "int", "from", "the", "buffer", "at", "the", "current", "position" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L820-L830
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.getUnsignedIntAt
public long getUnsignedIntAt(int index) { _checkForReadAt(index,4); long val = (long) (_buf.getInt(index) & 0xffffffffL); return val; }
java
public long getUnsignedIntAt(int index) { _checkForReadAt(index,4); long val = (long) (_buf.getInt(index) & 0xffffffffL); return val; }
[ "public", "long", "getUnsignedIntAt", "(", "int", "index", ")", "{", "_checkForReadAt", "(", "index", ",", "4", ")", ";", "long", "val", "=", "(", "long", ")", "(", "_buf", ".", "getInt", "(", "index", ")", "&", "0xffffffff", "L", ")", ";", "return",...
Returns an unsigned four-byte int from the buffer at the specified index @param index the index @return the four-byte unsigned int as a long
[ "Returns", "an", "unsigned", "four", "-", "byte", "int", "from", "the", "buffer", "at", "the", "specified", "index" ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L874-L878
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.getPrefixedString
public String getPrefixedString(int fieldSize, Charset cs) { int len = 0; switch (fieldSize) { case 1: len = _buf.get(); break; case 2: len = _buf.getShort(); break; case 4: len = _buf.getInt(); break; default: throw new IllegalArgumentException("Illegal argument, field size should be 1,2 or 4 and fieldSize is: " + fieldSize); } if (len == 0) { return ""; } int oldLimit = _buf.limit(); try { _buf.limit(_buf.position() + len); byte[] bytes = new byte[len]; _buf.get(bytes, 0, len); String retVal = cs.decode(java.nio.ByteBuffer.wrap(bytes)).toString(); return retVal; } finally { _buf.limit(oldLimit); } }
java
public String getPrefixedString(int fieldSize, Charset cs) { int len = 0; switch (fieldSize) { case 1: len = _buf.get(); break; case 2: len = _buf.getShort(); break; case 4: len = _buf.getInt(); break; default: throw new IllegalArgumentException("Illegal argument, field size should be 1,2 or 4 and fieldSize is: " + fieldSize); } if (len == 0) { return ""; } int oldLimit = _buf.limit(); try { _buf.limit(_buf.position() + len); byte[] bytes = new byte[len]; _buf.get(bytes, 0, len); String retVal = cs.decode(java.nio.ByteBuffer.wrap(bytes)).toString(); return retVal; } finally { _buf.limit(oldLimit); } }
[ "public", "String", "getPrefixedString", "(", "int", "fieldSize", ",", "Charset", "cs", ")", "{", "int", "len", "=", "0", ";", "switch", "(", "fieldSize", ")", "{", "case", "1", ":", "len", "=", "_buf", ".", "get", "(", ")", ";", "break", ";", "cas...
Returns a length-prefixed string from the buffer at the current position. @param fieldSize the width in bytes of the prefixed length field @param cs the character set @return the length-prefixed string
[ "Returns", "a", "length", "-", "prefixed", "string", "from", "the", "buffer", "at", "the", "current", "position", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L912-L943
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.getString
public String getString(Charset cs) { // find indexof \0 and create a string for the charset int nullAt = indexOf((byte) 0); boolean utf16 = cs.name().startsWith("UTF-16"); if (utf16) { int oldPos = _buf.position(); boolean nullFound = false; while (!nullFound && (nullAt != -1)) { if (_buf.get(nullAt + 1) == 0) { nullFound = true; break; } _buf.position(nullAt + 1); nullAt = indexOf((byte) 0); } if (!nullFound) { throw new IllegalStateException("The string being read is not UTF-16"); } _buf.position(oldPos); } int newLimit; if (nullAt != -1) { newLimit = nullAt; } else { newLimit = _buf.limit(); } int numBytes = newLimit - _buf.position(); int oldLimit = _buf.limit(); try { _buf.limit(newLimit); byte[] bytes = new byte[numBytes]; _buf.get(bytes, 0, numBytes); String retVal = cs.decode(java.nio.ByteBuffer.wrap(bytes)).toString(); return retVal; } finally { _buf.limit(oldLimit); if (nullAt != -1) { _buf.get(); if (utf16) { _buf.get(); } } } }
java
public String getString(Charset cs) { // find indexof \0 and create a string for the charset int nullAt = indexOf((byte) 0); boolean utf16 = cs.name().startsWith("UTF-16"); if (utf16) { int oldPos = _buf.position(); boolean nullFound = false; while (!nullFound && (nullAt != -1)) { if (_buf.get(nullAt + 1) == 0) { nullFound = true; break; } _buf.position(nullAt + 1); nullAt = indexOf((byte) 0); } if (!nullFound) { throw new IllegalStateException("The string being read is not UTF-16"); } _buf.position(oldPos); } int newLimit; if (nullAt != -1) { newLimit = nullAt; } else { newLimit = _buf.limit(); } int numBytes = newLimit - _buf.position(); int oldLimit = _buf.limit(); try { _buf.limit(newLimit); byte[] bytes = new byte[numBytes]; _buf.get(bytes, 0, numBytes); String retVal = cs.decode(java.nio.ByteBuffer.wrap(bytes)).toString(); return retVal; } finally { _buf.limit(oldLimit); if (nullAt != -1) { _buf.get(); if (utf16) { _buf.get(); } } } }
[ "public", "String", "getString", "(", "Charset", "cs", ")", "{", "// find indexof \\0 and create a string for the charset", "int", "nullAt", "=", "indexOf", "(", "(", "byte", ")", "0", ")", ";", "boolean", "utf16", "=", "cs", ".", "name", "(", ")", ".", "sta...
Returns a null-terminated string from the buffer at the current position. If the end of buffer if reached before discovering a null terminator byte, then the decoded string includes all bytes up to the end of the buffer. @param cs the character set @return the null-terminated string
[ "Returns", "a", "null", "-", "terminated", "string", "from", "the", "buffer", "at", "the", "current", "position", ".", "If", "the", "end", "of", "buffer", "if", "reached", "before", "discovering", "a", "null", "terminator", "byte", "then", "the", "decoded", ...
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L953-L997
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.skip
public WrappedByteBuffer skip(int size) { _autoExpand(size); _buf.position(_buf.position() + size); return this; }
java
public WrappedByteBuffer skip(int size) { _autoExpand(size); _buf.position(_buf.position() + size); return this; }
[ "public", "WrappedByteBuffer", "skip", "(", "int", "size", ")", "{", "_autoExpand", "(", "size", ")", ";", "_buf", ".", "position", "(", "_buf", ".", "position", "(", ")", "+", "size", ")", ";", "return", "this", ";", "}" ]
Skips the specified number of bytes from the current position. @param size the number of bytes to skip @return the buffer
[ "Skips", "the", "specified", "number", "of", "bytes", "from", "the", "current", "position", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L1115-L1119
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.getHexDump
public String getHexDump() { if (_buf.position() == _buf.limit()) { return "empty"; } StringBuilder hexDump = new StringBuilder(); for (int i = _buf.position(); i < _buf.limit(); i++) { hexDump.append(Integer.toHexString(_buf.get(i)&0xFF)).append(' '); } return hexDump.toString(); }
java
public String getHexDump() { if (_buf.position() == _buf.limit()) { return "empty"; } StringBuilder hexDump = new StringBuilder(); for (int i = _buf.position(); i < _buf.limit(); i++) { hexDump.append(Integer.toHexString(_buf.get(i)&0xFF)).append(' '); } return hexDump.toString(); }
[ "public", "String", "getHexDump", "(", ")", "{", "if", "(", "_buf", ".", "position", "(", ")", "==", "_buf", ".", "limit", "(", ")", ")", "{", "return", "\"empty\"", ";", "}", "StringBuilder", "hexDump", "=", "new", "StringBuilder", "(", ")", ";", "f...
Returns a hex dump of this buffer. @return the hex dump
[ "Returns", "a", "hex", "dump", "of", "this", "buffer", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L1126-L1136
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.expandAt
WrappedByteBuffer expandAt(int i, int expectedRemaining) { if ((i + expectedRemaining) <= _buf.limit()) { return this; } else { if ((i + expectedRemaining) <= _buf.capacity()) { _buf.limit(i + expectedRemaining); } else { // reallocate the underlying byte buffer and keep the original buffer // intact. The resetting of the position is required because, one // could be in the middle of a read of an existing buffer, when they // decide to over write only few bytes but still keep the remaining // part of the buffer unchanged. int newCapacity = _buf.capacity() + ((expectedRemaining > INITIAL_CAPACITY) ? expectedRemaining : INITIAL_CAPACITY); java.nio.ByteBuffer newBuffer = java.nio.ByteBuffer.allocate(newCapacity); _buf.flip(); newBuffer.put(_buf); _buf = newBuffer; } } return this; }
java
WrappedByteBuffer expandAt(int i, int expectedRemaining) { if ((i + expectedRemaining) <= _buf.limit()) { return this; } else { if ((i + expectedRemaining) <= _buf.capacity()) { _buf.limit(i + expectedRemaining); } else { // reallocate the underlying byte buffer and keep the original buffer // intact. The resetting of the position is required because, one // could be in the middle of a read of an existing buffer, when they // decide to over write only few bytes but still keep the remaining // part of the buffer unchanged. int newCapacity = _buf.capacity() + ((expectedRemaining > INITIAL_CAPACITY) ? expectedRemaining : INITIAL_CAPACITY); java.nio.ByteBuffer newBuffer = java.nio.ByteBuffer.allocate(newCapacity); _buf.flip(); newBuffer.put(_buf); _buf = newBuffer; } } return this; }
[ "WrappedByteBuffer", "expandAt", "(", "int", "i", ",", "int", "expectedRemaining", ")", "{", "if", "(", "(", "i", "+", "expectedRemaining", ")", "<=", "_buf", ".", "limit", "(", ")", ")", "{", "return", "this", ";", "}", "else", "{", "if", "(", "(", ...
Expands the buffer to support the expected number of remaining bytes at the specified index. @param index the index @param expectedRemaining the expected number of remaining bytes @return the buffer
[ "Expands", "the", "buffer", "to", "support", "the", "expected", "number", "of", "remaining", "bytes", "at", "the", "specified", "index", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L1185-L1207
train
calrissian/mango
mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java
JsonMetadata.setArrayIndex
static void setArrayIndex(Map<String,String> meta, int level, int index) { meta.put(level + ARRAY_IDX_SUFFIX, Integer.toString(index)); }
java
static void setArrayIndex(Map<String,String> meta, int level, int index) { meta.put(level + ARRAY_IDX_SUFFIX, Integer.toString(index)); }
[ "static", "void", "setArrayIndex", "(", "Map", "<", "String", ",", "String", ">", "meta", ",", "int", "level", ",", "int", "index", ")", "{", "meta", ".", "put", "(", "level", "+", "ARRAY_IDX_SUFFIX", ",", "Integer", ".", "toString", "(", "index", ")",...
Sets an array index on a map of metadata for a specific level of a nested json tree. Since the json requires that arrays have preserved order, it's imported that it is constrained from the flattened to the re-expanded representation. @param meta @param level @param index
[ "Sets", "an", "array", "index", "on", "a", "map", "of", "metadata", "for", "a", "specific", "level", "of", "a", "nested", "json", "tree", ".", "Since", "the", "json", "requires", "that", "arrays", "have", "preserved", "order", "it", "s", "imported", "tha...
a95aa5e77af9aa0e629787228d80806560023452
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java#L43-L45
train
calrissian/mango
mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java
JsonMetadata.getArrayIndex
static Integer getArrayIndex(Map<String,String> meta, int level) { return Integer.parseInt(meta.get(level + ARRAY_IDX_SUFFIX)); }
java
static Integer getArrayIndex(Map<String,String> meta, int level) { return Integer.parseInt(meta.get(level + ARRAY_IDX_SUFFIX)); }
[ "static", "Integer", "getArrayIndex", "(", "Map", "<", "String", ",", "String", ">", "meta", ",", "int", "level", ")", "{", "return", "Integer", ".", "parseInt", "(", "meta", ".", "get", "(", "level", "+", "ARRAY_IDX_SUFFIX", ")", ")", ";", "}" ]
Returns an array index for a specific level from the metadata from a flattened json tree. @param meta @param level @return
[ "Returns", "an", "array", "index", "for", "a", "specific", "level", "from", "the", "metadata", "from", "a", "flattened", "json", "tree", "." ]
a95aa5e77af9aa0e629787228d80806560023452
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java#L54-L56
train
calrissian/mango
mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java
JsonMetadata.hasArrayIndex
static boolean hasArrayIndex(Map<String,String> meta, int level) { return meta.containsKey(level + ARRAY_IDX_SUFFIX); }
java
static boolean hasArrayIndex(Map<String,String> meta, int level) { return meta.containsKey(level + ARRAY_IDX_SUFFIX); }
[ "static", "boolean", "hasArrayIndex", "(", "Map", "<", "String", ",", "String", ">", "meta", ",", "int", "level", ")", "{", "return", "meta", ".", "containsKey", "(", "level", "+", "ARRAY_IDX_SUFFIX", ")", ";", "}" ]
Determines whether or not a map of metadata contains array index information at the given level in a flattened json tree. @param meta @param level @return
[ "Determines", "whether", "or", "not", "a", "map", "of", "metadata", "contains", "array", "index", "information", "at", "the", "given", "level", "in", "a", "flattened", "json", "tree", "." ]
a95aa5e77af9aa0e629787228d80806560023452
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java#L65-L67
train
calrissian/mango
mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java
JsonMetadata.levelsToIndices
static Map<Integer, Integer> levelsToIndices(Map<String,String> meta) { Set<Map.Entry<String, String>> entries = meta.entrySet(); Map<Integer, Integer> levelToIdx = new HashMap<>(); for(Map.Entry<String,String> entry : entries) if(entry.getKey().endsWith(ARRAY_IDX_SUFFIX)) levelToIdx.put(parseInt(entry.getKey().substring(0, entry.getKey().indexOf('.'))), parseInt(entry.getValue())); return levelToIdx; }
java
static Map<Integer, Integer> levelsToIndices(Map<String,String> meta) { Set<Map.Entry<String, String>> entries = meta.entrySet(); Map<Integer, Integer> levelToIdx = new HashMap<>(); for(Map.Entry<String,String> entry : entries) if(entry.getKey().endsWith(ARRAY_IDX_SUFFIX)) levelToIdx.put(parseInt(entry.getKey().substring(0, entry.getKey().indexOf('.'))), parseInt(entry.getValue())); return levelToIdx; }
[ "static", "Map", "<", "Integer", ",", "Integer", ">", "levelsToIndices", "(", "Map", "<", "String", ",", "String", ">", "meta", ")", "{", "Set", "<", "Map", ".", "Entry", "<", "String", ",", "String", ">", ">", "entries", "=", "meta", ".", "entrySet"...
Converts all array index information in a given map of metadata to a map that is keyed only by the level and each value is the index in the array for that level. This is used to optimize lookup since a string is used for the key in the metadata that should not conflict with keys that other applications may want to set. @param meta @return
[ "Converts", "all", "array", "index", "information", "in", "a", "given", "map", "of", "metadata", "to", "a", "map", "that", "is", "keyed", "only", "by", "the", "level", "and", "each", "value", "is", "the", "index", "in", "the", "array", "for", "that", "...
a95aa5e77af9aa0e629787228d80806560023452
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java#L77-L85
train
threerings/nenya
core/src/main/java/com/threerings/openal/OpenALSoundPlayer.java
OpenALSoundPlayer.stream
public void stream (final String bundle, final String path, final boolean loop, final ResultListener<Stream> listener) throws IOException { if (!path.endsWith(".ogg")) { log.warning("Unknown file type for streaming", "bundle", bundle, "path", path); return; } InputStream rsrc = _loader.getSound(bundle, path); final StreamDecoder dec = new OggStreamDecoder(); dec.init(rsrc); getSoundQueue().postRunnable(new Runnable() { public void run () { Stream s = new Stream(_alSoundManager) { @Override protected void update (float time) { super.update(time); if (_state != AL10.AL_PLAYING) { return; } super.setGain(_clipVol * _streamGain); } @Override public void setGain (float gain) { _streamGain = gain; super.setGain(_clipVol * _streamGain); } @Override protected int getFormat () { return dec.getFormat(); } @Override protected int getFrequency () { return dec.getFrequency(); } @Override protected int populateBuffer (ByteBuffer buf) throws IOException { int read = dec.read(buf); if (buf.hasRemaining() && loop) { dec.init(_loader.getSound(bundle, path)); read = Math.max(0, read); read += dec.read(buf); } return read; } protected float _streamGain = 1F; }; s.setGain(_clipVol); listener.requestCompleted(s); }}); }
java
public void stream (final String bundle, final String path, final boolean loop, final ResultListener<Stream> listener) throws IOException { if (!path.endsWith(".ogg")) { log.warning("Unknown file type for streaming", "bundle", bundle, "path", path); return; } InputStream rsrc = _loader.getSound(bundle, path); final StreamDecoder dec = new OggStreamDecoder(); dec.init(rsrc); getSoundQueue().postRunnable(new Runnable() { public void run () { Stream s = new Stream(_alSoundManager) { @Override protected void update (float time) { super.update(time); if (_state != AL10.AL_PLAYING) { return; } super.setGain(_clipVol * _streamGain); } @Override public void setGain (float gain) { _streamGain = gain; super.setGain(_clipVol * _streamGain); } @Override protected int getFormat () { return dec.getFormat(); } @Override protected int getFrequency () { return dec.getFrequency(); } @Override protected int populateBuffer (ByteBuffer buf) throws IOException { int read = dec.read(buf); if (buf.hasRemaining() && loop) { dec.init(_loader.getSound(bundle, path)); read = Math.max(0, read); read += dec.read(buf); } return read; } protected float _streamGain = 1F; }; s.setGain(_clipVol); listener.requestCompleted(s); }}); }
[ "public", "void", "stream", "(", "final", "String", "bundle", ",", "final", "String", "path", ",", "final", "boolean", "loop", ",", "final", "ResultListener", "<", "Stream", ">", "listener", ")", "throws", "IOException", "{", "if", "(", "!", "path", ".", ...
Streams ogg files from the given bundle and path.
[ "Streams", "ogg", "files", "from", "the", "given", "bundle", "and", "path", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/OpenALSoundPlayer.java#L181-L236
train
groupon/monsoon
expr/src/main/java/com/groupon/lex/metrics/timeseries/expression/RegexpExpression.java
RegexpExpression.resolve_template_args_
private Map<Any2<Integer, String>, String> resolve_template_args_(Matcher matcher) { return template_.getArguments().stream() .collect(Collectors.toMap(arg -> arg, arg -> arg.mapCombine(matcher::group, matcher::group))); }
java
private Map<Any2<Integer, String>, String> resolve_template_args_(Matcher matcher) { return template_.getArguments().stream() .collect(Collectors.toMap(arg -> arg, arg -> arg.mapCombine(matcher::group, matcher::group))); }
[ "private", "Map", "<", "Any2", "<", "Integer", ",", "String", ">", ",", "String", ">", "resolve_template_args_", "(", "Matcher", "matcher", ")", "{", "return", "template_", ".", "getArguments", "(", ")", ".", "stream", "(", ")", ".", "collect", "(", "Col...
Convert a regexp match to a map of matcher arguments.
[ "Convert", "a", "regexp", "match", "to", "a", "map", "of", "matcher", "arguments", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/expr/src/main/java/com/groupon/lex/metrics/timeseries/expression/RegexpExpression.java#L95-L98
train
groupon/monsoon
expr/src/main/java/com/groupon/lex/metrics/timeseries/expression/RegexpExpression.java
RegexpExpression.rewrite_
private Optional<MetricValue> rewrite_(MetricValue v) { return v.asString() .map(pattern_::matcher) .filter(matcher -> matcher.find()) .map(this::resolve_template_args_) .map(template_::apply) .map(MetricValue::fromStrValue); }
java
private Optional<MetricValue> rewrite_(MetricValue v) { return v.asString() .map(pattern_::matcher) .filter(matcher -> matcher.find()) .map(this::resolve_template_args_) .map(template_::apply) .map(MetricValue::fromStrValue); }
[ "private", "Optional", "<", "MetricValue", ">", "rewrite_", "(", "MetricValue", "v", ")", "{", "return", "v", ".", "asString", "(", ")", ".", "map", "(", "pattern_", "::", "matcher", ")", ".", "filter", "(", "matcher", "->", "matcher", ".", "find", "("...
Rewrite a string metric, according to matcher and template. Strings that don't match the regexp are omitted.
[ "Rewrite", "a", "string", "metric", "according", "to", "matcher", "and", "template", ".", "Strings", "that", "don", "t", "match", "the", "regexp", "are", "omitted", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/expr/src/main/java/com/groupon/lex/metrics/timeseries/expression/RegexpExpression.java#L104-L111
train
threerings/nenya
tools/src/main/java/com/threerings/tools/xml/CompiledConfigParser.java
CompiledConfigParser.parseConfig
public Serializable parseConfig (File source) throws IOException, SAXException { Digester digester = new Digester(); Serializable config = createConfigObject(); addRules(digester); digester.push(config); digester.parse(new FileInputStream(source)); return config; }
java
public Serializable parseConfig (File source) throws IOException, SAXException { Digester digester = new Digester(); Serializable config = createConfigObject(); addRules(digester); digester.push(config); digester.parse(new FileInputStream(source)); return config; }
[ "public", "Serializable", "parseConfig", "(", "File", "source", ")", "throws", "IOException", ",", "SAXException", "{", "Digester", "digester", "=", "new", "Digester", "(", ")", ";", "Serializable", "config", "=", "createConfigObject", "(", ")", ";", "addRules",...
Parses the supplied configuration file into a serializable configuration object.
[ "Parses", "the", "supplied", "configuration", "file", "into", "a", "serializable", "configuration", "object", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/tools/xml/CompiledConfigParser.java#L47-L56
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Tags.java
Tags.filter
public Tags filter(Set<String> tag_names) { return Tags.valueOf(tags_.entrySet().stream() .filter(entry -> tag_names.contains(entry.getKey()))); }
java
public Tags filter(Set<String> tag_names) { return Tags.valueOf(tags_.entrySet().stream() .filter(entry -> tag_names.contains(entry.getKey()))); }
[ "public", "Tags", "filter", "(", "Set", "<", "String", ">", "tag_names", ")", "{", "return", "Tags", ".", "valueOf", "(", "tags_", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "entry", "->", "tag_names", ".", "contains", "(...
Reduce the list of tags, to only those specified in the argument set. @param tag_names The tag names to retain. @return A new instance of tags, which contains only tags mentioned in the argument set.
[ "Reduce", "the", "list", "of", "tags", "to", "only", "those", "specified", "in", "the", "argument", "set", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Tags.java#L136-L139
train
threerings/nenya
core/src/main/java/com/threerings/media/VirtualMediaPanel.java
VirtualMediaPanel.trackPathable
protected void trackPathable () { // if we're tracking a pathable, adjust our view coordinates if (_fpath == null) { return; } int width = getWidth(), height = getHeight(); int nx = _vbounds.x, ny = _vbounds.y; // figure out where to move switch (_fmode) { case TRACK_PATHABLE: nx = _fpath.getX(); ny = _fpath.getY(); break; case CENTER_ON_PATHABLE: nx = _fpath.getX() - width/2; ny = _fpath.getY() - height/2; break; case ENCLOSE_PATHABLE: Rectangle bounds = _fpath.getBounds(); if (nx > bounds.x) { nx = bounds.x; } else if (nx + width < bounds.x + bounds.width) { nx = bounds.x + bounds.width - width; } if (ny > bounds.y) { ny = bounds.y; } else if (ny + height < bounds.y + bounds.height) { ny = bounds.y + bounds.height - height; } break; default: log.warning("Eh? Set to invalid pathable mode", "mode", _fmode); break; } // Log.info("Tracking pathable [mode=" + _fmode + // ", pable=" + _fpath + ", nx=" + nx + ", ny=" + ny + "]."); setViewLocation(nx, ny); }
java
protected void trackPathable () { // if we're tracking a pathable, adjust our view coordinates if (_fpath == null) { return; } int width = getWidth(), height = getHeight(); int nx = _vbounds.x, ny = _vbounds.y; // figure out where to move switch (_fmode) { case TRACK_PATHABLE: nx = _fpath.getX(); ny = _fpath.getY(); break; case CENTER_ON_PATHABLE: nx = _fpath.getX() - width/2; ny = _fpath.getY() - height/2; break; case ENCLOSE_PATHABLE: Rectangle bounds = _fpath.getBounds(); if (nx > bounds.x) { nx = bounds.x; } else if (nx + width < bounds.x + bounds.width) { nx = bounds.x + bounds.width - width; } if (ny > bounds.y) { ny = bounds.y; } else if (ny + height < bounds.y + bounds.height) { ny = bounds.y + bounds.height - height; } break; default: log.warning("Eh? Set to invalid pathable mode", "mode", _fmode); break; } // Log.info("Tracking pathable [mode=" + _fmode + // ", pable=" + _fpath + ", nx=" + nx + ", ny=" + ny + "]."); setViewLocation(nx, ny); }
[ "protected", "void", "trackPathable", "(", ")", "{", "// if we're tracking a pathable, adjust our view coordinates", "if", "(", "_fpath", "==", "null", ")", "{", "return", ";", "}", "int", "width", "=", "getWidth", "(", ")", ",", "height", "=", "getHeight", "(",...
Implements the standard pathable tracking support. Derived classes may wish to override this if they desire custom tracking functionality.
[ "Implements", "the", "standard", "pathable", "tracking", "support", ".", "Derived", "classes", "may", "wish", "to", "override", "this", "if", "they", "desire", "custom", "tracking", "functionality", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/VirtualMediaPanel.java#L309-L354
train
threerings/nenya
core/src/main/java/com/threerings/media/sprite/LabelSprite.java
LabelSprite.updateBounds
public void updateBounds () { Dimension size = _label.getSize(); _bounds.width = size.width; _bounds.height = size.height; }
java
public void updateBounds () { Dimension size = _label.getSize(); _bounds.width = size.width; _bounds.height = size.height; }
[ "public", "void", "updateBounds", "(", ")", "{", "Dimension", "size", "=", "_label", ".", "getSize", "(", ")", ";", "_bounds", ".", "width", "=", "size", ".", "width", ";", "_bounds", ".", "height", "=", "size", ".", "height", ";", "}" ]
Updates the bounds of the sprite after a change to the label.
[ "Updates", "the", "bounds", "of", "the", "sprite", "after", "a", "change", "to", "the", "label", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/LabelSprite.java#L64-L69
train
threerings/nenya
core/src/main/java/com/threerings/media/sprite/LabelSprite.java
LabelSprite.layoutLabel
protected void layoutLabel () { Graphics2D gfx = _mgr.createGraphics(); if (gfx == null) { return; } try { gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, (_antiAliased) ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); _label.layout(gfx); } finally { gfx.dispose(); } }
java
protected void layoutLabel () { Graphics2D gfx = _mgr.createGraphics(); if (gfx == null) { return; } try { gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, (_antiAliased) ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); _label.layout(gfx); } finally { gfx.dispose(); } }
[ "protected", "void", "layoutLabel", "(", ")", "{", "Graphics2D", "gfx", "=", "_mgr", ".", "createGraphics", "(", ")", ";", "if", "(", "gfx", "==", "null", ")", "{", "return", ";", "}", "try", "{", "gfx", ".", "setRenderingHint", "(", "RenderingHints", ...
Lays out our underlying label which must be done if the text is changed.
[ "Lays", "out", "our", "underlying", "label", "which", "must", "be", "done", "if", "the", "text", "is", "changed", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/LabelSprite.java#L95-L110
train
threerings/nenya
tools/src/main/java/com/threerings/cast/tools/xml/ActionRuleSet.java
ActionRuleSet.addRuleInstances
@Override public void addRuleInstances (Digester digester) { // this creates the appropriate instance when we encounter a // <action> tag digester.addObjectCreate(_prefix + ACTION_PATH, ActionSequence.class.getName()); // grab the name attribute from the <action> tag digester.addRule(_prefix + ACTION_PATH, new SetPropertyFieldsRule()); // grab the other attributes from their respective tags digester.addRule(_prefix + ACTION_PATH + "/framesPerSecond", new SetFieldRule("framesPerSecond")); CallMethodSpecialRule origin = new CallMethodSpecialRule() { @Override public void parseAndSet (String bodyText, Object target) throws Exception { int[] coords = StringUtil.parseIntArray(bodyText); if (coords.length != 2) { String errmsg = "Invalid <origin> specification '" + bodyText + "'."; throw new Exception(errmsg); } ((ActionSequence)target).origin.setLocation( coords[0], coords[1]); } }; digester.addRule(_prefix + ACTION_PATH + "/origin", origin); CallMethodSpecialRule orient = new CallMethodSpecialRule() { @Override public void parseAndSet (String bodyText, Object target) throws Exception { ActionSequence seq = ((ActionSequence)target); String[] ostrs = StringUtil.parseStringArray(bodyText); seq.orients = new int[ostrs.length]; for (int ii = 0; ii < ostrs.length; ii++) { int orient = DirectionUtil.fromShortString(ostrs[ii]); if (orient != DirectionCodes.NONE) { seq.orients[ii] = orient; } else { String errmsg = "Invalid orientation specification " + "[index=" + ii + ", orient=" + ostrs[ii] + "]."; throw new Exception(errmsg); } } } }; digester.addRule(_prefix + ACTION_PATH + "/orients", orient); }
java
@Override public void addRuleInstances (Digester digester) { // this creates the appropriate instance when we encounter a // <action> tag digester.addObjectCreate(_prefix + ACTION_PATH, ActionSequence.class.getName()); // grab the name attribute from the <action> tag digester.addRule(_prefix + ACTION_PATH, new SetPropertyFieldsRule()); // grab the other attributes from their respective tags digester.addRule(_prefix + ACTION_PATH + "/framesPerSecond", new SetFieldRule("framesPerSecond")); CallMethodSpecialRule origin = new CallMethodSpecialRule() { @Override public void parseAndSet (String bodyText, Object target) throws Exception { int[] coords = StringUtil.parseIntArray(bodyText); if (coords.length != 2) { String errmsg = "Invalid <origin> specification '" + bodyText + "'."; throw new Exception(errmsg); } ((ActionSequence)target).origin.setLocation( coords[0], coords[1]); } }; digester.addRule(_prefix + ACTION_PATH + "/origin", origin); CallMethodSpecialRule orient = new CallMethodSpecialRule() { @Override public void parseAndSet (String bodyText, Object target) throws Exception { ActionSequence seq = ((ActionSequence)target); String[] ostrs = StringUtil.parseStringArray(bodyText); seq.orients = new int[ostrs.length]; for (int ii = 0; ii < ostrs.length; ii++) { int orient = DirectionUtil.fromShortString(ostrs[ii]); if (orient != DirectionCodes.NONE) { seq.orients[ii] = orient; } else { String errmsg = "Invalid orientation specification " + "[index=" + ii + ", orient=" + ostrs[ii] + "]."; throw new Exception(errmsg); } } } }; digester.addRule(_prefix + ACTION_PATH + "/orients", orient); }
[ "@", "Override", "public", "void", "addRuleInstances", "(", "Digester", "digester", ")", "{", "// this creates the appropriate instance when we encounter a", "// <action> tag", "digester", ".", "addObjectCreate", "(", "_prefix", "+", "ACTION_PATH", ",", "ActionSequence", "....
Adds the necessary rules to the digester to parse our actions.
[ "Adds", "the", "necessary", "rules", "to", "the", "digester", "to", "parse", "our", "actions", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/tools/xml/ActionRuleSet.java#L70-L121
train
threerings/nenya
tools/src/main/java/com/threerings/cast/tools/xml/ActionRuleSet.java
ActionRuleSet.validate
public static String validate (ActionSequence seq) { if (StringUtil.isBlank(seq.name)) { return "Missing 'name' definition."; } if (seq.framesPerSecond == 0) { return "Missing 'framesPerSecond' definition."; } if (seq.orients == null) { return "Missing 'orients' definition."; } return null; }
java
public static String validate (ActionSequence seq) { if (StringUtil.isBlank(seq.name)) { return "Missing 'name' definition."; } if (seq.framesPerSecond == 0) { return "Missing 'framesPerSecond' definition."; } if (seq.orients == null) { return "Missing 'orients' definition."; } return null; }
[ "public", "static", "String", "validate", "(", "ActionSequence", "seq", ")", "{", "if", "(", "StringUtil", ".", "isBlank", "(", "seq", ".", "name", ")", ")", "{", "return", "\"Missing 'name' definition.\"", ";", "}", "if", "(", "seq", ".", "framesPerSecond",...
Validates that all necessary fields have been parsed and set in this action sequence object and are valid. @return null if the sequence is valid, a string explaining the invalidity if it is not.
[ "Validates", "that", "all", "necessary", "fields", "have", "been", "parsed", "and", "set", "in", "this", "action", "sequence", "object", "and", "are", "valid", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/tools/xml/ActionRuleSet.java#L130-L142
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/comm/ConnectionEvictor.java
ConnectionEvictor.getNextEviction
private boolean getNextEviction() { long nowTime = System.currentTimeMillis(); final long sleepEndTime = nowTime + evictionInverval; while (nowTime < sleepEndTime) { final long toSleep = Math.max(100, sleepEndTime - nowTime); synchronized (this) { if (terminate) return false; try { wait(toSleep); } catch (InterruptedException e) { // ignore } } nowTime = System.currentTimeMillis(); } return true; }
java
private boolean getNextEviction() { long nowTime = System.currentTimeMillis(); final long sleepEndTime = nowTime + evictionInverval; while (nowTime < sleepEndTime) { final long toSleep = Math.max(100, sleepEndTime - nowTime); synchronized (this) { if (terminate) return false; try { wait(toSleep); } catch (InterruptedException e) { // ignore } } nowTime = System.currentTimeMillis(); } return true; }
[ "private", "boolean", "getNextEviction", "(", ")", "{", "long", "nowTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "final", "long", "sleepEndTime", "=", "nowTime", "+", "evictionInverval", ";", "while", "(", "nowTime", "<", "sleepEndTime", ")",...
Waits for a next eviction.
[ "Waits", "for", "a", "next", "eviction", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/comm/ConnectionEvictor.java#L53-L71
train
threerings/nenya
core/src/main/java/com/threerings/media/util/AStarPathUtil.java
AStarPathUtil.getPath
public static List<Point> getPath ( TraversalPred tpred, Object trav, int longest, int ax, int ay, int bx, int by, boolean partial) { return getPath(tpred, new Stepper(), trav, longest, ax, ay, bx, by, partial); }
java
public static List<Point> getPath ( TraversalPred tpred, Object trav, int longest, int ax, int ay, int bx, int by, boolean partial) { return getPath(tpred, new Stepper(), trav, longest, ax, ay, bx, by, partial); }
[ "public", "static", "List", "<", "Point", ">", "getPath", "(", "TraversalPred", "tpred", ",", "Object", "trav", ",", "int", "longest", ",", "int", "ax", ",", "int", "ay", ",", "int", "bx", ",", "int", "by", ",", "boolean", "partial", ")", "{", "retur...
Gets a path with the default stepper which assumes the piece can move one in any of the eight cardinal directions.
[ "Gets", "a", "path", "with", "the", "default", "stepper", "which", "assumes", "the", "piece", "can", "move", "one", "in", "any", "of", "the", "eight", "cardinal", "directions", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/AStarPathUtil.java#L202-L207
train
threerings/nenya
core/src/main/java/com/threerings/media/image/TransformedMirage.java
TransformedMirage.computeTransformedBounds
protected void computeTransformedBounds () { int w = _base.getWidth(); int h = _base.getHeight(); Point[] points = new Point[] { new Point(0, 0), new Point(w, 0), new Point(0, h), new Point(w, h) }; _transform.transform(points, 0, points, 0, 4); int minX, minY, maxX, maxY; minX = minY = Integer.MAX_VALUE; maxX = maxY = Integer.MIN_VALUE; for (int ii=0; ii < 4; ii++) { minX = Math.min(minX, points[ii].x); maxX = Math.max(maxX, points[ii].x); minY = Math.min(minY, points[ii].y); maxY = Math.max(maxY, points[ii].y); } _bounds = new Rectangle(minX, minY, maxX - minX, maxY - minY); }
java
protected void computeTransformedBounds () { int w = _base.getWidth(); int h = _base.getHeight(); Point[] points = new Point[] { new Point(0, 0), new Point(w, 0), new Point(0, h), new Point(w, h) }; _transform.transform(points, 0, points, 0, 4); int minX, minY, maxX, maxY; minX = minY = Integer.MAX_VALUE; maxX = maxY = Integer.MIN_VALUE; for (int ii=0; ii < 4; ii++) { minX = Math.min(minX, points[ii].x); maxX = Math.max(maxX, points[ii].x); minY = Math.min(minY, points[ii].y); maxY = Math.max(maxY, points[ii].y); } _bounds = new Rectangle(minX, minY, maxX - minX, maxY - minY); }
[ "protected", "void", "computeTransformedBounds", "(", ")", "{", "int", "w", "=", "_base", ".", "getWidth", "(", ")", ";", "int", "h", "=", "_base", ".", "getHeight", "(", ")", ";", "Point", "[", "]", "points", "=", "new", "Point", "[", "]", "{", "n...
Compute the bounds of the base Mirage after it has been transformed.
[ "Compute", "the", "bounds", "of", "the", "base", "Mirage", "after", "it", "has", "been", "transformed", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/TransformedMirage.java#L122-L140
train
threerings/nenya
core/src/main/java/com/threerings/media/image/AWTImageCreator.java
AWTImageCreator.createImage
public BufferedImage createImage (int width, int height, int trans) { // DEBUG: override transparency for the moment on all images trans = Transparency.TRANSLUCENT; if (_gc != null) { return _gc.createCompatibleImage(width, height, trans); } else { // if we're running in headless mode, do everything in 24-bit return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); } }
java
public BufferedImage createImage (int width, int height, int trans) { // DEBUG: override transparency for the moment on all images trans = Transparency.TRANSLUCENT; if (_gc != null) { return _gc.createCompatibleImage(width, height, trans); } else { // if we're running in headless mode, do everything in 24-bit return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); } }
[ "public", "BufferedImage", "createImage", "(", "int", "width", ",", "int", "height", ",", "int", "trans", ")", "{", "// DEBUG: override transparency for the moment on all images", "trans", "=", "Transparency", ".", "TRANSLUCENT", ";", "if", "(", "_gc", "!=", "null",...
documentation inherited from interface BaseImageManager.OptimalImageCreator
[ "documentation", "inherited", "from", "interface", "BaseImageManager", ".", "OptimalImageCreator" ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/AWTImageCreator.java#L55-L65
train
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.getConverterFactory
static ConverterFactory getConverterFactory(Configuration conf) { Class<? extends ConverterFactory> converterFactoryClass = conf.getClass(CONVERTER_FACTORY, null, ConverterFactory.class); if (converterFactoryClass == null) { throw new RuntimeException("ConverterFactory class was not set on the configuration"); } LOG.debug("Got input ConverterFactory class from conf: {}", converterFactoryClass); return ReflectionUtils.newInstance(converterFactoryClass, conf); }
java
static ConverterFactory getConverterFactory(Configuration conf) { Class<? extends ConverterFactory> converterFactoryClass = conf.getClass(CONVERTER_FACTORY, null, ConverterFactory.class); if (converterFactoryClass == null) { throw new RuntimeException("ConverterFactory class was not set on the configuration"); } LOG.debug("Got input ConverterFactory class from conf: {}", converterFactoryClass); return ReflectionUtils.newInstance(converterFactoryClass, conf); }
[ "static", "ConverterFactory", "getConverterFactory", "(", "Configuration", "conf", ")", "{", "Class", "<", "?", "extends", "ConverterFactory", ">", "converterFactoryClass", "=", "conf", ".", "getClass", "(", "CONVERTER_FACTORY", ",", "null", ",", "ConverterFactory", ...
Gets the ConverterFactory from the configuration
[ "Gets", "the", "ConverterFactory", "from", "the", "configuration" ]
37ecb5966315e4cf630a878ffcbada61c50bdcd3
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L82-L90
train
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.setConverterFactoryClass
public static void setConverterFactoryClass(Configuration conf, Class<? extends ConverterFactory> converterFactoryClass) { conf.setClass(CONVERTER_FACTORY, converterFactoryClass, ConverterFactory.class); LOG.debug("Set input ConverterFactory class on conf: {}", converterFactoryClass); }
java
public static void setConverterFactoryClass(Configuration conf, Class<? extends ConverterFactory> converterFactoryClass) { conf.setClass(CONVERTER_FACTORY, converterFactoryClass, ConverterFactory.class); LOG.debug("Set input ConverterFactory class on conf: {}", converterFactoryClass); }
[ "public", "static", "void", "setConverterFactoryClass", "(", "Configuration", "conf", ",", "Class", "<", "?", "extends", "ConverterFactory", ">", "converterFactoryClass", ")", "{", "conf", ".", "setClass", "(", "CONVERTER_FACTORY", ",", "converterFactoryClass", ",", ...
Sets the ConverterFactory class
[ "Sets", "the", "ConverterFactory", "class" ]
37ecb5966315e4cf630a878ffcbada61c50bdcd3
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L95-L99
train
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.getTypeInfo
static StructTypeInfo getTypeInfo(Configuration conf) { StructTypeInfo inputTypeInfo = (StructTypeInfo) TypeInfoUtils.getTypeInfoFromTypeString(conf.get(INPUT_TYPE_INFO)); LOG.debug("Got input typeInfo from conf: {}", inputTypeInfo); return inputTypeInfo; }
java
static StructTypeInfo getTypeInfo(Configuration conf) { StructTypeInfo inputTypeInfo = (StructTypeInfo) TypeInfoUtils.getTypeInfoFromTypeString(conf.get(INPUT_TYPE_INFO)); LOG.debug("Got input typeInfo from conf: {}", inputTypeInfo); return inputTypeInfo; }
[ "static", "StructTypeInfo", "getTypeInfo", "(", "Configuration", "conf", ")", "{", "StructTypeInfo", "inputTypeInfo", "=", "(", "StructTypeInfo", ")", "TypeInfoUtils", ".", "getTypeInfoFromTypeString", "(", "conf", ".", "get", "(", "INPUT_TYPE_INFO", ")", ")", ";", ...
Gets the StructTypeInfo that declares the columns to be read from the configuration
[ "Gets", "the", "StructTypeInfo", "that", "declares", "the", "columns", "to", "be", "read", "from", "the", "configuration" ]
37ecb5966315e4cf630a878ffcbada61c50bdcd3
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L104-L108
train
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.setTypeInfo
public static void setTypeInfo(Configuration conf, StructTypeInfo typeInfo) { conf.set(INPUT_TYPE_INFO, typeInfo.getTypeName()); LOG.debug("Set input typeInfo on conf: {}", typeInfo); }
java
public static void setTypeInfo(Configuration conf, StructTypeInfo typeInfo) { conf.set(INPUT_TYPE_INFO, typeInfo.getTypeName()); LOG.debug("Set input typeInfo on conf: {}", typeInfo); }
[ "public", "static", "void", "setTypeInfo", "(", "Configuration", "conf", ",", "StructTypeInfo", "typeInfo", ")", "{", "conf", ".", "set", "(", "INPUT_TYPE_INFO", ",", "typeInfo", ".", "getTypeName", "(", ")", ")", ";", "LOG", ".", "debug", "(", "\"Set input ...
Sets the StructTypeInfo that declares the columns to be read in the configuration
[ "Sets", "the", "StructTypeInfo", "that", "declares", "the", "columns", "to", "be", "read", "in", "the", "configuration" ]
37ecb5966315e4cf630a878ffcbada61c50bdcd3
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L113-L116
train
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.getSchemaTypeInfo
static StructTypeInfo getSchemaTypeInfo(Configuration conf) { String schemaTypeInfo = conf.get(SCHEMA_TYPE_INFO); if (schemaTypeInfo != null && !schemaTypeInfo.isEmpty()) { LOG.debug("Got schema typeInfo from conf: {}", schemaTypeInfo); return (StructTypeInfo) TypeInfoUtils.getTypeInfoFromTypeString(conf.get(SCHEMA_TYPE_INFO)); } return null; }
java
static StructTypeInfo getSchemaTypeInfo(Configuration conf) { String schemaTypeInfo = conf.get(SCHEMA_TYPE_INFO); if (schemaTypeInfo != null && !schemaTypeInfo.isEmpty()) { LOG.debug("Got schema typeInfo from conf: {}", schemaTypeInfo); return (StructTypeInfo) TypeInfoUtils.getTypeInfoFromTypeString(conf.get(SCHEMA_TYPE_INFO)); } return null; }
[ "static", "StructTypeInfo", "getSchemaTypeInfo", "(", "Configuration", "conf", ")", "{", "String", "schemaTypeInfo", "=", "conf", ".", "get", "(", "SCHEMA_TYPE_INFO", ")", ";", "if", "(", "schemaTypeInfo", "!=", "null", "&&", "!", "schemaTypeInfo", ".", "isEmpty...
Gets the StructTypeInfo that declares the total schema of the file from the configuration
[ "Gets", "the", "StructTypeInfo", "that", "declares", "the", "total", "schema", "of", "the", "file", "from", "the", "configuration" ]
37ecb5966315e4cf630a878ffcbada61c50bdcd3
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L121-L128
train
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.setSchemaTypeInfo
public static void setSchemaTypeInfo(Configuration conf, StructTypeInfo schemaTypeInfo) { if (schemaTypeInfo != null) { conf.set(SCHEMA_TYPE_INFO, schemaTypeInfo.getTypeName()); LOG.debug("Set schema typeInfo on conf: {}", schemaTypeInfo); } }
java
public static void setSchemaTypeInfo(Configuration conf, StructTypeInfo schemaTypeInfo) { if (schemaTypeInfo != null) { conf.set(SCHEMA_TYPE_INFO, schemaTypeInfo.getTypeName()); LOG.debug("Set schema typeInfo on conf: {}", schemaTypeInfo); } }
[ "public", "static", "void", "setSchemaTypeInfo", "(", "Configuration", "conf", ",", "StructTypeInfo", "schemaTypeInfo", ")", "{", "if", "(", "schemaTypeInfo", "!=", "null", ")", "{", "conf", ".", "set", "(", "SCHEMA_TYPE_INFO", ",", "schemaTypeInfo", ".", "getTy...
Sets the StructTypeInfo that declares the total schema of the file in the configuration
[ "Sets", "the", "StructTypeInfo", "that", "declares", "the", "total", "schema", "of", "the", "file", "in", "the", "configuration" ]
37ecb5966315e4cf630a878ffcbada61c50bdcd3
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L133-L138
train
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.setReadColumns
static void setReadColumns(Configuration conf, StructTypeInfo actualStructTypeInfo) { StructTypeInfo readStructTypeInfo = getTypeInfo(conf); LOG.info("Read StructTypeInfo: {}", readStructTypeInfo); List<Integer> ids = new ArrayList<>(); List<String> names = new ArrayList<>(); List<String> readNames = readStructTypeInfo.getAllStructFieldNames(); List<String> actualNames = actualStructTypeInfo.getAllStructFieldNames(); for (int i = 0; i < actualNames.size(); i++) { String actualName = actualNames.get(i); if (readNames.contains(actualName)) { // make sure they are the same type TypeInfo actualTypeInfo = actualStructTypeInfo.getStructFieldTypeInfo(actualName); TypeInfo readTypeInfo = readStructTypeInfo.getStructFieldTypeInfo(actualName); if (!actualTypeInfo.equals(readTypeInfo)) { throw new IllegalStateException("readTypeInfo [" + readTypeInfo + "] does not match actualTypeInfo [" + actualTypeInfo + "]"); } // mark the column as to-be-read ids.add(i); names.add(actualName); } } if (ids.size() == 0) { throw new IllegalStateException("None of the selected columns were found in the ORC file."); } LOG.info("Set column projection on columns: {} ({})", ids, names); ColumnProjectionUtils.appendReadColumns(conf, ids, names); }
java
static void setReadColumns(Configuration conf, StructTypeInfo actualStructTypeInfo) { StructTypeInfo readStructTypeInfo = getTypeInfo(conf); LOG.info("Read StructTypeInfo: {}", readStructTypeInfo); List<Integer> ids = new ArrayList<>(); List<String> names = new ArrayList<>(); List<String> readNames = readStructTypeInfo.getAllStructFieldNames(); List<String> actualNames = actualStructTypeInfo.getAllStructFieldNames(); for (int i = 0; i < actualNames.size(); i++) { String actualName = actualNames.get(i); if (readNames.contains(actualName)) { // make sure they are the same type TypeInfo actualTypeInfo = actualStructTypeInfo.getStructFieldTypeInfo(actualName); TypeInfo readTypeInfo = readStructTypeInfo.getStructFieldTypeInfo(actualName); if (!actualTypeInfo.equals(readTypeInfo)) { throw new IllegalStateException("readTypeInfo [" + readTypeInfo + "] does not match actualTypeInfo [" + actualTypeInfo + "]"); } // mark the column as to-be-read ids.add(i); names.add(actualName); } } if (ids.size() == 0) { throw new IllegalStateException("None of the selected columns were found in the ORC file."); } LOG.info("Set column projection on columns: {} ({})", ids, names); ColumnProjectionUtils.appendReadColumns(conf, ids, names); }
[ "static", "void", "setReadColumns", "(", "Configuration", "conf", ",", "StructTypeInfo", "actualStructTypeInfo", ")", "{", "StructTypeInfo", "readStructTypeInfo", "=", "getTypeInfo", "(", "conf", ")", ";", "LOG", ".", "info", "(", "\"Read StructTypeInfo: {}\"", ",", ...
Sets which fields are to be read from the ORC file
[ "Sets", "which", "fields", "are", "to", "be", "read", "from", "the", "ORC", "file" ]
37ecb5966315e4cf630a878ffcbada61c50bdcd3
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L169-L199
train
threerings/nenya
core/src/main/java/com/threerings/cast/builder/ComponentPanel.java
ComponentPanel.addClassEditors
protected void addClassEditors (BuilderModel model, String cprefix) { List<ComponentClass> classes = model.getComponentClasses(); int size = classes.size(); for (int ii = 0; ii < size; ii++) { ComponentClass cclass = classes.get(ii); if (!cclass.name.startsWith(cprefix)) { continue; } List<Integer> ccomps = model.getComponents(cclass); if (ccomps.size() > 0) { add(new ClassEditor(model, cclass, ccomps)); } else { log.info("Not creating editor for empty class " + "[class=" + cclass + "]."); } } }
java
protected void addClassEditors (BuilderModel model, String cprefix) { List<ComponentClass> classes = model.getComponentClasses(); int size = classes.size(); for (int ii = 0; ii < size; ii++) { ComponentClass cclass = classes.get(ii); if (!cclass.name.startsWith(cprefix)) { continue; } List<Integer> ccomps = model.getComponents(cclass); if (ccomps.size() > 0) { add(new ClassEditor(model, cclass, ccomps)); } else { log.info("Not creating editor for empty class " + "[class=" + cclass + "]."); } } }
[ "protected", "void", "addClassEditors", "(", "BuilderModel", "model", ",", "String", "cprefix", ")", "{", "List", "<", "ComponentClass", ">", "classes", "=", "model", ".", "getComponentClasses", "(", ")", ";", "int", "size", "=", "classes", ".", "size", "(",...
Adds editor user interface elements for each component class to allow the user to select the desired component.
[ "Adds", "editor", "user", "interface", "elements", "for", "each", "component", "class", "to", "allow", "the", "user", "to", "select", "the", "desired", "component", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/ComponentPanel.java#L56-L73
train
groupon/robo-remote
RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/Client.java
Client.isListening
public boolean isListening() throws Exception { try { JSONObject resp = new JSONObject(Get.get(API_BASE_URL + ":" + API_PORT, Constants.REQUEST_HEARTBEAT, "")); return true; } catch (Exception e) { return false; } }
java
public boolean isListening() throws Exception { try { JSONObject resp = new JSONObject(Get.get(API_BASE_URL + ":" + API_PORT, Constants.REQUEST_HEARTBEAT, "")); return true; } catch (Exception e) { return false; } }
[ "public", "boolean", "isListening", "(", ")", "throws", "Exception", "{", "try", "{", "JSONObject", "resp", "=", "new", "JSONObject", "(", "Get", ".", "get", "(", "API_BASE_URL", "+", "\":\"", "+", "API_PORT", ",", "Constants", ".", "REQUEST_HEARTBEAT", ",",...
Returns true if there is RoboRemoteServer currently listening @return @throws Exception
[ "Returns", "true", "if", "there", "is", "RoboRemoteServer", "currently", "listening" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/Client.java#L78-L86
train
groupon/robo-remote
RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/Client.java
Client.map
public JSONArray map(String query, String method_name, Object... items) throws Exception { QueryBuilder builder = new QueryBuilder(API_PORT); builder.map(query, method_name, items); return builder.execute(); }
java
public JSONArray map(String query, String method_name, Object... items) throws Exception { QueryBuilder builder = new QueryBuilder(API_PORT); builder.map(query, method_name, items); return builder.execute(); }
[ "public", "JSONArray", "map", "(", "String", "query", ",", "String", "method_name", ",", "Object", "...", "items", ")", "throws", "Exception", "{", "QueryBuilder", "builder", "=", "new", "QueryBuilder", "(", "API_PORT", ")", ";", "builder", ".", "map", "(", ...
Used to call a method with a list of arguments @param query @param method_name @param items @return @throws Exception
[ "Used", "to", "call", "a", "method", "with", "a", "list", "of", "arguments" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/Client.java#L130-L134
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/RedmineJSONParser.java
RedmineJSONParser.parseTracker
public static Tracker parseTracker(JSONObject object) throws JSONException { final int id = JsonInput.getInt(object, "id"); final String name = JsonInput.getStringNotNull(object, "name"); return new Tracker(id, name); }
java
public static Tracker parseTracker(JSONObject object) throws JSONException { final int id = JsonInput.getInt(object, "id"); final String name = JsonInput.getStringNotNull(object, "name"); return new Tracker(id, name); }
[ "public", "static", "Tracker", "parseTracker", "(", "JSONObject", "object", ")", "throws", "JSONException", "{", "final", "int", "id", "=", "JsonInput", ".", "getInt", "(", "object", ",", "\"id\"", ")", ";", "final", "String", "name", "=", "JsonInput", ".", ...
Parses a tracker. @param object object to parse. @return parsed tracker. @throws RedmineFormatException if object is not a valid tracker.
[ "Parses", "a", "tracker", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/RedmineJSONParser.java#L190-L194
train