_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q5000
AppServiceRegistry.bulkRegisterSingleton
train
synchronized void bulkRegisterSingleton() { for (Map.Entry<Class<? extends AppService>, AppService> entry : registry.entrySet()) { if (isSingletonService(entry.getKey())) { app.registerSingleton(entry.getKey(), entry.getValue()); } } }
java
{ "resource": "" }
q5001
ActionContext.paramKeys
train
@Override public Set<String> paramKeys() { Set<String> set = new HashSet<String>(); set.addAll(C.<String>list(request.paramNames())); set.addAll(extraParams.keySet()); set.addAll(bodyParams().keySet()); set.remove("_method"); set.remove("_body"); return set; ...
java
{ "resource": "" }
q5002
ActionContext.applyContentType
train
public ActionContext applyContentType(Result result) { if (!result.status().isError()) { return applyContentType(); } return applyContentType(contentTypeForErrorResult(req())); }
java
{ "resource": "" }
q5003
ActionContext.cached
train
public <T> T cached(String key) { H.Session sess = session(); if (null != sess) { return sess.cached(key); } else { return app().cache().get(key); } }
java
{ "resource": "" }
q5004
ActionContext.cache
train
public void cache(String key, Object obj) { H.Session sess = session(); if (null != sess) { sess.cache(key, obj); } else { app().cache().put(key, obj); } }
java
{ "resource": "" }
q5005
ActionContext.cache
train
public void cache(String key, Object obj, int expiration) { H.Session session = this.session; if (null != session) { session.cache(key, obj, expiration); } else { app().cache().put(key, obj, expiration); } }
java
{ "resource": "" }
q5006
ActionContext.evictCache
train
public void evictCache(String key) { H.Session sess = session(); if (null != sess) { sess.evict(key); } else { app().cache().evict(key); } }
java
{ "resource": "" }
q5007
ActionContext.login
train
public void login(Object userIdentifier) { session().put(config().sessionKeyUsername(), userIdentifier); app().eventBus().trigger(new LoginEvent(userIdentifier.toString())); }
java
{ "resource": "" }
q5008
ActionContext.loginAndRedirectBack
train
public void loginAndRedirectBack(Object userIdentifier, String defaultLandingUrl) { login(userIdentifier); RedirectToLoginUrl.redirectToOriginalUrl(this, defaultLandingUrl); }
java
{ "resource": "" }
q5009
ActionContext.logout
train
public void logout() { String userIdentifier = session.get(config().sessionKeyUsername()); SessionManager sessionManager = app().sessionManager(); sessionManager.logout(session); if (S.notBlank(userIdentifier)) { app().eventBus().trigger(new LogoutEvent(userIdentifier)); ...
java
{ "resource": "" }
q5010
JobContext.init
train
public static void init(String jobId) { JobContext parent = current_.get(); JobContext ctx = new JobContext(parent); current_.set(ctx); // don't call setJobId(String) // as it will trigger listeners -- TODO fix me ctx.jobId = jobId; if (null == parent) { ...
java
{ "resource": "" }
q5011
JobContext.clear
train
public static void clear() { JobContext ctx = current_.get(); if (null != ctx) { ctx.bag_.clear(); JobContext parent = ctx.parent; if (null != parent) { current_.set(parent); ctx.parent = null; } else { curre...
java
{ "resource": "" }
q5012
JobContext.get
train
public static <T> T get(String key, Class<T> clz) { return (T)m().get(key); }
java
{ "resource": "" }
q5013
JobContext.copy
train
static JobContext copy() { JobContext current = current_.get(); //JobContext ctxt = new JobContext(keepParent ? current : null); JobContext ctxt = new JobContext(null); if (null != current) { ctxt.bag_.putAll(current.bag_); } return ctxt; }
java
{ "resource": "" }
q5014
JobContext.loadFromOrigin
train
static void loadFromOrigin(JobContext origin) { if (origin.bag_.isEmpty()) { return; } ActContext<?> actContext = ActContext.Base.currentContext(); if (null != actContext) { Locale locale = (Locale) origin.bag_.get("locale"); if (null != locale) { ...
java
{ "resource": "" }
q5015
CaptchaSession.getToken
train
public String getToken() { String id = null == answer ? text : answer; return Act.app().crypto().generateToken(id); }
java
{ "resource": "" }
q5016
RouterRegexMacroLookup.expand
train
public String expand(String macro) { if (!isMacro(macro)) { return macro; } String definition = macros.get(Config.canonical(macro)); if (null == definition) { warn("possible missing definition of macro[%s]", macro); } return null == definition ? ma...
java
{ "resource": "" }
q5017
JavaNames.isPackageOrClassName
train
public static boolean isPackageOrClassName(String s) { if (S.blank(s)) { return false; } S.List parts = S.fastSplit(s, "."); if (parts.size() < 2) { return false; } for (String part: parts) { if (!Character.isJavaIdentifierStart(part.ch...
java
{ "resource": "" }
q5018
JavaNames.packageNameOf
train
public static String packageNameOf(Class<?> clazz) { String name = clazz.getName(); int pos = name.lastIndexOf('.'); E.unexpectedIf(pos < 0, "Class does not have package: " + name); return name.substring(0, pos); }
java
{ "resource": "" }
q5019
RouteInfo.of
train
public static RouteInfo of(ActionContext context) { H.Method m = context.req().method(); String path = context.req().url(); RequestHandler handler = context.handler(); if (null == handler) { handler = UNKNOWN_HANDLER; } return new RouteInfo(m, path, handler); ...
java
{ "resource": "" }
q5020
WebSocketConnectionRegistry.get
train
public List<WebSocketConnection> get(String key) { final List<WebSocketConnection> retList = new ArrayList<>(); accept(key, C.F.addTo(retList)); return retList; }
java
{ "resource": "" }
q5021
WebSocketConnectionRegistry.signIn
train
public void signIn(String key, WebSocketConnection connection) { ConcurrentMap<WebSocketConnection, WebSocketConnection> bag = ensureConnectionList(key); bag.put(connection, connection); }
java
{ "resource": "" }
q5022
WebSocketConnectionRegistry.signIn
train
public void signIn(String key, Collection<WebSocketConnection> connections) { if (connections.isEmpty()) { return; } Map<WebSocketConnection, WebSocketConnection> newMap = new HashMap<>(); for (WebSocketConnection conn : connections) { newMap.put(conn, conn); ...
java
{ "resource": "" }
q5023
WebSocketConnectionRegistry.signOff
train
public void signOff(String key, WebSocketConnection connection) { ConcurrentMap<WebSocketConnection, WebSocketConnection> connections = registry.get(key); if (null == connections) { return; } connections.remove(connection); }
java
{ "resource": "" }
q5024
WebSocketConnectionRegistry.signOff
train
public void signOff(WebSocketConnection connection) { for (ConcurrentMap<WebSocketConnection, WebSocketConnection> connections : registry.values()) { connections.remove(connection); } }
java
{ "resource": "" }
q5025
WebSocketConnectionRegistry.signOff
train
public void signOff(String key, Collection<WebSocketConnection> connections) { if (connections.isEmpty()) { return; } ConcurrentMap<WebSocketConnection, WebSocketConnection> bag = ensureConnectionList(key); bag.keySet().removeAll(connections); }
java
{ "resource": "" }
q5026
WebSocketConnectionRegistry.count
train
public int count() { int n = 0; for (ConcurrentMap<?, ?> bag : registry.values()) { n += bag.size(); } return n; }
java
{ "resource": "" }
q5027
WebSocketConnectionRegistry.count
train
public int count(String key) { ConcurrentMap<WebSocketConnection, WebSocketConnection> bag = registry.get(key); return null == bag ? 0 : bag.size(); }
java
{ "resource": "" }
q5028
ReflectedInvokerHelper.tryGetSingleton
train
public static Object tryGetSingleton(Class<?> invokerClass, App app) { Object singleton = app.singleton(invokerClass); if (null == singleton) { if (isGlobalOrStateless(invokerClass, new HashSet<Class>())) { singleton = app.getInstance(invokerClass); } } ...
java
{ "resource": "" }
q5029
JsonUtilConfig.writeJson
train
private static final void writeJson(Writer os, // Object object, // SerializeConfig config, // SerializeFilter[] filters, // DateFormat dateFormat, // ...
java
{ "resource": "" }
q5030
DbService.entityClasses
train
public Set<Class> entityClasses() { EntityMetaInfoRepo repo = app().entityMetaInfoRepo().forDb(id); return null == repo ? C.<Class>set() : repo.entityClasses(); }
java
{ "resource": "" }
q5031
WebSocketContext.messageReceived
train
public WebSocketContext messageReceived(String receivedMessage) { this.stringMessage = S.string(receivedMessage).trim(); isJson = stringMessage.startsWith("{") || stringMessage.startsWith("]"); tryParseQueryParams(); return this; }
java
{ "resource": "" }
q5032
WebSocketContext.reTag
train
public WebSocketContext reTag(String label) { WebSocketConnectionRegistry registry = manager.tagRegistry(); registry.signOff(connection); registry.signIn(label, connection); return this; }
java
{ "resource": "" }
q5033
WebSocketContext.sendToPeers
train
public WebSocketContext sendToPeers(String message, boolean excludeSelf) { return sendToConnections(message, url, manager.urlRegistry(), excludeSelf); }
java
{ "resource": "" }
q5034
WebSocketContext.sendToTagged
train
public WebSocketContext sendToTagged(String message, String tag) { return sendToTagged(message, tag, false); }
java
{ "resource": "" }
q5035
WebSocketContext.sendToTagged
train
public WebSocketContext sendToTagged(String message, String tag, boolean excludeSelf) { return sendToConnections(message, tag, manager.tagRegistry(), excludeSelf); }
java
{ "resource": "" }
q5036
WebSocketContext.sendToUser
train
public WebSocketContext sendToUser(String message, String username) { return sendToConnections(message, username, manager.usernameRegistry(), true); }
java
{ "resource": "" }
q5037
WebSocketContext.sendJsonToUser
train
public WebSocketContext sendJsonToUser(Object data, String username) { return sendToTagged(JSON.toJSONString(data), username); }
java
{ "resource": "" }
q5038
ApplicationModule.bindMappers
train
public void bindMappers() { JacksonXmlModule xmlModule = new JacksonXmlModule(); xmlModule.setDefaultUseWrapper(false); XmlMapper xmlMapper = new XmlMapper(xmlModule); xmlMapper.enable(ToXmlGenerator.Feature.WRITE_XML_DECLARATION); this.bind(XmlMapper.class).toInstance(xm...
java
{ "resource": "" }
q5039
Reader.read
train
public Swagger read(Set<Class<?>> classes) { Set<Class<?>> sortedClasses = new TreeSet<>((class1, class2) -> { if (class1.equals(class2)) { return 0; } else if (class1.isAssignableFrom(class2)) { return -1; } else if (class2.isAssignableFrom(cl...
java
{ "resource": "" }
q5040
Reader.read
train
public Swagger read(Class<?> cls) { SwaggerDefinition swaggerDefinition = cls.getAnnotation(SwaggerDefinition.class); if (swaggerDefinition != null) { readSwaggerConfig(cls, swaggerDefinition); } return read(cls, "", null, false, new String[0], new String[0], new LinkedHashM...
java
{ "resource": "" }
q5041
HandlerGenerator.generateRoutes
train
protected void generateRoutes() { try { // Optional<io.sinistral.proteus.annotations.Chain> typeLevelWrapAnnotation = Optional.ofNullable(controllerClass.getAnnotation(io.sinistral.proteus.annotations.Chain.class)); // // typeLevelWrapAnnotation.ifPresent( a -> { // // io.sinistral.proteus.a...
java
{ "resource": "" }
q5042
ProteusApplication.addDefaultRoutes
train
public ProteusApplication addDefaultRoutes(RoutingHandler router) { if (config.hasPath("health.statusPath")) { try { final String statusPath = config.getString("health.statusPath"); router.add(Methods.GET, statusPath, (final HttpServerExchange exchange) -> ...
java
{ "resource": "" }
q5043
ProteusApplication.setServerConfigurationFunction
train
public ProteusApplication setServerConfigurationFunction(Function<Undertow.Builder, Undertow.Builder> serverConfigurationFunction) { this.serverConfigurationFunction = serverConfigurationFunction; return this; }
java
{ "resource": "" }
q5044
Utils.getDisplayMetrics
train
static DisplayMetrics getDisplayMetrics(final Context context) { final WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); final DisplayMetrics metrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(metrics); return metric...
java
{ "resource": "" }
q5045
LiveBlurWorker.crop
train
private static Bitmap crop(Bitmap srcBmp, View canvasView, int downsampling) { float scale = 1f / downsampling; return Bitmap.createBitmap( srcBmp, (int) Math.floor((ViewCompat.getX(canvasView)) * scale), (int) Math.floor((ViewCompat.getY(canvasView)) * sc...
java
{ "resource": "" }
q5046
PerformanceProfiler.startTask
train
public void startTask(int id, String taskName) { if (isActivated) { durations.add(new Duration(id, taskName, BenchmarkUtil.elapsedRealTimeNanos())); } }
java
{ "resource": "" }
q5047
PerformanceProfiler.getDurationMs
train
public double getDurationMs() { double durationMs = 0; for (Duration duration : durations) { if (duration.taskFinished()) { durationMs += duration.getDurationMS(); } } return durationMs; }
java
{ "resource": "" }
q5048
LegacySDKUtil.setViewBackground
train
public static void setViewBackground(View v, Drawable d) { if (Build.VERSION.SDK_INT >= 16) { v.setBackground(d); } else { v.setBackgroundDrawable(d); } }
java
{ "resource": "" }
q5049
LegacySDKUtil.byteSizeOf
train
public static int byteSizeOf(Bitmap bitmap) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { return bitmap.getAllocationByteCount(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { return bitmap.getByteCount(); } else { ret...
java
{ "resource": "" }
q5050
LegacySDKUtil.getCacheDir
train
public static String getCacheDir(Context ctx) { return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || (!Environment.isExternalStorageRemovable() && ctx.getExternalCacheDir() != null) ? ctx.getExternalCacheDir().getPath() : ctx.getCacheDir().getPath(); }
java
{ "resource": "" }
q5051
ImageReference.measureImage
train
public Point measureImage(Resources resources) { BitmapFactory.Options justBoundsOptions = new BitmapFactory.Options(); justBoundsOptions.inJustDecodeBounds = true; if (bitmap != null) { return new Point(bitmap.getWidth(), bitmap.getHeight()); } else if (resId != null) { ...
java
{ "resource": "" }
q5052
ExecutorManager.cancelByTag
train
public synchronized int cancelByTag(String tagToCancel) { int i = 0; if (taskList.containsKey(tagToCancel)) { removeDoneTasks(); for (Future<BlurWorker.Result> future : taskList.get(tagToCancel)) { BuilderUtil.logVerbose(Dali.getConfig().logTag, "Canceling task w...
java
{ "resource": "" }
q5053
BitmapUtil.flip
train
public static Bitmap flip(Bitmap src) { Matrix m = new Matrix(); m.preScale(-1, 1); return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), m, false); }
java
{ "resource": "" }
q5054
TwoLevelCache.purge
train
public void purge(String cacheKey) { try { if (useMemoryCache) { if (memoryCache != null) { memoryCache.remove(cacheKey); } } if (useDiskCache) { if (diskLruCache != null) { diskLruCache....
java
{ "resource": "" }
q5055
ContextWrapper.getRenderScript
train
public RenderScript getRenderScript() { if (renderScript == null) { renderScript = RenderScript.create(context, renderScriptContextType); } return renderScript; }
java
{ "resource": "" }
q5056
DaliBlurDrawerToggle.renderBlurLayer
train
private void renderBlurLayer(float slideOffset) { if (enableBlur) { if (slideOffset == 0 || forceRedraw) { clearBlurView(); } if (slideOffset > 0f && blurView == null) { if (drawerLayout.getChildCount() == 2) { blurView = n...
java
{ "resource": "" }
q5057
DaliBlurDrawerToggle.onDrawerOpened
train
public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); if (listener != null) listener.onDrawerClosed(drawerView); }
java
{ "resource": "" }
q5058
BuilderUtil.getIBlurAlgorithm
train
public static IBlur getIBlurAlgorithm(EBlurAlgorithm algorithm, ContextWrapper contextWrapper) { RenderScript rs = contextWrapper.getRenderScript(); Context ctx = contextWrapper.getContext(); switch (algorithm) { case RS_GAUSS_FAST: return new RenderScriptGaussianBlu...
java
{ "resource": "" }
q5059
BlurBuilder.downScale
train
public BlurBuilder downScale(int scaleInSample) { data.options.inSampleSize = Math.min(Math.max(1, scaleInSample), 16384); return this; }
java
{ "resource": "" }
q5060
BlurBuilder.brightness
train
public BlurBuilder brightness(float brightness) { data.preProcessors.add(new RenderscriptBrightnessProcessor(data.contextWrapper.getRenderScript(), brightness, data.contextWrapper.getResources())); return this; }
java
{ "resource": "" }
q5061
BlurBuilder.contrast
train
public BlurBuilder contrast(float contrast) { data.preProcessors.add(new ContrastProcessor(data.contextWrapper.getRenderScript(), Math.max(Math.min(1500.f, contrast), -1500.f))); return this; }
java
{ "resource": "" }
q5062
Dali.resetAndSetNewConfig
train
public static synchronized void resetAndSetNewConfig(Context ctx, Config config) { GLOBAL_CONFIG = config; if (DISK_CACHE_MANAGER != null) { DISK_CACHE_MANAGER.clear(); DISK_CACHE_MANAGER = null; createCache(ctx); } if (EXECUTOR_MANAGER != null) { ...
java
{ "resource": "" }
q5063
IbanUtil.getIbanLength
train
public static int getIbanLength(final CountryCode countryCode) { final BbanStructure structure = getBbanStructure(countryCode); return COUNTRY_CODE_LENGTH + CHECK_DIGIT_LENGTH + structure.getBbanLength(); }
java
{ "resource": "" }
q5064
IbanUtil.getCountryCodeAndCheckDigit
train
public static String getCountryCodeAndCheckDigit(final String iban) { return iban.substring(COUNTRY_CODE_INDEX, COUNTRY_CODE_INDEX + COUNTRY_CODE_LENGTH + CHECK_DIGIT_LENGTH); }
java
{ "resource": "" }
q5065
IbanUtil.replaceCheckDigit
train
static String replaceCheckDigit(final String iban, final String checkDigit) { return getCountryCode(iban) + checkDigit + getBban(iban); }
java
{ "resource": "" }
q5066
IbanUtil.toFormattedString
train
static String toFormattedString(final String iban) { final StringBuilder ibanBuffer = new StringBuilder(iban); final int length = ibanBuffer.length(); for (int i = 0; i < length / 4; i++) { ibanBuffer.insert((i + 1) * 4 + i, ' '); } return ibanBuffer.toString().trim...
java
{ "resource": "" }
q5067
Bic.valueOf
train
public static Bic valueOf(final String bic) throws BicFormatException, UnsupportedCountryException { BicUtil.validate(bic); return new Bic(bic); }
java
{ "resource": "" }
q5068
BicUtil.validate
train
public static void validate(final String bic) throws BicFormatException, UnsupportedCountryException { try { validateEmpty(bic); validateLength(bic); validateCase(bic); validateBankCode(bic); validateCountryCode(bic); validateLo...
java
{ "resource": "" }
q5069
PhantomJSDriver.getScreenshotAs
train
@Override public <X> X getScreenshotAs(OutputType<X> target) { // Get the screenshot as base64 and convert it to the requested type (i.e. OutputType<T>) String base64 = (String) execute(DriverCommand.SCREENSHOT).getValue(); return target.convertFromBase64Png(base64); }
java
{ "resource": "" }
q5070
PayloadBuilder.sound
train
public PayloadBuilder sound(final String sound) { if (sound != null) { aps.put("sound", sound); } else { aps.remove("sound"); } return this; }
java
{ "resource": "" }
q5071
PayloadBuilder.category
train
public PayloadBuilder category(final String category) { if (category != null) { aps.put("category", category); } else { aps.remove("category"); } return this; }
java
{ "resource": "" }
q5072
PayloadBuilder.customField
train
public PayloadBuilder customField(final String key, final Object value) { root.put(key, value); return this; }
java
{ "resource": "" }
q5073
PayloadBuilder.resizeAlertBody
train
public PayloadBuilder resizeAlertBody(final int payloadLength, final String postfix) { int currLength = length(); if (currLength <= payloadLength) { return this; } // now we are sure that truncation is required String body = (String)customAlert.get("body"); ...
java
{ "resource": "" }
q5074
PayloadBuilder.build
train
public String build() { if (!root.containsKey("mdm")) { insertCustomAlert(); root.put("aps", aps); } try { return mapper.writeValueAsString(root); } catch (final Exception e) { throw new RuntimeException(e); } }
java
{ "resource": "" }
q5075
ApnsServiceBuilder.withSocksProxy
train
public ApnsServiceBuilder withSocksProxy(String host, int port) { Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(host, port)); return withProxy(proxy); }
java
{ "resource": "" }
q5076
ApnsServiceBuilder.withAuthProxy
train
public ApnsServiceBuilder withAuthProxy(Proxy proxy, String proxyUsername, String proxyPassword) { this.proxy = proxy; this.proxyUsername = proxyUsername; this.proxyPassword = proxyPassword; return this; }
java
{ "resource": "" }
q5077
ApnsServiceBuilder.withProxySocket
train
@Deprecated public ApnsServiceBuilder withProxySocket(Socket proxySocket) { return this.withProxy(new Proxy(Proxy.Type.SOCKS, proxySocket.getRemoteSocketAddress())); }
java
{ "resource": "" }
q5078
ApnsServiceBuilder.withDelegate
train
public ApnsServiceBuilder withDelegate(ApnsDelegate delegate) { this.delegate = delegate == null ? ApnsDelegate.EMPTY : delegate; return this; }
java
{ "resource": "" }
q5079
SimpleApnsNotification.length
train
public int length() { int length = 1 + 2 + deviceToken.length + 2 + payload.length; final int marshalledLength = marshall().length; assert marshalledLength == length; return length; }
java
{ "resource": "" }
q5080
MultiPageStack.setPadding
train
public void setPadding(float padding, Layout.Axis axis) { OrientedLayout layout = null; switch(axis) { case X: layout = mShiftLayout; break; case Y: layout = mShiftLayout; break; case Z: l...
java
{ "resource": "" }
q5081
MultiPageStack.setShiftOrientation
train
public void setShiftOrientation(OrientedLayout.Orientation orientation) { if (mShiftLayout.getOrientation() != orientation && orientation != OrientedLayout.Orientation.STACK) { mShiftLayout.setOrientation(orientation); requestLayout(); } }
java
{ "resource": "" }
q5082
TouchManager.removeHandlerFor
train
public boolean removeHandlerFor(final GVRSceneObject sceneObject) { sceneObject.detachComponent(GVRCollider.getComponentType()); return null != touchHandlers.remove(sceneObject); }
java
{ "resource": "" }
q5083
TouchManager.makePickable
train
public void makePickable(GVRSceneObject sceneObject) { try { GVRMeshCollider collider = new GVRMeshCollider(sceneObject.getGVRContext(), false); sceneObject.attachComponent(collider); } catch (Exception e) { // Possible that some objects (X3D panel nodes) are without ...
java
{ "resource": "" }
q5084
GearWearableUtility.isInCircle
train
static boolean isInCircle(float x, float y, float centerX, float centerY, float radius) { return Math.abs(x - centerX) < radius && Math.abs(y - centerY) < radius; }
java
{ "resource": "" }
q5085
GVRRotationKey.setValue
train
public void setValue(Quaternionf rot) { mX = rot.x; mY = rot.y; mZ = rot.z; mW = rot.w; }
java
{ "resource": "" }
q5086
GVRFloatImage.update
train
public void update(int width, int height, float[] data) throws IllegalArgumentException { if ((width <= 0) || (height <= 0) || (data == null) || (data.length < height * width * mFloatsPerPixel)) { throw new IllegalArgumentException(); } NativeFloat...
java
{ "resource": "" }
q5087
ImageTexture.getUrl
train
public String[] getUrl() { String[] valueDestination = new String[ url.size() ]; this.url.getValue(valueDestination); return valueDestination; }
java
{ "resource": "" }
q5088
ArchLayout.getSizeArcLength
train
protected float getSizeArcLength(float angle) { if (mRadius <= 0) { throw new IllegalArgumentException("mRadius is not specified!"); } return angle == Float.MAX_VALUE ? Float.MAX_VALUE : LayoutHelpers.lengthOfArc(angle, mRadius); }
java
{ "resource": "" }
q5089
GVRConsole.writeLine
train
public void writeLine(String pattern, Object... parameters) { String line = (parameters == null || parameters.length == 0) ? pattern : String.format(pattern, parameters); lines.add(0, line); // we'll write bottom to top, then purge unwritten // lines from end updateHUD();...
java
{ "resource": "" }
q5090
GVRConsole.setCanvasWidthHeight
train
public void setCanvasWidthHeight(int width, int height) { hudWidth = width; hudHeight = height; HUD = Bitmap.createBitmap(width, height, Config.ARGB_8888); canvas = new Canvas(HUD); texture = null; }
java
{ "resource": "" }
q5091
MeshUtils.scale
train
public static void scale(GVRMesh mesh, float x, float y, float z) { final float [] vertices = mesh.getVertices(); final int vsize = vertices.length; for (int i = 0; i < vsize; i += 3) { vertices[i] *= x; vertices[i + 1] *= y; vertices[i + 2] *= z; ...
java
{ "resource": "" }
q5092
MeshUtils.resize
train
public static void resize(GVRMesh mesh, float xsize, float ysize, float zsize) { float dim[] = getBoundingSize(mesh); scale(mesh, xsize / dim[0], ysize / dim[1], zsize / dim[2]); }
java
{ "resource": "" }
q5093
MeshUtils.resize
train
public static void resize(GVRMesh mesh, float size) { float dim[] = getBoundingSize(mesh); float maxsize = 0.0f; if (dim[0] > maxsize) maxsize = dim[0]; if (dim[1] > maxsize) maxsize = dim[1]; if (dim[2] > maxsize) maxsize = dim[2]; scale(mesh, size / maxsize); }
java
{ "resource": "" }
q5094
MeshUtils.getBoundingSize
train
public static float[] getBoundingSize(GVRMesh mesh) { final float [] dim = new float[3]; final float [] vertices = mesh.getVertices(); final int vsize = vertices.length; float minx = Integer.MAX_VALUE; float miny = Integer.MAX_VALUE; float minz = Integer.MAX_VALUE; ...
java
{ "resource": "" }
q5095
MeshUtils.createQuad
train
public static GVRMesh createQuad(GVRContext gvrContext, float width, float height) { GVRMesh mesh = new GVRMesh(gvrContext); float[] vertices = { width * -0.5f, height * 0.5f, 0.0f, width * -0.5f, height * -0.5f, 0.0f, width * 0.5f, height * 0.5f, 0.0f, width * 0.5f, hei...
java
{ "resource": "" }
q5096
OvrViewManager.onSurfaceChanged
train
void onSurfaceChanged(int width, int height) { Log.v(TAG, "onSurfaceChanged"); final VrAppSettings.EyeBufferParams.DepthFormat depthFormat = mApplication.getAppSettings().getEyeBufferParams().getDepthFormat(); mApplication.getConfigurationManager().configureRendering(VrAppSettings.EyeBufferPara...
java
{ "resource": "" }
q5097
OvrViewManager.onDrawEye
train
void onDrawEye(int eye, int swapChainIndex, boolean use_multiview) { mCurrentEye = eye; if (!(mSensoredScene == null || !mMainScene.equals(mSensoredScene))) { GVRCameraRig mainCameraRig = mMainScene.getMainCameraRig(); if (use_multiview) { if (DEBUG_STATS) { ...
java
{ "resource": "" }
q5098
GVRResourceVolume.openResource
train
public GVRAndroidResource openResource(String filePath) throws IOException { // Error tolerance: Remove initial '/' introduced by file::///filename // In this case, the path is interpreted as relative to defaultPath, // which is the root of the filesystem. if (filePath.startsWith(File.se...
java
{ "resource": "" }
q5099
GVRResourceVolume.adaptFilePath
train
protected String adaptFilePath(String filePath) { // Convert windows file path to target FS String targetPath = filePath.replaceAll("\\\\", volumeType.getSeparator()); return targetPath; }
java
{ "resource": "" }