signature:
public class WffBMObject { /** * @ param outer
 * @ return bytes for this WffBMObject
 * @ since 3.0.2
 * @ author WFF */
@ Override public byte [ ] buildBytes ( final boolean outer ) { } }

implementation: final Set < Entry < String , ValueValueType > > superEntrySet = super . entrySet ( ) ; final int capacity = outer ? superEntrySet . size ( ) + 1 : superEntrySet . size ( ) ; final Deque < NameValue > nameValues = new ArrayDeque < > ( capacity ) ; if ( outer ) { final NameValue typeNameValue = new NameValue ( ) ; typeNameValue . setName ( BMType . OBJECT . getType ( ) ) ; nameValues . add ( typeNameValue ) ; } for ( final Entry < String , ValueValueType > entry : superEntrySet ) { final String key = entry . getKey ( ) ; final ValueValueType valueValueType = entry . getValue ( ) ; final byte valueType = valueValueType . getValueTypeByte ( ) ; final NameValue nameValue = new NameValue ( ) ; nameValue . setName ( key . getBytes ( StandardCharsets . UTF_8 ) ) ; nameValues . add ( nameValue ) ; if ( valueType == BMValueType . STRING . getType ( ) ) { final String value = ( String ) valueValueType . getValue ( ) ; nameValue . setValues ( new byte [ ] { valueType } , value . getBytes ( StandardCharsets . UTF_8 ) ) ; } else if ( valueType == BMValueType . NUMBER . getType ( ) ) { final Number value = ( Number ) valueValueType . getValue ( ) ; final byte [ ] valueBytes = WffBinaryMessageUtil . getOptimizedBytesFromDouble ( value . doubleValue ( ) ) ; nameValue . setValues ( new byte [ ] { valueType } , valueBytes ) ; } else if ( valueType == BMValueType . UNDEFINED . getType ( ) ) { final byte [ ] valueBytes = { } ; nameValue . setValues ( new byte [ ] { valueType } , valueBytes ) ; } else if ( valueType == BMValueType . NULL . getType ( ) ) { final byte [ ] valueBytes = { } ; nameValue . setValues ( new byte [ ] { valueType } , valueBytes ) ; } else if ( valueType == BMValueType . BOOLEAN . getType ( ) ) { final Boolean value = ( Boolean ) valueValueType . getValue ( ) ; final byte [ ] valueBytes = { ( byte ) ( value . booleanValue ( ) ? 1 : 0 ) } ; nameValue . setValues ( new byte [ ] { valueType } , valueBytes ) ; } else if ( valueType == BMValueType . BM_OBJECT . getType ( ) ) { final WffBMObject value = ( WffBMObject ) valueValueType . getValue ( ) ; final byte [ ] valueBytes = value . buildBytes ( false ) ; nameValue . setValues ( new byte [ ] { valueType } , valueBytes ) ; } else if ( valueType == BMValueType . BM_ARRAY . getType ( ) ) { final WffBMArray value = ( WffBMArray ) valueValueType . getValue ( ) ; final byte [ ] valueBytes = value . buildBytes ( false ) ; nameValue . setValues ( new byte [ ] { valueType } , valueBytes ) ; } else if ( valueType == BMValueType . BM_BYTE_ARRAY . getType ( ) ) { final WffBMByteArray value = ( WffBMByteArray ) valueValueType . getValue ( ) ; final byte [ ] valueBytes = value . build ( false ) ; nameValue . setValues ( new byte [ ] { valueType } , valueBytes ) ; } else if ( valueType == BMValueType . REG_EXP . getType ( ) ) { final String value = ( String ) valueValueType . getValue ( ) ; nameValue . setValues ( new byte [ ] { valueType } , value . getBytes ( StandardCharsets . UTF_8 ) ) ; } else if ( valueType == BMValueType . FUNCTION . getType ( ) ) { final String value = ( String ) valueValueType . getValue ( ) ; nameValue . setValues ( new byte [ ] { valueType } , value . getBytes ( StandardCharsets . UTF_8 ) ) ; } else if ( valueType == BMValueType . INTERNAL_BYTE . getType ( ) ) { throw new WffRuntimeException ( "BMValueType.BYTE is only for internal use, use WffBMByteArray for row bytes." ) ; } } return WffBinaryMessageUtil . VERSION_1 . getWffBinaryMessageBytes ( nameValues ) ;


signature:
public class BorderImageSource { /** * sample code : -
 * { @ code backgroundImage . setImageUrls ( " Test . gif " , " TestImage . png " ) } creates
 * < code > background - image : url ( " Test . gif " ) , url ( " TestImage . png " ) ; < / code > .
 * For css3 syntax method please use
 * { @ code setImageUrls ( UrlCss3Value . . . urlCss3Values ) } method .
 * @ param imageUrls
 * an array of backgroundImage urls , eg : -
 * { @ code backgroundImage . setImageUrls ( " Test . gif " , " TestImage . png " ) }
 * and the generated css will be
 * < code > background - image : url ( " Test . gif " ) , url ( " TestImage . png " ) ; < / code >
 * @ since 1.0.0
 * @ author WFF */
public void setImageUrls ( final String ... imageUrls ) { } }

implementation: if ( imageUrls == null ) { throw new NullValueException ( "imageUrls is null" ) ; } final StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < imageUrls . length ; i ++ ) { sb . append ( "url(\"" ) . append ( imageUrls [ i ] ) . append ( "\")" ) ; if ( i < imageUrls . length - 1 ) { sb . append ( ", " ) ; } else { sb . append ( ' ' ) ; } } setCssValue ( StringBuilderUtil . getTrimmedString ( sb ) ) ; this . imageUrls = imageUrls ;


signature:
public class BorderImageSource { /** * @ return a new object of unmodifiable { @ code List < UrlCss3Value > } whenever
 * this method is called . Or null .
 * @ author WFF
 * @ since 1.0.0 */
public List < UrlCss3Value > getUrlCss3Values ( ) { } }

implementation:
// for security improvements for urlCss3Values without
// compromising performance .
// TODO the drawback of this the returning of new object each time even
// if the urlCss3Values array has not been modified , as a minor
// performance
// improvement , return a new object only if the urlCss3Values is
// modified .
if ( urlCss3Values == null ) { return null ; } return Collections . unmodifiableList ( Arrays . asList ( urlCss3Values ) ) ;


signature:
public class Pattern { /** * checks the value in this attribute contains a valid regex .
 * @ return true if this attribute contains a valid regex
 * @ since 3.0.1
 * @ author WFF */
public boolean containsValidRegEx ( ) { } }

implementation:
try { java . util . regex . Pattern . compile ( super . getAttributeValue ( ) ) ; return true ; } catch ( final PatternSyntaxException e ) { // NOP
} return false ;


signature:
public class RgbaCssValue { /** * to set the red value which is in between 0 to 255.
 * @ param r
 * represents red
 * @ author WFF
 * @ since 1.0.0 */
public void setR ( final int r ) { } }

implementation: if ( r < 0 || r > 255 ) { throw new InvalidValueException ( "r paramater accept values only from 0 to 255." ) ; } this . r = r ; rgba = "rgba(" + r + ", " + g + ", " + b + ", " + a + ")" ; if ( getStateChangeInformer ( ) != null ) { getStateChangeInformer ( ) . stateChanged ( this ) ; }


signature:
public class RgbaCssValue { /** * to set the green value which is in between 0 to 255.
 * @ param g
 * represents green
 * @ author WFF
 * @ since 1.0.0 */
public void setG ( final int g ) { } }

implementation: if ( g < 0 || g > 255 ) { throw new InvalidValueException ( "g paramater accept values only from 0 to 255." ) ; } this . g = g ; rgba = "rgba(" + r + ", " + g + ", " + b + ", " + a + ")" ; if ( getStateChangeInformer ( ) != null ) { getStateChangeInformer ( ) . stateChanged ( this ) ; }


signature:
public class RgbaCssValue { /** * to set the blue value which is in between 0 to 255.
 * @ param b
 * @ author WFF
 * @ since 1.0.0 */
public void setB ( final int b ) { } }

implementation: if ( b < 0 || b > 255 ) { throw new InvalidValueException ( "b paramater accept values only from 0 to 255." ) ; } this . b = b ; rgba = "rgba(" + r + ", " + g + ", " + b + ", " + a + ")" ; if ( getStateChangeInformer ( ) != null ) { getStateChangeInformer ( ) . stateChanged ( this ) ; }


signature:
public class RgbaCssValue { /** * to set alpha . The default value is 0.
 * @ param a
 * @ author WFF
 * @ since 1.0.0 */
public void setA ( final float a ) { } }

implementation: if ( a < 0 || a > 1 ) { throw new InvalidValueException ( "a paramater accept values only from 0 to 255." ) ; } this . a = a ; rgba = "rgba(" + r + ", " + g + ", " + b + ", " + a + ")" ; if ( getStateChangeInformer ( ) != null ) { getStateChangeInformer ( ) . stateChanged ( this ) ; }


signature:
public class UnicodeRange { /** * < pre >
 * Eg : -
 * String [ ] unicodeChars = { " U + 0400-045F " , " U + 0490-0491 " , " U + 04B0-04B1 " , " U + 2116 " } ;
 * < / pre >
 * @ param unicodeChars
 * the unicodeChars to set
 * @ author WFF
 * @ since 1.1.2 */
public void setUnicodeChars ( final String [ ] unicodeChars ) { } }

implementation: if ( unicodeChars != null ) { this . unicodeChars = StringUtil . cloneArray ( unicodeChars ) ; cssValue = getBuiltCssValue ( this . unicodeChars ) ; } else { this . unicodeChars = null ; cssValue = DEFAULT_VALUE ; } if ( getStateChangeInformer ( ) != null ) { getStateChangeInformer ( ) . stateChanged ( this ) ; }


signature:
public class TagRegistry { /** * Loads all tag classes .
 * @ since 2.1.13
 * @ author WFF */
public static void loadAllTagClasses ( ) { } }

implementation: final Map < String , Class < ? > > unloadedClasses = new HashMap < > ( ) ; for ( final Entry < String , Class < ? > > entry : tagClassByTagNameTmp . entrySet ( ) ) { try { Class . forName ( entry . getValue ( ) . getName ( ) ) ; } catch ( final ClassNotFoundException e ) { unloadedClasses . put ( entry . getKey ( ) , entry . getValue ( ) ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "Could not load tag class " + entry . getValue ( ) . getName ( ) ) ; } } } tagClassByTagNameTmp . clear ( ) ; if ( unloadedClasses . size ( ) > 0 ) { tagClassByTagNameTmp . putAll ( unloadedClasses ) ; } else { tagClassByTagNameTmp = null ; }


signature:
public class MozFlex { /** * checks the given css value is valid for this class . It does ' t do a strict
 * validation .
 * @ param cssValue
 * @ return
 * @ since 1.0.0
 * @ author WFF */
public static boolean isValid ( final String cssValue ) { } }

implementation:
// TODO modify to make a strict validation
if ( cssValue == null || StringUtil . isBlank ( cssValue ) ) { return false ; } final String [ ] cssValueParts = StringUtil . splitBySpace ( cssValue ) ; MozFlexGrow mozFlexGrow = null ; MozFlexShrink mozFlexShrink = null ; MozFlexBasis mozFlexBasis = null ; for ( final String eachPart : cssValueParts ) { boolean invalid = true ; if ( mozFlexGrow == null && MozFlexGrow . isValid ( eachPart ) ) { mozFlexGrow = new MozFlexGrow ( eachPart ) ; invalid = false ; } else if ( mozFlexShrink == null && MozFlexShrink . isValid ( eachPart ) ) { mozFlexShrink = new MozFlexShrink ( eachPart ) ; invalid = false ; } else if ( mozFlexBasis == null && MozFlexBasis . isValid ( eachPart ) ) { mozFlexBasis = new MozFlexBasis ( eachPart ) ; invalid = false ; } if ( invalid ) { return false ; } } return mozFlexGrow != null || mozFlexShrink != null || mozFlexBasis != null ;


signature:
public class StringUtil { /** * gets the first substring which starts and ends with the given values .
 * @ param inputString
 * the string from which the substring will be
 * extracted .
 * @ param startingWith
 * to match the starting substring
 * @ param endingWith
 * to match the ending substring
 * @ return the substring which starts and ends with the given
 * { @ code startingWith } and { @ code endingWith } values . Or returns
 * null if it doesn ' t contain .
 * @ author WFF
 * @ since 1.0.0 */
public static String getFirstSubstring ( final String inputString , final String startingWith , final String endingWith ) { } }

