idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
138,100
public int read ( byte b [ ] , int off , int len ) throws IOException { return IOUtils . read ( inStream , b , off , len ) ; }
Same as above but does not throw an exception at end of file just returns the actual data read .
138,101
public void addNamedParam ( final String name , final ParamInfo paramInfo ) { check ( ! named . containsKey ( name ) , "Duplicate parameter %s declaration at position %s" , name , paramInfo . position ) ; named . put ( name , paramInfo ) ; }
Register parameter as named .
138,102
public void addStaticElVarValue ( final String name , final String value ) { check ( ! staticElValues . containsKey ( name ) , "Duplicate el variable %s value declaration: %s (original: %s)" , name , value , staticElValues . get ( name ) ) ; check ( ! dynamicElValues . contains ( name ) , "El variable %s can't be regis...
Register static query el variable value .
138,103
public void addDynamicElVarValue ( final String name ) { check ( ! dynamicElValues . contains ( name ) , "Duplicate dynamic el variable %s declaration" , name ) ; check ( ! staticElValues . containsKey ( name ) , "El variable %s can't be registered as dynamic, because static declaration already defined" , name ) ; dyna...
Register dynamic query el variable value . Variable will be completely handled by extension . Registration is required to validated not handled variables .
138,104
private String generateXmlSchema ( Reader cobolReader , String targetNamespace , String targetXmlSchemaName , final String xsltFileName ) { log . debug ( "XML schema {} generation started" , targetXmlSchemaName + XSD_FILE_EXTENSION ) ; String xmlSchemaSource = cob2xsd . translate ( cobolReader , NamespaceUtils . toName...
Translate the COBOL copybook to XML Schema .
138,105
private Map < String , String > generateConverterClasses ( String xmlSchemaSource , String targetPackageName ) { log . debug ( "Converter support classes generation started" ) ; Map < String , String > codeMap = xsd2CobolTypes . generate ( new StringReader ( xmlSchemaSource ) , targetPackageName ) ; if ( log . isDebugE...
Produce the LegStar converter support classes .
138,106
private String generateAvroSchema ( String xmlSchemaSource , String targetPackageName , String targetAvroSchemaName ) throws IOException { log . debug ( "Avro schema {} generation started" , targetAvroSchemaName + AVSC_FILE_EXTENSION ) ; String avroSchemaSource = cob2AvroTranslator . translate ( new StringReader ( xmlS...
Produce the avro schema .
138,107
private void avroCompile ( String avroSchemaSource , File avroSchemaFile , File javaTargetFolder ) throws IOException { log . debug ( "Avro compiler started for: {}" , avroSchemaFile ) ; Schema . Parser parser = new Schema . Parser ( ) ; Schema schema = parser . parse ( avroSchemaSource ) ; SpecificCompiler compiler = ...
Given an Avro schema produce java specific classes .
138,108
public static TxConfig buildConfig ( final Class < ? > type , final Method method , final boolean useDefaults ) { final Transactional transactional = findAnnotation ( type , method , Transactional . class , useDefaults ) ; TxConfig res = null ; if ( transactional != null ) { final TxType txType = findAnnotation ( type ...
Build transaction config for type .
138,109
private static List < Class < ? extends Exception > > wrapExceptions ( final Class < ? extends Exception > ... list ) { return list . length == 0 ? null : Arrays . asList ( list ) ; }
Avoid creation of empty list .
138,110
public void setTitleGaps ( int gapBetweenIconAndTitle , int gapBetweenTitleAndComponents , int gapBetweenComponents ) { gapBetweenIconAndTitle = Math . max ( gapBetweenIconAndTitle , 0 ) ; gapBetweenTitleAndComponents = Math . max ( gapBetweenTitleAndComponents , 0 ) ; gapBetweenComponents = Math . max ( gapBetweenComp...
Defines the title gaps
138,111
public static void checkExec ( final boolean condition , final String message , final Object ... args ) { if ( ! condition ) { throw new MethodExecutionException ( String . format ( message , args ) ) ; } }
Shortcut to check and throw execution exception .
138,112
public static List < String > findVars ( final String str ) { final List < String > vars = new ArrayList < String > ( ) ; final char [ ] strArray = str . toCharArray ( ) ; int i = 0 ; while ( i < strArray . length - 1 ) { if ( strArray [ i ] == VAR_START && strArray [ i + 1 ] == VAR_LEFT_BOUND ) { i = i + 2 ; final int...
Analyze string for variables .
138,113
public static String replace ( final String str , final Map < String , String > params ) { final StringBuilder sb = new StringBuilder ( str . length ( ) ) ; final char [ ] strArray = str . toCharArray ( ) ; int i = 0 ; while ( i < strArray . length - 1 ) { if ( strArray [ i ] == VAR_START && strArray [ i + 1 ] == VAR_L...
Replace placeholders in string .
138,114
public static void validate ( final String string , final List < String > params ) { final List < String > vars = findVars ( string ) ; for ( String param : params ) { Preconditions . checkState ( vars . contains ( param ) , "Variable '%s' not found in target string '%s'" , param , string ) ; } vars . removeAll ( param...
Validate string variables and declared values for correctness .
138,115
private void expand ( boolean immediately ) { if ( locked == false && inAction == false && collapsed ) { inAction = true ; CollapsiblePanelListener [ ] array = listeners . getListeners ( CollapsiblePanelListener . class ) ; for ( CollapsiblePanelListener cpl : array ) { cpl . panelWillExpand ( new CollapsiblePanelEvent...
Expand the panel .
138,116
public void setReverseLayout ( boolean reverseLayout ) { if ( mPendingSavedState != null && mPendingSavedState . mReverseLayout != reverseLayout ) { mPendingSavedState . mReverseLayout = reverseLayout ; } if ( reverseLayout == mReverseLayout ) { return ; } mReverseLayout = reverseLayout ; requestLayout ( ) ; }
Used to reverse item traversal and layout order . This behaves similar to the layout change for RTL views . When set to true first item is rendered at the end of the UI second item is render before it etc .
138,117
public static void command ( final ODatabaseObject db , final String command , final Object ... args ) { db . command ( new OCommandSQL ( String . format ( command , args ) ) ) . execute ( ) ; }
Calls schema change sql command .
138,118
@ SuppressFBWarnings ( "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT" ) public static void dropIndex ( final ODatabaseObject db , final String indexName ) { db . getMetadata ( ) . getIndexManager ( ) . dropIndex ( indexName ) ; }
Drops named index . Safe to call even if index not exist .
138,119
private void configureCustomTypes ( ) { final Multibinder < OObjectSerializer > typesBinder = Multibinder . newSetBinder ( binder ( ) , OObjectSerializer . class ) ; if ( ! customTypes . isEmpty ( ) ) { for ( Class < ? extends OObjectSerializer > type : customTypes ) { bind ( type ) . in ( Singleton . class ) ; typesBi...
Binds registered custom types as guice singletons and register them with multibinder .
138,120
protected void loadOptionalPool ( final String poolBinder ) { try { final Method bindPool = OrientModule . class . getDeclaredMethod ( "bindPool" , Class . class , Class . class ) ; bindPool . setAccessible ( true ) ; try { Class . forName ( poolBinder ) . getConstructor ( OrientModule . class , Method . class , Binder...
Allows to load pool only if required jars are in classpath . For example no need for graph dependencies if only object db is used .
138,121
@ SuppressWarnings ( "unchecked" ) private static boolean isParametersCompatible ( final List < Class < ? > > params , final List < ParamInfo > ordinalParamInfos ) { boolean resolution = params . size ( ) == ordinalParamInfos . size ( ) ; if ( resolution && ! params . isEmpty ( ) ) { final Iterator < Class < ? > > para...
Checking method parameters compatibility .
138,122
public static ElDescriptor analyzeQuery ( final GenericsContext genericsContext , final String query ) { final List < String > vars = ElUtils . findVars ( query ) ; ElDescriptor descriptor = null ; if ( ! vars . isEmpty ( ) ) { descriptor = new ElDescriptor ( vars ) ; checkGenericVars ( descriptor , genericsContext ) ;...
Analyze query string for variables .
138,123
public static void check ( final boolean condition , final String message , final Object ... args ) { if ( ! condition ) { throw new MethodDefinitionException ( String . format ( message , args ) ) ; } }
Shortcut to check and throw definition exception .
138,124
private static Object jdk8 ( final Class < ? > type , final Object object ) { try { if ( jdk8OptionalFactory == null ) { lookupOptionalFactoryMethod ( type ) ; } return jdk8OptionalFactory . invoke ( null , object ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Failed to instantiate jdk Optional" , e )...
Only this will cause optional class loading and fail for earlier jdk .
138,125
public void setEngineConfigMap ( Map < String , Object > engineConfigMap ) { if ( engineConfigMap != null ) { this . engineConfig . putAll ( engineConfigMap ) ; } }
Set Rythm properties as Map to allow for non - String values like ds . resource . loader . instance .
138,126
public RythmEngine createRythmEngine ( ) throws IOException , RythmException { Map < String , Object > p = new HashMap < String , Object > ( ) ; p . put ( RythmConfigurationKey . ENGINE_PLUGIN_VERSION . getKey ( ) , Version . VALUE ) ; if ( this . configLocation != null ) { logger . info ( "Loading Rythm config from [%...
Prepare the RythmEngine instance and return it .
138,127
private static int getRecordLen ( byte [ ] hostData , int start , int length ) { int len = getRawRdw ( hostData , start , length ) ; if ( len < RDW_LEN || len > hostData . length ) { throw new IllegalArgumentException ( "Record does not start with a Record Descriptor Word" ) ; } return len - RDW_LEN ; }
RDW is a 4 bytes numeric stored in Big Endian as a binary 2 s complement .
138,128
public String translate ( XmlSchema xmlSchema , String avroNamespace , String avroSchemaName ) throws Xsd2AvroTranslatorException { log . debug ( "XML Schema to Avro Schema translator started" ) ; final Map < QName , XmlSchemaElement > items = xmlSchema . getElements ( ) ; ObjectNode rootAvroSchema = null ; final Array...
Translate the input XML Schema .
138,129
private void visit ( XmlSchema xmlSchema , final XmlSchemaElement xsdElement , final int level , final ArrayNode avroFields ) throws Xsd2AvroTranslatorException { if ( xsdElement . getRef ( ) . getTarget ( ) != null ) { return ; } log . debug ( "process started for element = " + xsdElement . getName ( ) ) ; if ( xsdEle...
Process a regular XML schema element .
138,130
private void visit ( XmlSchema xmlSchema , XmlSchemaComplexType xsdType , final int level , final ArrayNode avroFields ) { visit ( xmlSchema , xsdType . getParticle ( ) , level , avroFields ) ; }
Create an avro complex type field using an XML schema type .
138,131
private void visit ( XmlSchemaSimpleType xsdType , final int level , final String avroFieldName , long minOccurs , long maxOccurs , ArrayNode avroFields ) throws Xsd2AvroTranslatorException { Object avroType = getAvroPrimitiveType ( avroFieldName , xsdType , maxOccurs > 1 , minOccurs == 0 && maxOccurs == 1 ) ; ObjectNo...
Create an avro primitive type field using an XML schema type .
138,132
public static boolean isBigDecimal ( Schema schema ) { if ( Type . BYTES == schema . getType ( ) ) { JsonNode logicalTypeNode = schema . getJsonProp ( "logicalType" ) ; if ( logicalTypeNode != null && "decimal" . equals ( logicalTypeNode . asText ( ) ) ) { return true ; } } return false ; }
Tests whether a field is to be externalized as a BigDecimal
138,133
protected void configureAop ( ) { final RepositoryMethodInterceptor proxy = new RepositoryMethodInterceptor ( ) ; requestInjection ( proxy ) ; bindInterceptor ( Matchers . any ( ) , new AbstractMatcher < Method > ( ) { public boolean matches ( final Method method ) { try { return ExtUtils . findMethodAnnotation ( metho...
Configures repository annotations interceptor .
138,134
protected void bindExecutor ( final Class < ? extends RepositoryExecutor > executor ) { bind ( executor ) . in ( Singleton . class ) ; executorsMultibinder . addBinding ( ) . to ( executor ) ; }
Register executor for specific connection type .
138,135
protected void loadOptionalExecutor ( final String executorBinder ) { try { final Method bindExecutor = RepositoryModule . class . getDeclaredMethod ( "bindExecutor" , Class . class ) ; bindExecutor . setAccessible ( true ) ; try { Class . forName ( executorBinder ) . getConstructor ( RepositoryModule . class , Method ...
Allows to load executor only if required jars are in classpath . For example no need for graph dependencies if only object db is used .
138,136
public void setAdapter ( Adapter adapter ) { if ( mAdapter != null ) { mAdapter . unregisterAdapterDataObserver ( mObserver ) ; } if ( mItemAnimator != null ) { mItemAnimator . endAnimations ( ) ; } if ( mLayout != null ) { mLayout . removeAndRecycleAllViews ( mRecycler ) ; mLayout . removeAndRecycleScrapInt ( mRecycle...
Set a new adapter to provide child views on demand .
138,137
private void addAnimatingView ( View view ) { boolean alreadyAdded = false ; if ( mNumAnimatingViews > 0 ) { for ( int i = mAnimatingViewIndex ; i < getChildCount ( ) ; ++ i ) { if ( getChildAt ( i ) == view ) { alreadyAdded = true ; break ; } } } if ( ! alreadyAdded ) { if ( mNumAnimatingViews == 0 ) { mAnimatingViewI...
Adds a view to the animatingViews list . mAnimatingViews holds the child views that are currently being kept around purely for the purpose of being animated out of view . They are drawn as a regular part of the child list of the RecyclerView but they are invisible to the LayoutManager as they are managed separately fro...
138,138
private void removeAnimatingView ( View view ) { if ( mNumAnimatingViews > 0 ) { for ( int i = mAnimatingViewIndex ; i < getChildCount ( ) ; ++ i ) { if ( getChildAt ( i ) == view ) { removeViewAt ( i ) ; -- mNumAnimatingViews ; if ( mNumAnimatingViews == 0 ) { mAnimatingViewIndex = - 1 ; } mRecycler . recycleView ( vi...
Removes a view from the animatingViews list .
138,139
void scrollByInternal ( int x , int y ) { int overscrollX = 0 , overscrollY = 0 ; consumePendingUpdateOperations ( ) ; if ( mAdapter != null ) { eatRequestLayout ( ) ; if ( x != 0 ) { final int hresult = mLayout . scrollHorizontallyBy ( x , mRecycler , mState ) ; overscrollX = x - hresult ; } if ( y != 0 ) { final int ...
Does not perform bounds checking . Used by internal methods that have already validated input .
138,140
public boolean fling ( int velocityX , int velocityY ) { if ( Math . abs ( velocityX ) < mMinFlingVelocity ) { velocityX = 0 ; } if ( Math . abs ( velocityY ) < mMinFlingVelocity ) { velocityY = 0 ; } velocityX = Math . max ( - mMaxFlingVelocity , Math . min ( velocityX , mMaxFlingVelocity ) ) ; velocityY = Math . max ...
Begin a standard fling with an initial velocity along each axis in pixels per second . If the velocity given is below the system - defined minimum this method will return false and no fling will occur .
138,141
private void pullGlows ( int overscrollX , int overscrollY ) { if ( overscrollX < 0 ) { if ( mLeftGlow == null ) { mLeftGlow = new EdgeEffectCompat ( getContext ( ) ) ; mLeftGlow . setSize ( getMeasuredHeight ( ) - getPaddingTop ( ) - getPaddingBottom ( ) , getMeasuredWidth ( ) - getPaddingLeft ( ) - getPaddingRight ( ...
Apply a pull to relevant overscroll glow effects
138,142
void viewRangeUpdate ( int positionStart , int itemCount ) { final int childCount = getChildCount ( ) ; final int positionEnd = positionStart + itemCount ; for ( int i = 0 ; i < childCount ; i ++ ) { final ViewHolder holder = getChildViewHolderInt ( getChildAt ( i ) ) ; if ( holder == null ) { continue ; } final int po...
Rebind existing views for the given range or create as needed .
138,143
void markKnownViewsInvalid ( ) { final int childCount = getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { final ViewHolder holder = getChildViewHolderInt ( getChildAt ( i ) ) ; if ( holder != null ) { holder . addFlags ( ViewHolder . FLAG_UPDATE | ViewHolder . FLAG_INVALID ) ; } } mRecycler . markKnownVie...
Mark all known views as invalid . Used in response to a the whole world might have changed data change event .
138,144
void postAdapterUpdate ( UpdateOp op ) { mPendingUpdates . add ( op ) ; if ( mPendingUpdates . size ( ) == 1 ) { if ( mPostUpdatesOnAnimation && mHasFixedSize && mIsAttached ) { ViewCompat . postOnAnimation ( this , mUpdateChildViewsRunnable ) ; } else { mAdapterUpdateDuringMeasure = true ; requestLayout ( ) ; } } }
Schedule an update of data from the adapter to occur on the next frame . On newer platform versions this happens via the postOnAnimation mechanism and RecyclerView attempts to avoid relayouts if possible . On older platform versions the RecyclerView requests a layout the same way ListView does .
138,145
public int getChildPosition ( View child ) { final ViewHolder holder = getChildViewHolderInt ( child ) ; return holder != null ? holder . getPosition ( ) : NO_POSITION ; }
Return the adapter position that the given child view corresponds to .
138,146
public long getChildItemId ( View child ) { if ( mAdapter == null || ! mAdapter . hasStableIds ( ) ) { return NO_ID ; } final ViewHolder holder = getChildViewHolderInt ( child ) ; return holder != null ? holder . getItemId ( ) : NO_ID ; }
Return the stable item id that the given child view corresponds to .
138,147
public View findChildViewUnder ( float x , float y ) { final int count = getChildCount ( ) ; for ( int i = count - 1 ; i >= 0 ; i -- ) { final View child = getChildAt ( i ) ; final float translationX = ViewCompat . getTranslationX ( child ) ; final float translationY = ViewCompat . getTranslationY ( child ) ; if ( x >=...
Find the topmost view under the given point .
138,148
protected int getHorizontalSnapPreference ( ) { return mTargetVector == null || mTargetVector . x == 0 ? SNAP_TO_ANY : mTargetVector . x > 0 ? SNAP_TO_END : SNAP_TO_START ; }
When scrolling towards a child view this method defines whether we should align the left or the right edge of the child with the parent RecyclerView .
138,149
protected int getVerticalSnapPreference ( ) { return mTargetVector == null || mTargetVector . y == 0 ? SNAP_TO_ANY : mTargetVector . y > 0 ? SNAP_TO_END : SNAP_TO_START ; }
When scrolling towards a child view this method defines whether we should align the top or the bottom edge of the child with the parent RecyclerView .
138,150
protected void updateActionForInterimTarget ( Action action ) { PointF scrollVector = computeScrollVectorForPosition ( getTargetPosition ( ) ) ; if ( scrollVector == null || ( scrollVector . x == 0 && scrollVector . y == 0 ) ) { Log . e ( TAG , "To support smooth scrolling, you should override \n" + "LayoutManager#comp...
When the target scroll position is not a child of the RecyclerView this method calculates a direction vector towards that child and triggers a smooth scroll .
138,151
public int calculateDyToMakeVisible ( View view , int snapPreference ) { final RecyclerView . LayoutManager layoutManager = getLayoutManager ( ) ; if ( ! layoutManager . canScrollVertically ( ) ) { return 0 ; } final RecyclerView . LayoutParams params = ( RecyclerView . LayoutParams ) view . getLayoutParams ( ) ; final...
Calculates the vertical scroll amount necessary to make the given view fully visible inside the RecyclerView .
138,152
public int calculateDxToMakeVisible ( View view , int snapPreference ) { final RecyclerView . LayoutManager layoutManager = getLayoutManager ( ) ; if ( ! layoutManager . canScrollHorizontally ( ) ) { return 0 ; } final RecyclerView . LayoutParams params = ( RecyclerView . LayoutParams ) view . getLayoutParams ( ) ; fin...
Calculates the horizontal scroll amount necessary to make the given view fully visible inside the RecyclerView .
138,153
private Class < ? > resolveTargetType ( final Class < ? > listenerType , final Class < ? > declaredTargetType ) { Class < ? > target = null ; if ( RequiresRecordConversion . class . isAssignableFrom ( listenerType ) ) { target = GenericsResolver . resolve ( listenerType ) . type ( RequiresRecordConversion . class ) . g...
Resolve target conversion type either from listener instance or if its not possible from listener parameter declaration .
138,154
public static String methodToString ( final Class < ? > type , final Method method ) { final StringBuilder res = new StringBuilder ( ) ; res . append ( type . getSimpleName ( ) ) . append ( '#' ) . append ( method . getName ( ) ) . append ( '(' ) ; int i = 0 ; for ( Class < ? > param : method . getParameterTypes ( ) ) ...
Converts method signature to human readable string .
138,155
public static void checkParamExtensionCompatibility ( final Class < ? extends RepositoryMethodDescriptor > descriptorType , final Class < ? extends MethodParamExtension > paramExtType ) { check ( isCompatible ( paramExtType , MethodParamExtension . class , descriptorType ) , "Param extension %s is incompatible with des...
Checks that parameter extension is compatible with descriptor and throws error if extension incompatible .
138,156
public static void checkAmendExtensionsCompatibility ( final Class < ? extends RepositoryMethodDescriptor > descriptorType , final List < Annotation > extensions ) { final List < Class < ? extends AmendMethodExtension > > exts = Lists . transform ( extensions , new Function < Annotation , Class < ? extends AmendMethodE...
Checks that amend extensions strictly compatible with descriptor object . Used for amend annotations defined on method .
138,157
public static List < AmendExecutionExtension > filterCompatibleExtensions ( final List < AmendExecutionExtension > extensions , final Class < ? extends RepositoryMethodDescriptor > descriptorType ) { @ SuppressWarnings ( "unchecked" ) final Class < ? extends AmendExecutionExtension > supportedExtension = ( Class < ? ex...
Checks resolved amend extensions compatibility with method specific extension type . Extension may be universal and support some methods and doesn t support other .
138,158
public void disposeTooltip ( ) { if ( popup != null ) { timer . stop ( ) ; popup . setVisible ( false ) ; popup = null ; } }
Dispose the tooltip
138,159
private void showTooltip ( ) { Wrap tooltipLabel = new Wrap ( toolTipWrapWidth ) ; tooltipLabel . setForeground ( getForeground ( ) ) ; tooltipLabel . setFont ( ToolTipButton . this . getFont ( ) ) ; tooltipLabel . setText ( text ) ; JPanel panel = new JPanel ( ) ; panel . setBackground ( toolTipBackground ) ; panel . ...
Show the tooltip .
138,160
public static Collection < MatchedMethod > filterByClosestParams ( final Collection < MatchedMethod > possibilities , final int paramsCount ) { Collection < MatchedMethod > res = null ; for ( int i = 0 ; i < paramsCount ; i ++ ) { final Collection < MatchedMethod > filtered = filterByParam ( possibilities , i ) ; if ( ...
Looks for most specific type for each parameter .
138,161
private ODatabaseDocument checkAndAcquireConnection ( ) { final ODatabaseDocument res ; if ( userManager . isSpecificUser ( ) ) { res = orientDB . get ( ) . open ( database , userManager . getUser ( ) , userManager . getPassword ( ) ) ; } else { res = pool . acquire ( ) ; } if ( res . isClosed ( ) ) { final String mess...
Its definitely not normal that pool returns closed connections but possible if used improperly .
138,162
public static void trackIdChange ( final ODocument document , final Object pojo ) { if ( document . getIdentity ( ) . isNew ( ) ) { ORecordInternal . addIdentityChangeListener ( document , new OIdentityChangeListener ( ) { public void onBeforeIdentityChange ( final ORecord record ) { } public void onAfterIdentityChange...
When just created object is detached to pure pojo it gets temporary id . Real id is assigned only after transaction commit . This method tracks original document intercepts its id change and sets correct id and version into pojo . So it become safe to use such pojo id outside of transaction .
138,163
private static Field findIdField ( final Object value ) { Field res = null ; final Class < ? > type = value . getClass ( ) ; if ( ODatabaseRecordThreadLocal . instance ( ) . isDefined ( ) ) { res = OObjectEntitySerializer . getIdField ( type ) ; } else { final String idField = OObjectSerializerHelper . getObjectIDField...
Core orient field resolve method relies on bound connection but it may be required to resolve id outside of transaction . So we use orient method under transaction and do manual scan outside of transaction .
138,164
private static Component getCurrentModal_ ( RootPaneContainer rootPane ) { synchronized ( modals ) { Modal modal = modals . get ( rootPane ) ; if ( modal != null ) { if ( modal . getSize ( ) > 0 ) { return modal . components . get ( modal . components . size ( ) - 1 ) ; } } return null ; } }
Get the current modal component of a specific RootPaneContainer .
138,165
private static void closeCurrentModal_ ( RootPaneContainer rootPane ) { synchronized ( modals ) { Modal modal = modals . get ( rootPane ) ; if ( modal != null ) { modal . closeCurrent ( ) ; if ( modal . getSize ( ) == 0 ) { modals . remove ( rootPane ) ; } } } }
Close the current modal component of a specific RootPaneContainer .
138,166
public static void closeModal ( Component component ) { synchronized ( modals ) { RootPaneContainer frame = null ; Modal modal = null ; Iterator < Entry < RootPaneContainer , Modal > > it = modals . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Entry < RootPaneContainer , Modal > entry = it . next ( ) ; mo...
Close a specific modal component .
138,167
private static void closeAllModals_ ( RootPaneContainer rootPane ) { synchronized ( modals ) { Modal modal = modals . get ( rootPane ) ; if ( modal != null ) { modal . closeAll ( ) ; modals . remove ( rootPane ) ; } } }
Close all modals of a specific RootPaneContainer .
138,168
private static boolean hasModal_ ( RootPaneContainer rootPane ) { synchronized ( modals ) { Modal modal = modals . get ( rootPane ) ; if ( modal != null && modal . getSize ( ) > 0 ) { return true ; } return false ; } }
Indicates whether the RootPaneContainer has a modal .
138,169
private static Modal getModal ( RootPaneContainer rootPane ) { synchronized ( modals ) { Modal modal = modals . get ( rootPane ) ; if ( modal == null ) { modal = new Modal ( rootPane ) ; modals . put ( rootPane , modal ) ; } return modal ; } }
Get the modal of a specific frame
138,170
public static boolean isModal ( Component component ) { synchronized ( modals ) { Iterator < Entry < RootPaneContainer , Modal > > it = modals . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Entry < RootPaneContainer , Modal > entry = it . next ( ) ; if ( entry . getValue ( ) . components . contains ( comp...
Indicates whether the component is a modal component .
138,171
public static void addModal ( JInternalFrame frame , Component component , ModalListener listener ) { addModal_ ( frame , component , listener , defaultModalDepth ) ; }
Add a modal component in the internal frame .
138,172
public static void addModal ( JFrame frame , Component component , ModalListener listener , Integer modalDepth ) { addModal_ ( frame , component , listener , modalDepth ) ; }
Add a modal component in the frame .
138,173
private static void addModal_ ( RootPaneContainer rootPane , Component component , ModalListener listener , Integer modalDepth ) { synchronized ( modals ) { if ( isModal ( component ) == false ) { getModal ( rootPane ) . addModal ( component , listener , modalDepth ) ; } } }
Add a modal component in the RootPaneContainer .
138,174
private static int getModalCount_ ( RootPaneContainer rootPane ) { synchronized ( modals ) { Modal modal = modals . get ( rootPane ) ; if ( modal != null ) { return modal . getSize ( ) ; } return 0 ; } }
Get the modal count of a specific RootPaneContainer .
138,175
private void closeCurrent ( ) { if ( components . size ( ) > 0 ) { Component component = components . remove ( components . size ( ) - 1 ) ; getModalPanel ( ) . removeAll ( ) ; fireCloseActionListener ( listeners . get ( component ) ) ; listeners . remove ( component ) ; if ( components . size ( ) > 0 ) { showNextCompo...
Close the current modal .
138,176
private void close ( Component component ) { if ( components . size ( ) > 0 ) { if ( components . contains ( component ) == false ) { return ; } components . remove ( component ) ; depths . remove ( component ) ; getModalPanel ( ) . removeAll ( ) ; fireCloseActionListener ( listeners . get ( component ) ) ; listeners ....
Close a modal
138,177
private void closeAll ( ) { getModalPanel ( ) . removeAll ( ) ; components . clear ( ) ; depths . clear ( ) ; listeners . clear ( ) ; restoreRootPane ( ) ; }
Close all modals .
138,178
private void addModal ( Component component , ModalListener listener , Integer modalDepth ) { if ( modalDepth == null ) { modalDepth = defaultModalDepth ; } if ( components . contains ( component ) == false ) { rootPane . getLayeredPane ( ) . remove ( getModalPanel ( ) ) ; rootPane . getLayeredPane ( ) . add ( getModal...
Add a modal component
138,179
private ModalPanel getModalPanel ( ) { if ( modalPanel == null ) { modalPanel = new ModalPanel ( ) ; modalPanel . setLayout ( new ModalLayout ( ) ) ; } return modalPanel ; }
Get the transparent modal panel
138,180
public static RootPaneContainer getRootPaneContainer ( Component component ) { if ( component instanceof RootPaneContainer ) { return ( RootPaneContainer ) component ; } for ( Container p = component . getParent ( ) ; p != null ; p = p . getParent ( ) ) { if ( p instanceof RootPaneContainer ) { return ( RootPaneContain...
Get the RootPaneContainer of the specific component .
138,181
public static ResultDescriptor analyzeReturnType ( final DescriptorContext context , final Class < ? extends Collection > returnCollectionType ) { final Method method = context . method ; final MethodGenericsContext generics = context . generics . method ( method ) ; final Class < ? > returnClass = generics . resolveRe...
Analyze return type .
138,182
protected void recycleByRenderState ( RecyclerView . Recycler recycler , RenderState renderState ) { if ( renderState . mLayoutDirection == RenderState . LAYOUT_START ) { recycleViewsFromEnd ( recycler , renderState . mScrollingOffset ) ; } else { recycleViewsFromStart ( recycler , renderState . mScrollingOffset ) ; } ...
Helper method to call appropriate recycle method depending on current render layout direction
138,183
public static void check ( final Object result , final Class < ? > targetType ) { if ( result != null && ! targetType . isAssignableFrom ( result . getClass ( ) ) ) { throw new ResultConversionException ( String . format ( "Failed to convert %s to %s" , toStringType ( result ) , targetType . getSimpleName ( ) ) ) ; } }
Check converted result compatibility with required type .
138,184
@ SuppressWarnings ( "unchecked" ) public static Object convertToCollection ( final Object result , final Class collectionType , final Class targetEntity , final boolean projection ) { final Object converted ; if ( collectionType . equals ( Iterator . class ) ) { converted = toIterator ( result , targetEntity , project...
Convert result object to collection . In some cases this could be do nothing case because orient already returns collection . If projection is required or when collection type is different from requested type result will be re - packaged into the new collection .
138,185
@ SuppressWarnings ( "PMD.LooseCoupling" ) public static Object convertToArray ( final Object result , final Class entityType , final boolean projection ) { final Collection res = result instanceof Collection ? ( Collection ) result : convertToCollectionImpl ( result , ArrayList . class , entityType , false ) ; final O...
Convert result object to array .
138,186
public static void check ( final boolean condition , final String message , final Object ... args ) { if ( ! condition ) { throw new SchemeInitializationException ( String . format ( message , args ) ) ; } }
Shortcut to check and throw scheme exception .
138,187
public < T > T doInTransaction ( final TxConfig config , final TxAction < T > action ) { return txTemplate . doInTransaction ( config , action ) ; }
Execute action within transaction .
138,188
public boolean collapsePanel ( ) { if ( mFirstLayout ) { mSlideState = SlideState . COLLAPSED ; return true ; } else { if ( mSlideState == SlideState . HIDDEN || mSlideState == SlideState . COLLAPSED ) return false ; return collapsePanel ( mSlideableView , 0 ) ; } }
Collapse the sliding pane if it is currently slideable . If first layout has already completed this will animate .
138,189
public boolean expandPanel ( float mSlideOffset ) { if ( mSlideableView == null || mSlideState == SlideState . EXPANDED ) return false ; mSlideableView . setVisibility ( View . VISIBLE ) ; return expandPanel ( mSlideableView , 0 , mSlideOffset ) ; }
Partially expand the sliding panel up to a specific offset
138,190
public void showPanel ( ) { if ( mFirstLayout ) { mSlideState = SlideState . COLLAPSED ; } else { if ( mSlideableView == null || mSlideState != SlideState . HIDDEN ) return ; mSlideableView . setVisibility ( View . VISIBLE ) ; requestLayout ( ) ; smoothSlideTo ( 0 , 0 ) ; } }
Shows the panel from the hidden state
138,191
public void hidePanel ( ) { if ( mFirstLayout ) { mSlideState = SlideState . HIDDEN ; } else { if ( mSlideState == SlideState . DRAGGING || mSlideState == SlideState . HIDDEN ) return ; int newTop = computePanelTopPosition ( 0.0f ) ; smoothSlideTo ( computeSlideOffset ( newTop ) , 0 ) ; } }
Hides the sliding panel entirely .
138,192
boolean smoothSlideTo ( float slideOffset , int velocity ) { if ( ! isSlidingEnabled ( ) ) { return false ; } int panelTop = computePanelTopPosition ( slideOffset ) ; if ( mDragHelper . smoothSlideViewTo ( mSlideableView , mSlideableView . getLeft ( ) , panelTop ) ) { setAllChildrenVisible ( ) ; ViewCompat . postInvali...
Smoothly animate mDraggingPane to the target X position within its range .
138,193
public static UnsubscribeMessage createCleanupMessage ( WebSocketSession session ) { UnsubscribeMessage msg = new UnsubscribeMessage ( "**" ) ; msg . setWebSocketSessionId ( session . getId ( ) ) ; msg . setPrincipal ( session . getPrincipal ( ) ) ; msg . setWampSession ( new WampSession ( session ) ) ; msg . cleanup =...
Creates an internal unsubscribe message . The system creates this message when the WebSocket session ends and sends it to the subscribed message handlers for cleaning up
138,194
public static long [ ] parseCoins ( long value ) { long [ ] result = new long [ 3 ] ; if ( value < 0 ) return result ; long temp = value ; result [ 2 ] = temp % 100 ; temp = temp / 100 ; result [ 1 ] = temp % 100 ; result [ 0 ] = temp / 100 ; return result ; }
parse given coin value into number of gold sliver and copper
138,195
public void handleMessageFromClient ( WebSocketSession session , WebSocketMessage < ? > webSocketMessage , MessageChannel outputChannel ) { Assert . isInstanceOf ( TextMessage . class , webSocketMessage ) ; WampMessage wampMessage = null ; try { wampMessage = WampMessage . fromJson ( session , this . jsonFactory , ( ( ...
Handle incoming WebSocket messages from clients .
138,196
public void handleMessageToClient ( WebSocketSession session , Message < ? > message ) { if ( ! ( message instanceof WampMessage ) ) { logger . error ( "Expected WampMessage. Ignoring " + message + "." ) ; return ; } boolean closeWebSocketSession = false ; try { String json = ( ( WampMessage ) message ) . toJson ( this...
Handle WAMP messages going back out to WebSocket clients .
138,197
private Set < Field > getItemFields ( ) { Class next = Item . class ; Set < Field > fields = new HashSet < > ( getFields ( next ) ) ; while ( next . getSuperclass ( ) != Object . class ) { next = next . getSuperclass ( ) ; fields . addAll ( getFields ( next ) ) ; } return fields ; }
get all fields for item class and all of it s super classes
138,198
private List < Field > getFields ( Class given ) { Field [ ] fs = given . getDeclaredFields ( ) ; return new ArrayList < > ( Arrays . asList ( fs ) ) ; }
get field of given class
138,199
public static void setInstance ( Cache cache ) throws GuildWars2Exception { if ( instance != null ) throw new GuildWars2Exception ( ErrorCode . Other , "Instance already initialized" ) ; instance = new GuildWars2 ( cache ) ; }
Use this to initialize instance with custom cache