code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
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 fireOnDeleteQueue(ChannelEvent e) {
List<EventListener> listeners = changes.getListenerList(AMQP);
for (EventListener listener : listeners) {
ChannelListener amqpListener = (ChannelListener)listener;
amqpListener.onDeleteQueue(e);
}
} | java |
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 fireOnCancelBasic(ChannelEvent e) {
List<EventListener> listeners = changes.getListenerList(AMQP);
for (EventListener listener : listeners) {
ChannelListener amqpListener = (ChannelListener)listener;
amqpListener.onCancelBasic(e);
}
} | java |
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 fireOnPurgeQueue(ChannelEvent e) {
List<EventListener> listeners = changes.getListenerList(AMQP);
for (EventListener listener : listeners) {
ChannelListener amqpListener = (ChannelListener)listener;
amqpListener.onPurgeQueue(e);
}
} | java |
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 fireOnRejectBasic(ChannelEvent e) {
List<EventListener> listeners = changes.getListenerList(AMQP);
for (EventListener listener : listeners) {
ChannelListener amqpListener = (ChannelListener)listener;
amqpListener.onRejectBasic(e);
}
} | 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) {... | 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... | 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 :
... | java |
protected boolean isTypeableTarget (Component target)
{
return target.isShowing() &&
(((target instanceof JTextComponent) && ((JTextComponent) target).isEditable()) ||
(target instanceof JComboBox) ||
(target instanceof JTable) ||
(target instanceof JRootPa... | 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.getCompone... | java |
public static <T> CloseableIterable<T> distinct(final CloseableIterable<T> iterable) {
return wrap(Iterables2.distinct(iterable), iterable);
} | java |
public void delete ()
{
IntBuffer idbuf = BufferUtils.createIntBuffer(1);
idbuf.put(_id).rewind();
AL10.alDeleteBuffers(idbuf);
_id = 0;
} | 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 (!int... | java |
public void setSection (Section section)
{
_sections.put(key(section.x, section.y), section);
} | 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);
} | 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)... | 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()
... | 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(", ");
}... | java |
public boolean shouldPlay (SoundType type)
{
if (type == null) {
type = DEFAULT; // let the lazy kids play too
}
return _clipVol != 0f && isEnabled(type);
} | 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 Observer... | java |
public boolean play (SoundType type, String pkgPath, String key, float pan)
{
return play(type, pkgPath, key, 0, pan);
} | java |
private void addMetaPageInternal(final MetaHelpPage page) {
log.debug("Adding meta-page: {}", page);
metaPages.put(page.getName(), page);
events.publish(new MetaHelpPageAddedEvent(page));
} | java |
public static void main (String[] args)
{
boolean enabled = (args.length > 0 && args[0].equals("on"));
Keyboard.setKeyRepeat(enabled);
} | 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);
} | java |
public static Point getCorner (Point center, Point size)
{
return new Point(center.x - size.x/2, center.y - size.y/2);
} | 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, ... | 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) {
f... | 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;
};
} | java |
public void add(Metric m) {
final MetricName key = m.getName();
metrics_.put(key, m);
} | 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);
... | 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;
} | java |
protected View getView(String viewName) {
for (View view: solo.getCurrentViews()) {
if (view.toString().contains(viewName)) {
return view;
}
}
return null;
} | 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 )
{
... | java |
public <T> boolean has(Class<T> clazz)
{
return configuration.getClass().equals(clazz) || (fieldCache.getIfPresent(clazz) != null);
} | 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 = pa... | java |
public void setTarget (JComponent target, KeyTranslator xlate)
{
setEnabled(false);
// save off references
_target = target;
_xlate = xlate;
} | 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) {
... | java |
public void releaseAllKeys ()
{
long now = System.currentTimeMillis();
Iterator<KeyInfo> iter = _keys.elements();
while (iter.hasNext()) {
iter.next().release(now);
}
} | 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 ... | 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... | 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.getWhe... | java |
protected void logKey (String msg, KeyEvent e)
{
if (DEBUG_EVENTS || _debugTyping.getValue()) {
int keyCode = e.getKeyCode();
log.info(msg, "key", KeyEvent.getKeyText(keyCode));
}
} | 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, nul... | 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);
... | 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;
} | 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 = m... | java |
public WrappedByteBuffer fillWith(byte b, int size) {
_autoExpand(size);
while (size-- > 0) {
_buf.put(b);
}
return this;
} | 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++) {
i... | 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;
} | java |
public WrappedByteBuffer putAt(int index, byte v) {
_checkForWriteAt(index, 1);
_buf.put(index, v);
return this;
} | java |
public WrappedByteBuffer putUnsignedAt(int index, int v) {
_checkForWriteAt(index, 1);
byte b = (byte)(v & 0xFF);
return this.putAt(index, b);
} | java |
public WrappedByteBuffer putShortAt(int index, short v) {
_checkForWriteAt(index, 2);
_buf.putShort(index, v);
return this;
} | java |
public WrappedByteBuffer putIntAt(int index, int v) {
_checkForWriteAt(index, 4);
_buf.putInt(index, v);
return this;
} | java |
public WrappedByteBuffer putLongAt(int index, long v) {
_checkForWriteAt(index, 8);
_buf.putLong(index, v);
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;
} | 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 U... | 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;
} | java |
public WrappedByteBuffer putBuffer(WrappedByteBuffer v) {
_autoExpand(v.remaining());
_buf.put(v._buf);
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);
... | java |
public byte[] getBytes(int size){
_checkForRead(size);
byte[] dst = new byte[size];
_buf.get(dst, 0, size);
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;
} | 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;
}
} | java |
public long getUnsignedIntAt(int index) {
_checkForReadAt(index,4);
long val = (long) (_buf.getInt(index) & 0xffffffffL);
return val;
} | 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();
brea... | 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 (!n... | java |
public WrappedByteBuffer skip(int size) {
_autoExpand(size);
_buf.position(_buf.position() + size);
return this;
} | 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(' ');
}
... | 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 ... | java |
static void setArrayIndex(Map<String,String> meta, int level, int index) {
meta.put(level + ARRAY_IDX_SUFFIX, Integer.toString(index));
} | java |
static Integer getArrayIndex(Map<String,String> meta, int level) {
return Integer.parseInt(meta.get(level + ARRAY_IDX_SUFFIX));
} | java |
static boolean hasArrayIndex(Map<String,String> meta, int level) {
return meta.containsKey(level + ARRAY_IDX_SUFFIX);
} | 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))
... | 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;
}
... | 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)));
} | 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);
} | 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 conf... | java |
public Tags filter(Set<String> tag_names) {
return Tags.valueOf(tags_.entrySet().stream()
.filter(entry -> tag_names.contains(entry.getKey())));
} | 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 ... | java |
public void updateBounds ()
{
Dimension size = _label.getSize();
_bounds.width = size.width;
_bounds.height = size.height;
} | java |
protected void layoutLabel ()
{
Graphics2D gfx = _mgr.createGraphics();
if (gfx == null) {
return;
}
try {
gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
(_antiAliased) ?
RenderingHints.V... | 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 ... | 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) {
ret... | 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(t... | 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);
} | 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, ma... | 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... | 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 con... | 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);
} | 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;
} | java |
public static void setTypeInfo(Configuration conf, StructTypeInfo typeInfo) {
conf.set(INPUT_TYPE_INFO, typeInfo.getTypeName());
LOG.debug("Set input typeInfo on conf: {}", typeInfo);
} | 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... | 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);
}
} | 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> readName... | 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(cprefi... | 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;
}
} | 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();
} | 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);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.