implementation: if ( ! inputString . contains ( startingWith ) || ! inputString . contains ( endingWith ) ) { return null ; } final int startIndex = inputString . indexOf ( startingWith ) ; if ( ! ( ( startIndex + 1 ) < inputString . length ( ) ) ) { return null ; } final int endIndex = inputString . indexOf ( endingWith , startIndex + 1 ) + 1 ; if ( startIndex > endIndex || startIndex < 0 || endIndex < 0 ) { return null ; } return inputString . substring ( startIndex , endIndex ) ;


signature:
public class StringUtil { /** * gets all substrings as an array which starts and ends with the given
 * values . < br >
 * Note : - it will never return null instead it will return an empty array
 * ( having length zero ) .
 * < pre >
 * final String [ ] allSubstrings = getAllSubstrings ( & quot ; abcd & quot ; , & quot ; ab & quot ; , & quot ; cd & quot ; ) ;
 * for ( String each : allSubstrings ) {
 * System . out . println ( each ) ;
 * the output will be : < i > abcd < / i >
 * < / pre >
 * @ param inputString
 * the string from which the substrings will be
 * extracted .
 * @ param startingWith
 * to match the starting substring
 * @ param endingWith
 * to match the ending substring
 * @ return the array of substrings which contains strings starting and
 * ending with the given { @ code startingWith } and { @ code endingWith }
 * values . Or returns an empty array ( i . e an array having length
 * zero ) if it doesn ' t contain .
 * @ author WFF
 * @ since 1.0.0 */
public static String [ ] getAllSubstrings ( final String inputString , final String startingWith , final String endingWith ) { } }

implementation:
if ( ! inputString . contains ( startingWith ) || ! inputString . contains ( endingWith ) ) { return new String [ 0 ] ; } final int inputStringLength = inputString . length ( ) ; final int endingWithLength = endingWith . length ( ) ; final int maxArrayLength = inputStringLength / ( startingWith . length ( ) + endingWithLength ) ; if ( maxArrayLength == 0 ) { return new String [ 0 ] ; } final String [ ] maxSubstrings = new String [ maxArrayLength ] ; int startSearchFromIndex = 0 ; int count = 0 ; do { final int startIndex = inputString . indexOf ( startingWith , startSearchFromIndex ) ; if ( ! ( ( startIndex + 1 ) < inputStringLength ) ) { break ; } final int indexOfEndingWith = inputString . indexOf ( endingWith , startIndex + 1 ) ; if ( startIndex < 0 || indexOfEndingWith < 0 ) { break ; } final int endIndex = indexOfEndingWith + endingWithLength ; startSearchFromIndex = endIndex ; if ( ( startIndex > endIndex ) ) { startSearchFromIndex = inputStringLength ; } else { maxSubstrings [ count ] = inputString . substring ( startIndex , endIndex ) ; count ++ ; } } while ( startSearchFromIndex < inputStringLength ) ; final String [ ] substrings = new String [ count ] ; // TODO check later if System . arraycopy is better than small sized
// arrays .
System . arraycopy ( maxSubstrings , 0 , substrings , 0 , count ) ; return substrings ;


signature:
public class StringUtil { /** * gets all start and end indexes as an array of array which start and end
 * with the given values . < br >
 * Note : - it will never return null instead it will return an empty array
 * ( having length zero ) .
 * < pre >
 * final int [ ] [ ] startAndEndIndexesOf = startAndEndIndexesOf (
 * " 121 131 141 151 161 171 181 191 101 " , " 1 " , " 1 " ) ;
 * for ( final int [ ] startIndexAndEndIndex : startAndEndIndexesOf ) {
 * System . out . println ( startIndexAndEndIndex [ 0 ] + " - "
 * + startIndexAndEndIndex [ 1 ] ) ;
 * the output will be :
 * 0 - 3
 * 4 - 7
 * 8 - 11
 * 12 - 15
 * 16 - 19
 * 20 - 23
 * 24 - 27
 * 28 - 31
 * 32 - 35
 * int [ ] startIndexAndEndIndex = startAndEndIndexesOf [ 0 ] ; / / 1 , 2 etc . .
 * System . out . println ( startIndexAndEndIndex [ 0 ] + " - "
 * + startIndexAndEndIndex [ 1 ] ) ;
 * the output will be : < i > 0 - 3 < / i >
 * < / pre >
 * @ param inputString
 * the string from which the substrings will be
 * extracted .
 * @ param startingWith
 * to match the starting substring
 * @ param endingWith
 * to match the ending substring
 * @ return the array of substrings which contains strings starting and
 * ending with the given { @ code startingWith } and { @ code endingWith }
 * values . Or returns an empty array ( i . e an array having length
 * zero ) if it doesn ' t contain .
 * @ author WFF
 * @ since 1.0.0 */
public static int [ ] [ ] startAndEndIndexesOf ( final String inputString , final String startingWith , final String endingWith ) { } }

implementation:
if ( ! inputString . contains ( startingWith ) || ! inputString . contains ( endingWith ) ) { return new int [ 0 ] [ 0 ] ; } final int inputStringLength = inputString . length ( ) ; final int endingWithLength = endingWith . length ( ) ; final int maxArrayLength = inputStringLength / ( startingWith . length ( ) + endingWithLength ) ; if ( maxArrayLength == 0 ) { return new int [ 0 ] [ 0 ] ; } final int [ ] [ ] maxIndexes = new int [ maxArrayLength ] [ 0 ] ; int startSearchFromIndex = 0 ; int count = 0 ; do { final int startIndex = inputString . indexOf ( startingWith , startSearchFromIndex ) ; if ( ! ( ( startIndex + 1 ) < inputStringLength ) ) { return new int [ 0 ] [ 0 ] ; } final int indexOfEndingWith = inputString . indexOf ( endingWith , startIndex + 1 ) ; if ( startIndex < 0 || indexOfEndingWith < 0 ) { break ; } final int endIndex = indexOfEndingWith + endingWithLength - 1 ; startSearchFromIndex = endIndex ; if ( ( startIndex > endIndex ) ) { startSearchFromIndex = inputStringLength ; } else { final int [ ] is = { startIndex , endIndex } ; maxIndexes [ count ] = is ; count ++ ; } } while ( startSearchFromIndex < inputStringLength ) ; final int [ ] [ ] indexes = new int [ count ] [ 0 ] ; // TODO check later if System . arraycopy is better than small sized
// arrays .
System . arraycopy ( maxIndexes , 0 , indexes , 0 , count ) ; return indexes ;


signature:
public class StringUtil { /** * To make the clone copy of the given String array . This method is faster
 * than the clone method of String array .
 * @ param inputArray
 * @ return the cloned array of the given string array .
 * @ author WFF
 * @ since 1.0.0 */
public static String [ ] cloneArray ( final String [ ] inputArray ) { } }

implementation: final String [ ] array = new String [ inputArray . length ] ; System . arraycopy ( inputArray , 0 , array , 0 , inputArray . length ) ; return array ;


signature:
public class StringUtil { /** * Checks if the given string contains whitespace .
 * @ param string
 * @ return true if the given string contains space char .
 * @ since 3.0.1
 * @ author WFF */
public static boolean containsWhitespace ( final String string ) { } }

implementation: for ( int i = 0 ; i < string . length ( ) ; i ++ ) { if ( Character . isWhitespace ( string . charAt ( i ) ) ) { return true ; } } return false ;


signature:
public class StringUtil { /** * Removes the trailing and leading whitespaces
 * @ param s
 * @ return the striped string
 * @ since 3.0.1 */
public static String strip ( final String s ) { } }

implementation: int first ; int last ; for ( first = 0 ; first < s . length ( ) ; first ++ ) { if ( ! Character . isWhitespace ( s . charAt ( first ) ) ) { break ; } } for ( last = s . length ( ) ; last > first ; last -- ) { if ( ! Character . isWhitespace ( s . charAt ( last - 1 ) ) ) { break ; } } return s . substring ( first , last ) ;


signature:
public class PayloadProcessor { /** * ( default ) */
static byte [ ] pollAndConvertToByteArray ( final int totalCapacity , final Queue < ByteBuffer > dataArray ) { } }

implementation: final byte [ ] wholeData = new byte [ totalCapacity ] ; int destStartIndex = 0 ; ByteBuffer data ; while ( ( data = dataArray . poll ( ) ) != null ) { final byte [ ] array = data . array ( ) ; System . arraycopy ( array , 0 , wholeData , destStartIndex , array . length ) ; destStartIndex += array . length ; if ( destStartIndex == totalCapacity ) { break ; } } return wholeData ;


signature:
public class PayloadProcessor { /** * This method will be useful when the WebSocket server receives messages as
 * chucks . A WebSocket server may have a max size of byte array that can be
 * sent or receive as a single object . eg : websocket
 * session . getMaxBinaryMessageBufferSize may limit it . In such case this
 * method can be used to get the complete data as chucks .
 * @ param messagePart
 * message part
 * @ param last
 * true if it is the last part of the message
 * @ since 3.0.2 */
public void webSocketMessaged ( final ByteBuffer messagePart , final boolean last ) { } }

implementation: wsMessageChunks . add ( messagePart ) ; if ( last ) { final int totalCapacity = wsMessageChunksTotalCapacity . getAndSet ( 0 ) + messagePart . capacity ( ) ; browserPage . webSocketMessaged ( pollAndConvertToByteArray ( totalCapacity , wsMessageChunks ) ) ; } else { wsMessageChunksTotalCapacity . addAndGet ( messagePart . capacity ( ) ) ; }


signature:
public class AbstractHtml { /** * Removes all children from this tag .
 * @ author WFF */
public void removeAllChildren ( ) { } }

implementation: boolean listenerInvoked = false ; final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; try { lock . lock ( ) ; final AbstractHtml [ ] removedAbstractHtmls = children . toArray ( new AbstractHtml [ children . size ( ) ] ) ; children . clear ( ) ; initNewSharedObjectInAllNestedTagsAndSetSuperParentNull ( removedAbstractHtmls ) ; final ChildTagRemoveListener listener = sharedObject . getChildTagRemoveListener ( ACCESS_OBJECT ) ; if ( listener != null ) { listener . allChildrenRemoved ( new ChildTagRemoveListener . Event ( this , removedAbstractHtmls ) ) ; listenerInvoked = true ; } } finally { lock . unlock ( ) ; } if ( listenerInvoked ) { final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } }


signature:
public class AbstractHtml { /** * Removes all children and adds the given tags as children .
 * @ param updateClient
 * true to update client browser page if it is
 * available . The default value is true but it will
 * be ignored if there is no client browser page .
 * @ param innerHtmls
 * the inner html tags to add
 * @ since 2.1.15
 * @ author WFF */
protected void addInnerHtmls ( final boolean updateClient , final AbstractHtml ... innerHtmls ) { } }

implementation: boolean listenerInvoked = false ; final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; try { lock . lock ( ) ; final AbstractHtml [ ] removedAbstractHtmls = children . toArray ( new AbstractHtml [ children . size ( ) ] ) ; children . clear ( ) ; initNewSharedObjectInAllNestedTagsAndSetSuperParentNull ( removedAbstractHtmls ) ; final InnerHtmlAddListener listener = sharedObject . getInnerHtmlAddListener ( ACCESS_OBJECT ) ; if ( listener != null && updateClient ) { final InnerHtmlAddListener . Event [ ] events = new InnerHtmlAddListener . Event [ innerHtmls . length ] ; int index = 0 ; for ( final AbstractHtml innerHtml : innerHtmls ) { AbstractHtml previousParentTag = null ; if ( innerHtml . parent != null && innerHtml . parent . sharedObject == sharedObject ) { previousParentTag = innerHtml . parent ; } addChild ( innerHtml , false ) ; events [ index ] = new InnerHtmlAddListener . Event ( this , innerHtml , previousParentTag ) ; index ++ ; } listener . innerHtmlsAdded ( this , events ) ; listenerInvoked = true ; } else { for ( final AbstractHtml innerHtml : innerHtmls ) { addChild ( innerHtml , false ) ; } } } finally { lock . unlock ( ) ; } if ( listenerInvoked ) { final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } }


signature:
public class AbstractHtml { /** * Removes the given tags from its children tags .
 * @ param children
 * the tags to remove from its children .
 * @ return true given given children tags have been removed .
 * @ author WFF */
public boolean removeChildren ( final Collection < AbstractHtml > children ) { } }

implementation: final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; boolean result = false ; try { lock . lock ( ) ; result = this . children . removeAll ( children ) ; } finally { lock . unlock ( ) ; } final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } return result ;


signature:
public class AbstractHtml { /** * Removes the given tag from its children only if the given tag is a child
 * of this tag .
 * @ param child
 * the tag to remove from its children
 * @ return true if removed
 * @ author WFF */
public boolean removeChild ( final AbstractHtml child ) { } }

