repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRTextViewSceneObject.java | GVRTextViewSceneObject.getRefreshFrequency | public IntervalFrequency getRefreshFrequency() {
switch (mRefreshInterval) {
case REALTIME_REFRESH_INTERVAL:
return IntervalFrequency.REALTIME;
case HIGH_REFRESH_INTERVAL:
return IntervalFrequency.HIGH;
case LOW_REFRESH_INTERVAL:
return IntervalFrequency.LOW;
case MEDIUM_REFRESH_INTERVAL:
return IntervalFrequency.MEDIUM;
default:
return IntervalFrequency.NONE;
}
} | java | public IntervalFrequency getRefreshFrequency() {
switch (mRefreshInterval) {
case REALTIME_REFRESH_INTERVAL:
return IntervalFrequency.REALTIME;
case HIGH_REFRESH_INTERVAL:
return IntervalFrequency.HIGH;
case LOW_REFRESH_INTERVAL:
return IntervalFrequency.LOW;
case MEDIUM_REFRESH_INTERVAL:
return IntervalFrequency.MEDIUM;
default:
return IntervalFrequency.NONE;
}
} | [
"public",
"IntervalFrequency",
"getRefreshFrequency",
"(",
")",
"{",
"switch",
"(",
"mRefreshInterval",
")",
"{",
"case",
"REALTIME_REFRESH_INTERVAL",
":",
"return",
"IntervalFrequency",
".",
"REALTIME",
";",
"case",
"HIGH_REFRESH_INTERVAL",
":",
"return",
"IntervalFreq... | Get the refresh frequency of this scene object.
@return The refresh frequency of this TextViewSceneObject. | [
"Get",
"the",
"refresh",
"frequency",
"of",
"this",
"scene",
"object",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRTextViewSceneObject.java#L627-L640 | train |
Samsung/GearVRf | GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRPlaneEmitter.java | GVRPlaneEmitter.generateParticleVelocities | private float[] generateParticleVelocities()
{
float velocities[] = new float[mEmitRate * 3];
for ( int i = 0; i < mEmitRate * 3; i +=3 )
{
Vector3f nexVel = getNextVelocity();
velocities[i] = nexVel.x;
velocities[i+1] = nexVel.y;
velocities[i+2] = nexVel.z;
}
return velocities;
} | java | private float[] generateParticleVelocities()
{
float velocities[] = new float[mEmitRate * 3];
for ( int i = 0; i < mEmitRate * 3; i +=3 )
{
Vector3f nexVel = getNextVelocity();
velocities[i] = nexVel.x;
velocities[i+1] = nexVel.y;
velocities[i+2] = nexVel.z;
}
return velocities;
} | [
"private",
"float",
"[",
"]",
"generateParticleVelocities",
"(",
")",
"{",
"float",
"velocities",
"[",
"]",
"=",
"new",
"float",
"[",
"mEmitRate",
"*",
"3",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mEmitRate",
"*",
"3",
";",
"i",... | generate random velocities in the given range
@return | [
"generate",
"random",
"velocities",
"in",
"the",
"given",
"range"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRPlaneEmitter.java#L86-L97 | train |
Samsung/GearVRf | GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRPlaneEmitter.java | GVRPlaneEmitter.generateParticleTimeStamps | private float[] generateParticleTimeStamps(float totalTime)
{
float timeStamps[] = new float[mEmitRate * 2];
for ( int i = 0; i < mEmitRate * 2; i +=2 )
{
timeStamps[i] = totalTime + mRandom.nextFloat();
timeStamps[i + 1] = 0;
}
return timeStamps;
} | java | private float[] generateParticleTimeStamps(float totalTime)
{
float timeStamps[] = new float[mEmitRate * 2];
for ( int i = 0; i < mEmitRate * 2; i +=2 )
{
timeStamps[i] = totalTime + mRandom.nextFloat();
timeStamps[i + 1] = 0;
}
return timeStamps;
} | [
"private",
"float",
"[",
"]",
"generateParticleTimeStamps",
"(",
"float",
"totalTime",
")",
"{",
"float",
"timeStamps",
"[",
"]",
"=",
"new",
"float",
"[",
"mEmitRate",
"*",
"2",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mEmitRate",
... | Generate random time stamps from the current time upto the next one second.
Passed as texture coordinates to the vertex shader, an unused field is present
with every pair passed.
@param totalTime
@return | [
"Generate",
"random",
"time",
"stamps",
"from",
"the",
"current",
"time",
"upto",
"the",
"next",
"one",
"second",
".",
"Passed",
"as",
"texture",
"coordinates",
"to",
"the",
"vertex",
"shader",
"an",
"unused",
"field",
"is",
"present",
"with",
"every",
"pair... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRPlaneEmitter.java#L107-L116 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/WidgetLib.java | WidgetLib.init | public static WidgetLib init(GVRContext gvrContext, String customPropertiesAsset)
throws InterruptedException, JSONException, NoSuchMethodException {
if (mInstance == null) {
// Constructor sets mInstance to ensure the initialization order
new WidgetLib(gvrContext, customPropertiesAsset);
}
return mInstance.get();
} | java | public static WidgetLib init(GVRContext gvrContext, String customPropertiesAsset)
throws InterruptedException, JSONException, NoSuchMethodException {
if (mInstance == null) {
// Constructor sets mInstance to ensure the initialization order
new WidgetLib(gvrContext, customPropertiesAsset);
}
return mInstance.get();
} | [
"public",
"static",
"WidgetLib",
"init",
"(",
"GVRContext",
"gvrContext",
",",
"String",
"customPropertiesAsset",
")",
"throws",
"InterruptedException",
",",
"JSONException",
",",
"NoSuchMethodException",
"{",
"if",
"(",
"mInstance",
"==",
"null",
")",
"{",
"// Cons... | Initialize an instance of Widget Lib. It has to be done before any usage of library.
The application needs to hold onto the returned WidgetLib reference for as long as the
library is going to be used.
@param gvrContext A valid {@link GVRContext} instance
@param customPropertiesAsset An optional asset JSON file containing custom and overridden
properties for the application
@return Instance of Widget library
@throws InterruptedException
@throws JSONException
@throws NoSuchMethodException | [
"Initialize",
"an",
"instance",
"of",
"Widget",
"Lib",
".",
"It",
"has",
"to",
"be",
"done",
"before",
"any",
"usage",
"of",
"library",
".",
"The",
"application",
"needs",
"to",
"hold",
"onto",
"the",
"returned",
"WidgetLib",
"reference",
"for",
"as",
"lon... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/WidgetLib.java#L49-L56 | train |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java | AnimationInteractivityManager.BuildInteractiveObjectFromAnchor | public void BuildInteractiveObjectFromAnchor(Sensor anchorSensor, String anchorDestination) {
InteractiveObject interactiveObject = new InteractiveObject();
interactiveObject.setSensor(anchorSensor, anchorDestination);
interactiveObjects.add(interactiveObject);
} | java | public void BuildInteractiveObjectFromAnchor(Sensor anchorSensor, String anchorDestination) {
InteractiveObject interactiveObject = new InteractiveObject();
interactiveObject.setSensor(anchorSensor, anchorDestination);
interactiveObjects.add(interactiveObject);
} | [
"public",
"void",
"BuildInteractiveObjectFromAnchor",
"(",
"Sensor",
"anchorSensor",
",",
"String",
"anchorDestination",
")",
"{",
"InteractiveObject",
"interactiveObject",
"=",
"new",
"InteractiveObject",
"(",
")",
";",
"interactiveObject",
".",
"setSensor",
"(",
"anch... | BuildInteractiveObjectFromAnchor is a special type of interactive object in that it does not get
built using ROUTE's.
@param anchorSensor is the Sensor that describes the sensor set to an Anchor
@param anchorDestination is either another Viewpoint, url to a web site or another x3d scene | [
"BuildInteractiveObjectFromAnchor",
"is",
"a",
"special",
"type",
"of",
"interactive",
"object",
"in",
"that",
"it",
"does",
"not",
"get",
"built",
"using",
"ROUTE",
"s",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java#L502-L506 | train |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java | AnimationInteractivityManager.RunScript | private void RunScript(InteractiveObject interactiveObject, String functionName, Object[] parameters) {
boolean complete = false;
if ( V8JavaScriptEngine) {
GVRJavascriptV8File gvrJavascriptV8File = interactiveObject.getScriptObject().getGVRJavascriptV8File();
String paramString = "var params =[";
for (int i = 0; i < parameters.length; i++ ) {
paramString += (parameters[i] + ", ");
}
paramString = paramString.substring(0, (paramString.length()-2)) + "];";
final GVRJavascriptV8File gvrJavascriptV8FileFinal = gvrJavascriptV8File;
final InteractiveObject interactiveObjectFinal = interactiveObject;
final String functionNameFinal = functionName;
final Object[] parametersFinal = parameters;
final String paramStringFinal = paramString;
gvrContext.runOnGlThread(new Runnable() {
@Override
public void run() {
RunScriptThread (gvrJavascriptV8FileFinal, interactiveObjectFinal, functionNameFinal, parametersFinal, paramStringFinal);
}
});
} // end V8JavaScriptEngine
else {
// Mozilla Rhino engine
GVRJavascriptScriptFile gvrJavascriptFile = interactiveObject.getScriptObject().getGVRJavascriptScriptFile();
complete = gvrJavascriptFile.invokeFunction(functionName, parameters);
if (complete) {
// The JavaScript (JS) ran. Now get the return
// values (saved as X3D data types such as SFColor)
// stored in 'localBindings'.
// Then call SetResultsFromScript() to set the GearVR values
Bindings localBindings = gvrJavascriptFile.getLocalBindings();
SetResultsFromScript(interactiveObject, localBindings);
} else {
Log.e(TAG, "Error in SCRIPT node '" + interactiveObject.getScriptObject().getName() +
"' running Rhino Engine JavaScript function '" + functionName + "'");
}
}
} | java | private void RunScript(InteractiveObject interactiveObject, String functionName, Object[] parameters) {
boolean complete = false;
if ( V8JavaScriptEngine) {
GVRJavascriptV8File gvrJavascriptV8File = interactiveObject.getScriptObject().getGVRJavascriptV8File();
String paramString = "var params =[";
for (int i = 0; i < parameters.length; i++ ) {
paramString += (parameters[i] + ", ");
}
paramString = paramString.substring(0, (paramString.length()-2)) + "];";
final GVRJavascriptV8File gvrJavascriptV8FileFinal = gvrJavascriptV8File;
final InteractiveObject interactiveObjectFinal = interactiveObject;
final String functionNameFinal = functionName;
final Object[] parametersFinal = parameters;
final String paramStringFinal = paramString;
gvrContext.runOnGlThread(new Runnable() {
@Override
public void run() {
RunScriptThread (gvrJavascriptV8FileFinal, interactiveObjectFinal, functionNameFinal, parametersFinal, paramStringFinal);
}
});
} // end V8JavaScriptEngine
else {
// Mozilla Rhino engine
GVRJavascriptScriptFile gvrJavascriptFile = interactiveObject.getScriptObject().getGVRJavascriptScriptFile();
complete = gvrJavascriptFile.invokeFunction(functionName, parameters);
if (complete) {
// The JavaScript (JS) ran. Now get the return
// values (saved as X3D data types such as SFColor)
// stored in 'localBindings'.
// Then call SetResultsFromScript() to set the GearVR values
Bindings localBindings = gvrJavascriptFile.getLocalBindings();
SetResultsFromScript(interactiveObject, localBindings);
} else {
Log.e(TAG, "Error in SCRIPT node '" + interactiveObject.getScriptObject().getName() +
"' running Rhino Engine JavaScript function '" + functionName + "'");
}
}
} | [
"private",
"void",
"RunScript",
"(",
"InteractiveObject",
"interactiveObject",
",",
"String",
"functionName",
",",
"Object",
"[",
"]",
"parameters",
")",
"{",
"boolean",
"complete",
"=",
"false",
";",
"if",
"(",
"V8JavaScriptEngine",
")",
"{",
"GVRJavascriptV8File... | Run the JavaScript program, Output saved in localBindings | [
"Run",
"the",
"JavaScript",
"program",
"Output",
"saved",
"in",
"localBindings"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java#L2210-L2249 | train |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java | AnimationInteractivityManager.ConvertDirectionalVectorToQuaternion | public Quaternionf ConvertDirectionalVectorToQuaternion(Vector3f d) {
d.negate();
Quaternionf q = new Quaternionf();
// check for exception condition
if ((d.x == 0) && (d.z == 0)) {
// exception condition if direction is (0,y,0):
// straight up, straight down or all zero's.
if (d.y > 0) { // direction straight up
AxisAngle4f angleAxis = new AxisAngle4f(-(float) Math.PI / 2, 1, 0,
0);
q.set(angleAxis);
} else if (d.y < 0) { // direction straight down
AxisAngle4f angleAxis = new AxisAngle4f((float) Math.PI / 2, 1, 0, 0);
q.set(angleAxis);
} else { // All zero's. Just set to identity quaternion
q.identity();
}
} else {
d.normalize();
Vector3f up = new Vector3f(0, 1, 0);
Vector3f s = new Vector3f();
d.cross(up, s);
s.normalize();
Vector3f u = new Vector3f();
d.cross(s, u);
u.normalize();
Matrix4f matrix = new Matrix4f(s.x, s.y, s.z, 0, u.x, u.y, u.z, 0, d.x,
d.y, d.z, 0, 0, 0, 0, 1);
q.setFromNormalized(matrix);
}
return q;
} | java | public Quaternionf ConvertDirectionalVectorToQuaternion(Vector3f d) {
d.negate();
Quaternionf q = new Quaternionf();
// check for exception condition
if ((d.x == 0) && (d.z == 0)) {
// exception condition if direction is (0,y,0):
// straight up, straight down or all zero's.
if (d.y > 0) { // direction straight up
AxisAngle4f angleAxis = new AxisAngle4f(-(float) Math.PI / 2, 1, 0,
0);
q.set(angleAxis);
} else if (d.y < 0) { // direction straight down
AxisAngle4f angleAxis = new AxisAngle4f((float) Math.PI / 2, 1, 0, 0);
q.set(angleAxis);
} else { // All zero's. Just set to identity quaternion
q.identity();
}
} else {
d.normalize();
Vector3f up = new Vector3f(0, 1, 0);
Vector3f s = new Vector3f();
d.cross(up, s);
s.normalize();
Vector3f u = new Vector3f();
d.cross(s, u);
u.normalize();
Matrix4f matrix = new Matrix4f(s.x, s.y, s.z, 0, u.x, u.y, u.z, 0, d.x,
d.y, d.z, 0, 0, 0, 0, 1);
q.setFromNormalized(matrix);
}
return q;
} | [
"public",
"Quaternionf",
"ConvertDirectionalVectorToQuaternion",
"(",
"Vector3f",
"d",
")",
"{",
"d",
".",
"negate",
"(",
")",
";",
"Quaternionf",
"q",
"=",
"new",
"Quaternionf",
"(",
")",
";",
"// check for exception condition",
"if",
"(",
"(",
"d",
".",
"x",... | Converts a vector into a quaternion.
Used for the direction of spot and directional lights
Called upon initialization and updates to those vectors
@param d | [
"Converts",
"a",
"vector",
"into",
"a",
"quaternion",
".",
"Used",
"for",
"the",
"direction",
"of",
"spot",
"and",
"directional",
"lights",
"Called",
"upon",
"initialization",
"and",
"updates",
"to",
"those",
"vectors"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java#L2701-L2732 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/FPSCounter.java | FPSCounter.count | public static void count() {
long duration = SystemClock.uptimeMillis() - startTime;
float avgFPS = sumFrames / (duration / 1000f);
Log.v("FPSCounter",
"total frames = %d, total elapsed time = %d ms, average fps = %f",
sumFrames, duration, avgFPS);
} | java | public static void count() {
long duration = SystemClock.uptimeMillis() - startTime;
float avgFPS = sumFrames / (duration / 1000f);
Log.v("FPSCounter",
"total frames = %d, total elapsed time = %d ms, average fps = %f",
sumFrames, duration, avgFPS);
} | [
"public",
"static",
"void",
"count",
"(",
")",
"{",
"long",
"duration",
"=",
"SystemClock",
".",
"uptimeMillis",
"(",
")",
"-",
"startTime",
";",
"float",
"avgFPS",
"=",
"sumFrames",
"/",
"(",
"duration",
"/",
"1000f",
")",
";",
"Log",
".",
"v",
"(",
... | Computes FPS average | [
"Computes",
"FPS",
"average"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/FPSCounter.java#L35-L42 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/FPSCounter.java | FPSCounter.startCheck | public static void startCheck(String extra) {
startCheckTime = System.currentTimeMillis();
nextCheckTime = startCheckTime;
Log.d(Log.SUBSYSTEM.TRACING, "FPSCounter" , "[%d] startCheck %s", startCheckTime, extra);
} | java | public static void startCheck(String extra) {
startCheckTime = System.currentTimeMillis();
nextCheckTime = startCheckTime;
Log.d(Log.SUBSYSTEM.TRACING, "FPSCounter" , "[%d] startCheck %s", startCheckTime, extra);
} | [
"public",
"static",
"void",
"startCheck",
"(",
"String",
"extra",
")",
"{",
"startCheckTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"nextCheckTime",
"=",
"startCheckTime",
";",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"TRACING",
... | Start check of execution time
@param extra | [
"Start",
"check",
"of",
"execution",
"time"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/FPSCounter.java#L56-L60 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/FPSCounter.java | FPSCounter.timeCheck | public static void timeCheck(String extra) {
if (startCheckTime > 0) {
long now = System.currentTimeMillis();
long diff = now - nextCheckTime;
nextCheckTime = now;
Log.d(Log.SUBSYSTEM.TRACING, "FPSCounter", "[%d, %d] timeCheck: %s", now, diff, extra);
}
} | java | public static void timeCheck(String extra) {
if (startCheckTime > 0) {
long now = System.currentTimeMillis();
long diff = now - nextCheckTime;
nextCheckTime = now;
Log.d(Log.SUBSYSTEM.TRACING, "FPSCounter", "[%d, %d] timeCheck: %s", now, diff, extra);
}
} | [
"public",
"static",
"void",
"timeCheck",
"(",
"String",
"extra",
")",
"{",
"if",
"(",
"startCheckTime",
">",
"0",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"long",
"diff",
"=",
"now",
"-",
"nextCheckTime",
";",
"n... | Computes execution time
@param extra | [
"Computes",
"execution",
"time"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/FPSCounter.java#L66-L73 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRMorphAnimation.java | GVRMorphAnimation.animate | public void animate(GVRHybridObject object, float animationTime)
{
GVRMeshMorph morph = (GVRMeshMorph) mTarget;
mKeyInterpolator.animate(animationTime * mDuration, mCurrentValues);
morph.setWeights(mCurrentValues);
} | java | public void animate(GVRHybridObject object, float animationTime)
{
GVRMeshMorph morph = (GVRMeshMorph) mTarget;
mKeyInterpolator.animate(animationTime * mDuration, mCurrentValues);
morph.setWeights(mCurrentValues);
} | [
"public",
"void",
"animate",
"(",
"GVRHybridObject",
"object",
",",
"float",
"animationTime",
")",
"{",
"GVRMeshMorph",
"morph",
"=",
"(",
"GVRMeshMorph",
")",
"mTarget",
";",
"mKeyInterpolator",
".",
"animate",
"(",
"animationTime",
"*",
"mDuration",
",",
"mCur... | Computes the blend weights for the given time and
updates them in the target. | [
"Computes",
"the",
"blend",
"weights",
"for",
"the",
"given",
"time",
"and",
"updates",
"them",
"in",
"the",
"target",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRMorphAnimation.java#L55-L62 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLODGroup.java | GVRLODGroup.addRange | public synchronized void addRange(final float range, final GVRSceneObject sceneObject)
{
if (null == sceneObject) {
throw new IllegalArgumentException("sceneObject must be specified!");
}
if (range < 0) {
throw new IllegalArgumentException("range cannot be negative");
}
final int size = mRanges.size();
final float rangePow2 = range*range;
final Object[] newElement = new Object[] {rangePow2, sceneObject};
for (int i = 0; i < size; ++i) {
final Object[] el = mRanges.get(i);
final Float r = (Float)el[0];
if (r > rangePow2) {
mRanges.add(i, newElement);
break;
}
}
if (mRanges.size() == size) {
mRanges.add(newElement);
}
final GVRSceneObject owner = getOwnerObject();
if (null != owner) {
owner.addChildObject(sceneObject);
}
} | java | public synchronized void addRange(final float range, final GVRSceneObject sceneObject)
{
if (null == sceneObject) {
throw new IllegalArgumentException("sceneObject must be specified!");
}
if (range < 0) {
throw new IllegalArgumentException("range cannot be negative");
}
final int size = mRanges.size();
final float rangePow2 = range*range;
final Object[] newElement = new Object[] {rangePow2, sceneObject};
for (int i = 0; i < size; ++i) {
final Object[] el = mRanges.get(i);
final Float r = (Float)el[0];
if (r > rangePow2) {
mRanges.add(i, newElement);
break;
}
}
if (mRanges.size() == size) {
mRanges.add(newElement);
}
final GVRSceneObject owner = getOwnerObject();
if (null != owner) {
owner.addChildObject(sceneObject);
}
} | [
"public",
"synchronized",
"void",
"addRange",
"(",
"final",
"float",
"range",
",",
"final",
"GVRSceneObject",
"sceneObject",
")",
"{",
"if",
"(",
"null",
"==",
"sceneObject",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"sceneObject must be specified... | Add a range to this LOD group. Specify the scene object that should be displayed in this
range. Add the LOG group as a component to the parent scene object. The scene objects
associated with each range will automatically be added as children to the parent.
@param range show the scene object if the camera distance is greater than this value
@param sceneObject scene object that should be rendered when in this range
@throws IllegalArgumentException if range is negative or sceneObject null | [
"Add",
"a",
"range",
"to",
"this",
"LOD",
"group",
".",
"Specify",
"the",
"scene",
"object",
"that",
"should",
"be",
"displayed",
"in",
"this",
"range",
".",
"Add",
"the",
"LOG",
"group",
"as",
"a",
"component",
"to",
"the",
"parent",
"scene",
"object",
... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLODGroup.java#L64-L94 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLODGroup.java | GVRLODGroup.onDrawFrame | public void onDrawFrame(float frameTime) {
final GVRSceneObject owner = getOwnerObject();
if (owner == null) {
return;
}
final int size = mRanges.size();
final GVRTransform t = getGVRContext().getMainScene().getMainCameraRig().getCenterCamera().getTransform();
for (final Object[] range : mRanges) {
((GVRSceneObject)range[1]).setEnable(false);
}
for (int i = size - 1; i >= 0; --i) {
final Object[] range = mRanges.get(i);
final GVRSceneObject child = (GVRSceneObject) range[1];
if (child.getParent() != owner) {
Log.w(TAG, "the scene object for distance greater than " + range[0] + " is not a child of the owner; skipping it");
continue;
}
final float[] values = child.getBoundingVolumeRawValues();
mCenter.set(values[0], values[1], values[2], 1.0f);
mVector.set(t.getPositionX(), t.getPositionY(), t.getPositionZ(), 1.0f);
mVector.sub(mCenter);
mVector.negate();
float distance = mVector.dot(mVector);
if (distance >= (Float) range[0]) {
child.setEnable(true);
break;
}
}
} | java | public void onDrawFrame(float frameTime) {
final GVRSceneObject owner = getOwnerObject();
if (owner == null) {
return;
}
final int size = mRanges.size();
final GVRTransform t = getGVRContext().getMainScene().getMainCameraRig().getCenterCamera().getTransform();
for (final Object[] range : mRanges) {
((GVRSceneObject)range[1]).setEnable(false);
}
for (int i = size - 1; i >= 0; --i) {
final Object[] range = mRanges.get(i);
final GVRSceneObject child = (GVRSceneObject) range[1];
if (child.getParent() != owner) {
Log.w(TAG, "the scene object for distance greater than " + range[0] + " is not a child of the owner; skipping it");
continue;
}
final float[] values = child.getBoundingVolumeRawValues();
mCenter.set(values[0], values[1], values[2], 1.0f);
mVector.set(t.getPositionX(), t.getPositionY(), t.getPositionZ(), 1.0f);
mVector.sub(mCenter);
mVector.negate();
float distance = mVector.dot(mVector);
if (distance >= (Float) range[0]) {
child.setEnable(true);
break;
}
}
} | [
"public",
"void",
"onDrawFrame",
"(",
"float",
"frameTime",
")",
"{",
"final",
"GVRSceneObject",
"owner",
"=",
"getOwnerObject",
"(",
")",
";",
"if",
"(",
"owner",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"int",
"size",
"=",
"mRanges",
".",
... | Do not call directly.
@deprecated | [
"Do",
"not",
"call",
"directly",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLODGroup.java#L100-L135 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/ShellFactory.java | ShellFactory.createConsoleShell | public static Shell createConsoleShell(String prompt, String appName, Object... handlers) {
ConsoleIO io = new ConsoleIO();
List<String> path = new ArrayList<String>(1);
path.add(prompt);
MultiMap<String, Object> modifAuxHandlers = new ArrayHashMultiMap<String, Object>();
modifAuxHandlers.put("!", io);
Shell theShell = new Shell(new Shell.Settings(io, io, modifAuxHandlers, false),
new CommandTable(new DashJoinedNamer(true)), path);
theShell.setAppName(appName);
theShell.addMainHandler(theShell, "!");
theShell.addMainHandler(new HelpCommandHandler(), "?");
for (Object h : handlers) {
theShell.addMainHandler(h, "");
}
return theShell;
} | java | public static Shell createConsoleShell(String prompt, String appName, Object... handlers) {
ConsoleIO io = new ConsoleIO();
List<String> path = new ArrayList<String>(1);
path.add(prompt);
MultiMap<String, Object> modifAuxHandlers = new ArrayHashMultiMap<String, Object>();
modifAuxHandlers.put("!", io);
Shell theShell = new Shell(new Shell.Settings(io, io, modifAuxHandlers, false),
new CommandTable(new DashJoinedNamer(true)), path);
theShell.setAppName(appName);
theShell.addMainHandler(theShell, "!");
theShell.addMainHandler(new HelpCommandHandler(), "?");
for (Object h : handlers) {
theShell.addMainHandler(h, "");
}
return theShell;
} | [
"public",
"static",
"Shell",
"createConsoleShell",
"(",
"String",
"prompt",
",",
"String",
"appName",
",",
"Object",
"...",
"handlers",
")",
"{",
"ConsoleIO",
"io",
"=",
"new",
"ConsoleIO",
"(",
")",
";",
"List",
"<",
"String",
">",
"path",
"=",
"new",
"... | One of facade methods for operating the Shell.
Run the obtained Shell with commandLoop().
@see org.gearvrf.debug.cli.Shell#Shell(org.gearvrf.debug.cli.Shell.Settings, org.gearvrf.debug.cli.CommandTable, java.util.List)
@param prompt Prompt to be displayed
@param appName The app name string
@param handlers Command handlers
@return Shell that can be either further customized or run directly by calling commandLoop(). | [
"One",
"of",
"facade",
"methods",
"for",
"operating",
"the",
"Shell",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/ShellFactory.java#L35-L55 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/ShellFactory.java | ShellFactory.createConsoleShell | public static Shell createConsoleShell(String prompt, String appName, Object mainHandler) {
return createConsoleShell(prompt, appName, mainHandler, new EmptyMultiMap<String, Object>());
} | java | public static Shell createConsoleShell(String prompt, String appName, Object mainHandler) {
return createConsoleShell(prompt, appName, mainHandler, new EmptyMultiMap<String, Object>());
} | [
"public",
"static",
"Shell",
"createConsoleShell",
"(",
"String",
"prompt",
",",
"String",
"appName",
",",
"Object",
"mainHandler",
")",
"{",
"return",
"createConsoleShell",
"(",
"prompt",
",",
"appName",
",",
"mainHandler",
",",
"new",
"EmptyMultiMap",
"<",
"St... | Facade method for operating the Shell.
Run the obtained Shell with commandLoop().
@see org.gearvrf.debug.cli.Shell#Shell(org.gearvrf.debug.cli.Shell.Settings, org.gearvrf.debug.cli.CommandTable, java.util.List)
@param prompt Prompt to be displayed
@param appName The app name string
@param mainHandler Command handler
@return Shell that can be either further customized or run directly by calling commandLoop(). | [
"Facade",
"method",
"for",
"operating",
"the",
"Shell",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/ShellFactory.java#L104-L106 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/ShellFactory.java | ShellFactory.createSubshell | public static Shell createSubshell(String pathElement, Shell parent, String appName, Object mainHandler,
MultiMap<String, Object> auxHandlers) {
List<String> newPath = new ArrayList<String>(parent.getPath());
newPath.add(pathElement);
Shell subshell = new Shell(parent.getSettings().createWithAddedAuxHandlers(auxHandlers),
new CommandTable(parent.getCommandTable().getNamer()), newPath);
subshell.setAppName(appName);
subshell.addMainHandler(subshell, "!");
subshell.addMainHandler(new HelpCommandHandler(), "?");
subshell.addMainHandler(mainHandler, "");
return subshell;
} | java | public static Shell createSubshell(String pathElement, Shell parent, String appName, Object mainHandler,
MultiMap<String, Object> auxHandlers) {
List<String> newPath = new ArrayList<String>(parent.getPath());
newPath.add(pathElement);
Shell subshell = new Shell(parent.getSettings().createWithAddedAuxHandlers(auxHandlers),
new CommandTable(parent.getCommandTable().getNamer()), newPath);
subshell.setAppName(appName);
subshell.addMainHandler(subshell, "!");
subshell.addMainHandler(new HelpCommandHandler(), "?");
subshell.addMainHandler(mainHandler, "");
return subshell;
} | [
"public",
"static",
"Shell",
"createSubshell",
"(",
"String",
"pathElement",
",",
"Shell",
"parent",
",",
"String",
"appName",
",",
"Object",
"mainHandler",
",",
"MultiMap",
"<",
"String",
",",
"Object",
">",
"auxHandlers",
")",
"{",
"List",
"<",
"String",
"... | Facade method facilitating the creation of subshell.
Subshell is created and run inside Command method and shares the same IO and naming strategy.
Run the obtained Shell with commandLoop().
@param pathElement sub-prompt
@param parent Shell to be subshell'd
@param appName The app name string
@param mainHandler Command handler
@param auxHandlers Aux handlers to be passed to all subshells.
@return subshell | [
"Facade",
"method",
"facilitating",
"the",
"creation",
"of",
"subshell",
".",
"Subshell",
"is",
"created",
"and",
"run",
"inside",
"Command",
"method",
"and",
"shares",
"the",
"same",
"IO",
"and",
"naming",
"strategy",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/ShellFactory.java#L121-L136 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/ShellFactory.java | ShellFactory.createSubshell | public static Shell createSubshell(String pathElement, Shell parent, String appName, Object mainHandler) {
return createSubshell(pathElement, parent, appName, mainHandler, new EmptyMultiMap<String, Object>());
} | java | public static Shell createSubshell(String pathElement, Shell parent, String appName, Object mainHandler) {
return createSubshell(pathElement, parent, appName, mainHandler, new EmptyMultiMap<String, Object>());
} | [
"public",
"static",
"Shell",
"createSubshell",
"(",
"String",
"pathElement",
",",
"Shell",
"parent",
",",
"String",
"appName",
",",
"Object",
"mainHandler",
")",
"{",
"return",
"createSubshell",
"(",
"pathElement",
",",
"parent",
",",
"appName",
",",
"mainHandle... | Facade method facilitating the creation of subshell.
Subshell is created and run inside Command method and shares the same IO and naming strtategy.
Run the obtained Shell with commandLoop().
@param pathElement sub-prompt
@param parent Shell to be subshell'd
@param appName The app name string
@param mainHandler Command handler
@return subshell | [
"Facade",
"method",
"facilitating",
"the",
"creation",
"of",
"subshell",
".",
"Subshell",
"is",
"created",
"and",
"run",
"inside",
"Command",
"method",
"and",
"shares",
"the",
"same",
"IO",
"and",
"naming",
"strtategy",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/ShellFactory.java#L150-L152 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRAnimationChannel.java | GVRAnimationChannel.animate | public void animate(float animationTime, Matrix4f mat)
{
mRotInterpolator.animate(animationTime, mRotKey);
mPosInterpolator.animate(animationTime, mPosKey);
mSclInterpolator.animate(animationTime, mScaleKey);
mat.translationRotateScale(mPosKey[0], mPosKey[1], mPosKey[2], mRotKey[0], mRotKey[1], mRotKey[2], mRotKey[3], mScaleKey[0], mScaleKey[1], mScaleKey[2]);
} | java | public void animate(float animationTime, Matrix4f mat)
{
mRotInterpolator.animate(animationTime, mRotKey);
mPosInterpolator.animate(animationTime, mPosKey);
mSclInterpolator.animate(animationTime, mScaleKey);
mat.translationRotateScale(mPosKey[0], mPosKey[1], mPosKey[2], mRotKey[0], mRotKey[1], mRotKey[2], mRotKey[3], mScaleKey[0], mScaleKey[1], mScaleKey[2]);
} | [
"public",
"void",
"animate",
"(",
"float",
"animationTime",
",",
"Matrix4f",
"mat",
")",
"{",
"mRotInterpolator",
".",
"animate",
"(",
"animationTime",
",",
"mRotKey",
")",
";",
"mPosInterpolator",
".",
"animate",
"(",
"animationTime",
",",
"mPosKey",
")",
";"... | Obtains the transform for a specific time in animation.
@param animationTime The time in animation.
@return The transform. | [
"Obtains",
"the",
"transform",
"for",
"a",
"specific",
"time",
"in",
"animation",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRAnimationChannel.java#L291-L298 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java | GVRPointLight.setAmbientIntensity | public void setAmbientIntensity(float r, float g, float b, float a) {
setVec4("ambient_intensity", r, g, b, a);
} | java | public void setAmbientIntensity(float r, float g, float b, float a) {
setVec4("ambient_intensity", r, g, b, a);
} | [
"public",
"void",
"setAmbientIntensity",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"setVec4",
"(",
"\"ambient_intensity\"",
",",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"}"
] | Set the ambient light intensity.
This designates the color of the ambient reflection.
It is multiplied by the material ambient color to derive
the hue of the ambient reflection for that material.
The built-in phong shader {@link GVRPhongShader} uses a {@code vec4} uniform named
{@code ambient_intensity} to control the intensity of ambient light reflected.
@param r red component (0 to 1)
@param g green component (0 to 1)
@param b blue component (0 to 1)
@param a alpha component (0 to 1) | [
"Set",
"the",
"ambient",
"light",
"intensity",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java#L116-L118 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java | GVRPointLight.setDiffuseIntensity | public void setDiffuseIntensity(float r, float g, float b, float a) {
setVec4("diffuse_intensity", r, g, b, a);
} | java | public void setDiffuseIntensity(float r, float g, float b, float a) {
setVec4("diffuse_intensity", r, g, b, a);
} | [
"public",
"void",
"setDiffuseIntensity",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"setVec4",
"(",
"\"diffuse_intensity\"",
",",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"}"
] | Set the diffuse light intensity.
This designates the color of the diffuse reflection.
It is multiplied by the material diffuse color to derive
the hue of the diffuse reflection for that material.
The built-in phong shader {@link GVRPhongShader} uses a {@code vec4} uniform named
{@code diffuse_intensity} to control the intensity of diffuse light reflected.
@param r red component (0 to 1)
@param g green component (0 to 1)
@param b blue component (0 to 1)
@param a alpha component (0 to 1) | [
"Set",
"the",
"diffuse",
"light",
"intensity",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java#L150-L152 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java | GVRPointLight.setSpecularIntensity | public void setSpecularIntensity(float r, float g, float b, float a) {
setVec4("specular_intensity", r, g, b, a);
} | java | public void setSpecularIntensity(float r, float g, float b, float a) {
setVec4("specular_intensity", r, g, b, a);
} | [
"public",
"void",
"setSpecularIntensity",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"setVec4",
"(",
"\"specular_intensity\"",
",",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"}"
] | Set the specular intensity of the light.
This designates the color of the specular reflection.
It is multiplied by the material specular color to derive
the hue of the specular reflection for that material.
The built-in phong shader {@link GVRPhongShader} uses a {@code vec4} uniform named
{@code specular_intensity} to control the specular intensity.
@param r red component (0 to 1)
@param g green component (0 to 1)
@param b blue component (0 to 1)
@param a alpha component (0 to 1) | [
"Set",
"the",
"specular",
"intensity",
"of",
"the",
"light",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java#L183-L185 | train |
Samsung/GearVRf | GVRf/Framework/backend_monoscopic/src/main/java/org/gearvrf/MonoscopicInternalSensorListener.java | MonoscopicInternalSensorListener.getQuaternionW | private float getQuaternionW(float x, float y, float z) {
return (float) Math.cos(Math.asin(Math.sqrt(x * x + y * y + z * z)));
} | java | private float getQuaternionW(float x, float y, float z) {
return (float) Math.cos(Math.asin(Math.sqrt(x * x + y * y + z * z)));
} | [
"private",
"float",
"getQuaternionW",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"return",
"(",
"float",
")",
"Math",
".",
"cos",
"(",
"Math",
".",
"asin",
"(",
"Math",
".",
"sqrt",
"(",
"x",
"*",
"x",
"+",
"y",
"*",
"y"... | Finds the missing value. Seems to lose a degree of freedom, but it
doesn't. That degree of freedom is already lost by the sensor. | [
"Finds",
"the",
"missing",
"value",
".",
"Seems",
"to",
"lose",
"a",
"degree",
"of",
"freedom",
"but",
"it",
"doesn",
"t",
".",
"That",
"degree",
"of",
"freedom",
"is",
"already",
"lost",
"by",
"the",
"sensor",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/backend_monoscopic/src/main/java/org/gearvrf/MonoscopicInternalSensorListener.java#L69-L71 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/DebugServer.java | DebugServer.shutdown | public void shutdown() {
debugConnection = null;
shuttingDown = true;
try {
if (serverSocket != null) {
serverSocket.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} | java | public void shutdown() {
debugConnection = null;
shuttingDown = true;
try {
if (serverSocket != null) {
serverSocket.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"debugConnection",
"=",
"null",
";",
"shuttingDown",
"=",
"true",
";",
"try",
"{",
"if",
"(",
"serverSocket",
"!=",
"null",
")",
"{",
"serverSocket",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"I... | Shuts down the server. Active connections are not affected. | [
"Shuts",
"down",
"the",
"server",
".",
"Active",
"connections",
"are",
"not",
"affected",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/DebugServer.java#L159-L169 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/DebugServer.java | DebugServer.run | @Override
public void run() {
ExecutorService executorService = Executors.newFixedThreadPool(maxClients);
try {
serverSocket = new ServerSocket(port, maxClients);
while (!shuttingDown) {
try {
Socket socket = serverSocket.accept();
debugConnection = new DebugConnection(socket);
executorService.submit(debugConnection);
} catch (SocketException e) {
// closed
debugConnection = null;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
debugConnection = null;
serverSocket.close();
} catch (Exception e) {
}
executorService.shutdownNow();
}
} | java | @Override
public void run() {
ExecutorService executorService = Executors.newFixedThreadPool(maxClients);
try {
serverSocket = new ServerSocket(port, maxClients);
while (!shuttingDown) {
try {
Socket socket = serverSocket.accept();
debugConnection = new DebugConnection(socket);
executorService.submit(debugConnection);
} catch (SocketException e) {
// closed
debugConnection = null;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
debugConnection = null;
serverSocket.close();
} catch (Exception e) {
}
executorService.shutdownNow();
}
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"ExecutorService",
"executorService",
"=",
"Executors",
".",
"newFixedThreadPool",
"(",
"maxClients",
")",
";",
"try",
"{",
"serverSocket",
"=",
"new",
"ServerSocket",
"(",
"port",
",",
"maxClients",
")"... | Runs the server. | [
"Runs",
"the",
"server",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/DebugServer.java#L174-L199 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRScene.java | GVRScene.removeAllSceneObjects | public synchronized void removeAllSceneObjects() {
final GVRCameraRig rig = getMainCameraRig();
final GVRSceneObject head = rig.getOwnerObject();
rig.removeAllChildren();
NativeScene.removeAllSceneObjects(getNative());
for (final GVRSceneObject child : mSceneRoot.getChildren()) {
child.getParent().removeChildObject(child);
}
if (null != head) {
mSceneRoot.addChildObject(head);
}
final int numControllers = getGVRContext().getInputManager().clear();
if (numControllers > 0)
{
getGVRContext().getInputManager().selectController();
}
getGVRContext().runOnGlThread(new Runnable() {
@Override
public void run() {
NativeScene.deleteLightsAndDepthTextureOnRenderThread(getNative());
}
});
} | java | public synchronized void removeAllSceneObjects() {
final GVRCameraRig rig = getMainCameraRig();
final GVRSceneObject head = rig.getOwnerObject();
rig.removeAllChildren();
NativeScene.removeAllSceneObjects(getNative());
for (final GVRSceneObject child : mSceneRoot.getChildren()) {
child.getParent().removeChildObject(child);
}
if (null != head) {
mSceneRoot.addChildObject(head);
}
final int numControllers = getGVRContext().getInputManager().clear();
if (numControllers > 0)
{
getGVRContext().getInputManager().selectController();
}
getGVRContext().runOnGlThread(new Runnable() {
@Override
public void run() {
NativeScene.deleteLightsAndDepthTextureOnRenderThread(getNative());
}
});
} | [
"public",
"synchronized",
"void",
"removeAllSceneObjects",
"(",
")",
"{",
"final",
"GVRCameraRig",
"rig",
"=",
"getMainCameraRig",
"(",
")",
";",
"final",
"GVRSceneObject",
"head",
"=",
"rig",
".",
"getOwnerObject",
"(",
")",
";",
"rig",
".",
"removeAllChildren"... | Remove all scene objects. | [
"Remove",
"all",
"scene",
"objects",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRScene.java#L159-L185 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.setPickRay | public void setPickRay(float ox, float oy, float oz, float dx, float dy, float dz)
{
synchronized (this)
{
mRayOrigin.x = ox;
mRayOrigin.y = oy;
mRayOrigin.z = oz;
mRayDirection.x = dx;
mRayDirection.y = dy;
mRayDirection.z = dz;
}
} | java | public void setPickRay(float ox, float oy, float oz, float dx, float dy, float dz)
{
synchronized (this)
{
mRayOrigin.x = ox;
mRayOrigin.y = oy;
mRayOrigin.z = oz;
mRayDirection.x = dx;
mRayDirection.y = dy;
mRayDirection.z = dz;
}
} | [
"public",
"void",
"setPickRay",
"(",
"float",
"ox",
",",
"float",
"oy",
",",
"float",
"oz",
",",
"float",
"dx",
",",
"float",
"dy",
",",
"float",
"dz",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"mRayOrigin",
".",
"x",
"=",
"ox",
";",
"mRayOr... | Sets the origin and direction of the pick ray.
@param ox X coordinate of origin.
@param oy Y coordinate of origin.
@param oz Z coordinate of origin.
@param dx X coordinate of ray direction.
@param dy Y coordinate of ray direction.
@param dz Z coordinate of ray direction.
The coordinate system of the ray depends on the whether the
picker is attached to a scene object or not. When attached
to a scene object, the ray is in the coordinate system of
that object where (0, 0, 0) is the center of the scene object
and (0, 0, 1) is it's positive Z axis. If not attached to an
object, the ray is in the coordinate system of the scene's
main camera with (0, 0, 0) at the viewer and (0, 0, -1)
where the viewer is looking.
@see #doPick()
@see #getPickRay()
@see #getWorldPickRay(Vector3f, Vector3f) | [
"Sets",
"the",
"origin",
"and",
"direction",
"of",
"the",
"pick",
"ray",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L418-L429 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.onDrawFrame | public void onDrawFrame(float frameTime)
{
if (isEnabled() && (mScene != null) && mPickEventLock.tryLock())
{
// Don't call if we are in the middle of processing another pick
try
{
doPick();
}
finally
{
mPickEventLock.unlock();
}
}
} | java | public void onDrawFrame(float frameTime)
{
if (isEnabled() && (mScene != null) && mPickEventLock.tryLock())
{
// Don't call if we are in the middle of processing another pick
try
{
doPick();
}
finally
{
mPickEventLock.unlock();
}
}
} | [
"public",
"void",
"onDrawFrame",
"(",
"float",
"frameTime",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
"&&",
"(",
"mScene",
"!=",
"null",
")",
"&&",
"mPickEventLock",
".",
"tryLock",
"(",
")",
")",
"{",
"// Don't call if we are in the middle of processing anoth... | Called every frame if the picker is enabled
to generate pick events.
@param frameTime starting time of the current frame | [
"Called",
"every",
"frame",
"if",
"the",
"picker",
"is",
"enabled",
"to",
"generate",
"pick",
"events",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L487-L501 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.processPick | public void processPick(boolean touched, MotionEvent event)
{
mPickEventLock.lock();
mTouched = touched;
mMotionEvent = event;
doPick();
mPickEventLock.unlock();
} | java | public void processPick(boolean touched, MotionEvent event)
{
mPickEventLock.lock();
mTouched = touched;
mMotionEvent = event;
doPick();
mPickEventLock.unlock();
} | [
"public",
"void",
"processPick",
"(",
"boolean",
"touched",
",",
"MotionEvent",
"event",
")",
"{",
"mPickEventLock",
".",
"lock",
"(",
")",
";",
"mTouched",
"=",
"touched",
";",
"mMotionEvent",
"=",
"event",
";",
"doPick",
"(",
")",
";",
"mPickEventLock",
... | Scans the scene graph to collect picked items
and generates appropriate pick and touch events.
This function is called by the cursor controller
internally but can also be used to funnel a
stream of Android motion events into the picker.
@see #pickObjects(GVRScene, float, float, float, float, float, float)
@param touched true if the "touched" button is pressed.
Which button indicates touch is controller dependent.
@param event Android MotionEvent which caused the pick
@see IPickEvents
@see ITouchEvents | [
"Scans",
"the",
"scene",
"graph",
"to",
"collect",
"picked",
"items",
"and",
"generates",
"appropriate",
"pick",
"and",
"touch",
"events",
".",
"This",
"function",
"is",
"called",
"by",
"the",
"cursor",
"controller",
"internally",
"but",
"can",
"also",
"be",
... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L555-L562 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.propagateOnNoPick | protected void propagateOnNoPick(GVRPicker picker)
{
if (mEventOptions.contains(EventOptions.SEND_PICK_EVENTS))
{
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
getGVRContext().getEventManager().sendEvent(this, IPickEvents.class, "onNoPick", picker);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
getGVRContext().getEventManager().sendEvent(mScene, IPickEvents.class, "onNoPick", picker);
}
}
} | java | protected void propagateOnNoPick(GVRPicker picker)
{
if (mEventOptions.contains(EventOptions.SEND_PICK_EVENTS))
{
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
getGVRContext().getEventManager().sendEvent(this, IPickEvents.class, "onNoPick", picker);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
getGVRContext().getEventManager().sendEvent(mScene, IPickEvents.class, "onNoPick", picker);
}
}
} | [
"protected",
"void",
"propagateOnNoPick",
"(",
"GVRPicker",
"picker",
")",
"{",
"if",
"(",
"mEventOptions",
".",
"contains",
"(",
"EventOptions",
".",
"SEND_PICK_EVENTS",
")",
")",
"{",
"if",
"(",
"mEventOptions",
".",
"contains",
"(",
"EventOptions",
".",
"SE... | Propagate onNoPick events to listeners
@param picker GVRPicker which generated the event | [
"Propagate",
"onNoPick",
"events",
"to",
"listeners"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L666-L679 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.propagateOnMotionOutside | protected void propagateOnMotionOutside(MotionEvent event)
{
if (mEventOptions.contains(EventOptions.SEND_TOUCH_EVENTS))
{
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
getGVRContext().getEventManager().sendEvent(this, ITouchEvents.class, "onMotionOutside", this, event);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
getGVRContext().getEventManager().sendEvent(mScene, ITouchEvents.class, "onMotionOutside", this, event);
}
}
} | java | protected void propagateOnMotionOutside(MotionEvent event)
{
if (mEventOptions.contains(EventOptions.SEND_TOUCH_EVENTS))
{
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
getGVRContext().getEventManager().sendEvent(this, ITouchEvents.class, "onMotionOutside", this, event);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
getGVRContext().getEventManager().sendEvent(mScene, ITouchEvents.class, "onMotionOutside", this, event);
}
}
} | [
"protected",
"void",
"propagateOnMotionOutside",
"(",
"MotionEvent",
"event",
")",
"{",
"if",
"(",
"mEventOptions",
".",
"contains",
"(",
"EventOptions",
".",
"SEND_TOUCH_EVENTS",
")",
")",
"{",
"if",
"(",
"mEventOptions",
".",
"contains",
"(",
"EventOptions",
"... | Propagate onMotionOutside events to listeners
@param MotionEvent Android MotionEvent when nothing is picked | [
"Propagate",
"onMotionOutside",
"events",
"to",
"listeners"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L704-L717 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.propagateOnEnter | protected void propagateOnEnter(GVRPickedObject hit)
{
GVRSceneObject hitObject = hit.getHitObject();
GVREventManager eventManager = getGVRContext().getEventManager();
if (mEventOptions.contains(EventOptions.SEND_TOUCH_EVENTS))
{
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
eventManager.sendEvent(this, ITouchEvents.class, "onEnter", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_HIT_OBJECT))
{
eventManager.sendEvent(hitObject, ITouchEvents.class, "onEnter", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
eventManager.sendEvent(mScene, ITouchEvents.class, "onEnter", hitObject, hit);
}
}
if (mEventOptions.contains(EventOptions.SEND_PICK_EVENTS))
{
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
eventManager.sendEvent(this, IPickEvents.class, "onEnter", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_HIT_OBJECT))
{
eventManager.sendEvent(hitObject, IPickEvents.class, "onEnter", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
eventManager.sendEvent(mScene, IPickEvents.class, "onEnter", hitObject, hit);
}
}
} | java | protected void propagateOnEnter(GVRPickedObject hit)
{
GVRSceneObject hitObject = hit.getHitObject();
GVREventManager eventManager = getGVRContext().getEventManager();
if (mEventOptions.contains(EventOptions.SEND_TOUCH_EVENTS))
{
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
eventManager.sendEvent(this, ITouchEvents.class, "onEnter", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_HIT_OBJECT))
{
eventManager.sendEvent(hitObject, ITouchEvents.class, "onEnter", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
eventManager.sendEvent(mScene, ITouchEvents.class, "onEnter", hitObject, hit);
}
}
if (mEventOptions.contains(EventOptions.SEND_PICK_EVENTS))
{
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
eventManager.sendEvent(this, IPickEvents.class, "onEnter", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_HIT_OBJECT))
{
eventManager.sendEvent(hitObject, IPickEvents.class, "onEnter", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
eventManager.sendEvent(mScene, IPickEvents.class, "onEnter", hitObject, hit);
}
}
} | [
"protected",
"void",
"propagateOnEnter",
"(",
"GVRPickedObject",
"hit",
")",
"{",
"GVRSceneObject",
"hitObject",
"=",
"hit",
".",
"getHitObject",
"(",
")",
";",
"GVREventManager",
"eventManager",
"=",
"getGVRContext",
"(",
")",
".",
"getEventManager",
"(",
")",
... | Propagate onEnter events to listeners
@param hit collision object | [
"Propagate",
"onEnter",
"events",
"to",
"listeners"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L723-L757 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.propagateOnTouch | protected void propagateOnTouch(GVRPickedObject hit)
{
if (mEventOptions.contains(EventOptions.SEND_TOUCH_EVENTS))
{
GVREventManager eventManager = getGVRContext().getEventManager();
GVRSceneObject hitObject = hit.getHitObject();
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
eventManager.sendEvent(this, ITouchEvents.class, "onTouchStart", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_HIT_OBJECT))
{
eventManager.sendEvent(hitObject, ITouchEvents.class, "onTouchStart", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
eventManager.sendEvent(mScene, ITouchEvents.class, "onTouchStart", hitObject, hit);
}
}
} | java | protected void propagateOnTouch(GVRPickedObject hit)
{
if (mEventOptions.contains(EventOptions.SEND_TOUCH_EVENTS))
{
GVREventManager eventManager = getGVRContext().getEventManager();
GVRSceneObject hitObject = hit.getHitObject();
if (mEventOptions.contains(EventOptions.SEND_TO_LISTENERS))
{
eventManager.sendEvent(this, ITouchEvents.class, "onTouchStart", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_HIT_OBJECT))
{
eventManager.sendEvent(hitObject, ITouchEvents.class, "onTouchStart", hitObject, hit);
}
if (mEventOptions.contains(EventOptions.SEND_TO_SCENE) && (mScene != null))
{
eventManager.sendEvent(mScene, ITouchEvents.class, "onTouchStart", hitObject, hit);
}
}
} | [
"protected",
"void",
"propagateOnTouch",
"(",
"GVRPickedObject",
"hit",
")",
"{",
"if",
"(",
"mEventOptions",
".",
"contains",
"(",
"EventOptions",
".",
"SEND_TOUCH_EVENTS",
")",
")",
"{",
"GVREventManager",
"eventManager",
"=",
"getGVRContext",
"(",
")",
".",
"... | Propagate onTouchStart events to listeners
@param hit collision object | [
"Propagate",
"onTouchStart",
"events",
"to",
"listeners"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L763-L782 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.findCollider | protected GVRPickedObject findCollider(GVRPickedObject[] pickList, GVRCollider findme)
{
if (pickList == null)
{
return null;
}
for (GVRPickedObject hit : pickList)
{
if ((hit != null) && (hit.hitCollider == findme))
{
return hit;
}
}
return null;
} | java | protected GVRPickedObject findCollider(GVRPickedObject[] pickList, GVRCollider findme)
{
if (pickList == null)
{
return null;
}
for (GVRPickedObject hit : pickList)
{
if ((hit != null) && (hit.hitCollider == findme))
{
return hit;
}
}
return null;
} | [
"protected",
"GVRPickedObject",
"findCollider",
"(",
"GVRPickedObject",
"[",
"]",
"pickList",
",",
"GVRCollider",
"findme",
")",
"{",
"if",
"(",
"pickList",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"GVRPickedObject",
"hit",
":",
"pickL... | Find the collision against a specific collider in a list of collisions.
@param pickList collision list
@param findme collider to find
@return collision with the specified collider, null if not found | [
"Find",
"the",
"collision",
"against",
"a",
"specific",
"collider",
"in",
"a",
"list",
"of",
"collisions",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L894-L908 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.pickObjects | public static final GVRPickedObject[] pickObjects(GVRScene scene, float ox, float oy, float oz, float dx,
float dy, float dz) {
sFindObjectsLock.lock();
try {
final GVRPickedObject[] result = NativePicker.pickObjects(scene.getNative(), 0L, ox, oy, oz, dx, dy, dz);
return result;
} finally {
sFindObjectsLock.unlock();
}
} | java | public static final GVRPickedObject[] pickObjects(GVRScene scene, float ox, float oy, float oz, float dx,
float dy, float dz) {
sFindObjectsLock.lock();
try {
final GVRPickedObject[] result = NativePicker.pickObjects(scene.getNative(), 0L, ox, oy, oz, dx, dy, dz);
return result;
} finally {
sFindObjectsLock.unlock();
}
} | [
"public",
"static",
"final",
"GVRPickedObject",
"[",
"]",
"pickObjects",
"(",
"GVRScene",
"scene",
",",
"float",
"ox",
",",
"float",
"oy",
",",
"float",
"oz",
",",
"float",
"dx",
",",
"float",
"dy",
",",
"float",
"dz",
")",
"{",
"sFindObjectsLock",
".",
... | Casts a ray into the scene graph, and returns the objects it intersects.
The ray is defined by its origin {@code [ox, oy, oz]} and its direction
{@code [dx, dy, dz]}.
<p>
The ray origin may be [0, 0, 0] and the direction components should be
normalized from -1 to 1: Note that the y direction runs from -1 at the
bottom to 1 at the top. To construct a picking ray originating at the
user's head and pointing into the scene along the camera lookat vector,
pass in 0, 0, 0 for the origin and 0, 0, -1 for the direction.
<p>
This method is thread safe because it guarantees that only
one thread at a time is doing a ray cast into a 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.
<p>
Depending on the type of collider, that the hit location may not be exactly
where the ray would intersect the scene object itself. Rather, it is
where the ray intersects the collision geometry associated with the collider.
@param scene
The {@link GVRScene} with all the objects to be tested.
@param ox
The x coordinate of the ray origin.
@param oy
The y coordinate of the ray origin.
@param oz
The z coordinate of the ray origin.
@param dx
The x vector of the ray direction.
@param dy
The y vector of the ray direction.
@param dz
The z vector of the ray direction.
@return A list of {@link GVRPickedObject}, sorted by distance from the
camera rig. Each {@link GVRPickedObject} contains the scene object
which owns the {@link GVRCollider} along with the hit
location and distance from the camera.
@since 1.6.6 | [
"Casts",
"a",
"ray",
"into",
"the",
"scene",
"graph",
"and",
"returns",
"the",
"objects",
"it",
"intersects",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L1065-L1074 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.makeHitMesh | static GVRPickedObject makeHitMesh(long colliderPointer, float distance, float hitx, float hity, float hitz,
int faceIndex, float barycentricx, float barycentricy, float barycentricz,
float texu, float texv, float normalx, float normaly, float normalz)
{
GVRCollider collider = GVRCollider.lookup(colliderPointer);
if (collider == null)
{
Log.d(TAG, "makeHit: cannot find collider for %x", colliderPointer);
return null;
}
return new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance, faceIndex,
new float[] {barycentricx, barycentricy, barycentricz},
new float[]{ texu, texv },
new float[]{normalx, normaly, normalz});
} | java | static GVRPickedObject makeHitMesh(long colliderPointer, float distance, float hitx, float hity, float hitz,
int faceIndex, float barycentricx, float barycentricy, float barycentricz,
float texu, float texv, float normalx, float normaly, float normalz)
{
GVRCollider collider = GVRCollider.lookup(colliderPointer);
if (collider == null)
{
Log.d(TAG, "makeHit: cannot find collider for %x", colliderPointer);
return null;
}
return new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance, faceIndex,
new float[] {barycentricx, barycentricy, barycentricz},
new float[]{ texu, texv },
new float[]{normalx, normaly, normalz});
} | [
"static",
"GVRPickedObject",
"makeHitMesh",
"(",
"long",
"colliderPointer",
",",
"float",
"distance",
",",
"float",
"hitx",
",",
"float",
"hity",
",",
"float",
"hitz",
",",
"int",
"faceIndex",
",",
"float",
"barycentricx",
",",
"float",
"barycentricy",
",",
"f... | Internal utility to help JNI add hit objects to the pick list. Specifically for MeshColliders with picking
for UV, Barycentric, and normal coordinates enabled | [
"Internal",
"utility",
"to",
"help",
"JNI",
"add",
"hit",
"objects",
"to",
"the",
"pick",
"list",
".",
"Specifically",
"for",
"MeshColliders",
"with",
"picking",
"for",
"UV",
"Barycentric",
"and",
"normal",
"coordinates",
"enabled"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L1233-L1247 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncAtlasInfo.java | AsyncAtlasInfo.loadAtlasInformation | public static List<GVRAtlasInformation> loadAtlasInformation(InputStream ins) {
try {
int size = ins.available();
byte[] buffer = new byte[size];
ins.read(buffer);
return loadAtlasInformation(new JSONArray(new String(buffer, "UTF-8")));
} catch (JSONException je) {
je.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
return null;
} | java | public static List<GVRAtlasInformation> loadAtlasInformation(InputStream ins) {
try {
int size = ins.available();
byte[] buffer = new byte[size];
ins.read(buffer);
return loadAtlasInformation(new JSONArray(new String(buffer, "UTF-8")));
} catch (JSONException je) {
je.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
return null;
} | [
"public",
"static",
"List",
"<",
"GVRAtlasInformation",
">",
"loadAtlasInformation",
"(",
"InputStream",
"ins",
")",
"{",
"try",
"{",
"int",
"size",
"=",
"ins",
".",
"available",
"(",
")",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"size",... | This method is a sync parse to the JSON stream of atlas information.
@return List of atlas information. | [
"This",
"method",
"is",
"a",
"sync",
"parse",
"to",
"the",
"JSON",
"stream",
"of",
"atlas",
"information",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncAtlasInfo.java#L41-L56 | train |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/node/MovieTexture.java | MovieTexture.setSpeed | public void setSpeed(float newValue) {
if (newValue < 0) newValue = 0;
this.pitch.setValue( newValue );
this.speed.setValue( newValue );
} | java | public void setSpeed(float newValue) {
if (newValue < 0) newValue = 0;
this.pitch.setValue( newValue );
this.speed.setValue( newValue );
} | [
"public",
"void",
"setSpeed",
"(",
"float",
"newValue",
")",
"{",
"if",
"(",
"newValue",
"<",
"0",
")",
"newValue",
"=",
"0",
";",
"this",
".",
"pitch",
".",
"setValue",
"(",
"newValue",
")",
";",
"this",
".",
"speed",
".",
"setValue",
"(",
"newValue... | Assign float value to inputOutput SFFloat field named speed.
Note that our implementation with ExoPlayer that pitch and speed will be set to the same value.
@param newValue | [
"Assign",
"float",
"value",
"to",
"inputOutput",
"SFFloat",
"field",
"named",
"speed",
".",
"Note",
"that",
"our",
"implementation",
"with",
"ExoPlayer",
"that",
"pitch",
"and",
"speed",
"will",
"be",
"set",
"to",
"the",
"same",
"value",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/node/MovieTexture.java#L124-L128 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderId.java | GVRShaderId.getUniformDescriptor | public String getUniformDescriptor(GVRContext ctx)
{
if (mShaderTemplate == null)
{
mShaderTemplate = makeTemplate(ID, ctx);
ctx.getShaderManager().addShaderID(this);
}
return mShaderTemplate.getUniformDescriptor();
} | java | public String getUniformDescriptor(GVRContext ctx)
{
if (mShaderTemplate == null)
{
mShaderTemplate = makeTemplate(ID, ctx);
ctx.getShaderManager().addShaderID(this);
}
return mShaderTemplate.getUniformDescriptor();
} | [
"public",
"String",
"getUniformDescriptor",
"(",
"GVRContext",
"ctx",
")",
"{",
"if",
"(",
"mShaderTemplate",
"==",
"null",
")",
"{",
"mShaderTemplate",
"=",
"makeTemplate",
"(",
"ID",
",",
"ctx",
")",
";",
"ctx",
".",
"getShaderManager",
"(",
")",
".",
"a... | Gets the string describing the uniforms used by shaders of this type.
@param ctx GVFContext shader is associated with
@return uniform descriptor string
@see #getTemplate(GVRContext) GVRShader#getUniformDescriptor() | [
"Gets",
"the",
"string",
"describing",
"the",
"uniforms",
"used",
"by",
"shaders",
"of",
"this",
"type",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderId.java#L48-L56 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderId.java | GVRShaderId.getTemplate | public GVRShader getTemplate(GVRContext ctx)
{
if (mShaderTemplate == null)
{
mShaderTemplate = makeTemplate(ID, ctx);
ctx.getShaderManager().addShaderID(this);
}
return mShaderTemplate;
} | java | public GVRShader getTemplate(GVRContext ctx)
{
if (mShaderTemplate == null)
{
mShaderTemplate = makeTemplate(ID, ctx);
ctx.getShaderManager().addShaderID(this);
}
return mShaderTemplate;
} | [
"public",
"GVRShader",
"getTemplate",
"(",
"GVRContext",
"ctx",
")",
"{",
"if",
"(",
"mShaderTemplate",
"==",
"null",
")",
"{",
"mShaderTemplate",
"=",
"makeTemplate",
"(",
"ID",
",",
"ctx",
")",
";",
"ctx",
".",
"getShaderManager",
"(",
")",
".",
"addShad... | Gets the Java subclass of GVRShader which implements
this shader type.
@param ctx GVRContext shader is associated with
@return GVRShader class implementing the shader type | [
"Gets",
"the",
"Java",
"subclass",
"of",
"GVRShader",
"which",
"implements",
"this",
"shader",
"type",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderId.java#L80-L88 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderId.java | GVRShaderId.makeTemplate | GVRShader makeTemplate(Class<? extends GVRShader> id, GVRContext ctx)
{
try
{
Constructor<? extends GVRShader> maker = id.getDeclaredConstructor(GVRContext.class);
return maker.newInstance(ctx);
}
catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex)
{
try
{
Constructor<? extends GVRShader> maker = id.getDeclaredConstructor();
return maker.newInstance();
}
catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex2)
{
ctx.getEventManager().sendEvent(ctx, IErrorEvents.class, "onError", new Object[] {ex2.getMessage(), this});
return null;
}
}
} | java | GVRShader makeTemplate(Class<? extends GVRShader> id, GVRContext ctx)
{
try
{
Constructor<? extends GVRShader> maker = id.getDeclaredConstructor(GVRContext.class);
return maker.newInstance(ctx);
}
catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex)
{
try
{
Constructor<? extends GVRShader> maker = id.getDeclaredConstructor();
return maker.newInstance();
}
catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex2)
{
ctx.getEventManager().sendEvent(ctx, IErrorEvents.class, "onError", new Object[] {ex2.getMessage(), this});
return null;
}
}
} | [
"GVRShader",
"makeTemplate",
"(",
"Class",
"<",
"?",
"extends",
"GVRShader",
">",
"id",
",",
"GVRContext",
"ctx",
")",
"{",
"try",
"{",
"Constructor",
"<",
"?",
"extends",
"GVRShader",
">",
"maker",
"=",
"id",
".",
"getDeclaredConstructor",
"(",
"GVRContext"... | Instantiates an instance of input Java shader class,
which must be derived from GVRShader or GVRShaderTemplate.
@param id Java class which implements shaders of this type.
@param ctx GVRContext shader belongs to
@return GVRShader subclass which implements this shader type | [
"Instantiates",
"an",
"instance",
"of",
"input",
"Java",
"shader",
"class",
"which",
"must",
"be",
"derived",
"from",
"GVRShader",
"or",
"GVRShaderTemplate",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderId.java#L107-L127 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/GVRAccessibilitySpeech.java | GVRAccessibilitySpeech.start | public void start(GVRAccessibilitySpeechListener speechListener) {
mTts.setSpeechListener(speechListener);
mTts.getSpeechRecognizer().startListening(mTts.getSpeechRecognizerIntent());
} | java | public void start(GVRAccessibilitySpeechListener speechListener) {
mTts.setSpeechListener(speechListener);
mTts.getSpeechRecognizer().startListening(mTts.getSpeechRecognizerIntent());
} | [
"public",
"void",
"start",
"(",
"GVRAccessibilitySpeechListener",
"speechListener",
")",
"{",
"mTts",
".",
"setSpeechListener",
"(",
"speechListener",
")",
";",
"mTts",
".",
"getSpeechRecognizer",
"(",
")",
".",
"startListening",
"(",
"mTts",
".",
"getSpeechRecogniz... | Start speech recognizer.
@param speechListener | [
"Start",
"speech",
"recognizer",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/GVRAccessibilitySpeech.java#L34-L37 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMesh.java | GVRMesh.setVertexBuffer | public void setVertexBuffer(GVRVertexBuffer vbuf)
{
if (vbuf == null)
{
throw new IllegalArgumentException("Vertex buffer cannot be null");
}
mVertices = vbuf;
NativeMesh.setVertexBuffer(getNative(), vbuf.getNative());
} | java | public void setVertexBuffer(GVRVertexBuffer vbuf)
{
if (vbuf == null)
{
throw new IllegalArgumentException("Vertex buffer cannot be null");
}
mVertices = vbuf;
NativeMesh.setVertexBuffer(getNative(), vbuf.getNative());
} | [
"public",
"void",
"setVertexBuffer",
"(",
"GVRVertexBuffer",
"vbuf",
")",
"{",
"if",
"(",
"vbuf",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Vertex buffer cannot be null\"",
")",
";",
"}",
"mVertices",
"=",
"vbuf",
";",
"NativeMe... | Changes the vertex buffer associated with this mesh.
@param vbuf new vertex buffer to use
@see #setVertices(float[])
@see #getVertexBuffer()
@see #getVertices() | [
"Changes",
"the",
"vertex",
"buffer",
"associated",
"with",
"this",
"mesh",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMesh.java#L184-L192 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMesh.java | GVRMesh.setIndexBuffer | public void setIndexBuffer(GVRIndexBuffer ibuf)
{
mIndices = ibuf;
NativeMesh.setIndexBuffer(getNative(), (ibuf != null) ? ibuf.getNative() : 0L);
} | java | public void setIndexBuffer(GVRIndexBuffer ibuf)
{
mIndices = ibuf;
NativeMesh.setIndexBuffer(getNative(), (ibuf != null) ? ibuf.getNative() : 0L);
} | [
"public",
"void",
"setIndexBuffer",
"(",
"GVRIndexBuffer",
"ibuf",
")",
"{",
"mIndices",
"=",
"ibuf",
";",
"NativeMesh",
".",
"setIndexBuffer",
"(",
"getNative",
"(",
")",
",",
"(",
"ibuf",
"!=",
"null",
")",
"?",
"ibuf",
".",
"getNative",
"(",
")",
":",... | Changes the index buffer associated with this mesh.
@param ibuf new index buffer to use
@see #setIndices(int[])
@see #getIndexBuffer()
@see #getIntIndices() | [
"Changes",
"the",
"index",
"buffer",
"associated",
"with",
"this",
"mesh",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMesh.java#L201-L205 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java | Log.rebuild | public static void rebuild(final MODE newMode) {
if (mode != newMode) {
mode = newMode;
TYPE type;
switch (mode) {
case DEBUG:
type = TYPE.ANDROID;
Log.startFullLog();
break;
case DEVELOPER:
type = TYPE.PERSISTENT;
Log.stopFullLog();
break;
case USER:
type = TYPE.ANDROID;
break;
default:
type = DEFAULT_TYPE;
Log.stopFullLog();
break;
}
currentLog = getLog(type);
}
} | java | public static void rebuild(final MODE newMode) {
if (mode != newMode) {
mode = newMode;
TYPE type;
switch (mode) {
case DEBUG:
type = TYPE.ANDROID;
Log.startFullLog();
break;
case DEVELOPER:
type = TYPE.PERSISTENT;
Log.stopFullLog();
break;
case USER:
type = TYPE.ANDROID;
break;
default:
type = DEFAULT_TYPE;
Log.stopFullLog();
break;
}
currentLog = getLog(type);
}
} | [
"public",
"static",
"void",
"rebuild",
"(",
"final",
"MODE",
"newMode",
")",
"{",
"if",
"(",
"mode",
"!=",
"newMode",
")",
"{",
"mode",
"=",
"newMode",
";",
"TYPE",
"type",
";",
"switch",
"(",
"mode",
")",
"{",
"case",
"DEBUG",
":",
"type",
"=",
"T... | Rebuild logging systems with updated mode
@param newMode log mode | [
"Rebuild",
"logging",
"systems",
"with",
"updated",
"mode"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java#L167-L190 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java | Log.e | public static int e(ISubsystem subsystem, String tag, String msg) {
return isEnabled(subsystem) ?
currentLog.e(tag, getMsg(subsystem,msg)) : 0;
} | java | public static int e(ISubsystem subsystem, String tag, String msg) {
return isEnabled(subsystem) ?
currentLog.e(tag, getMsg(subsystem,msg)) : 0;
} | [
"public",
"static",
"int",
"e",
"(",
"ISubsystem",
"subsystem",
",",
"String",
"tag",
",",
"String",
"msg",
")",
"{",
"return",
"isEnabled",
"(",
"subsystem",
")",
"?",
"currentLog",
".",
"e",
"(",
"tag",
",",
"getMsg",
"(",
"subsystem",
",",
"msg",
")... | Send an ERROR log message with specified subsystem. If subsystem is not enabled the message
will not be logged
@param subsystem logging subsystem
@param tag Used to identify the source of a log message. It usually identifies the class or
activity where the log call occurs.
@param msg The message you would like logged.
@return | [
"Send",
"an",
"ERROR",
"log",
"message",
"with",
"specified",
"subsystem",
".",
"If",
"subsystem",
"is",
"not",
"enabled",
"the",
"message",
"will",
"not",
"be",
"logged"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java#L423-L426 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java | Log.d | public static void d(ISubsystem subsystem, String tag, String pattern, Object... parameters) {
if (!isEnabled(subsystem)) return;
d(subsystem, tag, format(pattern, parameters));
} | java | public static void d(ISubsystem subsystem, String tag, String pattern, Object... parameters) {
if (!isEnabled(subsystem)) return;
d(subsystem, tag, format(pattern, parameters));
} | [
"public",
"static",
"void",
"d",
"(",
"ISubsystem",
"subsystem",
",",
"String",
"tag",
",",
"String",
"pattern",
",",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"!",
"isEnabled",
"(",
"subsystem",
")",
")",
"return",
";",
"d",
"(",
"subsystem",
... | Send a DEBUG log message with specified subsystem. If subsystem is not enabled the message
will not be logged
@param subsystem logging subsystem
@param tag Used to identify the source of a log message. It usually identifies the class or
activity where the log call occurs.
@param pattern The message pattern
@return | [
"Send",
"a",
"DEBUG",
"log",
"message",
"with",
"specified",
"subsystem",
".",
"If",
"subsystem",
"is",
"not",
"enabled",
"the",
"message",
"will",
"not",
"be",
"logged"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java#L603-L606 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java | Log.deleteOldAndEmptyFiles | private static void deleteOldAndEmptyFiles() {
File dir = LOG_FILE_DIR;
if (dir.exists()) {
File[] files = dir.listFiles();
for (File f : files) {
if (f.length() == 0 ||
f.lastModified() + MAXFILEAGE < System.currentTimeMillis()) {
f.delete();
}
}
}
} | java | private static void deleteOldAndEmptyFiles() {
File dir = LOG_FILE_DIR;
if (dir.exists()) {
File[] files = dir.listFiles();
for (File f : files) {
if (f.length() == 0 ||
f.lastModified() + MAXFILEAGE < System.currentTimeMillis()) {
f.delete();
}
}
}
} | [
"private",
"static",
"void",
"deleteOldAndEmptyFiles",
"(",
")",
"{",
"File",
"dir",
"=",
"LOG_FILE_DIR",
";",
"if",
"(",
"dir",
".",
"exists",
"(",
")",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"dir",
".",
"listFiles",
"(",
")",
";",
"for",
"(",
... | delete of files more than 1 day old | [
"delete",
"of",
"files",
"more",
"than",
"1",
"day",
"old"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java#L1217-L1229 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRExternalScene.java | GVRExternalScene.load | public boolean load(GVRScene scene)
{
GVRAssetLoader loader = getGVRContext().getAssetLoader();
if (scene == null)
{
scene = getGVRContext().getMainScene();
}
if (mReplaceScene)
{
loader.loadScene(getOwnerObject(), mVolume, mImportSettings, scene, null);
}
else
{
loader.loadModel(getOwnerObject(), mVolume, mImportSettings, scene);
}
return true;
} | java | public boolean load(GVRScene scene)
{
GVRAssetLoader loader = getGVRContext().getAssetLoader();
if (scene == null)
{
scene = getGVRContext().getMainScene();
}
if (mReplaceScene)
{
loader.loadScene(getOwnerObject(), mVolume, mImportSettings, scene, null);
}
else
{
loader.loadModel(getOwnerObject(), mVolume, mImportSettings, scene);
}
return true;
} | [
"public",
"boolean",
"load",
"(",
"GVRScene",
"scene",
")",
"{",
"GVRAssetLoader",
"loader",
"=",
"getGVRContext",
"(",
")",
".",
"getAssetLoader",
"(",
")",
";",
"if",
"(",
"scene",
"==",
"null",
")",
"{",
"scene",
"=",
"getGVRContext",
"(",
")",
".",
... | Loads the asset referenced by the file name
under the owner of this component.
If this component was constructed to replace the scene with
the asset, the scene will contain only the owner of this
component upon return. Otherwise, the loaded asset is a
child of this component's owner.
Loading the asset is performed in a separate thread.
This function returns before the asset has finished loading.
IAssetEvents are emitted to the event listener on the context.
@param scene scene to add the model to, null is permissible
@return always true | [
"Loads",
"the",
"asset",
"referenced",
"by",
"the",
"file",
"name",
"under",
"the",
"owner",
"of",
"this",
"component",
".",
"If",
"this",
"component",
"was",
"constructed",
"to",
"replace",
"the",
"scene",
"with",
"the",
"asset",
"the",
"scene",
"will",
"... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRExternalScene.java#L133-L150 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRExternalScene.java | GVRExternalScene.load | public void load(IAssetEvents handler)
{
GVRAssetLoader loader = getGVRContext().getAssetLoader();
if (mReplaceScene)
{
loader.loadScene(getOwnerObject(), mVolume, mImportSettings, getGVRContext().getMainScene(), handler);
}
else
{
loader.loadModel(mVolume, getOwnerObject(), mImportSettings, true, handler);
}
} | java | public void load(IAssetEvents handler)
{
GVRAssetLoader loader = getGVRContext().getAssetLoader();
if (mReplaceScene)
{
loader.loadScene(getOwnerObject(), mVolume, mImportSettings, getGVRContext().getMainScene(), handler);
}
else
{
loader.loadModel(mVolume, getOwnerObject(), mImportSettings, true, handler);
}
} | [
"public",
"void",
"load",
"(",
"IAssetEvents",
"handler",
")",
"{",
"GVRAssetLoader",
"loader",
"=",
"getGVRContext",
"(",
")",
".",
"getAssetLoader",
"(",
")",
";",
"if",
"(",
"mReplaceScene",
")",
"{",
"loader",
".",
"loadScene",
"(",
"getOwnerObject",
"("... | Loads the asset referenced by the file name
under the owner of this component.
If this component was constructed to replace the scene with
the asset, the main scene of the current context
will contain only the owner of this
component upon return. Otherwise, the loaded asset is a
child of this component's owner.
Loading the asset is performed in a separate thread.
This function returns before the asset has finished loading.
IAssetEvents are emitted to the input event handler and
to any event listener on the context.
@param handler
IAssetEvents handler to process asset loading events | [
"Loads",
"the",
"asset",
"referenced",
"by",
"the",
"file",
"name",
"under",
"the",
"owner",
"of",
"this",
"component",
".",
"If",
"this",
"component",
"was",
"constructed",
"to",
"replace",
"the",
"scene",
"with",
"the",
"asset",
"the",
"main",
"scene",
"... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRExternalScene.java#L169-L181 | train |
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",
")",
... | 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 | train |
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",
")... | 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 | train |
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\"",
")",
";",
"}",
... | 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 | train |
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 | train |
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 | train |
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"... | 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 | train |
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",
"Eve... | 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 | train |
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",
")",
"... | 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 | train |
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",
"(",
... | 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 | train |
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",
".",
... | 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 | train |
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",
"-... | 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 | train |
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",
"... | 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 | train |
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",
"-... | 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 | train |
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... | 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 | train |
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\"",
"... | 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 | train |
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",
"vis... | 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 | train |
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... | 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 | train |
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 | train |
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",
"(",
")",
"&&",
"o... | 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 | train |
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",
... | 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",
"wit... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRDirectLight.java#L201-L228 | train |
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",
"s... | 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 | train |
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",
"[",
"]",
"re... | 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 | train |
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",
"!=",
"nu... | 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 | train |
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",
":",
"gvrKeyFrameAnimatio... | 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",... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TimeSensor.java#L96-L111 | train |
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",
"gvrKeyFrameA... | 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 | train |
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\""... | 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 | train |
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",
"(",
... | 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 | train |
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",
"(",
")",
";... | 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 | train |
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",
",",
"hand... | 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 | train |
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",
")",
".",
... | 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 | train |
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 | train |
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\"",
",",
... | 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 | train |
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",
".",
"invoke... | 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 | train |
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",
"(",
")",
... | 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 | train |
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_OBJE... | 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 | train |
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",
... | 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 | train |
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",
... | 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 | train |
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",
"Bi... | 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 | train |
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",
";",
... | 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 | train |
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 c... | 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 | train |
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",
"... | 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",
... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/MainThread.java#L123-L130 | train |
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",
"... | 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 | train |
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",
"(",
")",
")... | 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 | train |
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",
... | 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 | train |
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",... | 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 | train |
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",
"(... | 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 | train |
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",
"(",
"off... | 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 | train |
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",
".",
"requestL... | 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 | train |
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",
... | 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 | train |
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",
"Prin... | 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 | train |
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 & repo... | 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 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.