idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
38,100 | public void setEndTimex ( String v ) { if ( Timex3Interval_Type . featOkTst && ( ( Timex3Interval_Type ) jcasType ) . casFeat_endTimex == null ) jcasType . jcas . throwFeatMissing ( "endTimex" , "de.unihd.dbs.uima.types.heideltime.Timex3Interval" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Timex3Interval_Typ... | setter for endTimex - sets | 140 | 8 |
38,101 | public void process ( JCas jcas ) { try { tagger . process ( jcas ) ; } catch ( AnalysisEngineProcessException e ) { e . printStackTrace ( ) ; } } | invokes the IntervalTagger s process method . | 42 | 11 |
38,102 | public String getTimexId ( ) { if ( Dct_Type . featOkTst && ( ( Dct_Type ) jcasType ) . casFeat_timexId == null ) jcasType . jcas . throwFeatMissing ( "timexId" , "de.unihd.dbs.uima.types.heideltime.Dct" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Dct_Type ) jcasType ) . casFeatCode_timexId ) ; } | getter for timexId - gets | 125 | 8 |
38,103 | public void setTimexId ( String v ) { if ( Dct_Type . featOkTst && ( ( Dct_Type ) jcasType ) . casFeat_timexId == null ) jcasType . jcas . throwFeatMissing ( "timexId" , "de.unihd.dbs.uima.types.heideltime.Dct" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Dct_Type ) jcasType ) . casFeatCode_timexId , v ) ; } | setter for timexId - sets | 128 | 8 |
38,104 | private static void patternCompile ( ) { try { ptnNumber = Pattern . compile ( strNumberPattern ) ; ptnShortDate = Pattern . compile ( strShortDatePattern ) ; ptnLongDate = Pattern . compile ( strLongDatePattern ) ; ptnPercentage = Pattern . compile ( strPercentagePattern ) ; ptnCurrency = Pattern . compile ( strCurren... | Pattern compile . | 134 | 3 |
38,105 | private static String patternMatching ( String ptnName , String input ) { String suffix = "" ; if ( ptnNumber == null ) patternCompile ( ) ; Matcher matcher ; if ( ptnName . equals ( "number" ) ) { matcher = ptnNumber . matcher ( input ) ; if ( matcher . matches ( ) ) suffix = ":number" ; } else if ( ptnName . equals (... | Pattern matching . | 318 | 3 |
38,106 | public void parseVnSyllable ( String syll ) { strSyllable = syll ; strMainVowel = "" ; strSecondaryVowel = "" ; strFirstConsonant = "" ; strLastConsonant = "" ; iCurPos = 0 ; validViSyll = true ; parseFirstConsonant ( ) ; parseSecondaryVowel ( ) ; parseMainVowel ( ) ; parseLastConsonant ( ) ; } | Parses the vn syllable . | 100 | 9 |
38,107 | private void parseFirstConsonant ( ) { // find first of (vnfirstconsonant) // if not found, first consonant = ZERO // else the found consonant Iterator iter = alFirstConsonants . iterator ( ) ; while ( iter . hasNext ( ) ) { String strFirstCon = ( String ) iter . next ( ) ; if ( strSyllable . startsWith ( strFirstCon ,... | Parses the first consonant . | 133 | 8 |
38,108 | private void parseSecondaryVowel ( ) { if ( ! validViSyll ) return ; // get the current and next character in the syllable string char curChar , nextChar ; if ( iCurPos > strSyllable . length ( ) - 1 ) { validViSyll = false ; return ; } curChar = strSyllable . charAt ( iCurPos ) ; if ( iCurPos == strSyllable . length (... | Parses the secondary vowel . | 452 | 7 |
38,109 | private void parseMainVowel ( ) { if ( ! validViSyll ) return ; if ( iCurPos > strSyllable . length ( ) - 1 ) { validViSyll = false ; return ; } String strVowel = "" ; for ( int i = iCurPos ; i < strSyllable . length ( ) ; ++ i ) { int idx = vnVowels . indexOf ( strSyllable . charAt ( i ) ) ; if ( idx == - 1 ) break ; ... | Parses the main vowel . | 271 | 7 |
38,110 | private void parseLastConsonant ( ) { if ( ! validViSyll ) return ; if ( iCurPos > strSyllable . length ( ) ) strLastConsonant = ZERO ; String strCon = strSyllable . substring ( iCurPos , strSyllable . length ( ) ) ; if ( strCon . length ( ) > 3 ) { validViSyll = false ; return ; } Iterator iter = alLastConsonants . it... | Parses the last consonant . | 213 | 8 |
38,111 | private static void initArrayList ( ArrayList al , String str ) { StringTokenizer strTknr = new StringTokenizer ( str , "|" ) ; while ( strTknr . hasMoreTokens ( ) ) { al . add ( strTknr . nextToken ( ) ) ; } } | Inits the array list . | 66 | 6 |
38,112 | public static void displayCopyright ( ) { System . out . println ( "Vietnamese Word Segmentation:" ) ; System . out . println ( "\tusing Conditional Random Fields" ) ; System . out . println ( "\ttesting our dataset of 8000 sentences with the highest F1-measure of 94%" ) ; System . out . println ( "Copyright (C) by Cam... | Display copyright . | 182 | 3 |
38,113 | public static void displayHelp ( ) { System . out . println ( "Usage:" ) ; System . out . println ( "\tCase 1: WordSegmenting -modeldir <model directory> -inputfile <input data file>" ) ; System . out . println ( "\tCase 2: WordSegmenting -modeldir <model directory> -inputdir <input data directory>" ) ; System . out . ... | Display help . | 200 | 3 |
38,114 | public static Boolean checkInfrontBehind ( MatchResult r , Sentence s ) { Boolean ok = true ; // get rid of expressions such as "1999" in 53453.1999 if ( r . start ( ) > 1 ) { if ( ( s . getCoveredText ( ) . substring ( r . start ( ) - 2 , r . start ( ) ) . matches ( "\\d\\." ) ) ) { ok = false ; } } // get rid of expr... | Check token boundaries of expressions . | 400 | 6 |
38,115 | public void inferenceAll ( List data ) { System . out . println ( "Starting inference ..." ) ; long start , stop , elapsed ; start = System . currentTimeMillis ( ) ; for ( int i = 0 ; i < data . size ( ) ; i ++ ) { System . out . println ( "sequence " + Integer . toString ( i + 1 ) ) ; List seq = ( List ) data . get ( ... | Inference all . | 176 | 4 |
38,116 | public void readCpMaps ( BufferedReader fin ) throws IOException { if ( cpStr2Int != null ) { cpStr2Int . clear ( ) ; } else { cpStr2Int = new HashMap ( ) ; } if ( cpInt2Str != null ) { cpInt2Str . clear ( ) ; } else { cpInt2Str = new HashMap ( ) ; } String line ; // get size of context predicate map if ( ( line = fin ... | Read cp maps . | 384 | 4 |
38,117 | public void readLbMaps ( BufferedReader fin ) throws IOException { if ( lbStr2Int != null ) { lbStr2Int . clear ( ) ; } else { lbStr2Int = new HashMap ( ) ; } if ( lbInt2Str != null ) { lbInt2Str . clear ( ) ; } else { lbInt2Str = new HashMap ( ) ; } String line ; // get size of label map if ( ( line = fin . readLine (... | Read lb maps . | 379 | 4 |
38,118 | public int getSentenceId ( ) { if ( Sentence_Type . featOkTst && ( ( Sentence_Type ) jcasType ) . casFeat_sentenceId == null ) jcasType . jcas . throwFeatMissing ( "sentenceId" , "de.unihd.dbs.uima.types.heideltime.Sentence" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( Sentence_Type ) jcasType ) . casFeat... | getter for sentenceId - gets | 125 | 7 |
38,119 | public void setSentenceId ( int v ) { if ( Sentence_Type . featOkTst && ( ( Sentence_Type ) jcasType ) . casFeat_sentenceId == null ) jcasType . jcas . throwFeatMissing ( "sentenceId" , "de.unihd.dbs.uima.types.heideltime.Sentence" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( Sentence_Type ) jcasType ) . casFeat... | setter for sentenceId - sets | 128 | 7 |
38,120 | public String getUri ( ) { if ( SourceDocInfo_Type . featOkTst && ( ( SourceDocInfo_Type ) jcasType ) . casFeat_uri == null ) jcasType . jcas . throwFeatMissing ( "uri" , "de.unihd.dbs.uima.types.heideltime.SourceDocInfo" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( SourceDocInfo_Type ) jcasType ) . ca... | getter for uri - gets | 122 | 7 |
38,121 | public int getOffsetInSource ( ) { if ( SourceDocInfo_Type . featOkTst && ( ( SourceDocInfo_Type ) jcasType ) . casFeat_offsetInSource == null ) jcasType . jcas . throwFeatMissing ( "offsetInSource" , "de.unihd.dbs.uima.types.heideltime.SourceDocInfo" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( SourceDoc... | getter for offsetInSource - gets | 129 | 8 |
38,122 | public void setOffsetInSource ( int v ) { if ( SourceDocInfo_Type . featOkTst && ( ( SourceDocInfo_Type ) jcasType ) . casFeat_offsetInSource == null ) jcasType . jcas . throwFeatMissing ( "offsetInSource" , "de.unihd.dbs.uima.types.heideltime.SourceDocInfo" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( SourceDoc... | setter for offsetInSource - sets | 132 | 8 |
38,123 | @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public static void setProps ( Properties prop ) { properties = prop ; Iterator propIt = properties . entrySet ( ) . iterator ( ) ; while ( propIt . hasNext ( ) ) { Entry < String , String > entry = ( Entry < String , String > ) propIt . next ( ) ; properties . setProp... | Sets properties once | 110 | 4 |
38,124 | public boolean initSenSegmenter ( String modelDir ) { System . out . println ( "Initilize JVnSenSegmenter ..." ) ; //initialize sentence segmentation vnSenSegmenter = new JVnSenSegmenter ( ) ; if ( ! vnSenSegmenter . init ( modelDir ) ) { System . out . println ( "Error while initilizing JVnSenSegmenter" ) ; vnSenSegme... | Initialize the sentence segmetation for Vietnamese return true if the initialization is successful and false otherwise . | 113 | 21 |
38,125 | public boolean initSegmenter ( String modelDir ) { System . out . println ( "Initilize JVnSegmenter ..." ) ; System . out . println ( modelDir ) ; vnSegmenter = new CRFSegmenter ( ) ; try { vnSegmenter . init ( modelDir ) ; } catch ( Exception e ) { System . out . println ( "Error while initializing JVnSegmenter" ) ; v... | Initialize the word segmetation for Vietnamese . | 119 | 11 |
38,126 | public boolean initPosTagger ( String modelDir ) { try { this . vnPosTagger = new MaxentTagger ( modelDir ) ; } catch ( Exception e ) { System . out . println ( "Error while initializing POS TAgger" ) ; vnPosTagger = null ; return false ; } return true ; } | Initialize the pos tagger for Vietnamese . | 72 | 9 |
38,127 | public String senSegment ( String text ) { String ret = text ; //Segment sentences if ( vnSenSegmenter != null ) { ret = vnSenSegmenter . senSegment ( text ) ; } return ret . trim ( ) ; } | Do sentence segmentation . | 56 | 5 |
38,128 | public String senTokenize ( String text ) { String ret = text ; if ( isTokenization ) { ret = PennTokenizer . tokenize ( text ) ; } return ret . trim ( ) ; } | Do sentence tokenization . | 43 | 5 |
38,129 | public String wordSegment ( String text ) { String ret = text ; if ( vnSegmenter == null ) return ret ; ret = vnSegmenter . segmenting ( ret ) ; return ret ; } | Do word segmentation . | 46 | 5 |
38,130 | public String posTagging ( String text ) { String ret = text ; if ( vnPosTagger != null ) { ret = vnPosTagger . tagging ( text ) ; } return ret ; } | Do pos tagging . | 44 | 4 |
38,131 | @ Deprecated public static WayPoint of ( final Latitude latitude , final Longitude longitude , final Length elevation , final Speed speed , final ZonedDateTime time , final Degrees magneticVariation , final Length geoidHeight , final String name , final String comment , final String description , final String source , ... | Create a new way - point with the given parameter . | 193 | 11 |
38,132 | public static Location of ( final Point point ) { requireNonNull ( point ) ; return of ( point . getLatitude ( ) , point . getLongitude ( ) , point . getElevation ( ) . orElse ( null ) ) ; } | Create a new location form the given GPS point . | 53 | 10 |
38,133 | public static Ellipsoid of ( final String name , final double a , final double b , final double f ) { return new Ellipsoid ( name , a , b , f ) ; } | Create a new earth ellipsoid with the given parameters . | 42 | 13 |
38,134 | @ Deprecated public static Builder builder ( final String version , final String creator ) { return new Builder ( Version . of ( version ) , creator ) ; } | Create a new GPX builder with the given GPX version and creator string . | 32 | 16 |
38,135 | public static Reader reader ( final Version version , final Mode mode ) { return new Reader ( GPX . xmlReader ( version ) , mode ) ; } | Return a GPX reader reading GPX files with the given version and in the given reading mode . | 31 | 20 |
38,136 | public static Reader reader ( final Version version ) { return new Reader ( GPX . xmlReader ( version ) , Mode . STRICT ) ; } | Return a GPX reader reading GPX files with the given version and in strict reading mode . | 30 | 19 |
38,137 | public static Reader reader ( final Mode mode ) { return new Reader ( GPX . xmlReader ( Version . V11 ) , mode ) ; } | Return a GPX reader reading GPX files with version 1 . 1 and in the given reading mode . | 30 | 21 |
38,138 | public String toPattern ( ) { return _formats . stream ( ) . map ( Objects :: toString ) . collect ( Collectors . joining ( ) ) ; } | Return the pattern string represented by this formatter . | 35 | 10 |
38,139 | static String readString ( final DataInput in ) throws IOException { final byte [ ] bytes = new byte [ readInt ( in ) ] ; in . readFully ( bytes ) ; return new String ( bytes , "UTF-8" ) ; } | Reads a string value from the given data input . | 53 | 11 |
38,140 | static < T > void writes ( final Collection < ? extends T > elements , final Writer < ? super T > writer , final DataOutput out ) throws IOException { writeInt ( elements . size ( ) , out ) ; for ( T element : elements ) { writer . write ( element , out ) ; } } | Write the given elements to the data output . | 65 | 9 |
38,141 | static < T > List < T > reads ( final Reader < ? extends T > reader , final DataInput in ) throws IOException { final int length = readInt ( in ) ; final List < T > elements = new ArrayList <> ( length ) ; for ( int i = 0 ; i < length ; ++ i ) { elements . add ( reader . read ( in ) ) ; } return elements ; } | Reads a list of elements from the given data input . | 86 | 12 |
38,142 | public double to ( final Unit unit ) { requireNonNull ( unit ) ; return unit . convert ( _value , Unit . METERS_PER_SECOND ) ; } | Return the GPS speed value in the desired unit . | 36 | 10 |
38,143 | public static < T extends Serializable > Flowable < T > write ( final Flowable < T > source , final File file ) { return write ( source , file , false , DEFAULT_BUFFER_SIZE ) ; } | Writes the source stream to the given file in given append mode and using the a buffer size of 8192 bytes . | 47 | 24 |
38,144 | @ VisibleForTesting static Method getMethod ( Class < ? > cls , String name , Class < ? > ... params ) { Method m ; try { m = cls . getDeclaredMethod ( name , params ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } m . setAccessible ( true ) ; return m ; } | Bundle reflection calls to get access to the given method | 77 | 11 |
38,145 | private void mapAndSetOffset ( ) { try { final RandomAccessFile backingFile = new RandomAccessFile ( this . file , "rw" ) ; backingFile . setLength ( this . size ) ; final FileChannel ch = backingFile . getChannel ( ) ; this . addr = ( Long ) mmap . invoke ( ch , 1 , 0L , this . size ) ; ch . close ( ) ; backingFile . ... | for the given length and set this . addr to the returned offset | 110 | 13 |
38,146 | public void getBytes ( long pos , byte [ ] data , long offset , long length ) { unsafe . copyMemory ( null , pos + addr , data , BYTE_ARRAY_OFFSET + offset , length ) ; } | May want to have offset & length within data as well for both of these | 48 | 15 |
38,147 | public Phrase put ( String key , CharSequence value ) { if ( ! keys . contains ( key ) ) { throw new IllegalArgumentException ( "Invalid key: " + key ) ; } if ( value == null ) { throw new IllegalArgumentException ( "Null value for '" + key + "'" ) ; } keysToValues . put ( key , value ) ; // Invalidate the cached forma... | Replaces the given key with a non - null value . You may reuse Phrase instances and replace keys with new values . | 97 | 25 |
38,148 | public Phrase putOptional ( String key , CharSequence value ) { return keys . contains ( key ) ? put ( key , value ) : this ; } | Silently ignored if the key is not in the pattern . | 33 | 12 |
38,149 | public CharSequence format ( ) { if ( formatted == null ) { if ( ! keysToValues . keySet ( ) . containsAll ( keys ) ) { Set < String > missingKeys = new HashSet < String > ( keys ) ; missingKeys . removeAll ( keysToValues . keySet ( ) ) ; throw new IllegalArgumentException ( "Missing keys: " + missingKeys ) ; } // Copy... | Returns the text after replacing all keys with values . | 163 | 10 |
38,150 | private Token token ( Token prev ) { if ( curChar == EOF ) { return null ; } if ( curChar == ' ' ) { char nextChar = lookahead ( ) ; if ( nextChar == ' ' ) { return leftCurlyBracket ( prev ) ; } else if ( nextChar >= ' ' && nextChar <= ' ' ) { return key ( prev ) ; } else { throw new IllegalArgumentException ( "Unexpec... | Returns the next token from the input pattern or null when finished parsing . | 123 | 14 |
38,151 | private TextToken text ( Token prev ) { int startIndex = curCharIndex ; while ( curChar != ' ' && curChar != EOF ) { consume ( ) ; } return new TextToken ( prev , curCharIndex - startIndex ) ; } | Consumes and returns a token for a sequence of text . | 53 | 12 |
38,152 | private void consume ( ) { curCharIndex ++ ; curChar = ( curCharIndex == pattern . length ( ) ) ? EOF : pattern . charAt ( curCharIndex ) ; } | Advances the current character position without any error checking . Consuming beyond the end of the string can only happen if this parser contains a bug . | 40 | 29 |
38,153 | private String determineLanguage ( FacesContext fc , DataTable dataTable ) { final List < String > availableLanguages = Arrays . asList ( "de" , "en" , "es" , "fr" , "hu" , "it" , "nl" , "pl" , "pt" , "ru" ) ; if ( BsfUtils . isStringValued ( dataTable . getCustomLangUrl ( ) ) ) { return dataTable . getCustomLangUrl ( ... | Determine if the user specify a lang Otherwise return null to avoid language settings . | 225 | 17 |
38,154 | public String getType ( ) { String mode = A . asString ( getAttributes ( ) . get ( "mode" ) , "badge" ) ; return mode . equals ( "edit" ) ? "text" : "hidden" ; } | Method added to prevent AngularFaces from setting the type | 52 | 11 |
38,155 | protected void renderPassThruAttributes ( FacesContext context , UIComponent component , String [ ] attrs , boolean shouldRenderDataAttributes ) throws IOException { ResponseWriter writer = context . getResponseWriter ( ) ; if ( ( attrs == null || attrs . length <= 0 ) && shouldRenderDataAttributes == false ) return ; ... | Method that provide ability to render pass through attributes . | 220 | 10 |
38,156 | protected void generateErrorAndRequiredClass ( UIInput input , ResponseWriter rw , String clientId , String additionalClass1 , String additionalClass2 , String additionalClass3 ) throws IOException { String styleClass = getErrorAndRequiredClass ( input , clientId ) ; if ( null != additionalClass1 ) { additionalClass1 =... | Renders the CSS pseudo classes for required fields and for the error levels . | 225 | 15 |
38,157 | public static Converter getConverter ( FacesContext fc , ValueHolder vh ) { // explicit converter Converter converter = vh . getConverter ( ) ; // try to find implicit converter if ( converter == null ) { ValueExpression expr = ( ( UIComponent ) vh ) . getValueExpression ( "value" ) ; if ( expr != null ) { Class < ? > ... | Finds the appropriate converter for a given value holder | 140 | 10 |
38,158 | public static String getRequestParameter ( FacesContext context , String name ) { return context . getExternalContext ( ) . getRequestParameterMap ( ) . get ( name ) ; } | Returns request parameter value for the provided parameter name . | 37 | 10 |
38,159 | public static boolean beginDisabledFieldset ( IContentDisabled component , ResponseWriter rw ) throws IOException { if ( component . isContentDisabled ( ) ) { rw . startElement ( "fieldset" , ( UIComponent ) component ) ; rw . writeAttribute ( "disabled" , "disabled" , "null" ) ; return true ; } return false ; } | Renders the code disabling every input field and every button within a container . | 83 | 15 |
38,160 | @ Deprecated protected String getFormGroupWithFeedback ( String additionalClass , String clientId ) { if ( BsfUtils . isLegacyFeedbackClassesEnabled ( ) ) { return additionalClass ; } return additionalClass + " " + FacesMessages . getErrorSeverityClass ( clientId ) ; } | Get the main field container | 68 | 5 |
38,161 | public static String getValueAsString ( Object value , FacesContext ctx , DateTimePicker dtp ) { // Else we use our own converter if ( value == null ) { return null ; } Locale sloc = BsfUtils . selectLocale ( ctx . getViewRoot ( ) . getLocale ( ) , dtp . getLocale ( ) , dtp ) ; String javaFormatString = BsfUtils . sele... | Yields the value which is displayed in the input field of the date picker . | 160 | 18 |
38,162 | public static String getDateAsString ( FacesContext fc , DateTimePicker dtp , Object value , String javaFormatString , Locale locale ) { if ( value == null ) { return null ; } Converter converter = dtp . getConverter ( ) ; return converter == null ? getInternalDateAsString ( value , javaFormatString , locale ) : conver... | Get date in string format | 94 | 5 |
38,163 | private void encodeSeverityMessage ( FacesContext facesContext , Growl uiGrowl , FacesMessage msg ) throws IOException { ResponseWriter writer = facesContext . getResponseWriter ( ) ; String summary = msg . getSummary ( ) != null ? msg . getSummary ( ) : "" ; String detail = msg . getDetail ( ) != null ? msg . getDetai... | Encode single faces message as growl | 717 | 8 |
38,164 | private String getSeverityIcon ( FacesMessage message ) { if ( message . getSeverity ( ) . equals ( FacesMessage . SEVERITY_WARN ) ) return "fa fa-exclamation-triangle" ; else if ( message . getSeverity ( ) . equals ( FacesMessage . SEVERITY_ERROR ) ) return "fa fa-times-circle" ; else if ( message . getSeverity ( ) . ... | Get severity related icons . We use FA icons because future version of Bootstrap does not support glyphicons anymore | 127 | 21 |
38,165 | private String getMessageType ( FacesMessage message ) { if ( message . getSeverity ( ) . equals ( FacesMessage . SEVERITY_WARN ) ) return "warning" ; else if ( message . getSeverity ( ) . equals ( FacesMessage . SEVERITY_ERROR ) ) return "danger" ; else if ( message . getSeverity ( ) . equals ( FacesMessage . SEVERITY... | Translate severity type to growl style class | 134 | 9 |
38,166 | public static void printNodeData ( Node rootNode , String tab ) { tab = tab == null ? "" : tab + " " ; for ( Node n : rootNode . getChilds ( ) ) { printNodeData ( n , tab ) ; } } | Debug method to print tree node structure | 54 | 7 |
38,167 | public static Node searchNodeById ( Node rootNode , int nodeId ) { if ( rootNode . getNodeId ( ) == nodeId ) { return rootNode ; } Node foundNode = null ; for ( Node n : rootNode . getChilds ( ) ) { foundNode = searchNodeById ( n , nodeId ) ; if ( foundNode != null ) { break ; } } return foundNode ; } | Basic implementation of recursive node search by id It works only on a DefaultNodeImpl | 87 | 16 |
38,168 | public static String renderModelAsJson ( Node rootNode , boolean renderRoot ) { if ( renderRoot ) { return renderSubnodes ( rootNode == null ? new ArrayList < Node > ( ) : new ArrayList < Node > ( Arrays . asList ( rootNode ) ) ) ; } else if ( rootNode != null && rootNode . hasChild ( ) ) { return renderSubnodes ( root... | Render the node model as JSON | 102 | 6 |
38,169 | public static void encodeDropMenuStart ( DropMenu c , ResponseWriter rw , String l ) throws IOException { rw . startElement ( "ul" , c ) ; if ( c . getContentClass ( ) != null ) rw . writeAttribute ( "class" , "dropdown-menu " + c . getContentClass ( ) , "class" ) ; else rw . writeAttribute ( "class" , "dropdown-menu" ... | Renders the Drop Menu . | 174 | 6 |
38,170 | private static void drawClearDiv ( ResponseWriter writer , UIComponent tabView ) throws IOException { writer . startElement ( "div" , tabView ) ; writer . writeAttribute ( "style" , "clear:both;" , "style" ) ; writer . endElement ( "div" ) ; } | Draw a clear div | 66 | 4 |
38,171 | private static void encodeTabLinks ( FacesContext context , ResponseWriter writer , TabView tabView , int currentlyActiveIndex , List < UIComponent > tabs , String clientId , String hiddenInputFieldID ) throws IOException { writer . startElement ( "ul" , tabView ) ; writer . writeAttribute ( "id" , clientId , "id" ) ; ... | Encode the list of links that render the tabs | 381 | 10 |
38,172 | private static void encodeTabContentPanes ( final FacesContext context , final ResponseWriter writer , final TabView tabView , final int currentlyActiveIndex , final List < UIComponent > tabs ) throws IOException { writer . startElement ( "div" , tabView ) ; String classes = "tab-content" ; if ( tabView . getContentCla... | Generates the HTML of the tab panes . | 461 | 10 |
38,173 | private static void encodeTabs ( final FacesContext context , final ResponseWriter writer , final List < UIComponent > children , final int currentlyActiveIndex , final String hiddenInputFieldID , final boolean disabled ) throws IOException { if ( null != children ) { int tabIndex = 0 ; for ( int index = 0 ; index < ch... | Generates the HTML of the tabs . | 279 | 8 |
38,174 | private static void encodeTabAnchorTag ( FacesContext context , ResponseWriter writer , Tab tab , String hiddenInputFieldID , int tabindex , boolean disabled ) throws IOException { writer . startElement ( "a" , tab ) ; writer . writeAttribute ( "id" , tab . getClientId ( ) . replace ( ":" , "_" ) + "_tab" , "id" ) ; wr... | Generate the clickable entity of the tab . | 420 | 10 |
38,175 | public static int toInt ( Object val ) { if ( val == null ) { return 0 ; } if ( val instanceof Number ) { return ( ( Number ) val ) . intValue ( ) ; } if ( val instanceof String ) { return Integer . parseInt ( ( String ) val ) ; } throw new IllegalArgumentException ( "Cannot convert " + val ) ; } | Converts the parameter to an integer value if possible . Throws an IllegalArgumentException if the parameter cannot be converted to an integer . | 81 | 28 |
38,176 | private String encodeClick ( FacesContext context , Button button ) { String js ; String userClick = button . getOnclick ( ) ; if ( userClick != null ) { js = userClick ; } // +COLON; } else { js = "" ; } String fragment = button . getFragment ( ) ; String outcome = button . getOutcome ( ) ; if ( null != outcome && out... | Renders the Javascript code dealing with the click event . If the developer provides their own onclick handler is precedes the generated Javascript code . | 449 | 28 |
38,177 | private boolean canOutcomeBeRendered ( Button button , String fragment , String outcome ) { boolean renderOutcome = true ; if ( null == outcome && button . getAttributes ( ) != null && button . getAttributes ( ) . containsKey ( "ng-click" ) ) { String ngClick = ( String ) button . getAttributes ( ) . get ( "ng-click" )... | Do we have to suppress the target URL? | 123 | 9 |
38,178 | private String determineTargetURL ( FacesContext context , Button button , String outcome ) { ConfigurableNavigationHandler cnh = ( ConfigurableNavigationHandler ) context . getApplication ( ) . getNavigationHandler ( ) ; NavigationCase navCase = cnh . getNavigationCase ( context , null , outcome ) ; /* * Param Name: j... | Translate the outcome attribute value to the target URL . | 344 | 11 |
38,179 | private static String getStyleClasses ( Button button , boolean isResponsive ) { StringBuilder sb ; sb = new StringBuilder ( 40 ) ; // optimize int sb . append ( "btn" ) ; String size = button . getSize ( ) ; if ( size != null ) { sb . append ( " btn-" ) . append ( size ) ; } String look = button . getLook ( ) ; if ( l... | Collects the CSS classes of the button . | 224 | 9 |
38,180 | public List < UIComponent > resolve ( UIComponent component , List < UIComponent > parentComponents , String currentId , String originalExpression , String [ ] parameters ) { List < UIComponent > result = new ArrayList < UIComponent > ( ) ; for ( UIComponent parent : parentComponents ) { UIComponent grandparent = compo... | Collects everything preceding the current JSF node within the same branch of the tree . It s like | 231 | 20 |
38,181 | @ Override public void encodeEnd ( FacesContext context , UIComponent component ) throws IOException { if ( ! component . isRendered ( ) ) { return ; } PanelGrid panelGrid = ( PanelGrid ) component ; ResponseWriter writer = context . getResponseWriter ( ) ; boolean idHasBeenRendered = false ; String responsiveStyle = R... | Renders the grid component and its children . | 460 | 9 |
38,182 | protected String [ ] getRowClasses ( PanelGrid grid ) { String rowClasses = grid . getRowClasses ( ) ; if ( null == rowClasses || rowClasses . trim ( ) . length ( ) == 0 ) return null ; String [ ] rows = rowClasses . split ( "," ) ; return rows ; } | Extract the option row classes from the JSF file . | 72 | 12 |
38,183 | protected int [ ] getColSpanArray ( PanelGrid panelGrid ) { String columnsCSV = panelGrid . getColSpans ( ) ; if ( null == columnsCSV || columnsCSV . trim ( ) . length ( ) == 0 ) { columnsCSV = panelGrid . getColumns ( ) ; if ( "1" . equals ( columnsCSV ) ) { columnsCSV = "12" ; } else if ( "2" . equals ( columnsCSV ) ... | Read the colSpans attribute . | 545 | 7 |
38,184 | protected String [ ] getColumnClasses ( PanelGrid panelGrid , int [ ] colSpans ) { String columnsCSV = panelGrid . getColumnClasses ( ) ; String [ ] columnClasses ; if ( null == columnsCSV || columnsCSV . trim ( ) . length ( ) == 0 ) columnClasses = null ; else { columnClasses = columnsCSV . split ( "," ) ; if ( column... | Merge the column span information and the optional columnClasses attribute . | 320 | 14 |
38,185 | protected void generateColumnStart ( UIComponent child , String colStyleClass , ResponseWriter writer ) throws IOException { writer . startElement ( "div" , child ) ; writer . writeAttribute ( "class" , colStyleClass , "class" ) ; } | Generates the start of each Bootstrap column . | 56 | 10 |
38,186 | protected void generateRowStart ( ResponseWriter writer , int row , String [ ] rowClasses , PanelGrid panelGrid ) throws IOException { writer . startElement ( "div" , panelGrid ) ; if ( null == rowClasses ) writer . writeAttribute ( "class" , "row" , "class" ) ; else writer . writeAttribute ( "class" , "row " + rowClas... | Generates the start of each Bootstrap row . | 101 | 10 |
38,187 | protected void generateContainerStart ( ResponseWriter writer , PanelGrid panelGrid , boolean idHasBeenRendered ) throws IOException { writer . startElement ( "div" , panelGrid ) ; if ( ! idHasBeenRendered ) { String clientId = panelGrid . getClientId ( ) ; writer . writeAttribute ( "id" , clientId , "id" ) ; } writeAt... | Generates the start of the entire Bootstrap container . | 238 | 11 |
38,188 | protected void renderInputTag ( FacesContext context , ResponseWriter rw , String clientId , SelectBooleanCheckbox selectBooleanCheckbox ) throws IOException { int numberOfDivs = 0 ; String responsiveStyleClass = Responsive . getResponsiveStyleClass ( selectBooleanCheckbox , false ) . trim ( ) ; if ( responsiveStyleCla... | Renders the input tag . | 300 | 6 |
38,189 | protected void renderInputTagEnd ( ResponseWriter rw , SelectBooleanCheckbox selectBooleanCheckbox ) throws IOException { rw . endElement ( "input" ) ; String caption = selectBooleanCheckbox . getCaption ( ) ; if ( null != caption ) { if ( selectBooleanCheckbox . isEscape ( ) ) { rw . writeText ( " " + caption , null )... | Closes the input tag . This method is protected in order to allow third - party frameworks to derive from it . | 128 | 23 |
38,190 | protected void renderInputTagValue ( FacesContext context , ResponseWriter rw , SelectBooleanCheckbox selectBooleanCheckbox ) throws IOException { String v = getValue2Render ( context , selectBooleanCheckbox ) ; if ( v != null && "true" . equals ( v ) ) { rw . writeAttribute ( "checked" , v , null ) ; } } | Renders the value of the input tag . This method is protected in order to allow third - party frameworks to derive from it . | 81 | 26 |
38,191 | public void setMask ( String mask ) { if ( mask != null && ! mask . isEmpty ( ) ) { AddResourcesListener . addResourceToHeadButAfterJQuery ( C . BSF_LIBRARY , "js/jquery.inputmask.bundle.min.js" ) ; } getStateHelper ( ) . put ( PropertyKeys . mask , mask ) ; } | Sets input mask and triggers JavaScript to be loaded . | 82 | 11 |
38,192 | private static String getStyleClasses ( AbstractNavLink link , boolean isResponsive ) { StringBuilder sb ; sb = new StringBuilder ( 20 ) ; // optimize int String look = null ; if ( link instanceof Link ) { look = ( ( Link ) link ) . getLook ( ) ; } else if ( link instanceof CommandLink ) { look = ( ( CommandLink ) link... | Collects the CSS classes of the link . | 153 | 9 |
38,193 | public static boolean isValued ( Object obj ) { if ( obj == null ) return false ; if ( obj instanceof String ) return isStringValued ( ( String ) obj ) ; return true ; } | Check if a generic object is valued | 43 | 7 |
38,194 | public static String stringOrDefault ( String str , String defaultValue ) { if ( isStringValued ( str ) ) return str ; return defaultValue ; } | Get the string if is not null or empty otherwise return the default value | 33 | 14 |
38,195 | public static String snakeCaseToCamelCase ( String snakeCase ) { if ( snakeCase . contains ( "-" ) ) { StringBuilder camelCaseStr = new StringBuilder ( snakeCase . length ( ) ) ; boolean toUpperCase = false ; for ( char c : snakeCase . toCharArray ( ) ) { if ( c == ' ' ) toUpperCase = true ; else { if ( toUpperCase ) {... | Transform a snake - case string to a camel - case one . | 141 | 13 |
38,196 | public static String camelCaseToSnakeCase ( String camelCase ) { if ( null == camelCase || camelCase . length ( ) == 0 ) return camelCase ; StringBuilder snakeCase = new StringBuilder ( camelCase . length ( ) + 3 ) ; snakeCase . append ( camelCase . charAt ( 0 ) ) ; boolean hasCamelCase = false ; for ( int i = 1 ; i < ... | Transform a snake - case string to a camelCase one . | 180 | 12 |
38,197 | public static String escapeHtml ( String htmlString ) { StringBuffer sb = new StringBuffer ( htmlString . length ( ) ) ; // true if last char was blank boolean lastWasBlankChar = false ; int len = htmlString . length ( ) ; char c ; for ( int i = 0 ; i < len ; i ++ ) { c = htmlString . charAt ( i ) ; if ( c == ' ' ) { /... | Escape html special chars from string | 425 | 7 |
38,198 | public static String escapeJQuerySpecialCharsInSelector ( String selector ) { String jQuerySpecialChars = "!\"#$%&'()*+,./:;<=>?@[]^`{|}~;" ; String [ ] jsc = jQuerySpecialChars . split ( "(?!^)" ) ; for ( String c : jsc ) { selector = selector . replace ( c , "\\\\" + c ) ; } return selector ; } | Escape special jQuery chars in selector query | 97 | 8 |
38,199 | public static UIForm getClosestForm ( UIComponent component ) { while ( component != null ) { if ( component instanceof UIForm ) { return ( UIForm ) component ; } component = component . getParent ( ) ; } return null ; } | Get the related form | 58 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.