implementation:
boolean listenerInvoked = false ; final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; boolean removed = false ; try { lock . lock ( ) ; removed = children . remove ( child ) ; if ( removed ) { // making child . parent = null inside the below method .
initNewSharedObjectInAllNestedTagsAndSetSuperParentNull ( child ) ; final ChildTagRemoveListener listener = sharedObject . getChildTagRemoveListener ( ACCESS_OBJECT ) ; if ( listener != null ) { listener . childRemoved ( new ChildTagRemoveListener . Event ( this , child ) ) ; listenerInvoked = true ; } } } finally { lock . unlock ( ) ; } if ( listenerInvoked ) { final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } } return removed ;


signature:
public class AbstractHtml { /** * NB : This method is for internal use
 * @ param accessObject
 * @ param child
 * @ param invokeListener
 * @ return
 * @ since 2.0.0
 * @ author WFF */
public boolean addChild ( final Object accessObject , final AbstractHtml child , final boolean invokeListener ) { } }

implementation: if ( accessObject == null || ! ( SecurityClassConstants . BROWSER_PAGE . equals ( accessObject . getClass ( ) . getName ( ) ) ) ) { throw new WffSecurityException ( "Not allowed to consume this method. This method is for internal use." ) ; } final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; boolean result = false ; try { lock . lock ( ) ; result = addChild ( child , invokeListener ) ; } finally { lock . unlock ( ) ; } if ( invokeListener ) { final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } } return result ;


signature:
public class AbstractHtml { /** * adds the given children to the last position of the current children of
 * this object .
 * @ param children
 * children to append in this object ' s existing
 * children .
 * @ author WFF */
public void appendChildren ( final Collection < AbstractHtml > children ) { } }

implementation: boolean listenerInvoked = false ; final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; try { lock . lock ( ) ; final Collection < ChildMovedEvent > movedOrAppended = new ArrayDeque < > ( children . size ( ) ) ; for ( final AbstractHtml child : children ) { final AbstractHtml previousParent = child . parent ; addChild ( child , false ) ; final ChildMovedEvent event = new ChildMovedEvent ( previousParent , this , child ) ; movedOrAppended . add ( event ) ; } final ChildTagAppendListener listener = sharedObject . getChildTagAppendListener ( ACCESS_OBJECT ) ; if ( listener != null ) { listener . childrendAppendedOrMoved ( movedOrAppended ) ; listenerInvoked = true ; } } finally { lock . unlock ( ) ; } if ( listenerInvoked ) { final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } }


signature:
public class AbstractHtml { /** * prepends the given children to the first position of the current children
 * of this object . < br >
 * Eg : -
 * < pre >
 * Div div = new Div ( null , new Id ( " one " ) ) {
 * new Div ( this , new Id ( " child1 " ) ) ;
 * Span span = new Span ( null ) ;
 * P p = new P ( null ) ;
 * Br br = new Br ( null ) ;
 * div . prependChildren ( span , p , br ) ;
 * System . out . println ( div . toHtmlString ( ) ) ;
 * < / pre >
 * This prints
 * < pre >
 * & lt ; div id = & quot ; one & quot ; & gt ;
 * & lt ; span & gt ; & lt ; / span & gt ;
 * & lt ; p & gt ; & lt ; / p & gt ;
 * & lt ; br / & gt ;
 * & lt ; div id = & quot ; child1 & quot ; & gt ; & lt ; / div & gt ;
 * & lt ; / div & gt ;
 * < / pre >
 * @ param children
 * children to prepend in this object ' s existing
 * children .
 * @ author WFF
 * @ since 3.0.1 */
public void prependChildren ( final AbstractHtml ... children ) { } }

implementation:
final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; boolean listenerInvoked = false ; try { lock . lock ( ) ; final Iterator < AbstractHtml > iterator = this . children . iterator ( ) ; if ( iterator . hasNext ( ) ) { final AbstractHtml firstChild = iterator . next ( ) ; final AbstractHtml [ ] removedParentChildren = this . children . toArray ( new AbstractHtml [ this . children . size ( ) ] ) ; listenerInvoked = firstChild . insertBefore ( removedParentChildren , children ) ; if ( listenerInvoked ) { final InsertBeforeListener insertBeforeListener = sharedObject . getInsertBeforeListener ( ACCESS_OBJECT ) ; if ( insertBeforeListener == null ) { listenerInvoked = false ; } } } else { // NB : similar impl is done in appendChildren ( AbstractHtml . . .
// children ) so any improvements here will be applicable in
// there also
final Collection < ChildMovedEvent > movedOrAppended = new ArrayDeque < > ( children . length ) ; for ( final AbstractHtml child : children ) { final AbstractHtml previousParent = child . parent ; addChild ( child , false ) ; final ChildMovedEvent event = new ChildMovedEvent ( previousParent , this , child ) ; movedOrAppended . add ( event ) ; } final ChildTagAppendListener listener = sharedObject . getChildTagAppendListener ( ACCESS_OBJECT ) ; if ( listener != null ) { listener . childrendAppendedOrMoved ( movedOrAppended ) ; listenerInvoked = true ; } } } finally { lock . unlock ( ) ; } if ( listenerInvoked ) { final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } }


signature:
public class AbstractHtml { /** * NB : lockless implementation of
 * { @ code appendChildren ( AbstractHtml . . . children ) } < br >
 * adds the given children to the last position of the current children of
 * this object .
 * @ param children
 * children to append in this object ' s existing
 * children .
 * @ author WFF
 * @ since 3.0.1 */
private void appendChildrenLockless ( final AbstractHtml ... children ) { } }

implementation:
// any changes to this method should also be applied in
// appendChildren ( AbstractHtml . . . children )
final Collection < ChildMovedEvent > movedOrAppended = new ArrayDeque < > ( children . length ) ; for ( final AbstractHtml child : children ) { final AbstractHtml previousParent = child . parent ; addChild ( child , false ) ; final ChildMovedEvent event = new ChildMovedEvent ( previousParent , this , child ) ; movedOrAppended . add ( event ) ; } final ChildTagAppendListener listener = sharedObject . getChildTagAppendListener ( ACCESS_OBJECT ) ; if ( listener != null ) { listener . childrendAppendedOrMoved ( movedOrAppended ) ; }


signature:
public class AbstractHtml { /** * initializes attributes in this . attributes and also in attributesMap . this
 * should be called only once per object .
 * @ param attributes
 * @ since 2.0.0
 * @ author WFF */
private void initAttributes ( final AbstractAttribute ... attributes ) { } }

implementation:
if ( attributes == null || attributes . length == 0 ) { return ; } // initial capacity must be greater than 1 instead of 1
// because the load factor is 0.75f
// possible initial attributes on a tag may be maximum 8
// they may be id , name , class , value , style , onchange , placeholder
attributesMap = new ConcurrentHashMap < > ( 8 ) ; for ( final AbstractAttribute attribute : attributes ) { attributesMap . put ( attribute . getAttributeName ( ) , attribute ) ; } this . attributes = new AbstractAttribute [ attributesMap . size ( ) ] ; attributesMap . values ( ) . toArray ( this . attributes ) ;


signature:
public class AbstractHtml { /** * adds the given attributes to this tag .
 * @ param updateClient
 * true to update client browser page if it is
 * available . The default value is true but it will
 * be ignored if there is no client browser page .
 * @ param attributes
 * attributes to add
 * @ since 2.0.0 initial implementation
 * @ since 2.0.15 changed to public scope
 * @ author WFF */
public void addAttributes ( final boolean updateClient , final AbstractAttribute ... attributes ) { } }

implementation: boolean listenerInvoked = false ; final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; try { lock . lock ( ) ; listenerInvoked = addAttributesLockless ( updateClient , attributes ) ; } finally { lock . unlock ( ) ; } if ( listenerInvoked ) { final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } }


signature:
public class AbstractHtml { /** * adds the given attributes to this tag .
 * @ param updateClient
 * true to update client browser page if it is
 * available . The default value is true but it will
 * be ignored if there is no client browser page .
 * @ param attributes
 * attributes to add
 * @ since 3.0.1 initial implementation
 * @ author WFF
 * @ return true if the listener invoked else false . DO NOT confuse it with
 * whether attributes are added . */
private boolean addAttributesLockless ( final boolean updateClient , final AbstractAttribute ... attributes ) { } }

implementation:
boolean listenerInvoked = false ; if ( attributesMap == null ) { synchronized ( this ) { if ( attributesMap == null ) { attributesMap = new ConcurrentHashMap < > ( attributes . length ) ; } } } if ( this . attributes != null ) { for ( final AbstractAttribute attribute : this . attributes ) { attributesMap . put ( attribute . getAttributeName ( ) , attribute ) ; } } for ( final AbstractAttribute attribute : attributes ) { attribute . setOwnerTag ( this ) ; final AbstractAttribute previous = attributesMap . put ( attribute . getAttributeName ( ) , attribute ) ; if ( previous != null && ! attribute . equals ( previous ) ) { previous . unsetOwnerTag ( this ) ; } } this . attributes = new AbstractAttribute [ attributesMap . size ( ) ] ; attributesMap . values ( ) . toArray ( this . attributes ) ; setModified ( true ) ; sharedObject . setChildModified ( true ) ; // invokeListener
if ( updateClient ) { final AttributeAddListener attributeAddListener = sharedObject . getAttributeAddListener ( ACCESS_OBJECT ) ; if ( attributeAddListener != null ) { final AttributeAddListener . AddEvent event = new AttributeAddListener . AddEvent ( ) ; event . setAddedToTag ( this ) ; event . setAddedAttributes ( attributes ) ; attributeAddListener . addedAttributes ( event ) ; listenerInvoked = true ; } } return listenerInvoked ;


signature:
public class AbstractHtml { /** * gets the attribute by attribute name
 * @ return the attribute object for the given attribute name if exists
 * otherwise returns null .
 * @ since 2.0.0
 * @ author WFF */
public AbstractAttribute getAttributeByName ( final String attributeName ) { } }

implementation: final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . readLock ( ) ; AbstractAttribute result = null ; try { lock . lock ( ) ; if ( attributesMap != null ) { result = attributesMap . get ( attributeName ) ; } } finally { lock . unlock ( ) ; } return result ;


signature:
public class AbstractHtml { /** * removes the given attributes from this tag .
 * @ param invokeListener
 * true to invoke listener
 * @ param attributes
 * attributes to remove
 * @ return true if any of the attributes are removed .
 * @ since 2.0.0
 * @ author WFF */
public boolean removeAttributes ( final Object accessObject , final boolean invokeListener , final AbstractAttribute ... attributes ) { } }

implementation:
if ( accessObject == null || ! ( SecurityClassConstants . BROWSER_PAGE . equals ( accessObject . getClass ( ) . getName ( ) ) ) ) { throw new WffSecurityException ( "Not allowed to consume this method. This method is for internal use." ) ; } // lock is not required here . it is used in
// removeAttributes ( invokeListener , attributes )
return removeAttributes ( invokeListener , attributes ) ;


signature:
public class AbstractHtml { /** * removes the given attributes from this tag .
 * @ param invokeListener
 * true to invoke listener
 * @ param attributeNames
 * to remove the attributes having in the given
 * names .
 * @ return true if any of the attributes are removed .
 * @ since 2.0.0
 * @ author WFF */
public boolean removeAttributes ( final Object accessObject , final boolean invokeListener , final String ... attributeNames ) { } }

implementation:
if ( accessObject == null || ! ( SecurityClassConstants . BROWSER_PAGE . equals ( accessObject . getClass ( ) . getName ( ) ) ) ) { throw new WffSecurityException ( "Not allowed to consume this method. This method is for internal use." ) ; } // lock is not required here . it is used in
// removeAttributes ( invokeListener , attributes )
return removeAttributes ( invokeListener , attributeNames ) ;


signature:
public class AbstractHtml { /** * removes the given attributes from this tag .
 * @ param updateClient
 * true to update client browser page if it is
 * available . The default value is true but it
 * will be ignored if there is no client browser
 * page .
 * @ param attributeNames
 * to remove the attributes having in the given
 * names .
 * @ return true if any of the attributes are removed .
 * @ since 2.0.0 initial implementation
 * @ since 2.0.15 changed to public scope
 * @ author WFF */
public boolean removeAttributes ( final boolean updateClient , final String ... attributeNames ) { } }

