repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/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", ")", ";",...
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
train
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", ",", "pos...
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
train
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", ";", ...
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
train
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", ")", ")",...
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
train
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
train
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", ...
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
train
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", ".", "g...
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
train
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", ".", "getWindowMa...
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...
05034d465a7b0a494fabb9e9f2971ac19392f32d
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRApplication.java#L297-L313
train
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", "!=", "mRenderableV...
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
train
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", "(", "...
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
train
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", ...
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
train
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", ",",...
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
train
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", ...
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
train
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", ...
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
train
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", "(", "Malformed...
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
train
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", ".", "...
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
train
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", ...
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
train
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", ...
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
train
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", "=", "(", "ContentAss...
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
train
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"...
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", ...
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
train
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", "ContentAssistEntr...
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
train
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", "(", ")",...
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
train
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", ")", ")", ")", "{", ...
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
train
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"...
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
train
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", ",", "...
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
train
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", "(",...
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
train
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", ".", "getGu...
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
train
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
train
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
train
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", ")",...
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
train
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", "=", "getCurrent...
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
train
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", ...
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
train
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", "(", "!", "transf...
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
train
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", "(",...
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
train
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...
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
train
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", ".", ...
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
train
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", "(",...
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
train
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", "(", ")...
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", "...
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/resource/impl/ResourceDescriptionsData.java#L241-L248
train
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...
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
train
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", ")", "{", ...
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
train
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", "<", "?", ">", "[", "]", "param...
returns &gt; 0 when o1 is more specific than o2, returns == 0 when o1 and o2 are equal or unrelated, returns &lt; 0 when o2 is more specific than o1,
[ "returns", "&gt", ";", "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
train
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", ")"...
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
train
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", "."...
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
train
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...
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
train
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", "(...
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
train
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", ".", "d...
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
train
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", ",", "\"\"", ",", "...
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
train
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", "=...
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
train
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", ".", ...
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
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.addRequiredBundles
public void addRequiredBundles(Set<String> requiredBundles) { addRequiredBundles(requiredBundles.toArray(new String[requiredBundles.size()])); }
java
public void addRequiredBundles(Set<String> requiredBundles) { addRequiredBundles(requiredBundles.toArray(new String[requiredBundles.size()])); }
[ "public", "void", "addRequiredBundles", "(", "Set", "<", "String", ">", "requiredBundles", ")", "{", "addRequiredBundles", "(", "requiredBundles", ".", "toArray", "(", "new", "String", "[", "requiredBundles", ".", "size", "(", ")", "]", ")", ")", ";", "}" ]
Add the set with given bundles to the "Require-Bundle" main attribute. @param requiredBundles The set with all bundles to add.
[ "Add", "the", "set", "with", "given", "bundles", "to", "the", "Require", "-", "Bundle", "main", "attribute", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L265-L267
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.addRequiredBundles
public void addRequiredBundles(String... requiredBundles) { String oldBundles = mainAttributes.get(REQUIRE_BUNDLE); if (oldBundles == null) oldBundles = ""; BundleList oldResultList = BundleList.fromInput(oldBundles, newline); BundleList resultList = BundleList.fromInput(oldBundles, newline); for (String bundle : requiredBundles) { Bundle newBundle = Bundle.fromInput(bundle); if (name != null && name.equals(newBundle.getName())) continue; resultList.mergeInto(newBundle); } String result = resultList.toString(); boolean changed = !oldResultList.toString().equals(result); modified |= changed; if (changed) mainAttributes.put(REQUIRE_BUNDLE, result); }
java
public void addRequiredBundles(String... requiredBundles) { String oldBundles = mainAttributes.get(REQUIRE_BUNDLE); if (oldBundles == null) oldBundles = ""; BundleList oldResultList = BundleList.fromInput(oldBundles, newline); BundleList resultList = BundleList.fromInput(oldBundles, newline); for (String bundle : requiredBundles) { Bundle newBundle = Bundle.fromInput(bundle); if (name != null && name.equals(newBundle.getName())) continue; resultList.mergeInto(newBundle); } String result = resultList.toString(); boolean changed = !oldResultList.toString().equals(result); modified |= changed; if (changed) mainAttributes.put(REQUIRE_BUNDLE, result); }
[ "public", "void", "addRequiredBundles", "(", "String", "...", "requiredBundles", ")", "{", "String", "oldBundles", "=", "mainAttributes", ".", "get", "(", "REQUIRE_BUNDLE", ")", ";", "if", "(", "oldBundles", "==", "null", ")", "oldBundles", "=", "\"\"", ";", ...
Add the list with given bundles to the "Require-Bundle" main attribute. @param requiredBundles The list of all bundles to add.
[ "Add", "the", "list", "with", "given", "bundles", "to", "the", "Require", "-", "Bundle", "main", "attribute", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L274-L291
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.addImportedPackages
public void addImportedPackages(Set<String> importedPackages) { addImportedPackages(importedPackages.toArray(new String[importedPackages.size()])); }
java
public void addImportedPackages(Set<String> importedPackages) { addImportedPackages(importedPackages.toArray(new String[importedPackages.size()])); }
[ "public", "void", "addImportedPackages", "(", "Set", "<", "String", ">", "importedPackages", ")", "{", "addImportedPackages", "(", "importedPackages", ".", "toArray", "(", "new", "String", "[", "importedPackages", ".", "size", "(", ")", "]", ")", ")", ";", "...
Add the set with given bundles to the "Import-Package" main attribute. @param importedPackages The set of all packages to add.
[ "Add", "the", "set", "with", "given", "bundles", "to", "the", "Import", "-", "Package", "main", "attribute", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L298-L300
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.addImportedPackages
public void addImportedPackages(String... importedPackages) { String oldBundles = mainAttributes.get(IMPORT_PACKAGE); if (oldBundles == null) oldBundles = ""; BundleList oldResultList = BundleList.fromInput(oldBundles, newline); BundleList resultList = BundleList.fromInput(oldBundles, newline); for (String bundle : importedPackages) resultList.mergeInto(Bundle.fromInput(bundle)); String result = resultList.toString(); boolean changed = !oldResultList.toString().equals(result); modified |= changed; if (changed) mainAttributes.put(IMPORT_PACKAGE, result); }
java
public void addImportedPackages(String... importedPackages) { String oldBundles = mainAttributes.get(IMPORT_PACKAGE); if (oldBundles == null) oldBundles = ""; BundleList oldResultList = BundleList.fromInput(oldBundles, newline); BundleList resultList = BundleList.fromInput(oldBundles, newline); for (String bundle : importedPackages) resultList.mergeInto(Bundle.fromInput(bundle)); String result = resultList.toString(); boolean changed = !oldResultList.toString().equals(result); modified |= changed; if (changed) mainAttributes.put(IMPORT_PACKAGE, result); }
[ "public", "void", "addImportedPackages", "(", "String", "...", "importedPackages", ")", "{", "String", "oldBundles", "=", "mainAttributes", ".", "get", "(", "IMPORT_PACKAGE", ")", ";", "if", "(", "oldBundles", "==", "null", ")", "oldBundles", "=", "\"\"", ";",...
Add the list with given bundles to the "Import-Package" main attribute. @param importedPackages The list of all packages to add.
[ "Add", "the", "list", "with", "given", "bundles", "to", "the", "Import", "-", "Package", "main", "attribute", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L307-L320
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.addExportedPackages
public void addExportedPackages(Set<String> exportedPackages) { addExportedPackages(exportedPackages.toArray(new String[exportedPackages.size()])); }
java
public void addExportedPackages(Set<String> exportedPackages) { addExportedPackages(exportedPackages.toArray(new String[exportedPackages.size()])); }
[ "public", "void", "addExportedPackages", "(", "Set", "<", "String", ">", "exportedPackages", ")", "{", "addExportedPackages", "(", "exportedPackages", ".", "toArray", "(", "new", "String", "[", "exportedPackages", ".", "size", "(", ")", "]", ")", ")", ";", "...
Add the set with given bundles to the "Export-Package" main attribute. @param exportedPackages The set of all packages to add.
[ "Add", "the", "set", "with", "given", "bundles", "to", "the", "Export", "-", "Package", "main", "attribute", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L327-L329
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.addExportedPackages
public void addExportedPackages(String... exportedPackages) { String oldBundles = mainAttributes.get(EXPORT_PACKAGE); if (oldBundles == null) oldBundles = ""; BundleList oldResultList = BundleList.fromInput(oldBundles, newline); BundleList resultList = BundleList.fromInput(oldBundles, newline); for (String bundle : exportedPackages) resultList.mergeInto(Bundle.fromInput(bundle)); String result = resultList.toString(); boolean changed = !oldResultList.toString().equals(result); modified |= changed; if (changed) mainAttributes.put(EXPORT_PACKAGE, result); }
java
public void addExportedPackages(String... exportedPackages) { String oldBundles = mainAttributes.get(EXPORT_PACKAGE); if (oldBundles == null) oldBundles = ""; BundleList oldResultList = BundleList.fromInput(oldBundles, newline); BundleList resultList = BundleList.fromInput(oldBundles, newline); for (String bundle : exportedPackages) resultList.mergeInto(Bundle.fromInput(bundle)); String result = resultList.toString(); boolean changed = !oldResultList.toString().equals(result); modified |= changed; if (changed) mainAttributes.put(EXPORT_PACKAGE, result); }
[ "public", "void", "addExportedPackages", "(", "String", "...", "exportedPackages", ")", "{", "String", "oldBundles", "=", "mainAttributes", ".", "get", "(", "EXPORT_PACKAGE", ")", ";", "if", "(", "oldBundles", "==", "null", ")", "oldBundles", "=", "\"\"", ";",...
Add the list with given bundles to the "Export-Package" main attribute. @param exportedPackages The list of all packages to add.
[ "Add", "the", "list", "with", "given", "bundles", "to", "the", "Export", "-", "Package", "main", "attribute", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L336-L349
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.setBREE
public void setBREE(String bree) { String old = mainAttributes.get(BUNDLE_REQUIREDEXECUTIONENVIRONMENT); if (!bree.equals(old)) { this.mainAttributes.put(BUNDLE_REQUIREDEXECUTIONENVIRONMENT, bree); this.modified = true; this.bree = bree; } }
java
public void setBREE(String bree) { String old = mainAttributes.get(BUNDLE_REQUIREDEXECUTIONENVIRONMENT); if (!bree.equals(old)) { this.mainAttributes.put(BUNDLE_REQUIREDEXECUTIONENVIRONMENT, bree); this.modified = true; this.bree = bree; } }
[ "public", "void", "setBREE", "(", "String", "bree", ")", "{", "String", "old", "=", "mainAttributes", ".", "get", "(", "BUNDLE_REQUIREDEXECUTIONENVIRONMENT", ")", ";", "if", "(", "!", "bree", ".", "equals", "(", "old", ")", ")", "{", "this", ".", "mainAt...
Set the main attribute "Bundle-RequiredExecutionEnvironment" to the given value. @param bree The new value
[ "Set", "the", "main", "attribute", "Bundle", "-", "RequiredExecutionEnvironment", "to", "the", "given", "value", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L357-L364
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.setBundleActivator
public void setBundleActivator(String bundleActivator) { String old = mainAttributes.get(BUNDLE_ACTIVATOR); if (!bundleActivator.equals(old)) { this.mainAttributes.put(BUNDLE_ACTIVATOR, bundleActivator); this.modified = true; this.bundleActivator = bundleActivator; } }
java
public void setBundleActivator(String bundleActivator) { String old = mainAttributes.get(BUNDLE_ACTIVATOR); if (!bundleActivator.equals(old)) { this.mainAttributes.put(BUNDLE_ACTIVATOR, bundleActivator); this.modified = true; this.bundleActivator = bundleActivator; } }
[ "public", "void", "setBundleActivator", "(", "String", "bundleActivator", ")", "{", "String", "old", "=", "mainAttributes", ".", "get", "(", "BUNDLE_ACTIVATOR", ")", ";", "if", "(", "!", "bundleActivator", ".", "equals", "(", "old", ")", ")", "{", "this", ...
Set the main attribute "Bundle-Activator" to the given value. @param bundleActivator The new value
[ "Set", "the", "main", "attribute", "Bundle", "-", "Activator", "to", "the", "given", "value", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L379-L386
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.make512Safe
public static String make512Safe(StringBuffer input, String newline) { StringBuilder result = new StringBuilder(); String content = input.toString(); String rest = content; while (!rest.isEmpty()) { if (rest.contains("\n")) { String line = rest.substring(0, rest.indexOf("\n")); rest = rest.substring(rest.indexOf("\n") + 1); if (line.length() > 1 && line.charAt(line.length() - 1) == '\r') line = line.substring(0, line.length() - 1); append512Safe(line, result, newline); } else { append512Safe(rest, result, newline); break; } } return result.toString(); }
java
public static String make512Safe(StringBuffer input, String newline) { StringBuilder result = new StringBuilder(); String content = input.toString(); String rest = content; while (!rest.isEmpty()) { if (rest.contains("\n")) { String line = rest.substring(0, rest.indexOf("\n")); rest = rest.substring(rest.indexOf("\n") + 1); if (line.length() > 1 && line.charAt(line.length() - 1) == '\r') line = line.substring(0, line.length() - 1); append512Safe(line, result, newline); } else { append512Safe(rest, result, newline); break; } } return result.toString(); }
[ "public", "static", "String", "make512Safe", "(", "StringBuffer", "input", ",", "String", "newline", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "String", "content", "=", "input", ".", "toString", "(", ")", ";", "String",...
Return a string that ensures that no line is longer then 512 characters and lines are broken according to manifest specification. @param input The buffer containing the content that should be made safe @param newline The string to use to create newlines (usually "\n" or "\r\n") @return The string with no longer lines then 512, ready to be read again by {@link MergeableManifest2}.
[ "Return", "a", "string", "that", "ensures", "that", "no", "line", "is", "longer", "then", "512", "characters", "and", "lines", "are", "broken", "according", "to", "manifest", "specification", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L505-L522
train
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/formatting2/AbstractFormatter2.java
AbstractFormatter2._format
protected void _format(EObject obj, IFormattableDocument document) { for (EObject child : obj.eContents()) document.format(child); }
java
protected void _format(EObject obj, IFormattableDocument document) { for (EObject child : obj.eContents()) document.format(child); }
[ "protected", "void", "_format", "(", "EObject", "obj", ",", "IFormattableDocument", "document", ")", "{", "for", "(", "EObject", "child", ":", "obj", ".", "eContents", "(", ")", ")", "document", ".", "format", "(", "child", ")", ";", "}" ]
Fall-back for types that are not handled by a subclasse's dispatch method.
[ "Fall", "-", "back", "for", "types", "that", "are", "not", "handled", "by", "a", "subclasse", "s", "dispatch", "method", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/formatting2/AbstractFormatter2.java#L189-L192
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/concurrent/AbstractReadWriteAcces.java
AbstractReadWriteAcces.process
public <Result> Result process(IUnitOfWork<Result, State> work) { releaseReadLock(); acquireWriteLock(); try { if (log.isTraceEnabled()) log.trace("process - " + Thread.currentThread().getName()); return modify(work); } finally { if (log.isTraceEnabled()) log.trace("Downgrading from write lock to read lock..."); acquireReadLock(); releaseWriteLock(); } }
java
public <Result> Result process(IUnitOfWork<Result, State> work) { releaseReadLock(); acquireWriteLock(); try { if (log.isTraceEnabled()) log.trace("process - " + Thread.currentThread().getName()); return modify(work); } finally { if (log.isTraceEnabled()) log.trace("Downgrading from write lock to read lock..."); acquireReadLock(); releaseWriteLock(); } }
[ "public", "<", "Result", ">", "Result", "process", "(", "IUnitOfWork", "<", "Result", ",", "State", ">", "work", ")", "{", "releaseReadLock", "(", ")", ";", "acquireWriteLock", "(", ")", ";", "try", "{", "if", "(", "log", ".", "isTraceEnabled", "(", ")...
Upgrades a read transaction to a write transaction, executes the work then downgrades to a read transaction again. @since 2.4 @noreference
[ "Upgrades", "a", "read", "transaction", "to", "a", "write", "transaction", "executes", "the", "work", "then", "downgrades", "to", "a", "read", "transaction", "again", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/concurrent/AbstractReadWriteAcces.java#L107-L120
train
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractInternalAntlrParser.java
AbstractInternalAntlrParser.forceCreateModelElementAndSet
protected EObject forceCreateModelElementAndSet(Action action, EObject value) { EObject result = semanticModelBuilder.create(action.getType().getClassifier()); semanticModelBuilder.set(result, action.getFeature(), value, null /* ParserRule */, currentNode); insertCompositeNode(action); associateNodeWithAstElement(currentNode, result); return result; }
java
protected EObject forceCreateModelElementAndSet(Action action, EObject value) { EObject result = semanticModelBuilder.create(action.getType().getClassifier()); semanticModelBuilder.set(result, action.getFeature(), value, null /* ParserRule */, currentNode); insertCompositeNode(action); associateNodeWithAstElement(currentNode, result); return result; }
[ "protected", "EObject", "forceCreateModelElementAndSet", "(", "Action", "action", ",", "EObject", "value", ")", "{", "EObject", "result", "=", "semanticModelBuilder", ".", "create", "(", "action", ".", "getType", "(", ")", ".", "getClassifier", "(", ")", ")", ...
Assigned action code
[ "Assigned", "action", "code" ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractInternalAntlrParser.java#L672-L678
train
eclipse/xtext-core
org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/splitting/AntlrCodeQualityHelper.java
AntlrCodeQualityHelper.stripUnnecessaryComments
public String stripUnnecessaryComments(String javaContent, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return javaContent; } javaContent = stripMachineDependentPaths(javaContent); if (options.isStripAllComments()) { javaContent = stripAllComments(javaContent); } return javaContent; }
java
public String stripUnnecessaryComments(String javaContent, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return javaContent; } javaContent = stripMachineDependentPaths(javaContent); if (options.isStripAllComments()) { javaContent = stripAllComments(javaContent); } return javaContent; }
[ "public", "String", "stripUnnecessaryComments", "(", "String", "javaContent", ",", "AntlrOptions", "options", ")", "{", "if", "(", "!", "options", ".", "isOptimizeCodeQuality", "(", ")", ")", "{", "return", "javaContent", ";", "}", "javaContent", "=", "stripMach...
Remove all unnecessary comments from a lexer or parser file
[ "Remove", "all", "unnecessary", "comments", "from", "a", "lexer", "or", "parser", "file" ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/splitting/AntlrCodeQualityHelper.java#L40-L49
train
eclipse/xtext-core
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/ContentAssistContextFactory.java
ContentAssistContextFactory.getPrefix
public String getPrefix(INode prefixNode) { if (prefixNode instanceof ILeafNode) { if (((ILeafNode) prefixNode).isHidden() && prefixNode.getGrammarElement() != null) return ""; return getNodeTextUpToCompletionOffset(prefixNode); } StringBuilder result = new StringBuilder(prefixNode.getTotalLength()); doComputePrefix((ICompositeNode) prefixNode, result); return result.toString(); }
java
public String getPrefix(INode prefixNode) { if (prefixNode instanceof ILeafNode) { if (((ILeafNode) prefixNode).isHidden() && prefixNode.getGrammarElement() != null) return ""; return getNodeTextUpToCompletionOffset(prefixNode); } StringBuilder result = new StringBuilder(prefixNode.getTotalLength()); doComputePrefix((ICompositeNode) prefixNode, result); return result.toString(); }
[ "public", "String", "getPrefix", "(", "INode", "prefixNode", ")", "{", "if", "(", "prefixNode", "instanceof", "ILeafNode", ")", "{", "if", "(", "(", "(", "ILeafNode", ")", "prefixNode", ")", ".", "isHidden", "(", ")", "&&", "prefixNode", ".", "getGrammarEl...
replace region length
[ "replace", "region", "length" ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/antlr/ContentAssistContextFactory.java#L408-L417
train
eclipse/xtext-core
org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/UriExtensions.java
UriExtensions.toUriString
public String toUriString(final java.net.URI uri) { return this.toUriString(URI.createURI(uri.normalize().toString())); }
java
public String toUriString(final java.net.URI uri) { return this.toUriString(URI.createURI(uri.normalize().toString())); }
[ "public", "String", "toUriString", "(", "final", "java", ".", "net", ".", "URI", "uri", ")", "{", "return", "this", ".", "toUriString", "(", "URI", ".", "createURI", "(", "uri", ".", "normalize", "(", ")", ".", "toString", "(", ")", ")", ")", ";", ...
converts a java.net.URI into a string representation with empty authority, if absent and has file scheme.
[ "converts", "a", "java", ".", "net", ".", "URI", "into", "a", "string", "representation", "with", "empty", "authority", "if", "absent", "and", "has", "file", "scheme", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/UriExtensions.java#L32-L34
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/SimpleCache.java
SimpleCache.hasCachedValue
public boolean hasCachedValue(Key key) { try { readLock.lock(); return content.containsKey(key); } finally { readLock.unlock(); } }
java
public boolean hasCachedValue(Key key) { try { readLock.lock(); return content.containsKey(key); } finally { readLock.unlock(); } }
[ "public", "boolean", "hasCachedValue", "(", "Key", "key", ")", "{", "try", "{", "readLock", ".", "lock", "(", ")", ";", "return", "content", ".", "containsKey", "(", "key", ")", ";", "}", "finally", "{", "readLock", ".", "unlock", "(", ")", ";", "}",...
for testing purpose
[ "for", "testing", "purpose" ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/SimpleCache.java#L109-L116
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageLoadable.java
ResourceStorageLoadable.loadEntries
protected void loadEntries(final StorageAwareResource resource, final ZipInputStream zipIn) throws IOException { zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream = new BufferedInputStream(zipIn); this.readContents(resource, _bufferedInputStream); zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream_1 = new BufferedInputStream(zipIn); this.readResourceDescription(resource, _bufferedInputStream_1); if (this.storeNodeModel) { zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream_2 = new BufferedInputStream(zipIn); this.readNodeModel(resource, _bufferedInputStream_2); } }
java
protected void loadEntries(final StorageAwareResource resource, final ZipInputStream zipIn) throws IOException { zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream = new BufferedInputStream(zipIn); this.readContents(resource, _bufferedInputStream); zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream_1 = new BufferedInputStream(zipIn); this.readResourceDescription(resource, _bufferedInputStream_1); if (this.storeNodeModel) { zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream_2 = new BufferedInputStream(zipIn); this.readNodeModel(resource, _bufferedInputStream_2); } }
[ "protected", "void", "loadEntries", "(", "final", "StorageAwareResource", "resource", ",", "final", "ZipInputStream", "zipIn", ")", "throws", "IOException", "{", "zipIn", ".", "getNextEntry", "(", ")", ";", "BufferedInputStream", "_bufferedInputStream", "=", "new", ...
Load entries from the storage. Overriding methods should first delegate to super before adding their own entries.
[ "Load", "entries", "from", "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/ResourceStorageLoadable.java#L64-L76
train
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/generator/trace/AbstractTraceRegion.java
AbstractTraceRegion.leafIterator
public final Iterator<AbstractTraceRegion> leafIterator() { if (nestedRegions == null) return Collections.<AbstractTraceRegion> singleton(this).iterator(); return new LeafIterator(this); }
java
public final Iterator<AbstractTraceRegion> leafIterator() { if (nestedRegions == null) return Collections.<AbstractTraceRegion> singleton(this).iterator(); return new LeafIterator(this); }
[ "public", "final", "Iterator", "<", "AbstractTraceRegion", ">", "leafIterator", "(", ")", "{", "if", "(", "nestedRegions", "==", "null", ")", "return", "Collections", ".", "<", "AbstractTraceRegion", ">", "singleton", "(", "this", ")", ".", "iterator", "(", ...
Returns an iterator that will only offer leaf trace regions. If the nested regions have gaps, these will be filled with parent data. If this region is a leaf, a singleton iterator will be returned. @return an unmodifiable iterator for all leafs. Never <code>null</code>.
[ "Returns", "an", "iterator", "that", "will", "only", "offer", "leaf", "trace", "regions", ".", "If", "the", "nested", "regions", "have", "gaps", "these", "will", "be", "filled", "with", "parent", "data", ".", "If", "this", "region", "is", "a", "leaf", "a...
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/generator/trace/AbstractTraceRegion.java#L305-L309
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/TracingSugar.java
TracingSugar.generateTracedFile
public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final EObject rootTrace, final StringConcatenationClient code) { final CompositeGeneratorNode node = this.trace(rootTrace, code); this.generateTracedFile(fsa, path, node); }
java
public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final EObject rootTrace, final StringConcatenationClient code) { final CompositeGeneratorNode node = this.trace(rootTrace, code); this.generateTracedFile(fsa, path, node); }
[ "public", "void", "generateTracedFile", "(", "final", "IFileSystemAccess2", "fsa", ",", "final", "String", "path", ",", "final", "EObject", "rootTrace", ",", "final", "StringConcatenationClient", "code", ")", "{", "final", "CompositeGeneratorNode", "node", "=", "thi...
Convenience extension, to generate traced code.
[ "Convenience", "extension", "to", "generate", "traced", "code", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/TracingSugar.java#L43-L46
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/TracingSugar.java
TracingSugar.generateTracedFile
public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final CompositeGeneratorNode rootNode) { final GeneratorNodeProcessor.Result result = this.processor.process(rootNode); fsa.generateFile(path, result); }
java
public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final CompositeGeneratorNode rootNode) { final GeneratorNodeProcessor.Result result = this.processor.process(rootNode); fsa.generateFile(path, result); }
[ "public", "void", "generateTracedFile", "(", "final", "IFileSystemAccess2", "fsa", ",", "final", "String", "path", ",", "final", "CompositeGeneratorNode", "rootNode", ")", "{", "final", "GeneratorNodeProcessor", ".", "Result", "result", "=", "this", ".", "processor"...
Use to generate a file based on generator node.
[ "Use", "to", "generate", "a", "file", "based", "on", "generator", "node", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/TracingSugar.java#L51-L54
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/service/OperationCanceledManager.java
OperationCanceledManager.propagateAsErrorIfCancelException
public void propagateAsErrorIfCancelException(final Throwable t) { if ((t instanceof OperationCanceledError)) { throw ((OperationCanceledError)t); } final RuntimeException opCanceledException = this.getPlatformOperationCanceledException(t); if ((opCanceledException != null)) { throw new OperationCanceledError(opCanceledException); } }
java
public void propagateAsErrorIfCancelException(final Throwable t) { if ((t instanceof OperationCanceledError)) { throw ((OperationCanceledError)t); } final RuntimeException opCanceledException = this.getPlatformOperationCanceledException(t); if ((opCanceledException != null)) { throw new OperationCanceledError(opCanceledException); } }
[ "public", "void", "propagateAsErrorIfCancelException", "(", "final", "Throwable", "t", ")", "{", "if", "(", "(", "t", "instanceof", "OperationCanceledError", ")", ")", "{", "throw", "(", "(", "OperationCanceledError", ")", "t", ")", ";", "}", "final", "Runtime...
Rethrows OperationCanceledErrors and wraps platform specific OperationCanceledExceptions. Does nothing for any other type of Throwable.
[ "Rethrows", "OperationCanceledErrors", "and", "wraps", "platform", "specific", "OperationCanceledExceptions", ".", "Does", "nothing", "for", "any", "other", "type", "of", "Throwable", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/service/OperationCanceledManager.java#L61-L69
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/service/OperationCanceledManager.java
OperationCanceledManager.propagateIfCancelException
public void propagateIfCancelException(final Throwable t) { final RuntimeException cancelException = this.getPlatformOperationCanceledException(t); if ((cancelException != null)) { throw cancelException; } }
java
public void propagateIfCancelException(final Throwable t) { final RuntimeException cancelException = this.getPlatformOperationCanceledException(t); if ((cancelException != null)) { throw cancelException; } }
[ "public", "void", "propagateIfCancelException", "(", "final", "Throwable", "t", ")", "{", "final", "RuntimeException", "cancelException", "=", "this", ".", "getPlatformOperationCanceledException", "(", "t", ")", ";", "if", "(", "(", "cancelException", "!=", "null", ...
Rethrows platform specific OperationCanceledExceptions and unwraps OperationCanceledErrors. Does nothing for any other type of Throwable.
[ "Rethrows", "platform", "specific", "OperationCanceledExceptions", "and", "unwraps", "OperationCanceledErrors", ".", "Does", "nothing", "for", "any", "other", "type", "of", "Throwable", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/service/OperationCanceledManager.java#L74-L79
train
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/LazyURIEncoder.java
LazyURIEncoder.decode
public Triple<EObject, EReference, INode> decode(Resource res, String uriFragment) { if (isUseIndexFragment(res)) { return getLazyProxyInformation(res, uriFragment); } List<String> split = Strings.split(uriFragment, SEP); EObject source = resolveShortFragment(res, split.get(1)); EReference ref = fromShortExternalForm(source.eClass(), split.get(2)); INode compositeNode = NodeModelUtils.getNode(source); if (compositeNode==null) throw new IllegalStateException("Couldn't resolve lazy link, because no node model is attached."); INode textNode = getNode(compositeNode, split.get(3)); return Tuples.create(source, ref, textNode); }
java
public Triple<EObject, EReference, INode> decode(Resource res, String uriFragment) { if (isUseIndexFragment(res)) { return getLazyProxyInformation(res, uriFragment); } List<String> split = Strings.split(uriFragment, SEP); EObject source = resolveShortFragment(res, split.get(1)); EReference ref = fromShortExternalForm(source.eClass(), split.get(2)); INode compositeNode = NodeModelUtils.getNode(source); if (compositeNode==null) throw new IllegalStateException("Couldn't resolve lazy link, because no node model is attached."); INode textNode = getNode(compositeNode, split.get(3)); return Tuples.create(source, ref, textNode); }
[ "public", "Triple", "<", "EObject", ",", "EReference", ",", "INode", ">", "decode", "(", "Resource", "res", ",", "String", "uriFragment", ")", "{", "if", "(", "isUseIndexFragment", "(", "res", ")", ")", "{", "return", "getLazyProxyInformation", "(", "res", ...
decodes the uriFragment @param res the resource that contains the feature holder @param uriFragment the fragment that should be decoded @return the decoded information @see LazyURIEncoder#encode(EObject, EReference, INode)
[ "decodes", "the", "uriFragment" ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/LazyURIEncoder.java#L125-L137
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java
OnChangeEvictingCache.get
@Override public <T> T get(Object key, Resource resource, Provider<T> provider) { if(resource == null) { return provider.get(); } CacheAdapter adapter = getOrCreate(resource); T element = adapter.<T>internalGet(key); if (element==null) { element = provider.get(); cacheMiss(adapter); adapter.set(key, element); } else { cacheHit(adapter); } if (element == CacheAdapter.NULL) { return null; } return element; }
java
@Override public <T> T get(Object key, Resource resource, Provider<T> provider) { if(resource == null) { return provider.get(); } CacheAdapter adapter = getOrCreate(resource); T element = adapter.<T>internalGet(key); if (element==null) { element = provider.get(); cacheMiss(adapter); adapter.set(key, element); } else { cacheHit(adapter); } if (element == CacheAdapter.NULL) { return null; } return element; }
[ "@", "Override", "public", "<", "T", ">", "T", "get", "(", "Object", "key", ",", "Resource", "resource", ",", "Provider", "<", "T", ">", "provider", ")", "{", "if", "(", "resource", "==", "null", ")", "{", "return", "provider", ".", "get", "(", ")"...
Try to obtain the value that is cached for the given key in the given resource. If no value is cached, the provider is used to compute it and store it afterwards. @param resource the resource. If it is <code>null</code>, the provider will be used to compute the value. @param key the cache key. May not be <code>null</code>. @param provider the strategy to compute the value if necessary. May not be <code>null</code>.
[ "Try", "to", "obtain", "the", "value", "that", "is", "cached", "for", "the", "given", "key", "in", "the", "given", "resource", ".", "If", "no", "value", "is", "cached", "the", "provider", "is", "used", "to", "compute", "it", "and", "store", "it", "afte...
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java#L68-L86
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java
OnChangeEvictingCache.execWithoutCacheClear
public <Result, Param extends Resource> Result execWithoutCacheClear(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException { CacheAdapter cacheAdapter = getOrCreate(resource); try { cacheAdapter.ignoreNotifications(); return transaction.exec(resource); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new WrappedException(e); } finally { cacheAdapter.listenToNotifications(); } }
java
public <Result, Param extends Resource> Result execWithoutCacheClear(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException { CacheAdapter cacheAdapter = getOrCreate(resource); try { cacheAdapter.ignoreNotifications(); return transaction.exec(resource); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new WrappedException(e); } finally { cacheAdapter.listenToNotifications(); } }
[ "public", "<", "Result", ",", "Param", "extends", "Resource", ">", "Result", "execWithoutCacheClear", "(", "Param", "resource", ",", "IUnitOfWork", "<", "Result", ",", "Param", ">", "transaction", ")", "throws", "WrappedException", "{", "CacheAdapter", "cacheAdapt...
The transaction will be executed. While it is running, any semantic state change in the given resource will be ignored and the cache will not be cleared.
[ "The", "transaction", "will", "be", "executed", ".", "While", "it", "is", "running", "any", "semantic", "state", "change", "in", "the", "given", "resource", "will", "be", "ignored", "and", "the", "cache", "will", "not", "be", "cleared", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java#L124-L136
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java
OnChangeEvictingCache.execWithTemporaryCaching
public <Result, Param extends Resource> Result execWithTemporaryCaching(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException { CacheAdapter cacheAdapter = getOrCreate(resource); IgnoreValuesMemento memento = cacheAdapter.ignoreNewValues(); try { return transaction.exec(resource); } catch (Exception e) { throw new WrappedException(e); } finally { memento.done(); } }
java
public <Result, Param extends Resource> Result execWithTemporaryCaching(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException { CacheAdapter cacheAdapter = getOrCreate(resource); IgnoreValuesMemento memento = cacheAdapter.ignoreNewValues(); try { return transaction.exec(resource); } catch (Exception e) { throw new WrappedException(e); } finally { memento.done(); } }
[ "public", "<", "Result", ",", "Param", "extends", "Resource", ">", "Result", "execWithTemporaryCaching", "(", "Param", "resource", ",", "IUnitOfWork", "<", "Result", ",", "Param", ">", "transaction", ")", "throws", "WrappedException", "{", "CacheAdapter", "cacheAd...
The transaction will be executed with caching enabled. However, all newly cached values will be discarded as soon as the transaction is over. @since 2.1
[ "The", "transaction", "will", "be", "executed", "with", "caching", "enabled", ".", "However", "all", "newly", "cached", "values", "will", "be", "discarded", "as", "soon", "as", "the", "transaction", "is", "over", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java#L143-L153
train
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/LazyLinkingResource.java
LazyLinkingResource.resolveLazyCrossReferences
public void resolveLazyCrossReferences(final CancelIndicator mon) { final CancelIndicator monitor = mon == null ? CancelIndicator.NullImpl : mon; TreeIterator<Object> iterator = EcoreUtil.getAllContents(this, true); while (iterator.hasNext()) { operationCanceledManager.checkCanceled(monitor); InternalEObject source = (InternalEObject) iterator.next(); EStructuralFeature[] eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier) source.eClass() .getEAllStructuralFeatures()).crossReferences(); if (eStructuralFeatures != null) { for (EStructuralFeature crossRef : eStructuralFeatures) { operationCanceledManager.checkCanceled(monitor); resolveLazyCrossReference(source, crossRef); } } } }
java
public void resolveLazyCrossReferences(final CancelIndicator mon) { final CancelIndicator monitor = mon == null ? CancelIndicator.NullImpl : mon; TreeIterator<Object> iterator = EcoreUtil.getAllContents(this, true); while (iterator.hasNext()) { operationCanceledManager.checkCanceled(monitor); InternalEObject source = (InternalEObject) iterator.next(); EStructuralFeature[] eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier) source.eClass() .getEAllStructuralFeatures()).crossReferences(); if (eStructuralFeatures != null) { for (EStructuralFeature crossRef : eStructuralFeatures) { operationCanceledManager.checkCanceled(monitor); resolveLazyCrossReference(source, crossRef); } } } }
[ "public", "void", "resolveLazyCrossReferences", "(", "final", "CancelIndicator", "mon", ")", "{", "final", "CancelIndicator", "monitor", "=", "mon", "==", "null", "?", "CancelIndicator", ".", "NullImpl", ":", "mon", ";", "TreeIterator", "<", "Object", ">", "iter...
resolves any lazy cross references in this resource, adding Issues for unresolvable elements to this resource. This resource might still contain resolvable proxies after this method has been called. @param mon a {@link CancelIndicator} can be used to stop the resolution.
[ "resolves", "any", "lazy", "cross", "references", "in", "this", "resource", "adding", "Issues", "for", "unresolvable", "elements", "to", "this", "resource", ".", "This", "resource", "might", "still", "contain", "resolvable", "proxies", "after", "this", "method", ...
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/LazyLinkingResource.java#L137-L152
train
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/resource/DescriptionUtils.java
DescriptionUtils.collectOutgoingReferences
public Set<URI> collectOutgoingReferences(IResourceDescription description) { URI resourceURI = description.getURI(); Set<URI> result = null; for(IReferenceDescription reference: description.getReferenceDescriptions()) { URI targetResource = reference.getTargetEObjectUri().trimFragment(); if (!resourceURI.equals(targetResource)) { if (result == null) result = Sets.newHashSet(targetResource); else result.add(targetResource); } } if (result != null) return result; return Collections.emptySet(); }
java
public Set<URI> collectOutgoingReferences(IResourceDescription description) { URI resourceURI = description.getURI(); Set<URI> result = null; for(IReferenceDescription reference: description.getReferenceDescriptions()) { URI targetResource = reference.getTargetEObjectUri().trimFragment(); if (!resourceURI.equals(targetResource)) { if (result == null) result = Sets.newHashSet(targetResource); else result.add(targetResource); } } if (result != null) return result; return Collections.emptySet(); }
[ "public", "Set", "<", "URI", ">", "collectOutgoingReferences", "(", "IResourceDescription", "description", ")", "{", "URI", "resourceURI", "=", "description", ".", "getURI", "(", ")", ";", "Set", "<", "URI", ">", "result", "=", "null", ";", "for", "(", "IR...
Collect the URIs of resources, that are referenced by the given description. @return the list of referenced URIs. Never <code>null</code>.
[ "Collect", "the", "URIs", "of", "resources", "that", "are", "referenced", "by", "the", "given", "description", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/resource/DescriptionUtils.java#L26-L41
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/TailWriter.java
TailWriter.write
@Override public void write(final char[] cbuf, final int off, final int len) throws IOException { int offset = off; int length = len; while (suppressLineCount > 0 && length > 0) { length = -1; for (int i = 0; i < len && suppressLineCount > 0; i++) { if (cbuf[off + i] == '\n') { offset = off + i + 1; length = len - i - 1; suppressLineCount--; } } if (length <= 0) return; } delegate.write(cbuf, offset, length); }
java
@Override public void write(final char[] cbuf, final int off, final int len) throws IOException { int offset = off; int length = len; while (suppressLineCount > 0 && length > 0) { length = -1; for (int i = 0; i < len && suppressLineCount > 0; i++) { if (cbuf[off + i] == '\n') { offset = off + i + 1; length = len - i - 1; suppressLineCount--; } } if (length <= 0) return; } delegate.write(cbuf, offset, length); }
[ "@", "Override", "public", "void", "write", "(", "final", "char", "[", "]", "cbuf", ",", "final", "int", "off", ",", "final", "int", "len", ")", "throws", "IOException", "{", "int", "offset", "=", "off", ";", "int", "length", "=", "len", ";", "while"...
Filter everything until we found the first NL character.
[ "Filter", "everything", "until", "we", "found", "the", "first", "NL", "character", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/TailWriter.java#L42-L59
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinder.java
DefaultTaskFinder.setEndTag
@Inject(optional = true) protected Pattern setEndTag(@Named(AbstractMultiLineCommentProvider.END_TAG) final String endTag) { return this.endTagPattern = Pattern.compile((endTag + "\\z")); }
java
@Inject(optional = true) protected Pattern setEndTag(@Named(AbstractMultiLineCommentProvider.END_TAG) final String endTag) { return this.endTagPattern = Pattern.compile((endTag + "\\z")); }
[ "@", "Inject", "(", "optional", "=", "true", ")", "protected", "Pattern", "setEndTag", "(", "@", "Named", "(", "AbstractMultiLineCommentProvider", ".", "END_TAG", ")", "final", "String", "endTag", ")", "{", "return", "this", ".", "endTagPattern", "=", "Pattern...
this method is not intended to be called by clients @since 2.12
[ "this", "method", "is", "not", "intended", "to", "be", "called", "by", "clients" ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/tasks/DefaultTaskFinder.java#L55-L58
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java
GeneratorNodeExtensions.indent
public CompositeGeneratorNode indent(final CompositeGeneratorNode parent, final String indentString) { final IndentNode indent = new IndentNode(indentString); List<IGeneratorNode> _children = parent.getChildren(); _children.add(indent); return indent; }
java
public CompositeGeneratorNode indent(final CompositeGeneratorNode parent, final String indentString) { final IndentNode indent = new IndentNode(indentString); List<IGeneratorNode> _children = parent.getChildren(); _children.add(indent); return indent; }
[ "public", "CompositeGeneratorNode", "indent", "(", "final", "CompositeGeneratorNode", "parent", ",", "final", "String", "indentString", ")", "{", "final", "IndentNode", "indent", "=", "new", "IndentNode", "(", "indentString", ")", ";", "List", "<", "IGeneratorNode",...
Appends the indentation string at the current position of the parent and adds a new composite node, indicating the same indentation for subsequent lines. @return an indentation node, using the given indentString, appended as a child on the given parent
[ "Appends", "the", "indentation", "string", "at", "the", "current", "position", "of", "the", "parent", "and", "adds", "a", "new", "composite", "node", "indicating", "the", "same", "indentation", "for", "subsequent", "lines", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java#L84-L89
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java
GeneratorNodeExtensions.appendNewLineIfNotEmpty
public CompositeGeneratorNode appendNewLineIfNotEmpty(final CompositeGeneratorNode parent) { List<IGeneratorNode> _children = parent.getChildren(); String _lineDelimiter = this.wsConfig.getLineDelimiter(); NewLineNode _newLineNode = new NewLineNode(_lineDelimiter, true); _children.add(_newLineNode); return parent; }
java
public CompositeGeneratorNode appendNewLineIfNotEmpty(final CompositeGeneratorNode parent) { List<IGeneratorNode> _children = parent.getChildren(); String _lineDelimiter = this.wsConfig.getLineDelimiter(); NewLineNode _newLineNode = new NewLineNode(_lineDelimiter, true); _children.add(_newLineNode); return parent; }
[ "public", "CompositeGeneratorNode", "appendNewLineIfNotEmpty", "(", "final", "CompositeGeneratorNode", "parent", ")", "{", "List", "<", "IGeneratorNode", ">", "_children", "=", "parent", ".", "getChildren", "(", ")", ";", "String", "_lineDelimiter", "=", "this", "."...
Appends a line separator node that will only be effective if the current line contains non-whitespace text. @return the given parent node
[ "Appends", "a", "line", "separator", "node", "that", "will", "only", "be", "effective", "if", "the", "current", "line", "contains", "non", "-", "whitespace", "text", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java#L121-L127
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java
GeneratorNodeExtensions.appendTemplate
public CompositeGeneratorNode appendTemplate(final CompositeGeneratorNode parent, final StringConcatenationClient templateString) { final TemplateNode proc = new TemplateNode(templateString, this); List<IGeneratorNode> _children = parent.getChildren(); _children.add(proc); return parent; }
java
public CompositeGeneratorNode appendTemplate(final CompositeGeneratorNode parent, final StringConcatenationClient templateString) { final TemplateNode proc = new TemplateNode(templateString, this); List<IGeneratorNode> _children = parent.getChildren(); _children.add(proc); return parent; }
[ "public", "CompositeGeneratorNode", "appendTemplate", "(", "final", "CompositeGeneratorNode", "parent", ",", "final", "StringConcatenationClient", "templateString", ")", "{", "final", "TemplateNode", "proc", "=", "new", "TemplateNode", "(", "templateString", ",", "this", ...
Creates a template node for the given templateString and appends it to the given parent node. Templates are translated to generator node trees and expressions in templates can be of type IGeneratorNode. @return the given parent node
[ "Creates", "a", "template", "node", "for", "the", "given", "templateString", "and", "appends", "it", "to", "the", "given", "parent", "node", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java#L161-L166
train
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractIndentationTokenSource.java
AbstractIndentationTokenSource.doSplitTokenImpl
protected void doSplitTokenImpl(Token token, ITokenAcceptor result) { String text = token.getText(); int indentation = computeIndentation(text); if (indentation == -1 || indentation == currentIndentation) { // no change of indentation level detected simply process the token result.accept(token); } else if (indentation > currentIndentation) { // indentation level increased splitIntoBeginToken(token, indentation, result); } else if (indentation < currentIndentation) { // indentation level decreased int charCount = computeIndentationRelevantCharCount(text); if (charCount > 0) { // emit whitespace including newline splitWithText(token, text.substring(0, charCount), result); } // emit end tokens at the beginning of the line decreaseIndentation(indentation, result); if (charCount != text.length()) { handleRemainingText(token, text.substring(charCount), indentation, result); } } else { throw new IllegalStateException(String.valueOf(indentation)); } }
java
protected void doSplitTokenImpl(Token token, ITokenAcceptor result) { String text = token.getText(); int indentation = computeIndentation(text); if (indentation == -1 || indentation == currentIndentation) { // no change of indentation level detected simply process the token result.accept(token); } else if (indentation > currentIndentation) { // indentation level increased splitIntoBeginToken(token, indentation, result); } else if (indentation < currentIndentation) { // indentation level decreased int charCount = computeIndentationRelevantCharCount(text); if (charCount > 0) { // emit whitespace including newline splitWithText(token, text.substring(0, charCount), result); } // emit end tokens at the beginning of the line decreaseIndentation(indentation, result); if (charCount != text.length()) { handleRemainingText(token, text.substring(charCount), indentation, result); } } else { throw new IllegalStateException(String.valueOf(indentation)); } }
[ "protected", "void", "doSplitTokenImpl", "(", "Token", "token", ",", "ITokenAcceptor", "result", ")", "{", "String", "text", "=", "token", ".", "getText", "(", ")", ";", "int", "indentation", "=", "computeIndentation", "(", "text", ")", ";", "if", "(", "in...
The token was previously determined as potentially to-be-splitted thus we emit additional indentation or dedenting tokens.
[ "The", "token", "was", "previously", "determined", "as", "potentially", "to", "-", "be", "-", "splitted", "thus", "we", "emit", "additional", "indentation", "or", "dedenting", "tokens", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractIndentationTokenSource.java#L97-L121
train
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageFacade.java
ResourceStorageFacade.getOrCreateResourceStorageLoadable
@Override public ResourceStorageLoadable getOrCreateResourceStorageLoadable(final StorageAwareResource resource) { try { final ResourceStorageProviderAdapter stateProvider = IterableExtensions.<ResourceStorageProviderAdapter>head(Iterables.<ResourceStorageProviderAdapter>filter(resource.getResourceSet().eAdapters(), ResourceStorageProviderAdapter.class)); if ((stateProvider != null)) { final ResourceStorageLoadable inputStream = stateProvider.getResourceStorageLoadable(resource); if ((inputStream != null)) { return inputStream; } } InputStream _xifexpression = null; boolean _exists = resource.getResourceSet().getURIConverter().exists(this.getBinaryStorageURI(resource.getURI()), CollectionLiterals.<Object, Object>emptyMap()); if (_exists) { _xifexpression = resource.getResourceSet().getURIConverter().createInputStream(this.getBinaryStorageURI(resource.getURI())); } else { InputStream _xblockexpression = null; { final AbstractFileSystemAccess2 fsa = this.getFileSystemAccess(resource); final String outputRelativePath = this.computeOutputPath(resource); _xblockexpression = fsa.readBinaryFile(outputRelativePath); } _xifexpression = _xblockexpression; } final InputStream inputStream_1 = _xifexpression; return this.createResourceStorageLoadable(inputStream_1); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
java
@Override public ResourceStorageLoadable getOrCreateResourceStorageLoadable(final StorageAwareResource resource) { try { final ResourceStorageProviderAdapter stateProvider = IterableExtensions.<ResourceStorageProviderAdapter>head(Iterables.<ResourceStorageProviderAdapter>filter(resource.getResourceSet().eAdapters(), ResourceStorageProviderAdapter.class)); if ((stateProvider != null)) { final ResourceStorageLoadable inputStream = stateProvider.getResourceStorageLoadable(resource); if ((inputStream != null)) { return inputStream; } } InputStream _xifexpression = null; boolean _exists = resource.getResourceSet().getURIConverter().exists(this.getBinaryStorageURI(resource.getURI()), CollectionLiterals.<Object, Object>emptyMap()); if (_exists) { _xifexpression = resource.getResourceSet().getURIConverter().createInputStream(this.getBinaryStorageURI(resource.getURI())); } else { InputStream _xblockexpression = null; { final AbstractFileSystemAccess2 fsa = this.getFileSystemAccess(resource); final String outputRelativePath = this.computeOutputPath(resource); _xblockexpression = fsa.readBinaryFile(outputRelativePath); } _xifexpression = _xblockexpression; } final InputStream inputStream_1 = _xifexpression; return this.createResourceStorageLoadable(inputStream_1); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
[ "@", "Override", "public", "ResourceStorageLoadable", "getOrCreateResourceStorageLoadable", "(", "final", "StorageAwareResource", "resource", ")", "{", "try", "{", "final", "ResourceStorageProviderAdapter", "stateProvider", "=", "IterableExtensions", ".", "<", "ResourceStorag...
Finds or creates a ResourceStorageLoadable for the given resource. Clients should first call shouldLoadFromStorage to check whether there exists a storage version of the given resource. @return an IResourceStorageLoadable
[ "Finds", "or", "creates", "a", "ResourceStorageLoadable", "for", "the", "given", "resource", ".", "Clients", "should", "first", "call", "shouldLoadFromStorage", "to", "check", "whether", "there", "exists", "a", "storage", "version", "of", "the", "given", "resource...
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageFacade.java#L89-L117
train
eclipse/xtext-core
org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/CompletionPrefixProvider.java
CompletionPrefixProvider.getLastCompleteNodeByOffset
public INode getLastCompleteNodeByOffset(INode node, int offsetPosition, int completionOffset) { return internalGetLastCompleteNodeByOffset(node.getRootNode(), offsetPosition); }
java
public INode getLastCompleteNodeByOffset(INode node, int offsetPosition, int completionOffset) { return internalGetLastCompleteNodeByOffset(node.getRootNode(), offsetPosition); }
[ "public", "INode", "getLastCompleteNodeByOffset", "(", "INode", "node", ",", "int", "offsetPosition", ",", "int", "completionOffset", ")", "{", "return", "internalGetLastCompleteNodeByOffset", "(", "node", ".", "getRootNode", "(", ")", ",", "offsetPosition", ")", ";...
Returns the last node that appears to be part of the prefix. This will be used to determine the current model object that'll be the most special context instance in the proposal provider.
[ "Returns", "the", "last", "node", "that", "appears", "to", "be", "part", "of", "the", "prefix", ".", "This", "will", "be", "used", "to", "determine", "the", "current", "model", "object", "that", "ll", "be", "the", "most", "special", "context", "instance", ...
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/CompletionPrefixProvider.java#L36-L38
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest.java
MergeableManifest.addRequiredBundles
public void addRequiredBundles(Set<String> bundles) { // TODO manage transitive dependencies // don't require self Set<String> bundlesToMerge; String bundleName = (String) getMainAttributes().get(BUNDLE_SYMBOLIC_NAME); if (bundleName != null) { int idx = bundleName.indexOf(';'); if (idx >= 0) { bundleName = bundleName.substring(0, idx); } } if (bundleName != null && bundles.contains(bundleName) || projectName != null && bundles.contains(projectName)) { bundlesToMerge = new LinkedHashSet<String>(bundles); bundlesToMerge.remove(bundleName); bundlesToMerge.remove(projectName); } else { bundlesToMerge = bundles; } String s = (String) getMainAttributes().get(REQUIRE_BUNDLE); Wrapper<Boolean> modified = Wrapper.wrap(this.modified); String result = mergeIntoCommaSeparatedList(s, bundlesToMerge, modified, lineDelimiter); this.modified = modified.get(); getMainAttributes().put(REQUIRE_BUNDLE, result); }
java
public void addRequiredBundles(Set<String> bundles) { // TODO manage transitive dependencies // don't require self Set<String> bundlesToMerge; String bundleName = (String) getMainAttributes().get(BUNDLE_SYMBOLIC_NAME); if (bundleName != null) { int idx = bundleName.indexOf(';'); if (idx >= 0) { bundleName = bundleName.substring(0, idx); } } if (bundleName != null && bundles.contains(bundleName) || projectName != null && bundles.contains(projectName)) { bundlesToMerge = new LinkedHashSet<String>(bundles); bundlesToMerge.remove(bundleName); bundlesToMerge.remove(projectName); } else { bundlesToMerge = bundles; } String s = (String) getMainAttributes().get(REQUIRE_BUNDLE); Wrapper<Boolean> modified = Wrapper.wrap(this.modified); String result = mergeIntoCommaSeparatedList(s, bundlesToMerge, modified, lineDelimiter); this.modified = modified.get(); getMainAttributes().put(REQUIRE_BUNDLE, result); }
[ "public", "void", "addRequiredBundles", "(", "Set", "<", "String", ">", "bundles", ")", "{", "// TODO manage transitive dependencies", "// don't require self", "Set", "<", "String", ">", "bundlesToMerge", ";", "String", "bundleName", "=", "(", "String", ")", "getMai...
adds the qualified names to the require-bundle attribute, if not already present. @param bundles - passing parameterized bundled (e.g. versions, etc.) is not supported
[ "adds", "the", "qualified", "names", "to", "the", "require", "-", "bundle", "attribute", "if", "not", "already", "present", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest.java#L221-L245
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest.java
MergeableManifest.addExportedPackages
public void addExportedPackages(Set<String> packages) { String s = (String) getMainAttributes().get(EXPORT_PACKAGE); Wrapper<Boolean> modified = Wrapper.wrap(this.modified); String result = mergeIntoCommaSeparatedList(s, packages, modified, lineDelimiter); this.modified = modified.get(); getMainAttributes().put(EXPORT_PACKAGE, result); }
java
public void addExportedPackages(Set<String> packages) { String s = (String) getMainAttributes().get(EXPORT_PACKAGE); Wrapper<Boolean> modified = Wrapper.wrap(this.modified); String result = mergeIntoCommaSeparatedList(s, packages, modified, lineDelimiter); this.modified = modified.get(); getMainAttributes().put(EXPORT_PACKAGE, result); }
[ "public", "void", "addExportedPackages", "(", "Set", "<", "String", ">", "packages", ")", "{", "String", "s", "=", "(", "String", ")", "getMainAttributes", "(", ")", ".", "get", "(", "EXPORT_PACKAGE", ")", ";", "Wrapper", "<", "Boolean", ">", "modified", ...
adds the qualified names to the export-package attribute, if not already present. @param packages - passing parameterized packages is not supported
[ "adds", "the", "qualified", "names", "to", "the", "export", "-", "package", "attribute", "if", "not", "already", "present", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest.java#L329-L335
train
eclipse/xtext-core
org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalProvider.java
IdeContentProposalProvider.createProposals
public void createProposals(final Collection<ContentAssistContext> contexts, final IIdeContentProposalAcceptor acceptor) { Iterable<ContentAssistContext> _filteredContexts = this.getFilteredContexts(contexts); for (final ContentAssistContext context : _filteredContexts) { ImmutableList<AbstractElement> _firstSetGrammarElements = context.getFirstSetGrammarElements(); for (final AbstractElement element : _firstSetGrammarElements) { { boolean _canAcceptMoreProposals = acceptor.canAcceptMoreProposals(); boolean _not = (!_canAcceptMoreProposals); if (_not) { return; } this.createProposals(element, context, acceptor); } } } }
java
public void createProposals(final Collection<ContentAssistContext> contexts, final IIdeContentProposalAcceptor acceptor) { Iterable<ContentAssistContext> _filteredContexts = this.getFilteredContexts(contexts); for (final ContentAssistContext context : _filteredContexts) { ImmutableList<AbstractElement> _firstSetGrammarElements = context.getFirstSetGrammarElements(); for (final AbstractElement element : _firstSetGrammarElements) { { boolean _canAcceptMoreProposals = acceptor.canAcceptMoreProposals(); boolean _not = (!_canAcceptMoreProposals); if (_not) { return; } this.createProposals(element, context, acceptor); } } } }
[ "public", "void", "createProposals", "(", "final", "Collection", "<", "ContentAssistContext", ">", "contexts", ",", "final", "IIdeContentProposalAcceptor", "acceptor", ")", "{", "Iterable", "<", "ContentAssistContext", ">", "_filteredContexts", "=", "this", ".", "getF...
Create content assist proposals and pass them to the given acceptor.
[ "Create", "content", "assist", "proposals", "and", "pass", "them", "to", "the", "given", "acceptor", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalProvider.java#L83-L98
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/JavaStringConverter.java
JavaStringConverter.convertFromJavaString
public String convertFromJavaString(String string, boolean useUnicode) { int firstEscapeSequence = string.indexOf('\\'); if (firstEscapeSequence == -1) { return string; } int length = string.length(); StringBuilder result = new StringBuilder(length); appendRegion(string, 0, firstEscapeSequence, result); return convertFromJavaString(string, useUnicode, firstEscapeSequence, result); }
java
public String convertFromJavaString(String string, boolean useUnicode) { int firstEscapeSequence = string.indexOf('\\'); if (firstEscapeSequence == -1) { return string; } int length = string.length(); StringBuilder result = new StringBuilder(length); appendRegion(string, 0, firstEscapeSequence, result); return convertFromJavaString(string, useUnicode, firstEscapeSequence, result); }
[ "public", "String", "convertFromJavaString", "(", "String", "string", ",", "boolean", "useUnicode", ")", "{", "int", "firstEscapeSequence", "=", "string", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "firstEscapeSequence", "==", "-", "1", ")", "{", ...
Resolve Java control character sequences to the actual character value. Optionally handle unicode escape sequences, too.
[ "Resolve", "Java", "control", "character", "sequences", "to", "the", "actual", "character", "value", ".", "Optionally", "handle", "unicode", "escape", "sequences", "too", "." ]
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/JavaStringConverter.java#L23-L32
train
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/JavaStringConverter.java
JavaStringConverter.convertToJavaString
public String convertToJavaString(String input, boolean useUnicode) { int length = input.length(); StringBuilder result = new StringBuilder(length + 4); for (int i = 0; i < length; i++) { escapeAndAppendTo(input.charAt(i), useUnicode, result); } return result.toString(); }
java
public String convertToJavaString(String input, boolean useUnicode) { int length = input.length(); StringBuilder result = new StringBuilder(length + 4); for (int i = 0; i < length; i++) { escapeAndAppendTo(input.charAt(i), useUnicode, result); } return result.toString(); }
[ "public", "String", "convertToJavaString", "(", "String", "input", ",", "boolean", "useUnicode", ")", "{", "int", "length", "=", "input", ".", "length", "(", ")", ";", "StringBuilder", "result", "=", "new", "StringBuilder", "(", "length", "+", "4", ")", ";...
Escapes control characters with a preceding backslash. Optionally encodes special chars as unicode escape sequence. The resulting string is safe to be put into a Java string literal between the quotes.
[ "Escapes", "control", "characters", "with", "a", "preceding", "backslash", ".", "Optionally", "encodes", "special", "chars", "as", "unicode", "escape", "sequence", ".", "The", "resulting", "string", "is", "safe", "to", "be", "put", "into", "a", "Java", "string...
bac941cb75cb24706519845ec174cfef874d7557
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/JavaStringConverter.java#L181-L188
train
michel-kraemer/gradle-download-task
src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java
DownloadAction.performDownload
private void performDownload(HttpResponse response, File destFile) throws IOException { HttpEntity entity = response.getEntity(); if (entity == null) { return; } //get content length long contentLength = entity.getContentLength(); if (contentLength >= 0) { size = toLengthText(contentLength); } processedBytes = 0; loggedKb = 0; //open stream and start downloading InputStream is = entity.getContent(); streamAndMove(is, destFile); }
java
private void performDownload(HttpResponse response, File destFile) throws IOException { HttpEntity entity = response.getEntity(); if (entity == null) { return; } //get content length long contentLength = entity.getContentLength(); if (contentLength >= 0) { size = toLengthText(contentLength); } processedBytes = 0; loggedKb = 0; //open stream and start downloading InputStream is = entity.getContent(); streamAndMove(is, destFile); }
[ "private", "void", "performDownload", "(", "HttpResponse", "response", ",", "File", "destFile", ")", "throws", "IOException", "{", "HttpEntity", "entity", "=", "response", ".", "getEntity", "(", ")", ";", "if", "(", "entity", "==", "null", ")", "{", "return"...
Save an HTTP response to a file @param response the response to save @param destFile the destination file @throws IOException if the response could not be downloaded
[ "Save", "an", "HTTP", "response", "to", "a", "file" ]
a20c7f29c15ccb699700518f860373692148e3fc
https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L297-L316
train
michel-kraemer/gradle-download-task
src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java
DownloadAction.stream
private void stream(InputStream is, File destFile) throws IOException { try { startProgress(); OutputStream os = new FileOutputStream(destFile); boolean finished = false; try { byte[] buf = new byte[1024 * 10]; int read; while ((read = is.read(buf)) >= 0) { os.write(buf, 0, read); processedBytes += read; logProgress(); } os.flush(); finished = true; } finally { os.close(); if (!finished) { destFile.delete(); } } } finally { is.close(); completeProgress(); } }
java
private void stream(InputStream is, File destFile) throws IOException { try { startProgress(); OutputStream os = new FileOutputStream(destFile); boolean finished = false; try { byte[] buf = new byte[1024 * 10]; int read; while ((read = is.read(buf)) >= 0) { os.write(buf, 0, read); processedBytes += read; logProgress(); } os.flush(); finished = true; } finally { os.close(); if (!finished) { destFile.delete(); } } } finally { is.close(); completeProgress(); } }
[ "private", "void", "stream", "(", "InputStream", "is", ",", "File", "destFile", ")", "throws", "IOException", "{", "try", "{", "startProgress", "(", ")", ";", "OutputStream", "os", "=", "new", "FileOutputStream", "(", "destFile", ")", ";", "boolean", "finish...
Copy bytes from an input stream to a file and log progress @param is the input stream to read @param destFile the file to write to @throws IOException if an I/O error occurs
[ "Copy", "bytes", "from", "an", "input", "stream", "to", "a", "file", "and", "log", "progress" ]
a20c7f29c15ccb699700518f860373692148e3fc
https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L363-L390
train
michel-kraemer/gradle-download-task
src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java
DownloadAction.getCachedETag
private String getCachedETag(HttpHost host, String file) { Map<String, Object> cachedETags = readCachedETags(); @SuppressWarnings("unchecked") Map<String, Object> hostMap = (Map<String, Object>)cachedETags.get(host.toURI()); if (hostMap == null) { return null; } @SuppressWarnings("unchecked") Map<String, String> etagMap = (Map<String, String>)hostMap.get(file); if (etagMap == null) { return null; } return etagMap.get("ETag"); }
java
private String getCachedETag(HttpHost host, String file) { Map<String, Object> cachedETags = readCachedETags(); @SuppressWarnings("unchecked") Map<String, Object> hostMap = (Map<String, Object>)cachedETags.get(host.toURI()); if (hostMap == null) { return null; } @SuppressWarnings("unchecked") Map<String, String> etagMap = (Map<String, String>)hostMap.get(file); if (etagMap == null) { return null; } return etagMap.get("ETag"); }
[ "private", "String", "getCachedETag", "(", "HttpHost", "host", ",", "String", "file", ")", "{", "Map", "<", "String", ",", "Object", ">", "cachedETags", "=", "readCachedETags", "(", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Map", "<", ...
Get the cached ETag for the given host and file @param host the host @param file the file @return the cached ETag or null if there is no ETag in the cache
[ "Get", "the", "cached", "ETag", "for", "the", "given", "host", "and", "file" ]
a20c7f29c15ccb699700518f860373692148e3fc
https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L416-L433
train
michel-kraemer/gradle-download-task
src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java
DownloadAction.makeDestFile
private File makeDestFile(URL src) { if (dest == null) { throw new IllegalArgumentException("Please provide a download destination"); } File destFile = dest; if (destFile.isDirectory()) { //guess name from URL String name = src.toString(); if (name.endsWith("/")) { name = name.substring(0, name.length() - 1); } name = name.substring(name.lastIndexOf('/') + 1); destFile = new File(dest, name); } else { //create destination directory File parent = destFile.getParentFile(); if (parent != null) { parent.mkdirs(); } } return destFile; }
java
private File makeDestFile(URL src) { if (dest == null) { throw new IllegalArgumentException("Please provide a download destination"); } File destFile = dest; if (destFile.isDirectory()) { //guess name from URL String name = src.toString(); if (name.endsWith("/")) { name = name.substring(0, name.length() - 1); } name = name.substring(name.lastIndexOf('/') + 1); destFile = new File(dest, name); } else { //create destination directory File parent = destFile.getParentFile(); if (parent != null) { parent.mkdirs(); } } return destFile; }
[ "private", "File", "makeDestFile", "(", "URL", "src", ")", "{", "if", "(", "dest", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Please provide a download destination\"", ")", ";", "}", "File", "destFile", "=", "dest", ";", "if", ...
Generates the path to an output file for a given source URL. Creates all necessary parent directories for the destination file. @param src the source @return the path to the output file
[ "Generates", "the", "path", "to", "an", "output", "file", "for", "a", "given", "source", "URL", ".", "Creates", "all", "necessary", "parent", "directories", "for", "the", "destination", "file", "." ]
a20c7f29c15ccb699700518f860373692148e3fc
https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L517-L539
train
michel-kraemer/gradle-download-task
src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java
DownloadAction.addAuthentication
private void addAuthentication(HttpHost host, Credentials credentials, AuthScheme authScheme, HttpClientContext context) { AuthCache authCache = context.getAuthCache(); if (authCache == null) { authCache = new BasicAuthCache(); context.setAuthCache(authCache); } CredentialsProvider credsProvider = context.getCredentialsProvider(); if (credsProvider == null) { credsProvider = new BasicCredentialsProvider(); context.setCredentialsProvider(credsProvider); } credsProvider.setCredentials(new AuthScope(host), credentials); if (authScheme != null) { authCache.put(host, authScheme); } }
java
private void addAuthentication(HttpHost host, Credentials credentials, AuthScheme authScheme, HttpClientContext context) { AuthCache authCache = context.getAuthCache(); if (authCache == null) { authCache = new BasicAuthCache(); context.setAuthCache(authCache); } CredentialsProvider credsProvider = context.getCredentialsProvider(); if (credsProvider == null) { credsProvider = new BasicCredentialsProvider(); context.setCredentialsProvider(credsProvider); } credsProvider.setCredentials(new AuthScope(host), credentials); if (authScheme != null) { authCache.put(host, authScheme); } }
[ "private", "void", "addAuthentication", "(", "HttpHost", "host", ",", "Credentials", "credentials", ",", "AuthScheme", "authScheme", ",", "HttpClientContext", "context", ")", "{", "AuthCache", "authCache", "=", "context", ".", "getAuthCache", "(", ")", ";", "if", ...
Add authentication information for the given host @param host the host @param credentials the credentials @param authScheme the scheme for preemptive authentication (should be <code>null</code> if adding authentication for a proxy server) @param context the context in which the authentication information should be saved
[ "Add", "authentication", "information", "for", "the", "given", "host" ]
a20c7f29c15ccb699700518f860373692148e3fc
https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L656-L675
train
michel-kraemer/gradle-download-task
src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java
DownloadAction.toLengthText
private String toLengthText(long bytes) { if (bytes < 1024) { return bytes + " B"; } else if (bytes < 1024 * 1024) { return (bytes / 1024) + " KB"; } else if (bytes < 1024 * 1024 * 1024) { return String.format("%.2f MB", bytes / (1024.0 * 1024.0)); } else { return String.format("%.2f GB", bytes / (1024.0 * 1024.0 * 1024.0)); } }
java
private String toLengthText(long bytes) { if (bytes < 1024) { return bytes + " B"; } else if (bytes < 1024 * 1024) { return (bytes / 1024) + " KB"; } else if (bytes < 1024 * 1024 * 1024) { return String.format("%.2f MB", bytes / (1024.0 * 1024.0)); } else { return String.format("%.2f GB", bytes / (1024.0 * 1024.0 * 1024.0)); } }
[ "private", "String", "toLengthText", "(", "long", "bytes", ")", "{", "if", "(", "bytes", "<", "1024", ")", "{", "return", "bytes", "+", "\" B\"", ";", "}", "else", "if", "(", "bytes", "<", "1024", "*", "1024", ")", "{", "return", "(", "bytes", "/",...
Converts a number of bytes to a human-readable string @param bytes the bytes @return the human-readable string
[ "Converts", "a", "number", "of", "bytes", "to", "a", "human", "-", "readable", "string" ]
a20c7f29c15ccb699700518f860373692148e3fc
https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L682-L692
train
michel-kraemer/gradle-download-task
src/main/java/de/undercouch/gradle/tasks/download/internal/CachingHttpClientFactory.java
CachingHttpClientFactory.close
public void close() throws IOException { for (CloseableHttpClient c : cachedClients.values()) { c.close(); } cachedClients.clear(); }
java
public void close() throws IOException { for (CloseableHttpClient c : cachedClients.values()) { c.close(); } cachedClients.clear(); }
[ "public", "void", "close", "(", ")", "throws", "IOException", "{", "for", "(", "CloseableHttpClient", "c", ":", "cachedClients", ".", "values", "(", ")", ")", "{", "c", ".", "close", "(", ")", ";", "}", "cachedClients", ".", "clear", "(", ")", ";", "...
Close all HTTP clients created by this factory @throws IOException if an I/O error occurs
[ "Close", "all", "HTTP", "clients", "created", "by", "this", "factory" ]
a20c7f29c15ccb699700518f860373692148e3fc
https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/internal/CachingHttpClientFactory.java#L54-L59
train
tulskiy/jkeymaster
core/src/main/java/com/tulskiy/keymaster/common/Provider.java
Provider.getCurrentProvider
public static Provider getCurrentProvider(boolean useSwingEventQueue) { Provider provider; if (Platform.isX11()) { provider = new X11Provider(); } else if (Platform.isWindows()) { provider = new WindowsProvider(); } else if (Platform.isMac()) { provider = new CarbonProvider(); } else { LOGGER.warn("No suitable provider for " + System.getProperty("os.name")); return null; } provider.setUseSwingEventQueue(useSwingEventQueue); provider.init(); return provider; }
java
public static Provider getCurrentProvider(boolean useSwingEventQueue) { Provider provider; if (Platform.isX11()) { provider = new X11Provider(); } else if (Platform.isWindows()) { provider = new WindowsProvider(); } else if (Platform.isMac()) { provider = new CarbonProvider(); } else { LOGGER.warn("No suitable provider for " + System.getProperty("os.name")); return null; } provider.setUseSwingEventQueue(useSwingEventQueue); provider.init(); return provider; }
[ "public", "static", "Provider", "getCurrentProvider", "(", "boolean", "useSwingEventQueue", ")", "{", "Provider", "provider", ";", "if", "(", "Platform", ".", "isX11", "(", ")", ")", "{", "provider", "=", "new", "X11Provider", "(", ")", ";", "}", "else", "...
Get global hotkey provider for current platform @param useSwingEventQueue whether the provider should be using Swing Event queue or a regular thread @return new instance of Provider, or null if platform is not supported @see X11Provider @see WindowsProvider @see CarbonProvider
[ "Get", "global", "hotkey", "provider", "for", "current", "platform" ]
85ac2fa90d26d8d0e4ee4e3fa57c9d56c7946371
https://github.com/tulskiy/jkeymaster/blob/85ac2fa90d26d8d0e4ee4e3fa57c9d56c7946371/core/src/main/java/com/tulskiy/keymaster/common/Provider.java#L55-L71
train
tulskiy/jkeymaster
core/src/main/java/com/tulskiy/keymaster/common/Provider.java
Provider.fireEvent
protected void fireEvent(HotKey hotKey) { HotKeyEvent event = new HotKeyEvent(hotKey); if (useSwingEventQueue) { SwingUtilities.invokeLater(event); } else { if (eventQueue == null) { eventQueue = Executors.newSingleThreadExecutor(); } eventQueue.execute(event); } }
java
protected void fireEvent(HotKey hotKey) { HotKeyEvent event = new HotKeyEvent(hotKey); if (useSwingEventQueue) { SwingUtilities.invokeLater(event); } else { if (eventQueue == null) { eventQueue = Executors.newSingleThreadExecutor(); } eventQueue.execute(event); } }
[ "protected", "void", "fireEvent", "(", "HotKey", "hotKey", ")", "{", "HotKeyEvent", "event", "=", "new", "HotKeyEvent", "(", "hotKey", ")", ";", "if", "(", "useSwingEventQueue", ")", "{", "SwingUtilities", ".", "invokeLater", "(", "event", ")", ";", "}", "...
Helper method fro providers to fire hotkey event in a separate thread @param hotKey hotkey to fire
[ "Helper", "method", "fro", "providers", "to", "fire", "hotkey", "event", "in", "a", "separate", "thread" ]
85ac2fa90d26d8d0e4ee4e3fa57c9d56c7946371
https://github.com/tulskiy/jkeymaster/blob/85ac2fa90d26d8d0e4ee4e3fa57c9d56c7946371/core/src/main/java/com/tulskiy/keymaster/common/Provider.java#L128-L138
train
jbehave/jbehave-core
jbehave-groovy/src/main/java/org/jbehave/core/configuration/groovy/GroovyContext.java
GroovyContext.newInstance
public Object newInstance(String resource) { try { String name = resource.startsWith("/") ? resource : "/" + resource; File file = new File(this.getClass().getResource(name).toURI()); return newInstance(classLoader.parseClass(new GroovyCodeSource(file), true)); } catch (Exception e) { throw new GroovyClassInstantiationFailed(classLoader, resource, e); } }
java
public Object newInstance(String resource) { try { String name = resource.startsWith("/") ? resource : "/" + resource; File file = new File(this.getClass().getResource(name).toURI()); return newInstance(classLoader.parseClass(new GroovyCodeSource(file), true)); } catch (Exception e) { throw new GroovyClassInstantiationFailed(classLoader, resource, e); } }
[ "public", "Object", "newInstance", "(", "String", "resource", ")", "{", "try", "{", "String", "name", "=", "resource", ".", "startsWith", "(", "\"/\"", ")", "?", "resource", ":", "\"/\"", "+", "resource", ";", "File", "file", "=", "new", "File", "(", "...
Creates an object instance from the Groovy resource @param resource the Groovy resource to parse @return An Object instance
[ "Creates", "an", "object", "instance", "from", "the", "Groovy", "resource" ]
bdd6a6199528df3c35087e72d4644870655b23e6
https://github.com/jbehave/jbehave-core/blob/bdd6a6199528df3c35087e72d4644870655b23e6/jbehave-groovy/src/main/java/org/jbehave/core/configuration/groovy/GroovyContext.java#L59-L67
train