idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
148,600
public void addControl ( String name , JSONObject properties , Widget . OnTouchListener listener ) { final JSONObject allowedProperties = new JSONObject ( ) ; put ( allowedProperties , Widget . Properties . name , optString ( properties , Widget . Properties . name ) ) ; put ( allowedProperties , Widget . Properties . size , new PointF ( mControlDimensions . x , mControlDimensions . y ) ) ; put ( allowedProperties , Widget . Properties . states , optJSONObject ( properties , Widget . Properties . states ) ) ; Widget control = new Widget ( getGVRContext ( ) , allowedProperties ) ; setupControl ( name , control , listener , - 1 ) ; }
Add new control at the end of control bar with specified touch listener . Size of control bar is updated based on new number of controls .
156
27
148,601
public Widget addControl ( String name , int resId , Widget . OnTouchListener listener ) { return addControl ( name , resId , null , listener , - 1 ) ; }
Add new control at the end of control bar with specified touch listener and resource . Size of control bar is updated based on new number of controls .
40
29
148,602
public Widget addControl ( String name , int resId , String label , Widget . OnTouchListener listener ) { return addControl ( name , resId , label , listener , - 1 ) ; }
Add new control at the end of control bar with specified touch listener control label and resource . Size of control bar is updated based on new number of controls .
43
31
148,603
public Widget addControl ( String name , int resId , Widget . OnTouchListener listener , int position ) { Widget control = findChildByName ( name ) ; if ( control == null ) { control = createControlWidget ( resId , name , null ) ; } setupControl ( name , control , listener , position ) ; return control ; }
Add new control at the control bar with specified touch listener resource and position . Size of control bar is updated based on new number of controls .
75
28
148,604
public void setMesh ( GVRMesh mesh ) { mMesh = mesh ; NativeMeshCollider . setMesh ( getNative ( ) , mesh . getNative ( ) ) ; }
Set the mesh to be tested against .
38
8
148,605
public void setLinearLowerLimits ( float limitX , float limitY , float limitZ ) { Native3DGenericConstraint . setLinearLowerLimits ( getNative ( ) , limitX , limitY , limitZ ) ; }
Sets the lower limits for the moving body translation relative to joint point .
53
15
148,606
public void setLinearUpperLimits ( float limitX , float limitY , float limitZ ) { Native3DGenericConstraint . setLinearUpperLimits ( getNative ( ) , limitX , limitY , limitZ ) ; }
Sets the upper limits for the moving body translation relative to joint point .
55
15
148,607
public void setAngularLowerLimits ( float limitX , float limitY , float limitZ ) { Native3DGenericConstraint . setAngularLowerLimits ( getNative ( ) , limitX , limitY , limitZ ) ; }
Sets the lower limits for the moving body rotation relative to joint point .
53
15
148,608
public void setAngularUpperLimits ( float limitX , float limitY , float limitZ ) { Native3DGenericConstraint . setAngularUpperLimits ( getNative ( ) , limitX , limitY , limitZ ) ; }
Sets the upper limits for the moving body rotation relative to joint point .
55
15
148,609
GVRSceneObject makeParticleMesh ( float [ ] vertices , float [ ] velocities , float [ ] particleTimeStamps ) { mParticleMesh = new GVRMesh ( mGVRContext ) ; //pass the particle positions as vertices, velocities as normals, and //spawning times as texture coordinates. mParticleMesh . setVertices ( vertices ) ; mParticleMesh . setNormals ( velocities ) ; mParticleMesh . setTexCoords ( particleTimeStamps ) ; particleID = new GVRShaderId ( ParticleShader . class ) ; material = new GVRMaterial ( mGVRContext , particleID ) ; material . setVec4 ( "u_color" , mColorMultiplier . x , mColorMultiplier . y , mColorMultiplier . z , mColorMultiplier . w ) ; material . setFloat ( "u_particle_age" , mAge ) ; material . setVec3 ( "u_acceleration" , mAcceleration . x , mAcceleration . y , mAcceleration . z ) ; material . setFloat ( "u_particle_size" , mSize ) ; material . setFloat ( "u_size_change_rate" , mParticleSizeRate ) ; material . setFloat ( "u_fade" , mFadeWithAge ) ; material . setFloat ( "u_noise_factor" , mNoiseFactor ) ; GVRRenderData renderData = new GVRRenderData ( mGVRContext ) ; renderData . setMaterial ( material ) ; renderData . setMesh ( mParticleMesh ) ; material . setMainTexture ( mTexture ) ; GVRSceneObject meshObject = new GVRSceneObject ( mGVRContext ) ; meshObject . attachRenderData ( renderData ) ; meshObject . getRenderData ( ) . setMaterial ( material ) ; // Set the draw mode to GL_POINTS, disable writing to depth buffer, enable depth testing // and set the rendering order to transparent. // Disabling writing to depth buffer ensure that the particles blend correctly // and keeping the depth test on along with rendering them // after the geometry queue makes sure they occlude, and are occluded, correctly. meshObject . getRenderData ( ) . setDrawMode ( GL_POINTS ) ; meshObject . getRenderData ( ) . setDepthTest ( true ) ; meshObject . getRenderData ( ) . setDepthMask ( false ) ; meshObject . getRenderData ( ) . setRenderingOrder ( GVRRenderData . GVRRenderingOrder . TRANSPARENT ) ; return meshObject ; }
Creates and returns a GVRSceneObject with the specified mesh attributes .
587
15
148,610
public void setFilePath ( String filePath ) throws IOException , GVRScriptException { GVRResourceVolume . VolumeType volumeType = GVRResourceVolume . VolumeType . ANDROID_ASSETS ; String fname = filePath . toLowerCase ( ) ; mLanguage = FileNameUtils . getExtension ( fname ) ; if ( fname . startsWith ( "sd:" ) ) { volumeType = GVRResourceVolume . VolumeType . ANDROID_SDCARD ; } else if ( fname . startsWith ( "http:" ) || fname . startsWith ( "https:" ) ) { volumeType = GVRResourceVolume . VolumeType . NETWORK ; } GVRResourceVolume volume = new GVRResourceVolume ( getGVRContext ( ) , volumeType , FileNameUtils . getParentDirectory ( filePath ) ) ; GVRAndroidResource resource = volume . openResource ( filePath ) ; setScriptFile ( ( GVRScriptFile ) getGVRContext ( ) . getScriptManager ( ) . loadScript ( resource , mLanguage ) ) ; }
Sets the path to the script file to load and loads the script .
232
15
148,611
public void setScriptText ( String scriptText , String language ) { GVRScriptFile newScript = new GVRJavascriptScriptFile ( getGVRContext ( ) , scriptText ) ; mLanguage = GVRScriptManager . LANG_JAVASCRIPT ; setScriptFile ( newScript ) ; }
Loads the script from a text string .
66
9
148,612
public boolean invokeFunction ( String funcName , Object [ ] args ) { mLastError = null ; if ( mScriptFile != null ) { if ( mScriptFile . invokeFunction ( funcName , args ) ) { return true ; } } mLastError = mScriptFile . getLastError ( ) ; if ( ( mLastError != null ) && ! mLastError . contains ( "is not defined" ) ) { getGVRContext ( ) . logError ( mLastError , this ) ; } return false ; }
Calls a function script associated with this component . The function is called even if the component is not enabled and not attached to a scene object .
112
29
148,613
public void setTextureBufferSize ( final int size ) { mRootViewGroup . post ( new Runnable ( ) { @ Override public void run ( ) { mRootViewGroup . setTextureBufferSize ( size ) ; } } ) ; }
Set the default size of the texture buffers . You can call this to reduce the buffer size of views with anti - aliasing issue .
53
27
148,614
public void setBackgroundColor ( int color ) { setBackgroundColorR ( Colors . byteToGl ( Color . red ( color ) ) ) ; setBackgroundColorG ( Colors . byteToGl ( Color . green ( color ) ) ) ; setBackgroundColorB ( Colors . byteToGl ( Color . blue ( color ) ) ) ; setBackgroundColorA ( Colors . byteToGl ( Color . alpha ( color ) ) ) ; }
Set the background color .
91
5
148,615
public void setBackgroundColor ( float r , float g , float b , float a ) { setBackgroundColorR ( r ) ; setBackgroundColorG ( g ) ; setBackgroundColorB ( b ) ; setBackgroundColorA ( a ) ; }
Sets the background color of the scene rendered by this camera .
52
13
148,616
public void addPostEffect ( GVRMaterial postEffectData ) { GVRContext ctx = getGVRContext ( ) ; if ( mPostEffects == null ) { mPostEffects = new GVRRenderData ( ctx , postEffectData ) ; GVRMesh dummyMesh = new GVRMesh ( getGVRContext ( ) , "float3 a_position float2 a_texcoord" ) ; mPostEffects . setMesh ( dummyMesh ) ; NativeCamera . setPostEffect ( getNative ( ) , mPostEffects . getNative ( ) ) ; mPostEffects . setCullFace ( GVRRenderPass . GVRCullFaceEnum . None ) ; } else { GVRRenderPass rpass = new GVRRenderPass ( ctx , postEffectData ) ; rpass . setCullFace ( GVRRenderPass . GVRCullFaceEnum . None ) ; mPostEffects . addPass ( rpass ) ; } }
Add a post - effect to this camera s render chain .
206
12
148,617
public int getBoneIndex ( GVRSceneObject bone ) { for ( int i = 0 ; i < getNumBones ( ) ; ++ i ) if ( mBones [ i ] == bone ) return i ; return - 1 ; }
Get the bone index for the given scene object .
51
10
148,618
public int getBoneIndex ( String bonename ) { for ( int i = 0 ; i < getNumBones ( ) ; ++ i ) if ( mBoneNames [ i ] . equals ( bonename ) ) return i ; return - 1 ; }
Get the bone index for the bone with the given name .
53
12
148,619
public void setBoneName ( int boneindex , String bonename ) { mBoneNames [ boneindex ] = bonename ; NativeSkeleton . setBoneName ( getNative ( ) , boneindex , bonename ) ; }
Sets the name of the designated bone .
47
9
148,620
public void poseFromBones ( ) { for ( int i = 0 ; i < getNumBones ( ) ; ++ i ) { GVRSceneObject bone = mBones [ i ] ; if ( bone == null ) { continue ; } if ( ( mBoneOptions [ i ] & BONE_LOCK_ROTATION ) != 0 ) { continue ; } GVRTransform trans = bone . getTransform ( ) ; mPose . setLocalMatrix ( i , trans . getLocalModelMatrix4f ( ) ) ; } mPose . sync ( ) ; updateBonePose ( ) ; }
Applies the matrices computed from the scene object s linked to the skeleton bones to the current pose .
129
21
148,621
public void merge ( GVRSkeleton newSkel ) { int numBones = getNumBones ( ) ; List < Integer > parentBoneIds = new ArrayList < Integer > ( numBones + newSkel . getNumBones ( ) ) ; List < String > newBoneNames = new ArrayList < String > ( newSkel . getNumBones ( ) ) ; List < Matrix4f > newMatrices = new ArrayList < Matrix4f > ( newSkel . getNumBones ( ) ) ; GVRPose oldBindPose = getBindPose ( ) ; GVRPose curPose = getPose ( ) ; for ( int i = 0 ; i < numBones ; ++ i ) { parentBoneIds . add ( mParentBones [ i ] ) ; } for ( int j = 0 ; j < newSkel . getNumBones ( ) ; ++ j ) { String boneName = newSkel . getBoneName ( j ) ; int boneId = getBoneIndex ( boneName ) ; if ( boneId < 0 ) { int parentId = newSkel . getParentBoneIndex ( j ) ; Matrix4f m = new Matrix4f ( ) ; newSkel . getBindPose ( ) . getLocalMatrix ( j , m ) ; newMatrices . add ( m ) ; newBoneNames . add ( boneName ) ; if ( parentId >= 0 ) { boneName = newSkel . getBoneName ( parentId ) ; parentId = getBoneIndex ( boneName ) ; } parentBoneIds . add ( parentId ) ; } } if ( parentBoneIds . size ( ) == numBones ) { return ; } int n = numBones + parentBoneIds . size ( ) ; int [ ] parentIds = Arrays . copyOf ( mParentBones , n ) ; int [ ] boneOptions = Arrays . copyOf ( mBoneOptions , n ) ; String [ ] boneNames = Arrays . copyOf ( mBoneNames , n ) ; mBones = Arrays . copyOf ( mBones , n ) ; mPoseMatrices = new float [ n * 16 ] ; for ( int i = 0 ; i < parentBoneIds . size ( ) ; ++ i ) { n = numBones + i ; parentIds [ n ] = parentBoneIds . get ( i ) ; boneNames [ n ] = newBoneNames . get ( i ) ; boneOptions [ n ] = BONE_ANIMATE ; } mBoneOptions = boneOptions ; mBoneNames = boneNames ; mParentBones = parentIds ; mPose = new GVRPose ( this ) ; mBindPose = new GVRPose ( this ) ; mBindPose . copy ( oldBindPose ) ; mPose . copy ( curPose ) ; mBindPose . sync ( ) ; for ( int j = 0 ; j < newSkel . getNumBones ( ) ; ++ j ) { mBindPose . setLocalMatrix ( numBones + j , newMatrices . get ( j ) ) ; mPose . setLocalMatrix ( numBones + j , newMatrices . get ( j ) ) ; } setBindPose ( mBindPose ) ; mPose . sync ( ) ; updateBonePose ( ) ; }
Merge the source skeleton with this one . The result will be that this skeleton has all of its original bones and all the bones in the new skeleton .
738
31
148,622
public View getFullScreenView ( ) { if ( mFullScreenView != null ) { return mFullScreenView ; } final DisplayMetrics metrics = new DisplayMetrics ( ) ; mActivity . getWindowManager ( ) . getDefaultDisplay ( ) . getMetrics ( metrics ) ; final int screenWidthPixels = Math . max ( metrics . widthPixels , metrics . heightPixels ) ; final int screenHeightPixels = Math . min ( metrics . widthPixels , metrics . heightPixels ) ; final ViewGroup . LayoutParams layout = new ViewGroup . LayoutParams ( screenWidthPixels , screenHeightPixels ) ; mFullScreenView = new View ( mActivity ) ; mFullScreenView . setLayoutParams ( layout ) ; mRenderableViewGroup . addView ( mFullScreenView ) ; return mFullScreenView ; }
Invalidating just the GVRView associated with the GVRViewSceneObject incorrectly set the clip rectangle to just that view . To fix this we have to create a full screen android View and invalidate this to restore the clip rectangle .
184
47
148,623
public final void unregisterView ( final View view ) { mActivity . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { if ( null != mRenderableViewGroup && view . getParent ( ) == mRenderableViewGroup ) { mRenderableViewGroup . removeView ( view ) ; } } } ) ; }
Remove a child view of Android hierarchy view .
79
9
148,624
public void clear ( ) { List < Widget > children = getChildren ( ) ; Log . d ( TAG , "clear(%s): removing %d children" , getName ( ) , children . size ( ) ) ; for ( Widget child : children ) { removeChild ( child , true ) ; } requestLayout ( ) ; }
Removes all children
72
4
148,625
protected boolean inViewPort ( final int dataIndex ) { boolean inViewPort = true ; for ( Layout layout : mLayouts ) { inViewPort = inViewPort && ( layout . inViewPort ( dataIndex ) || ! layout . isClippingEnabled ( ) ) ; } return inViewPort ; }
Checks if the child is currently in ViewPort
66
10
148,626
public void setDataOffsets ( int [ ] offsets ) { assert ( mLevels == offsets . length ) ; NativeBitmapImage . updateCompressed ( getNative ( ) , mWidth , mHeight , mImageSize , mData , mLevels , offsets ) ; mData = null ; }
Set the offsets in the compressed data area for each mip - map level .
64
16
148,627
public static String getFilename ( String path ) throws IllegalArgumentException { if ( Pattern . matches ( sPatternUrl , path ) ) return getURLFilename ( path ) ; return new File ( path ) . getName ( ) ; }
Gets the filename from a path or URL .
49
10
148,628
public static String getParentDirectory ( String filePath ) throws IllegalArgumentException { if ( Pattern . matches ( sPatternUrl , filePath ) ) return getURLParentDirectory ( filePath ) ; return new File ( filePath ) . getParent ( ) ; }
Returns the directory of the file .
56
7
148,629
public static String getURLParentDirectory ( String urlString ) throws IllegalArgumentException { URL url = null ; try { url = new URL ( urlString ) ; } catch ( MalformedURLException e ) { throw Exceptions . IllegalArgument ( "Malformed URL: %s" , url ) ; } String path = url . getPath ( ) ; int lastSlashIndex = path . lastIndexOf ( "/" ) ; String directory = lastSlashIndex == - 1 ? "" : path . substring ( 0 , lastSlashIndex ) ; return String . format ( "%s://%s%s%s%s" , url . getProtocol ( ) , url . getUserInfo ( ) == null ? "" : url . getUserInfo ( ) + "@" , url . getHost ( ) , url . getPort ( ) == - 1 ? "" : ":" + Integer . toString ( url . getPort ( ) ) , directory ) ; }
Returns the directory of the URL .
208
7
148,630
@ Override protected void clearReference ( EObject obj , EReference ref ) { super . clearReference ( obj , ref ) ; if ( obj . eIsSet ( ref ) && ref . getEType ( ) . equals ( XtextPackage . Literals . TYPE_REF ) ) { INode node = NodeModelUtils . getNode ( ( EObject ) obj . eGet ( ref ) ) ; if ( node == null ) obj . eUnset ( ref ) ; } if ( obj . eIsSet ( ref ) && ref == XtextPackage . Literals . CROSS_REFERENCE__TERMINAL ) { INode node = NodeModelUtils . getNode ( ( EObject ) obj . eGet ( ref ) ) ; if ( node == null ) obj . eUnset ( ref ) ; } if ( ref == XtextPackage . Literals . RULE_CALL__RULE ) { obj . eUnset ( XtextPackage . Literals . RULE_CALL__EXPLICITLY_CALLED ) ; } }
We add typeRefs without Nodes on the fly so we should remove them before relinking .
227
20
148,631
public CancelIndicator newCancelIndicator ( final ResourceSet rs ) { CancelIndicator _xifexpression = null ; if ( ( rs instanceof XtextResourceSet ) ) { final boolean cancelationAllowed = ( this . cancelationAllowed . get ( ) ) . booleanValue ( ) ; final int current = ( ( XtextResourceSet ) rs ) . getModificationStamp ( ) ; final CancelIndicator _function = ( ) -> { return ( cancelationAllowed && ( ( ( XtextResourceSet ) rs ) . isOutdated ( ) || ( current != ( ( XtextResourceSet ) rs ) . getModificationStamp ( ) ) ) ) ; } ; return _function ; } else { _xifexpression = CancelIndicator . NullImpl ; } return _xifexpression ; }
Created a fresh CancelIndicator
177
6
148,632
public ContentAssistEntry createProposal ( final String proposal , final ContentAssistContext context ) { return this . createProposal ( proposal , context . getPrefix ( ) , context , ContentAssistEntry . KIND_UNKNOWN , null ) ; }
Returns an entry with the given proposal and the prefix from the context or null if the proposal is not valid .
55
22
148,633
public ContentAssistEntry createSnippet ( final String proposal , final String label , final ContentAssistContext context ) { final Procedure1 < ContentAssistEntry > _function = ( ContentAssistEntry it ) -> { it . setLabel ( label ) ; } ; return this . createProposal ( proposal , context . getPrefix ( ) , context , ContentAssistEntry . KIND_SNIPPET , _function ) ; }
Returns an entry of kind snippet with the given proposal and label and the prefix from the context or null if the proposal is not valid .
93
27
148,634
public ContentAssistEntry createProposal ( final String proposal , final ContentAssistContext context , final Procedure1 < ? super ContentAssistEntry > init ) { return this . createProposal ( proposal , context . getPrefix ( ) , context , ContentAssistEntry . KIND_UNKNOWN , init ) ; }
Returns an entry with the given proposal and the prefix from the context or null if the proposal is not valid . If it is valid the initializer function is applied to it .
68
35
148,635
public ContentAssistEntry createProposal ( final String proposal , final String prefix , final ContentAssistContext context , final String kind , final Procedure1 < ? super ContentAssistEntry > init ) { boolean _isValidProposal = this . isValidProposal ( proposal , prefix , context ) ; if ( _isValidProposal ) { final ContentAssistEntry result = new ContentAssistEntry ( ) ; result . setProposal ( proposal ) ; result . setPrefix ( prefix ) ; if ( ( kind != null ) ) { result . setKind ( kind ) ; } if ( ( init != null ) ) { init . apply ( result ) ; } return result ; } return null ; }
Returns an entry with the given proposal and prefix or null if the proposal is not valid . If it is valid the initializer function is applied to it .
148
31
148,636
public String toDecodedString ( final java . net . URI uri ) { final String scheme = uri . getScheme ( ) ; final String part = uri . getSchemeSpecificPart ( ) ; if ( ( scheme == null ) ) { return part ; } return ( ( scheme + ":" ) + part ) ; }
converts a java . net . URI to a decoded string
71
13
148,637
public URI withEmptyAuthority ( final URI uri ) { URI _xifexpression = null ; if ( ( uri . isFile ( ) && ( uri . authority ( ) == null ) ) ) { _xifexpression = URI . createHierarchicalURI ( uri . scheme ( ) , "" , uri . device ( ) , uri . segments ( ) , uri . query ( ) , uri . fragment ( ) ) ; } else { _xifexpression = uri ; } return _xifexpression ; }
converts the file URIs with an absent authority to one with an empty
120
15
148,638
public String [ ] [ ] getRequiredRuleNames ( Param param ) { if ( isFiltered ( param ) ) { return EMPTY_ARRAY ; } AbstractElement elementToParse = param . elementToParse ; String ruleName = param . ruleName ; if ( ruleName == null ) { return getRequiredRuleNames ( param , elementToParse ) ; } return getAdjustedRequiredRuleNames ( param , elementToParse , ruleName ) ; }
Returns the names of parser rules that should be called in order to obtain the follow elements for the parser call stack described by the given param .
99
28
148,639
protected boolean isFiltered ( Param param ) { AbstractElement elementToParse = param . elementToParse ; while ( elementToParse != null ) { if ( isFiltered ( elementToParse , param ) ) { return true ; } elementToParse = getEnclosingSingleElementGroup ( elementToParse ) ; } return false ; }
Returns true if the grammar element that is associated with the given param is filtered due to guard conditions of parameterized rules in the current call stack .
77
29
148,640
protected AbstractElement getEnclosingSingleElementGroup ( AbstractElement elementToParse ) { EObject container = elementToParse . eContainer ( ) ; if ( container instanceof Group ) { if ( ( ( Group ) container ) . getElements ( ) . size ( ) == 1 ) { return ( AbstractElement ) container ; } } return null ; }
Return the containing group if it contains exactly one element .
76
11
148,641
protected boolean isFiltered ( AbstractElement canddiate , Param param ) { if ( canddiate instanceof Group ) { Group group = ( Group ) canddiate ; if ( group . getGuardCondition ( ) != null ) { Set < Parameter > context = param . getAssignedParametes ( ) ; ConditionEvaluator evaluator = new ConditionEvaluator ( context ) ; if ( ! evaluator . evaluate ( group . getGuardCondition ( ) ) ) { return true ; } } } return false ; }
Returns true if the given candidate is a group that is filtered due to rule parameters in the current call graph .
115
22
148,642
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 .
43
16
148,643
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 .
33
28
148,644
public ImmutableList < AbstractElement > getFirstSetGrammarElements ( ) { if ( firstSetGrammarElements == null ) { firstSetGrammarElements = ImmutableList . copyOf ( mutableFirstSetGrammarElements ) ; } return firstSetGrammarElements ; }
The grammar elements that may occur at the given offset .
69
11
148,645
public int getReplaceContextLength ( ) { if ( replaceContextLength == null ) { int replacementOffset = getReplaceRegion ( ) . getOffset ( ) ; ITextRegion currentRegion = getCurrentNode ( ) . getTextRegion ( ) ; int replaceContextLength = currentRegion . getLength ( ) - ( replacementOffset - currentRegion . getOffset ( ) ) ; this . replaceContextLength = replaceContextLength ; return replaceContextLength ; } return replaceContextLength . intValue ( ) ; }
The length of the region left to the completion offset that is part of the replace region .
106
18
148,646
protected String getFormattedDatatypeValue ( ICompositeNode node , AbstractRule rule , String text ) throws ValueConverterException { Object value = valueConverter . toValue ( text , rule . getName ( ) , node ) ; text = valueConverter . toString ( value , rule . getName ( ) ) ; return text ; }
Create a canonical represenation of the data type value . Defaults to the value converter .
78
20
148,647
public String splitSpecialStateSwitch ( String specialStateTransition ) { Matcher transformedSpecialStateMatcher = TRANSORMED_SPECIAL_STATE_TRANSITION_METHOD . matcher ( specialStateTransition ) ; if ( ! transformedSpecialStateMatcher . find ( ) ) { return specialStateTransition ; } String specialStateSwitch = transformedSpecialStateMatcher . group ( 3 ) ; Matcher transformedCaseMatcher = TRANSFORMED_CASE_PATTERN . matcher ( specialStateSwitch ) ; StringBuffer switchReplacementBuffer = new StringBuffer ( ) ; StringBuffer extractedMethods = new StringBuffer ( ) ; List < String > extractedCasesList = new ArrayList < String > ( ) ; switchReplacementBuffer . append ( "$2\n" ) ; boolean methodExtracted = false ; boolean isFirst = true ; String from = "0" ; String to = "0" ; //Process individual case statements while ( transformedCaseMatcher . find ( ) ) { if ( isFirst ) { isFirst = false ; from = transformedCaseMatcher . group ( 2 ) ; } to = transformedCaseMatcher . group ( 2 ) ; extractedCasesList . add ( transformedCaseMatcher . group ( ) ) ; //If the list of not processed extracted cases exceeds the maximal allowed number //generate individual method for those cases if ( extractedCasesList . size ( ) >= casesPerSpecialStateSwitch ) { generateExtractedSwitch ( extractedCasesList , from , to , extractedMethods , switchReplacementBuffer ) ; extractedCasesList . clear ( ) ; isFirst = true ; methodExtracted = true ; } } //If no method was extracted return the input unchanged //or process rest of cases by generating method for them if ( ! methodExtracted ) { return specialStateTransition ; } else if ( ! extractedCasesList . isEmpty ( ) && methodExtracted ) { generateExtractedSwitch ( extractedCasesList , from , to , extractedMethods , switchReplacementBuffer ) ; } switchReplacementBuffer . append ( "$5" ) ; StringBuffer result = new StringBuffer ( ) ; transformedSpecialStateMatcher . appendReplacement ( result , switchReplacementBuffer . toString ( ) ) ; result . append ( extractedMethods ) ; transformedSpecialStateMatcher . appendTail ( result ) ; return result . toString ( ) ; }
Splits switch in specialStateTransition containing more than maxCasesPerSwitch cases into several methods each containing maximum of maxCasesPerSwitch cases or less .
501
33
148,648
public boolean merge ( final PluginXmlAccess other ) { boolean _xblockexpression = false ; { String _path = this . getPath ( ) ; String _path_1 = other . getPath ( ) ; boolean _notEquals = ( ! Objects . equal ( _path , _path_1 ) ) ; if ( _notEquals ) { String _path_2 = this . getPath ( ) ; String _plus = ( "Merging plugin.xml files with different paths: " + _path_2 ) ; String _plus_1 = ( _plus + ", " ) ; String _path_3 = other . getPath ( ) ; String _plus_2 = ( _plus_1 + _path_3 ) ; PluginXmlAccess . LOG . warn ( _plus_2 ) ; } _xblockexpression = this . entries . addAll ( other . entries ) ; } return _xblockexpression ; }
Merge the contents of the given plugin . xml into this one .
207
14
148,649
protected Iterable < URI > getTargetURIs ( final EObject primaryTarget ) { final TargetURIs result = targetURIsProvider . get ( ) ; uriCollector . add ( primaryTarget , result ) ; return result ; }
Returns with an iterable of URIs that points to all elements that are referenced by the argument or vice - versa .
50
24
148,650
public void setRegularExpression ( String regularExpression ) { if ( regularExpression != null ) this . regularExpression = Pattern . compile ( regularExpression ) ; else this . regularExpression = null ; }
Filter the URI based on a regular expression . Can be combined with an additional file - extension filter .
46
20
148,651
public void registerServices ( boolean force ) { Injector injector = Guice . createInjector ( getGuiceModule ( ) ) ; injector . injectMembers ( this ) ; registerInRegistry ( force ) ; }
Inject members into this instance and register the services afterwards .
49
12
148,652
public void register ( Delta delta ) { final IResourceDescription newDesc = delta . getNew ( ) ; if ( newDesc == null ) { removeDescription ( delta . getUri ( ) ) ; } else { addDescription ( delta . getUri ( ) , newDesc ) ; } }
Put a new resource description into the index or remove one if the delta has no new description . A delta for a particular URI may be registered more than once ; overwriting any earlier registration .
62
39
148,653
protected AbsoluteURI getGeneratedLocation ( PersistedTrace trace ) { AbsoluteURI path = trace . getPath ( ) ; String fileName = traceFileNameProvider . getJavaFromTrace ( path . getURI ( ) . toString ( ) ) ; return new AbsoluteURI ( fileName ) ; }
Compute the location of the generated file from the given trace file .
64
14
148,654
public static < T extends EObject > IScope scopeFor ( Iterable < ? extends T > elements , final Function < T , QualifiedName > nameComputation , IScope outer ) { return new SimpleScope ( outer , scopedElementsFor ( elements , nameComputation ) ) ; }
creates a scope using the passed function to compute the names and sets the passed scope as the parent scope
66
21
148,655
protected int compare ( MethodDesc o1 , MethodDesc o2 ) { final Class < ? > [ ] paramTypes1 = o1 . getParameterTypes ( ) ; final Class < ? > [ ] paramTypes2 = o2 . getParameterTypes ( ) ; // sort by parameter types from left to right for ( int i = 0 ; i < paramTypes1 . length ; i ++ ) { final Class < ? > class1 = paramTypes1 [ i ] ; final Class < ? > class2 = paramTypes2 [ i ] ; if ( class1 . equals ( class2 ) ) continue ; if ( class1 . isAssignableFrom ( class2 ) || Void . class . equals ( class2 ) ) return - 1 ; if ( class2 . isAssignableFrom ( class1 ) || Void . class . equals ( class1 ) ) return 1 ; } // sort by declaring class (more specific comes first). if ( ! o1 . getDeclaringClass ( ) . equals ( o2 . getDeclaringClass ( ) ) ) { if ( o1 . getDeclaringClass ( ) . isAssignableFrom ( o2 . getDeclaringClass ( ) ) ) return 1 ; if ( o2 . getDeclaringClass ( ) . isAssignableFrom ( o1 . getDeclaringClass ( ) ) ) return - 1 ; } // sort by target final int compareTo = ( ( Integer ) targets . indexOf ( o2 . target ) ) . compareTo ( targets . indexOf ( o1 . target ) ) ; return compareTo ; }
returns &gt ; 0 when o1 is more specific than o2
333
15
148,656
protected void writeEntries ( final StorageAwareResource resource , final ZipOutputStream zipOut ) throws IOException { final BufferedOutputStream bufferedOutput = new BufferedOutputStream ( zipOut ) ; ZipEntry _zipEntry = new ZipEntry ( "emf-contents" ) ; zipOut . putNextEntry ( _zipEntry ) ; try { this . writeContents ( resource , bufferedOutput ) ; } finally { bufferedOutput . flush ( ) ; zipOut . closeEntry ( ) ; } ZipEntry _zipEntry_1 = new ZipEntry ( "resource-description" ) ; zipOut . putNextEntry ( _zipEntry_1 ) ; try { this . writeResourceDescription ( resource , bufferedOutput ) ; } finally { bufferedOutput . flush ( ) ; zipOut . closeEntry ( ) ; } if ( this . storeNodeModel ) { ZipEntry _zipEntry_2 = new ZipEntry ( "node-model" ) ; zipOut . putNextEntry ( _zipEntry_2 ) ; try { this . writeNodeModel ( resource , bufferedOutput ) ; } finally { bufferedOutput . flush ( ) ; zipOut . closeEntry ( ) ; } } }
Write entries into the storage . Overriding methods should first delegate to super before adding their own entries .
255
21
148,657
@ Override public String getInputToParse ( String completeInput , int offset , int completionOffset ) { int fixedOffset = getOffsetIncludingWhitespace ( completeInput , offset , Math . min ( completeInput . length ( ) , completionOffset ) ) ; return super . getInputToParse ( completeInput , fixedOffset , completionOffset ) ; }
Returns the input to parse including the whitespace left to the cursor position since it may be relevant to the list of proposals for whitespace sensitive languages .
76
30
148,658
@ Override protected void doLinking ( ) { IParseResult parseResult = getParseResult ( ) ; if ( parseResult == null || parseResult . getRootASTElement ( ) == null ) return ; XtextLinker castedLinker = ( XtextLinker ) getLinker ( ) ; castedLinker . discardGeneratedPackages ( parseResult . getRootASTElement ( ) ) ; }
Overridden to do only the clean - part of the linking but not the actual linking . This is deferred until someone wants to access the content of the resource .
91
32
148,659
public static void setSourceLevelUrisWithoutCopy ( final ResourceSet resourceSet , final Set < URI > uris ) { final SourceLevelURIsAdapter adapter = SourceLevelURIsAdapter . findOrCreateAdapter ( resourceSet ) ; adapter . sourceLevelURIs = uris ; }
Installs the given set of URIs as the source level URIs . Does not copy the given set but uses it directly .
60
26
148,660
public void setFileExtensions ( final String fileExtensions ) { this . fileExtensions = IterableExtensions . < String > toList ( ( ( Iterable < String > ) Conversions . doWrapArray ( fileExtensions . trim ( ) . split ( "\\s*,\\s*" ) ) ) ) ; }
Either a single file extension or a comma - separated list of extensions for which the language shall be registered .
71
21
148,661
public static String compactDump ( INode node , boolean showHidden ) { StringBuilder result = new StringBuilder ( ) ; try { compactDump ( node , showHidden , "" , result ) ; } catch ( IOException e ) { return e . getMessage ( ) ; } return result . toString ( ) ; }
Creates a string representation of the given node . Useful for debugging .
68
14
148,662
public static String getTokenText ( INode node ) { if ( node instanceof ILeafNode ) return ( ( ILeafNode ) node ) . getText ( ) ; else { StringBuilder builder = new StringBuilder ( Math . max ( node . getTotalLength ( ) , 1 ) ) ; boolean hiddenSeen = false ; for ( ILeafNode leaf : node . getLeafNodes ( ) ) { if ( ! leaf . isHidden ( ) ) { if ( hiddenSeen && builder . length ( ) > 0 ) builder . append ( ' ' ) ; builder . append ( leaf . getText ( ) ) ; hiddenSeen = false ; } else { hiddenSeen = true ; } } return builder . toString ( ) ; } }
This method converts a node to text .
162
8
148,663
public List < List < String > > getAllScopes ( ) { this . checkInitialized ( ) ; final ImmutableList . Builder < List < String > > builder = ImmutableList . < List < String > > builder ( ) ; final Consumer < Integer > _function = ( Integer it ) -> { List < String > _get = this . scopes . get ( it ) ; StringConcatenation _builder = new StringConcatenation ( ) ; _builder . append ( "No scopes are available for index: " ) ; _builder . append ( it ) ; builder . add ( Preconditions . < List < String > > checkNotNull ( _get , _builder ) ) ; } ; this . scopes . keySet ( ) . forEach ( _function ) ; return builder . build ( ) ; }
Returns with a view of all scopes known by this manager .
176
13
148,664
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 .
48
15
148,665
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 ) ; }
Add the list with given bundles to the Require - Bundle main attribute .
207
15
148,666
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 .
45
14
148,667
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 ) ; }
Add the list with given bundles to the Import - Package main attribute .
170
14
148,668
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 .
45
14
148,669
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 ) ; }
Add the list with given bundles to the Export - Package main attribute .
170
14
148,670
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 ; } }
Set the main attribute Bundle - RequiredExecutionEnvironment to the given value .
88
15
148,671
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 ; } }
Set the main attribute Bundle - Activator to the given value .
84
13
148,672
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 ) == ' ' ) line = line . substring ( 0 , line . length ( ) - 1 ) ; append512Safe ( line , result , newline ) ; } else { append512Safe ( rest , result , newline ) ; break ; } } return result . toString ( ) ; }
Return a string that ensures that no line is longer then 512 characters and lines are broken according to manifest specification .
190
22
148,673
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 .
38
18
148,674
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 ( ) ; } }
Upgrades a read transaction to a write transaction executes the work then downgrades to a read transaction again .
116
21
148,675
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 ; }
Assigned action code
95
4
148,676
public String stripUnnecessaryComments ( String javaContent , AntlrOptions options ) { if ( ! options . isOptimizeCodeQuality ( ) ) { return javaContent ; } javaContent = stripMachineDependentPaths ( javaContent ) ; if ( options . isStripAllComments ( ) ) { javaContent = stripAllComments ( javaContent ) ; } return javaContent ; }
Remove all unnecessary comments from a lexer or parser file
80
11
148,677
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 ( ) ; }
replace region length
119
3
148,678
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 .
46
22
148,679
public boolean hasCachedValue ( Key key ) { try { readLock . lock ( ) ; return content . containsKey ( key ) ; } finally { readLock . unlock ( ) ; } }
for testing purpose
41
3
148,680
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 ) ; } }
Load entries from the storage . Overriding methods should first delegate to super before adding their own entries .
174
21
148,681
public final Iterator < AbstractTraceRegion > leafIterator ( ) { if ( nestedRegions == null ) return Collections . < AbstractTraceRegion > singleton ( this ) . iterator ( ) ; return new LeafIterator ( this ) ; }
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 .
51
39
148,682
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 ) ; }
Convenience extension to generate traced code .
71
9
148,683
public void generateTracedFile ( final IFileSystemAccess2 fsa , final String path , final CompositeGeneratorNode rootNode ) { final GeneratorNodeProcessor . Result result = this . processor . process ( rootNode ) ; fsa . generateFile ( path , result ) ; }
Use to generate a file based on generator node .
60
10
148,684
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 ) ; } }
Rethrows OperationCanceledErrors and wraps platform specific OperationCanceledExceptions . Does nothing for any other type of Throwable .
95
30
148,685
public void propagateIfCancelException ( final Throwable t ) { final RuntimeException cancelException = this . getPlatformOperationCanceledException ( t ) ; if ( ( cancelException != null ) ) { throw cancelException ; } }
Rethrows platform specific OperationCanceledExceptions and unwraps OperationCanceledErrors . Does nothing for any other type of Throwable .
49
32
148,686
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 ) ; }
decodes the uriFragment
195
7
148,687
@ 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 ; }
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 .
121
34
148,688
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 ( ) ; } }
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 .
106
29
148,689
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 ( ) ; } }
The transaction will be executed with caching enabled . However all newly cached values will be discarded as soon as the transaction is over .
104
25
148,690
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 ) ; } } } }
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 .
197
36
148,691
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 ( ) ; }
Collect the URIs of resources that are referenced by the given description .
135
14
148,692
@ 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 ] == ' ' ) { offset = off + i + 1 ; length = len - i - 1 ; suppressLineCount -- ; } } if ( length <= 0 ) return ; } delegate . write ( cbuf , offset , length ) ; }
Filter everything until we found the first NL character .
134
10
148,693
@ Inject ( optional = true ) protected Pattern setEndTag ( @ Named ( AbstractMultiLineCommentProvider . END_TAG ) final String endTag ) { return this . endTagPattern = Pattern . compile ( ( endTag + "\\z" ) ) ; }
this method is not intended to be called by clients
56
10
148,694
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 ; }
Appends the indentation string at the current position of the parent and adds a new composite node indicating the same indentation for subsequent lines .
64
28
148,695
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 ; }
Appends a line separator node that will only be effective if the current line contains non - whitespace text .
95
23
148,696
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 ; }
Creates a template node for the given templateString and appends it to the given parent node .
70
20
148,697
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 ) ) ; } }
The token was previously determined as potentially to - be - splitted thus we emit additional indentation or dedenting tokens .
254
24
148,698
@ 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 ) ; } }
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 .
383
36
148,699
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 .
45
36