implementation:
boolean removed = false ; boolean listenerInvoked = false ; final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; try { lock . lock ( ) ; if ( attributesMap == null ) { return false ; } for ( final String attributeName : attributeNames ) { final AbstractAttribute attribute = attributesMap . get ( attributeName ) ; if ( attribute != null ) { attribute . unsetOwnerTag ( this ) ; attributesMap . remove ( attributeName ) ; removed = true ; } } if ( removed ) { attributes = new AbstractAttribute [ attributesMap . size ( ) ] ; attributesMap . values ( ) . toArray ( attributes ) ; setModified ( true ) ; sharedObject . setChildModified ( true ) ; // invokeListener
if ( updateClient ) { final AttributeRemoveListener listener = sharedObject . getAttributeRemoveListener ( ACCESS_OBJECT ) ; if ( listener != null ) { final AttributeRemoveListener . RemovedEvent event = new AttributeRemoveListener . RemovedEvent ( this , attributeNames ) ; listener . removedAttributes ( event ) ; listenerInvoked = true ; } } } } finally { lock . unlock ( ) ; } if ( listenerInvoked ) { final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } } return removed ;


signature:
public class AbstractHtml { /** * marks the owner tag in the attributes
 * @ param attributes
 * @ since 1.0.0
 * @ author WFF */
private void markOwnerTag ( final AbstractAttribute [ ] attributes ) { } }

implementation: if ( attributes == null ) { return ; } for ( final AbstractAttribute abstractAttribute : attributes ) { abstractAttribute . setOwnerTag ( this ) ; }


signature:
public class AbstractHtml { /** * to initialize objects in the constructor
 * @ since 1.0.0
 * @ author WFF */
private void initInConstructor ( ) { } }

implementation: htmlStartSB = new StringBuilder ( tagName == null ? 0 : tagName . length ( ) + 2 + ( ( attributes == null ? 0 : attributes . length ) * 16 ) ) ; htmlEndSB = new StringBuilder ( tagName == null ? 16 : tagName . length ( ) + 3 ) ;


signature:
public class AbstractHtml { /** * NB : this method is for internal use . The returned object should not be
 * modified .
 * @ return the internal children object .
 * @ since 2.0.0
 * @ author WFF */
public Set < AbstractHtml > getChildren ( final Object accessObject ) { } }

implementation: if ( accessObject == null || ! ( SecurityClassConstants . BROWSER_PAGE . equals ( accessObject . getClass ( ) . getName ( ) ) ) ) { throw new WffSecurityException ( "Not allowed to consume this method. This method is for internal use." ) ; } return children ;


signature:
public class AbstractHtml { /** * Removes all current children and adds the given children under this tag .
 * Unlike setter methods , it will not reuse the given set object but it will
 * copy all children from the given set object . < br >
 * @ param children
 * which will be set as the children tag after removing
 * all current children . Empty set or null will remove
 * all current children from this tag .
 * @ since 2.1.12 proper implementation is available since 2.1.12
 * @ author WFF */
public void setChildren ( final Set < AbstractHtml > children ) { } }

implementation: if ( children == null || children . size ( ) == 0 ) { removeAllChildren ( ) ; } else { addInnerHtmls ( children . toArray ( new AbstractHtml [ children . size ( ) ] ) ) ; }


signature:
public class AbstractHtml { /** * Gets the children of this tag as an array . An efficient way to get the
 * children as an array .
 * @ return the array of children of this tag .
 * @ since 3.0.1
 * @ author WFF */
public AbstractHtml [ ] getChildrenAsArray ( ) { } }

implementation: final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . readLock ( ) ; try { lock . lock ( ) ; return children . toArray ( new AbstractHtml [ children . size ( ) ] ) ; } finally { lock . unlock ( ) ; }


signature:
public class AbstractHtml { /** * Gets the first child of this tag . The efficient way to get the first
 * child .
 * @ return the first child of this tag or null if there is no child .
 * @ since 3.0.1
 * @ author WFF */
public AbstractHtml getFirstChild ( ) { } }

implementation:
// this block must be synchronized otherwise may get null or
// ConcurrentModificationException
// the test cases are written to check its thread safety and can be
// reproduce by uncommenting this synchronized block , checkout
// AbstractHtmlTest class for it .
// synchronized ( children ) {
// it ' s been replaced with locking
final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . readLock ( ) ; try { lock . lock ( ) ; // this must be most efficient because the javadoc of findFirst says
// " This is a short - circuiting terminal operation . "
// return ( T ) children . stream ( ) . findFirst ( ) . orElse ( null ) ;
// but as per CodePerformanceTest . testPerformanceOfFindFirst
// the below is faster
final Iterator < AbstractHtml > iterator = children . iterator ( ) ; if ( iterator . hasNext ( ) ) { return iterator . next ( ) ; } return null ; } finally { lock . unlock ( ) ; }


signature:
public class AbstractHtml { /** * Gets the number of children in this tag . An efficient way to find the
 * size of children .
 * @ return the size of children .
 * @ since 3.0.1
 * @ author WFF */
public int getChildrenSize ( ) { } }

implementation: final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . readLock ( ) ; try { lock . lock ( ) ; return children . size ( ) ; } finally { lock . unlock ( ) ; }


signature:
public class AbstractHtml { /** * Gets the child at the specified position . An efficient way to get the
 * child at particular position . If you want to get the child at 0th ( zeroth )
 * index then use { @ code AbstractHtml # getFirstChild ( ) } method instead of
 * this method .
 * @ param index
 * from this index the tag will be returned
 * @ return the child at the specified index .
 * @ since 3.0.1
 * @ author WFF */
public AbstractHtml getChildAt ( final int index ) { } }

implementation: final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . readLock ( ) ; try { lock . lock ( ) ; return children . toArray ( new AbstractHtml [ children . size ( ) ] ) [ index ] ; } finally { lock . unlock ( ) ; }


signature:
public class AbstractHtml { /** * Checks whether a tag is contained in its direct children . An efficient
 * way to check if the given tag is a direct child of this tag .
 * @ param childTag
 * @ return true if the given tag is a child of this tags .
 * @ since 3.0.1
 * @ author WFF */
public boolean containsChild ( final AbstractHtml childTag ) { } }

implementation: final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . readLock ( ) ; try { lock . lock ( ) ; return children . contains ( childTag ) ; } finally { lock . unlock ( ) ; }


signature:
public class AbstractHtml { /** * For internal purpose . Not recommended for external purpose .
 * @ return the opening tag of this object
 * @ author WFF */
public final String getOpeningTag ( ) { } }

implementation: if ( isRebuild ( ) || isModified ( ) ) { final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; try { lock . lock ( ) ; buildOpeningTag ( true ) ; } finally { lock . unlock ( ) ; } } return openingTag ;


signature:
public class AbstractHtml { /** * to form html string from the children
 * @ param children
 * @ param rebuild
 * TODO
 * @ since 1.0.0
 * @ author WFF */
private static void recurChildren ( final StringBuilder tagBuilder , final Set < AbstractHtml > children , final boolean rebuild ) { } }

implementation:
if ( children != null && children . size ( ) > 0 ) { for ( final AbstractHtml child : children ) { child . setRebuild ( rebuild ) ; tagBuilder . append ( child . getOpeningTag ( ) ) ; // final Set < AbstractHtml > childrenOfChildren = child . children ;
// declaring a separate local variable childrenOfChildren will
// consume stack space so directly passed it as argument
recurChildren ( tagBuilder , child . children , rebuild ) ; tagBuilder . append ( child . closingTag ) ; } }


signature:
public class AbstractHtml { /** * Use this method to produce HTML from very heavy and complicated tag
 * hierarchy . For normal and simple HTML hierarchy use { @ code toHtmlString }
 * method which is faster than this method . The advantage of
 * { @ code toBigHtmlString } over { @ code toHtmlString } is it will never throw
 * { @ code StackOverflowError } . < br >
 * NB : - this method has not been undergone all testing process .
 * @ return the HTML string similar to toHtmlString method .
 * @ since 2.1.12
 * @ author WFF */
public String toBigHtmlString ( ) { } }

implementation: final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; try { lock . lock ( ) ; final String printStructure = getPrintStructureWithoutRecursive ( getSharedObject ( ) . isChildModified ( ) ) ; if ( parent == null ) { sharedObject . setChildModified ( false ) ; } return printStructure ; } finally { lock . unlock ( ) ; }


signature:
public class AbstractHtml { /** * Use this method to produce HTML from very heavy and complicated tag
 * hierarchy . For normal and simple HTML hierarchy use
 * { @ code toOutputStream } method which is faster than this method . The
 * advantage of { @ code toBigOutputStream } over { @ code toOutputStream } is it
 * will never throw { @ code StackOverflowError } and the memory consumed at
 * the time of writing could be available for GC ( depends on JVM GC rules ) .
 * < br >
 * NB : - this method has not been undergone all testing process .
 * @ param os
 * the object of { @ code OutputStream } to write to .
 * @ param charset
 * the charset
 * @ return
 * @ throws IOException
 * @ since 2.1.12 */
public int toBigOutputStream ( final OutputStream os , final Charset charset ) throws IOException { } }

implementation: return writePrintStructureToOSWithoutRecursive ( charset , os , true ) ;


signature:
public class AbstractHtml { /** * Use this method to produce HTML from very heavy and complicated tag
 * hierarchy . For normal and simple HTML hierarchy use
 * { @ code toOutputStream } method which is faster than this method . The
 * advantage of { @ code toBigOutputStream } over { @ code toOutputStream } is it
 * will never throw { @ code StackOverflowError } and the memory consumed at
 * the time of writing could be available for GC ( depends on JVM GC rules ) .
 * < br >
 * NB : - this method has not been undergone all testing process .
 * @ param os
 * the object of { @ code OutputStream } to write to .
 * @ param charset
 * the charset
 * @ return the total number of bytes written
 * @ throws IOException
 * @ since 2.1.12 */
public int toBigOutputStream ( final OutputStream os , final String charset ) throws IOException { } }

implementation: if ( charset == null ) { return writePrintStructureToOSWithoutRecursive ( Charset . forName ( charset ) , os , true ) ; } return writePrintStructureToOSWithoutRecursive ( this . charset , os , true ) ;


signature:
public class AbstractHtml { /** * to form html string from the children
 * @ param children
 * @ param rebuild
 * TODO
 * @ param flushOnWrite
 * true to flush on each write to OutputStream
 * @ since 1.0.0
 * @ author WFF
 * @ throws IOException */
private static void recurChildrenToOutputStream ( final int [ ] totalWritten , final Charset charset , final OutputStream os , final Set < AbstractHtml > children , final boolean rebuild , final boolean flushOnWrite ) throws IOException { } }

implementation:
if ( children != null && children . size ( ) > 0 ) { for ( final AbstractHtml child : children ) { child . setRebuild ( rebuild ) ; byte [ ] openingTagBytes = child . getOpeningTag ( ) . getBytes ( charset ) ; os . write ( openingTagBytes ) ; if ( flushOnWrite ) { os . flush ( ) ; } totalWritten [ 0 ] += openingTagBytes . length ; // explicitly dereferenced right after use
// because it ' s a recursive method .
openingTagBytes = null ; // final Set < AbstractHtml > childrenOfChildren = child . children ;
// declaring a separate local variable childrenOfChildren will
// consume stack space so directly passed it as argument
recurChildrenToOutputStream ( totalWritten , charset , os , child . children , rebuild , flushOnWrite ) ; byte [ ] closingTagBytes = child . closingTag . getBytes ( charset ) ; os . write ( closingTagBytes ) ; if ( flushOnWrite ) { os . flush ( ) ; } totalWritten [ 0 ] += closingTagBytes . length ; // explicitly dereferenced right after use
// because it ' s a recursive method .
closingTagBytes = null ; } }


signature:
public class AbstractHtml { /** * to form html string from the children
 * @ param children
 * @ param rebuild
 * TODO
 * @ since 2.0.0
 * @ author WFF
 * @ throws IOException */
private void recurChildrenToWffBinaryMessageOutputStream ( final Set < AbstractHtml > children , final boolean rebuild ) throws IOException { } }

