idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
8,400
public static void dissociateAll ( BaseUIComponent component ) { for ( Command command : CommandRegistry . getInstance ( ) ) { command . unbind ( component ) ; } }
Removes all command bindings for a component .
40
9
8,401
public static Command getCommand ( String commandName , boolean forceCreate ) { return CommandRegistry . getInstance ( ) . get ( commandName , forceCreate ) ; }
Returns a command from the command registry .
35
8
8,402
private static void addShortcut ( StringBuilder sb , Set < String > shortcuts ) { if ( sb . length ( ) > 0 ) { String shortcut = validateShortcut ( sb . toString ( ) ) ; if ( shortcut != null ) { shortcuts . add ( shortcut ) ; } sb . delete ( 0 , sb . length ( ) ) ; } }
Adds a parsed shortcut to the set of shortcuts . Only valid shortcuts are added .
79
16
8,403
private File resolveIndexDirectoryPath ( ) throws IOException { if ( StringUtils . isEmpty ( indexDirectoryPath ) ) { indexDirectoryPath = System . getProperty ( "java.io.tmpdir" ) + appContext . getApplicationName ( ) ; } File dir = new File ( indexDirectoryPath , getClass ( ) . getPackage ( ) . getName ( ) ) ; if ( !...
Resolves the index directory path . If a path is not specified one is created within temporary storage .
138
20
8,404
@ Override public void indexHelpModule ( HelpModule helpModule ) { try { if ( indexTracker . isSame ( helpModule ) ) { return ; } unindexHelpModule ( helpModule ) ; log . info ( "Indexing help module " + helpModule . getLocalizedId ( ) ) ; int i = helpModule . getUrl ( ) . lastIndexOf ( ' ' ) ; String pattern = "classp...
Index all HTML files within the content of the help module .
176
12
8,405
@ Override public void unindexHelpModule ( HelpModule helpModule ) { try { log . info ( "Removing index for help module " + helpModule . getLocalizedId ( ) ) ; Term term = new Term ( "module" , helpModule . getLocalizedId ( ) ) ; writer . deleteDocuments ( term ) ; writer . commit ( ) ; indexTracker . remove ( helpModu...
Removes the index for a help module .
107
9
8,406
private void indexDocument ( HelpModule helpModule , Resource resource ) throws Exception { String title = getTitle ( resource ) ; try ( InputStream is = resource . getInputStream ( ) ) { Document document = new Document ( ) ; document . add ( new TextField ( "module" , helpModule . getLocalizedId ( ) , Store . YES ) )...
Index an HTML text file resource .
190
7
8,407
private String getTitle ( Resource resource ) { String title = null ; try ( InputStream is = resource . getInputStream ( ) ) { Iterator < String > iter = IOUtils . lineIterator ( is , "UTF-8" ) ; while ( iter . hasNext ( ) ) { String line = iter . next ( ) . trim ( ) ; String lower = line . toLowerCase ( ) ; int i = lo...
Extract the title of the document if any .
205
10
8,408
@ Override public void search ( String words , Collection < IHelpSet > helpSets , IHelpSearchListener listener ) { try { if ( queryBuilder == null ) { initQueryBuilder ( ) ; } Query searchForWords = queryBuilder . createBooleanQuery ( "content" , words , Occur . MUST ) ; Query searchForModules = queryBuilder . createBo...
Performs a search query using the specified string on each registered query handler calling the listener for each set of results .
319
23
8,409
public void init ( ) throws IOException { File path = resolveIndexDirectoryPath ( ) ; indexTracker = new IndexTracker ( path ) ; indexDirectory = FSDirectory . open ( path ) ; tika = new Tika ( null , new HtmlParser ( ) ) ; Analyzer analyzer = new StandardAnalyzer ( ) ; IndexWriterConfig config = new IndexWriterConfig ...
Initialize the index writer .
103
6
8,410
private synchronized void initQueryBuilder ( ) throws IOException { if ( queryBuilder == null ) { indexReader = DirectoryReader . open ( indexDirectory ) ; indexSearcher = new IndexSearcher ( indexReader ) ; queryBuilder = new QueryBuilder ( writer . getAnalyzer ( ) ) ; } }
Performs a delayed initialization of the query builder to ensure that the index has been fully created .
63
19
8,411
public static AlertContainer render ( BaseComponent parent , BaseComponent child ) { AlertContainer container = new AlertContainer ( child ) ; parent . addChild ( container , 0 ) ; return container ; }
Renders an alert in its container .
40
8
8,412
@ Override public void doAction ( Action action ) { BaseComponent parent = getParent ( ) ; switch ( action ) { case REMOVE : ActionListener . unbindActionListeners ( this , actionListeners ) ; detach ( ) ; break ; case HIDE : case COLLAPSE : setVisible ( false ) ; break ; case SHOW : case EXPAND : setVisible ( true ) ;...
Perform the specified action on the drop container . Also notifies the container s parent that an action has occurred .
135
23
8,413
public void assertSubscriptions ( ) { for ( String channel : subscribers . keySet ( ) ) { try { subscribers . put ( channel , null ) ; subscribe ( channel ) ; } catch ( Throwable e ) { break ; } } }
Reassert subscriptions .
51
4
8,414
public void removeSubscriptions ( ) { for ( TopicSubscriber subscriber : subscribers . values ( ) ) { try { subscriber . close ( ) ; } catch ( Throwable e ) { log . debug ( "Error closing subscriber" , e ) ; //is level appropriate - previously hidden exception -afranken } } subscribers . clear ( ) ; }
Remove all remote subscriptions .
74
5
8,415
public String getCaption ( ) { return caption != null && caption . toLowerCase ( ) . startsWith ( "label:" ) ? StrUtil . getLabel ( caption . substring ( 6 ) ) : caption ; }
Returns the value of the button s caption text .
48
10
8,416
public Element createDOMNode ( Element parent ) { Element domNode = parent . getOwnerDocument ( ) . createElement ( tagName ) ; LayoutUtil . copyAttributes ( attributes , domNode ) ; parent . appendChild ( domNode ) ; return domNode ; }
Creates a DOM node from this layout node .
56
10
8,417
public void reset ( ) throws IOException { if ( t1 == null || t2 == null ) { throw new IllegalStateException ( "Cannot reset after close." ) ; } if ( ! isEmpty ( getOutput ( ) ) ) { toggle = ! toggle ; // reset the new output PathTools . deleteRecursive ( getOutput ( ) , false ) ; } else { throw new IOException ( "Cann...
Resets the input and output folder before writing to the output again
97
13
8,418
public void close ( ) throws IOException { if ( t1 == null || t2 == null ) { return ; } try { if ( ! isEmpty ( getOutput ( ) ) ) { Optional < ? extends IOException > ex = output . apply ( getOutput ( ) ) ; if ( ex . isPresent ( ) ) { throw ex . get ( ) ; } } else if ( ! isEmpty ( getInput ( ) ) ) { Optional < ? extends...
Process the result with the output function and then closes the temporary folders . Closing the TempFolderHandler is a mandatory last step after which no other calls to the object should be made .
182
36
8,419
public void setDetail ( String name , Object value ) { if ( value == null ) { details . remove ( name ) ; } else { details . put ( name , value ) ; } if ( log . isDebugEnabled ( ) ) { if ( value == null ) { log . debug ( "Detail removed: " + name ) ; } else { log . debug ( "Detail added: " + name + " = " + value ) ; } ...
Sets the specified detail element to the specified value .
98
11
8,420
public Object getDetail ( String name ) { return name == null ? null : details . get ( name ) ; }
Returns the specified detail element .
25
6
8,421
public void init ( ) { IUser user = SecurityUtil . getAuthenticatedUser ( ) ; publisherInfo . setUserId ( user == null ? null : user . getLogicalId ( ) ) ; publisherInfo . setUserName ( user == null ? "" : user . getFullName ( ) ) ; publisherInfo . setAppName ( getAppName ( ) ) ; publisherInfo . setConsumerId ( consume...
Initialize after setting all requisite properties .
173
8
8,422
@ Override public void fireRemoteEvent ( String eventName , Serializable eventData , Recipient ... recipients ) { Message message = new EventMessage ( eventName , eventData ) ; producer . publish ( EventUtil . getChannelName ( eventName ) , message , recipients ) ; }
Queues the specified event for delivery via the messaging service .
60
12
8,423
protected String getAppName ( ) { if ( appName == null && FrameworkUtil . isInitialized ( ) ) { setAppName ( FrameworkUtil . getAppName ( ) ) ; } return appName ; }
Returns the application name .
46
5
8,424
public static HelpViewerMode getViewerMode ( Page page ) { return page == null || ! page . hasAttribute ( EMBEDDED_ATTRIB ) ? defaultMode : ( HelpViewerMode ) page . getAttribute ( EMBEDDED_ATTRIB ) ; }
Returns the help viewer mode for the specified page .
63
10
8,425
public static void setViewerMode ( Page page , HelpViewerMode mode ) { if ( getViewerMode ( page ) != mode ) { removeViewer ( page , true ) ; } page . setAttribute ( EMBEDDED_ATTRIB , mode ) ; }
Sets the help viewer mode for the specified page . If different from the previous mode and a viewer for this page exists the viewer will be removed and recreated on the next request .
60
37
8,426
public static IHelpViewer getViewer ( boolean forceCreate ) { Page page = getPage ( ) ; IHelpViewer viewer = ( IHelpViewer ) page . getAttribute ( VIEWER_ATTRIB ) ; return viewer != null ? viewer : forceCreate ? createViewer ( page ) : null ; }
Returns an instance of the viewer for the current page . If no instance yet exists and forceCreate is true one is created .
68
25
8,427
private static IHelpViewer createViewer ( Page page ) { IHelpViewer viewer ; if ( getViewerMode ( page ) == HelpViewerMode . POPUP ) { viewer = new HelpViewerProxy ( page ) ; } else { BaseComponent root = PageUtil . createPage ( VIEWER_URL , page ) . get ( 0 ) ; viewer = ( IHelpViewer ) root . getAttribute ( "controlle...
Creates an instance of the help viewer associating it with the specified page .
115
16
8,428
protected static void removeViewer ( Page page , boolean close ) { IHelpViewer viewer = ( IHelpViewer ) page . removeAttribute ( VIEWER_ATTRIB ) ; if ( viewer != null && close ) { viewer . close ( ) ; } }
Remove and optionally close the help viewer associated with the specified page .
56
13
8,429
protected static void removeViewer ( Page page , IHelpViewer viewer , boolean close ) { if ( viewer != null && viewer == page . getAttribute ( VIEWER_ATTRIB ) ) { removeViewer ( page , close ) ; } }
Remove and optionally close the specified help viewer if is the active viewer for the specified page .
53
18
8,430
public static String getUrl ( String path ) { if ( path == null ) { return path ; } ServletContext sc = ExecutionContext . getSession ( ) . getServletContext ( ) ; if ( path . startsWith ( "jar:" ) ) { int i = path . indexOf ( "!" ) ; path = i < 0 ? path : path . substring ( ++ i ) ; } path = sc . getContextPath ( ) + ...
Returns a URL string representing the root path and context path .
100
12
8,431
public static void show ( String module , String topic , String label ) { getViewer ( true ) . show ( module , topic , label ) ; }
Show help for the given module and optional topic .
32
10
8,432
public static void showCSH ( BaseComponent component ) { while ( component != null ) { HelpContext target = ( HelpContext ) component . getAttribute ( CSH_TARGET ) ; if ( target != null ) { HelpUtil . show ( target ) ; break ; } component = component . getParent ( ) ; } }
Display context - sensitive help associated with the specified component . If none is associated with the component its parent is examined and so on . If no help association is found no action is taken .
69
37
8,433
public static void associateCSH ( BaseUIComponent component , HelpContext helpContext , BaseUIComponent commandTarget ) { if ( component != null ) { component . setAttribute ( CSH_TARGET , helpContext ) ; CommandUtil . associateCommand ( "help" , component , commandTarget ) ; } }
Associates context - sensitive help topic with a component . Any existing association is replaced .
69
18
8,434
public static void dissociateCSH ( BaseUIComponent component ) { if ( component != null && component . hasAttribute ( CSH_TARGET ) ) { CommandUtil . dissociateCommand ( "help" , component ) ; component . removeAttribute ( CSH_TARGET ) ; } }
Dissociates context - sensitive help from a component .
64
12
8,435
public static void subtract ( double [ ] array1 , double [ ] array2 ) { assert ( array1 . length == array2 . length ) ; for ( int i = 0 ; i < array1 . length ; i ++ ) { array1 [ i ] -= array2 [ i ] ; } }
Each element of the second array is subtracted from each element of the first .
63
16
8,436
public static void multiply ( double [ ] array1 , double [ ] array2 ) { assert ( array1 . length == array2 . length ) ; for ( int i = 0 ; i < array1 . length ; i ++ ) { array1 [ i ] *= array2 [ i ] ; } }
Each element of the second array is multiplied with each element of the first .
64
15
8,437
public static void divide ( double [ ] array1 , double [ ] array2 ) { assert ( array1 . length == array2 . length ) ; for ( int i = 0 ; i < array1 . length ; i ++ ) { array1 [ i ] /= array2 [ i ] ; } }
Each element of the first array is divided by each element of the second .
64
15
8,438
public static int indexOf ( double [ ] array , double val ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == val ) { return i ; } } return - 1 ; }
Gets the first index of a given value in an array or - 1 if not present .
52
19
8,439
public static int lastIndexOf ( double [ ] array , double val ) { for ( int i = array . length - 1 ; i >= 0 ; i -- ) { if ( array [ i ] == val ) { return i ; } } return - 1 ; }
Gets the last index of a given value in an array or - 1 if not present .
55
19
8,440
public static Provider < String > getPropertyProvider ( Binder binder , String propertyName ) { return binder . getProvider ( getPropertyKey ( propertyName ) ) ; }
Obtains property provider
37
4
8,441
public static Provider < String > bindDefault ( Binder binder , String propertyName , String defaultValue ) { Key < String > propertyKey = getPropertyKey ( propertyName ) ; OptionalBinder < String > optionalBinder = OptionalBinder . newOptionalBinder ( binder , propertyKey ) ; optionalBinder . setDefault ( ) . toInstan...
Binds default value to specified property
92
7
8,442
public static < T > Collector < T , List < T > > toList ( ) { return new Collector < T , List < T > > ( ) { @ Override public List < T > collect ( Stream < ? extends T > stream ) { return Lists . newArrayList ( stream . iterator ( ) ) ; } } ; }
Collect to array list .
70
5
8,443
public static < T > Collector < T , Set < T > > toSet ( ) { return new Collector < T , Set < T > > ( ) { @ Override public Set < T > collect ( Stream < ? extends T > stream ) { return Sets . newHashSet ( stream . iterator ( ) ) ; } } ; }
Collect to hash set
70
4
8,444
@ Override public void transform ( InputStream inputStream , OutputStream outputStream ) throws Exception { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream , CS_WIN1252 ) ) ) { String line ; String closingTag = null ; Stack < String > stack = new Stack <> ( ) ; String id = null ; ...
Transforms the input to well - formed XML .
527
10
8,445
@ Override public void registerDestructionCallback ( String name , Runnable callback ) { synchronized ( this ) { destructionCallbacks . put ( name , callback ) ; } }
Register a bean destruction callback .
37
6
8,446
public void destroy ( ) { for ( Entry < String , Runnable > entry : destructionCallbacks . entrySet ( ) ) { try { entry . getValue ( ) . run ( ) ; } catch ( Throwable t ) { log . error ( "Error during destruction callback for bean " + entry . getKey ( ) , t ) ; } } beans . clear ( ) ; destructionCallbacks . clear ( ) ;...
Calls all registered destruction callbacks and removes all bean references from the container .
89
16
8,447
@ Override public String getProperty ( String name ) { return name . startsWith ( LABEL_PREFIX ) ? StrUtil . getLabel ( name . substring ( LABEL_PREFIX . length ( ) ) ) : null ; }
Label names must be prefixed with
56
7
8,448
private void setAddress ( Address address , RolodexContract rolodex ) { if ( rolodex != null ) { address . setStreet1 ( rolodex . getAddressLine1 ( ) ) ; address . setStreet2 ( rolodex . getAddressLine2 ( ) ) ; address . setCity ( checkNull ( rolodex . getCity ( ) ) ) ; address . setCounty ( rolodex . getCounty ( ) ) ;...
This method is to set the rolodex details to AddressType
217
14
8,449
private Set < ChmEntry > buildEntryList ( ) throws TikaException { Set < ChmEntry > entries = new TreeSet <> ( ) ; for ( DirectoryListingEntry entry : chmExtractor . getChmDirList ( ) . getDirectoryListingEntryList ( ) ) { String name = entry . getName ( ) ; if ( name . startsWith ( "/" ) && ! name . equals ( "/" ) && ...
Builds the list of archive file entries .
125
9
8,450
private ChmEntry findEntry ( String file ) { for ( ChmEntry entry : entries ) { if ( file . equals ( entry . getSourcePath ( ) ) ) { return entry ; } } return null ; }
Returns the chm entry that references the specified file name .
46
12
8,451
public boolean hasChanged ( ) { Object currentValue = getValue ( ) ; return value == null || currentValue == null ? value != currentValue : ! value . equals ( currentValue ) ; }
Returns true if the property value has been changed since the last commit .
41
14
8,452
protected void init ( Object target , PropertyInfo propInfo , PropertyGrid propGrid ) { this . target = target ; this . propInfo = propInfo ; this . propGrid = propGrid ; this . index = propGrid . getEditorCount ( ) ; wireController ( ) ; }
Initializes the property editor .
59
6
8,453
public boolean commit ( ) { try { setWrongValueMessage ( null ) ; propInfo . setPropertyValue ( target , getValue ( ) ) ; updateValue ( ) ; return true ; } catch ( Exception e ) { setWrongValueException ( e ) ; return false ; } }
Commit the changed value .
61
6
8,454
public boolean revert ( ) { try { setWrongValueMessage ( null ) ; setValue ( propInfo . getPropertyValue ( target ) ) ; updateValue ( ) ; return true ; } catch ( Exception e ) { setWrongValueException ( e ) ; return false ; } }
Revert changes to the property value .
60
9
8,455
public List < String > nextParagraphs ( ) { return nextParagraphs ( Math . min ( Math . max ( 4 + ( int ) ( random . nextGaussian ( ) * 3d ) , 1 ) , 8 ) ) ; }
Returns a random list of paragraphs . The number of paragraphs will be between 1 and 8 .
52
18
8,456
public List < String > nextParagraphs ( int num ) { List < String > paragraphs = new ArrayList < String > ( num ) ; for ( int i = 0 ; i < num ; i ++ ) { paragraphs . add ( nextParagraph ( ) ) ; } return paragraphs ; }
Returns the given number of randomly generated paragraphs .
61
9
8,457
public String nextParagraph ( int totalSentences ) { StringBuilder out = new StringBuilder ( ) ; List < String > lastWords = new ArrayList < String > ( ) ; lastWords . add ( null ) ; lastWords . add ( null ) ; int numSentences = 0 ; boolean inSentence = false ; boolean inQuote = false ; while ( numSentences < totalSent...
Returns a paragraph of text with the given number of sentences .
411
12
8,458
public Map < String , String > getEOStateReview ( ProposalDevelopmentDocumentContract pdDoc ) { Map < String , String > stateReview = new HashMap <> ( ) ; List < ? extends AnswerHeaderContract > answerHeaders = propDevQuestionAnswerService . getQuestionnaireAnswerHeaders ( pdDoc . getDevelopmentProposal ( ) . getPropos...
This method returns a map containing the answers related to EOState REview for a given proposal
395
19
8,459
public String getDivisionName ( ProposalDevelopmentDocumentContract pdDoc ) { String divisionName = null ; if ( pdDoc != null && pdDoc . getDevelopmentProposal ( ) . getOwnedByUnit ( ) != null ) { UnitContract ownedByUnit = pdDoc . getDevelopmentProposal ( ) . getOwnedByUnit ( ) ; // traverse through the parent units t...
This method is to get division name using the OwnedByUnit and traversing through the parent units till the top level
183
24
8,460
public void registerTransform ( String pattern , AbstractTransform transform ) { transforms . add ( new Transform ( new WildcardFileFilter ( pattern . split ( "\\," ) ) , transform ) ) ; }
Registers a file transform .
41
6
8,461
public String replaceURLs ( String line ) { StringBuffer sb = new StringBuffer ( ) ; Matcher matcher = URL_PATTERN . matcher ( line ) ; String newPath = "web/" + getResourceBase ( ) + "/" ; while ( matcher . find ( ) ) { char dlm = line . charAt ( matcher . start ( ) - 1 ) ; int i = line . indexOf ( dlm , matcher . end...
Adjust any url references in the line to use new root path .
194
13
8,462
protected boolean transform ( IResource resource ) throws Exception { String name = StringUtils . trimToEmpty ( resource . getSourcePath ( ) ) ; if ( resource . isDirectory ( ) || mojo . isExcluded ( name ) ) { return false ; } AbstractTransform transform = getTransform ( name ) ; String targetPath = transform == null ...
Finds and executes the transform appropriate for the file resource .
154
12
8,463
private AbstractTransform getTransform ( String fileName ) { File file = new File ( fileName ) ; for ( Transform transform : transforms ) { if ( transform . filter . accept ( file ) ) { return transform . transform ; } } return null ; }
Returns the transform for the file or null if none registered .
52
12
8,464
public static String substringBefore ( final String str , final String separator ) { if ( Strings . isNullOrEmpty ( str ) ) { return str ; } final int pos = str . indexOf ( separator ) ; if ( pos == - 1 ) { return str ; } return str . substring ( 0 , pos ) ; }
Returns substring before provided string
72
6
8,465
public static IAction getRegisteredAction ( String id ) { IAction action = getRegistry ( false ) . get ( id ) ; return action == null ? getRegistry ( true ) . get ( id ) : action ; }
Attempt to locate in local registry first then global .
48
10
8,466
public static Collection < IAction > getRegisteredActions ( ActionScope scope ) { Map < String , IAction > actions = new HashMap <> ( ) ; if ( scope == ActionScope . BOTH || scope == ActionScope . GLOBAL ) { actions . putAll ( getRegistry ( true ) . map ) ; } if ( scope == ActionScope . BOTH || scope == ActionScope . L...
Returns a collection of actions registered to the specified scope .
113
11
8,467
private static ActionRegistry getRegistry ( boolean global ) { if ( global ) { return instance ; } Page page = ExecutionContext . getPage ( ) ; ActionRegistry registry = ( ActionRegistry ) page . getAttribute ( ATTR_LOCAL_REGISTRY ) ; if ( registry == null ) { page . setAttribute ( ATTR_LOCAL_REGISTRY , registry = new ...
Returns a reference to the registry for global or local actions .
96
12
8,468
ProgressEvent updateProgress ( double val , long now ) { if ( val < 0 || val > 1 ) { throw new IllegalArgumentException ( "Value out of range [0, 1]: " + val ) ; } if ( val <= progress . getProgress ( ) ) { reset ( start ) ; } double pD = val - progress . getProgress ( ) ; long tD = now - tstamp ; if ( step > 0 ) { ste...
allows setting the current time for testing
176
7
8,469
private boolean connect ( ) { if ( this . factory == null ) { return false ; } if ( isConnected ( ) ) { return true ; } try { this . connection = this . factory . createConnection ( ) ; this . session = ( TopicSession ) this . connection . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; this . connection . start...
Connect to the JMS server .
124
7
8,470
private void disconnect ( ) { if ( this . session != null ) { try { this . session . close ( ) ; } catch ( Exception e ) { log . error ( "Error closing JMS topic session." , e ) ; } } if ( this . connection != null ) { try { this . connection . stop ( ) ; this . connection . close ( ) ; } catch ( Exception e ) { log . ...
Disconnect from the JMS server .
115
8
8,471
public static ElementUI getAssociatedElement ( BaseComponent component ) { return component == null ? null : ( ElementUI ) component . getAttribute ( ASSOC_ELEMENT ) ; }
Returns the UI element that registered the CWF component .
38
11
8,472
public static Menupopup getDesignContextMenu ( BaseComponent component ) { return component == null ? null : ( Menupopup ) component . getAttribute ( CONTEXT_MENU ) ; }
Returns the design context menu currently bound to the component .
42
11
8,473
protected String getTemplateUrl ( ) { return "web/" + getClass ( ) . getPackage ( ) . getName ( ) . replace ( "." , "/" ) + "/" + StringUtils . uncapitalize ( getClass ( ) . getSimpleName ( ) ) + ".fsp" ; }
Returns the URL of the default template to use in createFromTemplate . Override this method to provide an alternate default URL .
67
25
8,474
@ Override public void setDesignMode ( boolean designMode ) { super . setDesignMode ( designMode ) ; for ( ElementTrigger trigger : triggers ) { trigger . setDesignMode ( designMode ) ; } setDesignContextMenu ( designMode ? DesignContextMenu . getInstance ( ) . getMenupopup ( ) : null ) ; mask . update ( ) ; }
Sets design mode status for this component and all its children and triggers .
79
15
8,475
@ Override protected void afterParentChanged ( ElementBase oldParent ) { if ( getParent ( ) != null ) { if ( ! getDefinition ( ) . isInternal ( ) ) { bind ( ) ; } setDesignMode ( getParent ( ) . isDesignMode ( ) ) ; } }
Called after the parent has been changed .
62
9
8,476
private ElementUI getVisibleChild ( boolean first ) { int count = getChildCount ( ) ; int start = first ? 0 : count - 1 ; int inc = first ? 1 : - 1 ; for ( int i = start ; i >= 0 && i < count ; i += inc ) { ElementUI child = ( ElementUI ) getChild ( i ) ; if ( child . isVisible ( ) ) { return child ; } } return null ; ...
Returns first or last visible child .
96
7
8,477
public ElementUI getNextSibling ( boolean visibleOnly ) { ElementUI parent = getParent ( ) ; if ( parent != null ) { int count = parent . getChildCount ( ) ; for ( int i = getIndex ( ) + 1 ; i < count ; i ++ ) { ElementUI child = ( ElementUI ) parent . getChild ( i ) ; if ( ! visibleOnly || child . isVisible ( ) ) { re...
Returns this element s next sibling .
101
7
8,478
@ Override protected void afterMoveChild ( ElementBase child , ElementBase before ) { moveChild ( ( ( ElementUI ) child ) . getOuterComponent ( ) , ( ( ElementUI ) before ) . getOuterComponent ( ) ) ; updateMasks ( ) ; }
Element has been moved to a different position under this parent . Adjust wrapped components accordingly .
59
17
8,479
protected void applyColor ( BaseUIComponent comp ) { if ( comp instanceof BaseLabeledComponent ) { comp . invoke ( comp . sub ( "lbl" ) , "css" , "color" , getColor ( ) ) ; } else if ( comp != null ) { comp . addStyle ( "background-color" , getColor ( ) ) ; } }
Applies the current color setting to the target component . If the target implements a custom method for performing this operation that method will be invoked . Otherwise the background color of the target is set . Override this method to provide alternate implementations .
80
47
8,480
protected boolean hasVisibleElements ( BaseUIComponent component ) { for ( BaseUIComponent child : component . getChildren ( BaseUIComponent . class ) ) { ElementUI ele = getAssociatedElement ( child ) ; if ( ele != null && ele . isVisible ( ) ) { return true ; } if ( hasVisibleElements ( child ) ) { return true ; } } ...
Returns true if any associated UI elements in the component subtree are visible .
91
15
8,481
public void set ( int i , byte value ) { if ( i < 0 || i >= size ) { throw new IndexOutOfBoundsException ( ) ; } elements [ i ] = value ; }
Sets the i th element of the array list to the given value .
42
15
8,482
public void add ( byte [ ] values ) { ensureCapacity ( size + values . length ) ; for ( byte element : values ) { this . add ( element ) ; } }
Adds all the elements in the given array to the array list .
38
13
8,483
public static double normalizeProps ( double [ ] props ) { double propSum = DoubleArrays . sum ( props ) ; if ( propSum == 0 ) { for ( int d = 0 ; d < props . length ; d ++ ) { props [ d ] = 1.0 / ( double ) props . length ; } } else if ( propSum == Double . POSITIVE_INFINITY ) { int count = DoubleArrays . count ( prop...
Normalize the proportions and return their sum .
271
9
8,484
public static double normalizeLogProps ( double [ ] logProps ) { double logPropSum = DoubleArrays . logSum ( logProps ) ; if ( logPropSum == Double . NEGATIVE_INFINITY ) { double uniform = FastMath . log ( 1.0 / ( double ) logProps . length ) ; for ( int d = 0 ; d < logProps . length ; d ++ ) { logProps [ d ] = uniform...
In the log - semiring normalize the proportions and return their sum .
336
15
8,485
public static double klDivergence ( double [ ] p , double [ ] q ) { if ( p . length != q . length ) { throw new IllegalStateException ( "The length of p and q must be the same." ) ; } double delta = 1e-8 ; if ( ! Multinomials . isMultinomial ( p , delta ) ) { throw new IllegalStateException ( "p is not a multinomial" )...
Gets the KL divergence between two multinomial distributions p and q .
213
15
8,486
public double [ ] toNativeArray ( ) { final double [ ] arr = new double [ getNumImplicitEntries ( ) ] ; iterate ( new FnIntDoubleToVoid ( ) { @ Override public void call ( int idx , double val ) { arr [ idx ] = val ; } } ) ; return arr ; }
Gets a NEW array containing all the elements in this vector .
73
13
8,487
private String getLabel ( String key ) { String label = StrUtil . getLabel ( "cwf.shell.about." + key . toString ( ) ) ; return label == null ? key : label ; }
Returns the label value for the specified key .
47
9
8,488
public H2DataSource init ( ) throws Exception { if ( dbMode == DBMode . LOCAL ) { String port = getPort ( ) ; if ( port . isEmpty ( ) ) { server = Server . createTcpServer ( ) ; } else { server = Server . createTcpServer ( "-tcpPort" , port ) ; } server . start ( ) ; } return this ; }
If running H2 in local mode starts the server .
86
11
8,489
private String getPort ( ) { String url = getUrl ( ) ; int i = url . indexOf ( "://" ) + 3 ; int j = url . indexOf ( "/" , i ) ; String s = i == 2 || j == - 1 ? "" : url . substring ( i , j ) ; i = s . indexOf ( ":" ) ; return i == - 1 ? "" : s . substring ( i + 1 ) ; }
Extract the TCP port from the connection URL .
98
10
8,490
public String nextLine ( Map < String , Object > extraClasses ) { return mainClass . render ( null , preprocessExtraClasses ( extraClasses ) ) ; }
Returns a random line of text driven by the underlying spew file and the given classes . For example to drive a spew file but add some parameters to it call this method with the class names as the map keys and the Strings that you d like substituted as the values .
37
54
8,491
public boolean isDuplicate ( HelpTopic topic ) { return ObjectUtils . equals ( url , topic . url ) && compareTo ( topic ) == 0 ; }
Returns true if the topic is considered a duplicate .
35
10
8,492
protected void updateStatus ( ) { if ( ! plugins . isEmpty ( ) ) { boolean disabled = isDisabled ( ) ; for ( ElementPlugin container : plugins ) { container . setDisabled ( disabled ) ; } } }
Updates the disabled status of all registered containers .
48
10
8,493
private Enum getYesNoEnum ( String answer ) { return answer . equals ( "Y" ) ? YesNoDataType . Y_YES : YesNoDataType . N_NO ; }
This method is to return YesNoDataType enum .
42
11
8,494
public static IAction createAction ( String label , String script ) { return new Action ( script , label , script ) ; }
Creates an action object from fields .
26
8
8,495
public static ActionListener removeAction ( BaseComponent component , String eventName ) { ActionListener listener = getListener ( component , eventName ) ; if ( listener != null ) { listener . removeAction ( ) ; } return listener ; }
Removes any action associated with a component .
48
9
8,496
public static void disableAction ( BaseComponent component , String eventName , boolean disable ) { ActionListener listener = getListener ( component , eventName ) ; if ( listener != null ) { listener . setDisabled ( disable ) ; } }
Enables or disables the deferred event listener associated with the component .
49
14
8,497
private static IAction createAction ( String action ) { IAction actn = null ; if ( ! StringUtils . isEmpty ( action ) ) { if ( ( actn = ActionRegistry . getRegisteredAction ( action ) ) == null ) { actn = ActionUtil . createAction ( null , action ) ; } } return actn ; }
Returns an IAction object given an action .
75
9
8,498
public static ActionListener getListener ( BaseComponent component , String eventName ) { return ( ActionListener ) component . getAttribute ( ActionListener . getAttrName ( eventName ) ) ; }
Returns the listener associated with the given component and event .
40
11
8,499
public static SSLContext buildSSLContext ( HttpClientConfig config ) throws IOException , GeneralSecurityException { KeyManagerFactory kmf = null ; if ( isSslKeyManagerEnabled ( config ) ) { kmf = getKeyManagerFactory ( config . getKeyStorePath ( ) , new StoreProperties ( config . getKeyStorePassword ( ) , config . get...
Build SSL Socket factory .
264
5