id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
---|---|---|---|---|---|---|---|---|---|---|---|
161,900 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java
|
Layout.layoutChildren
|
public void layoutChildren() {
Set<Integer> copySet;
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "layoutChildren [%d] layout = %s",
mMeasuredChildren.size(), this);
copySet = new HashSet<>(mMeasuredChildren);
}
for (int nextMeasured: copySet) {
Widget child = mContainer.get(nextMeasured);
if (child != null) {
child.preventTransformChanged(true);
layoutChild(nextMeasured);
postLayoutChild(nextMeasured);
child.preventTransformChanged(false);
}
}
}
|
java
|
public void layoutChildren() {
Set<Integer> copySet;
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "layoutChildren [%d] layout = %s",
mMeasuredChildren.size(), this);
copySet = new HashSet<>(mMeasuredChildren);
}
for (int nextMeasured: copySet) {
Widget child = mContainer.get(nextMeasured);
if (child != null) {
child.preventTransformChanged(true);
layoutChild(nextMeasured);
postLayoutChild(nextMeasured);
child.preventTransformChanged(false);
}
}
}
|
[
"public",
"void",
"layoutChildren",
"(",
")",
"{",
"Set",
"<",
"Integer",
">",
"copySet",
";",
"synchronized",
"(",
"mMeasuredChildren",
")",
"{",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYOUT",
",",
"TAG",
",",
"\"layoutChildren [%d] layout = %s\"",
",",
"mMeasuredChildren",
".",
"size",
"(",
")",
",",
"this",
")",
";",
"copySet",
"=",
"new",
"HashSet",
"<>",
"(",
"mMeasuredChildren",
")",
";",
"}",
"for",
"(",
"int",
"nextMeasured",
":",
"copySet",
")",
"{",
"Widget",
"child",
"=",
"mContainer",
".",
"get",
"(",
"nextMeasured",
")",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"child",
".",
"preventTransformChanged",
"(",
"true",
")",
";",
"layoutChild",
"(",
"nextMeasured",
")",
";",
"postLayoutChild",
"(",
"nextMeasured",
")",
";",
"child",
".",
"preventTransformChanged",
"(",
"false",
")",
";",
"}",
"}",
"}"
] |
Layout children inside the layout container
|
[
"Layout",
"children",
"inside",
"the",
"layout",
"container"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L422-L440
|
161,901 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java
|
Layout.getViewPortSize
|
protected float getViewPortSize(final Axis axis) {
float size = mViewPort == null ? 0 : mViewPort.get(axis);
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "getViewPortSize for %s %f mViewPort = %s", axis, size, mViewPort);
return size;
}
|
java
|
protected float getViewPortSize(final Axis axis) {
float size = mViewPort == null ? 0 : mViewPort.get(axis);
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "getViewPortSize for %s %f mViewPort = %s", axis, size, mViewPort);
return size;
}
|
[
"protected",
"float",
"getViewPortSize",
"(",
"final",
"Axis",
"axis",
")",
"{",
"float",
"size",
"=",
"mViewPort",
"==",
"null",
"?",
"0",
":",
"mViewPort",
".",
"get",
"(",
"axis",
")",
";",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYOUT",
",",
"TAG",
",",
"\"getViewPortSize for %s %f mViewPort = %s\"",
",",
"axis",
",",
"size",
",",
"mViewPort",
")",
";",
"return",
"size",
";",
"}"
] |
Get viewport size along the axis
@param axis {@link Axis}
@return size
|
[
"Get",
"viewport",
"size",
"along",
"the",
"axis"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L740-L744
|
161,902 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java
|
Layout.layoutChild
|
protected void layoutChild(final int dataIndex) {
Widget child = mContainer.get(dataIndex);
if (child != null) {
float offset = mOffset.get(Axis.X);
if (!equal(offset, 0)) {
updateTransform(child, Axis.X, offset);
}
offset = mOffset.get(Axis.Y);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Y, offset);
}
offset = mOffset.get(Axis.Z);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Z, offset);
}
}
}
|
java
|
protected void layoutChild(final int dataIndex) {
Widget child = mContainer.get(dataIndex);
if (child != null) {
float offset = mOffset.get(Axis.X);
if (!equal(offset, 0)) {
updateTransform(child, Axis.X, offset);
}
offset = mOffset.get(Axis.Y);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Y, offset);
}
offset = mOffset.get(Axis.Z);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Z, offset);
}
}
}
|
[
"protected",
"void",
"layoutChild",
"(",
"final",
"int",
"dataIndex",
")",
"{",
"Widget",
"child",
"=",
"mContainer",
".",
"get",
"(",
"dataIndex",
")",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"float",
"offset",
"=",
"mOffset",
".",
"get",
"(",
"Axis",
".",
"X",
")",
";",
"if",
"(",
"!",
"equal",
"(",
"offset",
",",
"0",
")",
")",
"{",
"updateTransform",
"(",
"child",
",",
"Axis",
".",
"X",
",",
"offset",
")",
";",
"}",
"offset",
"=",
"mOffset",
".",
"get",
"(",
"Axis",
".",
"Y",
")",
";",
"if",
"(",
"!",
"equal",
"(",
"offset",
",",
"0",
")",
")",
"{",
"updateTransform",
"(",
"child",
",",
"Axis",
".",
"Y",
",",
"offset",
")",
";",
"}",
"offset",
"=",
"mOffset",
".",
"get",
"(",
"Axis",
".",
"Z",
")",
";",
"if",
"(",
"!",
"equal",
"(",
"offset",
",",
"0",
")",
")",
"{",
"updateTransform",
"(",
"child",
",",
"Axis",
".",
"Z",
",",
"offset",
")",
";",
"}",
"}",
"}"
] |
Position the child inside the layout based on the offset and axis-s factors
@param dataIndex data index
|
[
"Position",
"the",
"child",
"inside",
"the",
"layout",
"based",
"on",
"the",
"offset",
"and",
"axis",
"-",
"s",
"factors"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L780-L798
|
161,903 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java
|
Layout.postLayoutChild
|
protected void postLayoutChild(final int dataIndex) {
if (!mContainer.isDynamic()) {
boolean visibleInLayout = !mViewPort.isClippingEnabled() || inViewPort(dataIndex);
ViewPortVisibility visibility = visibleInLayout ?
ViewPortVisibility.FULLY_VISIBLE : ViewPortVisibility.INVISIBLE;
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "onLayout: child with dataId [%d] viewportVisibility = %s",
dataIndex, visibility);
Widget childWidget = mContainer.get(dataIndex);
if (childWidget != null) {
childWidget.setViewPortVisibility(visibility);
}
}
}
|
java
|
protected void postLayoutChild(final int dataIndex) {
if (!mContainer.isDynamic()) {
boolean visibleInLayout = !mViewPort.isClippingEnabled() || inViewPort(dataIndex);
ViewPortVisibility visibility = visibleInLayout ?
ViewPortVisibility.FULLY_VISIBLE : ViewPortVisibility.INVISIBLE;
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "onLayout: child with dataId [%d] viewportVisibility = %s",
dataIndex, visibility);
Widget childWidget = mContainer.get(dataIndex);
if (childWidget != null) {
childWidget.setViewPortVisibility(visibility);
}
}
}
|
[
"protected",
"void",
"postLayoutChild",
"(",
"final",
"int",
"dataIndex",
")",
"{",
"if",
"(",
"!",
"mContainer",
".",
"isDynamic",
"(",
")",
")",
"{",
"boolean",
"visibleInLayout",
"=",
"!",
"mViewPort",
".",
"isClippingEnabled",
"(",
")",
"||",
"inViewPort",
"(",
"dataIndex",
")",
";",
"ViewPortVisibility",
"visibility",
"=",
"visibleInLayout",
"?",
"ViewPortVisibility",
".",
"FULLY_VISIBLE",
":",
"ViewPortVisibility",
".",
"INVISIBLE",
";",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYOUT",
",",
"TAG",
",",
"\"onLayout: child with dataId [%d] viewportVisibility = %s\"",
",",
"dataIndex",
",",
"visibility",
")",
";",
"Widget",
"childWidget",
"=",
"mContainer",
".",
"get",
"(",
"dataIndex",
")",
";",
"if",
"(",
"childWidget",
"!=",
"null",
")",
"{",
"childWidget",
".",
"setViewPortVisibility",
"(",
"visibility",
")",
";",
"}",
"}",
"}"
] |
Do post exam of child inside the layout after it has been positioned in parent
@param dataIndex data index
|
[
"Do",
"post",
"exam",
"of",
"child",
"inside",
"the",
"layout",
"after",
"it",
"has",
"been",
"positioned",
"in",
"parent"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L804-L817
|
161,904 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCollider.java
|
GVRCollider.lookup
|
static GVRCollider lookup(long nativePointer)
{
synchronized (sColliders)
{
WeakReference<GVRCollider> weakReference = sColliders.get(nativePointer);
return weakReference == null ? null : weakReference.get();
}
}
|
java
|
static GVRCollider lookup(long nativePointer)
{
synchronized (sColliders)
{
WeakReference<GVRCollider> weakReference = sColliders.get(nativePointer);
return weakReference == null ? null : weakReference.get();
}
}
|
[
"static",
"GVRCollider",
"lookup",
"(",
"long",
"nativePointer",
")",
"{",
"synchronized",
"(",
"sColliders",
")",
"{",
"WeakReference",
"<",
"GVRCollider",
">",
"weakReference",
"=",
"sColliders",
".",
"get",
"(",
"nativePointer",
")",
";",
"return",
"weakReference",
"==",
"null",
"?",
"null",
":",
"weakReference",
".",
"get",
"(",
")",
";",
"}",
"}"
] |
Lookup a native pointer to a collider and return its Java object.
@param nativePointer native pointer to C++ Collider
@return Java GVRCollider object
|
[
"Lookup",
"a",
"native",
"pointer",
"to",
"a",
"collider",
"and",
"return",
"its",
"Java",
"object",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCollider.java#L87-L94
|
161,905 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRCubeSceneObject.java
|
GVRCubeSceneObject.createSimpleCubeSixMeshes
|
private void createSimpleCubeSixMeshes(GVRContext gvrContext,
boolean facingOut, String vertexDesc, ArrayList<GVRTexture> textureList)
{
GVRSceneObject[] children = new GVRSceneObject[6];
GVRMesh[] meshes = new GVRMesh[6];
GVRVertexBuffer vbuf = new GVRVertexBuffer(gvrContext, vertexDesc, SIMPLE_VERTICES.length / 3);
if (facingOut)
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_OUTWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_OUTWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_OUTWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_OUTWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_OUTWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_OUTWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_OUTWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_OUTWARD_BOTTOM_INDICES);
}
else
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_INWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_INWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_INWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_INWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_INWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_INWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_INWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_INWARD_BOTTOM_INDICES);
}
for (int i = 0; i < 6; i++)
{
children[i] = new GVRSceneObject(gvrContext, meshes[i], textureList.get(i));
addChildObject(children[i]);
}
// attached an empty renderData for parent object, so that we can set some common properties
GVRRenderData renderData = new GVRRenderData(gvrContext);
attachRenderData(renderData);
}
|
java
|
private void createSimpleCubeSixMeshes(GVRContext gvrContext,
boolean facingOut, String vertexDesc, ArrayList<GVRTexture> textureList)
{
GVRSceneObject[] children = new GVRSceneObject[6];
GVRMesh[] meshes = new GVRMesh[6];
GVRVertexBuffer vbuf = new GVRVertexBuffer(gvrContext, vertexDesc, SIMPLE_VERTICES.length / 3);
if (facingOut)
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_OUTWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_OUTWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_OUTWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_OUTWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_OUTWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_OUTWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_OUTWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_OUTWARD_BOTTOM_INDICES);
}
else
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_INWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_INWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_INWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_INWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_INWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_INWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_INWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_INWARD_BOTTOM_INDICES);
}
for (int i = 0; i < 6; i++)
{
children[i] = new GVRSceneObject(gvrContext, meshes[i], textureList.get(i));
addChildObject(children[i]);
}
// attached an empty renderData for parent object, so that we can set some common properties
GVRRenderData renderData = new GVRRenderData(gvrContext);
attachRenderData(renderData);
}
|
[
"private",
"void",
"createSimpleCubeSixMeshes",
"(",
"GVRContext",
"gvrContext",
",",
"boolean",
"facingOut",
",",
"String",
"vertexDesc",
",",
"ArrayList",
"<",
"GVRTexture",
">",
"textureList",
")",
"{",
"GVRSceneObject",
"[",
"]",
"children",
"=",
"new",
"GVRSceneObject",
"[",
"6",
"]",
";",
"GVRMesh",
"[",
"]",
"meshes",
"=",
"new",
"GVRMesh",
"[",
"6",
"]",
";",
"GVRVertexBuffer",
"vbuf",
"=",
"new",
"GVRVertexBuffer",
"(",
"gvrContext",
",",
"vertexDesc",
",",
"SIMPLE_VERTICES",
".",
"length",
"/",
"3",
")",
";",
"if",
"(",
"facingOut",
")",
"{",
"vbuf",
".",
"setFloatArray",
"(",
"\"a_position\"",
",",
"SIMPLE_VERTICES",
",",
"3",
",",
"0",
")",
";",
"vbuf",
".",
"setFloatArray",
"(",
"\"a_normal\"",
",",
"SIMPLE_OUTWARD_NORMALS",
",",
"3",
",",
"0",
")",
";",
"vbuf",
".",
"setFloatArray",
"(",
"\"a_texcoord\"",
",",
"SIMPLE_OUTWARD_TEXCOORDS",
",",
"2",
",",
"0",
")",
";",
"meshes",
"[",
"0",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_OUTWARD_FRONT_INDICES",
")",
";",
"meshes",
"[",
"1",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_OUTWARD_RIGHT_INDICES",
")",
";",
"meshes",
"[",
"2",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_OUTWARD_BACK_INDICES",
")",
";",
"meshes",
"[",
"3",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_OUTWARD_LEFT_INDICES",
")",
";",
"meshes",
"[",
"4",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_OUTWARD_TOP_INDICES",
")",
";",
"meshes",
"[",
"5",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_OUTWARD_BOTTOM_INDICES",
")",
";",
"}",
"else",
"{",
"vbuf",
".",
"setFloatArray",
"(",
"\"a_position\"",
",",
"SIMPLE_VERTICES",
",",
"3",
",",
"0",
")",
";",
"vbuf",
".",
"setFloatArray",
"(",
"\"a_normal\"",
",",
"SIMPLE_INWARD_NORMALS",
",",
"3",
",",
"0",
")",
";",
"vbuf",
".",
"setFloatArray",
"(",
"\"a_texcoord\"",
",",
"SIMPLE_INWARD_TEXCOORDS",
",",
"2",
",",
"0",
")",
";",
"meshes",
"[",
"0",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_INWARD_FRONT_INDICES",
")",
";",
"meshes",
"[",
"1",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_INWARD_RIGHT_INDICES",
")",
";",
"meshes",
"[",
"2",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_INWARD_BACK_INDICES",
")",
";",
"meshes",
"[",
"3",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_INWARD_LEFT_INDICES",
")",
";",
"meshes",
"[",
"4",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_INWARD_TOP_INDICES",
")",
";",
"meshes",
"[",
"5",
"]",
"=",
"createMesh",
"(",
"vbuf",
",",
"SIMPLE_INWARD_BOTTOM_INDICES",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"6",
";",
"i",
"++",
")",
"{",
"children",
"[",
"i",
"]",
"=",
"new",
"GVRSceneObject",
"(",
"gvrContext",
",",
"meshes",
"[",
"i",
"]",
",",
"textureList",
".",
"get",
"(",
"i",
")",
")",
";",
"addChildObject",
"(",
"children",
"[",
"i",
"]",
")",
";",
"}",
"// attached an empty renderData for parent object, so that we can set some common properties",
"GVRRenderData",
"renderData",
"=",
"new",
"GVRRenderData",
"(",
"gvrContext",
")",
";",
"attachRenderData",
"(",
"renderData",
")",
";",
"}"
] |
Creates a cube with each face as a separate mesh using a different texture.
The meshes will share a common vertex array but will have separate index buffers.
@param gvrContext context to use for creating cube
@param facingOut true for outward normals, false for inward normals
@param vertexDesc string describing which vertex components are desired
@param textureList list of 6 textures, one for each face
|
[
"Creates",
"a",
"cube",
"with",
"each",
"face",
"as",
"a",
"separate",
"mesh",
"using",
"a",
"different",
"texture",
".",
"The",
"meshes",
"will",
"share",
"a",
"common",
"vertex",
"array",
"but",
"will",
"have",
"separate",
"index",
"buffers",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRCubeSceneObject.java#L553-L594
|
161,906 |
Samsung/GearVRf
|
GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/arcore/ARCorePlane.java
|
ARCorePlane.update
|
protected void update(float scale) {
GVRSceneObject owner = getOwnerObject();
if (isEnabled() && (owner != null) && owner.isEnabled())
{
float w = getWidth();
float h = getHeight();
mPose.update(mARPlane.getCenterPose(), scale);
Matrix4f m = new Matrix4f();
m.set(mPose.getPoseMatrix());
m.scaleLocal(w * 0.95f, h * 0.95f, 1.0f);
owner.getTransform().setModelMatrix(m);
}
}
|
java
|
protected void update(float scale) {
GVRSceneObject owner = getOwnerObject();
if (isEnabled() && (owner != null) && owner.isEnabled())
{
float w = getWidth();
float h = getHeight();
mPose.update(mARPlane.getCenterPose(), scale);
Matrix4f m = new Matrix4f();
m.set(mPose.getPoseMatrix());
m.scaleLocal(w * 0.95f, h * 0.95f, 1.0f);
owner.getTransform().setModelMatrix(m);
}
}
|
[
"protected",
"void",
"update",
"(",
"float",
"scale",
")",
"{",
"GVRSceneObject",
"owner",
"=",
"getOwnerObject",
"(",
")",
";",
"if",
"(",
"isEnabled",
"(",
")",
"&&",
"(",
"owner",
"!=",
"null",
")",
"&&",
"owner",
".",
"isEnabled",
"(",
")",
")",
"{",
"float",
"w",
"=",
"getWidth",
"(",
")",
";",
"float",
"h",
"=",
"getHeight",
"(",
")",
";",
"mPose",
".",
"update",
"(",
"mARPlane",
".",
"getCenterPose",
"(",
")",
",",
"scale",
")",
";",
"Matrix4f",
"m",
"=",
"new",
"Matrix4f",
"(",
")",
";",
"m",
".",
"set",
"(",
"mPose",
".",
"getPoseMatrix",
"(",
")",
")",
";",
"m",
".",
"scaleLocal",
"(",
"w",
"*",
"0.95f",
",",
"h",
"*",
"0.95f",
",",
"1.0f",
")",
";",
"owner",
".",
"getTransform",
"(",
")",
".",
"setModelMatrix",
"(",
"m",
")",
";",
"}",
"}"
] |
Update the plane based on arcore best knowledge of the world
@param scale
|
[
"Update",
"the",
"plane",
"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/ARCorePlane.java#L123-L135
|
161,907 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRPositionKey.java
|
GVRPositionKey.setValue
|
public void setValue(Vector3f pos) {
mX = pos.x;
mY = pos.y;
mZ = pos.z;
}
|
java
|
public void setValue(Vector3f pos) {
mX = pos.x;
mY = pos.y;
mZ = pos.z;
}
|
[
"public",
"void",
"setValue",
"(",
"Vector3f",
"pos",
")",
"{",
"mX",
"=",
"pos",
".",
"x",
";",
"mY",
"=",
"pos",
".",
"y",
";",
"mZ",
"=",
"pos",
".",
"z",
";",
"}"
] |
Sets the position vector of the keyframe.
|
[
"Sets",
"the",
"position",
"vector",
"of",
"the",
"keyframe",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRPositionKey.java#L42-L46
|
161,908 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java
|
GVRFloatAnimation.getKey
|
public void getKey(int keyIndex, float[] values)
{
int index = keyIndex * mFloatsPerKey;
System.arraycopy(mKeys, index + 1, values, 0, values.length);
}
|
java
|
public void getKey(int keyIndex, float[] values)
{
int index = keyIndex * mFloatsPerKey;
System.arraycopy(mKeys, index + 1, values, 0, values.length);
}
|
[
"public",
"void",
"getKey",
"(",
"int",
"keyIndex",
",",
"float",
"[",
"]",
"values",
")",
"{",
"int",
"index",
"=",
"keyIndex",
"*",
"mFloatsPerKey",
";",
"System",
".",
"arraycopy",
"(",
"mKeys",
",",
"index",
"+",
"1",
",",
"values",
",",
"0",
",",
"values",
".",
"length",
")",
";",
"}"
] |
Returns the key value in the given array.
@param keyIndex the index of the scale key
|
[
"Returns",
"the",
"key",
"value",
"in",
"the",
"given",
"array",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java#L321-L325
|
161,909 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java
|
GVRFloatAnimation.setKey
|
public void setKey(int keyIndex, float time, final float[] values)
{
int index = keyIndex * mFloatsPerKey;
Integer valSize = mFloatsPerKey-1;
if (values.length != valSize)
{
throw new IllegalArgumentException("This key needs " + valSize.toString() + " float per value");
}
mKeys[index] = time;
System.arraycopy(values, 0, mKeys, index + 1, values.length);
}
|
java
|
public void setKey(int keyIndex, float time, final float[] values)
{
int index = keyIndex * mFloatsPerKey;
Integer valSize = mFloatsPerKey-1;
if (values.length != valSize)
{
throw new IllegalArgumentException("This key needs " + valSize.toString() + " float per value");
}
mKeys[index] = time;
System.arraycopy(values, 0, mKeys, index + 1, values.length);
}
|
[
"public",
"void",
"setKey",
"(",
"int",
"keyIndex",
",",
"float",
"time",
",",
"final",
"float",
"[",
"]",
"values",
")",
"{",
"int",
"index",
"=",
"keyIndex",
"*",
"mFloatsPerKey",
";",
"Integer",
"valSize",
"=",
"mFloatsPerKey",
"-",
"1",
";",
"if",
"(",
"values",
".",
"length",
"!=",
"valSize",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"This key needs \"",
"+",
"valSize",
".",
"toString",
"(",
")",
"+",
"\" float per value\"",
")",
";",
"}",
"mKeys",
"[",
"index",
"]",
"=",
"time",
";",
"System",
".",
"arraycopy",
"(",
"values",
",",
"0",
",",
"mKeys",
",",
"index",
"+",
"1",
",",
"values",
".",
"length",
")",
";",
"}"
] |
Set the time and value of the key at the given index
@param keyIndex 0 based index of key
@param time key time in seconds
@param values key values
|
[
"Set",
"the",
"time",
"and",
"value",
"of",
"the",
"key",
"at",
"the",
"given",
"index"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java#L333-L344
|
161,910 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java
|
GVRFloatAnimation.resizeKeys
|
public void resizeKeys(int numKeys)
{
int n = numKeys * mFloatsPerKey;
if (mKeys.length == n)
{
return;
}
float[] newKeys = new float[n];
n = Math.min(n, mKeys.length);
System.arraycopy(mKeys, 0, newKeys, 0, n);
mKeys = newKeys;
mFloatInterpolator.setKeyData(mKeys);
}
|
java
|
public void resizeKeys(int numKeys)
{
int n = numKeys * mFloatsPerKey;
if (mKeys.length == n)
{
return;
}
float[] newKeys = new float[n];
n = Math.min(n, mKeys.length);
System.arraycopy(mKeys, 0, newKeys, 0, n);
mKeys = newKeys;
mFloatInterpolator.setKeyData(mKeys);
}
|
[
"public",
"void",
"resizeKeys",
"(",
"int",
"numKeys",
")",
"{",
"int",
"n",
"=",
"numKeys",
"*",
"mFloatsPerKey",
";",
"if",
"(",
"mKeys",
".",
"length",
"==",
"n",
")",
"{",
"return",
";",
"}",
"float",
"[",
"]",
"newKeys",
"=",
"new",
"float",
"[",
"n",
"]",
";",
"n",
"=",
"Math",
".",
"min",
"(",
"n",
",",
"mKeys",
".",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"mKeys",
",",
"0",
",",
"newKeys",
",",
"0",
",",
"n",
")",
";",
"mKeys",
"=",
"newKeys",
";",
"mFloatInterpolator",
".",
"setKeyData",
"(",
"mKeys",
")",
";",
"}"
] |
Resize the key data area.
This function will truncate the keys if the
initial setting was too large.
@oaran numKeys the desired number of keys
|
[
"Resize",
"the",
"key",
"data",
"area",
".",
"This",
"function",
"will",
"truncate",
"the",
"keys",
"if",
"the",
"initial",
"setting",
"was",
"too",
"large",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java#L365-L378
|
161,911 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRComponent.java
|
GVRComponent.setEnable
|
public void setEnable(boolean flag) {
if (flag == mIsEnabled)
return;
mIsEnabled = flag;
if (getNative() != 0)
{
NativeComponent.setEnable(getNative(), flag);
}
if (flag)
{
onEnable();
}
else
{
onDisable();
}
}
|
java
|
public void setEnable(boolean flag) {
if (flag == mIsEnabled)
return;
mIsEnabled = flag;
if (getNative() != 0)
{
NativeComponent.setEnable(getNative(), flag);
}
if (flag)
{
onEnable();
}
else
{
onDisable();
}
}
|
[
"public",
"void",
"setEnable",
"(",
"boolean",
"flag",
")",
"{",
"if",
"(",
"flag",
"==",
"mIsEnabled",
")",
"return",
";",
"mIsEnabled",
"=",
"flag",
";",
"if",
"(",
"getNative",
"(",
")",
"!=",
"0",
")",
"{",
"NativeComponent",
".",
"setEnable",
"(",
"getNative",
"(",
")",
",",
"flag",
")",
";",
"}",
"if",
"(",
"flag",
")",
"{",
"onEnable",
"(",
")",
";",
"}",
"else",
"{",
"onDisable",
"(",
")",
";",
"}",
"}"
] |
Enable or disable this component.
@param flag true to enable, false to disable.
@see #enable()
@see #disable()
@see #isEnabled()
|
[
"Enable",
"or",
"disable",
"this",
"component",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRComponent.java#L127-L145
|
161,912 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncManager.java
|
AsyncManager.registerDatatype
|
public void registerDatatype(Class<? extends GVRHybridObject> textureClass,
AsyncLoaderFactory<? extends GVRHybridObject, ?> asyncLoaderFactory) {
mFactories.put(textureClass, asyncLoaderFactory);
}
|
java
|
public void registerDatatype(Class<? extends GVRHybridObject> textureClass,
AsyncLoaderFactory<? extends GVRHybridObject, ?> asyncLoaderFactory) {
mFactories.put(textureClass, asyncLoaderFactory);
}
|
[
"public",
"void",
"registerDatatype",
"(",
"Class",
"<",
"?",
"extends",
"GVRHybridObject",
">",
"textureClass",
",",
"AsyncLoaderFactory",
"<",
"?",
"extends",
"GVRHybridObject",
",",
"?",
">",
"asyncLoaderFactory",
")",
"{",
"mFactories",
".",
"put",
"(",
"textureClass",
",",
"asyncLoaderFactory",
")",
";",
"}"
] |
Loaders call this method to register themselves. This method can be called by
loaders provided by the application.
@param textureClass
The class the loader is responsible for loading.
@param asyncLoaderFactory
The factory object.
|
[
"Loaders",
"call",
"this",
"method",
"to",
"register",
"themselves",
".",
"This",
"method",
"can",
"be",
"called",
"by",
"loaders",
"provided",
"by",
"the",
"application",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncManager.java#L63-L66
|
161,913 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java
|
GVRContext.assertGLThread
|
public void assertGLThread() {
if (Thread.currentThread().getId() != mGLThreadID) {
RuntimeException e = new RuntimeException(
"Should not run GL functions from a non-GL thread!");
e.printStackTrace();
throw e;
}
}
|
java
|
public void assertGLThread() {
if (Thread.currentThread().getId() != mGLThreadID) {
RuntimeException e = new RuntimeException(
"Should not run GL functions from a non-GL thread!");
e.printStackTrace();
throw e;
}
}
|
[
"public",
"void",
"assertGLThread",
"(",
")",
"{",
"if",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getId",
"(",
")",
"!=",
"mGLThreadID",
")",
"{",
"RuntimeException",
"e",
"=",
"new",
"RuntimeException",
"(",
"\"Should not run GL functions from a non-GL thread!\"",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"e",
";",
"}",
"}"
] |
Throws an exception if the current thread is not a GL thread.
@since 1.6.5
|
[
"Throws",
"an",
"exception",
"if",
"the",
"current",
"thread",
"is",
"not",
"a",
"GL",
"thread",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java#L281-L288
|
161,914 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java
|
GVRContext.logError
|
public void logError(String message, Object sender) {
getEventManager().sendEvent(this, IErrorEvents.class, "onError", new Object[] { message, sender });
}
|
java
|
public void logError(String message, Object sender) {
getEventManager().sendEvent(this, IErrorEvents.class, "onError", new Object[] { message, sender });
}
|
[
"public",
"void",
"logError",
"(",
"String",
"message",
",",
"Object",
"sender",
")",
"{",
"getEventManager",
"(",
")",
".",
"sendEvent",
"(",
"this",
",",
"IErrorEvents",
".",
"class",
",",
"\"onError\"",
",",
"new",
"Object",
"[",
"]",
"{",
"message",
",",
"sender",
"}",
")",
";",
"}"
] |
Logs an error by sending an error event to all listeners.
Error events can be generated by any part of GearVRF,
from any thread. They are always sent to the event receiver
of the GVRContext.
@param message error message
@param sender object which had the error
@see IErrorEvents
|
[
"Logs",
"an",
"error",
"by",
"sending",
"an",
"error",
"event",
"to",
"all",
"listeners",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java#L353-L355
|
161,915 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java
|
GVRContext.stopDebugServer
|
public synchronized void stopDebugServer() {
if (mDebugServer == null) {
Log.e(TAG, "Debug server is not running.");
return;
}
mDebugServer.shutdown();
mDebugServer = null;
}
|
java
|
public synchronized void stopDebugServer() {
if (mDebugServer == null) {
Log.e(TAG, "Debug server is not running.");
return;
}
mDebugServer.shutdown();
mDebugServer = null;
}
|
[
"public",
"synchronized",
"void",
"stopDebugServer",
"(",
")",
"{",
"if",
"(",
"mDebugServer",
"==",
"null",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"Debug server is not running.\"",
")",
";",
"return",
";",
"}",
"mDebugServer",
".",
"shutdown",
"(",
")",
";",
"mDebugServer",
"=",
"null",
";",
"}"
] |
Stops the current debug server. Active connections are
not affected.
|
[
"Stops",
"the",
"current",
"debug",
"server",
".",
"Active",
"connections",
"are",
"not",
"affected",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java#L361-L369
|
161,916 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java
|
GVRContext.showToast
|
public void showToast(final String message, float duration) {
final float quadWidth = 1.2f;
final GVRTextViewSceneObject toastSceneObject = new GVRTextViewSceneObject(this, quadWidth, quadWidth / 5,
message);
toastSceneObject.setTextSize(6);
toastSceneObject.setTextColor(Color.WHITE);
toastSceneObject.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP);
toastSceneObject.setBackgroundColor(Color.DKGRAY);
toastSceneObject.setRefreshFrequency(GVRTextViewSceneObject.IntervalFrequency.REALTIME);
final GVRTransform t = toastSceneObject.getTransform();
t.setPositionZ(-1.5f);
final GVRRenderData rd = toastSceneObject.getRenderData();
final float finalOpacity = 0.7f;
rd.getMaterial().setOpacity(0);
rd.setRenderingOrder(2 * GVRRenderData.GVRRenderingOrder.OVERLAY);
rd.setDepthTest(false);
final GVRCameraRig rig = getMainScene().getMainCameraRig();
rig.addChildObject(toastSceneObject);
final GVRMaterialAnimation fadeOut = new GVRMaterialAnimation(rd.getMaterial(), duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(finalOpacity - ratio * finalOpacity);
}
};
fadeOut.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
rig.removeChildObject(toastSceneObject);
}
});
final GVRMaterialAnimation fadeIn = new GVRMaterialAnimation(rd.getMaterial(), 3.0f * duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(ratio * finalOpacity);
}
};
fadeIn.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
getAnimationEngine().start(fadeOut);
}
});
getAnimationEngine().start(fadeIn);
}
|
java
|
public void showToast(final String message, float duration) {
final float quadWidth = 1.2f;
final GVRTextViewSceneObject toastSceneObject = new GVRTextViewSceneObject(this, quadWidth, quadWidth / 5,
message);
toastSceneObject.setTextSize(6);
toastSceneObject.setTextColor(Color.WHITE);
toastSceneObject.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP);
toastSceneObject.setBackgroundColor(Color.DKGRAY);
toastSceneObject.setRefreshFrequency(GVRTextViewSceneObject.IntervalFrequency.REALTIME);
final GVRTransform t = toastSceneObject.getTransform();
t.setPositionZ(-1.5f);
final GVRRenderData rd = toastSceneObject.getRenderData();
final float finalOpacity = 0.7f;
rd.getMaterial().setOpacity(0);
rd.setRenderingOrder(2 * GVRRenderData.GVRRenderingOrder.OVERLAY);
rd.setDepthTest(false);
final GVRCameraRig rig = getMainScene().getMainCameraRig();
rig.addChildObject(toastSceneObject);
final GVRMaterialAnimation fadeOut = new GVRMaterialAnimation(rd.getMaterial(), duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(finalOpacity - ratio * finalOpacity);
}
};
fadeOut.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
rig.removeChildObject(toastSceneObject);
}
});
final GVRMaterialAnimation fadeIn = new GVRMaterialAnimation(rd.getMaterial(), 3.0f * duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(ratio * finalOpacity);
}
};
fadeIn.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
getAnimationEngine().start(fadeOut);
}
});
getAnimationEngine().start(fadeIn);
}
|
[
"public",
"void",
"showToast",
"(",
"final",
"String",
"message",
",",
"float",
"duration",
")",
"{",
"final",
"float",
"quadWidth",
"=",
"1.2f",
";",
"final",
"GVRTextViewSceneObject",
"toastSceneObject",
"=",
"new",
"GVRTextViewSceneObject",
"(",
"this",
",",
"quadWidth",
",",
"quadWidth",
"/",
"5",
",",
"message",
")",
";",
"toastSceneObject",
".",
"setTextSize",
"(",
"6",
")",
";",
"toastSceneObject",
".",
"setTextColor",
"(",
"Color",
".",
"WHITE",
")",
";",
"toastSceneObject",
".",
"setGravity",
"(",
"Gravity",
".",
"CENTER_HORIZONTAL",
"|",
"Gravity",
".",
"TOP",
")",
";",
"toastSceneObject",
".",
"setBackgroundColor",
"(",
"Color",
".",
"DKGRAY",
")",
";",
"toastSceneObject",
".",
"setRefreshFrequency",
"(",
"GVRTextViewSceneObject",
".",
"IntervalFrequency",
".",
"REALTIME",
")",
";",
"final",
"GVRTransform",
"t",
"=",
"toastSceneObject",
".",
"getTransform",
"(",
")",
";",
"t",
".",
"setPositionZ",
"(",
"-",
"1.5f",
")",
";",
"final",
"GVRRenderData",
"rd",
"=",
"toastSceneObject",
".",
"getRenderData",
"(",
")",
";",
"final",
"float",
"finalOpacity",
"=",
"0.7f",
";",
"rd",
".",
"getMaterial",
"(",
")",
".",
"setOpacity",
"(",
"0",
")",
";",
"rd",
".",
"setRenderingOrder",
"(",
"2",
"*",
"GVRRenderData",
".",
"GVRRenderingOrder",
".",
"OVERLAY",
")",
";",
"rd",
".",
"setDepthTest",
"(",
"false",
")",
";",
"final",
"GVRCameraRig",
"rig",
"=",
"getMainScene",
"(",
")",
".",
"getMainCameraRig",
"(",
")",
";",
"rig",
".",
"addChildObject",
"(",
"toastSceneObject",
")",
";",
"final",
"GVRMaterialAnimation",
"fadeOut",
"=",
"new",
"GVRMaterialAnimation",
"(",
"rd",
".",
"getMaterial",
"(",
")",
",",
"duration",
"/",
"4.0f",
")",
"{",
"@",
"Override",
"protected",
"void",
"animate",
"(",
"GVRHybridObject",
"target",
",",
"float",
"ratio",
")",
"{",
"final",
"GVRMaterial",
"material",
"=",
"(",
"GVRMaterial",
")",
"target",
";",
"material",
".",
"setOpacity",
"(",
"finalOpacity",
"-",
"ratio",
"*",
"finalOpacity",
")",
";",
"}",
"}",
";",
"fadeOut",
".",
"setOnFinish",
"(",
"new",
"GVROnFinish",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"finished",
"(",
"GVRAnimation",
"animation",
")",
"{",
"rig",
".",
"removeChildObject",
"(",
"toastSceneObject",
")",
";",
"}",
"}",
")",
";",
"final",
"GVRMaterialAnimation",
"fadeIn",
"=",
"new",
"GVRMaterialAnimation",
"(",
"rd",
".",
"getMaterial",
"(",
")",
",",
"3.0f",
"*",
"duration",
"/",
"4.0f",
")",
"{",
"@",
"Override",
"protected",
"void",
"animate",
"(",
"GVRHybridObject",
"target",
",",
"float",
"ratio",
")",
"{",
"final",
"GVRMaterial",
"material",
"=",
"(",
"GVRMaterial",
")",
"target",
";",
"material",
".",
"setOpacity",
"(",
"ratio",
"*",
"finalOpacity",
")",
";",
"}",
"}",
";",
"fadeIn",
".",
"setOnFinish",
"(",
"new",
"GVROnFinish",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"finished",
"(",
"GVRAnimation",
"animation",
")",
"{",
"getAnimationEngine",
"(",
")",
".",
"start",
"(",
"fadeOut",
")",
";",
"}",
"}",
")",
";",
"getAnimationEngine",
"(",
")",
".",
"start",
"(",
"fadeIn",
")",
";",
"}"
] |
Show a toast-like message for the specified duration
@param message
@param duration in seconds
|
[
"Show",
"a",
"toast",
"-",
"like",
"message",
"for",
"the",
"specified",
"duration"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java#L702-L754
|
161,917 |
Samsung/GearVRf
|
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java
|
MFVec2f.append
|
public void append(float[] newValue) {
if ( (newValue.length % 2) == 0) {
for (int i = 0; i < (newValue.length/2); i++) {
value.add( new SFVec2f(newValue[i*2], newValue[i*2+1]) );
}
}
else {
Log.e(TAG, "X3D MFVec3f append set with array length not divisible by 2");
}
}
|
java
|
public void append(float[] newValue) {
if ( (newValue.length % 2) == 0) {
for (int i = 0; i < (newValue.length/2); i++) {
value.add( new SFVec2f(newValue[i*2], newValue[i*2+1]) );
}
}
else {
Log.e(TAG, "X3D MFVec3f append set with array length not divisible by 2");
}
}
|
[
"public",
"void",
"append",
"(",
"float",
"[",
"]",
"newValue",
")",
"{",
"if",
"(",
"(",
"newValue",
".",
"length",
"%",
"2",
")",
"==",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"(",
"newValue",
".",
"length",
"/",
"2",
")",
";",
"i",
"++",
")",
"{",
"value",
".",
"add",
"(",
"new",
"SFVec2f",
"(",
"newValue",
"[",
"i",
"*",
"2",
"]",
",",
"newValue",
"[",
"i",
"*",
"2",
"+",
"1",
"]",
")",
")",
";",
"}",
"}",
"else",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"X3D MFVec3f append set with array length not divisible by 2\"",
")",
";",
"}",
"}"
] |
Places a new value at the end of the existing value array, increasing the field length accordingly.
@param newValue - the 2 floats making the new SFVec2f appended to the MFVec2f array list
|
[
"Places",
"a",
"new",
"value",
"at",
"the",
"end",
"of",
"the",
"existing",
"value",
"array",
"increasing",
"the",
"field",
"length",
"accordingly",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java#L70-L79
|
161,918 |
Samsung/GearVRf
|
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java
|
MFVec2f.insertValue
|
public void insertValue(int index, float[] newValue) {
if ( newValue.length == 2) {
try {
value.add( index, new SFVec2f(newValue[0], newValue[1]) );
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) exception " + e);
}
}
else {
Log.e(TAG, "X3D MFVec2f insertValue set with array length not equal to 2");
}
}
|
java
|
public void insertValue(int index, float[] newValue) {
if ( newValue.length == 2) {
try {
value.add( index, new SFVec2f(newValue[0], newValue[1]) );
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) exception " + e);
}
}
else {
Log.e(TAG, "X3D MFVec2f insertValue set with array length not equal to 2");
}
}
|
[
"public",
"void",
"insertValue",
"(",
"int",
"index",
",",
"float",
"[",
"]",
"newValue",
")",
"{",
"if",
"(",
"newValue",
".",
"length",
"==",
"2",
")",
"{",
"try",
"{",
"value",
".",
"add",
"(",
"index",
",",
"new",
"SFVec2f",
"(",
"newValue",
"[",
"0",
"]",
",",
"newValue",
"[",
"1",
"]",
")",
")",
";",
"}",
"catch",
"(",
"IndexOutOfBoundsException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"X3D MFVec2f get1Value(index) out of bounds.\"",
"+",
"e",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"X3D MFVec2f get1Value(index) exception \"",
"+",
"e",
")",
";",
"}",
"}",
"else",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"X3D MFVec2f insertValue set with array length not equal to 2\"",
")",
";",
"}",
"}"
] |
Insert a new value prior to the index location in the existing value array,
increasing the field length accordingly.
@param index - where the new values in an SFVec2f object will be placed in the array list
@param newValue - the new x, y value for the array list
|
[
"Insert",
"a",
"new",
"value",
"prior",
"to",
"the",
"index",
"location",
"in",
"the",
"existing",
"value",
"array",
"increasing",
"the",
"field",
"length",
"accordingly",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java#L134-L149
|
161,919 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSpotLight.java
|
GVRSpotLight.setOuterConeAngle
|
public void setOuterConeAngle(float angle)
{
setFloat("outer_cone_angle", (float) Math.cos(Math.toRadians(angle)));
mChanged.set(true);
}
|
java
|
public void setOuterConeAngle(float angle)
{
setFloat("outer_cone_angle", (float) Math.cos(Math.toRadians(angle)));
mChanged.set(true);
}
|
[
"public",
"void",
"setOuterConeAngle",
"(",
"float",
"angle",
")",
"{",
"setFloat",
"(",
"\"outer_cone_angle\"",
",",
"(",
"float",
")",
"Math",
".",
"cos",
"(",
"Math",
".",
"toRadians",
"(",
"angle",
")",
")",
")",
";",
"mChanged",
".",
"set",
"(",
"true",
")",
";",
"}"
] |
Set the inner angle of the spotlight cone in degrees.
Beyond the outer cone angle there is no illumination.
The underlying uniform "outer_cone_angle" is the cosine
of this input angle. If the inner cone angle is larger than the outer cone angle
there will be unexpected results.
@see #setInnerConeAngle(float)
@see #getOuterConeAngle()
|
[
"Set",
"the",
"inner",
"angle",
"of",
"the",
"spotlight",
"cone",
"in",
"degrees",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSpotLight.java#L144-L148
|
161,920 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSpotLight.java
|
GVRSpotLight.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
{
float angle = (float) Math.acos(getFloat("outer_cone_angle")) * 2.0f;
GVRCamera shadowCam = GVRShadowMap.makePerspShadowCamera(getGVRContext().getMainScene().getMainCameraRig().getCenterCamera(), angle);
shadowMap = new GVRShadowMap(getGVRContext(), shadowCam);
owner.attachComponent(shadowMap);
}
mChanged.set(true);
}
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
{
float angle = (float) Math.acos(getFloat("outer_cone_angle")) * 2.0f;
GVRCamera shadowCam = GVRShadowMap.makePerspShadowCamera(getGVRContext().getMainScene().getMainCameraRig().getCenterCamera(), angle);
shadowMap = new GVRShadowMap(getGVRContext(), shadowCam);
owner.attachComponent(shadowMap);
}
mChanged.set(true);
}
else if (shadowMap != null)
{
shadowMap.setEnable(false);
}
}
mCastShadow = enableFlag;
}
|
[
"public",
"void",
"setCastShadow",
"(",
"boolean",
"enableFlag",
")",
"{",
"GVRSceneObject",
"owner",
"=",
"getOwnerObject",
"(",
")",
";",
"if",
"(",
"owner",
"!=",
"null",
")",
"{",
"GVRShadowMap",
"shadowMap",
"=",
"(",
"GVRShadowMap",
")",
"getComponent",
"(",
"GVRRenderTarget",
".",
"getComponentType",
"(",
")",
")",
";",
"if",
"(",
"enableFlag",
")",
"{",
"if",
"(",
"shadowMap",
"!=",
"null",
")",
"{",
"shadowMap",
".",
"setEnable",
"(",
"true",
")",
";",
"}",
"else",
"{",
"float",
"angle",
"=",
"(",
"float",
")",
"Math",
".",
"acos",
"(",
"getFloat",
"(",
"\"outer_cone_angle\"",
")",
")",
"*",
"2.0f",
";",
"GVRCamera",
"shadowCam",
"=",
"GVRShadowMap",
".",
"makePerspShadowCamera",
"(",
"getGVRContext",
"(",
")",
".",
"getMainScene",
"(",
")",
".",
"getMainCameraRig",
"(",
")",
".",
"getCenterCamera",
"(",
")",
",",
"angle",
")",
";",
"shadowMap",
"=",
"new",
"GVRShadowMap",
"(",
"getGVRContext",
"(",
")",
",",
"shadowCam",
")",
";",
"owner",
".",
"attachComponent",
"(",
"shadowMap",
")",
";",
"}",
"mChanged",
".",
"set",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"shadowMap",
"!=",
"null",
")",
"{",
"shadowMap",
".",
"setEnable",
"(",
"false",
")",
";",
"}",
"}",
"mCastShadow",
"=",
"enableFlag",
";",
"}"
] |
Enables or disabled shadow casting for a spot light.
Enabling shadows attaches a GVRShadowMap component to the
GVRSceneObject which owns the light and provides the
component with an perspective camera for shadow casting.
@param enableFlag true to enable shadow casting, false to disable
|
[
"Enables",
"or",
"disabled",
"shadow",
"casting",
"for",
"a",
"spot",
"light",
".",
"Enabling",
"shadows",
"attaches",
"a",
"GVRShadowMap",
"component",
"to",
"the",
"GVRSceneObject",
"which",
"owns",
"the",
"light",
"and",
"provides",
"the",
"component",
"with",
"an",
"perspective",
"camera",
"for",
"shadow",
"casting",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSpotLight.java#L157-L185
|
161,921 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java
|
GVRInputManager.findCursorController
|
public GVRCursorController findCursorController(GVRControllerType type) {
for (int index = 0, size = cache.size(); index < size; index++)
{
int key = cache.keyAt(index);
GVRCursorController controller = cache.get(key);
if (controller.getControllerType().equals(type)) {
return controller;
}
}
return null;
}
|
java
|
public GVRCursorController findCursorController(GVRControllerType type) {
for (int index = 0, size = cache.size(); index < size; index++)
{
int key = cache.keyAt(index);
GVRCursorController controller = cache.get(key);
if (controller.getControllerType().equals(type)) {
return controller;
}
}
return null;
}
|
[
"public",
"GVRCursorController",
"findCursorController",
"(",
"GVRControllerType",
"type",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
",",
"size",
"=",
"cache",
".",
"size",
"(",
")",
";",
"index",
"<",
"size",
";",
"index",
"++",
")",
"{",
"int",
"key",
"=",
"cache",
".",
"keyAt",
"(",
"index",
")",
";",
"GVRCursorController",
"controller",
"=",
"cache",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"controller",
".",
"getControllerType",
"(",
")",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"controller",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Get the first controller of a specified type
@param type controller type to search for
@return controller found or null if no controllers of the given type
|
[
"Get",
"the",
"first",
"controller",
"of",
"a",
"specified",
"type"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L372-L382
|
161,922 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java
|
GVRInputManager.clear
|
public int clear()
{
int n = 0;
for (GVRCursorController c : controllers)
{
c.stopDrag();
removeCursorController(c);
++n;
}
return n;
}
|
java
|
public int clear()
{
int n = 0;
for (GVRCursorController c : controllers)
{
c.stopDrag();
removeCursorController(c);
++n;
}
return n;
}
|
[
"public",
"int",
"clear",
"(",
")",
"{",
"int",
"n",
"=",
"0",
";",
"for",
"(",
"GVRCursorController",
"c",
":",
"controllers",
")",
"{",
"c",
".",
"stopDrag",
"(",
")",
";",
"removeCursorController",
"(",
"c",
")",
";",
"++",
"n",
";",
"}",
"return",
"n",
";",
"}"
] |
Remove all controllers but leave input manager running.
@return number of controllers removed
|
[
"Remove",
"all",
"controllers",
"but",
"leave",
"input",
"manager",
"running",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L435-L445
|
161,923 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java
|
GVRInputManager.close
|
public void close()
{
inputManager.unregisterInputDeviceListener(inputDeviceListener);
mouseDeviceManager.forceStopThread();
gamepadDeviceManager.forceStopThread();
controllerIds.clear();
cache.clear();
controllers.clear();
}
|
java
|
public void close()
{
inputManager.unregisterInputDeviceListener(inputDeviceListener);
mouseDeviceManager.forceStopThread();
gamepadDeviceManager.forceStopThread();
controllerIds.clear();
cache.clear();
controllers.clear();
}
|
[
"public",
"void",
"close",
"(",
")",
"{",
"inputManager",
".",
"unregisterInputDeviceListener",
"(",
"inputDeviceListener",
")",
";",
"mouseDeviceManager",
".",
"forceStopThread",
"(",
")",
";",
"gamepadDeviceManager",
".",
"forceStopThread",
"(",
")",
";",
"controllerIds",
".",
"clear",
"(",
")",
";",
"cache",
".",
"clear",
"(",
")",
";",
"controllers",
".",
"clear",
"(",
")",
";",
"}"
] |
Shut down the input manager.
After this call, GearVRf will not be able to access IO devices.
|
[
"Shut",
"down",
"the",
"input",
"manager",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L452-L460
|
161,924 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java
|
GVRInputManager.getUniqueControllerId
|
private GVRCursorController getUniqueControllerId(int deviceId) {
GVRCursorController controller = controllerIds.get(deviceId);
if (controller != null) {
return controller;
}
return null;
}
|
java
|
private GVRCursorController getUniqueControllerId(int deviceId) {
GVRCursorController controller = controllerIds.get(deviceId);
if (controller != null) {
return controller;
}
return null;
}
|
[
"private",
"GVRCursorController",
"getUniqueControllerId",
"(",
"int",
"deviceId",
")",
"{",
"GVRCursorController",
"controller",
"=",
"controllerIds",
".",
"get",
"(",
"deviceId",
")",
";",
"if",
"(",
"controller",
"!=",
"null",
")",
"{",
"return",
"controller",
";",
"}",
"return",
"null",
";",
"}"
] |
returns null if no device is found.
|
[
"returns",
"null",
"if",
"no",
"device",
"is",
"found",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L463-L469
|
161,925 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java
|
GVRInputManager.getCacheKey
|
private int getCacheKey(InputDevice device, GVRControllerType controllerType) {
if (controllerType != GVRControllerType.UNKNOWN &&
controllerType != GVRControllerType.EXTERNAL) {
// Sometimes a device shows up using two device ids
// here we try to show both devices as one using the
// product and vendor id
int key = device.getVendorId();
key = 31 * key + device.getProductId();
key = 31 * key + controllerType.hashCode();
return key;
}
return -1; // invalid key
}
|
java
|
private int getCacheKey(InputDevice device, GVRControllerType controllerType) {
if (controllerType != GVRControllerType.UNKNOWN &&
controllerType != GVRControllerType.EXTERNAL) {
// Sometimes a device shows up using two device ids
// here we try to show both devices as one using the
// product and vendor id
int key = device.getVendorId();
key = 31 * key + device.getProductId();
key = 31 * key + controllerType.hashCode();
return key;
}
return -1; // invalid key
}
|
[
"private",
"int",
"getCacheKey",
"(",
"InputDevice",
"device",
",",
"GVRControllerType",
"controllerType",
")",
"{",
"if",
"(",
"controllerType",
"!=",
"GVRControllerType",
".",
"UNKNOWN",
"&&",
"controllerType",
"!=",
"GVRControllerType",
".",
"EXTERNAL",
")",
"{",
"// Sometimes a device shows up using two device ids",
"// here we try to show both devices as one using the",
"// product and vendor id",
"int",
"key",
"=",
"device",
".",
"getVendorId",
"(",
")",
";",
"key",
"=",
"31",
"*",
"key",
"+",
"device",
".",
"getProductId",
"(",
")",
";",
"key",
"=",
"31",
"*",
"key",
"+",
"controllerType",
".",
"hashCode",
"(",
")",
";",
"return",
"key",
";",
"}",
"return",
"-",
"1",
";",
"// invalid key",
"}"
] |
Return the key if there is one else return -1
|
[
"Return",
"the",
"key",
"if",
"there",
"is",
"one",
"else",
"return",
"-",
"1"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L511-L525
|
161,926 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java
|
GVRInputManager.addDevice
|
private GVRCursorController addDevice(int deviceId) {
InputDevice device = inputManager.getInputDevice(deviceId);
GVRControllerType controllerType = getGVRInputDeviceType(device);
if (mEnabledControllerTypes == null)
{
return null;
}
if (controllerType == GVRControllerType.GAZE && !mEnabledControllerTypes.contains(GVRControllerType.GAZE))
{
return null;
}
int key;
if (controllerType == GVRControllerType.GAZE) {
// create the controller if there isn't one.
if (gazeCursorController == null) {
gazeCursorController = new GVRGazeCursorController(context, GVRControllerType.GAZE,
GVRDeviceConstants.OCULUS_GEARVR_DEVICE_NAME,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_VENDOR_ID,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_PRODUCT_ID);
}
// use the cached gaze key
key = GAZE_CACHED_KEY;
} else {
key = getCacheKey(device, controllerType);
}
if (key != -1)
{
GVRCursorController controller = cache.get(key);
if (controller == null)
{
if ((mEnabledControllerTypes == null) || !mEnabledControllerTypes.contains(controllerType))
{
return null;
}
if (controllerType == GVRControllerType.MOUSE)
{
controller = mouseDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAMEPAD)
{
controller = gamepadDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAZE)
{
controller = gazeCursorController;
}
cache.put(key, controller);
controllerIds.put(device.getId(), controller);
return controller;
}
else
{
controllerIds.put(device.getId(), controller);
}
}
return null;
}
|
java
|
private GVRCursorController addDevice(int deviceId) {
InputDevice device = inputManager.getInputDevice(deviceId);
GVRControllerType controllerType = getGVRInputDeviceType(device);
if (mEnabledControllerTypes == null)
{
return null;
}
if (controllerType == GVRControllerType.GAZE && !mEnabledControllerTypes.contains(GVRControllerType.GAZE))
{
return null;
}
int key;
if (controllerType == GVRControllerType.GAZE) {
// create the controller if there isn't one.
if (gazeCursorController == null) {
gazeCursorController = new GVRGazeCursorController(context, GVRControllerType.GAZE,
GVRDeviceConstants.OCULUS_GEARVR_DEVICE_NAME,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_VENDOR_ID,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_PRODUCT_ID);
}
// use the cached gaze key
key = GAZE_CACHED_KEY;
} else {
key = getCacheKey(device, controllerType);
}
if (key != -1)
{
GVRCursorController controller = cache.get(key);
if (controller == null)
{
if ((mEnabledControllerTypes == null) || !mEnabledControllerTypes.contains(controllerType))
{
return null;
}
if (controllerType == GVRControllerType.MOUSE)
{
controller = mouseDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAMEPAD)
{
controller = gamepadDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAZE)
{
controller = gazeCursorController;
}
cache.put(key, controller);
controllerIds.put(device.getId(), controller);
return controller;
}
else
{
controllerIds.put(device.getId(), controller);
}
}
return null;
}
|
[
"private",
"GVRCursorController",
"addDevice",
"(",
"int",
"deviceId",
")",
"{",
"InputDevice",
"device",
"=",
"inputManager",
".",
"getInputDevice",
"(",
"deviceId",
")",
";",
"GVRControllerType",
"controllerType",
"=",
"getGVRInputDeviceType",
"(",
"device",
")",
";",
"if",
"(",
"mEnabledControllerTypes",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"controllerType",
"==",
"GVRControllerType",
".",
"GAZE",
"&&",
"!",
"mEnabledControllerTypes",
".",
"contains",
"(",
"GVRControllerType",
".",
"GAZE",
")",
")",
"{",
"return",
"null",
";",
"}",
"int",
"key",
";",
"if",
"(",
"controllerType",
"==",
"GVRControllerType",
".",
"GAZE",
")",
"{",
"// create the controller if there isn't one. ",
"if",
"(",
"gazeCursorController",
"==",
"null",
")",
"{",
"gazeCursorController",
"=",
"new",
"GVRGazeCursorController",
"(",
"context",
",",
"GVRControllerType",
".",
"GAZE",
",",
"GVRDeviceConstants",
".",
"OCULUS_GEARVR_DEVICE_NAME",
",",
"GVRDeviceConstants",
".",
"OCULUS_GEARVR_TOUCHPAD_VENDOR_ID",
",",
"GVRDeviceConstants",
".",
"OCULUS_GEARVR_TOUCHPAD_PRODUCT_ID",
")",
";",
"}",
"// use the cached gaze key",
"key",
"=",
"GAZE_CACHED_KEY",
";",
"}",
"else",
"{",
"key",
"=",
"getCacheKey",
"(",
"device",
",",
"controllerType",
")",
";",
"}",
"if",
"(",
"key",
"!=",
"-",
"1",
")",
"{",
"GVRCursorController",
"controller",
"=",
"cache",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"controller",
"==",
"null",
")",
"{",
"if",
"(",
"(",
"mEnabledControllerTypes",
"==",
"null",
")",
"||",
"!",
"mEnabledControllerTypes",
".",
"contains",
"(",
"controllerType",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"controllerType",
"==",
"GVRControllerType",
".",
"MOUSE",
")",
"{",
"controller",
"=",
"mouseDeviceManager",
".",
"getCursorController",
"(",
"context",
",",
"device",
".",
"getName",
"(",
")",
",",
"device",
".",
"getVendorId",
"(",
")",
",",
"device",
".",
"getProductId",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"controllerType",
"==",
"GVRControllerType",
".",
"GAMEPAD",
")",
"{",
"controller",
"=",
"gamepadDeviceManager",
".",
"getCursorController",
"(",
"context",
",",
"device",
".",
"getName",
"(",
")",
",",
"device",
".",
"getVendorId",
"(",
")",
",",
"device",
".",
"getProductId",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"controllerType",
"==",
"GVRControllerType",
".",
"GAZE",
")",
"{",
"controller",
"=",
"gazeCursorController",
";",
"}",
"cache",
".",
"put",
"(",
"key",
",",
"controller",
")",
";",
"controllerIds",
".",
"put",
"(",
"device",
".",
"getId",
"(",
")",
",",
"controller",
")",
";",
"return",
"controller",
";",
"}",
"else",
"{",
"controllerIds",
".",
"put",
"(",
"device",
".",
"getId",
"(",
")",
",",
"controller",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
returns controller if a new device is found
|
[
"returns",
"controller",
"if",
"a",
"new",
"device",
"is",
"found"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L528-L587
|
161,927 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTexture.java
|
GVRTexture.getAtlasInformation
|
public List<GVRAtlasInformation> getAtlasInformation()
{
if ((mImage != null) && (mImage instanceof GVRImageAtlas))
{
return ((GVRImageAtlas) mImage).getAtlasInformation();
}
return null;
}
|
java
|
public List<GVRAtlasInformation> getAtlasInformation()
{
if ((mImage != null) && (mImage instanceof GVRImageAtlas))
{
return ((GVRImageAtlas) mImage).getAtlasInformation();
}
return null;
}
|
[
"public",
"List",
"<",
"GVRAtlasInformation",
">",
"getAtlasInformation",
"(",
")",
"{",
"if",
"(",
"(",
"mImage",
"!=",
"null",
")",
"&&",
"(",
"mImage",
"instanceof",
"GVRImageAtlas",
")",
")",
"{",
"return",
"(",
"(",
"GVRImageAtlas",
")",
"mImage",
")",
".",
"getAtlasInformation",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the list of atlas information necessary to map
the texture atlas to each scene object.
@return List of atlas information.
|
[
"Returns",
"the",
"list",
"of",
"atlas",
"information",
"necessary",
"to",
"map",
"the",
"texture",
"atlas",
"to",
"each",
"scene",
"object",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTexture.java#L206-L213
|
161,928 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTexture.java
|
GVRTexture.setImage
|
public void setImage(final GVRImage imageData)
{
mImage = imageData;
if (imageData != null)
NativeTexture.setImage(getNative(), imageData, imageData.getNative());
else
NativeTexture.setImage(getNative(), null, 0);
}
|
java
|
public void setImage(final GVRImage imageData)
{
mImage = imageData;
if (imageData != null)
NativeTexture.setImage(getNative(), imageData, imageData.getNative());
else
NativeTexture.setImage(getNative(), null, 0);
}
|
[
"public",
"void",
"setImage",
"(",
"final",
"GVRImage",
"imageData",
")",
"{",
"mImage",
"=",
"imageData",
";",
"if",
"(",
"imageData",
"!=",
"null",
")",
"NativeTexture",
".",
"setImage",
"(",
"getNative",
"(",
")",
",",
"imageData",
",",
"imageData",
".",
"getNative",
"(",
")",
")",
";",
"else",
"NativeTexture",
".",
"setImage",
"(",
"getNative",
"(",
")",
",",
"null",
",",
"0",
")",
";",
"}"
] |
Changes the image data associated with a GVRTexture.
This can be a simple bitmap, a compressed bitmap,
a cubemap or a compressed cubemap.
@param imageData data for the texture as a GVRImate
|
[
"Changes",
"the",
"image",
"data",
"associated",
"with",
"a",
"GVRTexture",
".",
"This",
"can",
"be",
"a",
"simple",
"bitmap",
"a",
"compressed",
"bitmap",
"a",
"cubemap",
"or",
"a",
"compressed",
"cubemap",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTexture.java#L251-L258
|
161,929 |
Samsung/GearVRf
|
GVRf/Extensions/3DCursor/IODevices/gearwear/PhoneSide/gearinputprovider/src/main/java/com/samsung/mpl/gearinputprovider/backend/InputProviderService.java
|
InputProviderService.sendEvent
|
public static void sendEvent(Context context, Parcelable event) {
Intent intent = new Intent(EventManager.ACTION_ACCESSORY_EVENT);
intent.putExtra(EventManager.EXTRA_EVENT, event);
context.sendBroadcast(intent);
}
|
java
|
public static void sendEvent(Context context, Parcelable event) {
Intent intent = new Intent(EventManager.ACTION_ACCESSORY_EVENT);
intent.putExtra(EventManager.EXTRA_EVENT, event);
context.sendBroadcast(intent);
}
|
[
"public",
"static",
"void",
"sendEvent",
"(",
"Context",
"context",
",",
"Parcelable",
"event",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"EventManager",
".",
"ACTION_ACCESSORY_EVENT",
")",
";",
"intent",
".",
"putExtra",
"(",
"EventManager",
".",
"EXTRA_EVENT",
",",
"event",
")",
";",
"context",
".",
"sendBroadcast",
"(",
"intent",
")",
";",
"}"
] |
Send an event to other applications
@param context context in which to send the broadcast
@param event event to send
|
[
"Send",
"an",
"event",
"to",
"other",
"applications"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/gearwear/PhoneSide/gearinputprovider/src/main/java/com/samsung/mpl/gearinputprovider/backend/InputProviderService.java#L286-L290
|
161,930 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/Jassimp.java
|
Jassimp.importFile
|
public static AiScene importFile(String filename) throws IOException {
return importFile(filename, EnumSet.noneOf(AiPostProcessSteps.class));
}
|
java
|
public static AiScene importFile(String filename) throws IOException {
return importFile(filename, EnumSet.noneOf(AiPostProcessSteps.class));
}
|
[
"public",
"static",
"AiScene",
"importFile",
"(",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"return",
"importFile",
"(",
"filename",
",",
"EnumSet",
".",
"noneOf",
"(",
"AiPostProcessSteps",
".",
"class",
")",
")",
";",
"}"
] |
Imports a file via assimp without post processing.
@param filename the file to import
@return the loaded scene
@throws IOException if an error occurs
|
[
"Imports",
"a",
"file",
"via",
"assimp",
"without",
"post",
"processing",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/Jassimp.java#L77-L80
|
161,931 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java
|
GVRSkeletonAnimation.addChannel
|
public void addChannel(String boneName, GVRAnimationChannel channel)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
mBoneChannels[boneId] = channel;
mSkeleton.setBoneOptions(boneId, GVRSkeleton.BONE_ANIMATE);
Log.d("BONE", "Adding animation channel %d %s ", boneId, boneName);
}
}
|
java
|
public void addChannel(String boneName, GVRAnimationChannel channel)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
mBoneChannels[boneId] = channel;
mSkeleton.setBoneOptions(boneId, GVRSkeleton.BONE_ANIMATE);
Log.d("BONE", "Adding animation channel %d %s ", boneId, boneName);
}
}
|
[
"public",
"void",
"addChannel",
"(",
"String",
"boneName",
",",
"GVRAnimationChannel",
"channel",
")",
"{",
"int",
"boneId",
"=",
"mSkeleton",
".",
"getBoneIndex",
"(",
"boneName",
")",
";",
"if",
"(",
"boneId",
">=",
"0",
")",
"{",
"mBoneChannels",
"[",
"boneId",
"]",
"=",
"channel",
";",
"mSkeleton",
".",
"setBoneOptions",
"(",
"boneId",
",",
"GVRSkeleton",
".",
"BONE_ANIMATE",
")",
";",
"Log",
".",
"d",
"(",
"\"BONE\"",
",",
"\"Adding animation channel %d %s \"",
",",
"boneId",
",",
"boneName",
")",
";",
"}",
"}"
] |
Add a channel to the animation to animate the named bone.
@param boneName name of bone to animate.
@param channel The animation channel.
|
[
"Add",
"a",
"channel",
"to",
"the",
"animation",
"to",
"animate",
"the",
"named",
"bone",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java#L105-L114
|
161,932 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java
|
GVRSkeletonAnimation.findChannel
|
public GVRAnimationChannel findChannel(String boneName)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
return mBoneChannels[boneId];
}
return null;
}
|
java
|
public GVRAnimationChannel findChannel(String boneName)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
return mBoneChannels[boneId];
}
return null;
}
|
[
"public",
"GVRAnimationChannel",
"findChannel",
"(",
"String",
"boneName",
")",
"{",
"int",
"boneId",
"=",
"mSkeleton",
".",
"getBoneIndex",
"(",
"boneName",
")",
";",
"if",
"(",
"boneId",
">=",
"0",
")",
"{",
"return",
"mBoneChannels",
"[",
"boneId",
"]",
";",
"}",
"return",
"null",
";",
"}"
] |
Find the channel in the animation that animates the named bone.
@param boneName name of bone to animate.
|
[
"Find",
"the",
"channel",
"in",
"the",
"animation",
"that",
"animates",
"the",
"named",
"bone",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java#L120-L128
|
161,933 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java
|
GVRSkeletonAnimation.animate
|
public void animate(float timeInSec)
{
GVRSkeleton skel = getSkeleton();
GVRPose pose = skel.getPose();
computePose(timeInSec,pose);
skel.poseToBones();
skel.updateBonePose();
skel.updateSkinPose();
}
|
java
|
public void animate(float timeInSec)
{
GVRSkeleton skel = getSkeleton();
GVRPose pose = skel.getPose();
computePose(timeInSec,pose);
skel.poseToBones();
skel.updateBonePose();
skel.updateSkinPose();
}
|
[
"public",
"void",
"animate",
"(",
"float",
"timeInSec",
")",
"{",
"GVRSkeleton",
"skel",
"=",
"getSkeleton",
"(",
")",
";",
"GVRPose",
"pose",
"=",
"skel",
".",
"getPose",
"(",
")",
";",
"computePose",
"(",
"timeInSec",
",",
"pose",
")",
";",
"skel",
".",
"poseToBones",
"(",
")",
";",
"skel",
".",
"updateBonePose",
"(",
")",
";",
"skel",
".",
"updateSkinPose",
"(",
")",
";",
"}"
] |
Compute pose of skeleton at the given time from the animation channels.
@param timeInSec animation time in seconds.
|
[
"Compute",
"pose",
"of",
"skeleton",
"at",
"the",
"given",
"time",
"from",
"the",
"animation",
"channels",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java#L218-L226
|
161,934 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/ResourceCache.java
|
ResourceCache.put
|
public void put(GVRAndroidResource androidResource, T resource) {
Log.d(TAG, "put resource %s to cache", androidResource);
super.put(androidResource, resource);
}
|
java
|
public void put(GVRAndroidResource androidResource, T resource) {
Log.d(TAG, "put resource %s to cache", androidResource);
super.put(androidResource, resource);
}
|
[
"public",
"void",
"put",
"(",
"GVRAndroidResource",
"androidResource",
",",
"T",
"resource",
")",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"put resource %s to cache\"",
",",
"androidResource",
")",
";",
"super",
".",
"put",
"(",
"androidResource",
",",
"resource",
")",
";",
"}"
] |
Save a weak reference to the resource
|
[
"Save",
"a",
"weak",
"reference",
"to",
"the",
"resource"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/ResourceCache.java#L43-L47
|
161,935 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java
|
ControlBar.removeControl
|
public void removeControl(String name) {
Widget control = findChildByName(name);
if (control != null) {
removeChild(control);
if (mBgResId != -1) {
updateMesh();
}
}
}
|
java
|
public void removeControl(String name) {
Widget control = findChildByName(name);
if (control != null) {
removeChild(control);
if (mBgResId != -1) {
updateMesh();
}
}
}
|
[
"public",
"void",
"removeControl",
"(",
"String",
"name",
")",
"{",
"Widget",
"control",
"=",
"findChildByName",
"(",
"name",
")",
";",
"if",
"(",
"control",
"!=",
"null",
")",
"{",
"removeChild",
"(",
"control",
")",
";",
"if",
"(",
"mBgResId",
"!=",
"-",
"1",
")",
"{",
"updateMesh",
"(",
")",
";",
"}",
"}",
"}"
] |
Remove control from the control bar. Size of control bar is updated based on new number of
controls.
@param name name of the control to remove
|
[
"Remove",
"control",
"from",
"the",
"control",
"bar",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L135-L143
|
161,936 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java
|
ControlBar.addControl
|
public void addControl(String name, JSONObject properties, Widget.OnTouchListener listener) {
final JSONObject allowedProperties = new JSONObject();
put(allowedProperties, Widget.Properties.name, optString(properties, Widget.Properties.name));
put(allowedProperties, Widget.Properties.size, new PointF(mControlDimensions.x, mControlDimensions.y));
put(allowedProperties, Widget.Properties.states, optJSONObject(properties, Widget.Properties.states));
Widget control = new Widget(getGVRContext(), allowedProperties);
setupControl(name, control, listener, -1);
}
|
java
|
public void addControl(String name, JSONObject properties, Widget.OnTouchListener listener) {
final JSONObject allowedProperties = new JSONObject();
put(allowedProperties, Widget.Properties.name, optString(properties, Widget.Properties.name));
put(allowedProperties, Widget.Properties.size, new PointF(mControlDimensions.x, mControlDimensions.y));
put(allowedProperties, Widget.Properties.states, optJSONObject(properties, Widget.Properties.states));
Widget control = new Widget(getGVRContext(), allowedProperties);
setupControl(name, control, listener, -1);
}
|
[
"public",
"void",
"addControl",
"(",
"String",
"name",
",",
"JSONObject",
"properties",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"final",
"JSONObject",
"allowedProperties",
"=",
"new",
"JSONObject",
"(",
")",
";",
"put",
"(",
"allowedProperties",
",",
"Widget",
".",
"Properties",
".",
"name",
",",
"optString",
"(",
"properties",
",",
"Widget",
".",
"Properties",
".",
"name",
")",
")",
";",
"put",
"(",
"allowedProperties",
",",
"Widget",
".",
"Properties",
".",
"size",
",",
"new",
"PointF",
"(",
"mControlDimensions",
".",
"x",
",",
"mControlDimensions",
".",
"y",
")",
")",
";",
"put",
"(",
"allowedProperties",
",",
"Widget",
".",
"Properties",
".",
"states",
",",
"optJSONObject",
"(",
"properties",
",",
"Widget",
".",
"Properties",
".",
"states",
")",
")",
";",
"Widget",
"control",
"=",
"new",
"Widget",
"(",
"getGVRContext",
"(",
")",
",",
"allowedProperties",
")",
";",
"setupControl",
"(",
"name",
",",
"control",
",",
"listener",
",",
"-",
"1",
")",
";",
"}"
] |
Add new control at the end of control bar with specified touch listener.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param properties JSON control specific properties
@param listener touch listener
|
[
"Add",
"new",
"control",
"at",
"the",
"end",
"of",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L153-L161
|
161,937 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java
|
ControlBar.addControl
|
public Widget addControl(String name, int resId, Widget.OnTouchListener listener) {
return addControl(name, resId, null, listener, -1);
}
|
java
|
public Widget addControl(String name, int resId, Widget.OnTouchListener listener) {
return addControl(name, resId, null, listener, -1);
}
|
[
"public",
"Widget",
"addControl",
"(",
"String",
"name",
",",
"int",
"resId",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"return",
"addControl",
"(",
"name",
",",
"resId",
",",
"null",
",",
"listener",
",",
"-",
"1",
")",
";",
"}"
] |
Add new control at the end of control bar with specified touch listener and resource.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param resId the control face
@param listener touch listener
|
[
"Add",
"new",
"control",
"at",
"the",
"end",
"of",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
"and",
"resource",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L170-L172
|
161,938 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java
|
ControlBar.addControl
|
public Widget addControl(String name, int resId, String label, Widget.OnTouchListener listener) {
return addControl(name, resId, label, listener, -1);
}
|
java
|
public Widget addControl(String name, int resId, String label, Widget.OnTouchListener listener) {
return addControl(name, resId, label, listener, -1);
}
|
[
"public",
"Widget",
"addControl",
"(",
"String",
"name",
",",
"int",
"resId",
",",
"String",
"label",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"return",
"addControl",
"(",
"name",
",",
"resId",
",",
"label",
",",
"listener",
",",
"-",
"1",
")",
";",
"}"
] |
Add new control at the end of control bar with specified touch listener, control label and resource.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param resId the control face
@param label the control label
@param listener touch listener
|
[
"Add",
"new",
"control",
"at",
"the",
"end",
"of",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
"control",
"label",
"and",
"resource",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L182-L184
|
161,939 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java
|
ControlBar.addControl
|
public Widget addControl(String name, int resId, Widget.OnTouchListener listener, int position) {
Widget control = findChildByName(name);
if (control == null) {
control = createControlWidget(resId, name, null);
}
setupControl(name, control, listener, position);
return control;
}
|
java
|
public Widget addControl(String name, int resId, Widget.OnTouchListener listener, int position) {
Widget control = findChildByName(name);
if (control == null) {
control = createControlWidget(resId, name, null);
}
setupControl(name, control, listener, position);
return control;
}
|
[
"public",
"Widget",
"addControl",
"(",
"String",
"name",
",",
"int",
"resId",
",",
"Widget",
".",
"OnTouchListener",
"listener",
",",
"int",
"position",
")",
"{",
"Widget",
"control",
"=",
"findChildByName",
"(",
"name",
")",
";",
"if",
"(",
"control",
"==",
"null",
")",
"{",
"control",
"=",
"createControlWidget",
"(",
"resId",
",",
"name",
",",
"null",
")",
";",
"}",
"setupControl",
"(",
"name",
",",
"control",
",",
"listener",
",",
"position",
")",
";",
"return",
"control",
";",
"}"
] |
Add new control at the control bar with specified touch listener, resource and position.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param resId the control face
@param listener touch listener
@param position control position in the bar
|
[
"Add",
"new",
"control",
"at",
"the",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
"resource",
"and",
"position",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L194-L201
|
161,940 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMeshCollider.java
|
GVRMeshCollider.setMesh
|
public void setMesh(GVRMesh mesh) {
mMesh = mesh;
NativeMeshCollider.setMesh(getNative(), mesh.getNative());
}
|
java
|
public void setMesh(GVRMesh mesh) {
mMesh = mesh;
NativeMeshCollider.setMesh(getNative(), mesh.getNative());
}
|
[
"public",
"void",
"setMesh",
"(",
"GVRMesh",
"mesh",
")",
"{",
"mMesh",
"=",
"mesh",
";",
"NativeMeshCollider",
".",
"setMesh",
"(",
"getNative",
"(",
")",
",",
"mesh",
".",
"getNative",
"(",
")",
")",
";",
"}"
] |
Set the mesh to be tested against.
@param mesh
The {@link GVRMesh} that the picking ray will test against.
|
[
"Set",
"the",
"mesh",
"to",
"be",
"tested",
"against",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMeshCollider.java#L123-L126
|
161,941 |
Samsung/GearVRf
|
GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java
|
GVRGenericConstraint.setLinearLowerLimits
|
public void setLinearLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearLowerLimits(getNative(), limitX, limitY, limitZ);
}
|
java
|
public void setLinearLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearLowerLimits(getNative(), limitX, limitY, limitZ);
}
|
[
"public",
"void",
"setLinearLowerLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setLinearLowerLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
";",
"}"
] |
Sets the lower limits for the "moving" body translation relative to joint point.
@param limitX the X axis lower translation limit
@param limitY the Y axis lower translation limit
@param limitZ the Z axis lower translation limit
|
[
"Sets",
"the",
"lower",
"limits",
"for",
"the",
"moving",
"body",
"translation",
"relative",
"to",
"joint",
"point",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L65-L67
|
161,942 |
Samsung/GearVRf
|
GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java
|
GVRGenericConstraint.setLinearUpperLimits
|
public void setLinearUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearUpperLimits(getNative(), limitX, limitY, limitZ);
}
|
java
|
public void setLinearUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearUpperLimits(getNative(), limitX, limitY, limitZ);
}
|
[
"public",
"void",
"setLinearUpperLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setLinearUpperLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
";",
"}"
] |
Sets the upper limits for the "moving" body translation relative to joint point.
@param limitX the X upper lower translation limit
@param limitY the Y upper lower translation limit
@param limitZ the Z upper lower translation limit
|
[
"Sets",
"the",
"upper",
"limits",
"for",
"the",
"moving",
"body",
"translation",
"relative",
"to",
"joint",
"point",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L85-L87
|
161,943 |
Samsung/GearVRf
|
GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java
|
GVRGenericConstraint.setAngularLowerLimits
|
public void setAngularLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularLowerLimits(getNative(), limitX, limitY, limitZ);
}
|
java
|
public void setAngularLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularLowerLimits(getNative(), limitX, limitY, limitZ);
}
|
[
"public",
"void",
"setAngularLowerLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setAngularLowerLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
";",
"}"
] |
Sets the lower limits for the "moving" body rotation relative to joint point.
@param limitX the X axis lower rotation limit (in radians)
@param limitY the Y axis lower rotation limit (in radians)
@param limitZ the Z axis lower rotation limit (in radians)
|
[
"Sets",
"the",
"lower",
"limits",
"for",
"the",
"moving",
"body",
"rotation",
"relative",
"to",
"joint",
"point",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L105-L107
|
161,944 |
Samsung/GearVRf
|
GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java
|
GVRGenericConstraint.setAngularUpperLimits
|
public void setAngularUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularUpperLimits(getNative(), limitX, limitY, limitZ);
}
|
java
|
public void setAngularUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularUpperLimits(getNative(), limitX, limitY, limitZ);
}
|
[
"public",
"void",
"setAngularUpperLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setAngularUpperLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
";",
"}"
] |
Sets the upper limits for the "moving" body rotation relative to joint point.
@param limitX the X axis upper rotation limit (in radians)
@param limitY the Y axis upper rotation limit (in radians)
@param limitZ the Z axis upper rotation limit (in radians)
|
[
"Sets",
"the",
"upper",
"limits",
"for",
"the",
"moving",
"body",
"rotation",
"relative",
"to",
"joint",
"point",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L125-L127
|
161,945 |
Samsung/GearVRf
|
GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/Particles.java
|
Particles.makeParticleMesh
|
GVRSceneObject makeParticleMesh(float[] vertices, float[] velocities,
float[] particleTimeStamps )
{
mParticleMesh = new GVRMesh(mGVRContext);
//pass the particle positions as vertices, velocities as normals, and
//spawning times as texture coordinates.
mParticleMesh.setVertices(vertices);
mParticleMesh.setNormals(velocities);
mParticleMesh.setTexCoords(particleTimeStamps);
particleID = new GVRShaderId(ParticleShader.class);
material = new GVRMaterial(mGVRContext, particleID);
material.setVec4("u_color", mColorMultiplier.x, mColorMultiplier.y,
mColorMultiplier.z, mColorMultiplier.w);
material.setFloat("u_particle_age", mAge);
material.setVec3("u_acceleration", mAcceleration.x, mAcceleration.y, mAcceleration.z);
material.setFloat("u_particle_size", mSize);
material.setFloat("u_size_change_rate", mParticleSizeRate);
material.setFloat("u_fade", mFadeWithAge);
material.setFloat("u_noise_factor", mNoiseFactor);
GVRRenderData renderData = new GVRRenderData(mGVRContext);
renderData.setMaterial(material);
renderData.setMesh(mParticleMesh);
material.setMainTexture(mTexture);
GVRSceneObject meshObject = new GVRSceneObject(mGVRContext);
meshObject.attachRenderData(renderData);
meshObject.getRenderData().setMaterial(material);
// Set the draw mode to GL_POINTS, disable writing to depth buffer, enable depth testing
// and set the rendering order to transparent.
// Disabling writing to depth buffer ensure that the particles blend correctly
// and keeping the depth test on along with rendering them
// after the geometry queue makes sure they occlude, and are occluded, correctly.
meshObject.getRenderData().setDrawMode(GL_POINTS);
meshObject.getRenderData().setDepthTest(true);
meshObject.getRenderData().setDepthMask(false);
meshObject.getRenderData().setRenderingOrder(GVRRenderData.GVRRenderingOrder.TRANSPARENT);
return meshObject;
}
|
java
|
GVRSceneObject makeParticleMesh(float[] vertices, float[] velocities,
float[] particleTimeStamps )
{
mParticleMesh = new GVRMesh(mGVRContext);
//pass the particle positions as vertices, velocities as normals, and
//spawning times as texture coordinates.
mParticleMesh.setVertices(vertices);
mParticleMesh.setNormals(velocities);
mParticleMesh.setTexCoords(particleTimeStamps);
particleID = new GVRShaderId(ParticleShader.class);
material = new GVRMaterial(mGVRContext, particleID);
material.setVec4("u_color", mColorMultiplier.x, mColorMultiplier.y,
mColorMultiplier.z, mColorMultiplier.w);
material.setFloat("u_particle_age", mAge);
material.setVec3("u_acceleration", mAcceleration.x, mAcceleration.y, mAcceleration.z);
material.setFloat("u_particle_size", mSize);
material.setFloat("u_size_change_rate", mParticleSizeRate);
material.setFloat("u_fade", mFadeWithAge);
material.setFloat("u_noise_factor", mNoiseFactor);
GVRRenderData renderData = new GVRRenderData(mGVRContext);
renderData.setMaterial(material);
renderData.setMesh(mParticleMesh);
material.setMainTexture(mTexture);
GVRSceneObject meshObject = new GVRSceneObject(mGVRContext);
meshObject.attachRenderData(renderData);
meshObject.getRenderData().setMaterial(material);
// Set the draw mode to GL_POINTS, disable writing to depth buffer, enable depth testing
// and set the rendering order to transparent.
// Disabling writing to depth buffer ensure that the particles blend correctly
// and keeping the depth test on along with rendering them
// after the geometry queue makes sure they occlude, and are occluded, correctly.
meshObject.getRenderData().setDrawMode(GL_POINTS);
meshObject.getRenderData().setDepthTest(true);
meshObject.getRenderData().setDepthMask(false);
meshObject.getRenderData().setRenderingOrder(GVRRenderData.GVRRenderingOrder.TRANSPARENT);
return meshObject;
}
|
[
"GVRSceneObject",
"makeParticleMesh",
"(",
"float",
"[",
"]",
"vertices",
",",
"float",
"[",
"]",
"velocities",
",",
"float",
"[",
"]",
"particleTimeStamps",
")",
"{",
"mParticleMesh",
"=",
"new",
"GVRMesh",
"(",
"mGVRContext",
")",
";",
"//pass the particle positions as vertices, velocities as normals, and",
"//spawning times as texture coordinates.",
"mParticleMesh",
".",
"setVertices",
"(",
"vertices",
")",
";",
"mParticleMesh",
".",
"setNormals",
"(",
"velocities",
")",
";",
"mParticleMesh",
".",
"setTexCoords",
"(",
"particleTimeStamps",
")",
";",
"particleID",
"=",
"new",
"GVRShaderId",
"(",
"ParticleShader",
".",
"class",
")",
";",
"material",
"=",
"new",
"GVRMaterial",
"(",
"mGVRContext",
",",
"particleID",
")",
";",
"material",
".",
"setVec4",
"(",
"\"u_color\"",
",",
"mColorMultiplier",
".",
"x",
",",
"mColorMultiplier",
".",
"y",
",",
"mColorMultiplier",
".",
"z",
",",
"mColorMultiplier",
".",
"w",
")",
";",
"material",
".",
"setFloat",
"(",
"\"u_particle_age\"",
",",
"mAge",
")",
";",
"material",
".",
"setVec3",
"(",
"\"u_acceleration\"",
",",
"mAcceleration",
".",
"x",
",",
"mAcceleration",
".",
"y",
",",
"mAcceleration",
".",
"z",
")",
";",
"material",
".",
"setFloat",
"(",
"\"u_particle_size\"",
",",
"mSize",
")",
";",
"material",
".",
"setFloat",
"(",
"\"u_size_change_rate\"",
",",
"mParticleSizeRate",
")",
";",
"material",
".",
"setFloat",
"(",
"\"u_fade\"",
",",
"mFadeWithAge",
")",
";",
"material",
".",
"setFloat",
"(",
"\"u_noise_factor\"",
",",
"mNoiseFactor",
")",
";",
"GVRRenderData",
"renderData",
"=",
"new",
"GVRRenderData",
"(",
"mGVRContext",
")",
";",
"renderData",
".",
"setMaterial",
"(",
"material",
")",
";",
"renderData",
".",
"setMesh",
"(",
"mParticleMesh",
")",
";",
"material",
".",
"setMainTexture",
"(",
"mTexture",
")",
";",
"GVRSceneObject",
"meshObject",
"=",
"new",
"GVRSceneObject",
"(",
"mGVRContext",
")",
";",
"meshObject",
".",
"attachRenderData",
"(",
"renderData",
")",
";",
"meshObject",
".",
"getRenderData",
"(",
")",
".",
"setMaterial",
"(",
"material",
")",
";",
"// Set the draw mode to GL_POINTS, disable writing to depth buffer, enable depth testing",
"// and set the rendering order to transparent.",
"// Disabling writing to depth buffer ensure that the particles blend correctly",
"// and keeping the depth test on along with rendering them",
"// after the geometry queue makes sure they occlude, and are occluded, correctly.",
"meshObject",
".",
"getRenderData",
"(",
")",
".",
"setDrawMode",
"(",
"GL_POINTS",
")",
";",
"meshObject",
".",
"getRenderData",
"(",
")",
".",
"setDepthTest",
"(",
"true",
")",
";",
"meshObject",
".",
"getRenderData",
"(",
")",
".",
"setDepthMask",
"(",
"false",
")",
";",
"meshObject",
".",
"getRenderData",
"(",
")",
".",
"setRenderingOrder",
"(",
"GVRRenderData",
".",
"GVRRenderingOrder",
".",
"TRANSPARENT",
")",
";",
"return",
"meshObject",
";",
"}"
] |
Creates and returns a GVRSceneObject with the specified mesh attributes.
@param vertices the vertex positions of that make up the mesh. (x1, y1, z1, x2, y2, z2, ...)
@param velocities the velocity attributes for each vertex. (vx1, vy1, vz1, vx2, vy2, vz2...)
@param particleTimeStamps the spawning times of each vertex. (t1, 0, t2, 0, t3, 0 ..)
@return The GVRSceneObject with this mesh.
|
[
"Creates",
"and",
"returns",
"a",
"GVRSceneObject",
"with",
"the",
"specified",
"mesh",
"attributes",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/Particles.java#L79-L123
|
161,946 |
Samsung/GearVRf
|
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java
|
GVRScriptBehavior.setFilePath
|
public void setFilePath(String filePath) throws IOException, GVRScriptException
{
GVRResourceVolume.VolumeType volumeType = GVRResourceVolume.VolumeType.ANDROID_ASSETS;
String fname = filePath.toLowerCase();
mLanguage = FileNameUtils.getExtension(fname);
if (fname.startsWith("sd:"))
{
volumeType = GVRResourceVolume.VolumeType.ANDROID_SDCARD;
}
else if (fname.startsWith("http:") || fname.startsWith("https:"))
{
volumeType = GVRResourceVolume.VolumeType.NETWORK;
}
GVRResourceVolume volume = new GVRResourceVolume(getGVRContext(), volumeType,
FileNameUtils.getParentDirectory(filePath));
GVRAndroidResource resource = volume.openResource(filePath);
setScriptFile((GVRScriptFile)getGVRContext().getScriptManager().loadScript(resource, mLanguage));
}
|
java
|
public void setFilePath(String filePath) throws IOException, GVRScriptException
{
GVRResourceVolume.VolumeType volumeType = GVRResourceVolume.VolumeType.ANDROID_ASSETS;
String fname = filePath.toLowerCase();
mLanguage = FileNameUtils.getExtension(fname);
if (fname.startsWith("sd:"))
{
volumeType = GVRResourceVolume.VolumeType.ANDROID_SDCARD;
}
else if (fname.startsWith("http:") || fname.startsWith("https:"))
{
volumeType = GVRResourceVolume.VolumeType.NETWORK;
}
GVRResourceVolume volume = new GVRResourceVolume(getGVRContext(), volumeType,
FileNameUtils.getParentDirectory(filePath));
GVRAndroidResource resource = volume.openResource(filePath);
setScriptFile((GVRScriptFile)getGVRContext().getScriptManager().loadScript(resource, mLanguage));
}
|
[
"public",
"void",
"setFilePath",
"(",
"String",
"filePath",
")",
"throws",
"IOException",
",",
"GVRScriptException",
"{",
"GVRResourceVolume",
".",
"VolumeType",
"volumeType",
"=",
"GVRResourceVolume",
".",
"VolumeType",
".",
"ANDROID_ASSETS",
";",
"String",
"fname",
"=",
"filePath",
".",
"toLowerCase",
"(",
")",
";",
"mLanguage",
"=",
"FileNameUtils",
".",
"getExtension",
"(",
"fname",
")",
";",
"if",
"(",
"fname",
".",
"startsWith",
"(",
"\"sd:\"",
")",
")",
"{",
"volumeType",
"=",
"GVRResourceVolume",
".",
"VolumeType",
".",
"ANDROID_SDCARD",
";",
"}",
"else",
"if",
"(",
"fname",
".",
"startsWith",
"(",
"\"http:\"",
")",
"||",
"fname",
".",
"startsWith",
"(",
"\"https:\"",
")",
")",
"{",
"volumeType",
"=",
"GVRResourceVolume",
".",
"VolumeType",
".",
"NETWORK",
";",
"}",
"GVRResourceVolume",
"volume",
"=",
"new",
"GVRResourceVolume",
"(",
"getGVRContext",
"(",
")",
",",
"volumeType",
",",
"FileNameUtils",
".",
"getParentDirectory",
"(",
"filePath",
")",
")",
";",
"GVRAndroidResource",
"resource",
"=",
"volume",
".",
"openResource",
"(",
"filePath",
")",
";",
"setScriptFile",
"(",
"(",
"GVRScriptFile",
")",
"getGVRContext",
"(",
")",
".",
"getScriptManager",
"(",
")",
".",
"loadScript",
"(",
"resource",
",",
"mLanguage",
")",
")",
";",
"}"
] |
Sets the path to the script file to load and loads the script.
@param filePath path to script file
@throws IOException if the script cannot be read.
@throws GVRScriptException if a script processing error occurs.
|
[
"Sets",
"the",
"path",
"to",
"the",
"script",
"file",
"to",
"load",
"and",
"loads",
"the",
"script",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java#L100-L119
|
161,947 |
Samsung/GearVRf
|
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java
|
GVRScriptBehavior.setScriptText
|
public void setScriptText(String scriptText, String language)
{
GVRScriptFile newScript = new GVRJavascriptScriptFile(getGVRContext(), scriptText);
mLanguage = GVRScriptManager.LANG_JAVASCRIPT;
setScriptFile(newScript);
}
|
java
|
public void setScriptText(String scriptText, String language)
{
GVRScriptFile newScript = new GVRJavascriptScriptFile(getGVRContext(), scriptText);
mLanguage = GVRScriptManager.LANG_JAVASCRIPT;
setScriptFile(newScript);
}
|
[
"public",
"void",
"setScriptText",
"(",
"String",
"scriptText",
",",
"String",
"language",
")",
"{",
"GVRScriptFile",
"newScript",
"=",
"new",
"GVRJavascriptScriptFile",
"(",
"getGVRContext",
"(",
")",
",",
"scriptText",
")",
";",
"mLanguage",
"=",
"GVRScriptManager",
".",
"LANG_JAVASCRIPT",
";",
"setScriptFile",
"(",
"newScript",
")",
";",
"}"
] |
Loads the script from a text string.
@param scriptText text string containing script to execute.
@param language language ("js" or "lua")
|
[
"Loads",
"the",
"script",
"from",
"a",
"text",
"string",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java#L126-L131
|
161,948 |
Samsung/GearVRf
|
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java
|
GVRScriptBehavior.invokeFunction
|
public boolean invokeFunction(String funcName, Object[] args)
{
mLastError = null;
if (mScriptFile != null)
{
if (mScriptFile.invokeFunction(funcName, args))
{
return true;
}
}
mLastError = mScriptFile.getLastError();
if ((mLastError != null) && !mLastError.contains("is not defined"))
{
getGVRContext().logError(mLastError, this);
}
return false;
}
|
java
|
public boolean invokeFunction(String funcName, Object[] args)
{
mLastError = null;
if (mScriptFile != null)
{
if (mScriptFile.invokeFunction(funcName, args))
{
return true;
}
}
mLastError = mScriptFile.getLastError();
if ((mLastError != null) && !mLastError.contains("is not defined"))
{
getGVRContext().logError(mLastError, this);
}
return false;
}
|
[
"public",
"boolean",
"invokeFunction",
"(",
"String",
"funcName",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"mLastError",
"=",
"null",
";",
"if",
"(",
"mScriptFile",
"!=",
"null",
")",
"{",
"if",
"(",
"mScriptFile",
".",
"invokeFunction",
"(",
"funcName",
",",
"args",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"mLastError",
"=",
"mScriptFile",
".",
"getLastError",
"(",
")",
";",
"if",
"(",
"(",
"mLastError",
"!=",
"null",
")",
"&&",
"!",
"mLastError",
".",
"contains",
"(",
"\"is not defined\"",
")",
")",
"{",
"getGVRContext",
"(",
")",
".",
"logError",
"(",
"mLastError",
",",
"this",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Calls a function script associated with this component.
The function is called even if the component
is not enabled and not attached to a scene object.
@param funcName name of script function to call.
@param args function parameters as an array of objects.
@return true if function was called, false if no such function
@see org.gearvrf.script.GVRScriptFile#invokeFunction(String, Object[]) invokeFunction
|
[
"Calls",
"a",
"function",
"script",
"associated",
"with",
"this",
"component",
".",
"The",
"function",
"is",
"called",
"even",
"if",
"the",
"component",
"is",
"not",
"enabled",
"and",
"not",
"attached",
"to",
"a",
"scene",
"object",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java#L316-L332
|
161,949 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRViewSceneObject.java
|
GVRViewSceneObject.setTextureBufferSize
|
public void setTextureBufferSize(final int size) {
mRootViewGroup.post(new Runnable() {
@Override
public void run() {
mRootViewGroup.setTextureBufferSize(size);
}
});
}
|
java
|
public void setTextureBufferSize(final int size) {
mRootViewGroup.post(new Runnable() {
@Override
public void run() {
mRootViewGroup.setTextureBufferSize(size);
}
});
}
|
[
"public",
"void",
"setTextureBufferSize",
"(",
"final",
"int",
"size",
")",
"{",
"mRootViewGroup",
".",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"mRootViewGroup",
".",
"setTextureBufferSize",
"(",
"size",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Set the default size of the texture buffers. You can call this to reduce the buffer size
of views with anti-aliasing issue.
The max value to the buffer size should be the Math.max(width, height) of attached view.
@param size buffer size. Value > 0 and <= Math.max(width, height).
|
[
"Set",
"the",
"default",
"size",
"of",
"the",
"texture",
"buffers",
".",
"You",
"can",
"call",
"this",
"to",
"reduce",
"the",
"buffer",
"size",
"of",
"views",
"with",
"anti",
"-",
"aliasing",
"issue",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRViewSceneObject.java#L361-L368
|
161,950 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java
|
GVRCamera.setBackgroundColor
|
public void setBackgroundColor(int color) {
setBackgroundColorR(Colors.byteToGl(Color.red(color)));
setBackgroundColorG(Colors.byteToGl(Color.green(color)));
setBackgroundColorB(Colors.byteToGl(Color.blue(color)));
setBackgroundColorA(Colors.byteToGl(Color.alpha(color)));
}
|
java
|
public void setBackgroundColor(int color) {
setBackgroundColorR(Colors.byteToGl(Color.red(color)));
setBackgroundColorG(Colors.byteToGl(Color.green(color)));
setBackgroundColorB(Colors.byteToGl(Color.blue(color)));
setBackgroundColorA(Colors.byteToGl(Color.alpha(color)));
}
|
[
"public",
"void",
"setBackgroundColor",
"(",
"int",
"color",
")",
"{",
"setBackgroundColorR",
"(",
"Colors",
".",
"byteToGl",
"(",
"Color",
".",
"red",
"(",
"color",
")",
")",
")",
";",
"setBackgroundColorG",
"(",
"Colors",
".",
"byteToGl",
"(",
"Color",
".",
"green",
"(",
"color",
")",
")",
")",
";",
"setBackgroundColorB",
"(",
"Colors",
".",
"byteToGl",
"(",
"Color",
".",
"blue",
"(",
"color",
")",
")",
")",
";",
"setBackgroundColorA",
"(",
"Colors",
".",
"byteToGl",
"(",
"Color",
".",
"alpha",
"(",
"color",
")",
")",
")",
";",
"}"
] |
Set the background color.
If you don't set the background color, the default is an opaque black:
{@link Color#BLACK}, 0xff000000.
@param color
An Android 32-bit (ARGB) {@link Color}, such as you get from
{@link Resources#getColor(int)}
|
[
"Set",
"the",
"background",
"color",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java#L83-L88
|
161,951 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java
|
GVRCamera.setBackgroundColor
|
public void setBackgroundColor(float r, float g, float b, float a) {
setBackgroundColorR(r);
setBackgroundColorG(g);
setBackgroundColorB(b);
setBackgroundColorA(a);
}
|
java
|
public void setBackgroundColor(float r, float g, float b, float a) {
setBackgroundColorR(r);
setBackgroundColorG(g);
setBackgroundColorB(b);
setBackgroundColorA(a);
}
|
[
"public",
"void",
"setBackgroundColor",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"setBackgroundColorR",
"(",
"r",
")",
";",
"setBackgroundColorG",
"(",
"g",
")",
";",
"setBackgroundColorB",
"(",
"b",
")",
";",
"setBackgroundColorA",
"(",
"a",
")",
";",
"}"
] |
Sets the background color of the scene rendered by this camera.
If you don't set the background color, the default is an opaque black.
Meaningful parameter values are from 0 to 1, inclusive: values
{@literal < 0} are clamped to 0; values {@literal > 1} are clamped to 1.
|
[
"Sets",
"the",
"background",
"color",
"of",
"the",
"scene",
"rendered",
"by",
"this",
"camera",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java#L97-L102
|
161,952 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java
|
GVRCamera.addPostEffect
|
public void addPostEffect(GVRMaterial postEffectData) {
GVRContext ctx = getGVRContext();
if (mPostEffects == null)
{
mPostEffects = new GVRRenderData(ctx, postEffectData);
GVRMesh dummyMesh = new GVRMesh(getGVRContext(),"float3 a_position float2 a_texcoord");
mPostEffects.setMesh(dummyMesh);
NativeCamera.setPostEffect(getNative(), mPostEffects.getNative());
mPostEffects.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
}
else
{
GVRRenderPass rpass = new GVRRenderPass(ctx, postEffectData);
rpass.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
mPostEffects.addPass(rpass);
}
}
|
java
|
public void addPostEffect(GVRMaterial postEffectData) {
GVRContext ctx = getGVRContext();
if (mPostEffects == null)
{
mPostEffects = new GVRRenderData(ctx, postEffectData);
GVRMesh dummyMesh = new GVRMesh(getGVRContext(),"float3 a_position float2 a_texcoord");
mPostEffects.setMesh(dummyMesh);
NativeCamera.setPostEffect(getNative(), mPostEffects.getNative());
mPostEffects.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
}
else
{
GVRRenderPass rpass = new GVRRenderPass(ctx, postEffectData);
rpass.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
mPostEffects.addPass(rpass);
}
}
|
[
"public",
"void",
"addPostEffect",
"(",
"GVRMaterial",
"postEffectData",
")",
"{",
"GVRContext",
"ctx",
"=",
"getGVRContext",
"(",
")",
";",
"if",
"(",
"mPostEffects",
"==",
"null",
")",
"{",
"mPostEffects",
"=",
"new",
"GVRRenderData",
"(",
"ctx",
",",
"postEffectData",
")",
";",
"GVRMesh",
"dummyMesh",
"=",
"new",
"GVRMesh",
"(",
"getGVRContext",
"(",
")",
",",
"\"float3 a_position float2 a_texcoord\"",
")",
";",
"mPostEffects",
".",
"setMesh",
"(",
"dummyMesh",
")",
";",
"NativeCamera",
".",
"setPostEffect",
"(",
"getNative",
"(",
")",
",",
"mPostEffects",
".",
"getNative",
"(",
")",
")",
";",
"mPostEffects",
".",
"setCullFace",
"(",
"GVRRenderPass",
".",
"GVRCullFaceEnum",
".",
"None",
")",
";",
"}",
"else",
"{",
"GVRRenderPass",
"rpass",
"=",
"new",
"GVRRenderPass",
"(",
"ctx",
",",
"postEffectData",
")",
";",
"rpass",
".",
"setCullFace",
"(",
"GVRRenderPass",
".",
"GVRCullFaceEnum",
".",
"None",
")",
";",
"mPostEffects",
".",
"addPass",
"(",
"rpass",
")",
";",
"}",
"}"
] |
Add a post-effect to this camera's render chain.
Post-effects are GL shaders, applied to the texture (hardware bitmap)
containing the rendered scene graph. Each post-effect combines a shader
selector with a set of parameters: This lets you pass different
parameters to the shaders for each eye.
@param postEffectData
Post-effect to append to this camera's render chain
|
[
"Add",
"a",
"post",
"-",
"effect",
"to",
"this",
"camera",
"s",
"render",
"chain",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java#L214-L231
|
161,953 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java
|
GVRSkeleton.getBoneIndex
|
public int getBoneIndex(GVRSceneObject bone)
{
for (int i = 0; i < getNumBones(); ++i)
if (mBones[i] == bone)
return i;
return -1;
}
|
java
|
public int getBoneIndex(GVRSceneObject bone)
{
for (int i = 0; i < getNumBones(); ++i)
if (mBones[i] == bone)
return i;
return -1;
}
|
[
"public",
"int",
"getBoneIndex",
"(",
"GVRSceneObject",
"bone",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getNumBones",
"(",
")",
";",
"++",
"i",
")",
"if",
"(",
"mBones",
"[",
"i",
"]",
"==",
"bone",
")",
"return",
"i",
";",
"return",
"-",
"1",
";",
"}"
] |
Get the bone index for the given scene object.
@param bone GVRSceneObject bone to search for
@return bone index or -1 for root bone.
@see #getParentBoneIndex
|
[
"Get",
"the",
"bone",
"index",
"for",
"the",
"given",
"scene",
"object",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java#L714-L720
|
161,954 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java
|
GVRSkeleton.getBoneIndex
|
public int getBoneIndex(String bonename)
{
for (int i = 0; i < getNumBones(); ++i)
if (mBoneNames[i].equals(bonename))
return i;
return -1;
}
|
java
|
public int getBoneIndex(String bonename)
{
for (int i = 0; i < getNumBones(); ++i)
if (mBoneNames[i].equals(bonename))
return i;
return -1;
}
|
[
"public",
"int",
"getBoneIndex",
"(",
"String",
"bonename",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getNumBones",
"(",
")",
";",
"++",
"i",
")",
"if",
"(",
"mBoneNames",
"[",
"i",
"]",
".",
"equals",
"(",
"bonename",
")",
")",
"return",
"i",
";",
"return",
"-",
"1",
";",
"}"
] |
Get the bone index for the bone with the given name.
@param bonename string identifying the bone whose index you want
@return 0 based bone index or -1 if bone with that name is not found.
|
[
"Get",
"the",
"bone",
"index",
"for",
"the",
"bone",
"with",
"the",
"given",
"name",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java#L728-L735
|
161,955 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java
|
GVRSkeleton.setBoneName
|
public void setBoneName(int boneindex, String bonename)
{
mBoneNames[boneindex] = bonename;
NativeSkeleton.setBoneName(getNative(), boneindex, bonename);
}
|
java
|
public void setBoneName(int boneindex, String bonename)
{
mBoneNames[boneindex] = bonename;
NativeSkeleton.setBoneName(getNative(), boneindex, bonename);
}
|
[
"public",
"void",
"setBoneName",
"(",
"int",
"boneindex",
",",
"String",
"bonename",
")",
"{",
"mBoneNames",
"[",
"boneindex",
"]",
"=",
"bonename",
";",
"NativeSkeleton",
".",
"setBoneName",
"(",
"getNative",
"(",
")",
",",
"boneindex",
",",
"bonename",
")",
";",
"}"
] |
Sets the name of the designated bone.
@param boneindex zero based index of bone to rotate.
@param bonename string with name of bone.
. * @see #getBoneName
|
[
"Sets",
"the",
"name",
"of",
"the",
"designated",
"bone",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java#L776-L780
|
161,956 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java
|
GVRSkeleton.poseFromBones
|
public void poseFromBones()
{
for (int i = 0; i < getNumBones(); ++i)
{
GVRSceneObject bone = mBones[i];
if (bone == null)
{
continue;
}
if ((mBoneOptions[i] & BONE_LOCK_ROTATION) != 0)
{
continue;
}
GVRTransform trans = bone.getTransform();
mPose.setLocalMatrix(i, trans.getLocalModelMatrix4f());
}
mPose.sync();
updateBonePose();
}
|
java
|
public void poseFromBones()
{
for (int i = 0; i < getNumBones(); ++i)
{
GVRSceneObject bone = mBones[i];
if (bone == null)
{
continue;
}
if ((mBoneOptions[i] & BONE_LOCK_ROTATION) != 0)
{
continue;
}
GVRTransform trans = bone.getTransform();
mPose.setLocalMatrix(i, trans.getLocalModelMatrix4f());
}
mPose.sync();
updateBonePose();
}
|
[
"public",
"void",
"poseFromBones",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getNumBones",
"(",
")",
";",
"++",
"i",
")",
"{",
"GVRSceneObject",
"bone",
"=",
"mBones",
"[",
"i",
"]",
";",
"if",
"(",
"bone",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"(",
"mBoneOptions",
"[",
"i",
"]",
"&",
"BONE_LOCK_ROTATION",
")",
"!=",
"0",
")",
"{",
"continue",
";",
"}",
"GVRTransform",
"trans",
"=",
"bone",
".",
"getTransform",
"(",
")",
";",
"mPose",
".",
"setLocalMatrix",
"(",
"i",
",",
"trans",
".",
"getLocalModelMatrix4f",
"(",
")",
")",
";",
"}",
"mPose",
".",
"sync",
"(",
")",
";",
"updateBonePose",
"(",
")",
";",
"}"
] |
Applies the matrices computed from the scene object's
linked to the skeleton bones to the current pose.
@see #applyPose(GVRPose, int)
@see #setPose(GVRPose)
|
[
"Applies",
"the",
"matrices",
"computed",
"from",
"the",
"scene",
"object",
"s",
"linked",
"to",
"the",
"skeleton",
"bones",
"to",
"the",
"current",
"pose",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java#L948-L966
|
161,957 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java
|
GVRSkeleton.merge
|
public void merge(GVRSkeleton newSkel)
{
int numBones = getNumBones();
List<Integer> parentBoneIds = new ArrayList<Integer>(numBones + newSkel.getNumBones());
List<String> newBoneNames = new ArrayList<String>(newSkel.getNumBones());
List<Matrix4f> newMatrices = new ArrayList<Matrix4f>(newSkel.getNumBones());
GVRPose oldBindPose = getBindPose();
GVRPose curPose = getPose();
for (int i = 0; i < numBones; ++i)
{
parentBoneIds.add(mParentBones[i]);
}
for (int j = 0; j < newSkel.getNumBones(); ++j)
{
String boneName = newSkel.getBoneName(j);
int boneId = getBoneIndex(boneName);
if (boneId < 0)
{
int parentId = newSkel.getParentBoneIndex(j);
Matrix4f m = new Matrix4f();
newSkel.getBindPose().getLocalMatrix(j, m);
newMatrices.add(m);
newBoneNames.add(boneName);
if (parentId >= 0)
{
boneName = newSkel.getBoneName(parentId);
parentId = getBoneIndex(boneName);
}
parentBoneIds.add(parentId);
}
}
if (parentBoneIds.size() == numBones)
{
return;
}
int n = numBones + parentBoneIds.size();
int[] parentIds = Arrays.copyOf(mParentBones, n);
int[] boneOptions = Arrays.copyOf(mBoneOptions, n);
String[] boneNames = Arrays.copyOf(mBoneNames, n);
mBones = Arrays.copyOf(mBones, n);
mPoseMatrices = new float[n * 16];
for (int i = 0; i < parentBoneIds.size(); ++i)
{
n = numBones + i;
parentIds[n] = parentBoneIds.get(i);
boneNames[n] = newBoneNames.get(i);
boneOptions[n] = BONE_ANIMATE;
}
mBoneOptions = boneOptions;
mBoneNames = boneNames;
mParentBones = parentIds;
mPose = new GVRPose(this);
mBindPose = new GVRPose(this);
mBindPose.copy(oldBindPose);
mPose.copy(curPose);
mBindPose.sync();
for (int j = 0; j < newSkel.getNumBones(); ++j)
{
mBindPose.setLocalMatrix(numBones + j, newMatrices.get(j));
mPose.setLocalMatrix(numBones + j, newMatrices.get(j));
}
setBindPose(mBindPose);
mPose.sync();
updateBonePose();
}
|
java
|
public void merge(GVRSkeleton newSkel)
{
int numBones = getNumBones();
List<Integer> parentBoneIds = new ArrayList<Integer>(numBones + newSkel.getNumBones());
List<String> newBoneNames = new ArrayList<String>(newSkel.getNumBones());
List<Matrix4f> newMatrices = new ArrayList<Matrix4f>(newSkel.getNumBones());
GVRPose oldBindPose = getBindPose();
GVRPose curPose = getPose();
for (int i = 0; i < numBones; ++i)
{
parentBoneIds.add(mParentBones[i]);
}
for (int j = 0; j < newSkel.getNumBones(); ++j)
{
String boneName = newSkel.getBoneName(j);
int boneId = getBoneIndex(boneName);
if (boneId < 0)
{
int parentId = newSkel.getParentBoneIndex(j);
Matrix4f m = new Matrix4f();
newSkel.getBindPose().getLocalMatrix(j, m);
newMatrices.add(m);
newBoneNames.add(boneName);
if (parentId >= 0)
{
boneName = newSkel.getBoneName(parentId);
parentId = getBoneIndex(boneName);
}
parentBoneIds.add(parentId);
}
}
if (parentBoneIds.size() == numBones)
{
return;
}
int n = numBones + parentBoneIds.size();
int[] parentIds = Arrays.copyOf(mParentBones, n);
int[] boneOptions = Arrays.copyOf(mBoneOptions, n);
String[] boneNames = Arrays.copyOf(mBoneNames, n);
mBones = Arrays.copyOf(mBones, n);
mPoseMatrices = new float[n * 16];
for (int i = 0; i < parentBoneIds.size(); ++i)
{
n = numBones + i;
parentIds[n] = parentBoneIds.get(i);
boneNames[n] = newBoneNames.get(i);
boneOptions[n] = BONE_ANIMATE;
}
mBoneOptions = boneOptions;
mBoneNames = boneNames;
mParentBones = parentIds;
mPose = new GVRPose(this);
mBindPose = new GVRPose(this);
mBindPose.copy(oldBindPose);
mPose.copy(curPose);
mBindPose.sync();
for (int j = 0; j < newSkel.getNumBones(); ++j)
{
mBindPose.setLocalMatrix(numBones + j, newMatrices.get(j));
mPose.setLocalMatrix(numBones + j, newMatrices.get(j));
}
setBindPose(mBindPose);
mPose.sync();
updateBonePose();
}
|
[
"public",
"void",
"merge",
"(",
"GVRSkeleton",
"newSkel",
")",
"{",
"int",
"numBones",
"=",
"getNumBones",
"(",
")",
";",
"List",
"<",
"Integer",
">",
"parentBoneIds",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
"numBones",
"+",
"newSkel",
".",
"getNumBones",
"(",
")",
")",
";",
"List",
"<",
"String",
">",
"newBoneNames",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"newSkel",
".",
"getNumBones",
"(",
")",
")",
";",
"List",
"<",
"Matrix4f",
">",
"newMatrices",
"=",
"new",
"ArrayList",
"<",
"Matrix4f",
">",
"(",
"newSkel",
".",
"getNumBones",
"(",
")",
")",
";",
"GVRPose",
"oldBindPose",
"=",
"getBindPose",
"(",
")",
";",
"GVRPose",
"curPose",
"=",
"getPose",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numBones",
";",
"++",
"i",
")",
"{",
"parentBoneIds",
".",
"add",
"(",
"mParentBones",
"[",
"i",
"]",
")",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"newSkel",
".",
"getNumBones",
"(",
")",
";",
"++",
"j",
")",
"{",
"String",
"boneName",
"=",
"newSkel",
".",
"getBoneName",
"(",
"j",
")",
";",
"int",
"boneId",
"=",
"getBoneIndex",
"(",
"boneName",
")",
";",
"if",
"(",
"boneId",
"<",
"0",
")",
"{",
"int",
"parentId",
"=",
"newSkel",
".",
"getParentBoneIndex",
"(",
"j",
")",
";",
"Matrix4f",
"m",
"=",
"new",
"Matrix4f",
"(",
")",
";",
"newSkel",
".",
"getBindPose",
"(",
")",
".",
"getLocalMatrix",
"(",
"j",
",",
"m",
")",
";",
"newMatrices",
".",
"add",
"(",
"m",
")",
";",
"newBoneNames",
".",
"add",
"(",
"boneName",
")",
";",
"if",
"(",
"parentId",
">=",
"0",
")",
"{",
"boneName",
"=",
"newSkel",
".",
"getBoneName",
"(",
"parentId",
")",
";",
"parentId",
"=",
"getBoneIndex",
"(",
"boneName",
")",
";",
"}",
"parentBoneIds",
".",
"add",
"(",
"parentId",
")",
";",
"}",
"}",
"if",
"(",
"parentBoneIds",
".",
"size",
"(",
")",
"==",
"numBones",
")",
"{",
"return",
";",
"}",
"int",
"n",
"=",
"numBones",
"+",
"parentBoneIds",
".",
"size",
"(",
")",
";",
"int",
"[",
"]",
"parentIds",
"=",
"Arrays",
".",
"copyOf",
"(",
"mParentBones",
",",
"n",
")",
";",
"int",
"[",
"]",
"boneOptions",
"=",
"Arrays",
".",
"copyOf",
"(",
"mBoneOptions",
",",
"n",
")",
";",
"String",
"[",
"]",
"boneNames",
"=",
"Arrays",
".",
"copyOf",
"(",
"mBoneNames",
",",
"n",
")",
";",
"mBones",
"=",
"Arrays",
".",
"copyOf",
"(",
"mBones",
",",
"n",
")",
";",
"mPoseMatrices",
"=",
"new",
"float",
"[",
"n",
"*",
"16",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parentBoneIds",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{",
"n",
"=",
"numBones",
"+",
"i",
";",
"parentIds",
"[",
"n",
"]",
"=",
"parentBoneIds",
".",
"get",
"(",
"i",
")",
";",
"boneNames",
"[",
"n",
"]",
"=",
"newBoneNames",
".",
"get",
"(",
"i",
")",
";",
"boneOptions",
"[",
"n",
"]",
"=",
"BONE_ANIMATE",
";",
"}",
"mBoneOptions",
"=",
"boneOptions",
";",
"mBoneNames",
"=",
"boneNames",
";",
"mParentBones",
"=",
"parentIds",
";",
"mPose",
"=",
"new",
"GVRPose",
"(",
"this",
")",
";",
"mBindPose",
"=",
"new",
"GVRPose",
"(",
"this",
")",
";",
"mBindPose",
".",
"copy",
"(",
"oldBindPose",
")",
";",
"mPose",
".",
"copy",
"(",
"curPose",
")",
";",
"mBindPose",
".",
"sync",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"newSkel",
".",
"getNumBones",
"(",
")",
";",
"++",
"j",
")",
"{",
"mBindPose",
".",
"setLocalMatrix",
"(",
"numBones",
"+",
"j",
",",
"newMatrices",
".",
"get",
"(",
"j",
")",
")",
";",
"mPose",
".",
"setLocalMatrix",
"(",
"numBones",
"+",
"j",
",",
"newMatrices",
".",
"get",
"(",
"j",
")",
")",
";",
"}",
"setBindPose",
"(",
"mBindPose",
")",
";",
"mPose",
".",
"sync",
"(",
")",
";",
"updateBonePose",
"(",
")",
";",
"}"
] |
Merge the source skeleton with this one.
The result will be that this skeleton has all of its
original bones and all the bones in the new skeleton.
@param newSkel skeleton to merge with this one
|
[
"Merge",
"the",
"source",
"skeleton",
"with",
"this",
"one",
".",
"The",
"result",
"will",
"be",
"that",
"this",
"skeleton",
"has",
"all",
"of",
"its",
"original",
"bones",
"and",
"all",
"the",
"bones",
"in",
"the",
"new",
"skeleton",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRSkeleton.java#L1105-L1172
|
161,958 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRApplication.java
|
GVRApplication.getFullScreenView
|
public View getFullScreenView() {
if (mFullScreenView != null) {
return mFullScreenView;
}
final DisplayMetrics metrics = new DisplayMetrics();
mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
final int screenWidthPixels = Math.max(metrics.widthPixels, metrics.heightPixels);
final int screenHeightPixels = Math.min(metrics.widthPixels, metrics.heightPixels);
final ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams(screenWidthPixels, screenHeightPixels);
mFullScreenView = new View(mActivity);
mFullScreenView.setLayoutParams(layout);
mRenderableViewGroup.addView(mFullScreenView);
return mFullScreenView;
}
|
java
|
public View getFullScreenView() {
if (mFullScreenView != null) {
return mFullScreenView;
}
final DisplayMetrics metrics = new DisplayMetrics();
mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
final int screenWidthPixels = Math.max(metrics.widthPixels, metrics.heightPixels);
final int screenHeightPixels = Math.min(metrics.widthPixels, metrics.heightPixels);
final ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams(screenWidthPixels, screenHeightPixels);
mFullScreenView = new View(mActivity);
mFullScreenView.setLayoutParams(layout);
mRenderableViewGroup.addView(mFullScreenView);
return mFullScreenView;
}
|
[
"public",
"View",
"getFullScreenView",
"(",
")",
"{",
"if",
"(",
"mFullScreenView",
"!=",
"null",
")",
"{",
"return",
"mFullScreenView",
";",
"}",
"final",
"DisplayMetrics",
"metrics",
"=",
"new",
"DisplayMetrics",
"(",
")",
";",
"mActivity",
".",
"getWindowManager",
"(",
")",
".",
"getDefaultDisplay",
"(",
")",
".",
"getMetrics",
"(",
"metrics",
")",
";",
"final",
"int",
"screenWidthPixels",
"=",
"Math",
".",
"max",
"(",
"metrics",
".",
"widthPixels",
",",
"metrics",
".",
"heightPixels",
")",
";",
"final",
"int",
"screenHeightPixels",
"=",
"Math",
".",
"min",
"(",
"metrics",
".",
"widthPixels",
",",
"metrics",
".",
"heightPixels",
")",
";",
"final",
"ViewGroup",
".",
"LayoutParams",
"layout",
"=",
"new",
"ViewGroup",
".",
"LayoutParams",
"(",
"screenWidthPixels",
",",
"screenHeightPixels",
")",
";",
"mFullScreenView",
"=",
"new",
"View",
"(",
"mActivity",
")",
";",
"mFullScreenView",
".",
"setLayoutParams",
"(",
"layout",
")",
";",
"mRenderableViewGroup",
".",
"addView",
"(",
"mFullScreenView",
")",
";",
"return",
"mFullScreenView",
";",
"}"
] |
Invalidating just the GVRView associated with the GVRViewSceneObject
incorrectly set the clip rectangle to just that view. To fix this,
we have to create a full screen android View and invalidate this
to restore the clip rectangle.
@return full screen View object
|
[
"Invalidating",
"just",
"the",
"GVRView",
"associated",
"with",
"the",
"GVRViewSceneObject",
"incorrectly",
"set",
"the",
"clip",
"rectangle",
"to",
"just",
"that",
"view",
".",
"To",
"fix",
"this",
"we",
"have",
"to",
"create",
"a",
"full",
"screen",
"android",
"View",
"and",
"invalidate",
"this",
"to",
"restore",
"the",
"clip",
"rectangle",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRApplication.java#L297-L313
|
161,959 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRApplication.java
|
GVRApplication.unregisterView
|
public final void unregisterView(final View view) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (null != mRenderableViewGroup && view.getParent() == mRenderableViewGroup) {
mRenderableViewGroup.removeView(view);
}
}
});
}
|
java
|
public final void unregisterView(final View view) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (null != mRenderableViewGroup && view.getParent() == mRenderableViewGroup) {
mRenderableViewGroup.removeView(view);
}
}
});
}
|
[
"public",
"final",
"void",
"unregisterView",
"(",
"final",
"View",
"view",
")",
"{",
"mActivity",
".",
"runOnUiThread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"mRenderableViewGroup",
"&&",
"view",
".",
"getParent",
"(",
")",
"==",
"mRenderableViewGroup",
")",
"{",
"mRenderableViewGroup",
".",
"removeView",
"(",
"view",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] |
Remove a child view of Android hierarchy view .
@param view View to be removed.
|
[
"Remove",
"a",
"child",
"view",
"of",
"Android",
"hierarchy",
"view",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRApplication.java#L556-L565
|
161,960 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/GroupWidget.java
|
GroupWidget.clear
|
public void clear() {
List<Widget> children = getChildren();
Log.d(TAG, "clear(%s): removing %d children", getName(), children.size());
for (Widget child : children) {
removeChild(child, true);
}
requestLayout();
}
|
java
|
public void clear() {
List<Widget> children = getChildren();
Log.d(TAG, "clear(%s): removing %d children", getName(), children.size());
for (Widget child : children) {
removeChild(child, true);
}
requestLayout();
}
|
[
"public",
"void",
"clear",
"(",
")",
"{",
"List",
"<",
"Widget",
">",
"children",
"=",
"getChildren",
"(",
")",
";",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"clear(%s): removing %d children\"",
",",
"getName",
"(",
")",
",",
"children",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Widget",
"child",
":",
"children",
")",
"{",
"removeChild",
"(",
"child",
",",
"true",
")",
";",
"}",
"requestLayout",
"(",
")",
";",
"}"
] |
Removes all children
|
[
"Removes",
"all",
"children"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/GroupWidget.java#L241-L248
|
161,961 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/GroupWidget.java
|
GroupWidget.inViewPort
|
protected boolean inViewPort(final int dataIndex) {
boolean inViewPort = true;
for (Layout layout: mLayouts) {
inViewPort = inViewPort && (layout.inViewPort(dataIndex) || !layout.isClippingEnabled());
}
return inViewPort;
}
|
java
|
protected boolean inViewPort(final int dataIndex) {
boolean inViewPort = true;
for (Layout layout: mLayouts) {
inViewPort = inViewPort && (layout.inViewPort(dataIndex) || !layout.isClippingEnabled());
}
return inViewPort;
}
|
[
"protected",
"boolean",
"inViewPort",
"(",
"final",
"int",
"dataIndex",
")",
"{",
"boolean",
"inViewPort",
"=",
"true",
";",
"for",
"(",
"Layout",
"layout",
":",
"mLayouts",
")",
"{",
"inViewPort",
"=",
"inViewPort",
"&&",
"(",
"layout",
".",
"inViewPort",
"(",
"dataIndex",
")",
"||",
"!",
"layout",
".",
"isClippingEnabled",
"(",
")",
")",
";",
"}",
"return",
"inViewPort",
";",
"}"
] |
Checks if the child is currently in ViewPort
@param dataIndex child index
@return true if the child is in viewport, false - otherwise
|
[
"Checks",
"if",
"the",
"child",
"is",
"currently",
"in",
"ViewPort"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/GroupWidget.java#L255-L262
|
161,962 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCompressedImage.java
|
GVRCompressedImage.setDataOffsets
|
public void setDataOffsets(int[] offsets)
{
assert(mLevels == offsets.length);
NativeBitmapImage.updateCompressed(getNative(), mWidth, mHeight, mImageSize, mData, mLevels, offsets);
mData = null;
}
|
java
|
public void setDataOffsets(int[] offsets)
{
assert(mLevels == offsets.length);
NativeBitmapImage.updateCompressed(getNative(), mWidth, mHeight, mImageSize, mData, mLevels, offsets);
mData = null;
}
|
[
"public",
"void",
"setDataOffsets",
"(",
"int",
"[",
"]",
"offsets",
")",
"{",
"assert",
"(",
"mLevels",
"==",
"offsets",
".",
"length",
")",
";",
"NativeBitmapImage",
".",
"updateCompressed",
"(",
"getNative",
"(",
")",
",",
"mWidth",
",",
"mHeight",
",",
"mImageSize",
",",
"mData",
",",
"mLevels",
",",
"offsets",
")",
";",
"mData",
"=",
"null",
";",
"}"
] |
Set the offsets in the compressed data area for each mip-map level.
@param offsets array of offsets
|
[
"Set",
"the",
"offsets",
"in",
"the",
"compressed",
"data",
"area",
"for",
"each",
"mip",
"-",
"map",
"level",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCompressedImage.java#L74-L79
|
161,963 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/FileNameUtils.java
|
FileNameUtils.getFilename
|
public static String getFilename(String path) throws IllegalArgumentException {
if (Pattern.matches(sPatternUrl, path))
return getURLFilename(path);
return new File(path).getName();
}
|
java
|
public static String getFilename(String path) throws IllegalArgumentException {
if (Pattern.matches(sPatternUrl, path))
return getURLFilename(path);
return new File(path).getName();
}
|
[
"public",
"static",
"String",
"getFilename",
"(",
"String",
"path",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"Pattern",
".",
"matches",
"(",
"sPatternUrl",
",",
"path",
")",
")",
"return",
"getURLFilename",
"(",
"path",
")",
";",
"return",
"new",
"File",
"(",
"path",
")",
".",
"getName",
"(",
")",
";",
"}"
] |
Gets the filename from a path or URL.
@param path or url.
@return the file name.
|
[
"Gets",
"the",
"filename",
"from",
"a",
"path",
"or",
"URL",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/FileNameUtils.java#L65-L70
|
161,964 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/FileNameUtils.java
|
FileNameUtils.getParentDirectory
|
public static String getParentDirectory(String filePath) throws IllegalArgumentException {
if (Pattern.matches(sPatternUrl, filePath))
return getURLParentDirectory(filePath);
return new File(filePath).getParent();
}
|
java
|
public static String getParentDirectory(String filePath) throws IllegalArgumentException {
if (Pattern.matches(sPatternUrl, filePath))
return getURLParentDirectory(filePath);
return new File(filePath).getParent();
}
|
[
"public",
"static",
"String",
"getParentDirectory",
"(",
"String",
"filePath",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"Pattern",
".",
"matches",
"(",
"sPatternUrl",
",",
"filePath",
")",
")",
"return",
"getURLParentDirectory",
"(",
"filePath",
")",
";",
"return",
"new",
"File",
"(",
"filePath",
")",
".",
"getParent",
"(",
")",
";",
"}"
] |
Returns the directory of the file.
@param filePath Path of the file.
@return The directory string or {@code null} if
there is no parent directory.
@throws IllegalArgumentException if path is bad
|
[
"Returns",
"the",
"directory",
"of",
"the",
"file",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/FileNameUtils.java#L91-L96
|
161,965 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/FileNameUtils.java
|
FileNameUtils.getURLParentDirectory
|
public static String getURLParentDirectory(String urlString) throws IllegalArgumentException {
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
throw Exceptions.IllegalArgument("Malformed URL: %s", url);
}
String path = url.getPath();
int lastSlashIndex = path.lastIndexOf("/");
String directory = lastSlashIndex == -1 ? "" : path.substring(0, lastSlashIndex);
return String.format("%s://%s%s%s%s", url.getProtocol(),
url.getUserInfo() == null ? "" : url.getUserInfo() + "@",
url.getHost(),
url.getPort() == -1 ? "" : ":" + Integer.toString(url.getPort()),
directory);
}
|
java
|
public static String getURLParentDirectory(String urlString) throws IllegalArgumentException {
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
throw Exceptions.IllegalArgument("Malformed URL: %s", url);
}
String path = url.getPath();
int lastSlashIndex = path.lastIndexOf("/");
String directory = lastSlashIndex == -1 ? "" : path.substring(0, lastSlashIndex);
return String.format("%s://%s%s%s%s", url.getProtocol(),
url.getUserInfo() == null ? "" : url.getUserInfo() + "@",
url.getHost(),
url.getPort() == -1 ? "" : ":" + Integer.toString(url.getPort()),
directory);
}
|
[
"public",
"static",
"String",
"getURLParentDirectory",
"(",
"String",
"urlString",
")",
"throws",
"IllegalArgumentException",
"{",
"URL",
"url",
"=",
"null",
";",
"try",
"{",
"url",
"=",
"new",
"URL",
"(",
"urlString",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"throw",
"Exceptions",
".",
"IllegalArgument",
"(",
"\"Malformed URL: %s\"",
",",
"url",
")",
";",
"}",
"String",
"path",
"=",
"url",
".",
"getPath",
"(",
")",
";",
"int",
"lastSlashIndex",
"=",
"path",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
";",
"String",
"directory",
"=",
"lastSlashIndex",
"==",
"-",
"1",
"?",
"\"\"",
":",
"path",
".",
"substring",
"(",
"0",
",",
"lastSlashIndex",
")",
";",
"return",
"String",
".",
"format",
"(",
"\"%s://%s%s%s%s\"",
",",
"url",
".",
"getProtocol",
"(",
")",
",",
"url",
".",
"getUserInfo",
"(",
")",
"==",
"null",
"?",
"\"\"",
":",
"url",
".",
"getUserInfo",
"(",
")",
"+",
"\"@\"",
",",
"url",
".",
"getHost",
"(",
")",
",",
"url",
".",
"getPort",
"(",
")",
"==",
"-",
"1",
"?",
"\"\"",
":",
"\":\"",
"+",
"Integer",
".",
"toString",
"(",
"url",
".",
"getPort",
"(",
")",
")",
",",
"directory",
")",
";",
"}"
] |
Returns the directory of the URL.
@param urlString URL of the file.
@return The directory string.
@throws IllegalArgumentException if URL is malformed
|
[
"Returns",
"the",
"directory",
"of",
"the",
"URL",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/FileNameUtils.java#L105-L121
|
161,966 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/xtext/XtextLinker.java
|
XtextLinker.clearReference
|
@Override
protected void clearReference(EObject obj, EReference ref) {
super.clearReference(obj, ref);
if (obj.eIsSet(ref) && ref.getEType().equals(XtextPackage.Literals.TYPE_REF)) {
INode node = NodeModelUtils.getNode((EObject) obj.eGet(ref));
if (node == null)
obj.eUnset(ref);
}
if (obj.eIsSet(ref) && ref == XtextPackage.Literals.CROSS_REFERENCE__TERMINAL) {
INode node = NodeModelUtils.getNode((EObject) obj.eGet(ref));
if (node == null)
obj.eUnset(ref);
}
if (ref == XtextPackage.Literals.RULE_CALL__RULE) {
obj.eUnset(XtextPackage.Literals.RULE_CALL__EXPLICITLY_CALLED);
}
}
|
java
|
@Override
protected void clearReference(EObject obj, EReference ref) {
super.clearReference(obj, ref);
if (obj.eIsSet(ref) && ref.getEType().equals(XtextPackage.Literals.TYPE_REF)) {
INode node = NodeModelUtils.getNode((EObject) obj.eGet(ref));
if (node == null)
obj.eUnset(ref);
}
if (obj.eIsSet(ref) && ref == XtextPackage.Literals.CROSS_REFERENCE__TERMINAL) {
INode node = NodeModelUtils.getNode((EObject) obj.eGet(ref));
if (node == null)
obj.eUnset(ref);
}
if (ref == XtextPackage.Literals.RULE_CALL__RULE) {
obj.eUnset(XtextPackage.Literals.RULE_CALL__EXPLICITLY_CALLED);
}
}
|
[
"@",
"Override",
"protected",
"void",
"clearReference",
"(",
"EObject",
"obj",
",",
"EReference",
"ref",
")",
"{",
"super",
".",
"clearReference",
"(",
"obj",
",",
"ref",
")",
";",
"if",
"(",
"obj",
".",
"eIsSet",
"(",
"ref",
")",
"&&",
"ref",
".",
"getEType",
"(",
")",
".",
"equals",
"(",
"XtextPackage",
".",
"Literals",
".",
"TYPE_REF",
")",
")",
"{",
"INode",
"node",
"=",
"NodeModelUtils",
".",
"getNode",
"(",
"(",
"EObject",
")",
"obj",
".",
"eGet",
"(",
"ref",
")",
")",
";",
"if",
"(",
"node",
"==",
"null",
")",
"obj",
".",
"eUnset",
"(",
"ref",
")",
";",
"}",
"if",
"(",
"obj",
".",
"eIsSet",
"(",
"ref",
")",
"&&",
"ref",
"==",
"XtextPackage",
".",
"Literals",
".",
"CROSS_REFERENCE__TERMINAL",
")",
"{",
"INode",
"node",
"=",
"NodeModelUtils",
".",
"getNode",
"(",
"(",
"EObject",
")",
"obj",
".",
"eGet",
"(",
"ref",
")",
")",
";",
"if",
"(",
"node",
"==",
"null",
")",
"obj",
".",
"eUnset",
"(",
"ref",
")",
";",
"}",
"if",
"(",
"ref",
"==",
"XtextPackage",
".",
"Literals",
".",
"RULE_CALL__RULE",
")",
"{",
"obj",
".",
"eUnset",
"(",
"XtextPackage",
".",
"Literals",
".",
"RULE_CALL__EXPLICITLY_CALLED",
")",
";",
"}",
"}"
] |
We add typeRefs without Nodes on the fly, so we should remove them before relinking.
|
[
"We",
"add",
"typeRefs",
"without",
"Nodes",
"on",
"the",
"fly",
"so",
"we",
"should",
"remove",
"them",
"before",
"relinking",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/xtext/XtextLinker.java#L466-L482
|
161,967 |
eclipse/xtext-core
|
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/OutdatedStateManager.java
|
OutdatedStateManager.newCancelIndicator
|
public CancelIndicator newCancelIndicator(final ResourceSet rs) {
CancelIndicator _xifexpression = null;
if ((rs instanceof XtextResourceSet)) {
final boolean cancelationAllowed = (this.cancelationAllowed.get()).booleanValue();
final int current = ((XtextResourceSet)rs).getModificationStamp();
final CancelIndicator _function = () -> {
return (cancelationAllowed && (((XtextResourceSet)rs).isOutdated() || (current != ((XtextResourceSet)rs).getModificationStamp())));
};
return _function;
} else {
_xifexpression = CancelIndicator.NullImpl;
}
return _xifexpression;
}
|
java
|
public CancelIndicator newCancelIndicator(final ResourceSet rs) {
CancelIndicator _xifexpression = null;
if ((rs instanceof XtextResourceSet)) {
final boolean cancelationAllowed = (this.cancelationAllowed.get()).booleanValue();
final int current = ((XtextResourceSet)rs).getModificationStamp();
final CancelIndicator _function = () -> {
return (cancelationAllowed && (((XtextResourceSet)rs).isOutdated() || (current != ((XtextResourceSet)rs).getModificationStamp())));
};
return _function;
} else {
_xifexpression = CancelIndicator.NullImpl;
}
return _xifexpression;
}
|
[
"public",
"CancelIndicator",
"newCancelIndicator",
"(",
"final",
"ResourceSet",
"rs",
")",
"{",
"CancelIndicator",
"_xifexpression",
"=",
"null",
";",
"if",
"(",
"(",
"rs",
"instanceof",
"XtextResourceSet",
")",
")",
"{",
"final",
"boolean",
"cancelationAllowed",
"=",
"(",
"this",
".",
"cancelationAllowed",
".",
"get",
"(",
")",
")",
".",
"booleanValue",
"(",
")",
";",
"final",
"int",
"current",
"=",
"(",
"(",
"XtextResourceSet",
")",
"rs",
")",
".",
"getModificationStamp",
"(",
")",
";",
"final",
"CancelIndicator",
"_function",
"=",
"(",
")",
"->",
"{",
"return",
"(",
"cancelationAllowed",
"&&",
"(",
"(",
"(",
"XtextResourceSet",
")",
"rs",
")",
".",
"isOutdated",
"(",
")",
"||",
"(",
"current",
"!=",
"(",
"(",
"XtextResourceSet",
")",
"rs",
")",
".",
"getModificationStamp",
"(",
")",
")",
")",
")",
";",
"}",
";",
"return",
"_function",
";",
"}",
"else",
"{",
"_xifexpression",
"=",
"CancelIndicator",
".",
"NullImpl",
";",
"}",
"return",
"_xifexpression",
";",
"}"
] |
Created a fresh CancelIndicator
|
[
"Created",
"a",
"fresh",
"CancelIndicator"
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/OutdatedStateManager.java#L41-L54
|
161,968 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java
|
IdeContentProposalCreator.createProposal
|
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) {
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null);
}
|
java
|
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) {
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null);
}
|
[
"public",
"ContentAssistEntry",
"createProposal",
"(",
"final",
"String",
"proposal",
",",
"final",
"ContentAssistContext",
"context",
")",
"{",
"return",
"this",
".",
"createProposal",
"(",
"proposal",
",",
"context",
".",
"getPrefix",
"(",
")",
",",
"context",
",",
"ContentAssistEntry",
".",
"KIND_UNKNOWN",
",",
"null",
")",
";",
"}"
] |
Returns an entry with the given proposal and the prefix from the context, or null if the proposal is not valid.
|
[
"Returns",
"an",
"entry",
"with",
"the",
"given",
"proposal",
"and",
"the",
"prefix",
"from",
"the",
"context",
"or",
"null",
"if",
"the",
"proposal",
"is",
"not",
"valid",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java#L36-L38
|
161,969 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java
|
IdeContentProposalCreator.createSnippet
|
public ContentAssistEntry createSnippet(final String proposal, final String label, final ContentAssistContext context) {
final Procedure1<ContentAssistEntry> _function = (ContentAssistEntry it) -> {
it.setLabel(label);
};
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_SNIPPET, _function);
}
|
java
|
public ContentAssistEntry createSnippet(final String proposal, final String label, final ContentAssistContext context) {
final Procedure1<ContentAssistEntry> _function = (ContentAssistEntry it) -> {
it.setLabel(label);
};
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_SNIPPET, _function);
}
|
[
"public",
"ContentAssistEntry",
"createSnippet",
"(",
"final",
"String",
"proposal",
",",
"final",
"String",
"label",
",",
"final",
"ContentAssistContext",
"context",
")",
"{",
"final",
"Procedure1",
"<",
"ContentAssistEntry",
">",
"_function",
"=",
"(",
"ContentAssistEntry",
"it",
")",
"->",
"{",
"it",
".",
"setLabel",
"(",
"label",
")",
";",
"}",
";",
"return",
"this",
".",
"createProposal",
"(",
"proposal",
",",
"context",
".",
"getPrefix",
"(",
")",
",",
"context",
",",
"ContentAssistEntry",
".",
"KIND_SNIPPET",
",",
"_function",
")",
";",
"}"
] |
Returns an entry of kind snippet with the given proposal and label and the prefix from the context, or null if the proposal is not valid.
@since 2.16
|
[
"Returns",
"an",
"entry",
"of",
"kind",
"snippet",
"with",
"the",
"given",
"proposal",
"and",
"label",
"and",
"the",
"prefix",
"from",
"the",
"context",
"or",
"null",
"if",
"the",
"proposal",
"is",
"not",
"valid",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java#L44-L49
|
161,970 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java
|
IdeContentProposalCreator.createProposal
|
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context, final Procedure1<? super ContentAssistEntry> init) {
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, init);
}
|
java
|
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context, final Procedure1<? super ContentAssistEntry> init) {
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, init);
}
|
[
"public",
"ContentAssistEntry",
"createProposal",
"(",
"final",
"String",
"proposal",
",",
"final",
"ContentAssistContext",
"context",
",",
"final",
"Procedure1",
"<",
"?",
"super",
"ContentAssistEntry",
">",
"init",
")",
"{",
"return",
"this",
".",
"createProposal",
"(",
"proposal",
",",
"context",
".",
"getPrefix",
"(",
")",
",",
"context",
",",
"ContentAssistEntry",
".",
"KIND_UNKNOWN",
",",
"init",
")",
";",
"}"
] |
Returns an entry with the given proposal and the prefix from the context, or null if the proposal is not valid.
If it is valid, the initializer function is applied to it.
|
[
"Returns",
"an",
"entry",
"with",
"the",
"given",
"proposal",
"and",
"the",
"prefix",
"from",
"the",
"context",
"or",
"null",
"if",
"the",
"proposal",
"is",
"not",
"valid",
".",
"If",
"it",
"is",
"valid",
"the",
"initializer",
"function",
"is",
"applied",
"to",
"it",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java#L55-L57
|
161,971 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java
|
IdeContentProposalCreator.createProposal
|
public ContentAssistEntry createProposal(final String proposal, final String prefix, final ContentAssistContext context, final String kind, final Procedure1<? super ContentAssistEntry> init) {
boolean _isValidProposal = this.isValidProposal(proposal, prefix, context);
if (_isValidProposal) {
final ContentAssistEntry result = new ContentAssistEntry();
result.setProposal(proposal);
result.setPrefix(prefix);
if ((kind != null)) {
result.setKind(kind);
}
if ((init != null)) {
init.apply(result);
}
return result;
}
return null;
}
|
java
|
public ContentAssistEntry createProposal(final String proposal, final String prefix, final ContentAssistContext context, final String kind, final Procedure1<? super ContentAssistEntry> init) {
boolean _isValidProposal = this.isValidProposal(proposal, prefix, context);
if (_isValidProposal) {
final ContentAssistEntry result = new ContentAssistEntry();
result.setProposal(proposal);
result.setPrefix(prefix);
if ((kind != null)) {
result.setKind(kind);
}
if ((init != null)) {
init.apply(result);
}
return result;
}
return null;
}
|
[
"public",
"ContentAssistEntry",
"createProposal",
"(",
"final",
"String",
"proposal",
",",
"final",
"String",
"prefix",
",",
"final",
"ContentAssistContext",
"context",
",",
"final",
"String",
"kind",
",",
"final",
"Procedure1",
"<",
"?",
"super",
"ContentAssistEntry",
">",
"init",
")",
"{",
"boolean",
"_isValidProposal",
"=",
"this",
".",
"isValidProposal",
"(",
"proposal",
",",
"prefix",
",",
"context",
")",
";",
"if",
"(",
"_isValidProposal",
")",
"{",
"final",
"ContentAssistEntry",
"result",
"=",
"new",
"ContentAssistEntry",
"(",
")",
";",
"result",
".",
"setProposal",
"(",
"proposal",
")",
";",
"result",
".",
"setPrefix",
"(",
"prefix",
")",
";",
"if",
"(",
"(",
"kind",
"!=",
"null",
")",
")",
"{",
"result",
".",
"setKind",
"(",
"kind",
")",
";",
"}",
"if",
"(",
"(",
"init",
"!=",
"null",
")",
")",
"{",
"init",
".",
"apply",
"(",
"result",
")",
";",
"}",
"return",
"result",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns an entry with the given proposal and prefix, or null if the proposal is not valid.
If it is valid, the initializer function is applied to it.
|
[
"Returns",
"an",
"entry",
"with",
"the",
"given",
"proposal",
"and",
"prefix",
"or",
"null",
"if",
"the",
"proposal",
"is",
"not",
"valid",
".",
"If",
"it",
"is",
"valid",
"the",
"initializer",
"function",
"is",
"applied",
"to",
"it",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java#L71-L86
|
161,972 |
eclipse/xtext-core
|
org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/UriExtensions.java
|
UriExtensions.toDecodedString
|
public String toDecodedString(final java.net.URI uri) {
final String scheme = uri.getScheme();
final String part = uri.getSchemeSpecificPart();
if ((scheme == null)) {
return part;
}
return ((scheme + ":") + part);
}
|
java
|
public String toDecodedString(final java.net.URI uri) {
final String scheme = uri.getScheme();
final String part = uri.getSchemeSpecificPart();
if ((scheme == null)) {
return part;
}
return ((scheme + ":") + part);
}
|
[
"public",
"String",
"toDecodedString",
"(",
"final",
"java",
".",
"net",
".",
"URI",
"uri",
")",
"{",
"final",
"String",
"scheme",
"=",
"uri",
".",
"getScheme",
"(",
")",
";",
"final",
"String",
"part",
"=",
"uri",
".",
"getSchemeSpecificPart",
"(",
")",
";",
"if",
"(",
"(",
"scheme",
"==",
"null",
")",
")",
"{",
"return",
"part",
";",
"}",
"return",
"(",
"(",
"scheme",
"+",
"\":\"",
")",
"+",
"part",
")",
";",
"}"
] |
converts a java.net.URI to a decoded string
|
[
"converts",
"a",
"java",
".",
"net",
".",
"URI",
"to",
"a",
"decoded",
"string"
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/UriExtensions.java#L48-L55
|
161,973 |
eclipse/xtext-core
|
org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/UriExtensions.java
|
UriExtensions.withEmptyAuthority
|
public URI withEmptyAuthority(final URI uri) {
URI _xifexpression = null;
if ((uri.isFile() && (uri.authority() == null))) {
_xifexpression = URI.createHierarchicalURI(uri.scheme(), "", uri.device(), uri.segments(), uri.query(), uri.fragment());
} else {
_xifexpression = uri;
}
return _xifexpression;
}
|
java
|
public URI withEmptyAuthority(final URI uri) {
URI _xifexpression = null;
if ((uri.isFile() && (uri.authority() == null))) {
_xifexpression = URI.createHierarchicalURI(uri.scheme(), "", uri.device(), uri.segments(), uri.query(), uri.fragment());
} else {
_xifexpression = uri;
}
return _xifexpression;
}
|
[
"public",
"URI",
"withEmptyAuthority",
"(",
"final",
"URI",
"uri",
")",
"{",
"URI",
"_xifexpression",
"=",
"null",
";",
"if",
"(",
"(",
"uri",
".",
"isFile",
"(",
")",
"&&",
"(",
"uri",
".",
"authority",
"(",
")",
"==",
"null",
")",
")",
")",
"{",
"_xifexpression",
"=",
"URI",
".",
"createHierarchicalURI",
"(",
"uri",
".",
"scheme",
"(",
")",
",",
"\"\"",
",",
"uri",
".",
"device",
"(",
")",
",",
"uri",
".",
"segments",
"(",
")",
",",
"uri",
".",
"query",
"(",
")",
",",
"uri",
".",
"fragment",
"(",
")",
")",
";",
"}",
"else",
"{",
"_xifexpression",
"=",
"uri",
";",
"}",
"return",
"_xifexpression",
";",
"}"
] |
converts the file URIs with an absent authority to one with an empty
|
[
"converts",
"the",
"file",
"URIs",
"with",
"an",
"absent",
"authority",
"to",
"one",
"with",
"an",
"empty"
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/xtend-gen/org/eclipse/xtext/util/UriExtensions.java#L60-L68
|
161,974 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/RequiredRuleNameComputer.java
|
RequiredRuleNameComputer.getRequiredRuleNames
|
public String[][] getRequiredRuleNames(Param param) {
if (isFiltered(param)) {
return EMPTY_ARRAY;
}
AbstractElement elementToParse = param.elementToParse;
String ruleName = param.ruleName;
if (ruleName == null) {
return getRequiredRuleNames(param, elementToParse);
}
return getAdjustedRequiredRuleNames(param, elementToParse, ruleName);
}
|
java
|
public String[][] getRequiredRuleNames(Param param) {
if (isFiltered(param)) {
return EMPTY_ARRAY;
}
AbstractElement elementToParse = param.elementToParse;
String ruleName = param.ruleName;
if (ruleName == null) {
return getRequiredRuleNames(param, elementToParse);
}
return getAdjustedRequiredRuleNames(param, elementToParse, ruleName);
}
|
[
"public",
"String",
"[",
"]",
"[",
"]",
"getRequiredRuleNames",
"(",
"Param",
"param",
")",
"{",
"if",
"(",
"isFiltered",
"(",
"param",
")",
")",
"{",
"return",
"EMPTY_ARRAY",
";",
"}",
"AbstractElement",
"elementToParse",
"=",
"param",
".",
"elementToParse",
";",
"String",
"ruleName",
"=",
"param",
".",
"ruleName",
";",
"if",
"(",
"ruleName",
"==",
"null",
")",
"{",
"return",
"getRequiredRuleNames",
"(",
"param",
",",
"elementToParse",
")",
";",
"}",
"return",
"getAdjustedRequiredRuleNames",
"(",
"param",
",",
"elementToParse",
",",
"ruleName",
")",
";",
"}"
] |
Returns the names of parser rules that should be called in order to obtain the follow elements for the parser
call stack described by the given param.
|
[
"Returns",
"the",
"names",
"of",
"parser",
"rules",
"that",
"should",
"be",
"called",
"in",
"order",
"to",
"obtain",
"the",
"follow",
"elements",
"for",
"the",
"parser",
"call",
"stack",
"described",
"by",
"the",
"given",
"param",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/RequiredRuleNameComputer.java#L76-L86
|
161,975 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/RequiredRuleNameComputer.java
|
RequiredRuleNameComputer.isFiltered
|
protected boolean isFiltered(Param param) {
AbstractElement elementToParse = param.elementToParse;
while (elementToParse != null) {
if (isFiltered(elementToParse, param)) {
return true;
}
elementToParse = getEnclosingSingleElementGroup(elementToParse);
}
return false;
}
|
java
|
protected boolean isFiltered(Param param) {
AbstractElement elementToParse = param.elementToParse;
while (elementToParse != null) {
if (isFiltered(elementToParse, param)) {
return true;
}
elementToParse = getEnclosingSingleElementGroup(elementToParse);
}
return false;
}
|
[
"protected",
"boolean",
"isFiltered",
"(",
"Param",
"param",
")",
"{",
"AbstractElement",
"elementToParse",
"=",
"param",
".",
"elementToParse",
";",
"while",
"(",
"elementToParse",
"!=",
"null",
")",
"{",
"if",
"(",
"isFiltered",
"(",
"elementToParse",
",",
"param",
")",
")",
"{",
"return",
"true",
";",
"}",
"elementToParse",
"=",
"getEnclosingSingleElementGroup",
"(",
"elementToParse",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Returns true if the grammar element that is associated with the given param is filtered due to guard conditions
of parameterized rules in the current call stack.
If the grammar element is the only element contained in a group, its container is checked, too.
@see #isFiltered(AbstractElement, Param)
|
[
"Returns",
"true",
"if",
"the",
"grammar",
"element",
"that",
"is",
"associated",
"with",
"the",
"given",
"param",
"is",
"filtered",
"due",
"to",
"guard",
"conditions",
"of",
"parameterized",
"rules",
"in",
"the",
"current",
"call",
"stack",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/RequiredRuleNameComputer.java#L169-L178
|
161,976 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/RequiredRuleNameComputer.java
|
RequiredRuleNameComputer.getEnclosingSingleElementGroup
|
protected AbstractElement getEnclosingSingleElementGroup(AbstractElement elementToParse) {
EObject container = elementToParse.eContainer();
if (container instanceof Group) {
if (((Group) container).getElements().size() == 1) {
return (AbstractElement) container;
}
}
return null;
}
|
java
|
protected AbstractElement getEnclosingSingleElementGroup(AbstractElement elementToParse) {
EObject container = elementToParse.eContainer();
if (container instanceof Group) {
if (((Group) container).getElements().size() == 1) {
return (AbstractElement) container;
}
}
return null;
}
|
[
"protected",
"AbstractElement",
"getEnclosingSingleElementGroup",
"(",
"AbstractElement",
"elementToParse",
")",
"{",
"EObject",
"container",
"=",
"elementToParse",
".",
"eContainer",
"(",
")",
";",
"if",
"(",
"container",
"instanceof",
"Group",
")",
"{",
"if",
"(",
"(",
"(",
"Group",
")",
"container",
")",
".",
"getElements",
"(",
")",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"(",
"AbstractElement",
")",
"container",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Return the containing group if it contains exactly one element.
@since 2.14
|
[
"Return",
"the",
"containing",
"group",
"if",
"it",
"contains",
"exactly",
"one",
"element",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/RequiredRuleNameComputer.java#L185-L193
|
161,977 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/RequiredRuleNameComputer.java
|
RequiredRuleNameComputer.isFiltered
|
protected boolean isFiltered(AbstractElement canddiate, Param param) {
if (canddiate instanceof Group) {
Group group = (Group) canddiate;
if (group.getGuardCondition() != null) {
Set<Parameter> context = param.getAssignedParametes();
ConditionEvaluator evaluator = new ConditionEvaluator(context);
if (!evaluator.evaluate(group.getGuardCondition())) {
return true;
}
}
}
return false;
}
|
java
|
protected boolean isFiltered(AbstractElement canddiate, Param param) {
if (canddiate instanceof Group) {
Group group = (Group) canddiate;
if (group.getGuardCondition() != null) {
Set<Parameter> context = param.getAssignedParametes();
ConditionEvaluator evaluator = new ConditionEvaluator(context);
if (!evaluator.evaluate(group.getGuardCondition())) {
return true;
}
}
}
return false;
}
|
[
"protected",
"boolean",
"isFiltered",
"(",
"AbstractElement",
"canddiate",
",",
"Param",
"param",
")",
"{",
"if",
"(",
"canddiate",
"instanceof",
"Group",
")",
"{",
"Group",
"group",
"=",
"(",
"Group",
")",
"canddiate",
";",
"if",
"(",
"group",
".",
"getGuardCondition",
"(",
")",
"!=",
"null",
")",
"{",
"Set",
"<",
"Parameter",
">",
"context",
"=",
"param",
".",
"getAssignedParametes",
"(",
")",
";",
"ConditionEvaluator",
"evaluator",
"=",
"new",
"ConditionEvaluator",
"(",
"context",
")",
";",
"if",
"(",
"!",
"evaluator",
".",
"evaluate",
"(",
"group",
".",
"getGuardCondition",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns true if the given candidate is a group that is filtered due to rule parameters in the current call graph.
|
[
"Returns",
"true",
"if",
"the",
"given",
"candidate",
"is",
"a",
"group",
"that",
"is",
"filtered",
"due",
"to",
"rule",
"parameters",
"in",
"the",
"current",
"call",
"graph",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/RequiredRuleNameComputer.java#L198-L210
|
161,978 |
eclipse/xtext-core
|
org.eclipse.xtext.util/src/org/eclipse/xtext/util/internal/CodeGenUtil2.java
|
CodeGenUtil2.isJavaLangType
|
public static boolean isJavaLangType(String s) {
return getJavaDefaultTypes().contains(s) && Character.isUpperCase(s.charAt(0));
}
|
java
|
public static boolean isJavaLangType(String s) {
return getJavaDefaultTypes().contains(s) && Character.isUpperCase(s.charAt(0));
}
|
[
"public",
"static",
"boolean",
"isJavaLangType",
"(",
"String",
"s",
")",
"{",
"return",
"getJavaDefaultTypes",
"(",
")",
".",
"contains",
"(",
"s",
")",
"&&",
"Character",
".",
"isUpperCase",
"(",
"s",
".",
"charAt",
"(",
"0",
")",
")",
";",
"}"
] |
Tests whether the given string is the name of a java.lang type.
|
[
"Tests",
"whether",
"the",
"given",
"string",
"is",
"the",
"name",
"of",
"a",
"java",
".",
"lang",
"type",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/internal/CodeGenUtil2.java#L28-L30
|
161,979 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ContentAssistContext.java
|
ContentAssistContext.copy
|
public ContentAssistContext.Builder copy() {
Builder result = builderProvider.get();
result.copyFrom(this);
return result;
}
|
java
|
public ContentAssistContext.Builder copy() {
Builder result = builderProvider.get();
result.copyFrom(this);
return result;
}
|
[
"public",
"ContentAssistContext",
".",
"Builder",
"copy",
"(",
")",
"{",
"Builder",
"result",
"=",
"builderProvider",
".",
"get",
"(",
")",
";",
"result",
".",
"copyFrom",
"(",
"this",
")",
";",
"return",
"result",
";",
"}"
] |
Use this context as prototype for a new mutable builder. The new builder is
pre-populated with the current settings of this context instance.
|
[
"Use",
"this",
"context",
"as",
"prototype",
"for",
"a",
"new",
"mutable",
"builder",
".",
"The",
"new",
"builder",
"is",
"pre",
"-",
"populated",
"with",
"the",
"current",
"settings",
"of",
"this",
"context",
"instance",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ContentAssistContext.java#L175-L179
|
161,980 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ContentAssistContext.java
|
ContentAssistContext.getFirstSetGrammarElements
|
public ImmutableList<AbstractElement> getFirstSetGrammarElements() {
if (firstSetGrammarElements == null) {
firstSetGrammarElements = ImmutableList.copyOf(mutableFirstSetGrammarElements);
}
return firstSetGrammarElements;
}
|
java
|
public ImmutableList<AbstractElement> getFirstSetGrammarElements() {
if (firstSetGrammarElements == null) {
firstSetGrammarElements = ImmutableList.copyOf(mutableFirstSetGrammarElements);
}
return firstSetGrammarElements;
}
|
[
"public",
"ImmutableList",
"<",
"AbstractElement",
">",
"getFirstSetGrammarElements",
"(",
")",
"{",
"if",
"(",
"firstSetGrammarElements",
"==",
"null",
")",
"{",
"firstSetGrammarElements",
"=",
"ImmutableList",
".",
"copyOf",
"(",
"mutableFirstSetGrammarElements",
")",
";",
"}",
"return",
"firstSetGrammarElements",
";",
"}"
] |
The grammar elements that may occur at the given offset.
|
[
"The",
"grammar",
"elements",
"that",
"may",
"occur",
"at",
"the",
"given",
"offset",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ContentAssistContext.java#L266-L271
|
161,981 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ContentAssistContext.java
|
ContentAssistContext.getReplaceContextLength
|
public int getReplaceContextLength() {
if (replaceContextLength == null) {
int replacementOffset = getReplaceRegion().getOffset();
ITextRegion currentRegion = getCurrentNode().getTextRegion();
int replaceContextLength = currentRegion.getLength() - (replacementOffset - currentRegion.getOffset());
this.replaceContextLength = replaceContextLength;
return replaceContextLength;
}
return replaceContextLength.intValue();
}
|
java
|
public int getReplaceContextLength() {
if (replaceContextLength == null) {
int replacementOffset = getReplaceRegion().getOffset();
ITextRegion currentRegion = getCurrentNode().getTextRegion();
int replaceContextLength = currentRegion.getLength() - (replacementOffset - currentRegion.getOffset());
this.replaceContextLength = replaceContextLength;
return replaceContextLength;
}
return replaceContextLength.intValue();
}
|
[
"public",
"int",
"getReplaceContextLength",
"(",
")",
"{",
"if",
"(",
"replaceContextLength",
"==",
"null",
")",
"{",
"int",
"replacementOffset",
"=",
"getReplaceRegion",
"(",
")",
".",
"getOffset",
"(",
")",
";",
"ITextRegion",
"currentRegion",
"=",
"getCurrentNode",
"(",
")",
".",
"getTextRegion",
"(",
")",
";",
"int",
"replaceContextLength",
"=",
"currentRegion",
".",
"getLength",
"(",
")",
"-",
"(",
"replacementOffset",
"-",
"currentRegion",
".",
"getOffset",
"(",
")",
")",
";",
"this",
".",
"replaceContextLength",
"=",
"replaceContextLength",
";",
"return",
"replaceContextLength",
";",
"}",
"return",
"replaceContextLength",
".",
"intValue",
"(",
")",
";",
"}"
] |
The length of the region left to the completion offset that is part of the
replace region.
|
[
"The",
"length",
"of",
"the",
"region",
"left",
"to",
"the",
"completion",
"offset",
"that",
"is",
"part",
"of",
"the",
"replace",
"region",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/ContentAssistContext.java#L277-L286
|
161,982 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/formatting/impl/NodeModelStreamer.java
|
NodeModelStreamer.getFormattedDatatypeValue
|
protected String getFormattedDatatypeValue(ICompositeNode node, AbstractRule rule, String text) throws ValueConverterException {
Object value = valueConverter.toValue(text, rule.getName(), node);
text = valueConverter.toString(value, rule.getName());
return text;
}
|
java
|
protected String getFormattedDatatypeValue(ICompositeNode node, AbstractRule rule, String text) throws ValueConverterException {
Object value = valueConverter.toValue(text, rule.getName(), node);
text = valueConverter.toString(value, rule.getName());
return text;
}
|
[
"protected",
"String",
"getFormattedDatatypeValue",
"(",
"ICompositeNode",
"node",
",",
"AbstractRule",
"rule",
",",
"String",
"text",
")",
"throws",
"ValueConverterException",
"{",
"Object",
"value",
"=",
"valueConverter",
".",
"toValue",
"(",
"text",
",",
"rule",
".",
"getName",
"(",
")",
",",
"node",
")",
";",
"text",
"=",
"valueConverter",
".",
"toString",
"(",
"value",
",",
"rule",
".",
"getName",
"(",
")",
")",
";",
"return",
"text",
";",
"}"
] |
Create a canonical represenation of the data type value. Defaults to the value converter.
@since 2.9
|
[
"Create",
"a",
"canonical",
"represenation",
"of",
"the",
"data",
"type",
"value",
".",
"Defaults",
"to",
"the",
"value",
"converter",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/formatting/impl/NodeModelStreamer.java#L163-L167
|
161,983 |
eclipse/xtext-core
|
org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/splitting/internal/LexerSpecialStateTransitionSplitter.java
|
LexerSpecialStateTransitionSplitter.splitSpecialStateSwitch
|
public String splitSpecialStateSwitch(String specialStateTransition){
Matcher transformedSpecialStateMatcher =
TRANSORMED_SPECIAL_STATE_TRANSITION_METHOD.matcher(specialStateTransition);
if( !transformedSpecialStateMatcher.find() ){
return specialStateTransition;
}
String specialStateSwitch = transformedSpecialStateMatcher.group(3);
Matcher transformedCaseMatcher = TRANSFORMED_CASE_PATTERN.matcher(specialStateSwitch);
StringBuffer switchReplacementBuffer = new StringBuffer();
StringBuffer extractedMethods = new StringBuffer();
List<String> extractedCasesList = new ArrayList<String>();
switchReplacementBuffer.append("$2\n");
boolean methodExtracted = false;
boolean isFirst = true;
String from = "0";
String to = "0";
//Process individual case statements
while(transformedCaseMatcher.find()){
if(isFirst){
isFirst = false;
from = transformedCaseMatcher.group(2);
}
to = transformedCaseMatcher.group(2);
extractedCasesList.add(transformedCaseMatcher.group());
//If the list of not processed extracted cases exceeds the maximal allowed number
//generate individual method for those cases
if (extractedCasesList.size() >= casesPerSpecialStateSwitch ){
generateExtractedSwitch(extractedCasesList, from, to, extractedMethods, switchReplacementBuffer);
extractedCasesList.clear();
isFirst = true;
methodExtracted = true;
}
}
//If no method was extracted return the input unchanged
//or process rest of cases by generating method for them
if(!methodExtracted){
return specialStateTransition;
}else if(!extractedCasesList.isEmpty() && methodExtracted){
generateExtractedSwitch(extractedCasesList, from, to, extractedMethods, switchReplacementBuffer);
}
switchReplacementBuffer.append("$5");
StringBuffer result = new StringBuffer();
transformedSpecialStateMatcher.appendReplacement( result, switchReplacementBuffer.toString());
result.append(extractedMethods);
transformedSpecialStateMatcher.appendTail(result);
return result.toString();
}
|
java
|
public String splitSpecialStateSwitch(String specialStateTransition){
Matcher transformedSpecialStateMatcher =
TRANSORMED_SPECIAL_STATE_TRANSITION_METHOD.matcher(specialStateTransition);
if( !transformedSpecialStateMatcher.find() ){
return specialStateTransition;
}
String specialStateSwitch = transformedSpecialStateMatcher.group(3);
Matcher transformedCaseMatcher = TRANSFORMED_CASE_PATTERN.matcher(specialStateSwitch);
StringBuffer switchReplacementBuffer = new StringBuffer();
StringBuffer extractedMethods = new StringBuffer();
List<String> extractedCasesList = new ArrayList<String>();
switchReplacementBuffer.append("$2\n");
boolean methodExtracted = false;
boolean isFirst = true;
String from = "0";
String to = "0";
//Process individual case statements
while(transformedCaseMatcher.find()){
if(isFirst){
isFirst = false;
from = transformedCaseMatcher.group(2);
}
to = transformedCaseMatcher.group(2);
extractedCasesList.add(transformedCaseMatcher.group());
//If the list of not processed extracted cases exceeds the maximal allowed number
//generate individual method for those cases
if (extractedCasesList.size() >= casesPerSpecialStateSwitch ){
generateExtractedSwitch(extractedCasesList, from, to, extractedMethods, switchReplacementBuffer);
extractedCasesList.clear();
isFirst = true;
methodExtracted = true;
}
}
//If no method was extracted return the input unchanged
//or process rest of cases by generating method for them
if(!methodExtracted){
return specialStateTransition;
}else if(!extractedCasesList.isEmpty() && methodExtracted){
generateExtractedSwitch(extractedCasesList, from, to, extractedMethods, switchReplacementBuffer);
}
switchReplacementBuffer.append("$5");
StringBuffer result = new StringBuffer();
transformedSpecialStateMatcher.appendReplacement( result, switchReplacementBuffer.toString());
result.append(extractedMethods);
transformedSpecialStateMatcher.appendTail(result);
return result.toString();
}
|
[
"public",
"String",
"splitSpecialStateSwitch",
"(",
"String",
"specialStateTransition",
")",
"{",
"Matcher",
"transformedSpecialStateMatcher",
"=",
"TRANSORMED_SPECIAL_STATE_TRANSITION_METHOD",
".",
"matcher",
"(",
"specialStateTransition",
")",
";",
"if",
"(",
"!",
"transformedSpecialStateMatcher",
".",
"find",
"(",
")",
")",
"{",
"return",
"specialStateTransition",
";",
"}",
"String",
"specialStateSwitch",
"=",
"transformedSpecialStateMatcher",
".",
"group",
"(",
"3",
")",
";",
"Matcher",
"transformedCaseMatcher",
"=",
"TRANSFORMED_CASE_PATTERN",
".",
"matcher",
"(",
"specialStateSwitch",
")",
";",
"StringBuffer",
"switchReplacementBuffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"StringBuffer",
"extractedMethods",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"List",
"<",
"String",
">",
"extractedCasesList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"switchReplacementBuffer",
".",
"append",
"(",
"\"$2\\n\"",
")",
";",
"boolean",
"methodExtracted",
"=",
"false",
";",
"boolean",
"isFirst",
"=",
"true",
";",
"String",
"from",
"=",
"\"0\"",
";",
"String",
"to",
"=",
"\"0\"",
";",
"//Process individual case statements",
"while",
"(",
"transformedCaseMatcher",
".",
"find",
"(",
")",
")",
"{",
"if",
"(",
"isFirst",
")",
"{",
"isFirst",
"=",
"false",
";",
"from",
"=",
"transformedCaseMatcher",
".",
"group",
"(",
"2",
")",
";",
"}",
"to",
"=",
"transformedCaseMatcher",
".",
"group",
"(",
"2",
")",
";",
"extractedCasesList",
".",
"add",
"(",
"transformedCaseMatcher",
".",
"group",
"(",
")",
")",
";",
"//If the list of not processed extracted cases exceeds the maximal allowed number",
"//generate individual method for those cases",
"if",
"(",
"extractedCasesList",
".",
"size",
"(",
")",
">=",
"casesPerSpecialStateSwitch",
")",
"{",
"generateExtractedSwitch",
"(",
"extractedCasesList",
",",
"from",
",",
"to",
",",
"extractedMethods",
",",
"switchReplacementBuffer",
")",
";",
"extractedCasesList",
".",
"clear",
"(",
")",
";",
"isFirst",
"=",
"true",
";",
"methodExtracted",
"=",
"true",
";",
"}",
"}",
"//If no method was extracted return the input unchanged",
"//or process rest of cases by generating method for them",
"if",
"(",
"!",
"methodExtracted",
")",
"{",
"return",
"specialStateTransition",
";",
"}",
"else",
"if",
"(",
"!",
"extractedCasesList",
".",
"isEmpty",
"(",
")",
"&&",
"methodExtracted",
")",
"{",
"generateExtractedSwitch",
"(",
"extractedCasesList",
",",
"from",
",",
"to",
",",
"extractedMethods",
",",
"switchReplacementBuffer",
")",
";",
"}",
"switchReplacementBuffer",
".",
"append",
"(",
"\"$5\"",
")",
";",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"transformedSpecialStateMatcher",
".",
"appendReplacement",
"(",
"result",
",",
"switchReplacementBuffer",
".",
"toString",
"(",
")",
")",
";",
"result",
".",
"append",
"(",
"extractedMethods",
")",
";",
"transformedSpecialStateMatcher",
".",
"appendTail",
"(",
"result",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Splits switch in specialStateTransition containing more than maxCasesPerSwitch
cases into several methods each containing maximum of maxCasesPerSwitch cases
or less.
@since 2.9
|
[
"Splits",
"switch",
"in",
"specialStateTransition",
"containing",
"more",
"than",
"maxCasesPerSwitch",
"cases",
"into",
"several",
"methods",
"each",
"containing",
"maximum",
"of",
"maxCasesPerSwitch",
"cases",
"or",
"less",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/splitting/internal/LexerSpecialStateTransitionSplitter.java#L153-L206
|
161,984 |
eclipse/xtext-core
|
org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/PluginXmlAccess.java
|
PluginXmlAccess.merge
|
public boolean merge(final PluginXmlAccess other) {
boolean _xblockexpression = false;
{
String _path = this.getPath();
String _path_1 = other.getPath();
boolean _notEquals = (!Objects.equal(_path, _path_1));
if (_notEquals) {
String _path_2 = this.getPath();
String _plus = ("Merging plugin.xml files with different paths: " + _path_2);
String _plus_1 = (_plus + ", ");
String _path_3 = other.getPath();
String _plus_2 = (_plus_1 + _path_3);
PluginXmlAccess.LOG.warn(_plus_2);
}
_xblockexpression = this.entries.addAll(other.entries);
}
return _xblockexpression;
}
|
java
|
public boolean merge(final PluginXmlAccess other) {
boolean _xblockexpression = false;
{
String _path = this.getPath();
String _path_1 = other.getPath();
boolean _notEquals = (!Objects.equal(_path, _path_1));
if (_notEquals) {
String _path_2 = this.getPath();
String _plus = ("Merging plugin.xml files with different paths: " + _path_2);
String _plus_1 = (_plus + ", ");
String _path_3 = other.getPath();
String _plus_2 = (_plus_1 + _path_3);
PluginXmlAccess.LOG.warn(_plus_2);
}
_xblockexpression = this.entries.addAll(other.entries);
}
return _xblockexpression;
}
|
[
"public",
"boolean",
"merge",
"(",
"final",
"PluginXmlAccess",
"other",
")",
"{",
"boolean",
"_xblockexpression",
"=",
"false",
";",
"{",
"String",
"_path",
"=",
"this",
".",
"getPath",
"(",
")",
";",
"String",
"_path_1",
"=",
"other",
".",
"getPath",
"(",
")",
";",
"boolean",
"_notEquals",
"=",
"(",
"!",
"Objects",
".",
"equal",
"(",
"_path",
",",
"_path_1",
")",
")",
";",
"if",
"(",
"_notEquals",
")",
"{",
"String",
"_path_2",
"=",
"this",
".",
"getPath",
"(",
")",
";",
"String",
"_plus",
"=",
"(",
"\"Merging plugin.xml files with different paths: \"",
"+",
"_path_2",
")",
";",
"String",
"_plus_1",
"=",
"(",
"_plus",
"+",
"\", \"",
")",
";",
"String",
"_path_3",
"=",
"other",
".",
"getPath",
"(",
")",
";",
"String",
"_plus_2",
"=",
"(",
"_plus_1",
"+",
"_path_3",
")",
";",
"PluginXmlAccess",
".",
"LOG",
".",
"warn",
"(",
"_plus_2",
")",
";",
"}",
"_xblockexpression",
"=",
"this",
".",
"entries",
".",
"addAll",
"(",
"other",
".",
"entries",
")",
";",
"}",
"return",
"_xblockexpression",
";",
"}"
] |
Merge the contents of the given plugin.xml into this one.
|
[
"Merge",
"the",
"contents",
"of",
"the",
"given",
"plugin",
".",
"xml",
"into",
"this",
"one",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/model/PluginXmlAccess.java#L80-L97
|
161,985 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/occurrences/DefaultDocumentHighlightService.java
|
DefaultDocumentHighlightService.getTargetURIs
|
protected Iterable<URI> getTargetURIs(final EObject primaryTarget) {
final TargetURIs result = targetURIsProvider.get();
uriCollector.add(primaryTarget, result);
return result;
}
|
java
|
protected Iterable<URI> getTargetURIs(final EObject primaryTarget) {
final TargetURIs result = targetURIsProvider.get();
uriCollector.add(primaryTarget, result);
return result;
}
|
[
"protected",
"Iterable",
"<",
"URI",
">",
"getTargetURIs",
"(",
"final",
"EObject",
"primaryTarget",
")",
"{",
"final",
"TargetURIs",
"result",
"=",
"targetURIsProvider",
".",
"get",
"(",
")",
";",
"uriCollector",
".",
"add",
"(",
"primaryTarget",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Returns with an iterable of URIs that points to all elements that are
referenced by the argument or vice-versa.
@return an iterable of URIs that are referenced by the argument or the
other way around.
|
[
"Returns",
"with",
"an",
"iterable",
"of",
"URIs",
"that",
"points",
"to",
"all",
"elements",
"that",
"are",
"referenced",
"by",
"the",
"argument",
"or",
"vice",
"-",
"versa",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/occurrences/DefaultDocumentHighlightService.java#L245-L249
|
161,986 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/mwe/NameBasedFilter.java
|
NameBasedFilter.setRegularExpression
|
public void setRegularExpression(String regularExpression) {
if (regularExpression != null)
this.regularExpression = Pattern.compile(regularExpression);
else
this.regularExpression = null;
}
|
java
|
public void setRegularExpression(String regularExpression) {
if (regularExpression != null)
this.regularExpression = Pattern.compile(regularExpression);
else
this.regularExpression = null;
}
|
[
"public",
"void",
"setRegularExpression",
"(",
"String",
"regularExpression",
")",
"{",
"if",
"(",
"regularExpression",
"!=",
"null",
")",
"this",
".",
"regularExpression",
"=",
"Pattern",
".",
"compile",
"(",
"regularExpression",
")",
";",
"else",
"this",
".",
"regularExpression",
"=",
"null",
";",
"}"
] |
Filter the URI based on a regular expression.
Can be combined with an additional file-extension filter.
|
[
"Filter",
"the",
"URI",
"based",
"on",
"a",
"regular",
"expression",
".",
"Can",
"be",
"combined",
"with",
"an",
"additional",
"file",
"-",
"extension",
"filter",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/mwe/NameBasedFilter.java#L54-L59
|
161,987 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/resource/generic/AbstractGenericResourceSupport.java
|
AbstractGenericResourceSupport.registerServices
|
public void registerServices(boolean force) {
Injector injector = Guice.createInjector(getGuiceModule());
injector.injectMembers(this);
registerInRegistry(force);
}
|
java
|
public void registerServices(boolean force) {
Injector injector = Guice.createInjector(getGuiceModule());
injector.injectMembers(this);
registerInRegistry(force);
}
|
[
"public",
"void",
"registerServices",
"(",
"boolean",
"force",
")",
"{",
"Injector",
"injector",
"=",
"Guice",
".",
"createInjector",
"(",
"getGuiceModule",
"(",
")",
")",
";",
"injector",
".",
"injectMembers",
"(",
"this",
")",
";",
"registerInRegistry",
"(",
"force",
")",
";",
"}"
] |
Inject members into this instance and register the services afterwards.
@see #getGuiceModule()
@see #registerInRegistry(boolean)
@since 2.1
|
[
"Inject",
"members",
"into",
"this",
"instance",
"and",
"register",
"the",
"services",
"afterwards",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/resource/generic/AbstractGenericResourceSupport.java#L54-L58
|
161,988 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/resource/impl/ResourceDescriptionsData.java
|
ResourceDescriptionsData.register
|
public void register(Delta delta) {
final IResourceDescription newDesc = delta.getNew();
if (newDesc == null) {
removeDescription(delta.getUri());
} else {
addDescription(delta.getUri(), newDesc);
}
}
|
java
|
public void register(Delta delta) {
final IResourceDescription newDesc = delta.getNew();
if (newDesc == null) {
removeDescription(delta.getUri());
} else {
addDescription(delta.getUri(), newDesc);
}
}
|
[
"public",
"void",
"register",
"(",
"Delta",
"delta",
")",
"{",
"final",
"IResourceDescription",
"newDesc",
"=",
"delta",
".",
"getNew",
"(",
")",
";",
"if",
"(",
"newDesc",
"==",
"null",
")",
"{",
"removeDescription",
"(",
"delta",
".",
"getUri",
"(",
")",
")",
";",
"}",
"else",
"{",
"addDescription",
"(",
"delta",
".",
"getUri",
"(",
")",
",",
"newDesc",
")",
";",
"}",
"}"
] |
Put a new resource description into the index, or remove one if the delta has no new description. A delta for a
particular URI may be registered more than once; overwriting any earlier registration.
@param delta
The resource change.
@since 2.9
|
[
"Put",
"a",
"new",
"resource",
"description",
"into",
"the",
"index",
"or",
"remove",
"one",
"if",
"the",
"delta",
"has",
"no",
"new",
"description",
".",
"A",
"delta",
"for",
"a",
"particular",
"URI",
"may",
"be",
"registered",
"more",
"than",
"once",
";",
"overwriting",
"any",
"earlier",
"registration",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/resource/impl/ResourceDescriptionsData.java#L241-L248
|
161,989 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/generator/trace/internal/AbstractTraceForURIProvider.java
|
AbstractTraceForURIProvider.getGeneratedLocation
|
protected AbsoluteURI getGeneratedLocation(PersistedTrace trace) {
AbsoluteURI path = trace.getPath();
String fileName = traceFileNameProvider.getJavaFromTrace(path.getURI().toString());
return new AbsoluteURI(fileName);
}
|
java
|
protected AbsoluteURI getGeneratedLocation(PersistedTrace trace) {
AbsoluteURI path = trace.getPath();
String fileName = traceFileNameProvider.getJavaFromTrace(path.getURI().toString());
return new AbsoluteURI(fileName);
}
|
[
"protected",
"AbsoluteURI",
"getGeneratedLocation",
"(",
"PersistedTrace",
"trace",
")",
"{",
"AbsoluteURI",
"path",
"=",
"trace",
".",
"getPath",
"(",
")",
";",
"String",
"fileName",
"=",
"traceFileNameProvider",
".",
"getJavaFromTrace",
"(",
"path",
".",
"getURI",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"return",
"new",
"AbsoluteURI",
"(",
"fileName",
")",
";",
"}"
] |
Compute the location of the generated file from the given trace file.
|
[
"Compute",
"the",
"location",
"of",
"the",
"generated",
"file",
"from",
"the",
"given",
"trace",
"file",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/generator/trace/internal/AbstractTraceForURIProvider.java#L276-L280
|
161,990 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java
|
Scopes.scopeFor
|
public static <T extends EObject> IScope scopeFor(Iterable<? extends T> elements,
final Function<T, QualifiedName> nameComputation, IScope outer) {
return new SimpleScope(outer,scopedElementsFor(elements, nameComputation));
}
|
java
|
public static <T extends EObject> IScope scopeFor(Iterable<? extends T> elements,
final Function<T, QualifiedName> nameComputation, IScope outer) {
return new SimpleScope(outer,scopedElementsFor(elements, nameComputation));
}
|
[
"public",
"static",
"<",
"T",
"extends",
"EObject",
">",
"IScope",
"scopeFor",
"(",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"elements",
",",
"final",
"Function",
"<",
"T",
",",
"QualifiedName",
">",
"nameComputation",
",",
"IScope",
"outer",
")",
"{",
"return",
"new",
"SimpleScope",
"(",
"outer",
",",
"scopedElementsFor",
"(",
"elements",
",",
"nameComputation",
")",
")",
";",
"}"
] |
creates a scope using the passed function to compute the names and sets the passed scope as the parent scope
|
[
"creates",
"a",
"scope",
"using",
"the",
"passed",
"function",
"to",
"compute",
"the",
"names",
"and",
"sets",
"the",
"passed",
"scope",
"as",
"the",
"parent",
"scope"
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java#L68-L71
|
161,991 |
eclipse/xtext-core
|
org.eclipse.xtext.util/src/org/eclipse/xtext/util/PolymorphicDispatcher.java
|
PolymorphicDispatcher.compare
|
protected int compare(MethodDesc o1, MethodDesc o2) {
final Class<?>[] paramTypes1 = o1.getParameterTypes();
final Class<?>[] paramTypes2 = o2.getParameterTypes();
// sort by parameter types from left to right
for (int i = 0; i < paramTypes1.length; i++) {
final Class<?> class1 = paramTypes1[i];
final Class<?> class2 = paramTypes2[i];
if (class1.equals(class2))
continue;
if (class1.isAssignableFrom(class2) || Void.class.equals(class2))
return -1;
if (class2.isAssignableFrom(class1) || Void.class.equals(class1))
return 1;
}
// sort by declaring class (more specific comes first).
if (!o1.getDeclaringClass().equals(o2.getDeclaringClass())) {
if (o1.getDeclaringClass().isAssignableFrom(o2.getDeclaringClass()))
return 1;
if (o2.getDeclaringClass().isAssignableFrom(o1.getDeclaringClass()))
return -1;
}
// sort by target
final int compareTo = ((Integer) targets.indexOf(o2.target)).compareTo(targets.indexOf(o1.target));
return compareTo;
}
|
java
|
protected int compare(MethodDesc o1, MethodDesc o2) {
final Class<?>[] paramTypes1 = o1.getParameterTypes();
final Class<?>[] paramTypes2 = o2.getParameterTypes();
// sort by parameter types from left to right
for (int i = 0; i < paramTypes1.length; i++) {
final Class<?> class1 = paramTypes1[i];
final Class<?> class2 = paramTypes2[i];
if (class1.equals(class2))
continue;
if (class1.isAssignableFrom(class2) || Void.class.equals(class2))
return -1;
if (class2.isAssignableFrom(class1) || Void.class.equals(class1))
return 1;
}
// sort by declaring class (more specific comes first).
if (!o1.getDeclaringClass().equals(o2.getDeclaringClass())) {
if (o1.getDeclaringClass().isAssignableFrom(o2.getDeclaringClass()))
return 1;
if (o2.getDeclaringClass().isAssignableFrom(o1.getDeclaringClass()))
return -1;
}
// sort by target
final int compareTo = ((Integer) targets.indexOf(o2.target)).compareTo(targets.indexOf(o1.target));
return compareTo;
}
|
[
"protected",
"int",
"compare",
"(",
"MethodDesc",
"o1",
",",
"MethodDesc",
"o2",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes1",
"=",
"o1",
".",
"getParameterTypes",
"(",
")",
";",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes2",
"=",
"o2",
".",
"getParameterTypes",
"(",
")",
";",
"// sort by parameter types from left to right",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paramTypes1",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"class1",
"=",
"paramTypes1",
"[",
"i",
"]",
";",
"final",
"Class",
"<",
"?",
">",
"class2",
"=",
"paramTypes2",
"[",
"i",
"]",
";",
"if",
"(",
"class1",
".",
"equals",
"(",
"class2",
")",
")",
"continue",
";",
"if",
"(",
"class1",
".",
"isAssignableFrom",
"(",
"class2",
")",
"||",
"Void",
".",
"class",
".",
"equals",
"(",
"class2",
")",
")",
"return",
"-",
"1",
";",
"if",
"(",
"class2",
".",
"isAssignableFrom",
"(",
"class1",
")",
"||",
"Void",
".",
"class",
".",
"equals",
"(",
"class1",
")",
")",
"return",
"1",
";",
"}",
"// sort by declaring class (more specific comes first).",
"if",
"(",
"!",
"o1",
".",
"getDeclaringClass",
"(",
")",
".",
"equals",
"(",
"o2",
".",
"getDeclaringClass",
"(",
")",
")",
")",
"{",
"if",
"(",
"o1",
".",
"getDeclaringClass",
"(",
")",
".",
"isAssignableFrom",
"(",
"o2",
".",
"getDeclaringClass",
"(",
")",
")",
")",
"return",
"1",
";",
"if",
"(",
"o2",
".",
"getDeclaringClass",
"(",
")",
".",
"isAssignableFrom",
"(",
"o1",
".",
"getDeclaringClass",
"(",
")",
")",
")",
"return",
"-",
"1",
";",
"}",
"// sort by target",
"final",
"int",
"compareTo",
"=",
"(",
"(",
"Integer",
")",
"targets",
".",
"indexOf",
"(",
"o2",
".",
"target",
")",
")",
".",
"compareTo",
"(",
"targets",
".",
"indexOf",
"(",
"o1",
".",
"target",
")",
")",
";",
"return",
"compareTo",
";",
"}"
] |
returns > 0 when o1 is more specific than o2,
returns == 0 when o1 and o2 are equal or unrelated,
returns < 0 when o2 is more specific than o1,
|
[
"returns",
">",
";",
"0",
"when",
"o1",
"is",
"more",
"specific",
"than",
"o2"
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/PolymorphicDispatcher.java#L219-L247
|
161,992 |
eclipse/xtext-core
|
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageWritable.java
|
ResourceStorageWritable.writeEntries
|
protected void writeEntries(final StorageAwareResource resource, final ZipOutputStream zipOut) throws IOException {
final BufferedOutputStream bufferedOutput = new BufferedOutputStream(zipOut);
ZipEntry _zipEntry = new ZipEntry("emf-contents");
zipOut.putNextEntry(_zipEntry);
try {
this.writeContents(resource, bufferedOutput);
} finally {
bufferedOutput.flush();
zipOut.closeEntry();
}
ZipEntry _zipEntry_1 = new ZipEntry("resource-description");
zipOut.putNextEntry(_zipEntry_1);
try {
this.writeResourceDescription(resource, bufferedOutput);
} finally {
bufferedOutput.flush();
zipOut.closeEntry();
}
if (this.storeNodeModel) {
ZipEntry _zipEntry_2 = new ZipEntry("node-model");
zipOut.putNextEntry(_zipEntry_2);
try {
this.writeNodeModel(resource, bufferedOutput);
} finally {
bufferedOutput.flush();
zipOut.closeEntry();
}
}
}
|
java
|
protected void writeEntries(final StorageAwareResource resource, final ZipOutputStream zipOut) throws IOException {
final BufferedOutputStream bufferedOutput = new BufferedOutputStream(zipOut);
ZipEntry _zipEntry = new ZipEntry("emf-contents");
zipOut.putNextEntry(_zipEntry);
try {
this.writeContents(resource, bufferedOutput);
} finally {
bufferedOutput.flush();
zipOut.closeEntry();
}
ZipEntry _zipEntry_1 = new ZipEntry("resource-description");
zipOut.putNextEntry(_zipEntry_1);
try {
this.writeResourceDescription(resource, bufferedOutput);
} finally {
bufferedOutput.flush();
zipOut.closeEntry();
}
if (this.storeNodeModel) {
ZipEntry _zipEntry_2 = new ZipEntry("node-model");
zipOut.putNextEntry(_zipEntry_2);
try {
this.writeNodeModel(resource, bufferedOutput);
} finally {
bufferedOutput.flush();
zipOut.closeEntry();
}
}
}
|
[
"protected",
"void",
"writeEntries",
"(",
"final",
"StorageAwareResource",
"resource",
",",
"final",
"ZipOutputStream",
"zipOut",
")",
"throws",
"IOException",
"{",
"final",
"BufferedOutputStream",
"bufferedOutput",
"=",
"new",
"BufferedOutputStream",
"(",
"zipOut",
")",
";",
"ZipEntry",
"_zipEntry",
"=",
"new",
"ZipEntry",
"(",
"\"emf-contents\"",
")",
";",
"zipOut",
".",
"putNextEntry",
"(",
"_zipEntry",
")",
";",
"try",
"{",
"this",
".",
"writeContents",
"(",
"resource",
",",
"bufferedOutput",
")",
";",
"}",
"finally",
"{",
"bufferedOutput",
".",
"flush",
"(",
")",
";",
"zipOut",
".",
"closeEntry",
"(",
")",
";",
"}",
"ZipEntry",
"_zipEntry_1",
"=",
"new",
"ZipEntry",
"(",
"\"resource-description\"",
")",
";",
"zipOut",
".",
"putNextEntry",
"(",
"_zipEntry_1",
")",
";",
"try",
"{",
"this",
".",
"writeResourceDescription",
"(",
"resource",
",",
"bufferedOutput",
")",
";",
"}",
"finally",
"{",
"bufferedOutput",
".",
"flush",
"(",
")",
";",
"zipOut",
".",
"closeEntry",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"storeNodeModel",
")",
"{",
"ZipEntry",
"_zipEntry_2",
"=",
"new",
"ZipEntry",
"(",
"\"node-model\"",
")",
";",
"zipOut",
".",
"putNextEntry",
"(",
"_zipEntry_2",
")",
";",
"try",
"{",
"this",
".",
"writeNodeModel",
"(",
"resource",
",",
"bufferedOutput",
")",
";",
"}",
"finally",
"{",
"bufferedOutput",
".",
"flush",
"(",
")",
";",
"zipOut",
".",
"closeEntry",
"(",
")",
";",
"}",
"}",
"}"
] |
Write entries into the storage.
Overriding methods should first delegate to super before adding their own entries.
|
[
"Write",
"entries",
"into",
"the",
"storage",
".",
"Overriding",
"methods",
"should",
"first",
"delegate",
"to",
"super",
"before",
"adding",
"their",
"own",
"entries",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageWritable.java#L61-L89
|
161,993 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IndentationAwareCompletionPrefixProvider.java
|
IndentationAwareCompletionPrefixProvider.getInputToParse
|
@Override
public String getInputToParse(String completeInput, int offset, int completionOffset) {
int fixedOffset = getOffsetIncludingWhitespace(completeInput, offset, Math.min(completeInput.length(), completionOffset));
return super.getInputToParse(completeInput, fixedOffset, completionOffset);
}
|
java
|
@Override
public String getInputToParse(String completeInput, int offset, int completionOffset) {
int fixedOffset = getOffsetIncludingWhitespace(completeInput, offset, Math.min(completeInput.length(), completionOffset));
return super.getInputToParse(completeInput, fixedOffset, completionOffset);
}
|
[
"@",
"Override",
"public",
"String",
"getInputToParse",
"(",
"String",
"completeInput",
",",
"int",
"offset",
",",
"int",
"completionOffset",
")",
"{",
"int",
"fixedOffset",
"=",
"getOffsetIncludingWhitespace",
"(",
"completeInput",
",",
"offset",
",",
"Math",
".",
"min",
"(",
"completeInput",
".",
"length",
"(",
")",
",",
"completionOffset",
")",
")",
";",
"return",
"super",
".",
"getInputToParse",
"(",
"completeInput",
",",
"fixedOffset",
",",
"completionOffset",
")",
";",
"}"
] |
Returns the input to parse including the whitespace left to the cursor position since
it may be relevant to the list of proposals for whitespace sensitive languages.
|
[
"Returns",
"the",
"input",
"to",
"parse",
"including",
"the",
"whitespace",
"left",
"to",
"the",
"cursor",
"position",
"since",
"it",
"may",
"be",
"relevant",
"to",
"the",
"list",
"of",
"proposals",
"for",
"whitespace",
"sensitive",
"languages",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IndentationAwareCompletionPrefixProvider.java#L41-L45
|
161,994 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/xtext/GrammarResource.java
|
GrammarResource.doLinking
|
@Override
protected void doLinking() {
IParseResult parseResult = getParseResult();
if (parseResult == null || parseResult.getRootASTElement() == null)
return;
XtextLinker castedLinker = (XtextLinker) getLinker();
castedLinker.discardGeneratedPackages(parseResult.getRootASTElement());
}
|
java
|
@Override
protected void doLinking() {
IParseResult parseResult = getParseResult();
if (parseResult == null || parseResult.getRootASTElement() == null)
return;
XtextLinker castedLinker = (XtextLinker) getLinker();
castedLinker.discardGeneratedPackages(parseResult.getRootASTElement());
}
|
[
"@",
"Override",
"protected",
"void",
"doLinking",
"(",
")",
"{",
"IParseResult",
"parseResult",
"=",
"getParseResult",
"(",
")",
";",
"if",
"(",
"parseResult",
"==",
"null",
"||",
"parseResult",
".",
"getRootASTElement",
"(",
")",
"==",
"null",
")",
"return",
";",
"XtextLinker",
"castedLinker",
"=",
"(",
"XtextLinker",
")",
"getLinker",
"(",
")",
";",
"castedLinker",
".",
"discardGeneratedPackages",
"(",
"parseResult",
".",
"getRootASTElement",
"(",
")",
")",
";",
"}"
] |
Overridden to do only the clean-part of the linking but not
the actual linking. This is deferred until someone wants to access
the content of the resource.
|
[
"Overridden",
"to",
"do",
"only",
"the",
"clean",
"-",
"part",
"of",
"the",
"linking",
"but",
"not",
"the",
"actual",
"linking",
".",
"This",
"is",
"deferred",
"until",
"someone",
"wants",
"to",
"access",
"the",
"content",
"of",
"the",
"resource",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/xtext/GrammarResource.java#L34-L42
|
161,995 |
eclipse/xtext-core
|
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SourceLevelURIsAdapter.java
|
SourceLevelURIsAdapter.setSourceLevelUrisWithoutCopy
|
public static void setSourceLevelUrisWithoutCopy(final ResourceSet resourceSet, final Set<URI> uris) {
final SourceLevelURIsAdapter adapter = SourceLevelURIsAdapter.findOrCreateAdapter(resourceSet);
adapter.sourceLevelURIs = uris;
}
|
java
|
public static void setSourceLevelUrisWithoutCopy(final ResourceSet resourceSet, final Set<URI> uris) {
final SourceLevelURIsAdapter adapter = SourceLevelURIsAdapter.findOrCreateAdapter(resourceSet);
adapter.sourceLevelURIs = uris;
}
|
[
"public",
"static",
"void",
"setSourceLevelUrisWithoutCopy",
"(",
"final",
"ResourceSet",
"resourceSet",
",",
"final",
"Set",
"<",
"URI",
">",
"uris",
")",
"{",
"final",
"SourceLevelURIsAdapter",
"adapter",
"=",
"SourceLevelURIsAdapter",
".",
"findOrCreateAdapter",
"(",
"resourceSet",
")",
";",
"adapter",
".",
"sourceLevelURIs",
"=",
"uris",
";",
"}"
] |
Installs the given set of URIs as the source level URIs. Does not copy the given
set but uses it directly.
|
[
"Installs",
"the",
"given",
"set",
"of",
"URIs",
"as",
"the",
"source",
"level",
"URIs",
".",
"Does",
"not",
"copy",
"the",
"given",
"set",
"but",
"uses",
"it",
"directly",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/SourceLevelURIsAdapter.java#L78-L81
|
161,996 |
eclipse/xtext-core
|
org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorLanguage.java
|
XtextGeneratorLanguage.setFileExtensions
|
public void setFileExtensions(final String fileExtensions) {
this.fileExtensions = IterableExtensions.<String>toList(((Iterable<String>)Conversions.doWrapArray(fileExtensions.trim().split("\\s*,\\s*"))));
}
|
java
|
public void setFileExtensions(final String fileExtensions) {
this.fileExtensions = IterableExtensions.<String>toList(((Iterable<String>)Conversions.doWrapArray(fileExtensions.trim().split("\\s*,\\s*"))));
}
|
[
"public",
"void",
"setFileExtensions",
"(",
"final",
"String",
"fileExtensions",
")",
"{",
"this",
".",
"fileExtensions",
"=",
"IterableExtensions",
".",
"<",
"String",
">",
"toList",
"(",
"(",
"(",
"Iterable",
"<",
"String",
">",
")",
"Conversions",
".",
"doWrapArray",
"(",
"fileExtensions",
".",
"trim",
"(",
")",
".",
"split",
"(",
"\"\\\\s*,\\\\s*\"",
")",
")",
")",
")",
";",
"}"
] |
Either a single file extension or a comma-separated list of extensions for which the language
shall be registered.
|
[
"Either",
"a",
"single",
"file",
"extension",
"or",
"a",
"comma",
"-",
"separated",
"list",
"of",
"extensions",
"for",
"which",
"the",
"language",
"shall",
"be",
"registered",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.xtext.generator/xtend-gen/org/eclipse/xtext/xtext/generator/XtextGeneratorLanguage.java#L167-L169
|
161,997 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/nodemodel/util/NodeModelUtils.java
|
NodeModelUtils.compactDump
|
public static String compactDump(INode node, boolean showHidden) {
StringBuilder result = new StringBuilder();
try {
compactDump(node, showHidden, "", result);
} catch (IOException e) {
return e.getMessage();
}
return result.toString();
}
|
java
|
public static String compactDump(INode node, boolean showHidden) {
StringBuilder result = new StringBuilder();
try {
compactDump(node, showHidden, "", result);
} catch (IOException e) {
return e.getMessage();
}
return result.toString();
}
|
[
"public",
"static",
"String",
"compactDump",
"(",
"INode",
"node",
",",
"boolean",
"showHidden",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"compactDump",
"(",
"node",
",",
"showHidden",
",",
"\"\"",
",",
"result",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"e",
".",
"getMessage",
"(",
")",
";",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Creates a string representation of the given node. Useful for debugging.
@return a debug string for the given node.
|
[
"Creates",
"a",
"string",
"representation",
"of",
"the",
"given",
"node",
".",
"Useful",
"for",
"debugging",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/nodemodel/util/NodeModelUtils.java#L341-L349
|
161,998 |
eclipse/xtext-core
|
org.eclipse.xtext/src/org/eclipse/xtext/nodemodel/util/NodeModelUtils.java
|
NodeModelUtils.getTokenText
|
public static String getTokenText(INode node) {
if (node instanceof ILeafNode)
return ((ILeafNode) node).getText();
else {
StringBuilder builder = new StringBuilder(Math.max(node.getTotalLength(), 1));
boolean hiddenSeen = false;
for (ILeafNode leaf : node.getLeafNodes()) {
if (!leaf.isHidden()) {
if (hiddenSeen && builder.length() > 0)
builder.append(' ');
builder.append(leaf.getText());
hiddenSeen = false;
} else {
hiddenSeen = true;
}
}
return builder.toString();
}
}
|
java
|
public static String getTokenText(INode node) {
if (node instanceof ILeafNode)
return ((ILeafNode) node).getText();
else {
StringBuilder builder = new StringBuilder(Math.max(node.getTotalLength(), 1));
boolean hiddenSeen = false;
for (ILeafNode leaf : node.getLeafNodes()) {
if (!leaf.isHidden()) {
if (hiddenSeen && builder.length() > 0)
builder.append(' ');
builder.append(leaf.getText());
hiddenSeen = false;
} else {
hiddenSeen = true;
}
}
return builder.toString();
}
}
|
[
"public",
"static",
"String",
"getTokenText",
"(",
"INode",
"node",
")",
"{",
"if",
"(",
"node",
"instanceof",
"ILeafNode",
")",
"return",
"(",
"(",
"ILeafNode",
")",
"node",
")",
".",
"getText",
"(",
")",
";",
"else",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"Math",
".",
"max",
"(",
"node",
".",
"getTotalLength",
"(",
")",
",",
"1",
")",
")",
";",
"boolean",
"hiddenSeen",
"=",
"false",
";",
"for",
"(",
"ILeafNode",
"leaf",
":",
"node",
".",
"getLeafNodes",
"(",
")",
")",
"{",
"if",
"(",
"!",
"leaf",
".",
"isHidden",
"(",
")",
")",
"{",
"if",
"(",
"hiddenSeen",
"&&",
"builder",
".",
"length",
"(",
")",
">",
"0",
")",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"builder",
".",
"append",
"(",
"leaf",
".",
"getText",
"(",
")",
")",
";",
"hiddenSeen",
"=",
"false",
";",
"}",
"else",
"{",
"hiddenSeen",
"=",
"true",
";",
"}",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}",
"}"
] |
This method converts a node to text.
Leading and trailing text from hidden tokens (whitespace/comments) is removed. Text from hidden tokens that is
surrounded by text from non-hidden tokens is summarized to a single whitespace.
The preferred use case of this method is to convert the {@link ICompositeNode} that has been created for a data
type rule to text.
This is also the recommended way to convert a node to text if you want to invoke
{@link org.eclipse.xtext.conversion.IValueConverterService#toValue(String, String, INode)}
|
[
"This",
"method",
"converts",
"a",
"node",
"to",
"text",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/nodemodel/util/NodeModelUtils.java#L411-L429
|
161,999 |
eclipse/xtext-core
|
org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/semanticHighlight/SemanticHighlightingRegistry.java
|
SemanticHighlightingRegistry.getAllScopes
|
public List<List<String>> getAllScopes() {
this.checkInitialized();
final ImmutableList.Builder<List<String>> builder = ImmutableList.<List<String>>builder();
final Consumer<Integer> _function = (Integer it) -> {
List<String> _get = this.scopes.get(it);
StringConcatenation _builder = new StringConcatenation();
_builder.append("No scopes are available for index: ");
_builder.append(it);
builder.add(Preconditions.<List<String>>checkNotNull(_get, _builder));
};
this.scopes.keySet().forEach(_function);
return builder.build();
}
|
java
|
public List<List<String>> getAllScopes() {
this.checkInitialized();
final ImmutableList.Builder<List<String>> builder = ImmutableList.<List<String>>builder();
final Consumer<Integer> _function = (Integer it) -> {
List<String> _get = this.scopes.get(it);
StringConcatenation _builder = new StringConcatenation();
_builder.append("No scopes are available for index: ");
_builder.append(it);
builder.add(Preconditions.<List<String>>checkNotNull(_get, _builder));
};
this.scopes.keySet().forEach(_function);
return builder.build();
}
|
[
"public",
"List",
"<",
"List",
"<",
"String",
">",
">",
"getAllScopes",
"(",
")",
"{",
"this",
".",
"checkInitialized",
"(",
")",
";",
"final",
"ImmutableList",
".",
"Builder",
"<",
"List",
"<",
"String",
">",
">",
"builder",
"=",
"ImmutableList",
".",
"<",
"List",
"<",
"String",
">",
">",
"builder",
"(",
")",
";",
"final",
"Consumer",
"<",
"Integer",
">",
"_function",
"=",
"(",
"Integer",
"it",
")",
"->",
"{",
"List",
"<",
"String",
">",
"_get",
"=",
"this",
".",
"scopes",
".",
"get",
"(",
"it",
")",
";",
"StringConcatenation",
"_builder",
"=",
"new",
"StringConcatenation",
"(",
")",
";",
"_builder",
".",
"append",
"(",
"\"No scopes are available for index: \"",
")",
";",
"_builder",
".",
"append",
"(",
"it",
")",
";",
"builder",
".",
"add",
"(",
"Preconditions",
".",
"<",
"List",
"<",
"String",
">",
">",
"checkNotNull",
"(",
"_get",
",",
"_builder",
")",
")",
";",
"}",
";",
"this",
".",
"scopes",
".",
"keySet",
"(",
")",
".",
"forEach",
"(",
"_function",
")",
";",
"return",
"builder",
".",
"build",
"(",
")",
";",
"}"
] |
Returns with a view of all scopes known by this manager.
|
[
"Returns",
"with",
"a",
"view",
"of",
"all",
"scopes",
"known",
"by",
"this",
"manager",
"."
] |
bac941cb75cb24706519845ec174cfef874d7557
|
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/semanticHighlight/SemanticHighlightingRegistry.java#L223-L235
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.