implementation:
if ( children != null && children . size ( ) > 0 ) { for ( final AbstractHtml child : children ) { child . setRebuild ( rebuild ) ; // wffBinaryMessageOutputStreamer
// outputStream . write ( child . getOpeningTag ( ) . getBytes ( charset ) ) ;
NameValue nameValue = new NameValue ( ) ; final int tagNameIndex = TagRegistry . getTagNames ( ) . indexOf ( child . getTagName ( ) ) ; // if the tag index is - 1 i . e . it ' s not indexed then the tag
// name prepended with 0 value byte should be set .
// If the first byte = = 0 and length is greater than 1 then it ' s
// a tag name , if the first byte is greater than 0 then it is
// index bytes
byte [ ] closingTagNameConvertedBytes = null ; if ( tagNameIndex == - 1 ) { final byte [ ] tagNameBytes = child . getTagName ( ) . getBytes ( charset ) ; byte [ ] nameBytes = new byte [ tagNameBytes . length + 1 ] ; nameBytes [ 0 ] = 0 ; System . arraycopy ( tagNameBytes , 0 , nameBytes , 1 , tagNameBytes . length ) ; nameValue . setName ( nameBytes ) ; closingTagNameConvertedBytes = nameBytes ; // explicitly dereferenced right after use
// because it ' s a recursive method .
nameBytes = null ; } else { // final byte [ ] indexBytes = WffBinaryMessageUtil
// . getOptimizedBytesFromInt ( tagNameIndex ) ;
// directly passed it as argument to
// avoid consuming stack space
nameValue . setName ( WffBinaryMessageUtil . getOptimizedBytesFromInt ( tagNameIndex ) ) ; closingTagNameConvertedBytes = WffBinaryMessageUtil . getOptimizedBytesFromInt ( ( tagNameIndex * ( - 1 ) ) ) ; } nameValue . setValues ( child . getAttributeHtmlBytesCompressedByIndex ( rebuild , charset ) ) ; wffBinaryMessageOutputStreamer . write ( nameValue ) ; // explicitly dereferenced right after use
// because it ' s a recursive method .
nameValue = null ; // final Set < AbstractHtml > childrenOfChildren = child . children ;
// declaring a separate local variable childrenOfChildren will
// consume stack space so directly passed it as argument
recurChildrenToWffBinaryMessageOutputStream ( child . children , rebuild ) ; NameValue closingTagNameValue = new NameValue ( ) ; closingTagNameValue . setName ( closingTagNameConvertedBytes ) ; closingTagNameValue . setValues ( new byte [ 0 ] [ 0 ] ) ; wffBinaryMessageOutputStreamer . write ( closingTagNameValue ) ; // explicitly dereferenced right after use
// because it ' s a recursive method .
closingTagNameValue = null ; closingTagNameConvertedBytes = null ; // outputStream . write ( child . closingTag . getBytes ( charset ) ) ;
} }


signature:
public class AbstractHtml { /** * ( non - Javadoc )
 * @ see com . webfirmframework . wffweb . tag . TagBase # toHtmlString ( )
 * @ since 1.0.0
 * @ author WFF */
@ Override public String toHtmlString ( ) { } }

implementation: final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; try { lock . lock ( ) ; final String printStructure = getPrintStructure ( getSharedObject ( ) . isChildModified ( ) ) ; if ( parent == null ) { sharedObject . setChildModified ( false ) ; } return printStructure ; } finally { lock . unlock ( ) ; }


signature:
public class AbstractHtml { /** * ( non - Javadoc )
 * @ see com . webfirmframework . wffweb . tag . core . TagBase # toHtmlString ( java . nio .
 * charset . Charset ) */
@ Override public String toHtmlString ( final Charset charset ) { } }

implementation:
final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; final Charset previousCharset = this . charset ; try { lock . lock ( ) ; this . charset = charset ; // assigning it to new variable is very important here as this
// line of code should invoke before finally block
final String htmlString = toHtmlString ( ) ; return htmlString ; } finally { this . charset = previousCharset ; lock . unlock ( ) ; }


signature:
public class AbstractHtml { /** * @ param os
 * the object of { @ code OutputStream } to write to .
 * @ param rebuild
 * true to rebuild & amp ; false to write previously
 * built bytes .
 * @ param flushOnWrite
 * true to flush on each write to OutputStream
 * @ return the total number of bytes written
 * @ throws IOException
 * @ since 3.0.2 */
public int toOutputStream ( final OutputStream os , final boolean rebuild , final boolean flushOnWrite ) throws IOException { } }

implementation: return writePrintStructureToOutputStream ( os , rebuild , charset , flushOnWrite ) ;


signature:
public class AbstractHtml { /** * Inserts the given tags before this tag . There must be a parent for this
 * method tag .
 * @ param abstractHtmls
 * to insert before this tag
 * @ return true if inserted otherwise false .
 * @ since 2.1.1
 * @ author WFF */
public boolean insertBefore ( final AbstractHtml ... abstractHtmls ) { } }

implementation: if ( parent == null ) { throw new NoParentException ( "There must be a parent for this tag." ) ; } final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; boolean result = false ; try { lock . lock ( ) ; final AbstractHtml [ ] removedParentChildren = parent . children . toArray ( new AbstractHtml [ parent . children . size ( ) ] ) ; result = insertBefore ( removedParentChildren , abstractHtmls ) ; } finally { lock . unlock ( ) ; } final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } return result ;


signature:
public class AbstractHtml { /** * should be used inside a synchronized block . NB : - It ' s removing
 * removedParentChildren by parent . children . clear ( ) ; in this method .
 * @ param removedParentChildren
 * just pass the parent children , no need
 * to remove it from parent . It ' s removing
 * by parent . children . clear ( ) ;
 * @ param abstractHtmls
 * @ return true if inserted otherwise false .
 * @ since 2.1.6
 * @ author WFF */
private boolean insertBefore ( final AbstractHtml [ ] removedParentChildren , final AbstractHtml [ ] abstractHtmls ) { } }

implementation:
final int parentChildrenSize = parent . children . size ( ) ; if ( parentChildrenSize > 0 ) { final InsertBeforeListener insertBeforeListener = sharedObject . getInsertBeforeListener ( ACCESS_OBJECT ) ; parent . children . clear ( ) ; final InsertBeforeListener . Event [ ] events = new InsertBeforeListener . Event [ abstractHtmls . length ] ; int count = 0 ; for ( final AbstractHtml parentChild : removedParentChildren ) { if ( equals ( parentChild ) ) { for ( final AbstractHtml abstractHtmlToInsert : abstractHtmls ) { final boolean alreadyHasParent = abstractHtmlToInsert . parent != null ; if ( insertBeforeListener != null ) { AbstractHtml previousParent = null ; if ( abstractHtmlToInsert . parent != null && abstractHtmlToInsert . parent . sharedObject == sharedObject ) { previousParent = abstractHtmlToInsert . parent ; } final InsertBeforeListener . Event event = new InsertBeforeListener . Event ( parent , abstractHtmlToInsert , this , previousParent ) ; events [ count ] = event ; count ++ ; } // if alreadyHasParent = true then it means the
// child is
// moving from one tag to another .
if ( alreadyHasParent ) { abstractHtmlToInsert . parent . children . remove ( abstractHtmlToInsert ) ; } initSharedObject ( abstractHtmlToInsert ) ; abstractHtmlToInsert . parent = parent ; parent . children . add ( abstractHtmlToInsert ) ; } } parent . children . add ( parentChild ) ; } if ( insertBeforeListener != null ) { insertBeforeListener . insertedBefore ( events ) ; } return true ; } return false ;


signature:
public class AbstractHtml { /** * Inserts the given tags after this tag . There must be a parent for this
 * method tag . < br >
 * Note : This { @ code insertAfter } method might be bit slower ( in terms of
 * nano optimization ) than { @ code insertBefore } method as it internally uses
 * { @ code insertBefore } method . This will be improved in the future version .
 * @ param abstractHtmls
 * to insert after this tag
 * @ return true if inserted otherwise false .
 * @ since 2.1.6
 * @ author WFF */
public boolean insertAfter ( final AbstractHtml ... abstractHtmls ) { } }

implementation: if ( parent == null ) { throw new NoParentException ( "There must be a parent for this tag." ) ; } final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; boolean result = false ; try { lock . lock ( ) ; final AbstractHtml [ ] childrenOfParent = parent . children . toArray ( new AbstractHtml [ parent . children . size ( ) ] ) ; for ( int i = 0 ; i < childrenOfParent . length ; i ++ ) { if ( equals ( childrenOfParent [ i ] ) ) { if ( i < ( childrenOfParent . length - 1 ) ) { return childrenOfParent [ i + 1 ] . insertBefore ( childrenOfParent , abstractHtmls ) ; } else { parent . appendChildrenLockless ( abstractHtmls ) ; } result = true ; } } } finally { lock . unlock ( ) ; } final PushQueue pushQueue = sharedObject . getPushQueue ( ACCESS_OBJECT ) ; if ( pushQueue != null ) { pushQueue . push ( ) ; } return result ;


signature:
public class AbstractHtml { /** * Loops through all nested children tags ( excluding the given tag ) of the
 * given tag . The looping is in a random order to gain maximum performance
 * and minimum memory footprint .
 * @ param nestedChild
 * the object of NestedChild from which the
 * eachChild ( AbstractHtml ) to be invoked .
 * @ param includeParents
 * true to include the given parent tags in the
 * loop
 * @ param parents
 * the tags from which to loop through .
 * @ since 2.1.8
 * @ author WFF */
protected static void loopThroughAllNestedChildren ( final NestedChild nestedChild , final boolean includeParents , final AbstractHtml ... parents ) { } }

implementation: final Deque < Set < AbstractHtml > > childrenStack = new ArrayDeque < > ( ) ; if ( includeParents ) { final Set < AbstractHtml > parentsSet = new HashSet < > ( parents . length ) ; Collections . addAll ( parentsSet , parents ) ; childrenStack . push ( parentsSet ) ; } else { for ( final AbstractHtml parent : parents ) { childrenStack . push ( parent . children ) ; } } Set < AbstractHtml > children ; exit : while ( ( children = childrenStack . poll ( ) ) != null ) { for ( final AbstractHtml eachChild : children ) { if ( ! nestedChild . eachChild ( eachChild ) ) { break exit ; } final Set < AbstractHtml > subChildren = eachChild . children ; if ( subChildren != null && subChildren . size ( ) > 0 ) { childrenStack . push ( subChildren ) ; } } }


signature:
public class AbstractHtml { /** * Resets the hierarchy of this tag so that it can be used in another
 * instance of { @ code BrowserPage } . If a tag is used under a
 * { @ code BrowserPage } instance and the same instance of tag needs to be
 * used in another instance of { @ code BrowserPage } then the tag needs to be
 * reset before use otherwise there could be some strange behaviour in the
 * UI . To avoid compromising performance such usage never throws any
 * exception . < br >
 * NB : - Child tag cannot be reset , i . e . this tag should not be a child of
 * another tag .
 * @ throws InvalidTagException
 * if the tag is already used by another
 * tag , i . e . if this tag has a parent tag .
 * @ since 2.1.13
 * @ author WFF */
public final void resetHierarchy ( ) throws InvalidTagException { } }

implementation: if ( parent != null ) { throw new InvalidTagException ( "Child tag cannot be reset" ) ; } final Lock lock = sharedObject . getLock ( ACCESS_OBJECT ) . writeLock ( ) ; try { lock . lock ( ) ; loopThroughAllNestedChildren ( child -> { child . removeAttributes ( false , DataWffId . ATTRIBUTE_NAME ) ; return true ; } , true , this ) ; } finally { lock . unlock ( ) ; }


signature:
public class AbstractHtml { /** * NB : it might lead to StackOverflowException if the tag hierarchy is deep .
 * @ return stream of all nested children including this parent object .
 * @ since 3.0.0
 * @ author WFF */
private Stream < AbstractHtml > buildNestedChildrenIncludingParent ( ) { } }

implementation: return Stream . concat ( Stream . of ( this ) , children . stream ( ) . flatMap ( AbstractHtml :: buildNestedChildrenIncludingParent ) ) ;


signature:
public class Flex { /** * checks the given css value is valid for this class . It does ' t do a strict
 * validation .
 * @ param cssValue
 * @ return
 * @ since 1.0.0
 * @ author WFF */
public static boolean isValid ( final String cssValue ) { } }

implementation:
// TODO modify to make a strict validation
if ( cssValue == null || StringUtil . isBlank ( cssValue ) ) { return false ; } final String [ ] cssValueParts = StringUtil . splitBySpace ( cssValue ) ; FlexGrow flexGrow = null ; FlexShrink flexShrink = null ; FlexBasis flexBasis = null ; for ( final String eachPart : cssValueParts ) { boolean invalid = true ; if ( flexGrow == null && FlexGrow . isValid ( eachPart ) ) { flexGrow = new FlexGrow ( eachPart ) ; invalid = false ; } else if ( flexShrink == null && FlexShrink . isValid ( eachPart ) ) { flexShrink = new FlexShrink ( eachPart ) ; invalid = false ; } else if ( flexBasis == null && FlexBasis . isValid ( eachPart ) ) { flexBasis = new FlexBasis ( eachPart ) ; invalid = false ; } if ( invalid ) { return false ; } } return flexGrow != null || flexShrink != null || flexBasis != null ;


