code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
protected void createPath (List<Point> points)
{
Point last = null;
int size = points.size();
for (int ii = 0; ii < size; ii++) {
Point p = points.get(ii);
int dir = (ii == 0) ? NORTH : DirectionUtil.getDirection(last, p);
addNode(p.x, p.y, dir);
... | java |
public static void browseURL (URL url, ResultListener<Void> listener, String genagent)
{
String[] cmd;
if (RunAnywhere.isWindows()) {
// TODO: test this on Vinders 98
// cmd = new String[] { "rundll32", "url.dll,FileProtocolHandler",
// url.toString() };
... | java |
public void setPosition (float x, float y, float z)
{
if (_px != x || _py != y || _pz != z) {
AL10.alSource3f(_id, AL10.AL_POSITION, _px = x, _py = y, _pz = z);
}
} | java |
public void setVelocity (float x, float y, float z)
{
if (_vx != x || _vy != y || _vz != z) {
AL10.alSource3f(_id, AL10.AL_VELOCITY, _vx = x, _vy = y, _vz = z);
}
} | java |
public void setGain (float gain)
{
if (_gain != gain) {
AL10.alSourcef(_id, AL10.AL_GAIN, _gain = gain);
}
} | java |
public void setSourceRelative (boolean relative)
{
if (_sourceRelative != relative) {
_sourceRelative = relative;
AL10.alSourcei(_id, AL10.AL_SOURCE_RELATIVE, relative ? AL10.AL_TRUE : AL10.AL_FALSE);
}
} | java |
public void setLooping (boolean looping)
{
if (_looping != looping) {
_looping = looping;
AL10.alSourcei(_id, AL10.AL_LOOPING, looping ? AL10.AL_TRUE : AL10.AL_FALSE);
}
} | java |
public void setMinGain (float gain)
{
if (_minGain != gain) {
AL10.alSourcef(_id, AL10.AL_MIN_GAIN, _minGain = gain);
}
} | java |
public void setMaxGain (float gain)
{
if (_maxGain != gain) {
AL10.alSourcef(_id, AL10.AL_MAX_GAIN, _maxGain = gain);
}
} | java |
public void setReferenceDistance (float distance)
{
if (_referenceDistance != distance) {
AL10.alSourcef(_id, AL10.AL_REFERENCE_DISTANCE, _referenceDistance = distance);
}
} | java |
public void setRolloffFactor (float rolloff)
{
if (_rolloffFactor != rolloff) {
AL10.alSourcef(_id, AL10.AL_ROLLOFF_FACTOR, _rolloffFactor = rolloff);
}
} | java |
public void setMaxDistance (float distance)
{
if (_maxDistance != distance) {
AL10.alSourcef(_id, AL10.AL_MAX_DISTANCE, _maxDistance = distance);
}
} | java |
public void setPitch (float pitch)
{
if (_pitch != pitch) {
AL10.alSourcef(_id, AL10.AL_PITCH, _pitch = pitch);
}
} | java |
public void setDirection (float x, float y, float z)
{
if (_dx != x || _dy != y || _dz != z) {
AL10.alSource3f(_id, AL10.AL_DIRECTION, _dx = x, _dy = y, _dz = z);
}
} | java |
public void setConeInnerAngle (float angle)
{
if (_coneInnerAngle != angle) {
AL10.alSourcef(_id, AL10.AL_CONE_INNER_ANGLE, _coneInnerAngle = angle);
}
} | java |
public void setConeOuterAngle (float angle)
{
if (_coneOuterAngle != angle) {
AL10.alSourcef(_id, AL10.AL_CONE_OUTER_ANGLE, _coneOuterAngle = angle);
}
} | java |
public void setConeOuterGain (float gain)
{
if (_coneOuterGain != gain) {
AL10.alSourcef(_id, AL10.AL_CONE_OUTER_GAIN, _coneOuterGain = gain);
}
} | java |
public void setBuffer (Buffer buffer)
{
_queue.clear();
if (buffer != null) {
_queue.add(buffer);
}
AL10.alSourcei(_id, AL10.AL_BUFFER, buffer == null ? AL10.AL_NONE : buffer.getId());
} | java |
public void queueBuffers (Buffer... buffers)
{
IntBuffer idbuf = BufferUtils.createIntBuffer(buffers.length);
for (int ii = 0; ii < buffers.length; ii++) {
Buffer buffer = buffers[ii];
_queue.add(buffer);
idbuf.put(ii, buffer.getId());
}
AL10.alSou... | java |
public void unqueueBuffers (Buffer... buffers)
{
IntBuffer idbuf = BufferUtils.createIntBuffer(buffers.length);
for (int ii = 0; ii < buffers.length; ii++) {
Buffer buffer = buffers[ii];
_queue.remove(buffer);
idbuf.put(ii, buffer.getId());
}
AL10.... | java |
public void delete ()
{
IntBuffer idbuf = BufferUtils.createIntBuffer(1);
idbuf.put(_id).rewind();
AL10.alDeleteSources(idbuf);
_id = 0;
_queue.clear();
} | java |
public UniformTileSet loadTileSet (String imgPath, int width, int height)
{
return loadCachedTileSet("", imgPath, width, height);
} | java |
public TileSet getTileSet (String name)
throws NoSuchTileSetException
{
// make sure we have a repository configured
if (_setrep == null) {
throw new NoSuchTileSetException(name);
}
try {
return _setrep.getTileSet(name);
} catch (PersistenceEx... | java |
public Map<String, Object> getProperties() {
// Shallow copy entries to a newly instantiated HashMap.
Map<String, Object> clone = new HashMap<String, Object>();
Set<Entry<String, Object>> set = _properties.entrySet();
for (Entry<String, Object> entry : set) {
// Ther... | java |
public void setAppId(String appId) {
if (appId == null) {
_properties.remove(AMQP_PROP_APP_ID);
return;
}
_properties.put(AMQP_PROP_APP_ID, appId);
} | java |
public void setContentType(String contentType) {
if (contentType == null) {
_properties.remove(AMQP_PROP_CONTENT_TYPE);
return;
}
_properties.put(AMQP_PROP_CONTENT_TYPE, contentType);
} | java |
public void setContentEncoding(String encoding) {
if (encoding == null) {
_properties.remove(AMQP_PROP_CONTENT_ENCODING);
return;
}
_properties.put(AMQP_PROP_CONTENT_ENCODING, encoding);
} | java |
public void setCorrelationId(String correlationId) {
if (correlationId == null) {
_properties.remove(AMQP_PROP_CORRELATION_ID);
return;
}
_properties.put(AMQP_PROP_CORRELATION_ID, correlationId);
} | java |
public void setDeliveryMode(Integer deliveryMode) {
if (deliveryMode == null) {
_properties.remove(AMQP_PROP_DELIVERY_MODE);
return;
}
// Perhaps, we could do an enum for deliveryMode. But, it will require
// some major changes in encoding and decoding an... | java |
public void setExpiration(String expiration) {
if (expiration == null) {
_properties.remove(AMQP_PROP_EXPIRATION);
return;
}
_properties.put(AMQP_PROP_EXPIRATION, expiration);
} | java |
public void setHeaders(AmqpArguments headers) {
if (headers == null) {
_properties.remove(AMQP_PROP_HEADERS);
return;
}
_properties.put(AMQP_PROP_HEADERS, headers);
} | java |
public void setMessageId(String messageId) {
if (messageId == null) {
_properties.remove(AMQP_PROP_MESSAGE_ID);
return;
}
_properties.put(AMQP_PROP_MESSAGE_ID, messageId);
} | java |
public void setPriority(Integer priority) {
if (priority == null) {
_properties.remove(AMQP_PROP_PRIORITY);
return;
}
int priorityValue = priority.intValue();
if ((priorityValue < 0) || (priorityValue > 9)) {
String s = "AMQP 0-9-1 spe... | java |
public void setReplyTo(String replyTo) {
if (replyTo == null) {
_properties.remove(AMQP_PROP_REPLY_TO);
return;
}
_properties.put(AMQP_PROP_REPLY_TO, replyTo);
} | java |
public void setTimestamp(Timestamp timestamp) {
if (timestamp == null) {
_properties.remove(AMQP_PROP_TIMESTAMP);
return;
}
_properties.put(AMQP_PROP_TIMESTAMP, timestamp);
} | java |
public void setType(String type) {
if (type == null) {
_properties.remove(AMQP_PROP_TYPE);
return;
}
_properties.put(AMQP_PROP_TYPE, type);
} | java |
public void setUserId(String userId) {
if (userId == null) {
_properties.remove(AMQP_PROP_USER_ID);
return;
}
_properties.put(AMQP_PROP_USER_ID, userId);
} | java |
public boolean createBundle (
File target, TileSetBundle bundle, ImageProvider improv, String imageBase, long newestMod)
throws IOException
{
return createBundleJar(target, bundle, improv, imageBase, _keepRawPngs, _uncompressed);
} | java |
protected void initBundles (ResourceManager rmgr, String name)
{
// first we obtain the resource set from which we will load up our
// tileset bundles
ResourceBundle[] rbundles = rmgr.getResourceSet(name);
// sanity check
if (rbundles == null) {
log.warning("Unab... | java |
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap,
ResourceBundle bundle)
{
try {
TileSetBundle tsb = BundleUtil.extractBundle(bundle);
// initialize it and add it to the list
tsb.init(bundle);
addBundle(idmap, namem... | java |
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap,
TileSetBundle bundle)
{
IMImageProvider improv = (_imgr == null) ?
null : new IMImageProvider(_imgr, bundle);
// map all of the tilesets in this bundle
for (IntMa... | java |
public SceneObjectIndicator createIndicator (MisoScenePanel panel, String text, Icon icon)
{
return new SceneObjectTip(text, icon);
} | java |
public static void register (String prefix, ObjectActionHandler handler)
{
// make sure we know about potential funny business
if (_oahandlers.containsKey(prefix)) {
log.warning("Warning! Overwriting previous object action handler registration, all " +
"hell could... | java |
public static int bound (int low, int value, int high)
{
return Math.min(high, Math.max(low, value));
} | java |
public static int distanceSq (int x0, int y0, int x1, int y1)
{
return ((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0));
} | java |
public static float[] stddev (int[] values, int start, int length)
{
// first we need the mean
float mean = 0f;
for (int ii = start, end = start + length; ii < end; ii++) {
mean += values[ii];
}
mean /= length;
// next we compute the variance
floa... | java |
private void validateNamesUnique(List<String> names) {
List<String> seenNames = new ArrayList<>(names.size());
for (int i = 0; i < names.size(); i++) {
String lowerCaseName = names.get(i).toLowerCase();
int index = seenNames.indexOf(lowerCaseName);
if (index != -1) {
throw new IllegalA... | java |
public void setSpot (int x, int y, byte orient)
{
_spot = new Point(x, y);
_sorient = orient;
} | java |
public boolean hasConstraint (String constraint)
{
return (_constraints == null) ? false :
ListUtil.contains(_constraints, constraint);
} | java |
public String getSyntax() {
if (name != null && longName != null) {
return String.format("-%s (--%s)", name, longName);
}
else if (name != null) {
return String.format("-%s", name);
}
else if (longName != null) {
return String.format("--%s", longName);
}
throw new Error();
... | java |
public void setLocalePrefix (final String prefix)
{
setLocaleHandler(
new LocaleHandler() {
public String getLocalePath (String path) {
return PathUtil.appendPath(prefix, path);
}
});
} | java |
public void initBundles (String resourceDir, String configPath, InitObserver initObs)
throws IOException
{
// reinitialize our resource dir if it was specified
if (resourceDir != null) {
initResourceDir(resourceDir);
}
// load up our configuration
Propert... | java |
public boolean checkBundle (String path)
{
File bfile = getResourceFile(path);
return (bfile == null) ? false : new FileResourceBundle(bfile, true, _unpack).isUnpacked();
} | java |
public InputStream getResource (String path)
throws IOException
{
String localePath = getLocalePath(path);
InputStream in;
// first look for this resource in our default resource bundle
for (ResourceBundle bundle : _default) {
// Try a localized version first.
... | java |
public void addModificationObserver (String path, ModificationObserver obs)
{
ObservedResource resource = _observed.get(path);
if (resource == null) {
File file = getResourceFile(path);
if (file == null) {
return; // only resource files will ever be modified
... | java |
public void removeModificationObserver (String path, ModificationObserver obs)
{
ObservedResource resource = _observed.get(path);
if (resource != null) {
resource.observers.remove(obs);
}
} | java |
protected Properties loadConfig (String configPath)
throws IOException
{
Properties config = new Properties();
try {
config.load(new FileInputStream(new File(_rdir, configPath)));
} catch (Exception e) {
String errmsg = "Unable to load resource manager config ... | java |
protected void resolveResourceSet (
String setName, String definition, String setType, List<ResourceBundle> dlist)
{
List<ResourceBundle> set = Lists.newArrayList();
StringTokenizer tok = new StringTokenizer(definition, ":");
while (tok.hasMoreTokens()) {
set.add(createRe... | java |
protected ResourceBundle createResourceBundle (String setType, String path,
List<ResourceBundle> dlist)
{
if (setType.equals(FILE_SET_TYPE)) {
FileResourceBundle bundle =
createFileResourceBundle(getResourceFile(path), true, _unpack);
if (!bundle.isUnpacked() ... | java |
protected FileResourceBundle createFileResourceBundle (
File source, boolean delay, boolean unpack)
{
return new FileResourceBundle(source, delay, unpack);
} | java |
protected ResourceBundle createNetworkResourceBundle (
String root, String path, Set<String> rsrcList)
{
return new NetworkResourceBundle(root, path, rsrcList);
} | java |
protected InputStream getInputStreamFromClasspath (final String fullyQualifiedPath)
{
return AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
public InputStream run () {
return _loader.getResourceAsStream(fullyQualifiedPath);
}
});
} | java |
protected String getLocalePath (String path)
{
return (_localeHandler == null) ? null : _localeHandler.getLocalePath(path);
} | java |
protected static int getNumericJavaVersion (String verstr)
{
Matcher m = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?.*").matcher(verstr);
if (!m.matches()) {
// if we can't parse the java version we're in weird land and should probably just try
// our luck with what we'... | java |
private void writeObject (ObjectOutputStream out)
throws IOException
{
out.writeInt(size());
for (IntEntry<TileSet> entry : intEntrySet()) {
out.writeInt(entry.getIntKey());
out.writeObject(entry.getValue());
}
} | java |
private void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
int count = in.readInt();
for (int ii = 0; ii < count; ii++) {
int tileSetId = in.readInt();
TileSet set = (TileSet)in.readObject();
put(tileSetId, set);
}... | java |
public void run() {
boolean validation_fail = false;
boolean arg_seen = true;
for (String file : files) {
final Report v = new Report(new File(file).getAbsoluteFile(), recursive);
if (v.hasErrors()) validation_fail = true;
if (arg_seen) {
arg_s... | java |
private synchronized void onNewMbean(ObjectName obj) {
if (detected_groups_.keySet().contains(obj)) {
LOG.log(Level.WARNING, "skipping registration of {0}: already present", obj);
return;
}
MBeanGroup instance = new MBeanGroup(obj, resolvedMap);
detected_groups_.... | java |
private synchronized void onRemovedMbean(ObjectName obj) {
if (!detected_groups_.keySet().contains(obj)) {
LOG.log(Level.WARNING, "skipping de-registration of {0}: not present", obj);
return;
}
MBeanGroup instance = detected_groups_.get(obj);
detected_groups_.rem... | java |
public static void renderIndex(final PrintWriter out, final Collection<? extends HelpPage> pages) {
checkNotNull(out);
checkNotNull(pages);
checkArgument(!pages.isEmpty(), "No help pages to render index");
// construct a printf format with sizing for showing columns
int max = pages.stream().mapToI... | java |
public void addDirtyRegion (Rectangle rect)
{
// Only add dirty regions where rect intersects our actual media as the set region will
// propagate out to the repaint manager.
for (AbstractMedia media : _metamgr) {
Rectangle intersection = media.getBounds().intersection(rect);
... | java |
private void runEvictor(ConnectionEvictor evictor2) {
final Thread evictorThread = new Thread(evictor2);
evictorThread.setDaemon(true);
evictorThread
.setName("Redmine communicator connection eviction thread");
evictorThread.start();
} | java |
@Override
public boolean addAll(Collection<? extends TimeSeriesCollection> c) {
try {
final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_TCP);
try {
final list_of_timeseries_collection enc_c = encodeTSCCollection(c);
return BlockingWrapp... | java |
@Override
public DateTime getEnd() {
try {
final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_UDP);
try {
return decodeTimestamp(BlockingWrapper.execute(() -> client.getEnd_1()));
} finally {
client.close();
}
... | java |
public MetricValue[] getAll(int startInclusive, int endExclusive) {
return IntStream.range(startInclusive, endExclusive)
.mapToObj(this::getOrNull)
.toArray(MetricValue[]::new);
} | java |
public List<ChallengeHandler> lookup(String location) {
List<ChallengeHandler> result = Collections.emptyList();
if (location != null) {
Node<ChallengeHandler, UriElement> resultNode = findBestMatchingNode(location);
if (resultNode != null) {
return resultNode.get... | java |
ChallengeHandler lookup(ChallengeRequest challengeRequest) {
ChallengeHandler result = null;
String location = challengeRequest.getLocation();
if (location != null) {
Node<ChallengeHandler,UriElement> resultNode = findBestMatchingNode(location);
//
// If we f... | java |
private void refresh() {
try {
// Invoke underlying getTuples unsynchronized.
// This way it won't block tuple access, in case it is a long
// running or expensive function.
final CompletableFuture<? extends Collection<ResolverTuple>> fut = underlying.getTuples();... | java |
private void update(Collection<ResolverTuple> underlyingTuples, Throwable t) {
if (t != null)
applyException(t);
else if (underlyingTuples != null)
applyUpdate(underlyingTuples);
else
applyException(null);
} | java |
private synchronized void applyUpdate(Collection<ResolverTuple> underlyingTuples) {
lastRefresh = DateTime.now();
tuples = underlyingTuples;
exception = null;
reschedule(minAge.getMillis());
} | java |
private synchronized void reschedule(long millis) {
currentFut = null; // Remove current future.
if (!closed) {
SCHEDULER.schedule(this::refresh, millis, TimeUnit.MILLISECONDS);
} else {
try {
underlying.close();
} catch (Exception ex) {
... | java |
public static Map<String, TileSet> parseActionTileSets (File file)
throws IOException, SAXException
{
return parseActionTileSets(new BufferedInputStream(new FileInputStream(file)));
} | java |
public static Map<String, TileSet> parseActionTileSets (InputStream in)
throws IOException, SAXException
{
Digester digester = new Digester();
digester.addSetProperties("actions" + ActionRuleSet.ACTION_PATH);
addTileSetRuleSet(digester, new SwissArmyTileSetRuleSet());
addTile... | java |
public static TileSetBundle extractBundle (ResourceBundle bundle)
throws IOException, ClassNotFoundException
{
// unserialize the tileset bundles array
InputStream tbin = null;
try {
tbin = bundle.getResource(METADATA_PATH);
ObjectInputStream oin = new ObjectI... | java |
public static TileSetBundle extractBundle (File file)
throws IOException, ClassNotFoundException
{
// unserialize the tileset bundles array
FileInputStream fin = new FileInputStream(file);
try {
ObjectInputStream oin = new ObjectInputStream(
new BufferedIn... | java |
public static FileChannel createTempFile(Path dir, String prefix, String suffix) throws IOException {
return createNewFileImpl(dir, prefix, suffix, new OpenOption[]{READ, WRITE, CREATE_NEW, DELETE_ON_CLOSE}).getFileChannel();
} | java |
public static FileChannel createTempFile(String prefix, String suffix) throws IOException {
return createTempFile(TMPDIR, prefix, suffix);
} | java |
public static NamedFileChannel createNewFile(Path dir, String prefix, String suffix) throws IOException {
return createNewFileImpl(dir, prefix, suffix, new OpenOption[]{READ, WRITE, CREATE_NEW});
} | java |
public void paint (Graphics2D gfx)
{
// if we're rendering footprints, paint that
boolean footpaint = _fprintDebug.getValue();
if (footpaint) {
gfx.setColor(Color.black);
gfx.draw(_footprint);
if (_hideObjects.getValue()) {
// We're in foo... | java |
public void setPriority (byte priority)
{
info.priority = (byte)Math.max(
Byte.MIN_VALUE, Math.min(Byte.MAX_VALUE, priority));
} | java |
public void relocateObject (MisoSceneMetrics metrics, int tx, int ty)
{
// Log.info("Relocating object " + this + " to " +
// StringUtil.coordsToString(tx, ty));
info.x = tx;
info.y = ty;
computeInfo(metrics);
} | java |
protected void computeInfo (MisoSceneMetrics metrics)
{
// start with the screen coordinates of our origin tile
Point tpos = MisoUtil.tileToScreen(
metrics, info.x, info.y, new Point());
// if the tile has an origin coordinate, use that, otherwise
// compute it from the ... | java |
@Override
public void run() {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
subjectRepository.getSubjectsCollection(new SubjectRepository.SubjectListCallback() {
@Override
public void onSubjectList... | java |
private void fixBacklog() throws IOException {
try {
writers.values().parallelStream()
.forEach(groupWriter -> {
try {
groupWriter.fixBacklog(timestamps.size());
} catch (IOExcepti... | java |
public void setPaused (boolean paused)
{
// sanity check
if ((paused && (_pauseTime != 0)) || (!paused && (_pauseTime == 0))) {
log.warning("Requested to pause when paused or vice-versa", "paused", paused);
return;
}
_paused = paused;
if (_paused) {
... | java |
public void paintMedia (Graphics2D gfx, int layer, Rectangle dirty)
{
if (layer == FRONT) {
_spritemgr.paint(gfx, layer, dirty);
_animmgr.paint(gfx, layer, dirty);
} else {
_animmgr.paint(gfx, layer, dirty);
_spritemgr.paint(gfx, layer, dirty);
... | java |
public void paintPerf (Graphics2D gfx)
{
if (_perfRect != null && FrameManager._perfDebug.getValue()) {
gfx.setClip(null);
_perfLabel.render(gfx, _perfRect.x, _perfRect.y);
}
} | java |
public void viewLocationDidChange (int dx, int dy)
{
if (_perfRect != null) {
Rectangle sdirty = new Rectangle(_perfRect);
sdirty.translate(-dx, -dy);
_remgr.addDirtyRegion(sdirty);
}
// let our sprites and animations know what's up
_animmgr.viewL... | java |
public void setImage (Mirage image)
{
if (_mirage != null) {
_totalTileMemory -= _mirage.getEstimatedMemoryUsage();
}
_mirage = image;
if (_mirage != null) {
_totalTileMemory += _mirage.getEstimatedMemoryUsage();
}
} | java |
public void paint (Graphics2D gfx, int x, int y)
{
_mirage.paint(gfx, x, y);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.