id
int32
0
165k
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
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
161,700
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/Utility.java
Utility.parseMFString
public String[] parseMFString(String mfString) { Vector<String> strings = new Vector<String>(); StringReader sr = new StringReader(mfString); StreamTokenizer st = new StreamTokenizer(sr); st.quoteChar('"'); st.quoteChar('\''); String[] mfStrings = null; int tokenType; try { while ((tokenType = st.nextToken()) != StreamTokenizer.TT_EOF) { strings.add(st.sval); } } catch (IOException e) { Log.d(TAG, "String parsing Error: " + e); e.printStackTrace(); } mfStrings = new String[strings.size()]; for (int i = 0; i < strings.size(); i++) { mfStrings[i] = strings.get(i); } return mfStrings; }
java
public String[] parseMFString(String mfString) { Vector<String> strings = new Vector<String>(); StringReader sr = new StringReader(mfString); StreamTokenizer st = new StreamTokenizer(sr); st.quoteChar('"'); st.quoteChar('\''); String[] mfStrings = null; int tokenType; try { while ((tokenType = st.nextToken()) != StreamTokenizer.TT_EOF) { strings.add(st.sval); } } catch (IOException e) { Log.d(TAG, "String parsing Error: " + e); e.printStackTrace(); } mfStrings = new String[strings.size()]; for (int i = 0; i < strings.size(); i++) { mfStrings[i] = strings.get(i); } return mfStrings; }
[ "public", "String", "[", "]", "parseMFString", "(", "String", "mfString", ")", "{", "Vector", "<", "String", ">", "strings", "=", "new", "Vector", "<", "String", ">", "(", ")", ";", "StringReader", "sr", "=", "new", "StringReader", "(", "mfString", ")", ";", "StreamTokenizer", "st", "=", "new", "StreamTokenizer", "(", "sr", ")", ";", "st", ".", "quoteChar", "(", "'", "'", ")", ";", "st", ".", "quoteChar", "(", "'", "'", ")", ";", "String", "[", "]", "mfStrings", "=", "null", ";", "int", "tokenType", ";", "try", "{", "while", "(", "(", "tokenType", "=", "st", ".", "nextToken", "(", ")", ")", "!=", "StreamTokenizer", ".", "TT_EOF", ")", "{", "strings", ".", "add", "(", "st", ".", "sval", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "Log", ".", "d", "(", "TAG", ",", "\"String parsing Error: \"", "+", "e", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "mfStrings", "=", "new", "String", "[", "strings", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strings", ".", "size", "(", ")", ";", "i", "++", ")", "{", "mfStrings", "[", "i", "]", "=", "strings", ".", "get", "(", "i", ")", ";", "}", "return", "mfStrings", ";", "}" ]
multi-field string
[ "multi", "-", "field", "string" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/Utility.java#L195-L222
161,701
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncBitmapTexture.java
AsyncBitmapTexture.getScreenSize
private static Point getScreenSize(Context context, Point p) { if (p == null) { p = new Point(); } WindowManager windowManager = (WindowManager) context .getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); display.getSize(p); return p; }
java
private static Point getScreenSize(Context context, Point p) { if (p == null) { p = new Point(); } WindowManager windowManager = (WindowManager) context .getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); display.getSize(p); return p; }
[ "private", "static", "Point", "getScreenSize", "(", "Context", "context", ",", "Point", "p", ")", "{", "if", "(", "p", "==", "null", ")", "{", "p", "=", "new", "Point", "(", ")", ";", "}", "WindowManager", "windowManager", "=", "(", "WindowManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "WINDOW_SERVICE", ")", ";", "Display", "display", "=", "windowManager", ".", "getDefaultDisplay", "(", ")", ";", "display", ".", "getSize", "(", "p", ")", ";", "return", "p", ";", "}" ]
Returns screen height and width @param context Any non-null Android Context @param p Optional Point to reuse. If null, a new Point will be created. @return .x is screen width; .y is screen height.
[ "Returns", "screen", "height", "and", "width" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncBitmapTexture.java#L229-L238
161,702
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMatrix4f.java
AiMatrix4f.get
public float get(int row, int col) { if (row < 0 || row > 3) { throw new IndexOutOfBoundsException("Index: " + row + ", Size: 4"); } if (col < 0 || col > 3) { throw new IndexOutOfBoundsException("Index: " + col + ", Size: 4"); } return m_data[row * 4 + col]; }
java
public float get(int row, int col) { if (row < 0 || row > 3) { throw new IndexOutOfBoundsException("Index: " + row + ", Size: 4"); } if (col < 0 || col > 3) { throw new IndexOutOfBoundsException("Index: " + col + ", Size: 4"); } return m_data[row * 4 + col]; }
[ "public", "float", "get", "(", "int", "row", ",", "int", "col", ")", "{", "if", "(", "row", "<", "0", "||", "row", ">", "3", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Index: \"", "+", "row", "+", "\", Size: 4\"", ")", ";", "}", "if", "(", "col", "<", "0", "||", "col", ">", "3", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Index: \"", "+", "col", "+", "\", Size: 4\"", ")", ";", "}", "return", "m_data", "[", "row", "*", "4", "+", "col", "]", ";", "}" ]
Gets an element of the matrix. @param row the row @param col the column @return the element at the given position
[ "Gets", "an", "element", "of", "the", "matrix", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMatrix4f.java#L81-L90
161,703
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java
GVRPeriodicEngine.runAfter
public PeriodicEvent runAfter(Runnable task, float delay) { validateDelay(delay); return new Event(task, delay); }
java
public PeriodicEvent runAfter(Runnable task, float delay) { validateDelay(delay); return new Event(task, delay); }
[ "public", "PeriodicEvent", "runAfter", "(", "Runnable", "task", ",", "float", "delay", ")", "{", "validateDelay", "(", "delay", ")", ";", "return", "new", "Event", "(", "task", ",", "delay", ")", ";", "}" ]
Run a task once, after a delay. @param task Task to run. @param delay Unit is seconds. @return An interface that lets you query the status; cancel; or reschedule the event.
[ "Run", "a", "task", "once", "after", "a", "delay", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java#L120-L123
161,704
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java
GVRPeriodicEngine.runEvery
public PeriodicEvent runEvery(Runnable task, float delay, float period) { return runEvery(task, delay, period, null); }
java
public PeriodicEvent runEvery(Runnable task, float delay, float period) { return runEvery(task, delay, period, null); }
[ "public", "PeriodicEvent", "runEvery", "(", "Runnable", "task", ",", "float", "delay", ",", "float", "period", ")", "{", "return", "runEvery", "(", "task", ",", "delay", ",", "period", ",", "null", ")", ";", "}" ]
Run a task periodically and indefinitely. @param task Task to run. @param delay The first execution will happen in {@code delay} seconds. @param period Subsequent executions will happen every {@code period} seconds after the first. @return An interface that lets you query the status; cancel; or reschedule the event.
[ "Run", "a", "task", "periodically", "and", "indefinitely", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java#L138-L140
161,705
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java
GVRPeriodicEngine.runEvery
public PeriodicEvent runEvery(Runnable task, float delay, float period, int repetitions) { if (repetitions < 1) { return null; } else if (repetitions == 1) { // Better to burn a handful of CPU cycles than to churn memory by // creating a new callback return runAfter(task, delay); } else { return runEvery(task, delay, period, new RunFor(repetitions)); } }
java
public PeriodicEvent runEvery(Runnable task, float delay, float period, int repetitions) { if (repetitions < 1) { return null; } else if (repetitions == 1) { // Better to burn a handful of CPU cycles than to churn memory by // creating a new callback return runAfter(task, delay); } else { return runEvery(task, delay, period, new RunFor(repetitions)); } }
[ "public", "PeriodicEvent", "runEvery", "(", "Runnable", "task", ",", "float", "delay", ",", "float", "period", ",", "int", "repetitions", ")", "{", "if", "(", "repetitions", "<", "1", ")", "{", "return", "null", ";", "}", "else", "if", "(", "repetitions", "==", "1", ")", "{", "// Better to burn a handful of CPU cycles than to churn memory by", "// creating a new callback", "return", "runAfter", "(", "task", ",", "delay", ")", ";", "}", "else", "{", "return", "runEvery", "(", "task", ",", "delay", ",", "period", ",", "new", "RunFor", "(", "repetitions", ")", ")", ";", "}", "}" ]
Run a task periodically, for a set number of times. @param task Task to run. @param delay The first execution will happen in {@code delay} seconds. @param period Subsequent executions will happen every {@code period} seconds after the first. @param repetitions Repeat count @return {@code null} if {@code repetitions < 1}; otherwise, an interface that lets you query the status; cancel; or reschedule the event.
[ "Run", "a", "task", "periodically", "for", "a", "set", "number", "of", "times", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java#L157-L168
161,706
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java
GVRPeriodicEngine.runEvery
public PeriodicEvent runEvery(Runnable task, float delay, float period, KeepRunning callback) { validateDelay(delay); validatePeriod(period); return new Event(task, delay, period, callback); }
java
public PeriodicEvent runEvery(Runnable task, float delay, float period, KeepRunning callback) { validateDelay(delay); validatePeriod(period); return new Event(task, delay, period, callback); }
[ "public", "PeriodicEvent", "runEvery", "(", "Runnable", "task", ",", "float", "delay", ",", "float", "period", ",", "KeepRunning", "callback", ")", "{", "validateDelay", "(", "delay", ")", ";", "validatePeriod", "(", "period", ")", ";", "return", "new", "Event", "(", "task", ",", "delay", ",", "period", ",", "callback", ")", ";", "}" ]
Run a task periodically, with a callback. @param task Task to run. @param delay The first execution will happen in {@code delay} seconds. @param period Subsequent executions will happen every {@code period} seconds after the first. @param callback Callback that lets you cancel the task. {@code null} means run indefinitely. @return An interface that lets you query the status; cancel; or reschedule the event.
[ "Run", "a", "task", "periodically", "with", "a", "callback", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java#L186-L191
161,707
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiScene.java
AiScene.getSceneRoot
@SuppressWarnings("unchecked") public <V3, M4, C, N, Q> N getSceneRoot(AiWrapperProvider<V3, M4, C, N, Q> wrapperProvider) { return (N) m_sceneRoot; }
java
@SuppressWarnings("unchecked") public <V3, M4, C, N, Q> N getSceneRoot(AiWrapperProvider<V3, M4, C, N, Q> wrapperProvider) { return (N) m_sceneRoot; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "V3", ",", "M4", ",", "C", ",", "N", ",", "Q", ">", "N", "getSceneRoot", "(", "AiWrapperProvider", "<", "V3", ",", "M4", ",", "C", ",", "N", ",", "Q", ">", "wrapperProvider", ")", "{", "return", "(", "N", ")", "m_sceneRoot", ";", "}" ]
Returns the scene graph root. This method is part of the wrapped API (see {@link AiWrapperProvider} for details on wrappers).<p> The built-in behavior is to return a {@link AiVector}. @param wrapperProvider the wrapper provider (used for type inference) @return the scene graph root
[ "Returns", "the", "scene", "graph", "root", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiScene.java#L227-L232
161,708
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.enableClipRegion
public void enableClipRegion() { if (mClippingEnabled) { Log.w(TAG, "Clipping has been enabled already for %s!", getName()); return; } Log.d(Log.SUBSYSTEM.WIDGET, TAG, "enableClipping for %s [%f, %f, %f]", getName(), getViewPortWidth(), getViewPortHeight(), getViewPortDepth()); mClippingEnabled = true; GVRTexture texture = WidgetLib.getTextureHelper().getSolidColorTexture(Color.YELLOW); GVRSceneObject clippingObj = new GVRSceneObject(mContext, getViewPortWidth(), getViewPortHeight(), texture); clippingObj.setName("clippingObj"); clippingObj.getRenderData() .setRenderingOrder(GVRRenderData.GVRRenderingOrder.STENCIL) .setStencilTest(true) .setStencilFunc(GLES30.GL_ALWAYS, 1, 0xFF) .setStencilOp(GLES30.GL_KEEP, GLES30.GL_KEEP, GLES30.GL_REPLACE) .setStencilMask(0xFF); mSceneObject.addChildObject(clippingObj); for (Widget child : getChildren()) { setObjectClipped(child); } }
java
public void enableClipRegion() { if (mClippingEnabled) { Log.w(TAG, "Clipping has been enabled already for %s!", getName()); return; } Log.d(Log.SUBSYSTEM.WIDGET, TAG, "enableClipping for %s [%f, %f, %f]", getName(), getViewPortWidth(), getViewPortHeight(), getViewPortDepth()); mClippingEnabled = true; GVRTexture texture = WidgetLib.getTextureHelper().getSolidColorTexture(Color.YELLOW); GVRSceneObject clippingObj = new GVRSceneObject(mContext, getViewPortWidth(), getViewPortHeight(), texture); clippingObj.setName("clippingObj"); clippingObj.getRenderData() .setRenderingOrder(GVRRenderData.GVRRenderingOrder.STENCIL) .setStencilTest(true) .setStencilFunc(GLES30.GL_ALWAYS, 1, 0xFF) .setStencilOp(GLES30.GL_KEEP, GLES30.GL_KEEP, GLES30.GL_REPLACE) .setStencilMask(0xFF); mSceneObject.addChildObject(clippingObj); for (Widget child : getChildren()) { setObjectClipped(child); } }
[ "public", "void", "enableClipRegion", "(", ")", "{", "if", "(", "mClippingEnabled", ")", "{", "Log", ".", "w", "(", "TAG", ",", "\"Clipping has been enabled already for %s!\"", ",", "getName", "(", ")", ")", ";", "return", ";", "}", "Log", ".", "d", "(", "Log", ".", "SUBSYSTEM", ".", "WIDGET", ",", "TAG", ",", "\"enableClipping for %s [%f, %f, %f]\"", ",", "getName", "(", ")", ",", "getViewPortWidth", "(", ")", ",", "getViewPortHeight", "(", ")", ",", "getViewPortDepth", "(", ")", ")", ";", "mClippingEnabled", "=", "true", ";", "GVRTexture", "texture", "=", "WidgetLib", ".", "getTextureHelper", "(", ")", ".", "getSolidColorTexture", "(", "Color", ".", "YELLOW", ")", ";", "GVRSceneObject", "clippingObj", "=", "new", "GVRSceneObject", "(", "mContext", ",", "getViewPortWidth", "(", ")", ",", "getViewPortHeight", "(", ")", ",", "texture", ")", ";", "clippingObj", ".", "setName", "(", "\"clippingObj\"", ")", ";", "clippingObj", ".", "getRenderData", "(", ")", ".", "setRenderingOrder", "(", "GVRRenderData", ".", "GVRRenderingOrder", ".", "STENCIL", ")", ".", "setStencilTest", "(", "true", ")", ".", "setStencilFunc", "(", "GLES30", ".", "GL_ALWAYS", ",", "1", ",", "0xFF", ")", ".", "setStencilOp", "(", "GLES30", ".", "GL_KEEP", ",", "GLES30", ".", "GL_KEEP", ",", "GLES30", ".", "GL_REPLACE", ")", ".", "setStencilMask", "(", "0xFF", ")", ";", "mSceneObject", ".", "addChildObject", "(", "clippingObj", ")", ";", "for", "(", "Widget", "child", ":", "getChildren", "(", ")", ")", "{", "setObjectClipped", "(", "child", ")", ";", "}", "}" ]
Enable clipping for the Widget. Widget content including its children will be clipped by a rectangular View Port. By default clipping is disabled.
[ "Enable", "clipping", "for", "the", "Widget", ".", "Widget", "content", "including", "its", "children", "will", "be", "clipped", "by", "a", "rectangular", "View", "Port", ".", "By", "default", "clipping", "is", "disabled", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L884-L910
161,709
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.getLayoutSize
public float getLayoutSize(final Layout.Axis axis) { float size = 0; for (Layout layout : mLayouts) { size = Math.max(size, layout.getSize(axis)); } Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "getLayoutSize [%s] axis [%s] size [%f]", getName(), axis, size); return size; }
java
public float getLayoutSize(final Layout.Axis axis) { float size = 0; for (Layout layout : mLayouts) { size = Math.max(size, layout.getSize(axis)); } Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "getLayoutSize [%s] axis [%s] size [%f]", getName(), axis, size); return size; }
[ "public", "float", "getLayoutSize", "(", "final", "Layout", ".", "Axis", "axis", ")", "{", "float", "size", "=", "0", ";", "for", "(", "Layout", "layout", ":", "mLayouts", ")", "{", "size", "=", "Math", ".", "max", "(", "size", ",", "layout", ".", "getSize", "(", "axis", ")", ")", ";", "}", "Log", ".", "d", "(", "Log", ".", "SUBSYSTEM", ".", "LAYOUT", ",", "TAG", ",", "\"getLayoutSize [%s] axis [%s] size [%f]\"", ",", "getName", "(", ")", ",", "axis", ",", "size", ")", ";", "return", "size", ";", "}" ]
Gets Widget layout dimension @param axis The {@linkplain Layout.Axis axis} to obtain layout size for @return dimension
[ "Gets", "Widget", "layout", "dimension" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L992-L999
161,710
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.getBoundsWidth
public float getBoundsWidth() { if (mSceneObject != null) { GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume(); return v.maxCorner.x - v.minCorner.x; } return 0f; }
java
public float getBoundsWidth() { if (mSceneObject != null) { GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume(); return v.maxCorner.x - v.minCorner.x; } return 0f; }
[ "public", "float", "getBoundsWidth", "(", ")", "{", "if", "(", "mSceneObject", "!=", "null", ")", "{", "GVRSceneObject", ".", "BoundingVolume", "v", "=", "mSceneObject", ".", "getBoundingVolume", "(", ")", ";", "return", "v", ".", "maxCorner", ".", "x", "-", "v", ".", "minCorner", ".", "x", ";", "}", "return", "0f", ";", "}" ]
Gets Widget bounds width @return width
[ "Gets", "Widget", "bounds", "width" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1035-L1041
161,711
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.getBoundsHeight
public float getBoundsHeight(){ if (mSceneObject != null) { GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume(); return v.maxCorner.y - v.minCorner.y; } return 0f; }
java
public float getBoundsHeight(){ if (mSceneObject != null) { GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume(); return v.maxCorner.y - v.minCorner.y; } return 0f; }
[ "public", "float", "getBoundsHeight", "(", ")", "{", "if", "(", "mSceneObject", "!=", "null", ")", "{", "GVRSceneObject", ".", "BoundingVolume", "v", "=", "mSceneObject", ".", "getBoundingVolume", "(", ")", ";", "return", "v", ".", "maxCorner", ".", "y", "-", "v", ".", "minCorner", ".", "y", ";", "}", "return", "0f", ";", "}" ]
Gets Widget bounds height @return height
[ "Gets", "Widget", "bounds", "height" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1047-L1053
161,712
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.getBoundsDepth
public float getBoundsDepth() { if (mSceneObject != null) { GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume(); return v.maxCorner.z - v.minCorner.z; } return 0f; }
java
public float getBoundsDepth() { if (mSceneObject != null) { GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume(); return v.maxCorner.z - v.minCorner.z; } return 0f; }
[ "public", "float", "getBoundsDepth", "(", ")", "{", "if", "(", "mSceneObject", "!=", "null", ")", "{", "GVRSceneObject", ".", "BoundingVolume", "v", "=", "mSceneObject", ".", "getBoundingVolume", "(", ")", ";", "return", "v", ".", "maxCorner", ".", "z", "-", "v", ".", "minCorner", ".", "z", ";", "}", "return", "0f", ";", "}" ]
Gets Widget bounds depth @return depth
[ "Gets", "Widget", "bounds", "depth" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1059-L1065
161,713
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.rotateWithPivot
public void rotateWithPivot(float w, float x, float y, float z, float pivotX, float pivotY, float pivotZ) { getTransform().rotateWithPivot(w, x, y, z, pivotX, pivotY, pivotZ); if (mTransformCache.rotateWithPivot(w, x, y, z, pivotX, pivotY, pivotZ)) { onTransformChanged(); } }
java
public void rotateWithPivot(float w, float x, float y, float z, float pivotX, float pivotY, float pivotZ) { getTransform().rotateWithPivot(w, x, y, z, pivotX, pivotY, pivotZ); if (mTransformCache.rotateWithPivot(w, x, y, z, pivotX, pivotY, pivotZ)) { onTransformChanged(); } }
[ "public", "void", "rotateWithPivot", "(", "float", "w", ",", "float", "x", ",", "float", "y", ",", "float", "z", ",", "float", "pivotX", ",", "float", "pivotY", ",", "float", "pivotZ", ")", "{", "getTransform", "(", ")", ".", "rotateWithPivot", "(", "w", ",", "x", ",", "y", ",", "z", ",", "pivotX", ",", "pivotY", ",", "pivotZ", ")", ";", "if", "(", "mTransformCache", ".", "rotateWithPivot", "(", "w", ",", "x", ",", "y", ",", "z", ",", "pivotX", ",", "pivotY", ",", "pivotZ", ")", ")", "{", "onTransformChanged", "(", ")", ";", "}", "}" ]
Modify the tranform's current rotation in quaternion terms, around a pivot other than the origin. @param w 'W' component of the quaternion. @param x 'X' component of the quaternion. @param y 'Y' component of the quaternion. @param z 'Z' component of the quaternion. @param pivotX 'X' component of the pivot's location. @param pivotY 'Y' component of the pivot's location. @param pivotZ 'Z' component of the pivot's location.
[ "Modify", "the", "tranform", "s", "current", "rotation", "in", "quaternion", "terms", "around", "a", "pivot", "other", "than", "the", "origin", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1618-L1624
161,714
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.setVisibility
public boolean setVisibility(final Visibility visibility) { if (visibility != mVisibility) { Log.d(Log.SUBSYSTEM.WIDGET, TAG, "setVisibility(%s) for %s", visibility, getName()); updateVisibility(visibility); mVisibility = visibility; return true; } return false; }
java
public boolean setVisibility(final Visibility visibility) { if (visibility != mVisibility) { Log.d(Log.SUBSYSTEM.WIDGET, TAG, "setVisibility(%s) for %s", visibility, getName()); updateVisibility(visibility); mVisibility = visibility; return true; } return false; }
[ "public", "boolean", "setVisibility", "(", "final", "Visibility", "visibility", ")", "{", "if", "(", "visibility", "!=", "mVisibility", ")", "{", "Log", ".", "d", "(", "Log", ".", "SUBSYSTEM", ".", "WIDGET", ",", "TAG", ",", "\"setVisibility(%s) for %s\"", ",", "visibility", ",", "getName", "(", ")", ")", ";", "updateVisibility", "(", "visibility", ")", ";", "mVisibility", "=", "visibility", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Set the visibility of the object. @see Visibility @param visibility The visibility of the object. @return {@code true} if the visibility was changed, {@code false} if it wasn't.
[ "Set", "the", "visibility", "of", "the", "object", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1768-L1776
161,715
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.setViewPortVisibility
public boolean setViewPortVisibility(final ViewPortVisibility viewportVisibility) { boolean visibilityIsChanged = viewportVisibility != mIsVisibleInViewPort; if (visibilityIsChanged) { Visibility visibility = mVisibility; switch(viewportVisibility) { case FULLY_VISIBLE: case PARTIALLY_VISIBLE: break; case INVISIBLE: visibility = Visibility.HIDDEN; break; } mIsVisibleInViewPort = viewportVisibility; updateVisibility(visibility); } return visibilityIsChanged; }
java
public boolean setViewPortVisibility(final ViewPortVisibility viewportVisibility) { boolean visibilityIsChanged = viewportVisibility != mIsVisibleInViewPort; if (visibilityIsChanged) { Visibility visibility = mVisibility; switch(viewportVisibility) { case FULLY_VISIBLE: case PARTIALLY_VISIBLE: break; case INVISIBLE: visibility = Visibility.HIDDEN; break; } mIsVisibleInViewPort = viewportVisibility; updateVisibility(visibility); } return visibilityIsChanged; }
[ "public", "boolean", "setViewPortVisibility", "(", "final", "ViewPortVisibility", "viewportVisibility", ")", "{", "boolean", "visibilityIsChanged", "=", "viewportVisibility", "!=", "mIsVisibleInViewPort", ";", "if", "(", "visibilityIsChanged", ")", "{", "Visibility", "visibility", "=", "mVisibility", ";", "switch", "(", "viewportVisibility", ")", "{", "case", "FULLY_VISIBLE", ":", "case", "PARTIALLY_VISIBLE", ":", "break", ";", "case", "INVISIBLE", ":", "visibility", "=", "Visibility", ".", "HIDDEN", ";", "break", ";", "}", "mIsVisibleInViewPort", "=", "viewportVisibility", ";", "updateVisibility", "(", "visibility", ")", ";", "}", "return", "visibilityIsChanged", ";", "}" ]
Set ViewPort visibility of the object. @see ViewPortVisibility @param viewportVisibility The ViewPort visibility of the object. @return {@code true} if the ViewPort visibility was changed, {@code false} if it wasn't.
[ "Set", "ViewPort", "visibility", "of", "the", "object", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1809-L1828
161,716
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.findChildByName
public Widget findChildByName(final String name) { final List<Widget> groups = new ArrayList<>(); groups.add(this); return findChildByNameInAllGroups(name, groups); }
java
public Widget findChildByName(final String name) { final List<Widget> groups = new ArrayList<>(); groups.add(this); return findChildByNameInAllGroups(name, groups); }
[ "public", "Widget", "findChildByName", "(", "final", "String", "name", ")", "{", "final", "List", "<", "Widget", ">", "groups", "=", "new", "ArrayList", "<>", "(", ")", ";", "groups", ".", "add", "(", "this", ")", ";", "return", "findChildByNameInAllGroups", "(", "name", ",", "groups", ")", ";", "}" ]
Finds the Widget in hierarchy @param name Name of the child to find @return The named child {@link Widget} or {@code null} if not found.
[ "Finds", "the", "Widget", "in", "hierarchy" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1974-L1979
161,717
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.isGLThread
protected final boolean isGLThread() { final Thread glThread = sGLThread.get(); return glThread != null && glThread.equals(Thread.currentThread()); }
java
protected final boolean isGLThread() { final Thread glThread = sGLThread.get(); return glThread != null && glThread.equals(Thread.currentThread()); }
[ "protected", "final", "boolean", "isGLThread", "(", ")", "{", "final", "Thread", "glThread", "=", "sGLThread", ".", "get", "(", ")", ";", "return", "glThread", "!=", "null", "&&", "glThread", ".", "equals", "(", "Thread", ".", "currentThread", "(", ")", ")", ";", "}" ]
Determine whether the calling thread is the GL thread. @return {@code True} if called from the GL thread, {@code false} if called from another thread.
[ "Determine", "whether", "the", "calling", "thread", "is", "the", "GL", "thread", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L3643-L3646
161,718
Samsung/GearVRf
GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/arcore/ARCoreAnchor.java
ARCoreAnchor.update
protected void update(float scale) { // Updates only when the plane is in the scene GVRSceneObject owner = getOwnerObject(); if ((owner != null) && isEnabled() && owner.isEnabled()) { convertFromARtoVRSpace(scale); } }
java
protected void update(float scale) { // Updates only when the plane is in the scene GVRSceneObject owner = getOwnerObject(); if ((owner != null) && isEnabled() && owner.isEnabled()) { convertFromARtoVRSpace(scale); } }
[ "protected", "void", "update", "(", "float", "scale", ")", "{", "// Updates only when the plane is in the scene", "GVRSceneObject", "owner", "=", "getOwnerObject", "(", ")", ";", "if", "(", "(", "owner", "!=", "null", ")", "&&", "isEnabled", "(", ")", "&&", "owner", ".", "isEnabled", "(", ")", ")", "{", "convertFromARtoVRSpace", "(", "scale", ")", ";", "}", "}" ]
Update the anchor based on arcore best knowledge of the world @param scale
[ "Update", "the", "anchor", "based", "on", "arcore", "best", "knowledge", "of", "the", "world" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/arcore/ARCoreAnchor.java#L85-L93
161,719
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRDirectLight.java
GVRDirectLight.setCastShadow
public void setCastShadow(boolean enableFlag) { GVRSceneObject owner = getOwnerObject(); if (owner != null) { GVRShadowMap shadowMap = (GVRShadowMap) getComponent(GVRRenderTarget.getComponentType()); if (enableFlag) { if (shadowMap != null) { shadowMap.setEnable(true); } else { GVRCamera shadowCam = GVRShadowMap.makeOrthoShadowCamera( getGVRContext().getMainScene().getMainCameraRig().getCenterCamera()); shadowMap = new GVRShadowMap(getGVRContext(), shadowCam); owner.attachComponent(shadowMap); } } else if (shadowMap != null) { shadowMap.setEnable(false); } } mCastShadow = enableFlag; }
java
public void setCastShadow(boolean enableFlag) { GVRSceneObject owner = getOwnerObject(); if (owner != null) { GVRShadowMap shadowMap = (GVRShadowMap) getComponent(GVRRenderTarget.getComponentType()); if (enableFlag) { if (shadowMap != null) { shadowMap.setEnable(true); } else { GVRCamera shadowCam = GVRShadowMap.makeOrthoShadowCamera( getGVRContext().getMainScene().getMainCameraRig().getCenterCamera()); shadowMap = new GVRShadowMap(getGVRContext(), shadowCam); owner.attachComponent(shadowMap); } } else if (shadowMap != null) { shadowMap.setEnable(false); } } mCastShadow = enableFlag; }
[ "public", "void", "setCastShadow", "(", "boolean", "enableFlag", ")", "{", "GVRSceneObject", "owner", "=", "getOwnerObject", "(", ")", ";", "if", "(", "owner", "!=", "null", ")", "{", "GVRShadowMap", "shadowMap", "=", "(", "GVRShadowMap", ")", "getComponent", "(", "GVRRenderTarget", ".", "getComponentType", "(", ")", ")", ";", "if", "(", "enableFlag", ")", "{", "if", "(", "shadowMap", "!=", "null", ")", "{", "shadowMap", ".", "setEnable", "(", "true", ")", ";", "}", "else", "{", "GVRCamera", "shadowCam", "=", "GVRShadowMap", ".", "makeOrthoShadowCamera", "(", "getGVRContext", "(", ")", ".", "getMainScene", "(", ")", ".", "getMainCameraRig", "(", ")", ".", "getCenterCamera", "(", ")", ")", ";", "shadowMap", "=", "new", "GVRShadowMap", "(", "getGVRContext", "(", ")", ",", "shadowCam", ")", ";", "owner", ".", "attachComponent", "(", "shadowMap", ")", ";", "}", "}", "else", "if", "(", "shadowMap", "!=", "null", ")", "{", "shadowMap", ".", "setEnable", "(", "false", ")", ";", "}", "}", "mCastShadow", "=", "enableFlag", ";", "}" ]
Enables or disabled shadow casting for a direct light. Enabling shadows attaches a GVRShadowMap component to the GVRSceneObject which owns the light and provides the component with an orthographic camera for shadow casting. @param enableFlag true to enable shadow casting, false to disable
[ "Enables", "or", "disabled", "shadow", "casting", "for", "a", "direct", "light", ".", "Enabling", "shadows", "attaches", "a", "GVRShadowMap", "component", "to", "the", "GVRSceneObject", "which", "owns", "the", "light", "and", "provides", "the", "component", "with", "an", "orthographic", "camera", "for", "shadow", "casting", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRDirectLight.java#L201-L228
161,720
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java
ExternalScriptable.delete
public synchronized void delete(String name) { if (isEmpty(name)) { indexedProps.remove(name); } else { synchronized (context) { int scope = context.getAttributesScope(name); if (scope != -1) { context.removeAttribute(name, scope); } } } }
java
public synchronized void delete(String name) { if (isEmpty(name)) { indexedProps.remove(name); } else { synchronized (context) { int scope = context.getAttributesScope(name); if (scope != -1) { context.removeAttribute(name, scope); } } } }
[ "public", "synchronized", "void", "delete", "(", "String", "name", ")", "{", "if", "(", "isEmpty", "(", "name", ")", ")", "{", "indexedProps", ".", "remove", "(", "name", ")", ";", "}", "else", "{", "synchronized", "(", "context", ")", "{", "int", "scope", "=", "context", ".", "getAttributesScope", "(", "name", ")", ";", "if", "(", "scope", "!=", "-", "1", ")", "{", "context", ".", "removeAttribute", "(", "name", ",", "scope", ")", ";", "}", "}", "}", "}" ]
Removes a named property from the object. If the property is not found, no action is taken. @param name the name of the property
[ "Removes", "a", "named", "property", "from", "the", "object", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java#L217-L228
161,721
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java
ExternalScriptable.getIds
public synchronized Object[] getIds() { String[] keys = getAllKeys(); int size = keys.length + indexedProps.size(); Object[] res = new Object[size]; System.arraycopy(keys, 0, res, 0, keys.length); int i = keys.length; // now add all indexed properties for (Object index : indexedProps.keySet()) { res[i++] = index; } return res; }
java
public synchronized Object[] getIds() { String[] keys = getAllKeys(); int size = keys.length + indexedProps.size(); Object[] res = new Object[size]; System.arraycopy(keys, 0, res, 0, keys.length); int i = keys.length; // now add all indexed properties for (Object index : indexedProps.keySet()) { res[i++] = index; } return res; }
[ "public", "synchronized", "Object", "[", "]", "getIds", "(", ")", "{", "String", "[", "]", "keys", "=", "getAllKeys", "(", ")", ";", "int", "size", "=", "keys", ".", "length", "+", "indexedProps", ".", "size", "(", ")", ";", "Object", "[", "]", "res", "=", "new", "Object", "[", "size", "]", ";", "System", ".", "arraycopy", "(", "keys", ",", "0", ",", "res", ",", "0", ",", "keys", ".", "length", ")", ";", "int", "i", "=", "keys", ".", "length", ";", "// now add all indexed properties", "for", "(", "Object", "index", ":", "indexedProps", ".", "keySet", "(", ")", ")", "{", "res", "[", "i", "++", "]", "=", "index", ";", "}", "return", "res", ";", "}" ]
Get an array of property ids. Not all property ids need be returned. Those properties whose ids are not returned are considered non-enumerable. @return an array of Objects. Each entry in the array is either a java.lang.String or a java.lang.Number
[ "Get", "an", "array", "of", "property", "ids", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java#L282-L293
161,722
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java
ExternalScriptable.hasInstance
public boolean hasInstance(Scriptable instance) { // Default for JS objects (other than Function) is to do prototype // chasing. Scriptable proto = instance.getPrototype(); while (proto != null) { if (proto.equals(this)) return true; proto = proto.getPrototype(); } return false; }
java
public boolean hasInstance(Scriptable instance) { // Default for JS objects (other than Function) is to do prototype // chasing. Scriptable proto = instance.getPrototype(); while (proto != null) { if (proto.equals(this)) return true; proto = proto.getPrototype(); } return false; }
[ "public", "boolean", "hasInstance", "(", "Scriptable", "instance", ")", "{", "// Default for JS objects (other than Function) is to do prototype", "// chasing.", "Scriptable", "proto", "=", "instance", ".", "getPrototype", "(", ")", ";", "while", "(", "proto", "!=", "null", ")", "{", "if", "(", "proto", ".", "equals", "(", "this", ")", ")", "return", "true", ";", "proto", "=", "proto", ".", "getPrototype", "(", ")", ";", "}", "return", "false", ";", "}" ]
Implements the instanceof operator. @param instance The value that appeared on the LHS of the instanceof operator @return true if "this" appears in value's prototype chain
[ "Implements", "the", "instanceof", "operator", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java#L400-L409
161,723
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TimeSensor.java
TimeSensor.setLoop
public void setLoop(boolean doLoop, GVRContext gvrContext) { if (this.loop != doLoop ) { // a change in the loop for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { if (doLoop) gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.REPEATED); else gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.ONCE); } // be sure to start the animations if loop is true if ( doLoop ) { for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { gvrKeyFrameAnimation.start(gvrContext.getAnimationEngine() ); } } this.loop = doLoop; } }
java
public void setLoop(boolean doLoop, GVRContext gvrContext) { if (this.loop != doLoop ) { // a change in the loop for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { if (doLoop) gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.REPEATED); else gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.ONCE); } // be sure to start the animations if loop is true if ( doLoop ) { for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { gvrKeyFrameAnimation.start(gvrContext.getAnimationEngine() ); } } this.loop = doLoop; } }
[ "public", "void", "setLoop", "(", "boolean", "doLoop", ",", "GVRContext", "gvrContext", ")", "{", "if", "(", "this", ".", "loop", "!=", "doLoop", ")", "{", "// a change in the loop", "for", "(", "GVRNodeAnimation", "gvrKeyFrameAnimation", ":", "gvrKeyFrameAnimations", ")", "{", "if", "(", "doLoop", ")", "gvrKeyFrameAnimation", ".", "setRepeatMode", "(", "GVRRepeatMode", ".", "REPEATED", ")", ";", "else", "gvrKeyFrameAnimation", ".", "setRepeatMode", "(", "GVRRepeatMode", ".", "ONCE", ")", ";", "}", "// be sure to start the animations if loop is true", "if", "(", "doLoop", ")", "{", "for", "(", "GVRNodeAnimation", "gvrKeyFrameAnimation", ":", "gvrKeyFrameAnimations", ")", "{", "gvrKeyFrameAnimation", ".", "start", "(", "gvrContext", ".", "getAnimationEngine", "(", ")", ")", ";", "}", "}", "this", ".", "loop", "=", "doLoop", ";", "}", "}" ]
SetLoop will either set the GVRNodeAnimation's Repeat Mode to REPEATED if loop is true. or it will set the GVRNodeAnimation's Repeat Mode to ONCE if loop is false if loop is set to TRUE, when it was previously FALSE, then start the Animation. @param doLoop @param gvrContext
[ "SetLoop", "will", "either", "set", "the", "GVRNodeAnimation", "s", "Repeat", "Mode", "to", "REPEATED", "if", "loop", "is", "true", ".", "or", "it", "will", "set", "the", "GVRNodeAnimation", "s", "Repeat", "Mode", "to", "ONCE", "if", "loop", "is", "false", "if", "loop", "is", "set", "to", "TRUE", "when", "it", "was", "previously", "FALSE", "then", "start", "the", "Animation", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TimeSensor.java#L96-L111
161,724
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TimeSensor.java
TimeSensor.setCycleInterval
public void setCycleInterval(float newCycleInterval) { if ( (this.cycleInterval != newCycleInterval) && (newCycleInterval > 0) ) { for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { //TODO Cannot easily change the GVRAnimation's GVRChannel once set. } this.cycleInterval = newCycleInterval; } }
java
public void setCycleInterval(float newCycleInterval) { if ( (this.cycleInterval != newCycleInterval) && (newCycleInterval > 0) ) { for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { //TODO Cannot easily change the GVRAnimation's GVRChannel once set. } this.cycleInterval = newCycleInterval; } }
[ "public", "void", "setCycleInterval", "(", "float", "newCycleInterval", ")", "{", "if", "(", "(", "this", ".", "cycleInterval", "!=", "newCycleInterval", ")", "&&", "(", "newCycleInterval", ">", "0", ")", ")", "{", "for", "(", "GVRNodeAnimation", "gvrKeyFrameAnimation", ":", "gvrKeyFrameAnimations", ")", "{", "//TODO Cannot easily change the GVRAnimation's GVRChannel once set.", "}", "this", ".", "cycleInterval", "=", "newCycleInterval", ";", "}", "}" ]
Set the TimeSensor's cycleInterval property Currently, this does not change the duration of the animation. @param newCycleInterval
[ "Set", "the", "TimeSensor", "s", "cycleInterval", "property", "Currently", "this", "does", "not", "change", "the", "duration", "of", "the", "animation", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TimeSensor.java#L126-L133
161,725
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java
ExecutionChain.setErrorCallback
public ExecutionChain setErrorCallback(ErrorCallback callback) { if (state.get() == State.RUNNING) { throw new IllegalStateException( "Invalid while ExecutionChain is running"); } errorCallback = callback; return this; }
java
public ExecutionChain setErrorCallback(ErrorCallback callback) { if (state.get() == State.RUNNING) { throw new IllegalStateException( "Invalid while ExecutionChain is running"); } errorCallback = callback; return this; }
[ "public", "ExecutionChain", "setErrorCallback", "(", "ErrorCallback", "callback", ")", "{", "if", "(", "state", ".", "get", "(", ")", "==", "State", ".", "RUNNING", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Invalid while ExecutionChain is running\"", ")", ";", "}", "errorCallback", "=", "callback", ";", "return", "this", ";", "}" ]
Set a callback to handle any exceptions in the chain of execution. @param callback Instance of {@link ErrorCallback}. @return Reference to the {@code ExecutionChain} @throws IllegalStateException if the chain of execution has already been {@link #execute() started}.
[ "Set", "a", "callback", "to", "handle", "any", "exceptions", "in", "the", "chain", "of", "execution", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java#L381-L388
161,726
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java
ExecutionChain.execute
public void execute() { State currentState = state.getAndSet(State.RUNNING); if (currentState == State.RUNNING) { throw new IllegalStateException( "ExecutionChain is already running!"); } executeRunnable = new ExecuteRunnable(); }
java
public void execute() { State currentState = state.getAndSet(State.RUNNING); if (currentState == State.RUNNING) { throw new IllegalStateException( "ExecutionChain is already running!"); } executeRunnable = new ExecuteRunnable(); }
[ "public", "void", "execute", "(", ")", "{", "State", "currentState", "=", "state", ".", "getAndSet", "(", "State", ".", "RUNNING", ")", ";", "if", "(", "currentState", "==", "State", ".", "RUNNING", ")", "{", "throw", "new", "IllegalStateException", "(", "\"ExecutionChain is already running!\"", ")", ";", "}", "executeRunnable", "=", "new", "ExecuteRunnable", "(", ")", ";", "}" ]
Start the chain of execution running. @throws IllegalStateException if the chain of execution has already been started.
[ "Start", "the", "chain", "of", "execution", "running", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java#L396-L403
161,727
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRConfigurationManager.java
GVRConfigurationManager.isHomeKeyPresent
public boolean isHomeKeyPresent() { final GVRApplication application = mApplication.get(); if (null != application) { final String model = getHmtModel(); if (null != model && model.contains("R323")) { return true; } } return false; }
java
public boolean isHomeKeyPresent() { final GVRApplication application = mApplication.get(); if (null != application) { final String model = getHmtModel(); if (null != model && model.contains("R323")) { return true; } } return false; }
[ "public", "boolean", "isHomeKeyPresent", "(", ")", "{", "final", "GVRApplication", "application", "=", "mApplication", ".", "get", "(", ")", ";", "if", "(", "null", "!=", "application", ")", "{", "final", "String", "model", "=", "getHmtModel", "(", ")", ";", "if", "(", "null", "!=", "model", "&&", "model", ".", "contains", "(", "\"R323\"", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Does the headset the device is docked into have a dedicated home key @return
[ "Does", "the", "headset", "the", "device", "is", "docked", "into", "have", "a", "dedicated", "home", "key" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRConfigurationManager.java#L200-L209
161,728
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java
Shell.addAuxHandler
public void addAuxHandler(Object handler, String prefix) { if (handler == null) { throw new NullPointerException(); } auxHandlers.put(prefix, handler); allHandlers.add(handler); addDeclaredMethods(handler, prefix); inputConverter.addDeclaredConverters(handler); outputConverter.addDeclaredConverters(handler); if (handler instanceof ShellDependent) { ((ShellDependent)handler).cliSetShell(this); } }
java
public void addAuxHandler(Object handler, String prefix) { if (handler == null) { throw new NullPointerException(); } auxHandlers.put(prefix, handler); allHandlers.add(handler); addDeclaredMethods(handler, prefix); inputConverter.addDeclaredConverters(handler); outputConverter.addDeclaredConverters(handler); if (handler instanceof ShellDependent) { ((ShellDependent)handler).cliSetShell(this); } }
[ "public", "void", "addAuxHandler", "(", "Object", "handler", ",", "String", "prefix", ")", "{", "if", "(", "handler", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "auxHandlers", ".", "put", "(", "prefix", ",", "handler", ")", ";", "allHandlers", ".", "add", "(", "handler", ")", ";", "addDeclaredMethods", "(", "handler", ",", "prefix", ")", ";", "inputConverter", ".", "addDeclaredConverters", "(", "handler", ")", ";", "outputConverter", ".", "addDeclaredConverters", "(", "handler", ")", ";", "if", "(", "handler", "instanceof", "ShellDependent", ")", "{", "(", "(", "ShellDependent", ")", "handler", ")", ".", "cliSetShell", "(", "this", ")", ";", "}", "}" ]
This method is very similar to addMainHandler, except ShellFactory will pass all handlers registered with this method to all this shell's subshells. @see org.gearvrf.debug.cli.Shell#addMainHandler(java.lang.Object, java.lang.String) @param handler Object which should be registered as handler. @param prefix Prefix that should be prepended to all handler's command names.
[ "This", "method", "is", "very", "similar", "to", "addMainHandler", "except", "ShellFactory", "will", "pass", "all", "handlers", "registered", "with", "this", "method", "to", "all", "this", "shell", "s", "subshells", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java#L164-L178
161,729
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java
Shell.commandLoop
public void commandLoop() throws IOException { for (Object handler : allHandlers) { if (handler instanceof ShellManageable) { ((ShellManageable)handler).cliEnterLoop(); } } output.output(appName, outputConverter); String command = ""; while (true) { try { command = input.readCommand(path); if (command.trim().equals("exit")) { if (lineProcessor == null) break; else { path = savedPath; lineProcessor = null; } } processLine(command); } catch (TokenException te) { lastException = te; output.outputException(command, te); } catch (CLIException clie) { lastException = clie; if (!command.trim().equals("exit")) { output.outputException(clie); } } } for (Object handler : allHandlers) { if (handler instanceof ShellManageable) { ((ShellManageable)handler).cliLeaveLoop(); } } }
java
public void commandLoop() throws IOException { for (Object handler : allHandlers) { if (handler instanceof ShellManageable) { ((ShellManageable)handler).cliEnterLoop(); } } output.output(appName, outputConverter); String command = ""; while (true) { try { command = input.readCommand(path); if (command.trim().equals("exit")) { if (lineProcessor == null) break; else { path = savedPath; lineProcessor = null; } } processLine(command); } catch (TokenException te) { lastException = te; output.outputException(command, te); } catch (CLIException clie) { lastException = clie; if (!command.trim().equals("exit")) { output.outputException(clie); } } } for (Object handler : allHandlers) { if (handler instanceof ShellManageable) { ((ShellManageable)handler).cliLeaveLoop(); } } }
[ "public", "void", "commandLoop", "(", ")", "throws", "IOException", "{", "for", "(", "Object", "handler", ":", "allHandlers", ")", "{", "if", "(", "handler", "instanceof", "ShellManageable", ")", "{", "(", "(", "ShellManageable", ")", "handler", ")", ".", "cliEnterLoop", "(", ")", ";", "}", "}", "output", ".", "output", "(", "appName", ",", "outputConverter", ")", ";", "String", "command", "=", "\"\"", ";", "while", "(", "true", ")", "{", "try", "{", "command", "=", "input", ".", "readCommand", "(", "path", ")", ";", "if", "(", "command", ".", "trim", "(", ")", ".", "equals", "(", "\"exit\"", ")", ")", "{", "if", "(", "lineProcessor", "==", "null", ")", "break", ";", "else", "{", "path", "=", "savedPath", ";", "lineProcessor", "=", "null", ";", "}", "}", "processLine", "(", "command", ")", ";", "}", "catch", "(", "TokenException", "te", ")", "{", "lastException", "=", "te", ";", "output", ".", "outputException", "(", "command", ",", "te", ")", ";", "}", "catch", "(", "CLIException", "clie", ")", "{", "lastException", "=", "clie", ";", "if", "(", "!", "command", ".", "trim", "(", ")", ".", "equals", "(", "\"exit\"", ")", ")", "{", "output", ".", "outputException", "(", "clie", ")", ";", "}", "}", "}", "for", "(", "Object", "handler", ":", "allHandlers", ")", "{", "if", "(", "handler", "instanceof", "ShellManageable", ")", "{", "(", "(", "ShellManageable", ")", "handler", ")", ".", "cliLeaveLoop", "(", ")", ";", "}", "}", "}" ]
Runs the command session. Create the Shell, then run this method to listen to the user, and the Shell will invoke Handler's methods. @throws java.io.IOException when can't readLine() from input.
[ "Runs", "the", "command", "session", ".", "Create", "the", "Shell", "then", "run", "this", "method", "to", "listen", "to", "the", "user", "and", "the", "Shell", "will", "invoke", "Handler", "s", "methods", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java#L224-L260
161,730
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java
GVRScriptManager.addVariable
@Override public void addVariable(String varName, Object value) { synchronized (mGlobalVariables) { mGlobalVariables.put(varName, value); } refreshGlobalBindings(); }
java
@Override public void addVariable(String varName, Object value) { synchronized (mGlobalVariables) { mGlobalVariables.put(varName, value); } refreshGlobalBindings(); }
[ "@", "Override", "public", "void", "addVariable", "(", "String", "varName", ",", "Object", "value", ")", "{", "synchronized", "(", "mGlobalVariables", ")", "{", "mGlobalVariables", ".", "put", "(", "varName", ",", "value", ")", ";", "}", "refreshGlobalBindings", "(", ")", ";", "}" ]
Add a variable to the scripting context. @param varName The variable name. @param value The variable value.
[ "Add", "a", "variable", "to", "the", "scripting", "context", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L172-L178
161,731
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java
GVRScriptManager.attachScriptFile
@Override public void attachScriptFile(IScriptable target, IScriptFile scriptFile) { mScriptMap.put(target, scriptFile); scriptFile.invokeFunction("onAttach", new Object[] { target }); }
java
@Override public void attachScriptFile(IScriptable target, IScriptFile scriptFile) { mScriptMap.put(target, scriptFile); scriptFile.invokeFunction("onAttach", new Object[] { target }); }
[ "@", "Override", "public", "void", "attachScriptFile", "(", "IScriptable", "target", ",", "IScriptFile", "scriptFile", ")", "{", "mScriptMap", ".", "put", "(", "target", ",", "scriptFile", ")", ";", "scriptFile", ".", "invokeFunction", "(", "\"onAttach\"", ",", "new", "Object", "[", "]", "{", "target", "}", ")", ";", "}" ]
Attach a script file to a scriptable target. @param target The scriptable target. @param scriptFile The script file object.
[ "Attach", "a", "script", "file", "to", "a", "scriptable", "target", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L186-L190
161,732
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java
GVRScriptManager.detachScriptFile
@Override public void detachScriptFile(IScriptable target) { IScriptFile scriptFile = mScriptMap.remove(target); if (scriptFile != null) { scriptFile.invokeFunction("onDetach", new Object[] { target }); } }
java
@Override public void detachScriptFile(IScriptable target) { IScriptFile scriptFile = mScriptMap.remove(target); if (scriptFile != null) { scriptFile.invokeFunction("onDetach", new Object[] { target }); } }
[ "@", "Override", "public", "void", "detachScriptFile", "(", "IScriptable", "target", ")", "{", "IScriptFile", "scriptFile", "=", "mScriptMap", ".", "remove", "(", "target", ")", ";", "if", "(", "scriptFile", "!=", "null", ")", "{", "scriptFile", ".", "invokeFunction", "(", "\"onDetach\"", ",", "new", "Object", "[", "]", "{", "target", "}", ")", ";", "}", "}" ]
Detach any script file from a scriptable target. @param target The scriptable target.
[ "Detach", "any", "script", "file", "from", "a", "scriptable", "target", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L197-L203
161,733
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java
GVRScriptManager.bindScriptBundleToScene
public void bindScriptBundleToScene(GVRScriptBundle scriptBundle, GVRScene scene) throws IOException, GVRScriptException { for (GVRSceneObject sceneObject : scene.getSceneObjects()) { bindBundleToSceneObject(scriptBundle, sceneObject); } }
java
public void bindScriptBundleToScene(GVRScriptBundle scriptBundle, GVRScene scene) throws IOException, GVRScriptException { for (GVRSceneObject sceneObject : scene.getSceneObjects()) { bindBundleToSceneObject(scriptBundle, sceneObject); } }
[ "public", "void", "bindScriptBundleToScene", "(", "GVRScriptBundle", "scriptBundle", ",", "GVRScene", "scene", ")", "throws", "IOException", ",", "GVRScriptException", "{", "for", "(", "GVRSceneObject", "sceneObject", ":", "scene", ".", "getSceneObjects", "(", ")", ")", "{", "bindBundleToSceneObject", "(", "scriptBundle", ",", "sceneObject", ")", ";", "}", "}" ]
Binds a script bundle to a scene. @param scriptBundle The {@code GVRScriptBundle} object containing script binding information. @param scene The scene to bind to. @throws IOException if script bundle file cannot be read. @throws GVRScriptException if script processing error occurs.
[ "Binds", "a", "script", "bundle", "to", "a", "scene", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L313-L317
161,734
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java
GVRScriptManager.bindBundleToSceneObject
public void bindBundleToSceneObject(GVRScriptBundle scriptBundle, GVRSceneObject rootSceneObject) throws IOException, GVRScriptException { bindHelper(scriptBundle, rootSceneObject, BIND_MASK_SCENE_OBJECTS); }
java
public void bindBundleToSceneObject(GVRScriptBundle scriptBundle, GVRSceneObject rootSceneObject) throws IOException, GVRScriptException { bindHelper(scriptBundle, rootSceneObject, BIND_MASK_SCENE_OBJECTS); }
[ "public", "void", "bindBundleToSceneObject", "(", "GVRScriptBundle", "scriptBundle", ",", "GVRSceneObject", "rootSceneObject", ")", "throws", "IOException", ",", "GVRScriptException", "{", "bindHelper", "(", "scriptBundle", ",", "rootSceneObject", ",", "BIND_MASK_SCENE_OBJECTS", ")", ";", "}" ]
Binds a script bundle to scene graph rooted at a scene object. @param scriptBundle The {@code GVRScriptBundle} object containing script binding information. @param rootSceneObject The root of the scene object tree to which the scripts are bound. @throws IOException if script bundle file cannot be read. @throws GVRScriptException if a script processing error occurs.
[ "Binds", "a", "script", "bundle", "to", "scene", "graph", "rooted", "at", "a", "scene", "object", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L328-L332
161,735
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java
GVRScriptManager.bindHelper
protected void bindHelper(GVRScriptBundle scriptBundle, GVRSceneObject rootSceneObject, int bindMask) throws IOException, GVRScriptException { for (GVRScriptBindingEntry entry : scriptBundle.file.binding) { GVRAndroidResource rc; if (entry.volumeType == null || entry.volumeType.isEmpty()) { rc = scriptBundle.volume.openResource(entry.script); } else { GVRResourceVolume.VolumeType volumeType = GVRResourceVolume.VolumeType.fromString(entry.volumeType); if (volumeType == null) { throw new GVRScriptException(String.format("Volume type %s is not recognized, script=%s", entry.volumeType, entry.script)); } rc = new GVRResourceVolume(mGvrContext, volumeType).openResource(entry.script); } GVRScriptFile scriptFile = (GVRScriptFile)loadScript(rc, entry.language); String targetName = entry.target; if (targetName.startsWith(TARGET_PREFIX)) { TargetResolver resolver = sBuiltinTargetMap.get(targetName); IScriptable target = resolver.getTarget(mGvrContext, targetName); // Apply mask boolean toBind = false; if ((bindMask & BIND_MASK_GVRSCRIPT) != 0 && targetName.equalsIgnoreCase(TARGET_GVRMAIN)) { toBind = true; } if ((bindMask & BIND_MASK_GVRACTIVITY) != 0 && targetName.equalsIgnoreCase(TARGET_GVRAPPLICATION)) { toBind = true; } if (toBind) { attachScriptFile(target, scriptFile); } } else { if ((bindMask & BIND_MASK_SCENE_OBJECTS) != 0) { if (targetName.equals(rootSceneObject.getName())) { attachScriptFile(rootSceneObject, scriptFile); } // Search in children GVRSceneObject[] sceneObjects = rootSceneObject.getSceneObjectsByName(targetName); if (sceneObjects != null) { for (GVRSceneObject sceneObject : sceneObjects) { GVRScriptBehavior b = new GVRScriptBehavior(sceneObject.getGVRContext()); b.setScriptFile(scriptFile); sceneObject.attachComponent(b); } } } } } }
java
protected void bindHelper(GVRScriptBundle scriptBundle, GVRSceneObject rootSceneObject, int bindMask) throws IOException, GVRScriptException { for (GVRScriptBindingEntry entry : scriptBundle.file.binding) { GVRAndroidResource rc; if (entry.volumeType == null || entry.volumeType.isEmpty()) { rc = scriptBundle.volume.openResource(entry.script); } else { GVRResourceVolume.VolumeType volumeType = GVRResourceVolume.VolumeType.fromString(entry.volumeType); if (volumeType == null) { throw new GVRScriptException(String.format("Volume type %s is not recognized, script=%s", entry.volumeType, entry.script)); } rc = new GVRResourceVolume(mGvrContext, volumeType).openResource(entry.script); } GVRScriptFile scriptFile = (GVRScriptFile)loadScript(rc, entry.language); String targetName = entry.target; if (targetName.startsWith(TARGET_PREFIX)) { TargetResolver resolver = sBuiltinTargetMap.get(targetName); IScriptable target = resolver.getTarget(mGvrContext, targetName); // Apply mask boolean toBind = false; if ((bindMask & BIND_MASK_GVRSCRIPT) != 0 && targetName.equalsIgnoreCase(TARGET_GVRMAIN)) { toBind = true; } if ((bindMask & BIND_MASK_GVRACTIVITY) != 0 && targetName.equalsIgnoreCase(TARGET_GVRAPPLICATION)) { toBind = true; } if (toBind) { attachScriptFile(target, scriptFile); } } else { if ((bindMask & BIND_MASK_SCENE_OBJECTS) != 0) { if (targetName.equals(rootSceneObject.getName())) { attachScriptFile(rootSceneObject, scriptFile); } // Search in children GVRSceneObject[] sceneObjects = rootSceneObject.getSceneObjectsByName(targetName); if (sceneObjects != null) { for (GVRSceneObject sceneObject : sceneObjects) { GVRScriptBehavior b = new GVRScriptBehavior(sceneObject.getGVRContext()); b.setScriptFile(scriptFile); sceneObject.attachComponent(b); } } } } } }
[ "protected", "void", "bindHelper", "(", "GVRScriptBundle", "scriptBundle", ",", "GVRSceneObject", "rootSceneObject", ",", "int", "bindMask", ")", "throws", "IOException", ",", "GVRScriptException", "{", "for", "(", "GVRScriptBindingEntry", "entry", ":", "scriptBundle", ".", "file", ".", "binding", ")", "{", "GVRAndroidResource", "rc", ";", "if", "(", "entry", ".", "volumeType", "==", "null", "||", "entry", ".", "volumeType", ".", "isEmpty", "(", ")", ")", "{", "rc", "=", "scriptBundle", ".", "volume", ".", "openResource", "(", "entry", ".", "script", ")", ";", "}", "else", "{", "GVRResourceVolume", ".", "VolumeType", "volumeType", "=", "GVRResourceVolume", ".", "VolumeType", ".", "fromString", "(", "entry", ".", "volumeType", ")", ";", "if", "(", "volumeType", "==", "null", ")", "{", "throw", "new", "GVRScriptException", "(", "String", ".", "format", "(", "\"Volume type %s is not recognized, script=%s\"", ",", "entry", ".", "volumeType", ",", "entry", ".", "script", ")", ")", ";", "}", "rc", "=", "new", "GVRResourceVolume", "(", "mGvrContext", ",", "volumeType", ")", ".", "openResource", "(", "entry", ".", "script", ")", ";", "}", "GVRScriptFile", "scriptFile", "=", "(", "GVRScriptFile", ")", "loadScript", "(", "rc", ",", "entry", ".", "language", ")", ";", "String", "targetName", "=", "entry", ".", "target", ";", "if", "(", "targetName", ".", "startsWith", "(", "TARGET_PREFIX", ")", ")", "{", "TargetResolver", "resolver", "=", "sBuiltinTargetMap", ".", "get", "(", "targetName", ")", ";", "IScriptable", "target", "=", "resolver", ".", "getTarget", "(", "mGvrContext", ",", "targetName", ")", ";", "// Apply mask", "boolean", "toBind", "=", "false", ";", "if", "(", "(", "bindMask", "&", "BIND_MASK_GVRSCRIPT", ")", "!=", "0", "&&", "targetName", ".", "equalsIgnoreCase", "(", "TARGET_GVRMAIN", ")", ")", "{", "toBind", "=", "true", ";", "}", "if", "(", "(", "bindMask", "&", "BIND_MASK_GVRACTIVITY", ")", "!=", "0", "&&", "targetName", ".", "equalsIgnoreCase", "(", "TARGET_GVRAPPLICATION", ")", ")", "{", "toBind", "=", "true", ";", "}", "if", "(", "toBind", ")", "{", "attachScriptFile", "(", "target", ",", "scriptFile", ")", ";", "}", "}", "else", "{", "if", "(", "(", "bindMask", "&", "BIND_MASK_SCENE_OBJECTS", ")", "!=", "0", ")", "{", "if", "(", "targetName", ".", "equals", "(", "rootSceneObject", ".", "getName", "(", ")", ")", ")", "{", "attachScriptFile", "(", "rootSceneObject", ",", "scriptFile", ")", ";", "}", "// Search in children", "GVRSceneObject", "[", "]", "sceneObjects", "=", "rootSceneObject", ".", "getSceneObjectsByName", "(", "targetName", ")", ";", "if", "(", "sceneObjects", "!=", "null", ")", "{", "for", "(", "GVRSceneObject", "sceneObject", ":", "sceneObjects", ")", "{", "GVRScriptBehavior", "b", "=", "new", "GVRScriptBehavior", "(", "sceneObject", ".", "getGVRContext", "(", ")", ")", ";", "b", ".", "setScriptFile", "(", "scriptFile", ")", ";", "sceneObject", ".", "attachComponent", "(", "b", ")", ";", "}", "}", "}", "}", "}", "}" ]
Helper function to bind script bundler to various targets
[ "Helper", "function", "to", "bind", "script", "bundler", "to", "various", "targets" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L339-L393
161,736
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRViewManager.java
GVRViewManager.doMemoryManagementAndPerFrameCallbacks
private long doMemoryManagementAndPerFrameCallbacks() { long currentTime = GVRTime.getCurrentTime(); mFrameTime = (currentTime - mPreviousTimeNanos) / 1e9f; mPreviousTimeNanos = currentTime; /* * Without the sensor data, can't draw a scene properly. */ if (!(mSensoredScene == null || !mMainScene.equals(mSensoredScene))) { Runnable runnable; while ((runnable = mRunnables.poll()) != null) { try { runnable.run(); } catch (final Exception exc) { Log.e(TAG, "Runnable-on-GL %s threw %s", runnable, exc.toString()); exc.printStackTrace(); } } final List<GVRDrawFrameListener> frameListeners = mFrameListeners; for (GVRDrawFrameListener listener : frameListeners) { try { listener.onDrawFrame(mFrameTime); } catch (final Exception exc) { Log.e(TAG, "DrawFrameListener %s threw %s", listener, exc.toString()); exc.printStackTrace(); } } } return currentTime; }
java
private long doMemoryManagementAndPerFrameCallbacks() { long currentTime = GVRTime.getCurrentTime(); mFrameTime = (currentTime - mPreviousTimeNanos) / 1e9f; mPreviousTimeNanos = currentTime; /* * Without the sensor data, can't draw a scene properly. */ if (!(mSensoredScene == null || !mMainScene.equals(mSensoredScene))) { Runnable runnable; while ((runnable = mRunnables.poll()) != null) { try { runnable.run(); } catch (final Exception exc) { Log.e(TAG, "Runnable-on-GL %s threw %s", runnable, exc.toString()); exc.printStackTrace(); } } final List<GVRDrawFrameListener> frameListeners = mFrameListeners; for (GVRDrawFrameListener listener : frameListeners) { try { listener.onDrawFrame(mFrameTime); } catch (final Exception exc) { Log.e(TAG, "DrawFrameListener %s threw %s", listener, exc.toString()); exc.printStackTrace(); } } } return currentTime; }
[ "private", "long", "doMemoryManagementAndPerFrameCallbacks", "(", ")", "{", "long", "currentTime", "=", "GVRTime", ".", "getCurrentTime", "(", ")", ";", "mFrameTime", "=", "(", "currentTime", "-", "mPreviousTimeNanos", ")", "/", "1e9f", ";", "mPreviousTimeNanos", "=", "currentTime", ";", "/*\n * Without the sensor data, can't draw a scene properly.\n */", "if", "(", "!", "(", "mSensoredScene", "==", "null", "||", "!", "mMainScene", ".", "equals", "(", "mSensoredScene", ")", ")", ")", "{", "Runnable", "runnable", ";", "while", "(", "(", "runnable", "=", "mRunnables", ".", "poll", "(", ")", ")", "!=", "null", ")", "{", "try", "{", "runnable", ".", "run", "(", ")", ";", "}", "catch", "(", "final", "Exception", "exc", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"Runnable-on-GL %s threw %s\"", ",", "runnable", ",", "exc", ".", "toString", "(", ")", ")", ";", "exc", ".", "printStackTrace", "(", ")", ";", "}", "}", "final", "List", "<", "GVRDrawFrameListener", ">", "frameListeners", "=", "mFrameListeners", ";", "for", "(", "GVRDrawFrameListener", "listener", ":", "frameListeners", ")", "{", "try", "{", "listener", ".", "onDrawFrame", "(", "mFrameTime", ")", ";", "}", "catch", "(", "final", "Exception", "exc", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"DrawFrameListener %s threw %s\"", ",", "listener", ",", "exc", ".", "toString", "(", ")", ")", ";", "exc", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "return", "currentTime", ";", "}" ]
This is the code that needs to be executed before either eye is drawn. @return Current time, from {@link GVRTime#getCurrentTime()}
[ "This", "is", "the", "code", "that", "needs", "to", "be", "executed", "before", "either", "eye", "is", "drawn", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRViewManager.java#L258-L289
161,737
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRViewManager.java
GVRViewManager.capture3DScreenShot
protected void capture3DScreenShot(GVRRenderTarget renderTarget, boolean isMultiview) { if (mScreenshot3DCallback == null) { return; } final Bitmap[] bitmaps = new Bitmap[6]; renderSixCamerasAndReadback(mMainScene.getMainCameraRig(), bitmaps, renderTarget, isMultiview); returnScreenshot3DToCaller(mScreenshot3DCallback, bitmaps, mReadbackBufferWidth, mReadbackBufferHeight); mScreenshot3DCallback = null; }
java
protected void capture3DScreenShot(GVRRenderTarget renderTarget, boolean isMultiview) { if (mScreenshot3DCallback == null) { return; } final Bitmap[] bitmaps = new Bitmap[6]; renderSixCamerasAndReadback(mMainScene.getMainCameraRig(), bitmaps, renderTarget, isMultiview); returnScreenshot3DToCaller(mScreenshot3DCallback, bitmaps, mReadbackBufferWidth, mReadbackBufferHeight); mScreenshot3DCallback = null; }
[ "protected", "void", "capture3DScreenShot", "(", "GVRRenderTarget", "renderTarget", ",", "boolean", "isMultiview", ")", "{", "if", "(", "mScreenshot3DCallback", "==", "null", ")", "{", "return", ";", "}", "final", "Bitmap", "[", "]", "bitmaps", "=", "new", "Bitmap", "[", "6", "]", ";", "renderSixCamerasAndReadback", "(", "mMainScene", ".", "getMainCameraRig", "(", ")", ",", "bitmaps", ",", "renderTarget", ",", "isMultiview", ")", ";", "returnScreenshot3DToCaller", "(", "mScreenshot3DCallback", ",", "bitmaps", ",", "mReadbackBufferWidth", ",", "mReadbackBufferHeight", ")", ";", "mScreenshot3DCallback", "=", "null", ";", "}" ]
capture 3D screenshot
[ "capture", "3D", "screenshot" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRViewManager.java#L665-L674
161,738
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRViewManager.java
GVRViewManager.captureEye
private void captureEye(GVRScreenshotCallback callback, GVRRenderTarget renderTarget, GVRViewManager.EYE eye, boolean useMultiview) { if (null == callback) { return; } readRenderResult(renderTarget,eye,useMultiview); returnScreenshotToCaller(callback, mReadbackBufferWidth, mReadbackBufferHeight); }
java
private void captureEye(GVRScreenshotCallback callback, GVRRenderTarget renderTarget, GVRViewManager.EYE eye, boolean useMultiview) { if (null == callback) { return; } readRenderResult(renderTarget,eye,useMultiview); returnScreenshotToCaller(callback, mReadbackBufferWidth, mReadbackBufferHeight); }
[ "private", "void", "captureEye", "(", "GVRScreenshotCallback", "callback", ",", "GVRRenderTarget", "renderTarget", ",", "GVRViewManager", ".", "EYE", "eye", ",", "boolean", "useMultiview", ")", "{", "if", "(", "null", "==", "callback", ")", "{", "return", ";", "}", "readRenderResult", "(", "renderTarget", ",", "eye", ",", "useMultiview", ")", ";", "returnScreenshotToCaller", "(", "callback", ",", "mReadbackBufferWidth", ",", "mReadbackBufferHeight", ")", ";", "}" ]
capture screenshot of an eye
[ "capture", "screenshot", "of", "an", "eye" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRViewManager.java#L687-L693
161,739
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRViewManager.java
GVRViewManager.captureCenterEye
protected void captureCenterEye(GVRRenderTarget renderTarget, boolean isMultiview) { if (mScreenshotCenterCallback == null) { return; } // TODO: when we will use multithreading, create new camera using centercamera as we are adding posteffects into it final GVRCamera centerCamera = mMainScene.getMainCameraRig().getCenterCamera(); final GVRMaterial postEffect = new GVRMaterial(this, GVRMaterial.GVRShaderType.VerticalFlip.ID); centerCamera.addPostEffect(postEffect); GVRRenderTexture posteffectRenderTextureB = null; GVRRenderTexture posteffectRenderTextureA = null; if(isMultiview) { posteffectRenderTextureA = mRenderBundle.getEyeCapturePostEffectRenderTextureA(); posteffectRenderTextureB = mRenderBundle.getEyeCapturePostEffectRenderTextureB(); renderTarget = mRenderBundle.getEyeCaptureRenderTarget(); renderTarget.cullFromCamera(mMainScene, centerCamera ,mRenderBundle.getShaderManager()); renderTarget.beginRendering(centerCamera); } else { posteffectRenderTextureA = mRenderBundle.getPostEffectRenderTextureA(); posteffectRenderTextureB = mRenderBundle.getPostEffectRenderTextureB(); } renderTarget.render(mMainScene,centerCamera, mRenderBundle.getShaderManager(), posteffectRenderTextureA, posteffectRenderTextureB); centerCamera.removePostEffect(postEffect); readRenderResult(renderTarget, EYE.MULTIVIEW, false); if(isMultiview) renderTarget.endRendering(); final Bitmap bitmap = Bitmap.createBitmap(mReadbackBufferWidth, mReadbackBufferHeight, Bitmap.Config.ARGB_8888); mReadbackBuffer.rewind(); bitmap.copyPixelsFromBuffer(mReadbackBuffer); final GVRScreenshotCallback callback = mScreenshotCenterCallback; Threads.spawn(new Runnable() { public void run() { callback.onScreenCaptured(bitmap); } }); mScreenshotCenterCallback = null; }
java
protected void captureCenterEye(GVRRenderTarget renderTarget, boolean isMultiview) { if (mScreenshotCenterCallback == null) { return; } // TODO: when we will use multithreading, create new camera using centercamera as we are adding posteffects into it final GVRCamera centerCamera = mMainScene.getMainCameraRig().getCenterCamera(); final GVRMaterial postEffect = new GVRMaterial(this, GVRMaterial.GVRShaderType.VerticalFlip.ID); centerCamera.addPostEffect(postEffect); GVRRenderTexture posteffectRenderTextureB = null; GVRRenderTexture posteffectRenderTextureA = null; if(isMultiview) { posteffectRenderTextureA = mRenderBundle.getEyeCapturePostEffectRenderTextureA(); posteffectRenderTextureB = mRenderBundle.getEyeCapturePostEffectRenderTextureB(); renderTarget = mRenderBundle.getEyeCaptureRenderTarget(); renderTarget.cullFromCamera(mMainScene, centerCamera ,mRenderBundle.getShaderManager()); renderTarget.beginRendering(centerCamera); } else { posteffectRenderTextureA = mRenderBundle.getPostEffectRenderTextureA(); posteffectRenderTextureB = mRenderBundle.getPostEffectRenderTextureB(); } renderTarget.render(mMainScene,centerCamera, mRenderBundle.getShaderManager(), posteffectRenderTextureA, posteffectRenderTextureB); centerCamera.removePostEffect(postEffect); readRenderResult(renderTarget, EYE.MULTIVIEW, false); if(isMultiview) renderTarget.endRendering(); final Bitmap bitmap = Bitmap.createBitmap(mReadbackBufferWidth, mReadbackBufferHeight, Bitmap.Config.ARGB_8888); mReadbackBuffer.rewind(); bitmap.copyPixelsFromBuffer(mReadbackBuffer); final GVRScreenshotCallback callback = mScreenshotCenterCallback; Threads.spawn(new Runnable() { public void run() { callback.onScreenCaptured(bitmap); } }); mScreenshotCenterCallback = null; }
[ "protected", "void", "captureCenterEye", "(", "GVRRenderTarget", "renderTarget", ",", "boolean", "isMultiview", ")", "{", "if", "(", "mScreenshotCenterCallback", "==", "null", ")", "{", "return", ";", "}", "// TODO: when we will use multithreading, create new camera using centercamera as we are adding posteffects into it", "final", "GVRCamera", "centerCamera", "=", "mMainScene", ".", "getMainCameraRig", "(", ")", ".", "getCenterCamera", "(", ")", ";", "final", "GVRMaterial", "postEffect", "=", "new", "GVRMaterial", "(", "this", ",", "GVRMaterial", ".", "GVRShaderType", ".", "VerticalFlip", ".", "ID", ")", ";", "centerCamera", ".", "addPostEffect", "(", "postEffect", ")", ";", "GVRRenderTexture", "posteffectRenderTextureB", "=", "null", ";", "GVRRenderTexture", "posteffectRenderTextureA", "=", "null", ";", "if", "(", "isMultiview", ")", "{", "posteffectRenderTextureA", "=", "mRenderBundle", ".", "getEyeCapturePostEffectRenderTextureA", "(", ")", ";", "posteffectRenderTextureB", "=", "mRenderBundle", ".", "getEyeCapturePostEffectRenderTextureB", "(", ")", ";", "renderTarget", "=", "mRenderBundle", ".", "getEyeCaptureRenderTarget", "(", ")", ";", "renderTarget", ".", "cullFromCamera", "(", "mMainScene", ",", "centerCamera", ",", "mRenderBundle", ".", "getShaderManager", "(", ")", ")", ";", "renderTarget", ".", "beginRendering", "(", "centerCamera", ")", ";", "}", "else", "{", "posteffectRenderTextureA", "=", "mRenderBundle", ".", "getPostEffectRenderTextureA", "(", ")", ";", "posteffectRenderTextureB", "=", "mRenderBundle", ".", "getPostEffectRenderTextureB", "(", ")", ";", "}", "renderTarget", ".", "render", "(", "mMainScene", ",", "centerCamera", ",", "mRenderBundle", ".", "getShaderManager", "(", ")", ",", "posteffectRenderTextureA", ",", "posteffectRenderTextureB", ")", ";", "centerCamera", ".", "removePostEffect", "(", "postEffect", ")", ";", "readRenderResult", "(", "renderTarget", ",", "EYE", ".", "MULTIVIEW", ",", "false", ")", ";", "if", "(", "isMultiview", ")", "renderTarget", ".", "endRendering", "(", ")", ";", "final", "Bitmap", "bitmap", "=", "Bitmap", ".", "createBitmap", "(", "mReadbackBufferWidth", ",", "mReadbackBufferHeight", ",", "Bitmap", ".", "Config", ".", "ARGB_8888", ")", ";", "mReadbackBuffer", ".", "rewind", "(", ")", ";", "bitmap", ".", "copyPixelsFromBuffer", "(", "mReadbackBuffer", ")", ";", "final", "GVRScreenshotCallback", "callback", "=", "mScreenshotCenterCallback", ";", "Threads", ".", "spawn", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "callback", ".", "onScreenCaptured", "(", "bitmap", ")", ";", "}", "}", ")", ";", "mScreenshotCenterCallback", "=", "null", ";", "}" ]
capture center eye
[ "capture", "center", "eye" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRViewManager.java#L696-L740
161,740
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/MainThread.java
MainThread.runOnMainThreadNext
public boolean runOnMainThreadNext(Runnable r) { assert handler != null; if (!sanityCheck("runOnMainThreadNext " + r)) { return false; } return handler.post(r); }
java
public boolean runOnMainThreadNext(Runnable r) { assert handler != null; if (!sanityCheck("runOnMainThreadNext " + r)) { return false; } return handler.post(r); }
[ "public", "boolean", "runOnMainThreadNext", "(", "Runnable", "r", ")", "{", "assert", "handler", "!=", "null", ";", "if", "(", "!", "sanityCheck", "(", "\"runOnMainThreadNext \"", "+", "r", ")", ")", "{", "return", "false", ";", "}", "return", "handler", ".", "post", "(", "r", ")", ";", "}" ]
Queues a Runnable to be run on the main thread on the next iteration of the messaging loop. This is handy when code running on the main thread needs to run something else on the main thread, but only after the current code has finished executing. @param r The {@link Runnable} to run on the main thread. @return Returns {@code true} if the Runnable was successfully placed in the Looper's message queue.
[ "Queues", "a", "Runnable", "to", "be", "run", "on", "the", "main", "thread", "on", "the", "next", "iteration", "of", "the", "messaging", "loop", ".", "This", "is", "handy", "when", "code", "running", "on", "the", "main", "thread", "needs", "to", "run", "something", "else", "on", "the", "main", "thread", "but", "only", "after", "the", "current", "code", "has", "finished", "executing", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/MainThread.java#L123-L130
161,741
Samsung/GearVRf
GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java
CursorManager.showSettingsMenu
private void showSettingsMenu(final Cursor cursor) { Log.d(TAG, "showSettingsMenu"); enableSettingsCursor(cursor); context.runOnGlThread(new Runnable() { @Override public void run() { new SettingsView(context, scene, CursorManager.this, settingsCursor.getIoDevice().getCursorControllerId(), cursor, new SettingsChangeListener() { @Override public void onBack(boolean cascading) { disableSettingsCursor(); } @Override public int onDeviceChanged(IoDevice device) { // we are changing the io device on the settings cursor removeCursorFromScene(settingsCursor); IoDevice clickedDevice = getAvailableIoDevice(device); settingsCursor.setIoDevice(clickedDevice); addCursorToScene(settingsCursor); return device.getCursorControllerId(); } }); } }); }
java
private void showSettingsMenu(final Cursor cursor) { Log.d(TAG, "showSettingsMenu"); enableSettingsCursor(cursor); context.runOnGlThread(new Runnable() { @Override public void run() { new SettingsView(context, scene, CursorManager.this, settingsCursor.getIoDevice().getCursorControllerId(), cursor, new SettingsChangeListener() { @Override public void onBack(boolean cascading) { disableSettingsCursor(); } @Override public int onDeviceChanged(IoDevice device) { // we are changing the io device on the settings cursor removeCursorFromScene(settingsCursor); IoDevice clickedDevice = getAvailableIoDevice(device); settingsCursor.setIoDevice(clickedDevice); addCursorToScene(settingsCursor); return device.getCursorControllerId(); } }); } }); }
[ "private", "void", "showSettingsMenu", "(", "final", "Cursor", "cursor", ")", "{", "Log", ".", "d", "(", "TAG", ",", "\"showSettingsMenu\"", ")", ";", "enableSettingsCursor", "(", "cursor", ")", ";", "context", ".", "runOnGlThread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "new", "SettingsView", "(", "context", ",", "scene", ",", "CursorManager", ".", "this", ",", "settingsCursor", ".", "getIoDevice", "(", ")", ".", "getCursorControllerId", "(", ")", ",", "cursor", ",", "new", "SettingsChangeListener", "(", ")", "{", "@", "Override", "public", "void", "onBack", "(", "boolean", "cascading", ")", "{", "disableSettingsCursor", "(", ")", ";", "}", "@", "Override", "public", "int", "onDeviceChanged", "(", "IoDevice", "device", ")", "{", "// we are changing the io device on the settings cursor", "removeCursorFromScene", "(", "settingsCursor", ")", ";", "IoDevice", "clickedDevice", "=", "getAvailableIoDevice", "(", "device", ")", ";", "settingsCursor", ".", "setIoDevice", "(", "clickedDevice", ")", ";", "addCursorToScene", "(", "settingsCursor", ")", ";", "return", "device", ".", "getCursorControllerId", "(", ")", ";", "}", "}", ")", ";", "}", "}", ")", ";", "}" ]
Presents the Cursor Settings to the User. Only works if scene is set.
[ "Presents", "the", "Cursor", "Settings", "to", "the", "User", ".", "Only", "works", "if", "scene", "is", "set", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java#L435-L461
161,742
Samsung/GearVRf
GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java
CursorManager.updateCursorsInScene
private void updateCursorsInScene(GVRScene scene, boolean add) { synchronized (mCursors) { for (Cursor cursor : mCursors) { if (cursor.isActive()) { if (add) { addCursorToScene(cursor); } else { removeCursorFromScene(cursor); } } } } }
java
private void updateCursorsInScene(GVRScene scene, boolean add) { synchronized (mCursors) { for (Cursor cursor : mCursors) { if (cursor.isActive()) { if (add) { addCursorToScene(cursor); } else { removeCursorFromScene(cursor); } } } } }
[ "private", "void", "updateCursorsInScene", "(", "GVRScene", "scene", ",", "boolean", "add", ")", "{", "synchronized", "(", "mCursors", ")", "{", "for", "(", "Cursor", "cursor", ":", "mCursors", ")", "{", "if", "(", "cursor", ".", "isActive", "(", ")", ")", "{", "if", "(", "add", ")", "{", "addCursorToScene", "(", "cursor", ")", ";", "}", "else", "{", "removeCursorFromScene", "(", "cursor", ")", ";", "}", "}", "}", "}", "}" ]
Add or remove the active cursors from the provided scene. @param scene The GVRScene. @param add <code>true</code> for add, <code>false</code> to remove
[ "Add", "or", "remove", "the", "active", "cursors", "from", "the", "provided", "scene", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java#L621-L633
161,743
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java
ListWidget.getAllViews
public List<Widget> getAllViews() { List<Widget> views = new ArrayList<>(); for (Widget child: mContent.getChildren()) { Widget item = ((ListItemHostWidget) child).getGuest(); if (item != null) { views.add(item); } } return views; }
java
public List<Widget> getAllViews() { List<Widget> views = new ArrayList<>(); for (Widget child: mContent.getChildren()) { Widget item = ((ListItemHostWidget) child).getGuest(); if (item != null) { views.add(item); } } return views; }
[ "public", "List", "<", "Widget", ">", "getAllViews", "(", ")", "{", "List", "<", "Widget", ">", "views", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Widget", "child", ":", "mContent", ".", "getChildren", "(", ")", ")", "{", "Widget", "item", "=", "(", "(", "ListItemHostWidget", ")", "child", ")", ".", "getGuest", "(", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "views", ".", "add", "(", "item", ")", ";", "}", "}", "return", "views", ";", "}" ]
Get all views from the list content @return list of views currently visible
[ "Get", "all", "views", "from", "the", "list", "content" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L370-L379
161,744
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java
ListWidget.clearSelection
public boolean clearSelection(boolean requestLayout) { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "clearSelection [%d]", mSelectedItemsList.size()); boolean updateLayout = false; List<ListItemHostWidget> views = getAllHosts(); for (ListItemHostWidget host: views) { if (host.isSelected()) { host.setSelected(false); updateLayout = true; if (requestLayout) { host.requestLayout(); } } } clearSelectedItemsList(); return updateLayout; }
java
public boolean clearSelection(boolean requestLayout) { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "clearSelection [%d]", mSelectedItemsList.size()); boolean updateLayout = false; List<ListItemHostWidget> views = getAllHosts(); for (ListItemHostWidget host: views) { if (host.isSelected()) { host.setSelected(false); updateLayout = true; if (requestLayout) { host.requestLayout(); } } } clearSelectedItemsList(); return updateLayout; }
[ "public", "boolean", "clearSelection", "(", "boolean", "requestLayout", ")", "{", "Log", ".", "d", "(", "Log", ".", "SUBSYSTEM", ".", "LAYOUT", ",", "TAG", ",", "\"clearSelection [%d]\"", ",", "mSelectedItemsList", ".", "size", "(", ")", ")", ";", "boolean", "updateLayout", "=", "false", ";", "List", "<", "ListItemHostWidget", ">", "views", "=", "getAllHosts", "(", ")", ";", "for", "(", "ListItemHostWidget", "host", ":", "views", ")", "{", "if", "(", "host", ".", "isSelected", "(", ")", ")", "{", "host", ".", "setSelected", "(", "false", ")", ";", "updateLayout", "=", "true", ";", "if", "(", "requestLayout", ")", "{", "host", ".", "requestLayout", "(", ")", ";", "}", "}", "}", "clearSelectedItemsList", "(", ")", ";", "return", "updateLayout", ";", "}" ]
Clear the selection of all items. @param requestLayout request layout after clear selection if the flag is true, no layout requested otherwise @return {@code true} if at least one item was deselected, {@code false} otherwise.
[ "Clear", "the", "selection", "of", "all", "items", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L469-L485
161,745
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java
ListWidget.updateSelectedItemsList
public boolean updateSelectedItemsList(int dataIndex, boolean select) { boolean done = false; boolean contains = isSelected(dataIndex); if (select) { if (!contains) { if (!mMultiSelectionSupported) { clearSelection(false); } Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "updateSelectedItemsList add index = %d", dataIndex); mSelectedItemsList.add(dataIndex); done = true; } } else { if (contains) { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "updateSelectedItemsList remove index = %d", dataIndex); mSelectedItemsList.remove(dataIndex); done = true; } } return done; }
java
public boolean updateSelectedItemsList(int dataIndex, boolean select) { boolean done = false; boolean contains = isSelected(dataIndex); if (select) { if (!contains) { if (!mMultiSelectionSupported) { clearSelection(false); } Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "updateSelectedItemsList add index = %d", dataIndex); mSelectedItemsList.add(dataIndex); done = true; } } else { if (contains) { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "updateSelectedItemsList remove index = %d", dataIndex); mSelectedItemsList.remove(dataIndex); done = true; } } return done; }
[ "public", "boolean", "updateSelectedItemsList", "(", "int", "dataIndex", ",", "boolean", "select", ")", "{", "boolean", "done", "=", "false", ";", "boolean", "contains", "=", "isSelected", "(", "dataIndex", ")", ";", "if", "(", "select", ")", "{", "if", "(", "!", "contains", ")", "{", "if", "(", "!", "mMultiSelectionSupported", ")", "{", "clearSelection", "(", "false", ")", ";", "}", "Log", ".", "d", "(", "Log", ".", "SUBSYSTEM", ".", "LAYOUT", ",", "TAG", ",", "\"updateSelectedItemsList add index = %d\"", ",", "dataIndex", ")", ";", "mSelectedItemsList", ".", "add", "(", "dataIndex", ")", ";", "done", "=", "true", ";", "}", "}", "else", "{", "if", "(", "contains", ")", "{", "Log", ".", "d", "(", "Log", ".", "SUBSYSTEM", ".", "LAYOUT", ",", "TAG", ",", "\"updateSelectedItemsList remove index = %d\"", ",", "dataIndex", ")", ";", "mSelectedItemsList", ".", "remove", "(", "dataIndex", ")", ";", "done", "=", "true", ";", "}", "}", "return", "done", ";", "}" ]
Update the selection state of the item @param dataIndex data set index @param select if it is true the item is marked as selected, otherwise - unselected @return true if the selection state has been changed successfully, otherwise - false
[ "Update", "the", "selection", "state", "of", "the", "item" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L546-L566
161,746
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java
ListWidget.onScrollImpl
private void onScrollImpl(final Vector3Axis offset, final LayoutScroller.OnScrollListener listener) { if (!isScrolling()) { mScroller = new ScrollingProcessor(offset, listener); mScroller.scroll(); } }
java
private void onScrollImpl(final Vector3Axis offset, final LayoutScroller.OnScrollListener listener) { if (!isScrolling()) { mScroller = new ScrollingProcessor(offset, listener); mScroller.scroll(); } }
[ "private", "void", "onScrollImpl", "(", "final", "Vector3Axis", "offset", ",", "final", "LayoutScroller", ".", "OnScrollListener", "listener", ")", "{", "if", "(", "!", "isScrolling", "(", ")", ")", "{", "mScroller", "=", "new", "ScrollingProcessor", "(", "offset", ",", "listener", ")", ";", "mScroller", ".", "scroll", "(", ")", ";", "}", "}" ]
This method is called if the data set has been scrolled.
[ "This", "method", "is", "called", "if", "the", "data", "set", "has", "been", "scrolled", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L1184-L1189
161,747
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java
ListWidget.recycleChildren
protected void recycleChildren() { for (ListItemHostWidget host: getAllHosts()) { recycle(host); } mContent.onTransformChanged(); mContent.requestLayout(); }
java
protected void recycleChildren() { for (ListItemHostWidget host: getAllHosts()) { recycle(host); } mContent.onTransformChanged(); mContent.requestLayout(); }
[ "protected", "void", "recycleChildren", "(", ")", "{", "for", "(", "ListItemHostWidget", "host", ":", "getAllHosts", "(", ")", ")", "{", "recycle", "(", "host", ")", ";", "}", "mContent", ".", "onTransformChanged", "(", ")", ";", "mContent", ".", "requestLayout", "(", ")", ";", "}" ]
Recycle all views in the list. The host views might be reused for other data to save resources on creating new widgets.
[ "Recycle", "all", "views", "in", "the", "list", ".", "The", "host", "views", "might", "be", "reused", "for", "other", "data", "to", "save", "resources", "on", "creating", "new", "widgets", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L1228-L1234
161,748
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java
ListWidget.onChangedImpl
private void onChangedImpl(final int preferableCenterPosition) { for (ListOnChangedListener listener: mOnChangedListeners) { listener.onChangedStart(this); } Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "onChangedImpl(%s): items [%d] views [%d] mLayouts.size() = %d " + "preferableCenterPosition = %d", getName(), getDataCount(), getViewCount(), mContent.mLayouts.size(), preferableCenterPosition); // TODO: selectively recycle data based on the changes in the data set mPreferableCenterPosition = preferableCenterPosition; recycleChildren(); }
java
private void onChangedImpl(final int preferableCenterPosition) { for (ListOnChangedListener listener: mOnChangedListeners) { listener.onChangedStart(this); } Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "onChangedImpl(%s): items [%d] views [%d] mLayouts.size() = %d " + "preferableCenterPosition = %d", getName(), getDataCount(), getViewCount(), mContent.mLayouts.size(), preferableCenterPosition); // TODO: selectively recycle data based on the changes in the data set mPreferableCenterPosition = preferableCenterPosition; recycleChildren(); }
[ "private", "void", "onChangedImpl", "(", "final", "int", "preferableCenterPosition", ")", "{", "for", "(", "ListOnChangedListener", "listener", ":", "mOnChangedListeners", ")", "{", "listener", ".", "onChangedStart", "(", "this", ")", ";", "}", "Log", ".", "d", "(", "Log", ".", "SUBSYSTEM", ".", "LAYOUT", ",", "TAG", ",", "\"onChangedImpl(%s): items [%d] views [%d] mLayouts.size() = %d \"", "+", "\"preferableCenterPosition = %d\"", ",", "getName", "(", ")", ",", "getDataCount", "(", ")", ",", "getViewCount", "(", ")", ",", "mContent", ".", "mLayouts", ".", "size", "(", ")", ",", "preferableCenterPosition", ")", ";", "// TODO: selectively recycle data based on the changes in the data set", "mPreferableCenterPosition", "=", "preferableCenterPosition", ";", "recycleChildren", "(", ")", ";", "}" ]
This method is called if the data set has been changed. Subclasses might want to override this method to add some extra logic. Go through all items in the list: - reuse the existing views in the list - add new views in the list if needed - trim the unused views - request re-layout @param preferableCenterPosition the preferable center position. If it is -1 - keep the current center position.
[ "This", "method", "is", "called", "if", "the", "data", "set", "has", "been", "changed", ".", "Subclasses", "might", "want", "to", "override", "this", "method", "to", "add", "some", "extra", "logic", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L1273-L1285
161,749
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsoleFactory.java
GVRConsoleFactory.createTerminalConsoleShell
static Shell createTerminalConsoleShell(String prompt, String appName, ShellCommandHandler mainHandler, InputStream input, OutputStream output) { try { PrintStream out = new PrintStream(output); // Build jline terminal jline.Terminal term = TerminalFactory.get(); final ConsoleReader console = new ConsoleReader(input, output, term); console.setBellEnabled(true); console.setHistoryEnabled(true); // Build console BufferedReader in = new BufferedReader(new InputStreamReader( new ConsoleReaderInputStream(console))); ConsoleIO.PromptListener promptListener = new ConsoleIO.PromptListener() { @Override public boolean onPrompt(String prompt) { console.setPrompt(prompt); return true; // suppress normal prompt } }; return createConsoleShell(prompt, appName, mainHandler, in, out, out, promptListener); } catch (Exception e) { // Failover: use default shell BufferedReader in = new BufferedReader(new InputStreamReader(input)); PrintStream out = new PrintStream(output); return createConsoleShell(prompt, appName, mainHandler, in, out, out, null); } }
java
static Shell createTerminalConsoleShell(String prompt, String appName, ShellCommandHandler mainHandler, InputStream input, OutputStream output) { try { PrintStream out = new PrintStream(output); // Build jline terminal jline.Terminal term = TerminalFactory.get(); final ConsoleReader console = new ConsoleReader(input, output, term); console.setBellEnabled(true); console.setHistoryEnabled(true); // Build console BufferedReader in = new BufferedReader(new InputStreamReader( new ConsoleReaderInputStream(console))); ConsoleIO.PromptListener promptListener = new ConsoleIO.PromptListener() { @Override public boolean onPrompt(String prompt) { console.setPrompt(prompt); return true; // suppress normal prompt } }; return createConsoleShell(prompt, appName, mainHandler, in, out, out, promptListener); } catch (Exception e) { // Failover: use default shell BufferedReader in = new BufferedReader(new InputStreamReader(input)); PrintStream out = new PrintStream(output); return createConsoleShell(prompt, appName, mainHandler, in, out, out, null); } }
[ "static", "Shell", "createTerminalConsoleShell", "(", "String", "prompt", ",", "String", "appName", ",", "ShellCommandHandler", "mainHandler", ",", "InputStream", "input", ",", "OutputStream", "output", ")", "{", "try", "{", "PrintStream", "out", "=", "new", "PrintStream", "(", "output", ")", ";", "// Build jline terminal", "jline", ".", "Terminal", "term", "=", "TerminalFactory", ".", "get", "(", ")", ";", "final", "ConsoleReader", "console", "=", "new", "ConsoleReader", "(", "input", ",", "output", ",", "term", ")", ";", "console", ".", "setBellEnabled", "(", "true", ")", ";", "console", ".", "setHistoryEnabled", "(", "true", ")", ";", "// Build console", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "new", "ConsoleReaderInputStream", "(", "console", ")", ")", ")", ";", "ConsoleIO", ".", "PromptListener", "promptListener", "=", "new", "ConsoleIO", ".", "PromptListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPrompt", "(", "String", "prompt", ")", "{", "console", ".", "setPrompt", "(", "prompt", ")", ";", "return", "true", ";", "// suppress normal prompt", "}", "}", ";", "return", "createConsoleShell", "(", "prompt", ",", "appName", ",", "mainHandler", ",", "in", ",", "out", ",", "out", ",", "promptListener", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// Failover: use default shell", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "input", ")", ")", ";", "PrintStream", "out", "=", "new", "PrintStream", "(", "output", ")", ";", "return", "createConsoleShell", "(", "prompt", ",", "appName", ",", "mainHandler", ",", "in", ",", "out", ",", "out", ",", "null", ")", ";", "}", "}" ]
Facade method for operating the Unix-like terminal supporting line editing and command history. @param prompt Prompt to be displayed @param appName The app name string @param mainHandler Main command handler @param input Input stream. @param output Output stream. @return Shell that can be either further customized or run directly by calling commandLoop().
[ "Facade", "method", "for", "operating", "the", "Unix", "-", "like", "terminal", "supporting", "line", "editing", "and", "command", "history", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsoleFactory.java#L97-L128
161,750
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsoleFactory.java
GVRConsoleFactory.createTelnetConsoleShell
static Shell createTelnetConsoleShell(String prompt, String appName, ShellCommandHandler mainHandler, InputStream input, OutputStream output) { try { // Set up nvt4j; ignore the initial clear & reposition final nvt4j.impl.Terminal nvt4jTerminal = new nvt4j.impl.Terminal(input, output) { private boolean cleared; private boolean moved; @Override public void clear() throws IOException { if (this.cleared) super.clear(); this.cleared = true; } @Override public void move(int row, int col) throws IOException { if (this.moved) super.move(row, col); this.moved = true; } }; nvt4jTerminal.put(nvt4j.impl.Terminal.AUTO_WRAP_ON); nvt4jTerminal.setCursor(true); // Have JLine do input & output through telnet terminal final InputStream jlineInput = new InputStream() { @Override public int read() throws IOException { return nvt4jTerminal.get(); } }; final OutputStream jlineOutput = new OutputStream() { @Override public void write(int value) throws IOException { nvt4jTerminal.put(value); } }; return createTerminalConsoleShell(prompt, appName, mainHandler, jlineInput, jlineOutput); } catch (Exception e) { // Failover: use default shell BufferedReader in = new BufferedReader(new InputStreamReader(input)); PrintStream out = new PrintStream(output); return createConsoleShell(prompt, appName, mainHandler, in, out, out, null); } }
java
static Shell createTelnetConsoleShell(String prompt, String appName, ShellCommandHandler mainHandler, InputStream input, OutputStream output) { try { // Set up nvt4j; ignore the initial clear & reposition final nvt4j.impl.Terminal nvt4jTerminal = new nvt4j.impl.Terminal(input, output) { private boolean cleared; private boolean moved; @Override public void clear() throws IOException { if (this.cleared) super.clear(); this.cleared = true; } @Override public void move(int row, int col) throws IOException { if (this.moved) super.move(row, col); this.moved = true; } }; nvt4jTerminal.put(nvt4j.impl.Terminal.AUTO_WRAP_ON); nvt4jTerminal.setCursor(true); // Have JLine do input & output through telnet terminal final InputStream jlineInput = new InputStream() { @Override public int read() throws IOException { return nvt4jTerminal.get(); } }; final OutputStream jlineOutput = new OutputStream() { @Override public void write(int value) throws IOException { nvt4jTerminal.put(value); } }; return createTerminalConsoleShell(prompt, appName, mainHandler, jlineInput, jlineOutput); } catch (Exception e) { // Failover: use default shell BufferedReader in = new BufferedReader(new InputStreamReader(input)); PrintStream out = new PrintStream(output); return createConsoleShell(prompt, appName, mainHandler, in, out, out, null); } }
[ "static", "Shell", "createTelnetConsoleShell", "(", "String", "prompt", ",", "String", "appName", ",", "ShellCommandHandler", "mainHandler", ",", "InputStream", "input", ",", "OutputStream", "output", ")", "{", "try", "{", "// Set up nvt4j; ignore the initial clear & reposition", "final", "nvt4j", ".", "impl", ".", "Terminal", "nvt4jTerminal", "=", "new", "nvt4j", ".", "impl", ".", "Terminal", "(", "input", ",", "output", ")", "{", "private", "boolean", "cleared", ";", "private", "boolean", "moved", ";", "@", "Override", "public", "void", "clear", "(", ")", "throws", "IOException", "{", "if", "(", "this", ".", "cleared", ")", "super", ".", "clear", "(", ")", ";", "this", ".", "cleared", "=", "true", ";", "}", "@", "Override", "public", "void", "move", "(", "int", "row", ",", "int", "col", ")", "throws", "IOException", "{", "if", "(", "this", ".", "moved", ")", "super", ".", "move", "(", "row", ",", "col", ")", ";", "this", ".", "moved", "=", "true", ";", "}", "}", ";", "nvt4jTerminal", ".", "put", "(", "nvt4j", ".", "impl", ".", "Terminal", ".", "AUTO_WRAP_ON", ")", ";", "nvt4jTerminal", ".", "setCursor", "(", "true", ")", ";", "// Have JLine do input & output through telnet terminal", "final", "InputStream", "jlineInput", "=", "new", "InputStream", "(", ")", "{", "@", "Override", "public", "int", "read", "(", ")", "throws", "IOException", "{", "return", "nvt4jTerminal", ".", "get", "(", ")", ";", "}", "}", ";", "final", "OutputStream", "jlineOutput", "=", "new", "OutputStream", "(", ")", "{", "@", "Override", "public", "void", "write", "(", "int", "value", ")", "throws", "IOException", "{", "nvt4jTerminal", ".", "put", "(", "value", ")", ";", "}", "}", ";", "return", "createTerminalConsoleShell", "(", "prompt", ",", "appName", ",", "mainHandler", ",", "jlineInput", ",", "jlineOutput", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// Failover: use default shell", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "input", ")", ")", ";", "PrintStream", "out", "=", "new", "PrintStream", "(", "output", ")", ";", "return", "createConsoleShell", "(", "prompt", ",", "appName", ",", "mainHandler", ",", "in", ",", "out", ",", "out", ",", "null", ")", ";", "}", "}" ]
Facade method for operating the Telnet Shell supporting line editing and command history over a socket. @param prompt Prompt to be displayed @param appName The app name string @param mainHandler Main command handler @param input Input stream. @param output Output stream. @return Shell that can be either further customized or run directly by calling commandLoop().
[ "Facade", "method", "for", "operating", "the", "Telnet", "Shell", "supporting", "line", "editing", "and", "command", "history", "over", "a", "socket", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsoleFactory.java#L141-L188
161,751
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/LODmanager.java
LODmanager.AddLODSceneObject
protected void AddLODSceneObject(GVRSceneObject currentSceneObject) { if (this.transformLODSceneObject != null) { GVRSceneObject levelOfDetailSceneObject = null; if ( currentSceneObject.getParent() == this.transformLODSceneObject) { levelOfDetailSceneObject = currentSceneObject; } else { GVRSceneObject lodSceneObj = root.getSceneObjectByName((currentSceneObject.getName() + TRANSFORM_TRANSLATION_)); if ( lodSceneObj != null ) { if (lodSceneObj.getParent() == this.transformLODSceneObject) { levelOfDetailSceneObject = lodSceneObj; } } if (levelOfDetailSceneObject == null) { lodSceneObj = root.getSceneObjectByName((currentSceneObject.getName() + TRANSFORM_ROTATION_)); if ( lodSceneObj != null ) { if (lodSceneObj.getParent() == this.transformLODSceneObject) { levelOfDetailSceneObject = lodSceneObj; } } } if (levelOfDetailSceneObject == null) { lodSceneObj = root.getSceneObjectByName((currentSceneObject.getName() + TRANSFORM_SCALE_)); if ( lodSceneObj != null ) { if (lodSceneObj.getParent() == this.transformLODSceneObject) { levelOfDetailSceneObject = lodSceneObj; } } } } if ( levelOfDetailSceneObject != null) { final GVRLODGroup lodGroup = (GVRLODGroup) this.transformLODSceneObject.getComponent(GVRLODGroup.getComponentType()); lodGroup.addRange(this.getMinRange(), levelOfDetailSceneObject); this.increment(); } } }
java
protected void AddLODSceneObject(GVRSceneObject currentSceneObject) { if (this.transformLODSceneObject != null) { GVRSceneObject levelOfDetailSceneObject = null; if ( currentSceneObject.getParent() == this.transformLODSceneObject) { levelOfDetailSceneObject = currentSceneObject; } else { GVRSceneObject lodSceneObj = root.getSceneObjectByName((currentSceneObject.getName() + TRANSFORM_TRANSLATION_)); if ( lodSceneObj != null ) { if (lodSceneObj.getParent() == this.transformLODSceneObject) { levelOfDetailSceneObject = lodSceneObj; } } if (levelOfDetailSceneObject == null) { lodSceneObj = root.getSceneObjectByName((currentSceneObject.getName() + TRANSFORM_ROTATION_)); if ( lodSceneObj != null ) { if (lodSceneObj.getParent() == this.transformLODSceneObject) { levelOfDetailSceneObject = lodSceneObj; } } } if (levelOfDetailSceneObject == null) { lodSceneObj = root.getSceneObjectByName((currentSceneObject.getName() + TRANSFORM_SCALE_)); if ( lodSceneObj != null ) { if (lodSceneObj.getParent() == this.transformLODSceneObject) { levelOfDetailSceneObject = lodSceneObj; } } } } if ( levelOfDetailSceneObject != null) { final GVRLODGroup lodGroup = (GVRLODGroup) this.transformLODSceneObject.getComponent(GVRLODGroup.getComponentType()); lodGroup.addRange(this.getMinRange(), levelOfDetailSceneObject); this.increment(); } } }
[ "protected", "void", "AddLODSceneObject", "(", "GVRSceneObject", "currentSceneObject", ")", "{", "if", "(", "this", ".", "transformLODSceneObject", "!=", "null", ")", "{", "GVRSceneObject", "levelOfDetailSceneObject", "=", "null", ";", "if", "(", "currentSceneObject", ".", "getParent", "(", ")", "==", "this", ".", "transformLODSceneObject", ")", "{", "levelOfDetailSceneObject", "=", "currentSceneObject", ";", "}", "else", "{", "GVRSceneObject", "lodSceneObj", "=", "root", ".", "getSceneObjectByName", "(", "(", "currentSceneObject", ".", "getName", "(", ")", "+", "TRANSFORM_TRANSLATION_", ")", ")", ";", "if", "(", "lodSceneObj", "!=", "null", ")", "{", "if", "(", "lodSceneObj", ".", "getParent", "(", ")", "==", "this", ".", "transformLODSceneObject", ")", "{", "levelOfDetailSceneObject", "=", "lodSceneObj", ";", "}", "}", "if", "(", "levelOfDetailSceneObject", "==", "null", ")", "{", "lodSceneObj", "=", "root", ".", "getSceneObjectByName", "(", "(", "currentSceneObject", ".", "getName", "(", ")", "+", "TRANSFORM_ROTATION_", ")", ")", ";", "if", "(", "lodSceneObj", "!=", "null", ")", "{", "if", "(", "lodSceneObj", ".", "getParent", "(", ")", "==", "this", ".", "transformLODSceneObject", ")", "{", "levelOfDetailSceneObject", "=", "lodSceneObj", ";", "}", "}", "}", "if", "(", "levelOfDetailSceneObject", "==", "null", ")", "{", "lodSceneObj", "=", "root", ".", "getSceneObjectByName", "(", "(", "currentSceneObject", ".", "getName", "(", ")", "+", "TRANSFORM_SCALE_", ")", ")", ";", "if", "(", "lodSceneObj", "!=", "null", ")", "{", "if", "(", "lodSceneObj", ".", "getParent", "(", ")", "==", "this", ".", "transformLODSceneObject", ")", "{", "levelOfDetailSceneObject", "=", "lodSceneObj", ";", "}", "}", "}", "}", "if", "(", "levelOfDetailSceneObject", "!=", "null", ")", "{", "final", "GVRLODGroup", "lodGroup", "=", "(", "GVRLODGroup", ")", "this", ".", "transformLODSceneObject", ".", "getComponent", "(", "GVRLODGroup", ".", "getComponentType", "(", ")", ")", ";", "lodGroup", ".", "addRange", "(", "this", ".", "getMinRange", "(", ")", ",", "levelOfDetailSceneObject", ")", ";", "this", ".", "increment", "(", ")", ";", "}", "}", "}" ]
Add the currentSceneObject to an active Level-of-Detail
[ "Add", "the", "currentSceneObject", "to", "an", "active", "Level", "-", "of", "-", "Detail" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/LODmanager.java#L109-L146
161,752
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/MultiPageWidget.java
MultiPageWidget.applyLayout
@Override public boolean applyLayout(Layout itemLayout) { boolean applied = false; if (itemLayout != null && mItemLayouts.add(itemLayout)) { // apply the layout to all visible pages List<Widget> views = getAllViews(); for (Widget view: views) { view.applyLayout(itemLayout.clone()); } applied = true; } return applied; }
java
@Override public boolean applyLayout(Layout itemLayout) { boolean applied = false; if (itemLayout != null && mItemLayouts.add(itemLayout)) { // apply the layout to all visible pages List<Widget> views = getAllViews(); for (Widget view: views) { view.applyLayout(itemLayout.clone()); } applied = true; } return applied; }
[ "@", "Override", "public", "boolean", "applyLayout", "(", "Layout", "itemLayout", ")", "{", "boolean", "applied", "=", "false", ";", "if", "(", "itemLayout", "!=", "null", "&&", "mItemLayouts", ".", "add", "(", "itemLayout", ")", ")", "{", "// apply the layout to all visible pages", "List", "<", "Widget", ">", "views", "=", "getAllViews", "(", ")", ";", "for", "(", "Widget", "view", ":", "views", ")", "{", "view", ".", "applyLayout", "(", "itemLayout", ".", "clone", "(", ")", ")", ";", "}", "applied", "=", "true", ";", "}", "return", "applied", ";", "}" ]
Apply the layout to the each page in the list @param itemLayout item layout in the page @return true if the new layout is applied successfully, otherwise - false
[ "Apply", "the", "layout", "to", "the", "each", "page", "in", "the", "list" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/MultiPageWidget.java#L172-L185
161,753
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/MultiPageWidget.java
MultiPageWidget.getPageScrollable
public LayoutScroller.ScrollableList getPageScrollable() { return new LayoutScroller.ScrollableList() { @Override public int getScrollingItemsCount() { return MultiPageWidget.super.getScrollingItemsCount(); } @Override public float getViewPortWidth() { return MultiPageWidget.super.getViewPortWidth(); } @Override public float getViewPortHeight() { return MultiPageWidget.super.getViewPortHeight(); } @Override public float getViewPortDepth() { return MultiPageWidget.super.getViewPortDepth(); } @Override public boolean scrollToPosition(int pos, final LayoutScroller.OnScrollListener listener) { return MultiPageWidget.super.scrollToPosition(pos, listener); } @Override public boolean scrollByOffset(float xOffset, float yOffset, float zOffset, final LayoutScroller.OnScrollListener listener) { return MultiPageWidget.super.scrollByOffset(xOffset, yOffset, zOffset, listener); } @Override public void registerDataSetObserver(DataSetObserver observer) { MultiPageWidget.super.registerDataSetObserver(observer); } @Override public void unregisterDataSetObserver(DataSetObserver observer) { MultiPageWidget.super.unregisterDataSetObserver(observer); } @Override public int getCurrentPosition() { return MultiPageWidget.super.getCurrentPosition(); } }; }
java
public LayoutScroller.ScrollableList getPageScrollable() { return new LayoutScroller.ScrollableList() { @Override public int getScrollingItemsCount() { return MultiPageWidget.super.getScrollingItemsCount(); } @Override public float getViewPortWidth() { return MultiPageWidget.super.getViewPortWidth(); } @Override public float getViewPortHeight() { return MultiPageWidget.super.getViewPortHeight(); } @Override public float getViewPortDepth() { return MultiPageWidget.super.getViewPortDepth(); } @Override public boolean scrollToPosition(int pos, final LayoutScroller.OnScrollListener listener) { return MultiPageWidget.super.scrollToPosition(pos, listener); } @Override public boolean scrollByOffset(float xOffset, float yOffset, float zOffset, final LayoutScroller.OnScrollListener listener) { return MultiPageWidget.super.scrollByOffset(xOffset, yOffset, zOffset, listener); } @Override public void registerDataSetObserver(DataSetObserver observer) { MultiPageWidget.super.registerDataSetObserver(observer); } @Override public void unregisterDataSetObserver(DataSetObserver observer) { MultiPageWidget.super.unregisterDataSetObserver(observer); } @Override public int getCurrentPosition() { return MultiPageWidget.super.getCurrentPosition(); } }; }
[ "public", "LayoutScroller", ".", "ScrollableList", "getPageScrollable", "(", ")", "{", "return", "new", "LayoutScroller", ".", "ScrollableList", "(", ")", "{", "@", "Override", "public", "int", "getScrollingItemsCount", "(", ")", "{", "return", "MultiPageWidget", ".", "super", ".", "getScrollingItemsCount", "(", ")", ";", "}", "@", "Override", "public", "float", "getViewPortWidth", "(", ")", "{", "return", "MultiPageWidget", ".", "super", ".", "getViewPortWidth", "(", ")", ";", "}", "@", "Override", "public", "float", "getViewPortHeight", "(", ")", "{", "return", "MultiPageWidget", ".", "super", ".", "getViewPortHeight", "(", ")", ";", "}", "@", "Override", "public", "float", "getViewPortDepth", "(", ")", "{", "return", "MultiPageWidget", ".", "super", ".", "getViewPortDepth", "(", ")", ";", "}", "@", "Override", "public", "boolean", "scrollToPosition", "(", "int", "pos", ",", "final", "LayoutScroller", ".", "OnScrollListener", "listener", ")", "{", "return", "MultiPageWidget", ".", "super", ".", "scrollToPosition", "(", "pos", ",", "listener", ")", ";", "}", "@", "Override", "public", "boolean", "scrollByOffset", "(", "float", "xOffset", ",", "float", "yOffset", ",", "float", "zOffset", ",", "final", "LayoutScroller", ".", "OnScrollListener", "listener", ")", "{", "return", "MultiPageWidget", ".", "super", ".", "scrollByOffset", "(", "xOffset", ",", "yOffset", ",", "zOffset", ",", "listener", ")", ";", "}", "@", "Override", "public", "void", "registerDataSetObserver", "(", "DataSetObserver", "observer", ")", "{", "MultiPageWidget", ".", "super", ".", "registerDataSetObserver", "(", "observer", ")", ";", "}", "@", "Override", "public", "void", "unregisterDataSetObserver", "(", "DataSetObserver", "observer", ")", "{", "MultiPageWidget", ".", "super", ".", "unregisterDataSetObserver", "(", "observer", ")", ";", "}", "@", "Override", "public", "int", "getCurrentPosition", "(", ")", "{", "return", "MultiPageWidget", ".", "super", ".", "getCurrentPosition", "(", ")", ";", "}", "}", ";", "}" ]
Provides the scrollableList implementation for page scrolling @return {@link LayoutScroller.ScrollableList} implementation, passed to {@link LayoutScroller} for the processing the scrolling
[ "Provides", "the", "scrollableList", "implementation", "for", "page", "scrolling" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/MultiPageWidget.java#L376-L426
161,754
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/ViewpointAnimation.java
ViewpointAnimation.startAnimation
public void startAnimation() { Date time = new Date(); this.beginAnimation = time.getTime(); this.endAnimation = beginAnimation + (long) (animationTime * 1000); this.animate = true; }
java
public void startAnimation() { Date time = new Date(); this.beginAnimation = time.getTime(); this.endAnimation = beginAnimation + (long) (animationTime * 1000); this.animate = true; }
[ "public", "void", "startAnimation", "(", ")", "{", "Date", "time", "=", "new", "Date", "(", ")", ";", "this", ".", "beginAnimation", "=", "time", ".", "getTime", "(", ")", ";", "this", ".", "endAnimation", "=", "beginAnimation", "+", "(", "long", ")", "(", "animationTime", "*", "1000", ")", ";", "this", ".", "animate", "=", "true", ";", "}" ]
once animation is setup, start the animation record the beginning and ending time for the animation
[ "once", "animation", "is", "setup", "start", "the", "animation", "record", "the", "beginning", "and", "ending", "time", "for", "the", "animation" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/ViewpointAnimation.java#L99-L105
161,755
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/ViewpointAnimation.java
ViewpointAnimation.updateAnimation
public void updateAnimation() { Date time = new Date(); long currentTime = time.getTime() - this.beginAnimation; if (currentTime > animationTime) { this.currentQuaternion.set(endQuaternion); for (int i = 0; i < 3; i++) { this.currentPos[i] = this.endPos[i]; } this.animate = false; } else { float t = (float) currentTime / animationTime; this.currentQuaternion = this.beginQuaternion.slerp(this.endQuaternion, t); for (int i = 0; i < 3; i++) { this.currentPos[i] = this.beginPos[i] + totalTranslation[i] * t; } } }
java
public void updateAnimation() { Date time = new Date(); long currentTime = time.getTime() - this.beginAnimation; if (currentTime > animationTime) { this.currentQuaternion.set(endQuaternion); for (int i = 0; i < 3; i++) { this.currentPos[i] = this.endPos[i]; } this.animate = false; } else { float t = (float) currentTime / animationTime; this.currentQuaternion = this.beginQuaternion.slerp(this.endQuaternion, t); for (int i = 0; i < 3; i++) { this.currentPos[i] = this.beginPos[i] + totalTranslation[i] * t; } } }
[ "public", "void", "updateAnimation", "(", ")", "{", "Date", "time", "=", "new", "Date", "(", ")", ";", "long", "currentTime", "=", "time", ".", "getTime", "(", ")", "-", "this", ".", "beginAnimation", ";", "if", "(", "currentTime", ">", "animationTime", ")", "{", "this", ".", "currentQuaternion", ".", "set", "(", "endQuaternion", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "this", ".", "currentPos", "[", "i", "]", "=", "this", ".", "endPos", "[", "i", "]", ";", "}", "this", ".", "animate", "=", "false", ";", "}", "else", "{", "float", "t", "=", "(", "float", ")", "currentTime", "/", "animationTime", ";", "this", ".", "currentQuaternion", "=", "this", ".", "beginQuaternion", ".", "slerp", "(", "this", ".", "endQuaternion", ",", "t", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "this", ".", "currentPos", "[", "i", "]", "=", "this", ".", "beginPos", "[", "i", "]", "+", "totalTranslation", "[", "i", "]", "*", "t", ";", "}", "}", "}" ]
called per frame of animation to update the camera position
[ "called", "per", "frame", "of", "animation", "to", "update", "the", "camera", "position" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/ViewpointAnimation.java#L110-L136
161,756
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTextureParameters.java
GVRTextureParameters.getDefalutValuesArray
public int[] getDefalutValuesArray() { int[] defaultValues = new int[5]; defaultValues[0] = GLES20.GL_LINEAR_MIPMAP_NEAREST; // MIN FILTER defaultValues[1] = GLES20.GL_LINEAR; // MAG FILTER defaultValues[2] = 1; // ANISO FILTER defaultValues[3] = GLES20.GL_CLAMP_TO_EDGE; // WRAP S defaultValues[4] = GLES20.GL_CLAMP_TO_EDGE; // WRAP T return defaultValues; }
java
public int[] getDefalutValuesArray() { int[] defaultValues = new int[5]; defaultValues[0] = GLES20.GL_LINEAR_MIPMAP_NEAREST; // MIN FILTER defaultValues[1] = GLES20.GL_LINEAR; // MAG FILTER defaultValues[2] = 1; // ANISO FILTER defaultValues[3] = GLES20.GL_CLAMP_TO_EDGE; // WRAP S defaultValues[4] = GLES20.GL_CLAMP_TO_EDGE; // WRAP T return defaultValues; }
[ "public", "int", "[", "]", "getDefalutValuesArray", "(", ")", "{", "int", "[", "]", "defaultValues", "=", "new", "int", "[", "5", "]", ";", "defaultValues", "[", "0", "]", "=", "GLES20", ".", "GL_LINEAR_MIPMAP_NEAREST", ";", "// MIN FILTER", "defaultValues", "[", "1", "]", "=", "GLES20", ".", "GL_LINEAR", ";", "// MAG FILTER", "defaultValues", "[", "2", "]", "=", "1", ";", "// ANISO FILTER", "defaultValues", "[", "3", "]", "=", "GLES20", ".", "GL_CLAMP_TO_EDGE", ";", "// WRAP S", "defaultValues", "[", "4", "]", "=", "GLES20", ".", "GL_CLAMP_TO_EDGE", ";", "// WRAP T", "return", "defaultValues", ";", "}" ]
Returns an integer array that contains the default values for all the texture parameters. @return an integer array that contains the default values for all the texture parameters.
[ "Returns", "an", "integer", "array", "that", "contains", "the", "default", "values", "for", "all", "the", "texture", "parameters", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTextureParameters.java#L203-L213
161,757
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTextureParameters.java
GVRTextureParameters.getCurrentValuesArray
public int[] getCurrentValuesArray() { int[] currentValues = new int[5]; currentValues[0] = getMinFilterType().getFilterValue(); // MIN FILTER currentValues[1] = getMagFilterType().getFilterValue(); // MAG FILTER currentValues[2] = getAnisotropicValue(); // ANISO FILTER currentValues[3] = getWrapSType().getWrapValue(); // WRAP S currentValues[4] = getWrapTType().getWrapValue(); // WRAP T return currentValues; }
java
public int[] getCurrentValuesArray() { int[] currentValues = new int[5]; currentValues[0] = getMinFilterType().getFilterValue(); // MIN FILTER currentValues[1] = getMagFilterType().getFilterValue(); // MAG FILTER currentValues[2] = getAnisotropicValue(); // ANISO FILTER currentValues[3] = getWrapSType().getWrapValue(); // WRAP S currentValues[4] = getWrapTType().getWrapValue(); // WRAP T return currentValues; }
[ "public", "int", "[", "]", "getCurrentValuesArray", "(", ")", "{", "int", "[", "]", "currentValues", "=", "new", "int", "[", "5", "]", ";", "currentValues", "[", "0", "]", "=", "getMinFilterType", "(", ")", ".", "getFilterValue", "(", ")", ";", "// MIN FILTER", "currentValues", "[", "1", "]", "=", "getMagFilterType", "(", ")", ".", "getFilterValue", "(", ")", ";", "// MAG FILTER", "currentValues", "[", "2", "]", "=", "getAnisotropicValue", "(", ")", ";", "// ANISO FILTER", "currentValues", "[", "3", "]", "=", "getWrapSType", "(", ")", ".", "getWrapValue", "(", ")", ";", "// WRAP S", "currentValues", "[", "4", "]", "=", "getWrapTType", "(", ")", ".", "getWrapValue", "(", ")", ";", "// WRAP T", "return", "currentValues", ";", "}" ]
Returns an integer array that contains the current values for all the texture parameters. @return an integer array that contains the current values for all the texture parameters.
[ "Returns", "an", "integer", "array", "that", "contains", "the", "current", "values", "for", "all", "the", "texture", "parameters", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTextureParameters.java#L222-L232
161,758
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.hasProperties
public boolean hasProperties(Set<PropertyKey> keys) { for (PropertyKey key : keys) { if (null == getProperty(key.m_key)) { return false; } } return true; }
java
public boolean hasProperties(Set<PropertyKey> keys) { for (PropertyKey key : keys) { if (null == getProperty(key.m_key)) { return false; } } return true; }
[ "public", "boolean", "hasProperties", "(", "Set", "<", "PropertyKey", ">", "keys", ")", "{", "for", "(", "PropertyKey", "key", ":", "keys", ")", "{", "if", "(", "null", "==", "getProperty", "(", "key", ".", "m_key", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Checks whether the given set of properties is available. @param keys the keys to check @return true if all properties are available, false otherwise
[ "Checks", "whether", "the", "given", "set", "of", "properties", "is", "available", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L499-L507
161,759
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.getTextureMagFilter
public Integer getTextureMagFilter(AiTextureType type, int index) { checkTexRange(type, index); Property p = getProperty(PropertyKey.TEX_MAG_FILTER.m_key); if (null == p || null == p.getData()) { return (Integer) m_defaults.get(PropertyKey.TEX_MAG_FILTER); } Object rawValue = p.getData(); if (rawValue instanceof java.nio.ByteBuffer) { java.nio.IntBuffer ibuf = ((java.nio.ByteBuffer) rawValue).asIntBuffer(); return ibuf.get(); } else { return (Integer) rawValue; } }
java
public Integer getTextureMagFilter(AiTextureType type, int index) { checkTexRange(type, index); Property p = getProperty(PropertyKey.TEX_MAG_FILTER.m_key); if (null == p || null == p.getData()) { return (Integer) m_defaults.get(PropertyKey.TEX_MAG_FILTER); } Object rawValue = p.getData(); if (rawValue instanceof java.nio.ByteBuffer) { java.nio.IntBuffer ibuf = ((java.nio.ByteBuffer) rawValue).asIntBuffer(); return ibuf.get(); } else { return (Integer) rawValue; } }
[ "public", "Integer", "getTextureMagFilter", "(", "AiTextureType", "type", ",", "int", "index", ")", "{", "checkTexRange", "(", "type", ",", "index", ")", ";", "Property", "p", "=", "getProperty", "(", "PropertyKey", ".", "TEX_MAG_FILTER", ".", "m_key", ")", ";", "if", "(", "null", "==", "p", "||", "null", "==", "p", ".", "getData", "(", ")", ")", "{", "return", "(", "Integer", ")", "m_defaults", ".", "get", "(", "PropertyKey", ".", "TEX_MAG_FILTER", ")", ";", "}", "Object", "rawValue", "=", "p", ".", "getData", "(", ")", ";", "if", "(", "rawValue", "instanceof", "java", ".", "nio", ".", "ByteBuffer", ")", "{", "java", ".", "nio", ".", "IntBuffer", "ibuf", "=", "(", "(", "java", ".", "nio", ".", "ByteBuffer", ")", "rawValue", ")", ".", "asIntBuffer", "(", ")", ";", "return", "ibuf", ".", "get", "(", ")", ";", "}", "else", "{", "return", "(", "Integer", ")", "rawValue", ";", "}", "}" ]
Returns the texture magnification filter If missing, defaults to {@link GL_LINEAR } @param type the texture type @param index the index in the texture stack @return the texture magnification filter
[ "Returns", "the", "texture", "magnification", "filter" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L1051-L1069
161,760
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.getMetallic
public float getMetallic() { Property p = getProperty(PropertyKey.METALLIC.m_key); if (null == p || null == p.getData()) { throw new IllegalArgumentException("Metallic property not found"); } Object rawValue = p.getData(); if (rawValue instanceof java.nio.ByteBuffer) { java.nio.FloatBuffer fbuf = ((java.nio.ByteBuffer) rawValue).asFloatBuffer(); return fbuf.get(); } else { return (Float) rawValue; } }
java
public float getMetallic() { Property p = getProperty(PropertyKey.METALLIC.m_key); if (null == p || null == p.getData()) { throw new IllegalArgumentException("Metallic property not found"); } Object rawValue = p.getData(); if (rawValue instanceof java.nio.ByteBuffer) { java.nio.FloatBuffer fbuf = ((java.nio.ByteBuffer) rawValue).asFloatBuffer(); return fbuf.get(); } else { return (Float) rawValue; } }
[ "public", "float", "getMetallic", "(", ")", "{", "Property", "p", "=", "getProperty", "(", "PropertyKey", ".", "METALLIC", ".", "m_key", ")", ";", "if", "(", "null", "==", "p", "||", "null", "==", "p", ".", "getData", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Metallic property not found\"", ")", ";", "}", "Object", "rawValue", "=", "p", ".", "getData", "(", ")", ";", "if", "(", "rawValue", "instanceof", "java", ".", "nio", ".", "ByteBuffer", ")", "{", "java", ".", "nio", ".", "FloatBuffer", "fbuf", "=", "(", "(", "java", ".", "nio", ".", "ByteBuffer", ")", "rawValue", ")", ".", "asFloatBuffer", "(", ")", ";", "return", "fbuf", ".", "get", "(", ")", ";", "}", "else", "{", "return", "(", "Float", ")", "rawValue", ";", "}", "}" ]
Returns the metallic factor for PBR shading
[ "Returns", "the", "metallic", "factor", "for", "PBR", "shading" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L1074-L1092
161,761
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.getTextureInfo
public AiTextureInfo getTextureInfo(AiTextureType type, int index) { return new AiTextureInfo(type, index, getTextureFile(type, index), getTextureUVIndex(type, index), getBlendFactor(type, index), getTextureOp(type, index), getTextureMapModeW(type, index), getTextureMapModeW(type, index), getTextureMapModeW(type, index)); }
java
public AiTextureInfo getTextureInfo(AiTextureType type, int index) { return new AiTextureInfo(type, index, getTextureFile(type, index), getTextureUVIndex(type, index), getBlendFactor(type, index), getTextureOp(type, index), getTextureMapModeW(type, index), getTextureMapModeW(type, index), getTextureMapModeW(type, index)); }
[ "public", "AiTextureInfo", "getTextureInfo", "(", "AiTextureType", "type", ",", "int", "index", ")", "{", "return", "new", "AiTextureInfo", "(", "type", ",", "index", ",", "getTextureFile", "(", "type", ",", "index", ")", ",", "getTextureUVIndex", "(", "type", ",", "index", ")", ",", "getBlendFactor", "(", "type", ",", "index", ")", ",", "getTextureOp", "(", "type", ",", "index", ")", ",", "getTextureMapModeW", "(", "type", ",", "index", ")", ",", "getTextureMapModeW", "(", "type", ",", "index", ")", ",", "getTextureMapModeW", "(", "type", ",", "index", ")", ")", ";", "}" ]
Returns all information related to a single texture. @param type the texture type @param index the index in the texture stack @return the texture information
[ "Returns", "all", "information", "related", "to", "a", "single", "texture", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L1159-L1165
161,762
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.checkTexRange
private void checkTexRange(AiTextureType type, int index) { if (index < 0 || index > m_numTextures.get(type)) { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + m_numTextures.get(type)); } }
java
private void checkTexRange(AiTextureType type, int index) { if (index < 0 || index > m_numTextures.get(type)) { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + m_numTextures.get(type)); } }
[ "private", "void", "checkTexRange", "(", "AiTextureType", "type", ",", "int", "index", ")", "{", "if", "(", "index", "<", "0", "||", "index", ">", "m_numTextures", ".", "get", "(", "type", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Index: \"", "+", "index", "+", "\", Size: \"", "+", "m_numTextures", ".", "get", "(", "type", ")", ")", ";", "}", "}" ]
Checks that index is valid an throw an exception if not. @param type the type @param index the index to check
[ "Checks", "that", "index", "is", "valid", "an", "throw", "an", "exception", "if", "not", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L1268-L1273
161,763
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.setTextureNumber
@SuppressWarnings("unused") private void setTextureNumber(int type, int number) { m_numTextures.put(AiTextureType.fromRawValue(type), number); }
java
@SuppressWarnings("unused") private void setTextureNumber(int type, int number) { m_numTextures.put(AiTextureType.fromRawValue(type), number); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "private", "void", "setTextureNumber", "(", "int", "type", ",", "int", "number", ")", "{", "m_numTextures", ".", "put", "(", "AiTextureType", ".", "fromRawValue", "(", "type", ")", ",", "number", ")", ";", "}" ]
This method is used by JNI, do not call or modify. @param type the type @param number the number
[ "This", "method", "is", "used", "by", "JNI", "do", "not", "call", "or", "modify", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L1334-L1337
161,764
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java
GVRFrustumPicker.setFrustum
public void setFrustum(float[] frustum) { Matrix4f projMatrix = new Matrix4f(); projMatrix.setFrustum(frustum[0], frustum[3], frustum[1], frustum[4], frustum[2], frustum[5]); setFrustum(projMatrix); }
java
public void setFrustum(float[] frustum) { Matrix4f projMatrix = new Matrix4f(); projMatrix.setFrustum(frustum[0], frustum[3], frustum[1], frustum[4], frustum[2], frustum[5]); setFrustum(projMatrix); }
[ "public", "void", "setFrustum", "(", "float", "[", "]", "frustum", ")", "{", "Matrix4f", "projMatrix", "=", "new", "Matrix4f", "(", ")", ";", "projMatrix", ".", "setFrustum", "(", "frustum", "[", "0", "]", ",", "frustum", "[", "3", "]", ",", "frustum", "[", "1", "]", ",", "frustum", "[", "4", "]", ",", "frustum", "[", "2", "]", ",", "frustum", "[", "5", "]", ")", ";", "setFrustum", "(", "projMatrix", ")", ";", "}" ]
Set the view frustum to pick against from the minimum and maximum corners. The viewpoint of the frustum is the center of the scene object the picker is attached to. The view direction is the forward direction of that scene object. The frustum will pick what a camera attached to the scene object with that view frustum would see. If the frustum is not attached to a scene object, it defaults to the view frustum of the main camera of the scene. @param frustum array of 6 floats as follows: frustum[0] = left corner of frustum frustum[1] = bottom corner of frustum frustum[2] = front corner of frustum (near plane) frustum[3] = right corner of frustum frustum[4] = top corner of frustum frustum[5 = back corner of frustum (far plane)
[ "Set", "the", "view", "frustum", "to", "pick", "against", "from", "the", "minimum", "and", "maximum", "corners", ".", "The", "viewpoint", "of", "the", "frustum", "is", "the", "center", "of", "the", "scene", "object", "the", "picker", "is", "attached", "to", ".", "The", "view", "direction", "is", "the", "forward", "direction", "of", "that", "scene", "object", ".", "The", "frustum", "will", "pick", "what", "a", "camera", "attached", "to", "the", "scene", "object", "with", "that", "view", "frustum", "would", "see", ".", "If", "the", "frustum", "is", "not", "attached", "to", "a", "scene", "object", "it", "defaults", "to", "the", "view", "frustum", "of", "the", "main", "camera", "of", "the", "scene", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java#L92-L97
161,765
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java
GVRFrustumPicker.setFrustum
public void setFrustum(float fovy, float aspect, float znear, float zfar) { Matrix4f projMatrix = new Matrix4f(); projMatrix.perspective((float) Math.toRadians(fovy), aspect, znear, zfar); setFrustum(projMatrix); }
java
public void setFrustum(float fovy, float aspect, float znear, float zfar) { Matrix4f projMatrix = new Matrix4f(); projMatrix.perspective((float) Math.toRadians(fovy), aspect, znear, zfar); setFrustum(projMatrix); }
[ "public", "void", "setFrustum", "(", "float", "fovy", ",", "float", "aspect", ",", "float", "znear", ",", "float", "zfar", ")", "{", "Matrix4f", "projMatrix", "=", "new", "Matrix4f", "(", ")", ";", "projMatrix", ".", "perspective", "(", "(", "float", ")", "Math", ".", "toRadians", "(", "fovy", ")", ",", "aspect", ",", "znear", ",", "zfar", ")", ";", "setFrustum", "(", "projMatrix", ")", ";", "}" ]
Set the view frustum to pick against from the field of view, aspect ratio and near, far clip planes. The viewpoint of the frustum is the center of the scene object the picker is attached to. The view direction is the forward direction of that scene object. The frustum will pick what a camera attached to the scene object with that view frustum would see. If the frustum is not attached to a scene object, it defaults to the view frustum of the main camera of the scene. @param fovy vertical field of view in degrees @param aspect aspect ratio (width / height)
[ "Set", "the", "view", "frustum", "to", "pick", "against", "from", "the", "field", "of", "view", "aspect", "ratio", "and", "near", "far", "clip", "planes", ".", "The", "viewpoint", "of", "the", "frustum", "is", "the", "center", "of", "the", "scene", "object", "the", "picker", "is", "attached", "to", ".", "The", "view", "direction", "is", "the", "forward", "direction", "of", "that", "scene", "object", ".", "The", "frustum", "will", "pick", "what", "a", "camera", "attached", "to", "the", "scene", "object", "with", "that", "view", "frustum", "would", "see", ".", "If", "the", "frustum", "is", "not", "attached", "to", "a", "scene", "object", "it", "defaults", "to", "the", "view", "frustum", "of", "the", "main", "camera", "of", "the", "scene", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java#L112-L117
161,766
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java
GVRFrustumPicker.setFrustum
public void setFrustum(Matrix4f projMatrix) { if (projMatrix != null) { if (mProjMatrix == null) { mProjMatrix = new float[16]; } mProjMatrix = projMatrix.get(mProjMatrix, 0); mScene.setPickVisible(false); if (mCuller != null) { mCuller.set(projMatrix); } else { mCuller = new FrustumIntersection(projMatrix); } } mProjection = projMatrix; }
java
public void setFrustum(Matrix4f projMatrix) { if (projMatrix != null) { if (mProjMatrix == null) { mProjMatrix = new float[16]; } mProjMatrix = projMatrix.get(mProjMatrix, 0); mScene.setPickVisible(false); if (mCuller != null) { mCuller.set(projMatrix); } else { mCuller = new FrustumIntersection(projMatrix); } } mProjection = projMatrix; }
[ "public", "void", "setFrustum", "(", "Matrix4f", "projMatrix", ")", "{", "if", "(", "projMatrix", "!=", "null", ")", "{", "if", "(", "mProjMatrix", "==", "null", ")", "{", "mProjMatrix", "=", "new", "float", "[", "16", "]", ";", "}", "mProjMatrix", "=", "projMatrix", ".", "get", "(", "mProjMatrix", ",", "0", ")", ";", "mScene", ".", "setPickVisible", "(", "false", ")", ";", "if", "(", "mCuller", "!=", "null", ")", "{", "mCuller", ".", "set", "(", "projMatrix", ")", ";", "}", "else", "{", "mCuller", "=", "new", "FrustumIntersection", "(", "projMatrix", ")", ";", "}", "}", "mProjection", "=", "projMatrix", ";", "}" ]
Set the view frustum to pick against from the given projection matrix. If the projection matrix is null, the picker will revert to picking objects that are visible from the viewpoint of the scene's current camera. If a matrix is given, the picker will pick objects that are visible from the viewpoint of it's owner the given projection matrix. @param projMatrix 4x4 projection matrix or null @see GVRScene#setPickVisible(boolean)
[ "Set", "the", "view", "frustum", "to", "pick", "against", "from", "the", "given", "projection", "matrix", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java#L130-L150
161,767
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java
GVRFrustumPicker.pickVisible
public static final GVRPickedObject[] pickVisible(GVRScene scene) { sFindObjectsLock.lock(); try { final GVRPickedObject[] result = NativePicker.pickVisible(scene.getNative()); return result; } finally { sFindObjectsLock.unlock(); } }
java
public static final GVRPickedObject[] pickVisible(GVRScene scene) { sFindObjectsLock.lock(); try { final GVRPickedObject[] result = NativePicker.pickVisible(scene.getNative()); return result; } finally { sFindObjectsLock.unlock(); } }
[ "public", "static", "final", "GVRPickedObject", "[", "]", "pickVisible", "(", "GVRScene", "scene", ")", "{", "sFindObjectsLock", ".", "lock", "(", ")", ";", "try", "{", "final", "GVRPickedObject", "[", "]", "result", "=", "NativePicker", ".", "pickVisible", "(", "scene", ".", "getNative", "(", ")", ")", ";", "return", "result", ";", "}", "finally", "{", "sFindObjectsLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Returns the list of colliders attached to scene objects that are visible from the viewpoint of the camera. <p> This method is thread safe because it guarantees that only one thread at a time is picking against particular scene graph, and it extracts the hit data during within its synchronized block. You can then examine the return list without worrying about another thread corrupting your hit data. The hit location returned is the world position of the scene object center. @param scene The {@link GVRScene} with all the objects to be tested. @return A list of {@link org.gearvrf.GVRPicker.GVRPickedObject}, sorted by distance from the camera rig. Each {@link org.gearvrf.GVRPicker.GVRPickedObject} contains the scene object which owns the {@link GVRCollider} along with the hit location and distance from the camera. @since 1.6.6
[ "Returns", "the", "list", "of", "colliders", "attached", "to", "scene", "objects", "that", "are", "visible", "from", "the", "viewpoint", "of", "the", "camera", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java#L240-L248
161,768
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRIndexBuffer.java
GVRIndexBuffer.setShortVec
public void setShortVec(char[] data) { if (data == null) { throw new IllegalArgumentException("Input data for indices cannot be null"); } if (getIndexSize() != 2) { throw new UnsupportedOperationException("Cannot update integer indices with char array"); } if (!NativeIndexBuffer.setShortArray(getNative(), data)) { throw new UnsupportedOperationException("Input array is wrong size"); } }
java
public void setShortVec(char[] data) { if (data == null) { throw new IllegalArgumentException("Input data for indices cannot be null"); } if (getIndexSize() != 2) { throw new UnsupportedOperationException("Cannot update integer indices with char array"); } if (!NativeIndexBuffer.setShortArray(getNative(), data)) { throw new UnsupportedOperationException("Input array is wrong size"); } }
[ "public", "void", "setShortVec", "(", "char", "[", "]", "data", ")", "{", "if", "(", "data", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Input data for indices cannot be null\"", ")", ";", "}", "if", "(", "getIndexSize", "(", ")", "!=", "2", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Cannot update integer indices with char array\"", ")", ";", "}", "if", "(", "!", "NativeIndexBuffer", ".", "setShortArray", "(", "getNative", "(", ")", ",", "data", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Input array is wrong size\"", ")", ";", "}", "}" ]
Updates the indices in the index buffer from a Java char array. All of the entries of the input char array are copied into the storage for the index buffer. The new indices must be the same size as the old indices - the index buffer size cannot be changed. @param data char array containing the new values @throws IllegalArgumentException if char array is wrong size
[ "Updates", "the", "indices", "in", "the", "index", "buffer", "from", "a", "Java", "char", "array", ".", "All", "of", "the", "entries", "of", "the", "input", "char", "array", "are", "copied", "into", "the", "storage", "for", "the", "index", "buffer", ".", "The", "new", "indices", "must", "be", "the", "same", "size", "as", "the", "old", "indices", "-", "the", "index", "buffer", "size", "cannot", "be", "changed", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRIndexBuffer.java#L192-L206
161,769
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRIndexBuffer.java
GVRIndexBuffer.setShortVec
public void setShortVec(CharBuffer data) { if (data == null) { throw new IllegalArgumentException("Input data for indices cannot be null"); } if (getIndexSize() != 2) { throw new UnsupportedOperationException("Cannot update integer indices with char array"); } if (data.isDirect()) { if (!NativeIndexBuffer.setShortVec(getNative(), data)) { throw new UnsupportedOperationException("Input buffer is wrong size"); } } else if (data.hasArray()) { if (!NativeIndexBuffer.setShortArray(getNative(), data.array())) { throw new UnsupportedOperationException("Input buffer is wrong size"); } } else { throw new UnsupportedOperationException( "CharBuffer type not supported. Must be direct or have backing array"); } }
java
public void setShortVec(CharBuffer data) { if (data == null) { throw new IllegalArgumentException("Input data for indices cannot be null"); } if (getIndexSize() != 2) { throw new UnsupportedOperationException("Cannot update integer indices with char array"); } if (data.isDirect()) { if (!NativeIndexBuffer.setShortVec(getNative(), data)) { throw new UnsupportedOperationException("Input buffer is wrong size"); } } else if (data.hasArray()) { if (!NativeIndexBuffer.setShortArray(getNative(), data.array())) { throw new UnsupportedOperationException("Input buffer is wrong size"); } } else { throw new UnsupportedOperationException( "CharBuffer type not supported. Must be direct or have backing array"); } }
[ "public", "void", "setShortVec", "(", "CharBuffer", "data", ")", "{", "if", "(", "data", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Input data for indices cannot be null\"", ")", ";", "}", "if", "(", "getIndexSize", "(", ")", "!=", "2", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Cannot update integer indices with char array\"", ")", ";", "}", "if", "(", "data", ".", "isDirect", "(", ")", ")", "{", "if", "(", "!", "NativeIndexBuffer", ".", "setShortVec", "(", "getNative", "(", ")", ",", "data", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Input buffer is wrong size\"", ")", ";", "}", "}", "else", "if", "(", "data", ".", "hasArray", "(", ")", ")", "{", "if", "(", "!", "NativeIndexBuffer", ".", "setShortArray", "(", "getNative", "(", ")", ",", "data", ".", "array", "(", ")", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Input buffer is wrong size\"", ")", ";", "}", "}", "else", "{", "throw", "new", "UnsupportedOperationException", "(", "\"CharBuffer type not supported. Must be direct or have backing array\"", ")", ";", "}", "}" ]
Updates the indices in the index buffer from a Java CharBuffer. All of the entries of the input buffer are copied into the storage for the index buffer. The new indices must be the same size as the old indices - the index buffer size cannot be changed. @param data CharBuffer containing the new values @throws IllegalArgumentException if char array is wrong size
[ "Updates", "the", "indices", "in", "the", "index", "buffer", "from", "a", "Java", "CharBuffer", ".", "All", "of", "the", "entries", "of", "the", "input", "buffer", "are", "copied", "into", "the", "storage", "for", "the", "index", "buffer", ".", "The", "new", "indices", "must", "be", "the", "same", "size", "as", "the", "old", "indices", "-", "the", "index", "buffer", "size", "cannot", "be", "changed", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRIndexBuffer.java#L216-L245
161,770
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRIndexBuffer.java
GVRIndexBuffer.setIntVec
public void setIntVec(int[] data) { if (data == null) { throw new IllegalArgumentException("Input data for indices cannot be null"); } if (getIndexSize() != 4) { throw new UnsupportedOperationException("Cannot update short indices with int array"); } if (!NativeIndexBuffer.setIntArray(getNative(), data)) { throw new UnsupportedOperationException("Input array is wrong size"); } }
java
public void setIntVec(int[] data) { if (data == null) { throw new IllegalArgumentException("Input data for indices cannot be null"); } if (getIndexSize() != 4) { throw new UnsupportedOperationException("Cannot update short indices with int array"); } if (!NativeIndexBuffer.setIntArray(getNative(), data)) { throw new UnsupportedOperationException("Input array is wrong size"); } }
[ "public", "void", "setIntVec", "(", "int", "[", "]", "data", ")", "{", "if", "(", "data", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Input data for indices cannot be null\"", ")", ";", "}", "if", "(", "getIndexSize", "(", ")", "!=", "4", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Cannot update short indices with int array\"", ")", ";", "}", "if", "(", "!", "NativeIndexBuffer", ".", "setIntArray", "(", "getNative", "(", ")", ",", "data", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Input array is wrong size\"", ")", ";", "}", "}" ]
Updates the indices in the index buffer from a Java int array. All of the entries of the input int array are copied into the storage for the index buffer. The new indices must be the same size as the old indices - the index buffer size cannot be changed. @param data char array containing the new values @throws IllegalArgumentException if int array is wrong size
[ "Updates", "the", "indices", "in", "the", "index", "buffer", "from", "a", "Java", "int", "array", ".", "All", "of", "the", "entries", "of", "the", "input", "int", "array", "are", "copied", "into", "the", "storage", "for", "the", "index", "buffer", ".", "The", "new", "indices", "must", "be", "the", "same", "size", "as", "the", "old", "indices", "-", "the", "index", "buffer", "size", "cannot", "be", "changed", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRIndexBuffer.java#L255-L269
161,771
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRIndexBuffer.java
GVRIndexBuffer.setIntVec
public void setIntVec(IntBuffer data) { if (data == null) { throw new IllegalArgumentException("Input buffer for indices cannot be null"); } if (getIndexSize() != 4) { throw new UnsupportedOperationException("Cannot update integer indices with short array"); } if (data.isDirect()) { if (!NativeIndexBuffer.setIntVec(getNative(), data)) { throw new UnsupportedOperationException("Input array is wrong size"); } } else if (data.hasArray()) { if (!NativeIndexBuffer.setIntArray(getNative(), data.array())) { throw new IllegalArgumentException("Data array incompatible with index buffer"); } } else { throw new UnsupportedOperationException("IntBuffer type not supported. Must be direct or have backing array"); } }
java
public void setIntVec(IntBuffer data) { if (data == null) { throw new IllegalArgumentException("Input buffer for indices cannot be null"); } if (getIndexSize() != 4) { throw new UnsupportedOperationException("Cannot update integer indices with short array"); } if (data.isDirect()) { if (!NativeIndexBuffer.setIntVec(getNative(), data)) { throw new UnsupportedOperationException("Input array is wrong size"); } } else if (data.hasArray()) { if (!NativeIndexBuffer.setIntArray(getNative(), data.array())) { throw new IllegalArgumentException("Data array incompatible with index buffer"); } } else { throw new UnsupportedOperationException("IntBuffer type not supported. Must be direct or have backing array"); } }
[ "public", "void", "setIntVec", "(", "IntBuffer", "data", ")", "{", "if", "(", "data", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Input buffer for indices cannot be null\"", ")", ";", "}", "if", "(", "getIndexSize", "(", ")", "!=", "4", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Cannot update integer indices with short array\"", ")", ";", "}", "if", "(", "data", ".", "isDirect", "(", ")", ")", "{", "if", "(", "!", "NativeIndexBuffer", ".", "setIntVec", "(", "getNative", "(", ")", ",", "data", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Input array is wrong size\"", ")", ";", "}", "}", "else", "if", "(", "data", ".", "hasArray", "(", ")", ")", "{", "if", "(", "!", "NativeIndexBuffer", ".", "setIntArray", "(", "getNative", "(", ")", ",", "data", ".", "array", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Data array incompatible with index buffer\"", ")", ";", "}", "}", "else", "{", "throw", "new", "UnsupportedOperationException", "(", "\"IntBuffer type not supported. Must be direct or have backing array\"", ")", ";", "}", "}" ]
Updates the indices in the index buffer from a Java IntBuffer. All of the entries of the input int buffer are copied into the storage for the index buffer. The new indices must be the same size as the old indices - the index buffer size cannot be changed. @param data char array containing the new values @throws IllegalArgumentException if int buffer is wrong size
[ "Updates", "the", "indices", "in", "the", "index", "buffer", "from", "a", "Java", "IntBuffer", ".", "All", "of", "the", "entries", "of", "the", "input", "int", "buffer", "are", "copied", "into", "the", "storage", "for", "the", "index", "buffer", ".", "The", "new", "indices", "must", "be", "the", "same", "size", "as", "the", "old", "indices", "-", "the", "index", "buffer", "size", "cannot", "be", "changed", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRIndexBuffer.java#L279-L307
161,772
Samsung/GearVRf
GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVREmitter.java
GVREmitter.emitWithBurstCheck
protected void emitWithBurstCheck(float[] particlePositions, float[] particleVelocities, float[] particleTimeStamps) { if ( burstMode ) { if ( executeOnce ) { emit(particlePositions, particleVelocities, particleTimeStamps); executeOnce = false; } } else { emit(particlePositions, particleVelocities, particleTimeStamps); } }
java
protected void emitWithBurstCheck(float[] particlePositions, float[] particleVelocities, float[] particleTimeStamps) { if ( burstMode ) { if ( executeOnce ) { emit(particlePositions, particleVelocities, particleTimeStamps); executeOnce = false; } } else { emit(particlePositions, particleVelocities, particleTimeStamps); } }
[ "protected", "void", "emitWithBurstCheck", "(", "float", "[", "]", "particlePositions", ",", "float", "[", "]", "particleVelocities", ",", "float", "[", "]", "particleTimeStamps", ")", "{", "if", "(", "burstMode", ")", "{", "if", "(", "executeOnce", ")", "{", "emit", "(", "particlePositions", ",", "particleVelocities", ",", "particleTimeStamps", ")", ";", "executeOnce", "=", "false", ";", "}", "}", "else", "{", "emit", "(", "particlePositions", ",", "particleVelocities", ",", "particleTimeStamps", ")", ";", "}", "}" ]
If the burst mode is on, emit the particles only once. @param particlePositions @param particleVelocities @param particleTimeStamps
[ "If", "the", "burst", "mode", "is", "on", "emit", "the", "particles", "only", "once", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVREmitter.java#L134-L150
161,773
Samsung/GearVRf
GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVREmitter.java
GVREmitter.emit
private void emit(float[] particlePositions, float[] particleVelocities, float[] particleTimeStamps) { float[] allParticlePositions = new float[particlePositions.length + particleBoundingVolume.length]; System.arraycopy(particlePositions, 0, allParticlePositions, 0, particlePositions.length); System.arraycopy(particleBoundingVolume, 0, allParticlePositions, particlePositions.length, particleBoundingVolume.length); float[] allSpawnTimes = new float[particleTimeStamps.length + BVSpawnTimes.length]; System.arraycopy(particleTimeStamps, 0, allSpawnTimes, 0, particleTimeStamps.length); System.arraycopy(BVSpawnTimes, 0, allSpawnTimes, particleTimeStamps.length, BVSpawnTimes.length); float[] allParticleVelocities = new float[particleVelocities.length + BVVelocities.length]; System.arraycopy(particleVelocities, 0, allParticleVelocities, 0, particleVelocities.length); System.arraycopy(BVVelocities, 0, allParticleVelocities, particleVelocities.length, BVVelocities.length); Particles particleMesh = new Particles(mGVRContext, mMaxAge, mParticleSize, mEnvironmentAcceleration, mParticleSizeRate, mFadeWithAge, mParticleTexture, mColor, mNoiseFactor); GVRSceneObject particleObject = particleMesh.makeParticleMesh(allParticlePositions, allParticleVelocities, allSpawnTimes); this.addChildObject(particleObject); meshInfo.add(Pair.create(particleObject, currTime)); }
java
private void emit(float[] particlePositions, float[] particleVelocities, float[] particleTimeStamps) { float[] allParticlePositions = new float[particlePositions.length + particleBoundingVolume.length]; System.arraycopy(particlePositions, 0, allParticlePositions, 0, particlePositions.length); System.arraycopy(particleBoundingVolume, 0, allParticlePositions, particlePositions.length, particleBoundingVolume.length); float[] allSpawnTimes = new float[particleTimeStamps.length + BVSpawnTimes.length]; System.arraycopy(particleTimeStamps, 0, allSpawnTimes, 0, particleTimeStamps.length); System.arraycopy(BVSpawnTimes, 0, allSpawnTimes, particleTimeStamps.length, BVSpawnTimes.length); float[] allParticleVelocities = new float[particleVelocities.length + BVVelocities.length]; System.arraycopy(particleVelocities, 0, allParticleVelocities, 0, particleVelocities.length); System.arraycopy(BVVelocities, 0, allParticleVelocities, particleVelocities.length, BVVelocities.length); Particles particleMesh = new Particles(mGVRContext, mMaxAge, mParticleSize, mEnvironmentAcceleration, mParticleSizeRate, mFadeWithAge, mParticleTexture, mColor, mNoiseFactor); GVRSceneObject particleObject = particleMesh.makeParticleMesh(allParticlePositions, allParticleVelocities, allSpawnTimes); this.addChildObject(particleObject); meshInfo.add(Pair.create(particleObject, currTime)); }
[ "private", "void", "emit", "(", "float", "[", "]", "particlePositions", ",", "float", "[", "]", "particleVelocities", ",", "float", "[", "]", "particleTimeStamps", ")", "{", "float", "[", "]", "allParticlePositions", "=", "new", "float", "[", "particlePositions", ".", "length", "+", "particleBoundingVolume", ".", "length", "]", ";", "System", ".", "arraycopy", "(", "particlePositions", ",", "0", ",", "allParticlePositions", ",", "0", ",", "particlePositions", ".", "length", ")", ";", "System", ".", "arraycopy", "(", "particleBoundingVolume", ",", "0", ",", "allParticlePositions", ",", "particlePositions", ".", "length", ",", "particleBoundingVolume", ".", "length", ")", ";", "float", "[", "]", "allSpawnTimes", "=", "new", "float", "[", "particleTimeStamps", ".", "length", "+", "BVSpawnTimes", ".", "length", "]", ";", "System", ".", "arraycopy", "(", "particleTimeStamps", ",", "0", ",", "allSpawnTimes", ",", "0", ",", "particleTimeStamps", ".", "length", ")", ";", "System", ".", "arraycopy", "(", "BVSpawnTimes", ",", "0", ",", "allSpawnTimes", ",", "particleTimeStamps", ".", "length", ",", "BVSpawnTimes", ".", "length", ")", ";", "float", "[", "]", "allParticleVelocities", "=", "new", "float", "[", "particleVelocities", ".", "length", "+", "BVVelocities", ".", "length", "]", ";", "System", ".", "arraycopy", "(", "particleVelocities", ",", "0", ",", "allParticleVelocities", ",", "0", ",", "particleVelocities", ".", "length", ")", ";", "System", ".", "arraycopy", "(", "BVVelocities", ",", "0", ",", "allParticleVelocities", ",", "particleVelocities", ".", "length", ",", "BVVelocities", ".", "length", ")", ";", "Particles", "particleMesh", "=", "new", "Particles", "(", "mGVRContext", ",", "mMaxAge", ",", "mParticleSize", ",", "mEnvironmentAcceleration", ",", "mParticleSizeRate", ",", "mFadeWithAge", ",", "mParticleTexture", ",", "mColor", ",", "mNoiseFactor", ")", ";", "GVRSceneObject", "particleObject", "=", "particleMesh", ".", "makeParticleMesh", "(", "allParticlePositions", ",", "allParticleVelocities", ",", "allSpawnTimes", ")", ";", "this", ".", "addChildObject", "(", "particleObject", ")", ";", "meshInfo", ".", "add", "(", "Pair", ".", "create", "(", "particleObject", ",", "currTime", ")", ")", ";", "}" ]
Append the bounding volume particle positions, times and velocities to the existing mesh before creating a new scene object with this mesh attached to it. Also, append every created scene object and its creation time to corresponding array lists. @param particlePositions @param particleVelocities @param particleTimeStamps
[ "Append", "the", "bounding", "volume", "particle", "positions", "times", "and", "velocities", "to", "the", "existing", "mesh", "before", "creating", "a", "new", "scene", "object", "with", "this", "mesh", "attached", "to", "it", ".", "Also", "append", "every", "created", "scene", "object", "and", "its", "creation", "time", "to", "corresponding", "array", "lists", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVREmitter.java#L162-L189
161,774
Samsung/GearVRf
GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVREmitter.java
GVREmitter.setVelocityRange
public void setVelocityRange( final Vector3f minV, final Vector3f maxV ) { if (null != mGVRContext) { mGVRContext.runOnGlThread(new Runnable() { @Override public void run() { minVelocity = minV; maxVelocity = maxV; } }); } }
java
public void setVelocityRange( final Vector3f minV, final Vector3f maxV ) { if (null != mGVRContext) { mGVRContext.runOnGlThread(new Runnable() { @Override public void run() { minVelocity = minV; maxVelocity = maxV; } }); } }
[ "public", "void", "setVelocityRange", "(", "final", "Vector3f", "minV", ",", "final", "Vector3f", "maxV", ")", "{", "if", "(", "null", "!=", "mGVRContext", ")", "{", "mGVRContext", ".", "runOnGlThread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "minVelocity", "=", "minV", ";", "maxVelocity", "=", "maxV", ";", "}", "}", ")", ";", "}", "}" ]
The range of velocities that a particle generated from this emitter can have. @param minV Minimum velocity that a particle can have @param maxV Maximum velocity that a particle can have
[ "The", "range", "of", "velocities", "that", "a", "particle", "generated", "from", "this", "emitter", "can", "have", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVREmitter.java#L294-L306
161,775
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Log.java
Log.logLong
public static void logLong(String TAG, String longString) { InputStream is = new ByteArrayInputStream( longString.getBytes() ); @SuppressWarnings("resource") Scanner scan = new Scanner(is); while (scan.hasNextLine()) { Log.v(TAG, scan.nextLine()); } }
java
public static void logLong(String TAG, String longString) { InputStream is = new ByteArrayInputStream( longString.getBytes() ); @SuppressWarnings("resource") Scanner scan = new Scanner(is); while (scan.hasNextLine()) { Log.v(TAG, scan.nextLine()); } }
[ "public", "static", "void", "logLong", "(", "String", "TAG", ",", "String", "longString", ")", "{", "InputStream", "is", "=", "new", "ByteArrayInputStream", "(", "longString", ".", "getBytes", "(", ")", ")", ";", "@", "SuppressWarnings", "(", "\"resource\"", ")", "Scanner", "scan", "=", "new", "Scanner", "(", "is", ")", ";", "while", "(", "scan", ".", "hasNextLine", "(", ")", ")", "{", "Log", ".", "v", "(", "TAG", ",", "scan", ".", "nextLine", "(", ")", ")", ";", "}", "}" ]
Log long string using verbose tag @param TAG The tag. @param longString The long string.
[ "Log", "long", "string", "using", "verbose", "tag" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Log.java#L116-L123
161,776
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java
Utility.readTextFile
public static String readTextFile(Context context, String asset) { try { InputStream inputStream = context.getAssets().open(asset); return org.gearvrf.utility.TextFile.readTextFile(inputStream); } catch (FileNotFoundException f) { Log.w(TAG, "readTextFile(): asset file '%s' doesn't exist", asset); } catch (IOException e) { e.printStackTrace(); Log.e(TAG, e, "readTextFile()"); } return null; }
java
public static String readTextFile(Context context, String asset) { try { InputStream inputStream = context.getAssets().open(asset); return org.gearvrf.utility.TextFile.readTextFile(inputStream); } catch (FileNotFoundException f) { Log.w(TAG, "readTextFile(): asset file '%s' doesn't exist", asset); } catch (IOException e) { e.printStackTrace(); Log.e(TAG, e, "readTextFile()"); } return null; }
[ "public", "static", "String", "readTextFile", "(", "Context", "context", ",", "String", "asset", ")", "{", "try", "{", "InputStream", "inputStream", "=", "context", ".", "getAssets", "(", ")", ".", "open", "(", "asset", ")", ";", "return", "org", ".", "gearvrf", ".", "utility", ".", "TextFile", ".", "readTextFile", "(", "inputStream", ")", ";", "}", "catch", "(", "FileNotFoundException", "f", ")", "{", "Log", ".", "w", "(", "TAG", ",", "\"readTextFile(): asset file '%s' doesn't exist\"", ",", "asset", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "Log", ".", "e", "(", "TAG", ",", "e", ",", "\"readTextFile()\"", ")", ";", "}", "return", "null", ";", "}" ]
Read a text file from assets into a single string @param context A non-null Android Context @param asset The asset file to read @return The contents or null on error.
[ "Read", "a", "text", "file", "from", "assets", "into", "a", "single", "string" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java#L42-L53
161,777
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java
Utility.equal
public static boolean equal(Vector3f v1, Vector3f v2) { return equal(v1.x, v2.x) && equal(v1.y, v2.y) && equal(v1.z, v2.z); }
java
public static boolean equal(Vector3f v1, Vector3f v2) { return equal(v1.x, v2.x) && equal(v1.y, v2.y) && equal(v1.z, v2.z); }
[ "public", "static", "boolean", "equal", "(", "Vector3f", "v1", ",", "Vector3f", "v2", ")", "{", "return", "equal", "(", "v1", ".", "x", ",", "v2", ".", "x", ")", "&&", "equal", "(", "v1", ".", "y", ",", "v2", ".", "y", ")", "&&", "equal", "(", "v1", ".", "z", ",", "v2", ".", "z", ")", ";", "}" ]
Are these two numbers effectively equal? The same logic is applied for each of the 3 vector dimensions: see {@link #equal} @param v1 @param v2
[ "Are", "these", "two", "numbers", "effectively", "equal?" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java#L90-L92
161,778
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java
Utility.getId
public static int getId(Context context, String id) { final String defType; if (id.startsWith("R.")) { int dot = id.indexOf('.', 2); defType = id.substring(2, dot); } else { defType = "drawable"; } Log.d(TAG, "getId(): id: %s, extracted type: %s", id, defType); return getId(context, id, defType); }
java
public static int getId(Context context, String id) { final String defType; if (id.startsWith("R.")) { int dot = id.indexOf('.', 2); defType = id.substring(2, dot); } else { defType = "drawable"; } Log.d(TAG, "getId(): id: %s, extracted type: %s", id, defType); return getId(context, id, defType); }
[ "public", "static", "int", "getId", "(", "Context", "context", ",", "String", "id", ")", "{", "final", "String", "defType", ";", "if", "(", "id", ".", "startsWith", "(", "\"R.\"", ")", ")", "{", "int", "dot", "=", "id", ".", "indexOf", "(", "'", "'", ",", "2", ")", ";", "defType", "=", "id", ".", "substring", "(", "2", ",", "dot", ")", ";", "}", "else", "{", "defType", "=", "\"drawable\"", ";", "}", "Log", ".", "d", "(", "TAG", ",", "\"getId(): id: %s, extracted type: %s\"", ",", "id", ",", "defType", ")", ";", "return", "getId", "(", "context", ",", "id", ",", "defType", ")", ";", "}" ]
Parses the resource String id and get back the int res id @param context @param id String resource id @return int resource id
[ "Parses", "the", "resource", "String", "id", "and", "get", "back", "the", "int", "res", "id" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java#L100-L111
161,779
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java
Utility.getId
public static int getId(Context context, String id, String defType) { String type = "R." + defType + "."; if (id.startsWith(type)) { id = id.substring(type.length()); } Resources r = context.getResources(); int resId = r.getIdentifier(id, defType, context.getPackageName()); if (resId > 0) { return resId; } else { throw new RuntimeAssertion("Specified resource '%s' could not be found", id); } }
java
public static int getId(Context context, String id, String defType) { String type = "R." + defType + "."; if (id.startsWith(type)) { id = id.substring(type.length()); } Resources r = context.getResources(); int resId = r.getIdentifier(id, defType, context.getPackageName()); if (resId > 0) { return resId; } else { throw new RuntimeAssertion("Specified resource '%s' could not be found", id); } }
[ "public", "static", "int", "getId", "(", "Context", "context", ",", "String", "id", ",", "String", "defType", ")", "{", "String", "type", "=", "\"R.\"", "+", "defType", "+", "\".\"", ";", "if", "(", "id", ".", "startsWith", "(", "type", ")", ")", "{", "id", "=", "id", ".", "substring", "(", "type", ".", "length", "(", ")", ")", ";", "}", "Resources", "r", "=", "context", ".", "getResources", "(", ")", ";", "int", "resId", "=", "r", ".", "getIdentifier", "(", "id", ",", "defType", ",", "context", ".", "getPackageName", "(", ")", ")", ";", "if", "(", "resId", ">", "0", ")", "{", "return", "resId", ";", "}", "else", "{", "throw", "new", "RuntimeAssertion", "(", "\"Specified resource '%s' could not be found\"", ",", "id", ")", ";", "}", "}" ]
Get the int resource id with specified type definition @param context @param id String resource id @return int resource id
[ "Get", "the", "int", "resource", "id", "with", "specified", "type", "definition" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java#L119-L133
161,780
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java
GVRShader.generateSignature
public String generateSignature(HashMap<String, Integer> defined, GVRLight[] lightlist) { return getClass().getSimpleName(); }
java
public String generateSignature(HashMap<String, Integer> defined, GVRLight[] lightlist) { return getClass().getSimpleName(); }
[ "public", "String", "generateSignature", "(", "HashMap", "<", "String", ",", "Integer", ">", "defined", ",", "GVRLight", "[", "]", "lightlist", ")", "{", "return", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "}" ]
Create a unique signature for this shader. The signature for simple shaders is just the class name. For the more complex shaders generated by GVRShaderTemplate the signature includes information about the vertex attributes, uniforms, textures and lights used by the shader variant. @param defined names to be defined for this shader @return string signature for shader @see GVRShaderTemplate
[ "Create", "a", "unique", "signature", "for", "this", "shader", ".", "The", "signature", "for", "simple", "shaders", "is", "just", "the", "class", "name", ".", "For", "the", "more", "complex", "shaders", "generated", "by", "GVRShaderTemplate", "the", "signature", "includes", "information", "about", "the", "vertex", "attributes", "uniforms", "textures", "and", "lights", "used", "by", "the", "shader", "variant", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java#L244-L247
161,781
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java
GVRShader.bindShader
public int bindShader(GVRContext context, IRenderable rdata, GVRScene scene, boolean isMultiview) { String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); GVRMaterial mtl = rdata.getMaterial(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, mtl); } if (nativeShader > 0) { rdata.setShader(nativeShader, isMultiview); } return nativeShader; } }
java
public int bindShader(GVRContext context, IRenderable rdata, GVRScene scene, boolean isMultiview) { String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); GVRMaterial mtl = rdata.getMaterial(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, mtl); } if (nativeShader > 0) { rdata.setShader(nativeShader, isMultiview); } return nativeShader; } }
[ "public", "int", "bindShader", "(", "GVRContext", "context", ",", "IRenderable", "rdata", ",", "GVRScene", "scene", ",", "boolean", "isMultiview", ")", "{", "String", "signature", "=", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "GVRShaderManager", "shaderManager", "=", "context", ".", "getShaderManager", "(", ")", ";", "GVRMaterial", "mtl", "=", "rdata", ".", "getMaterial", "(", ")", ";", "synchronized", "(", "shaderManager", ")", "{", "int", "nativeShader", "=", "shaderManager", ".", "getShader", "(", "signature", ")", ";", "if", "(", "nativeShader", "==", "0", ")", "{", "nativeShader", "=", "addShader", "(", "shaderManager", ",", "signature", ",", "mtl", ")", ";", "}", "if", "(", "nativeShader", ">", "0", ")", "{", "rdata", ".", "setShader", "(", "nativeShader", ",", "isMultiview", ")", ";", "}", "return", "nativeShader", ";", "}", "}" ]
Select the specific vertex and fragment shader to use. The shader template is used to generate the sources for the vertex and fragment shader based on the vertex, material and light properties. This function may compile the shader if it does not already exist. @param context GVRContext @param rdata renderable entity with mesh and rendering options @param scene list of light sources
[ "Select", "the", "specific", "vertex", "and", "fragment", "shader", "to", "use", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java#L306-L325
161,782
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java
GVRShader.bindShader
public int bindShader(GVRContext context, GVRShaderData material, String vertexDesc) { String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, material); } return nativeShader; } }
java
public int bindShader(GVRContext context, GVRShaderData material, String vertexDesc) { String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, material); } return nativeShader; } }
[ "public", "int", "bindShader", "(", "GVRContext", "context", ",", "GVRShaderData", "material", ",", "String", "vertexDesc", ")", "{", "String", "signature", "=", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "GVRShaderManager", "shaderManager", "=", "context", ".", "getShaderManager", "(", ")", ";", "synchronized", "(", "shaderManager", ")", "{", "int", "nativeShader", "=", "shaderManager", ".", "getShader", "(", "signature", ")", ";", "if", "(", "nativeShader", "==", "0", ")", "{", "nativeShader", "=", "addShader", "(", "shaderManager", ",", "signature", ",", "material", ")", ";", "}", "return", "nativeShader", ";", "}", "}" ]
Select the specific vertex and fragment shader to use with this material. The shader template is used to generate the sources for the vertex and fragment shader based on the material properties only. It will ignore the mesh attributes and all lights. @param context GVRContext @param material material to use with the shader @return ID of vertex/fragment shader set
[ "Select", "the", "specific", "vertex", "and", "fragment", "shader", "to", "use", "with", "this", "material", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java#L340-L354
161,783
Samsung/GearVRf
GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/PhysicsDragger.java
PhysicsDragger.startDrag
public GVRSceneObject startDrag(GVRSceneObject dragMe, float relX, float relY, float relZ) { synchronized (mLock) { if (mCursorController == null) { Log.w(TAG, "Physics drag failed: Cursor controller not found!"); return null; } if (mDragMe != null) { Log.w(TAG, "Physics drag failed: Previous drag wasn't finished!"); return null; } if (mPivotObject == null) { mPivotObject = onCreatePivotObject(mContext); } mDragMe = dragMe; GVRTransform t = dragMe.getTransform(); /* It is not possible to drag a rigid body directly, we need a pivot object. We are using the pivot object's position as pivot of the dragging's physics constraint. */ mPivotObject.getTransform().setPosition(t.getPositionX() + relX, t.getPositionY() + relY, t.getPositionZ() + relZ); mCursorController.startDrag(mPivotObject); } return mPivotObject; }
java
public GVRSceneObject startDrag(GVRSceneObject dragMe, float relX, float relY, float relZ) { synchronized (mLock) { if (mCursorController == null) { Log.w(TAG, "Physics drag failed: Cursor controller not found!"); return null; } if (mDragMe != null) { Log.w(TAG, "Physics drag failed: Previous drag wasn't finished!"); return null; } if (mPivotObject == null) { mPivotObject = onCreatePivotObject(mContext); } mDragMe = dragMe; GVRTransform t = dragMe.getTransform(); /* It is not possible to drag a rigid body directly, we need a pivot object. We are using the pivot object's position as pivot of the dragging's physics constraint. */ mPivotObject.getTransform().setPosition(t.getPositionX() + relX, t.getPositionY() + relY, t.getPositionZ() + relZ); mCursorController.startDrag(mPivotObject); } return mPivotObject; }
[ "public", "GVRSceneObject", "startDrag", "(", "GVRSceneObject", "dragMe", ",", "float", "relX", ",", "float", "relY", ",", "float", "relZ", ")", "{", "synchronized", "(", "mLock", ")", "{", "if", "(", "mCursorController", "==", "null", ")", "{", "Log", ".", "w", "(", "TAG", ",", "\"Physics drag failed: Cursor controller not found!\"", ")", ";", "return", "null", ";", "}", "if", "(", "mDragMe", "!=", "null", ")", "{", "Log", ".", "w", "(", "TAG", ",", "\"Physics drag failed: Previous drag wasn't finished!\"", ")", ";", "return", "null", ";", "}", "if", "(", "mPivotObject", "==", "null", ")", "{", "mPivotObject", "=", "onCreatePivotObject", "(", "mContext", ")", ";", "}", "mDragMe", "=", "dragMe", ";", "GVRTransform", "t", "=", "dragMe", ".", "getTransform", "(", ")", ";", "/* It is not possible to drag a rigid body directly, we need a pivot object.\n We are using the pivot object's position as pivot of the dragging's physics constraint.\n */", "mPivotObject", ".", "getTransform", "(", ")", ".", "setPosition", "(", "t", ".", "getPositionX", "(", ")", "+", "relX", ",", "t", ".", "getPositionY", "(", ")", "+", "relY", ",", "t", ".", "getPositionZ", "(", ")", "+", "relZ", ")", ";", "mCursorController", ".", "startDrag", "(", "mPivotObject", ")", ";", "}", "return", "mPivotObject", ";", "}" ]
Start the drag of the pivot object. @param dragMe Scene object with a rigid body. @param relX rel position in x-axis. @param relY rel position in y-axis. @param relZ rel position in z-axis. @return Pivot instance if success, otherwise returns null.
[ "Start", "the", "drag", "of", "the", "pivot", "object", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/PhysicsDragger.java#L67-L97
161,784
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java
GVRShaderData.setTexCoord
public void setTexCoord(String texName, String texCoordAttr, String shaderVarName) { synchronized (textures) { GVRTexture tex = textures.get(texName); if (tex != null) { tex.setTexCoord(texCoordAttr, shaderVarName); } else { throw new UnsupportedOperationException("Texture must be set before updating texture coordinate information"); } } }
java
public void setTexCoord(String texName, String texCoordAttr, String shaderVarName) { synchronized (textures) { GVRTexture tex = textures.get(texName); if (tex != null) { tex.setTexCoord(texCoordAttr, shaderVarName); } else { throw new UnsupportedOperationException("Texture must be set before updating texture coordinate information"); } } }
[ "public", "void", "setTexCoord", "(", "String", "texName", ",", "String", "texCoordAttr", ",", "String", "shaderVarName", ")", "{", "synchronized", "(", "textures", ")", "{", "GVRTexture", "tex", "=", "textures", ".", "get", "(", "texName", ")", ";", "if", "(", "tex", "!=", "null", ")", "{", "tex", ".", "setTexCoord", "(", "texCoordAttr", ",", "shaderVarName", ")", ";", "}", "else", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Texture must be set before updating texture coordinate information\"", ")", ";", "}", "}", "}" ]
Designate the vertex attribute and shader variable for the texture coordinates associated with the named texture. @param texName name of texture @param texCoordAttr name of vertex attribute with texture coordinates. @param shaderVarName name of shader variable to get texture coordinates.
[ "Designate", "the", "vertex", "attribute", "and", "shader", "variable", "for", "the", "texture", "coordinates", "associated", "with", "the", "named", "texture", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java#L465-L480
161,785
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java
GVRShaderData.getTexCoordAttr
public String getTexCoordAttr(String texName) { GVRTexture tex = textures.get(texName); if (tex != null) { return tex.getTexCoordAttr(); } return null; }
java
public String getTexCoordAttr(String texName) { GVRTexture tex = textures.get(texName); if (tex != null) { return tex.getTexCoordAttr(); } return null; }
[ "public", "String", "getTexCoordAttr", "(", "String", "texName", ")", "{", "GVRTexture", "tex", "=", "textures", ".", "get", "(", "texName", ")", ";", "if", "(", "tex", "!=", "null", ")", "{", "return", "tex", ".", "getTexCoordAttr", "(", ")", ";", "}", "return", "null", ";", "}" ]
Gets the name of the vertex attribute containing the texture coordinates for the named texture. @param texName name of texture @return name of texture coordinate vertex attribute
[ "Gets", "the", "name", "of", "the", "vertex", "attribute", "containing", "the", "texture", "coordinates", "for", "the", "named", "texture", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java#L489-L497
161,786
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java
GVRShaderData.getTexCoordShaderVar
public String getTexCoordShaderVar(String texName) { GVRTexture tex = textures.get(texName); if (tex != null) { return tex.getTexCoordShaderVar(); } return null; }
java
public String getTexCoordShaderVar(String texName) { GVRTexture tex = textures.get(texName); if (tex != null) { return tex.getTexCoordShaderVar(); } return null; }
[ "public", "String", "getTexCoordShaderVar", "(", "String", "texName", ")", "{", "GVRTexture", "tex", "=", "textures", ".", "get", "(", "texName", ")", ";", "if", "(", "tex", "!=", "null", ")", "{", "return", "tex", ".", "getTexCoordShaderVar", "(", ")", ";", "}", "return", "null", ";", "}" ]
Gets the name of the shader variable to get the texture coordinates for the named texture. @param texName name of texture @return name of shader variable
[ "Gets", "the", "name", "of", "the", "shader", "variable", "to", "get", "the", "texture", "coordinates", "for", "the", "named", "texture", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java#L506-L514
161,787
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPreference.java
GVRPreference.getProperty
public String getProperty(String key, String defaultValue) { return mProperties.getProperty(key, defaultValue); }
java
public String getProperty(String key, String defaultValue) { return mProperties.getProperty(key, defaultValue); }
[ "public", "String", "getProperty", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "return", "mProperties", ".", "getProperty", "(", "key", ",", "defaultValue", ")", ";", "}" ]
Gets a property with a default value. @param key The key string. @param defaultValue The default value. @return The property string.
[ "Gets", "a", "property", "with", "a", "default", "value", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPreference.java#L63-L65
161,788
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/PickerWidget.java
PickerWidget.hide
public synchronized void hide() { if (focusedQuad != null) { mDefocusAnimationFactory.create(focusedQuad) .setRequestLayoutOnTargetChange(false) .start().finish(); focusedQuad = null; } Log.d(Log.SUBSYSTEM.WIDGET, TAG, "hide Picker!"); }
java
public synchronized void hide() { if (focusedQuad != null) { mDefocusAnimationFactory.create(focusedQuad) .setRequestLayoutOnTargetChange(false) .start().finish(); focusedQuad = null; } Log.d(Log.SUBSYSTEM.WIDGET, TAG, "hide Picker!"); }
[ "public", "synchronized", "void", "hide", "(", ")", "{", "if", "(", "focusedQuad", "!=", "null", ")", "{", "mDefocusAnimationFactory", ".", "create", "(", "focusedQuad", ")", ".", "setRequestLayoutOnTargetChange", "(", "false", ")", ".", "start", "(", ")", ".", "finish", "(", ")", ";", "focusedQuad", "=", "null", ";", "}", "Log", ".", "d", "(", "Log", ".", "SUBSYSTEM", ".", "WIDGET", ",", "TAG", ",", "\"hide Picker!\"", ")", ";", "}" ]
It should be called when the picker is hidden
[ "It", "should", "be", "called", "when", "the", "picker", "is", "hidden" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/PickerWidget.java#L68-L78
161,789
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFString.java
MFString.set1Value
public void set1Value(int index, String newValue) { try { value.set( index, newValue ); } catch (IndexOutOfBoundsException e) { Log.e(TAG, "X3D MFString set1Value(int index, ...) out of bounds." + e); } catch (Exception e) { Log.e(TAG, "X3D MFString set1Value(int index, ...) exception " + e); } }
java
public void set1Value(int index, String newValue) { try { value.set( index, newValue ); } catch (IndexOutOfBoundsException e) { Log.e(TAG, "X3D MFString set1Value(int index, ...) out of bounds." + e); } catch (Exception e) { Log.e(TAG, "X3D MFString set1Value(int index, ...) exception " + e); } }
[ "public", "void", "set1Value", "(", "int", "index", ",", "String", "newValue", ")", "{", "try", "{", "value", ".", "set", "(", "index", ",", "newValue", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"X3D MFString set1Value(int index, ...) out of bounds.\"", "+", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"X3D MFString set1Value(int index, ...) exception \"", "+", "e", ")", ";", "}", "}" ]
Replace a single value at the appropriate location in the existing value array. @param index - location in the array list @param newValue - the new String
[ "Replace", "a", "single", "value", "at", "the", "appropriate", "location", "in", "the", "existing", "value", "array", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFString.java#L128-L138
161,790
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFString.java
MFString.setValue
public void setValue(int numStrings, String[] newValues) { value.clear(); if (numStrings == newValues.length) { for (int i = 0; i < newValues.length; i++) { value.add(newValues[i]); } } else { Log.e(TAG, "X3D MFString setValue() numStrings not equal total newValues"); } }
java
public void setValue(int numStrings, String[] newValues) { value.clear(); if (numStrings == newValues.length) { for (int i = 0; i < newValues.length; i++) { value.add(newValues[i]); } } else { Log.e(TAG, "X3D MFString setValue() numStrings not equal total newValues"); } }
[ "public", "void", "setValue", "(", "int", "numStrings", ",", "String", "[", "]", "newValues", ")", "{", "value", ".", "clear", "(", ")", ";", "if", "(", "numStrings", "==", "newValues", ".", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "newValues", ".", "length", ";", "i", "++", ")", "{", "value", ".", "add", "(", "newValues", "[", "i", "]", ")", ";", "}", "}", "else", "{", "Log", ".", "e", "(", "TAG", ",", "\"X3D MFString setValue() numStrings not equal total newValues\"", ")", ";", "}", "}" ]
Assign a new value to this field. @param numStrings - number of strings @param newValues - the new strings
[ "Assign", "a", "new", "value", "to", "this", "field", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFString.java#L145-L155
161,791
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRBitmapImage.java
GVRBitmapImage.update
public void update(int width, int height, byte[] grayscaleData) { NativeBitmapImage.updateFromMemory(getNative(), width, height, grayscaleData); }
java
public void update(int width, int height, byte[] grayscaleData) { NativeBitmapImage.updateFromMemory(getNative(), width, height, grayscaleData); }
[ "public", "void", "update", "(", "int", "width", ",", "int", "height", ",", "byte", "[", "]", "grayscaleData", ")", "{", "NativeBitmapImage", ".", "updateFromMemory", "(", "getNative", "(", ")", ",", "width", ",", "height", ",", "grayscaleData", ")", ";", "}" ]
Copy new grayscale data to the GPU texture. This one is also safe even in a non-GL thread. An updateGPU request on a non-GL thread will be forwarded to the GL thread and be executed before main rendering happens. Be aware that updating a texture will affect any and all {@linkplain GVRMaterial materials} and/or post effects that use the texture! @param width width of grayscale image @param height height of grayscale image @param grayscaleData A byte array containing grayscale data @since 1.6.3
[ "Copy", "new", "grayscale", "data", "to", "the", "GPU", "texture", ".", "This", "one", "is", "also", "safe", "even", "in", "a", "non", "-", "GL", "thread", ".", "An", "updateGPU", "request", "on", "a", "non", "-", "GL", "thread", "will", "be", "forwarded", "to", "the", "GL", "thread", "and", "be", "executed", "before", "main", "rendering", "happens", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRBitmapImage.java#L228-L231
161,792
Samsung/GearVRf
GVRf/Extensions/platformsdk_support/src/main/java/org/gearvrf/PlatformEntitlementCheck.java
PlatformEntitlementCheck.start
public static void start(final GVRContext context, final String appId, final ResultListener listener) { if (null == listener) { throw new IllegalArgumentException("listener cannot be null"); } final Activity activity = context.getActivity(); final long result = create(activity, appId); if (0 != result) { throw new IllegalStateException("Could not initialize the platform sdk; error code: " + result); } context.registerDrawFrameListener(new GVRDrawFrameListener() { @Override public void onDrawFrame(float frameTime) { final int result = processEntitlementCheckResponse(); if (0 != result) { context.unregisterDrawFrameListener(this); final Runnable runnable; if (-1 == result) { runnable = new Runnable() { @Override public void run() { listener.onFailure(); } }; } else { runnable = new Runnable() { @Override public void run() { listener.onSuccess(); } }; } activity.runOnUiThread(runnable); } } }); }
java
public static void start(final GVRContext context, final String appId, final ResultListener listener) { if (null == listener) { throw new IllegalArgumentException("listener cannot be null"); } final Activity activity = context.getActivity(); final long result = create(activity, appId); if (0 != result) { throw new IllegalStateException("Could not initialize the platform sdk; error code: " + result); } context.registerDrawFrameListener(new GVRDrawFrameListener() { @Override public void onDrawFrame(float frameTime) { final int result = processEntitlementCheckResponse(); if (0 != result) { context.unregisterDrawFrameListener(this); final Runnable runnable; if (-1 == result) { runnable = new Runnable() { @Override public void run() { listener.onFailure(); } }; } else { runnable = new Runnable() { @Override public void run() { listener.onSuccess(); } }; } activity.runOnUiThread(runnable); } } }); }
[ "public", "static", "void", "start", "(", "final", "GVRContext", "context", ",", "final", "String", "appId", ",", "final", "ResultListener", "listener", ")", "{", "if", "(", "null", "==", "listener", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"listener cannot be null\"", ")", ";", "}", "final", "Activity", "activity", "=", "context", ".", "getActivity", "(", ")", ";", "final", "long", "result", "=", "create", "(", "activity", ",", "appId", ")", ";", "if", "(", "0", "!=", "result", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not initialize the platform sdk; error code: \"", "+", "result", ")", ";", "}", "context", ".", "registerDrawFrameListener", "(", "new", "GVRDrawFrameListener", "(", ")", "{", "@", "Override", "public", "void", "onDrawFrame", "(", "float", "frameTime", ")", "{", "final", "int", "result", "=", "processEntitlementCheckResponse", "(", ")", ";", "if", "(", "0", "!=", "result", ")", "{", "context", ".", "unregisterDrawFrameListener", "(", "this", ")", ";", "final", "Runnable", "runnable", ";", "if", "(", "-", "1", "==", "result", ")", "{", "runnable", "=", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "listener", ".", "onFailure", "(", ")", ";", "}", "}", ";", "}", "else", "{", "runnable", "=", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "listener", ".", "onSuccess", "(", ")", ";", "}", "}", ";", "}", "activity", ".", "runOnUiThread", "(", "runnable", ")", ";", "}", "}", "}", ")", ";", "}" ]
Starts asynchronous check. Result will be delivered to the listener on the main thread. @param context @param appId application id from the oculus dashboard @param listener listener to invoke when the result is available @throws IllegalStateException in case the platform sdk cannot be initialized @throws IllegalArgumentException if listener is null
[ "Starts", "asynchronous", "check", ".", "Result", "will", "be", "delivered", "to", "the", "listener", "on", "the", "main", "thread", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/platformsdk_support/src/main/java/org/gearvrf/PlatformEntitlementCheck.java#L55-L93
161,793
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRFPSTracer.java
GVRFPSTracer.tick
public synchronized void tick() { long currentTime = GVRTime.getMilliTime(); long cutoffTime = currentTime - BUFFER_SECONDS * 1000; ListIterator<Long> it = mTimestamps.listIterator(); while (it.hasNext()) { Long timestamp = it.next(); if (timestamp < cutoffTime) { it.remove(); } else { break; } } mTimestamps.add(currentTime); mStatColumn.addValue(((float)mTimestamps.size()) / BUFFER_SECONDS); }
java
public synchronized void tick() { long currentTime = GVRTime.getMilliTime(); long cutoffTime = currentTime - BUFFER_SECONDS * 1000; ListIterator<Long> it = mTimestamps.listIterator(); while (it.hasNext()) { Long timestamp = it.next(); if (timestamp < cutoffTime) { it.remove(); } else { break; } } mTimestamps.add(currentTime); mStatColumn.addValue(((float)mTimestamps.size()) / BUFFER_SECONDS); }
[ "public", "synchronized", "void", "tick", "(", ")", "{", "long", "currentTime", "=", "GVRTime", ".", "getMilliTime", "(", ")", ";", "long", "cutoffTime", "=", "currentTime", "-", "BUFFER_SECONDS", "*", "1000", ";", "ListIterator", "<", "Long", ">", "it", "=", "mTimestamps", ".", "listIterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Long", "timestamp", "=", "it", ".", "next", "(", ")", ";", "if", "(", "timestamp", "<", "cutoffTime", ")", "{", "it", ".", "remove", "(", ")", ";", "}", "else", "{", "break", ";", "}", "}", "mTimestamps", ".", "add", "(", "currentTime", ")", ";", "mStatColumn", ".", "addValue", "(", "(", "(", "float", ")", "mTimestamps", ".", "size", "(", ")", ")", "/", "BUFFER_SECONDS", ")", ";", "}" ]
Should be called each frame.
[ "Should", "be", "called", "each", "frame", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRFPSTracer.java#L54-L69
161,794
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/VrAppSettings.java
VrAppSettings.addControllerType
public void addControllerType(GVRControllerType controllerType) { if (cursorControllerTypes == null) { cursorControllerTypes = new ArrayList<GVRControllerType>(); } else if (cursorControllerTypes.contains(controllerType)) { return; } cursorControllerTypes.add(controllerType); }
java
public void addControllerType(GVRControllerType controllerType) { if (cursorControllerTypes == null) { cursorControllerTypes = new ArrayList<GVRControllerType>(); } else if (cursorControllerTypes.contains(controllerType)) { return; } cursorControllerTypes.add(controllerType); }
[ "public", "void", "addControllerType", "(", "GVRControllerType", "controllerType", ")", "{", "if", "(", "cursorControllerTypes", "==", "null", ")", "{", "cursorControllerTypes", "=", "new", "ArrayList", "<", "GVRControllerType", ">", "(", ")", ";", "}", "else", "if", "(", "cursorControllerTypes", ".", "contains", "(", "controllerType", ")", ")", "{", "return", ";", "}", "cursorControllerTypes", ".", "add", "(", "controllerType", ")", ";", "}" ]
Enable the use of the given controller type by adding it to the cursor controller types list. @param controllerType GVRControllerType to add to the list
[ "Enable", "the", "use", "of", "the", "given", "controller", "type", "by", "adding", "it", "to", "the", "cursor", "controller", "types", "list", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/VrAppSettings.java#L627-L638
161,795
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java
Assert.checkStringNotNullOrEmpty
public static void checkStringNotNullOrEmpty(String parameterName, String value) { if (TextUtils.isEmpty(value)) { throw Exceptions.IllegalArgument("Current input string %s is %s.", parameterName, value == null ? "null" : "empty"); } }
java
public static void checkStringNotNullOrEmpty(String parameterName, String value) { if (TextUtils.isEmpty(value)) { throw Exceptions.IllegalArgument("Current input string %s is %s.", parameterName, value == null ? "null" : "empty"); } }
[ "public", "static", "void", "checkStringNotNullOrEmpty", "(", "String", "parameterName", ",", "String", "value", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "value", ")", ")", "{", "throw", "Exceptions", ".", "IllegalArgument", "(", "\"Current input string %s is %s.\"", ",", "parameterName", ",", "value", "==", "null", "?", "\"null\"", ":", "\"empty\"", ")", ";", "}", "}" ]
Check that the parameter string is not null or empty @param value String value to be checked. @param parameterName The name of the user-supplied parameter that we are validating so that the user can easily find the error in their code. @throws IllegalArgumentException If the key is null or empty.
[ "Check", "that", "the", "parameter", "string", "is", "not", "null", "or", "empty" ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java#L65-L71
161,796
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java
Assert.checkArrayLength
public static void checkArrayLength(String parameterName, int actualLength, int expectedLength) { if (actualLength != expectedLength) { throw Exceptions.IllegalArgument( "Array %s should have %d elements, not %d", parameterName, expectedLength, actualLength); } }
java
public static void checkArrayLength(String parameterName, int actualLength, int expectedLength) { if (actualLength != expectedLength) { throw Exceptions.IllegalArgument( "Array %s should have %d elements, not %d", parameterName, expectedLength, actualLength); } }
[ "public", "static", "void", "checkArrayLength", "(", "String", "parameterName", ",", "int", "actualLength", ",", "int", "expectedLength", ")", "{", "if", "(", "actualLength", "!=", "expectedLength", ")", "{", "throw", "Exceptions", ".", "IllegalArgument", "(", "\"Array %s should have %d elements, not %d\"", ",", "parameterName", ",", "expectedLength", ",", "actualLength", ")", ";", "}", "}" ]
Check that the parameter array has exactly the right number of elements. @param parameterName The name of the user-supplied parameter that we are validating so that the user can easily find the error in their code. @param actualLength The actual array length @param expectedLength The expected array length
[ "Check", "that", "the", "parameter", "array", "has", "exactly", "the", "right", "number", "of", "elements", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java#L84-L91
161,797
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java
Assert.checkMinimumArrayLength
public static void checkMinimumArrayLength(String parameterName, int actualLength, int minimumLength) { if (actualLength < minimumLength) { throw Exceptions .IllegalArgument( "Array %s should have at least %d elements, but it only has %d", parameterName, minimumLength, actualLength); } }
java
public static void checkMinimumArrayLength(String parameterName, int actualLength, int minimumLength) { if (actualLength < minimumLength) { throw Exceptions .IllegalArgument( "Array %s should have at least %d elements, but it only has %d", parameterName, minimumLength, actualLength); } }
[ "public", "static", "void", "checkMinimumArrayLength", "(", "String", "parameterName", ",", "int", "actualLength", ",", "int", "minimumLength", ")", "{", "if", "(", "actualLength", "<", "minimumLength", ")", "{", "throw", "Exceptions", ".", "IllegalArgument", "(", "\"Array %s should have at least %d elements, but it only has %d\"", ",", "parameterName", ",", "minimumLength", ",", "actualLength", ")", ";", "}", "}" ]
Check that the parameter array has at least as many elements as it should. @param parameterName The name of the user-supplied parameter that we are validating so that the user can easily find the error in their code. @param actualLength The actual array length @param minimumLength The minimum array length
[ "Check", "that", "the", "parameter", "array", "has", "at", "least", "as", "many", "elements", "as", "it", "should", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java#L267-L275
161,798
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java
Assert.checkFloatNotNaNOrInfinity
public static void checkFloatNotNaNOrInfinity(String parameterName, float data) { if (Float.isNaN(data) || Float.isInfinite(data)) { throw Exceptions.IllegalArgument( "%s should never be NaN or Infinite.", parameterName); } }
java
public static void checkFloatNotNaNOrInfinity(String parameterName, float data) { if (Float.isNaN(data) || Float.isInfinite(data)) { throw Exceptions.IllegalArgument( "%s should never be NaN or Infinite.", parameterName); } }
[ "public", "static", "void", "checkFloatNotNaNOrInfinity", "(", "String", "parameterName", ",", "float", "data", ")", "{", "if", "(", "Float", ".", "isNaN", "(", "data", ")", "||", "Float", ".", "isInfinite", "(", "data", ")", ")", "{", "throw", "Exceptions", ".", "IllegalArgument", "(", "\"%s should never be NaN or Infinite.\"", ",", "parameterName", ")", ";", "}", "}" ]
In common shader cases, NaN makes little sense. Correspondingly, GVRF is going to use Float.NaN as illegal flag in many cases. Therefore, we need a function to check if there is any setX that is using NaN as input. @param parameterName The name of the user-supplied parameter that we are validating so that the user can easily find the error in their code. @param data A single float data. @throws IllegalArgumentException if the data includes NaN.
[ "In", "common", "shader", "cases", "NaN", "makes", "little", "sense", ".", "Correspondingly", "GVRF", "is", "going", "to", "use", "Float", ".", "NaN", "as", "illegal", "flag", "in", "many", "cases", ".", "Therefore", "we", "need", "a", "function", "to", "check", "if", "there", "is", "any", "setX", "that", "is", "using", "NaN", "as", "input", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java#L686-L692
161,799
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java
GVRPose.transformPose
public void transformPose(Matrix4f trans) { Bone bone = mBones[0]; bone.LocalMatrix.set(trans); bone.WorldMatrix.set(trans); bone.Changed = WORLD_POS | WORLD_ROT; mNeedSync = true; sync(); }
java
public void transformPose(Matrix4f trans) { Bone bone = mBones[0]; bone.LocalMatrix.set(trans); bone.WorldMatrix.set(trans); bone.Changed = WORLD_POS | WORLD_ROT; mNeedSync = true; sync(); }
[ "public", "void", "transformPose", "(", "Matrix4f", "trans", ")", "{", "Bone", "bone", "=", "mBones", "[", "0", "]", ";", "bone", ".", "LocalMatrix", ".", "set", "(", "trans", ")", ";", "bone", ".", "WorldMatrix", ".", "set", "(", "trans", ")", ";", "bone", ".", "Changed", "=", "WORLD_POS", "|", "WORLD_ROT", ";", "mNeedSync", "=", "true", ";", "sync", "(", ")", ";", "}" ]
Transform the root bone of the pose by the given matrix. @param trans matrix to transform the pose by.
[ "Transform", "the", "root", "bone", "of", "the", "pose", "by", "the", "given", "matrix", "." ]
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L690-L699