signature:
public class AbstractValueSetAttribute { /** * sets the value for this attribute
 * @ param updateClient
 * true to update client browser page if it is
 * available . The default value is true but it will
 * be ignored if there is no client browser page .
 * @ param value
 * the value for the attribute .
 * @ since 2.1.15
 * @ author WFF */
@ Override protected void setAttributeValue ( final boolean updateClient , final String value ) { } }

implementation: if ( value != null ) { final Collection < String > allValues = extractValues ( value ) ; super . replaceAllInAttributeValueSet ( updateClient , allValues ) ; }


signature:
public class AbstractValueSetAttribute { /** * splits by space */
private static Collection < String > extractValues ( final String value ) { } }

implementation:
final String [ ] inputValues = StringUtil . splitBySpace ( value ) ; final Collection < String > allValues = new ArrayDeque < > ( ) ; for ( final String each : inputValues ) { // As per Collections . addAll ' s doc it is faster than
// allValues . addAll ( Arrays . asList ( values ) ) ;
Collections . addAll ( allValues , StringUtil . strip ( each ) ) ; } return allValues ;


signature:
public class AbstractValueSetAttribute { /** * Removes all values from the attributeValueSet and adds the given
 * attribute values .
 * @ param updateClient
 * @ param attrValues
 * @ since 3.0.1 */
protected void replaceAllInAttributeValueSet ( final boolean updateClient , final String ... attrValues ) { } }

implementation: if ( attrValues != null ) { final Collection < String > allValues = new ArrayDeque < > ( ) ; for ( final String attrValue : attrValues ) { if ( attrValue != null ) { allValues . addAll ( extractValues ( attrValue ) ) ; } } super . replaceAllInAttributeValueSet ( updateClient , allValues ) ; }


signature:
public class Columns { /** * checks the given css value is valid for this class . It does ' t do a strict
 * validation .
 * @ param cssValue
 * @ return
 * @ since 1.0.0
 * @ author WFF */
public static boolean isValid ( final String cssValue ) { } }

implementation: if ( cssValue == null || StringUtil . isBlank ( cssValue ) ) { return false ; } final String [ ] cssValueParts = StringUtil . splitBySpace ( cssValue ) ; ColumnWidth columnWidth = null ; ColumnCount columnCount = null ; for ( final String eachPart : cssValueParts ) { boolean invalid = true ; if ( columnWidth == null && ColumnWidth . isValid ( eachPart ) ) { columnWidth = new ColumnWidth ( eachPart ) ; invalid = false ; } else if ( columnCount == null && ColumnCount . isValid ( eachPart ) ) { columnCount = new ColumnCount ( eachPart ) ; invalid = false ; } if ( invalid ) { return false ; } } return columnWidth != null || columnCount != null ;


signature:
public class Margin { /** * sets the top , right , bottom and left width in { @ code Margin } . If the
 * given argument is already used by another object , then the
 * existing / cloned object will be used . And throws
 * { @ code NullValueException } if any of the given argument is null .
 * @ param marginTop
 * @ param marginRight
 * @ param marginBottom
 * @ param marginLeft
 * @ author WFF
 * @ since 1.0.0 */
public void setMargin ( final MarginTop marginTop , final MarginRight marginRight , final MarginBottom marginBottom , final MarginLeft marginLeft ) { } }

implementation: if ( marginTop != null && marginRight != null && marginBottom != null && marginLeft != null ) { if ( MarginTop . INITIAL . equals ( marginTop . getCssValue ( ) ) || MarginTop . INHERIT . equals ( marginTop . getCssValue ( ) ) || MarginRight . INITIAL . equals ( marginRight . getCssValue ( ) ) || MarginRight . INHERIT . equals ( marginRight . getCssValue ( ) ) || MarginBottom . INITIAL . equals ( marginBottom . getCssValue ( ) ) || MarginBottom . INHERIT . equals ( marginBottom . getCssValue ( ) ) || MarginLeft . INITIAL . equals ( marginLeft . getCssValue ( ) ) || MarginLeft . INHERIT . equals ( marginLeft . getCssValue ( ) ) ) { throw new InvalidValueException ( "Any or all of the given arguments have initial/inherit constant value as its cssValue" ) ; } try { final MarginTop marginTopTemp ; final MarginRight marginRightTemp ; final MarginBottom marginBottomTemp ; final MarginLeft marginLeftTemp ; if ( this . marginTop != null ) { this . marginTop . setAlreadyInUse ( false ) ; this . marginRight . setAlreadyInUse ( false ) ; this . marginBottom . setAlreadyInUse ( false ) ; this . marginLeft . setAlreadyInUse ( false ) ; } if ( marginTop . isAlreadyInUse ( ) && this . marginTop != marginTop ) { if ( this . marginTop != null ) { marginTopTemp = this . marginTop . setCssValue ( marginTop . getCssValue ( ) ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginTop is already used by another object so the existing object is used" ) ; } } else { marginTopTemp = marginTop . clone ( ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginTop is already used by another object so its clone is assigned" ) ; } } } else { marginTopTemp = marginTop ; } if ( marginRight . isAlreadyInUse ( ) && this . marginRight != marginRight ) { if ( this . marginRight != null ) { marginRightTemp = this . marginRight . setCssValue ( marginTop . getCssValue ( ) ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginRight is already used by another object so the existing object is used" ) ; } } else { marginRightTemp = marginRight . clone ( ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginRight is already used by another object so its clone is assigned" ) ; } } } else { marginRightTemp = marginRight ; } if ( marginBottom . isAlreadyInUse ( ) && this . marginBottom != marginBottom ) { if ( this . marginBottom != null ) { marginBottomTemp = this . marginBottom . setCssValue ( marginTop . getCssValue ( ) ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginBottom is already used by another object so the existing object is used" ) ; } } else { marginBottomTemp = marginBottom . clone ( ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginBottom is already used by another object so its clone is assigned" ) ; } } } else { marginBottomTemp = marginBottom ; } if ( marginLeft . isAlreadyInUse ( ) && this . marginLeft != marginLeft ) { if ( this . marginLeft != null ) { marginLeftTemp = this . marginLeft . setCssValue ( marginTop . getCssValue ( ) ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginLeft is already used by another object so the existing object is used" ) ; } } else { marginLeftTemp = marginLeft . clone ( ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginLeft is already used by another object so its clone is assigned" ) ; } } } else { marginLeftTemp = marginLeft ; } marginTopTemp . setAlreadyInUse ( true ) ; marginTopTemp . setStateChangeInformer ( this ) ; marginRightTemp . setAlreadyInUse ( true ) ; marginRightTemp . setStateChangeInformer ( this ) ; marginBottomTemp . setAlreadyInUse ( true ) ; marginBottomTemp . setStateChangeInformer ( this ) ; marginLeftTemp . setAlreadyInUse ( true ) ; marginLeftTemp . setStateChangeInformer ( this ) ; assignProducedCssValue ( marginTop , marginRight , marginBottom , marginLeft ) ; this . marginTop = marginTopTemp ; this . marginRight = marginRightTemp ; this . marginBottom = marginBottomTemp ; this . marginLeft = marginLeftTemp ; } catch ( final CloneNotSupportedException e ) { throw new InvalidValueException ( e ) ; } catch ( final Exception e ) { throw new InvalidValueException ( e ) ; } } else { throw new NullValueException ( "cannot accept null arguments" ) ; }


signature:
public class Margin { /** * ( non - Javadoc )
 * @ see
 * com . webfirmframework . wffweb . informer . StateChangeInformer # stateChanged (
 * java . lang . Object ) */
@ Override public void stateChanged ( final CssProperty stateChangedObject ) { } }

implementation: if ( stateChangedObject instanceof MarginTop ) { final MarginTop marginTop = ( MarginTop ) stateChangedObject ; if ( MarginTop . INITIAL . equals ( marginTop . getCssValue ( ) ) || MarginTop . INHERIT . equals ( marginTop . getCssValue ( ) ) ) { throw new InvalidValueException ( "marginTop cannot have initial/inherit as its cssValue" ) ; } } else if ( stateChangedObject instanceof MarginRight ) { final MarginRight marginRight = ( MarginRight ) stateChangedObject ; if ( MarginRight . INITIAL . equals ( marginRight . getCssValue ( ) ) || MarginRight . INHERIT . equals ( marginRight . getCssValue ( ) ) ) { throw new InvalidValueException ( "marginRight cannot have initial/inherit as its cssValue" ) ; } } else if ( stateChangedObject instanceof MarginBottom ) { final MarginBottom marginBottom = ( MarginBottom ) stateChangedObject ; if ( MarginBottom . INITIAL . equals ( marginBottom . getCssValue ( ) ) || MarginBottom . INHERIT . equals ( marginBottom . getCssValue ( ) ) ) { throw new InvalidValueException ( "marginBottom cannot have initial/inherit as its cssValue" ) ; } } else if ( stateChangedObject instanceof MarginLeft ) { final MarginLeft marginLeft = ( MarginLeft ) stateChangedObject ; if ( MarginLeft . INITIAL . equals ( marginLeft . getCssValue ( ) ) || MarginLeft . INHERIT . equals ( marginLeft . getCssValue ( ) ) ) { throw new InvalidValueException ( "marginLeft cannot have initial/inherit as its cssValue" ) ; } } assignProducedCssValue ( marginTop , marginRight , marginBottom , marginLeft ) ;


signature:
public class Form { /** * prepares and gets the js object for the given tag names under this form
 * tag . This js object may be used to return in onsubmit attribute .
 * @ param onlyForTagNames
 * TagNameConstants . INPUT ,
 * TagNameConstants . TEXTAREA and
 * TagNameConstants . SELECT . Pass object of
 * { @ code List } , { @ code HashSet } based on the
 * number of elements in it .
 * @ return the js object string for the given tag names . The returned js
 * string will be as { name1 . name1 . value } where name1 is the value of
 * name attribute of the field .
 * @ since 2.1.8
 * @ since 2.1.13 changed { @ code Collection < Set > onlyForTagNames } to
 * { @ code Collection < String > onlyForTagNames } .
 * @ author WFF */
public String getNameBasedJsObject ( final Collection < String > onlyForTagNames ) { } }

implementation:
// " { " should not be changed to ' { '
final StringBuilder jsObjectBuilder = new StringBuilder ( "{" ) ; final Set < String > appendedValues = new HashSet < > ( ) ; loopThroughAllNestedChildren ( child -> { final String tagName = child . getTagName ( ) ; if ( onlyForTagNames . contains ( tagName ) ) { final AbstractAttribute nameAttr = child . getAttributeByName ( AttributeNameConstants . NAME ) ; final AbstractAttribute typeAttr = child . getAttributeByName ( AttributeNameConstants . TYPE ) ; if ( nameAttr != null ) { final String nameAttrValue = nameAttr . getAttributeValue ( ) ; if ( ! appendedValues . contains ( nameAttrValue ) ) { if ( typeAttr != null ) { final String typeAttrValue = typeAttr . getAttributeValue ( ) ; if ( Type . CHECKBOX . equals ( typeAttrValue ) || Type . RADIO . equals ( typeAttrValue ) ) { jsObjectBuilder . append ( nameAttrValue ) . append ( ':' ) . append ( nameAttrValue ) . append ( ".checked," ) ; appendedValues . add ( nameAttrValue ) ; } else { jsObjectBuilder . append ( nameAttrValue ) . append ( ':' ) . append ( nameAttrValue ) . append ( ".value," ) ; appendedValues . add ( nameAttrValue ) ; } } else { jsObjectBuilder . append ( nameAttrValue ) . append ( ':' ) . append ( nameAttrValue ) . append ( ".value," ) ; appendedValues . add ( nameAttrValue ) ; } } } } return true ; } , false , this ) ; return jsObjectBuilder . replace ( jsObjectBuilder . length ( ) - 1 , jsObjectBuilder . length ( ) , "}" ) . toString ( ) ;


signature:
public class Form { /** * prepares and gets the js object for the given tag names under this form
 * tag . This js object may be used to return in onsubmit attribute .
 * @ param functionName
 * the function name to get the element , eg :
 * document . getElementById
 * @ param onlyForTagNames
 * TagNameConstants . INPUT ,
 * TagNameConstants . TEXTAREA and
 * TagNameConstants . SELECT Pass object of
 * { @ code List } , { @ code HashSet } based on the
 * number of elements in it .
 * @ return the js object string for the given tag names . The returned js
 * string will be as { name1 : document . getElementById ( ' name1 ' ) . value }
 * where name1 is the value of id attribute of the field .
 * @ since 3.0.1
 * @ author WFF */
public String getIdBasedJsObject ( final String functionName , final Collection < String > onlyForTagNames ) { } }

implementation:
// " { " should not be changed to ' { ' if passing arg in constructor of
// StringBuilder
final StringBuilder jsObjectBuilder = new StringBuilder ( "{" ) ; final Set < String > appendedValues = new HashSet < > ( ) ; loopThroughAllNestedChildren ( child -> { final String tagName = child . getTagName ( ) ; if ( onlyForTagNames . contains ( tagName ) ) { final AbstractAttribute idAttr = child . getAttributeByName ( AttributeNameConstants . ID ) ; final AbstractAttribute typeAttr = child . getAttributeByName ( AttributeNameConstants . TYPE ) ; if ( idAttr != null ) { final String idAttrValue = idAttr . getAttributeValue ( ) ; if ( ! appendedValues . contains ( idAttrValue ) ) { final String docById = functionName + "('" + idAttrValue + "')" ; if ( typeAttr != null ) { final String typeAttrValue = typeAttr . getAttributeValue ( ) ; if ( Type . CHECKBOX . equals ( typeAttrValue ) || Type . RADIO . equals ( typeAttrValue ) ) { jsObjectBuilder . append ( idAttrValue ) . append ( ':' ) . append ( docById ) . append ( ".checked," ) ; appendedValues . add ( idAttrValue ) ; } else { jsObjectBuilder . append ( idAttrValue ) . append ( ':' ) . append ( docById ) . append ( ".value," ) ; appendedValues . add ( idAttrValue ) ; } } else { jsObjectBuilder . append ( idAttrValue ) . append ( ':' ) . append ( docById ) . append ( ".value," ) ; appendedValues . add ( idAttrValue ) ; } } } } return true ; } , false , this ) ; return jsObjectBuilder . replace ( jsObjectBuilder . length ( ) - 1 , jsObjectBuilder . length ( ) , "}" ) . toString ( ) ;


signature:
public class AbstractHtmlView { /** * ( non - Javadoc )
 * @ see com . webfirmframework . wffweb . tag . Base # toValueString ( ) */
@ Override public String toHtmlString ( ) { } }

implementation: final OutputBuffer outputBuffer = outputBufferTL . get ( ) ; if ( ! preserveOutputBufferContent ) { outputBuffer . setLength ( 0 ) ; } develop ( outputBuffer ) ; return outputBuffer . toBuilderString ( ) ;


signature:
public class Cursor { /** * This method is for CSS 2.1 cursor syntax . < br >
 * sample code : -
 * { @ code cursor . setCursorUrls ( " auto " , " Test . gif " , " TestImage . png " ) } creates
 * < code > cursor : url ( " Test . gif " ) , url ( " TestImage . png " ) , auto ; < / code > . For
 * css3 syntax method please use
 * { @ code setCursorUrls ( String cursorType , UrlCss3Value . . . urlCss3Values ) }
 * method .
 * @ param cursorType
 * This will be the last value , eg : - < code > auto < / code >
 * in
 * < code > cursor : url ( Test . gif ) , url ( TestImage . png ) , auto ; < / code > .
 * This value can not be null . And , it will throw
 * { @ code NullValueException } for null value .
 * @ param cursorUrls
 * an array of cursor urls , eg : -
 * { @ code cursor . setCursorUrls ( " auto " , " Test . gif " , " TestImage . png " ) }
 * and the generated css will be
 * < code > cursor : url ( " Test . gif " ) , url ( " TestImage . png " ) , auto ; < / code >
 * @ since 1.0.0
 * @ author WFF */
public void setCursorUrls ( final String cursorType , final String ... cursorUrls ) { } }

implementation: if ( cursorType == null ) { throw new NullValueException ( "cursorType is null" ) ; } if ( cursorUrls == null ) { throw new NullValueException ( "cursorUrls is null" ) ; } if ( ! ALL_CURSORTYPES . contains ( StringUtil . strip ( cursorType ) . toLowerCase ( ) ) ) { throw new InvalidValueException ( cursorType + " is invalid. The cursorType should be any predefined cursor type, eg default, auto etc.." ) ; } final StringBuilder sb = new StringBuilder ( ) ; for ( final String cursorUrl : cursorUrls ) { final String urlString = "url(\"" . concat ( cursorUrl ) . concat ( "\"), " ) ; sb . append ( urlString ) ; } String cssValue = sb . toString ( ) ; cssValue = cssValue . endsWith ( ", " ) ? cssValue . concat ( cursorType ) : cursorType ; setCssValue ( cssValue ) ; this . cursorType = cursorType ; this . cursorUrls = cursorUrls ;


signature:
public class BorderImageSlice { /** * adds the value { @ code fill } in cssValue .
 * @ since 1.0.0
 * @ author WFF */
public void addFill ( ) { } }

implementation: middle = FILL ; cssValue = cssValue . replace ( FILL , "" ) . concat ( " " ) . concat ( FILL ) ; if ( getStateChangeInformer ( ) != null ) { getStateChangeInformer ( ) . stateChanged ( this ) ; }


signature:
public class BorderImageSlice { /** * validates if the given cssValue is valid for this class .
 * @ param cssValue
 * the value to check .
 * @ return true if valid and false if invalid .
 * @ author WFF
 * @ since 1.0.0 */
public static boolean isValid ( final String cssValue ) { } }

implementation: final String trimmedCssValue = StringUtil . convertToSingleSpace ( TagStringUtil . toLowerCase ( StringUtil . strip ( cssValue ) ) ) ; if ( PREDEFINED_CONSTANTS . contains ( trimmedCssValue ) ) { return true ; } final String [ ] cssValueParts = StringUtil . splitBySpace ( trimmedCssValue ) ; if ( cssValueParts . length > 5 ) { return false ; } if ( ( cssValue . length ( ) - cssValue . replace ( FILL , "" ) . length ( ) ) > FILL . length ( ) ) { return false ; } for ( final String cssValuePart : cssValueParts ) { final Object [ ] lengthValueAndUnit = CssLengthUtil . getLengthValueAndUnit ( cssValuePart ) ; if ( lengthValueAndUnit . length == 0 && ! FILL . equals ( cssValuePart ) ) { return false ; } } return true ;


signature:
public class TagStringUtil { /** * In html , the tag characters are supposed to use a limited number of
 * characters like ' a ' - ' z ' , ' A ' - ' Z ' , ' 0 ' - ' 9 ' , ' . ' , ' , ' , ' - ' etc . . . only . *
 * This method gains performance than the native
 * { @ code String . toLowerCase ( ) } method .
 * @ param value
 * The String to lower case
 * @ return The lower case string
 * @ author WFF */
public static String toLowerCase ( final String value ) { } }

implementation: final char [ ] chars = value . toCharArray ( ) ; for ( int i = 0 ; i < chars . length ; i ++ ) { chars [ i ] = LOWER_CASE_CHARS [ chars [ i ] ] ; } return new String ( chars ) ;


signature:
public class TagStringUtil { /** * In html , the tag characters are supposed to use a limited number of
 * characters like ' a ' - ' z ' , ' A ' - ' Z ' , ' 0 ' - ' 9 ' , ' . ' , ' , ' , ' - ' etc . . . < br >
 * This method gains performance than the native
 * { @ code String . toUpperCase ( ) } method .
 * @ param value
 * The String to lower case
 * @ return The upper case string
 * @ author WFF */
public static String toUpperCase ( final String value ) { } }

implementation: final char [ ] chars = value . toCharArray ( ) ; for ( int i = 0 ; i < chars . length ; i ++ ) { chars [ i ] = UPPER_CASE_CHARS [ chars [ i ] ] ; } return new String ( chars ) ;


signature:
public class BrowserPage { /** * adds the WebSocket listener for the given WebSocket session
 * @ param sessionId
 * the unique id of WebSocket session
 * @ param wsListener
 * @ since 2.1.0
 * @ author WFF */
public final void addWebSocketPushListener ( final String sessionId , final WebSocketPushListener wsListener ) { } }

implementation: sessionIdWsListeners . put ( sessionId , wsListener ) ; wsListeners . push ( wsListener ) ; this . wsListener = wsListener ; if ( pushQueueOnNewWebSocketListener ) { pushWffBMBytesQueue ( ) ; }


signature:
public class BrowserPage { /** * removes the WebSocket listener added for this WebSocket session
 * @ param sessionId
 * the unique id of WebSocket session
 * @ since 2.1.0
 * @ author WFF */
public final void removeWebSocketPushListener ( final String sessionId ) { } }

implementation: final WebSocketPushListener removed = sessionIdWsListeners . remove ( sessionId ) ; wsListeners . remove ( removed ) ; wsListener = wsListeners . peek ( ) ;


signature:
public class BrowserPage { /** * executes the task in the given wff binary message . < br >
 * For WFF authors : - Make sure that the passing { @ code message } is not
 * empty while consuming this method , just as made conditional checking in
 * { @ code BrowserPage # webSocketMessaged ( byte [ ] ) } method .
 * @ since 2.0.0
 * @ author WFF
 * @ throws UnsupportedEncodingException
 * throwing this exception will be
 * removed in future version
 * because its internal
 * implementation will never make
 * this exception due to the code
 * changes since 3.0.1. */
private void executeWffBMTask ( final byte [ ] message ) throws UnsupportedEncodingException { } }

implementation:
final List < NameValue > nameValues = WffBinaryMessageUtil . VERSION_1 . parse ( message ) ; final NameValue task = nameValues . get ( 0 ) ; final byte taskValue = task . getValues ( ) [ 0 ] [ 0 ] ; if ( Task . TASK . getValueByte ( ) == task . getName ( ) [ 0 ] ) { // IM stands for Invoke Method
if ( taskValue == Task . INVOKE_ASYNC_METHOD . getValueByte ( ) ) { invokeAsychMethod ( nameValues ) ; } else if ( taskValue == Task . INVOKE_CUSTOM_SERVER_METHOD . getValueByte ( ) ) { invokeCustomServerMethod ( nameValues ) ; } else if ( taskValue == Task . REMOVE_BROWSER_PAGE . getValueByte ( ) ) { removeBrowserPageFromContext ( nameValues ) ; } }


signature:
public class BrowserPage { /** * NB : this method should not be called under { @ link BrowserPage # render ( ) }
 * method because this method internally calls { @ link BrowserPage # render ( ) }
 * method .
 * @ return { @ code String } equalent to the html string of the tag including
 * the child tags .
 * @ author WFF */
public String toHtmlString ( ) { } }

implementation: initAbstractHtml ( ) ; wsWarningDisabled = true ; beforeToHtml ( rootTag ) ; wsWarningDisabled = false ; final String htmlString = rootTag . toHtmlString ( true ) ; wsWarningDisabled = true ; afterToHtml ( rootTag ) ; wsWarningDisabled = false ; return htmlString ;


signature:
public class BrowserPage { /** * NB : this method should not be called under { @ link BrowserPage # render ( ) }
 * method because this method internally calls { @ link BrowserPage # render ( ) }
 * method .
 * @ param os
 * the object of { @ code OutputStream } to write to .
 * @ return the total number of bytes written
 * @ since 2.1.4 void toOutputStream
 * @ since 2.1.8 int toOutputStream
 * @ throws IOException */
public int toOutputStream ( final OutputStream os ) throws IOException { } }

implementation: initAbstractHtml ( ) ; wsWarningDisabled = true ; beforeToHtml ( rootTag ) ; wsWarningDisabled = false ; final int totalWritten = rootTag . toOutputStream ( os , true ) ; wsWarningDisabled = true ; afterToHtml ( rootTag ) ; wsWarningDisabled = false ; return totalWritten ;


signature:
public class BrowserPage { /** * unholds push if not already unheld . Usage : -
 * < pre >
 * try {
 * browserPage . holdPush ( ) ;
 * for ( AbstractHtml tag : tags ) {
 * tag . removeAttributes ( " style " ) ;
 * / / other tag manipulations
 * } finally {
 * browserPage . unholdPush ( ) ;
 * < / pre >
 * @ since 2.1.3
 * @ author WFF */
public final void unholdPush ( ) { } }

implementation: if ( holdPush . get ( ) > 0 ) { synchronized ( wffBMBytesQueue ) { holdPush . decrementAndGet ( ) ; ByteBuffer wffBM = wffBMBytesHoldPushQueue . poll ( ) ; if ( wffBM != null ) { final NameValue invokeMultipleTasks = Task . getTaskOfTasksNameValue ( ) ; final Deque < ByteBuffer > wffBMs = new ArrayDeque < > ( wffBMBytesHoldPushQueue . size ( ) + 1 ) ; do { wffBMs . add ( wffBM ) ; wffBM = wffBMBytesHoldPushQueue . poll ( ) ; } while ( wffBM != null ) ; final byte [ ] [ ] values = new byte [ wffBMs . size ( ) ] [ 0 ] ; int index = 0 ; for ( final ByteBuffer eachWffBM : wffBMs ) { values [ index ] = eachWffBM . array ( ) ; index ++ ; } invokeMultipleTasks . setValues ( values ) ; wffBMBytesQueue . add ( ByteBuffer . wrap ( WffBinaryMessageUtil . VERSION_1 . getWffBinaryMessageBytes ( invokeMultipleTasks ) ) ) ; pushQueueSize . increment ( ) ; pushWffBMBytesQueue ( ) ; } } }


signature:
public class BrowserPage { /** * By default On . TAB _ CLOSE and On . INIT _ REMOVE _ PREVIOUS are enabled .
 * @ param enable
 * @ param ons
 * the instance of On to represent on which browser event
 * the browser page needs to be removed .
 * @ since 2.1.4
 * @ author WFF */
public final void removeFromContext ( final boolean enable , final On ... ons ) { } }

implementation: for ( final On on : ons ) { if ( On . TAB_CLOSE . equals ( on ) ) { removeFromBrowserContextOnTabClose = enable ; } else if ( On . INIT_REMOVE_PREVIOUS . equals ( on ) ) { removePrevFromBrowserContextOnTabInit = enable ; } }


signature:
public class BrowserPage { /** * To check if the given tag exists in the UI . < br >
 * NB : - This method is valid only if { @ code browserPage # toHtmlString } or
 * { @ code browserPage # toOutputStream } is called at least once in the life
 * time .
 * @ param tag
 * the tag object to be checked .
 * @ return true if the given tag contains in the BrowserPage i . e . UI . false
 * if the given tag was removed or was not already added in the UI .
 * @ throws NullValueException
 * throws this exception if the given tag
 * is null .
 * @ throws NotRenderedException
 * if the { @ code BrowserPage } object is not
 * rendered . i . e . if
 * { @ code browserPage # toHtmlString } or
 * { @ code browserPage # toOutputStream } was
 * NOT called at least once in the life
 * time .
 * @ since 2.1.7
 * @ author WFF */
public final boolean contains ( final AbstractHtml tag ) throws NullValueException , NotRenderedException { } }

implementation: if ( tag == null ) { throw new NullValueException ( "tag object in browserPage.contains(AbstractHtml tag) method cannot be null" ) ; } if ( tagByWffId == null ) { throw new NotRenderedException ( "Could not check its existance. Make sure that you have called browserPage#toHtmlString method atleast once in the life time." ) ; } final DataWffId dataWffId = tag . getDataWffId ( ) ; if ( dataWffId == null ) { return false ; } return tag . equals ( tagByWffId . get ( dataWffId . getValue ( ) ) ) ;


signature:
public class BrowserPage { /** * Gets the TagRepository to do different tag operations . This tag
 * repository is specific to this BrowserPage instance .
 * @ return the TagRepository object to do different tag operations . Or null
 * if any one of the BrowserPage # toString or
 * BrowserPage # toOutputStream methods is not called .
 * @ since 2.1.8
 * @ author WFF */
public final TagRepository getTagRepository ( ) { } }

implementation: if ( tagRepository == null && rootTag != null ) { synchronized ( this ) { if ( tagRepository == null ) { tagRepository = new TagRepository ( ACCESS_OBJECT , this , tagByWffId , rootTag ) ; } } } return tagRepository ;


signature:
public class BrowserPage { /** * Sets nonce attribute value for wff script .
 * @ param value
 * pass value to set nonce value or pass null to remove
 * nonce attribute
 * @ since 3.0.1 */
protected final void setNonceForWffScript ( final String value ) { } }

implementation: if ( autoremoveWffScript ) { throw new InvalidUsageException ( "Cannot remove while autoremoveWffScript is set as true. Please do setAutoremoveWffScript(false)" ) ; } if ( value != null ) { if ( nonceForWffScriptTag == null ) { nonceForWffScriptTag = new Nonce ( value ) ; if ( wffScriptTagId != null ) { final AbstractHtml [ ] ownerTags = wffScriptTagId . getOwnerTags ( ) ; if ( ownerTags . length > 0 ) { final AbstractHtml wffScript = ownerTags [ 0 ] ; wffScript . addAttributes ( nonceForWffScriptTag ) ; } } } else { nonceForWffScriptTag . setValue ( value ) ; } } else { if ( wffScriptTagId != null && nonceForWffScriptTag != null ) { final AbstractHtml [ ] ownerTags = wffScriptTagId . getOwnerTags ( ) ; if ( ownerTags . length > 0 ) { final AbstractHtml wffScript = ownerTags [ 0 ] ; wffScript . removeAttributes ( nonceForWffScriptTag ) ; } } nonceForWffScriptTag = null ; }


signature:
public class Border { /** * checks the given css value is valid for this class . It does ' t do a strict
 * validation .
 * @ param cssValue
 * @ return
 * @ since 1.0.0
 * @ author WFF */
public static boolean isValid ( final String cssValue ) { } }

implementation:
// TODO modify to make a strict validation
final String trimmedCssValue ; if ( cssValue == null || ( trimmedCssValue = StringUtil . strip ( cssValue ) ) . isEmpty ( ) ) { return false ; } if ( INITIAL . equals ( trimmedCssValue ) || INHERIT . equals ( trimmedCssValue ) ) { return true ; } final List < String > cssValueParts = CssValueUtil . split ( trimmedCssValue ) ; if ( cssValueParts . size ( ) > 1 && ( trimmedCssValue . contains ( INITIAL ) || trimmedCssValue . contains ( INHERIT ) ) ) { return false ; } BorderTopWidth width = null ; BorderStyle borderStyle = null ; BorderColorCssValues borderColorCssValues = null ; for ( final String eachPart : cssValueParts ) { boolean invalid = true ; if ( width == null && BorderTopWidth . isValid ( eachPart ) ) { width = new BorderTopWidth ( eachPart ) ; invalid = false ; } else if ( borderStyle == null && BorderStyle . isValid ( eachPart ) ) { borderStyle = BorderStyle . getThis ( eachPart ) ; invalid = false ; } else if ( borderColorCssValues == null && BorderColorCssValues . isValid ( eachPart ) ) { borderColorCssValues = new BorderColorCssValues ( eachPart ) ; invalid = false ; } if ( invalid ) { return false ; } } return true ;


signature:
public class Border { /** * to set the border style .
 * @ param borderStyle
 * @ return the current object .
 * @ author WFF
 * @ since 1.0.0 */
public Border setBorderStyle ( final BorderStyle borderStyle ) { } }

implementation: if ( borderStyle == BorderStyle . INITIAL || borderStyle == BorderStyle . INHERIT ) { throw new InvalidValueException ( "the given borderStyle cannot be " + borderStyle . getCssValue ( ) ) ; } final StringBuilder cssValueBuilder = new StringBuilder ( ) ; if ( borderWidthValue != null ) { cssValueBuilder . append ( borderWidthValue ) . append ( ' ' ) ; } if ( borderStyle != null ) { cssValueBuilder . append ( borderStyle . getCssValue ( ) ) . append ( ' ' ) ; } if ( borderColorCssValues != null ) { cssValueBuilder . append ( borderColorCssValues . getValue ( ) ) . append ( ' ' ) ; } final String trimmedCssValue = StringBuilderUtil . getTrimmedString ( cssValueBuilder ) . toString ( ) ; cssValue = trimmedCssValue . isEmpty ( ) ? INHERIT : trimmedCssValue ; this . borderStyle = borderStyle ; if ( getStateChangeInformer ( ) != null ) { getStateChangeInformer ( ) . stateChanged ( this ) ; } return this ;


signature:
public class FontFamily { /** * < pre >
 * Eg : -
 * String [ ] fontFamilyNames = { " Times New Roman " , " Georgia " , GenericFontFamilyNameContants . SERIF } ;
 * < / pre >
 * @ param fontFamilyNames
 * the fontFamilyNames to set
 * @ author WFF
 * @ since 1.0.0 */
public void setFontFamilyNames ( final String [ ] fontFamilyNames ) { } }

implementation: if ( fontFamilyNames != null ) { this . fontFamilyNames = StringUtil . cloneArray ( fontFamilyNames ) ; cssValue = getBuiltCssValue ( this . fontFamilyNames ) ; } else { this . fontFamilyNames = null ; cssValue = INITIAL ; } if ( getStateChangeInformer ( ) != null ) { getStateChangeInformer ( ) . stateChanged ( this ) ; }


signature:
public class Id { /** * value for the id attribute .
 * @ param uuid
 * @ since 1.0.0
 * @ author WFF */
public void setValue ( final UUID uuid ) { } }

implementation: if ( uuid != null ) { super . setAttributeValue ( uuid . toString ( ) ) ; this . uuid = uuid ; }


signature:
public class ByteBufferUtil { /** * Eg :
 * < pre >
 * < code >
 * final String s = " 1234567890abc " ;
 * final ByteBuffer inputData = ByteBuffer
 * . wrap ( s . getBytes ( StandardCharsets . UTF _ 8 ) ) ;
 * final StringBuilder builder = new StringBuilder ( ) ;
 * final int totalSlices = ByteBufferUtil . slice ( inputData , 3,
 * ( part , last ) - & gt ; {
 * builder . append (
 * new String ( part . array ( ) , StandardCharsets . UTF _ 8 ) ) ;
 * return ! last ;
 * System . out . println ( s . equals ( builder . toString ( ) ) ) ;
 * System . out . println ( 5 = = totalSlices ) ;
 * < / code >
 * < / pre >
 * prints
 * < pre >
 * true
 * true
 * < / pre >
 * @ param data
 * ByteBuffer to be sliced
 * @ param maxSliceSize
 * the maximum size of ByteBuffer of the sliced
 * part .
 * @ param slice
 * the Slice functional interface . The method
 * Slice . each must return true to continue slicing .
 * @ return the total number of slices made . NB : it is just the count of
 * invocation of Slice . each method . If the Slice . each returned false
 * while the last ( second param in Slice . each ) is false then the
 * returned slice count will be less than the probable number of
 * slices in the input data .
 * @ since 3.0.1 */
public static int slice ( final ByteBuffer data , final int maxSliceSize , final Slice < ByteBuffer > slice ) { } }

implementation: ByteBuffer d = data ; int remaining = 0 ; int sliceCount = 0 ; while ( ( remaining = d . remaining ( ) ) > 0 ) { sliceCount ++ ; final byte [ ] bytes = new byte [ maxSliceSize < remaining ? maxSliceSize : remaining ] ; final boolean goOn = slice . each ( ByteBuffer . wrap ( bytes ) , d . get ( bytes ) . remaining ( ) == 0 ) ; if ( ! goOn ) { break ; } d = d . slice ( ) ; } return sliceCount ;


signature:
public class ByteBufferUtil { /** * Merges and returns ByteBuffer from the given dataArray . The ByteBuffer
 * will be returned after flip .
 * @ param dataArray
 * the ByteByffers to merge
 * @ return a single ByteBuffer after flip merged from all ByteBuffer objects
 * from dataArray .
 * @ since 3.0.2 */
public static ByteBuffer merge ( final ByteBuffer ... dataArray ) { } }

implementation: int totalCapacity = 0 ; for ( final ByteBuffer data : dataArray ) { totalCapacity += data . capacity ( ) ; } final ByteBuffer wholeData = ByteBuffer . allocate ( totalCapacity ) ; for ( final ByteBuffer data : dataArray ) { wholeData . put ( data ) ; } wholeData . flip ( ) ; return wholeData ;


signature:
public class BorderImageOutset { /** * sets the top , right , bottom and left in { @ code BorderImageWidth } .
 * @ param top
 * the value for top . The value { @ code auto } will be
 * assigned for null value .
 * @ param right
 * the value for right . The value { @ code auto } will be
 * assigned for null value .
 * @ param bottom
 * the value for bottom . The value { @ code auto } will be
 * assigned for null value .
 * @ param left
 * the value for left . The value { @ code auto } will be
 * assigned for null value .
 * @ param unit
 * the { @ code CssLengthUnit } for all of the given top ,
 * right , bottom and left values .
 * @ author WFF
 * @ since 1.0.0 */
public void setBorderImageTopRightBottomLeft ( final Float top , final Float right , final Float bottom , final Float left , final CssLengthUnit unit ) { } }

implementation: cssValue = getProducedCssValue ( top , unit , right , unit , bottom , unit , left , unit ) ; this . top = top ; this . right = right ; this . bottom = bottom ; this . left = left ; topUnit = rightUnit = bottomUnit = leftUnit = unit ; final StateChangeInformer < CssProperty > stateChangeInformer = getStateChangeInformer ( ) ; if ( stateChangeInformer != null ) { stateChangeInformer . stateChanged ( this ) ; }