signature:
public class CharsetUtil { /** * Returns a cached thread - local { @ link CharsetEncoder } for the specified < tt > charset < / tt > .
 * @ param charset { @ link java . nio . charset . Charset }
 * @ return { @ link java . nio . charset . CharsetEncoder } */
public static CharsetEncoder getEncoder ( Charset charset ) { } }

implementation: if ( charset == null ) { throw new NullPointerException ( "charset" ) ; } Map < Charset , CharsetEncoder > map = encoders . get ( ) ; CharsetEncoder e = map . get ( charset ) ; if ( e != null ) { e . reset ( ) ; e . onMalformedInput ( CodingErrorAction . REPLACE ) ; e . onUnmappableCharacter ( CodingErrorAction . REPLACE ) ; return e ; } e = charset . newEncoder ( ) ; e . onMalformedInput ( CodingErrorAction . REPLACE ) ; e . onUnmappableCharacter ( CodingErrorAction . REPLACE ) ; map . put ( charset , e ) ; return e ;


signature:
public class AppUtilities { /** * Open and read the properties file .
 * @ param strFileName The name of the properties file .
 * @ return The properties . */
public static Properties readProperties ( String strFileName ) { } }

implementation: Properties properties = new Properties ( ) ; File fileProperties = new File ( strFileName ) ; try { if ( ! fileProperties . exists ( ) ) fileProperties . createNewFile ( ) ; InputStream inStream = new FileInputStream ( fileProperties ) ; properties . load ( inStream ) ; inStream . close ( ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } return properties ;


signature:
public class AppUtilities { /** * Write out the properties .
 * @ param strFileName The name of the properties file .
 * @ param properties The properties file . */
public static void writeProperties ( String strFileName , Properties properties ) { } }

implementation: try { OutputStream out = new FileOutputStream ( strFileName ) ; properties . store ( out , "JBackup preferences" ) ; out . flush ( ) ; out . close ( ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; }


signature:
public class AppUtilities { /** * Parse this URL formatted string into properties .
 * @ properties The properties object to add the params to .
 * @ args The arguments to parse ( each formatted as key = value ) . */
public static Properties parseArgs ( Properties properties , String [ ] args ) { } }

implementation: if ( properties == null ) properties = new Properties ( ) ; if ( args == null ) return properties ; for ( int i = 0 ; i < args . length ; i ++ ) AppUtilities . addParam ( properties , args [ i ] , false ) ; return properties ;


signature:
public class AppUtilities { /** * Parse the param line and add it to this properties object .
 * ( ie . , key = value ) .
 * @ properties The properties object to add this params to .
 * @ param strParam param line in the format param = value */
public static void addParam ( Properties properties , String strParams , boolean bDecodeString ) { } }

implementation: int iIndex = strParams . indexOf ( '=' ) ; int iEndIndex = strParams . length ( ) ; if ( iIndex != - 1 ) { String strParam = strParams . substring ( 0 , iIndex ) ; String strValue = strParams . substring ( iIndex + 1 , iEndIndex ) ; if ( bDecodeString ) { try { strParam = URLDecoder . decode ( strParam , URL_ENCODING ) ; strValue = URLDecoder . decode ( strValue , URL_ENCODING ) ; } catch ( java . io . UnsupportedEncodingException ex ) { ex . printStackTrace ( ) ; } } properties . put ( strParam , strValue ) ; }


signature:
public class RestfulMatcher { /** * 按照长度分组 */
public void register ( ActionInfo action , String url ) { } }

implementation: if ( url . indexOf ( '{' ) == - 1 ) { staticUrls . put ( url , new RouteInfo ( action ) ) ; } else { String [ ] urlSegments = StringUtils . split ( url . substring ( 1 ) , '/' ) ; if ( urlSegments . length >= MAX_PATH_PARTS ) { throw new IllegalStateException ( "exceed max url parts: " + url ) ; } OneByOneMatcher matcher = matchers [ urlSegments . length ] ; if ( matcher == null ) { matcher = new OneByOneMatcher ( ) ; matchers [ urlSegments . length ] = matcher ; } matcher . register ( action , urlSegments ) ; }


signature: public class Configuration { public < T > T getValue ( String name , Class < T > type ) { } }

implementation: return getValue ( name , type , null ) ;


signature:
public class PropertyView { /** * Constructor . */
public void init ( PropertyOwner propOwner , Properties properties ) { } }

implementation:
m_propOwner = propOwner ; m_properties = properties ; this . setLayout ( new BorderLayout ( ) ) ; // Default
this . addControlsToView ( this ) ; // Add the controls to this view
this . propertiesToControls ( ) ; this . addListeners ( ) ;


signature:
public class PropertyView { /** * Create a combobox with all the values in this string array . */
public JComponent makeControlPopup ( String [ ] rgstrValue , String strControl ) { } }

implementation: JComboBox comboBox = new JComboBox ( ) ; comboBox . setEditable ( true ) ; this . addItems ( comboBox , rgstrValue , strControl ) ; return comboBox ;


signature:
public class PropertyView { /** * Add all the items in this array to the combobox and set the default . */
public void addItems ( JComboBox comboBox , String [ ] rgstrValue , String strDefault ) { } }

implementation: for ( int i = 0 ; i < rgstrValue . length ; i ++ ) { comboBox . addItem ( rgstrValue [ i ] ) ; if ( rgstrValue [ i ] . equalsIgnoreCase ( strDefault ) ) strDefault = rgstrValue [ i ] ; } comboBox . setSelectedItem ( strDefault ) ;


signature:
public class PropertyView { /** * Utility to create a new panel and add it to this parent panel . */
public JPanel makeNewPanel ( JPanel panel , Object constraints ) { } }

implementation: JPanel panelNew = new JPanel ( ) ; panelNew . setLayout ( new BorderLayout ( ) ) ; panel . add ( panelNew , constraints ) ; return panelNew ;


signature:
public class RequestUtils { /** * 获取相对 ContextPath 的 requestURI */
public static String getPathInfo ( HttpServletRequest request ) { } }

implementation: String path = request . getPathInfo ( ) ; if ( path == null ) { path = request . getServletPath ( ) ; } else { path = request . getServletPath ( ) + path ; } if ( path == null || path . length ( ) == 0 ) { path = "/" ; } return path ;


signature:
public class RequestUtils { /** * 客户端对Http Basic验证的 Header进行编码 . */
public static String encodeHttpBasic ( String userName , String password ) { } }

implementation: String encode = userName + ":" + password ; return "Basic " + Base64 . encodeToString ( encode . getBytes ( ) ) ;


signature:
public class RequestUtils { /** * 是否是Flash请求数据 */
public static boolean isFlashRequest ( HttpServletRequest request ) { } }

implementation: return "Shockwave Flash" . equals ( request . getHeader ( "User-Agent" ) ) || StringUtils . isNotEmpty ( request . getHeader ( "x-flash-version" ) ) ;


signature:
public class RequestUtils { /** * 判断是否为搜索引擎 */
public static boolean isRobot ( HttpServletRequest request ) { } }

implementation:
String ua = request . getHeader ( "user-agent" ) ; if ( StringUtils . isBlank ( ua ) ) return false ; // @ formatter : off
return ( ua != null && ( ua . contains ( "Baiduspider" ) || ua . contains ( "Googlebot" ) || ua . contains ( "sogou" ) || ua . contains ( "sina" ) || ua . contains ( "iaskspider" ) || ua . contains ( "ia_archiver" ) || ua . contains ( "Sosospider" ) || ua . contains ( "YoudaoBot" ) || ua . contains ( "yahoo" ) || ua . contains ( "yodao" ) || ua . contains ( "MSNBot" ) || ua . contains ( "spider" ) || ua . contains ( "Twiceler" ) || ua . contains ( "Sosoimagespider" ) || ua . contains ( "naver.com/robots" ) || ua . contains ( "Nutch" ) || ua . contains ( "spider" ) ) ) ; // @ formatter : on


signature:
public class MultipartRequest { /** * < p > Sets a parameter for this request . The parameter is actually
 * separate from the request parameters , but calling on the getParameter ( )
 * methods of this class will work as if they weren ' t . < / p > */
public void setParameter ( String name , String value ) { } }

implementation: String [ ] values = parameters . get ( name ) ; if ( values == null ) { values = new String [ ] { value } ; parameters . put ( name , values ) ; } else { String [ ] newValues = new String [ values . length + 1 ] ; System . arraycopy ( values , 0 , newValues , 0 , values . length ) ; newValues [ values . length ] = value ; parameters . put ( name , newValues ) ; }


signature:
public class MultipartRequest { /** * < p > Returns the values of a parameter in this request . It first looks
 * in the underlying HttpServletRequest object for the parameter , and if
 * that doesn ' t exist it looks for the parameter retrieved from the
 * multipart request . < / p > */
@ Override public String [ ] getParameterValues ( String name ) { } }

implementation: String [ ] values = getRequest ( ) . getParameterValues ( name ) ; if ( values == null ) { values = parameters . get ( name ) ; } return values ;


signature:
public class MultipartRequest { /** * < p > Combines the parameters stored here with those in the underlying
 * request . If paramater values in the underlying request take precedence
 * over those stored here . < / p > */
@ Override public Map < String , String [ ] > getParameterMap ( ) { } }

implementation: Map < String , String [ ] > map = new HashMap < String , String [ ] > ( parameters ) ; map . putAll ( getRequest ( ) . getParameterMap ( ) ) ; return map ;


signature:
public class JaasBasedDbPropsBuilder { /** * Initialize a set of database properties based on key / values in a < code > HashMap < / code > .
 * @ param properties A < code > HashMap < / code > with configuration properties as required by the init ( ) method in JAAS ,
 * using the keys as specified in this class
 * @ return A < code > DbProperties < / code > object with default values , plus the provided parameters
 * @ throws NullPointerException When { @ code properties } is { @ code null } */
public static DbProperties build ( final Map < String , ? > properties ) { } }

implementation:
Validate . notNull ( properties , "The validated object 'properties' is null" ) ; final DbProperties dbProps = new DbProperties ( ) ; String tmp = getOption ( KEY_JNDI_CONNECTION_NAME , properties ) ; if ( StringUtils . isNotEmpty ( tmp ) ) { // JNDI connection name can be null or empty
dbProps . setJndiConnectionName ( tmp ) ; logValue ( KEY_JNDI_CONNECTION_NAME , tmp ) ; } else { dbProps . setJndiConnectionName ( DEFAULT_JNDI_NAME ) ; logDefault ( KEY_JNDI_CONNECTION_NAME , DEFAULT_JNDI_NAME ) ; } tmp = getOption ( KEY_SQL_USER_QUERY , properties ) ; if ( StringUtils . isNotEmpty ( tmp ) ) { // sql query cannot be null or empty , defaulting to null to catch it
dbProps . setSqlUserQuery ( tmp ) ; logValue ( KEY_SQL_USER_QUERY , tmp ) ; } else { dbProps . setSqlUserQuery ( DEFAULT_SQL_USER_QUERY ) ; logDefault ( KEY_SQL_USER_QUERY , DEFAULT_SQL_USER_QUERY ) ; } // set the additional properties , preserving the originally provided properties
// create a defensive copy of the map and all its properties
// the code looks a little more complicated than a simple " putAll ( ) " , but it catches situations
// where a Map is provided that supports null values ( e . g . a HashMap ) vs Map implementations
// that do not ( e . g . ConcurrentHashMap ) .
final Map < String , String > tempMap = new ConcurrentHashMap < > ( ) ; try { for ( final Map . Entry < String , ? > entry : properties . entrySet ( ) ) { final String key = entry . getKey ( ) ; final String value = ( String ) entry . getValue ( ) ; if ( value != null ) { tempMap . put ( key , value ) ; } } } catch ( ClassCastException e ) { final String error = "The values of the configured JAAS properties must be Strings. " + "Sorry, but we do not support anything else here!" ; throw new IllegalArgumentException ( error , e ) ; } dbProps . setAdditionalProperties ( tempMap ) ; return dbProps ;


signature:
public class WildcharPathUtils { /** * Matches path against pattern using * , ? and * * wildcards .
 * Both path and the pattern are tokenized on path separators ( both \ and / ) .
 * ' * * ' represents deep tree wildcard , as in Ant . */
public static boolean matchPath ( String path , String pattern ) { } }

implementation: String [ ] pathElements = StringUtils . splitChars ( path , PATH_SEPARATORS ) ; String [ ] patternElements = StringUtils . splitChars ( pattern , PATH_SEPARATORS ) ; return matchTokens ( pathElements , patternElements ) ;


signature:
public class WildcharPathUtils { /** * Matches path to at least one pattern .
 * Returns index of matched pattern or < code > - 1 < / code > otherwise .
 * @ see # matchPath ( String , String ) */
public static int matchPathOne ( String path , String [ ] patterns ) { } }

implementation: for ( int i = 0 ; i < patterns . length ; i ++ ) { if ( matchPath ( path , patterns [ i ] ) == true ) { return i ; } } return - 1 ;


signature:
public class Rectangular { /** * Changes the rectangle coordinates by adding the specified X and Y offsets
 * @ param xofs the X offset
 * @ param yofs the Y offset */
public void move ( int xofs , int yofs ) { } }

implementation: x1 += xofs ; y1 += yofs ; x2 += xofs ; y2 += yofs ;


signature:
public class Rectangular { /** * Checks if this rectangle entirely contains another rectangle .
 * @ param other the other rectangle
 * @ return true when the other rectangle is completely contained in this one */
public boolean encloses ( Rectangular other ) { } }

implementation: return x1 <= other . x1 && y1 <= other . y1 && x2 >= other . x2 && y2 >= other . y2 ;


signature:
public class Rectangular { /** * Checks if this rectangle contains a point .
 * @ param x the point X coordinate
 * @ param y the point Y coordinate
 * @ return true when the point is contained in this one */
public boolean contains ( int x , int y ) { } }


signature:
public class Rectangular { /** * Computes the intersection of this rectangle with another one .
 * @ param other the other rectangle
 * @ return the resulting intersection or an empty rectangle when there is no intersection */
public Rectangular intersection ( Rectangular other ) { } }

implementation:
if ( this . intersects ( other ) ) { return new Rectangular ( Math . max ( x1 , other . x1 ) , Math . max ( y1 , other . y1 ) , Math . min ( x2 , other . x2 ) , Math . min ( y2 , other . y2 ) ) ; } else { return new Rectangular ( ) ; // an empty rectangle
}


signature:
public class Rectangular { /** * Computes the union of this rectangle with another one .
 * @ param other the other rectangle
 * @ return the union rectangle */
public Rectangular union ( Rectangular other ) { } }

implementation: return new Rectangular ( Math . min ( x1 , other . x1 ) , Math . min ( y1 , other . y1 ) , Math . max ( x2 , other . x2 ) , Math . max ( y2 , other . y2 ) ) ;


signature:
public class Rectangular { /** * Replaces the X coordinates of the rectangle with the X coordinates of another one .
 * @ param other the rectangle whose X coordinates will be used
 * @ return the resulting rectangle */
public Rectangular replaceX ( Rectangular other ) { } }

implementation: Rectangular ret = new Rectangular ( this ) ; ret . x1 = other . x1 ; ret . x2 = other . x2 ; return ret ;


signature:
public class Rectangular { /** * Replaces the Y coordinates of the rectangle with the Y coordinates of another one .
 * @ param other the rectangle whose Y coordinates will be used
 * @ return the resulting rectangle */
public Rectangular replaceY ( Rectangular other ) { } }

implementation: Rectangular ret = new Rectangular ( this ) ; ret . y1 = other . y1 ; ret . y2 = other . y2 ; return ret ;


signature:
public class Rectangular { /** * If this rectangle intersets with the other one , splits this rectangle horizontally so that it does not intersect with the other one anymore .
 * @ param other the rectangle used to split this one
 * @ return if this rectangle had to be split in two parts , the second one is returned . Otherwise , null is returned . */
public Rectangular hsplit ( Rectangular other ) { } }

implementation: if ( this . intersects ( other ) ) { Rectangular a = new Rectangular ( this ) ; Rectangular b = new Rectangular ( this ) ; if ( a . x2 > other . x1 - 1 ) a . x2 = other . x1 - 1 ; if ( b . x1 < other . x2 + 1 ) b . x1 = other . x2 + 1 ; if ( a . isEmpty ( ) ) { x1 = b . x1 ; return null ; } else { x2 = a . x2 ; if ( b . isEmpty ( ) ) return null ; else return b ; } } else return null ;


signature:
public class Rectangular { /** * If this rectangle intersets with the other one , splits this rectangle horizontally so that it does not intersect with the other one anymore .
 * @ param other the rectangle used to split this one
 * @ return if this rectangle had to be split in two parts , the second one is returned . Otherwise , null is returned . */
public Rectangular vsplit ( Rectangular other ) { } }

implementation: if ( this . intersects ( other ) ) { Rectangular a = new Rectangular ( this ) ; Rectangular b = new Rectangular ( this ) ; if ( a . y2 > other . y1 - 1 ) a . y2 = other . y1 - 1 ; if ( b . y1 < other . y2 + 1 ) b . y1 = other . y2 + 1 ; if ( a . isEmpty ( ) ) { y1 = b . y1 ; return null ; } else { y2 = a . y2 ; if ( b . isEmpty ( ) ) return null ; else return b ; } } else return null ;


signature:
public class FilenameUtils { /** * 得到文件名 . */
public static String getFilename ( final String path ) { } }

implementation: if ( path == null ) { return null ; } int separatorIndex = getFileSeparatorIndex ( path ) ; return separatorIndex == - 1 ? path . substring ( separatorIndex + 1 ) : path ;


signature:
public class FilenameUtils { /** * 得到文件扩展名 . */
public static String getFileExtension ( final String path ) { } }

implementation: if ( path == null ) { return null ; } int extIndex = path . lastIndexOf ( '.' ) ; if ( extIndex == - 1 ) { return null ; } int folderIndex = getFileSeparatorIndex ( path ) ; if ( folderIndex > extIndex ) { return null ; } return path . substring ( extIndex + 1 ) ;


signature:
public class FilesystemSourcePropertyView { /** * Set the properties to the current control values . */
public void controlsToProperties ( ) { } }

implementation: super . controlsToProperties ( ) ; String strPathname = m_tfRootPathname . getText ( ) ; m_properties . setProperty ( SOURCE_ROOT_PATHNAME_PARAM , strPathname ) ;


signature:
public class FilesystemSourcePropertyView { /** * Set the properties to the current control values . */
public void propertiesToControls ( ) { } }

implementation: super . propertiesToControls ( ) ; String strPathname = m_properties . getProperty ( SOURCE_ROOT_PATHNAME_PARAM ) ; m_tfRootPathname . setText ( strPathname ) ;


signature:
public class AreaGrid { /** * Finds the offset of the specified column from the grid origin .
 * @ param col the column index
 * @ return the offset in pixels . Column 0 has always the offset 0. */
public int getColOfs ( int col ) throws ArrayIndexOutOfBoundsException { } }

implementation: if ( col < width ) { int ofs = 0 ; for ( int i = 0 ; i < col ; i ++ ) ofs += cols [ i ] ; return ofs ; } else if ( col == width ) return abspos . getWidth ( ) ; else throw new ArrayIndexOutOfBoundsException ( col + ">" + width ) ;


signature:
public class AreaGrid { /** * Finds the offset of the specified row from the grid origin .
 * @ param col the row index
 * @ return the offset in pixels . Row 0 has always the offset 0. */
public int getRowOfs ( int row ) throws ArrayIndexOutOfBoundsException { } }

implementation: if ( row < height ) { int ofs = 0 ; for ( int i = 0 ; i < row ; i ++ ) ofs += rows [ i ] ; return ofs ; } else if ( row == height ) return abspos . getHeight ( ) ; else throw new ArrayIndexOutOfBoundsException ( row + ">" + height ) ;


signature:
public class AreaGrid { /** * Computes the coordinates of the specified grid cell relatively to the area top left corner .
 * @ param x the column index of the cell
 * @ param y the row index of the cell
 * @ return the coordinates of the given cell in pixels */
public Rectangular getCellBoundsRelative ( int x , int y ) { } }

implementation: int x1 = getColOfs ( x ) ; int y1 = getRowOfs ( y ) ; int x2 = ( x == width - 1 ) ? abspos . getWidth ( ) - 1 : x1 + cols [ x ] - 1 ; int y2 = ( y == height - 1 ) ? abspos . getHeight ( ) - 1 : y1 + rows [ y ] - 1 ; return new Rectangular ( x1 , y1 , x2 , y2 ) ;


signature:
public class AreaGrid { /** * Computes the absolute coordinates of the specified area in the grid .
 * @ param x1 the column index of the top left cell of the area .
 * @ param y1 the row index of the top left cell of the area .
 * @ param x2 the column index of the bottom right cell of the area .
 * @ param y2 the row index of the bottom right cell of the area .
 * @ return the absolute coordinates of the given area in pixels . */
public Rectangular getAreaBoundsAbsolute ( int x1 , int y1 , int x2 , int y2 ) { } }

implementation: final Rectangular end = getCellBoundsAbsolute ( x2 , y2 ) ; return new Rectangular ( abspos . getX1 ( ) + getColOfs ( x1 ) , abspos . getY1 ( ) + getRowOfs ( y1 ) , end . getX2 ( ) , end . getY2 ( ) ) ;


signature:
public class AreaGrid { /** * Computes the absolute coordinates of the specified area in the grid .
 * @ param The area coordinates in the grid .
 * @ return the absolute coordinates of the given area in pixels . */
public Rectangular getAreaBoundsAbsolute ( Rectangular area ) { } }

implementation: return getAreaBoundsAbsolute ( area . getX1 ( ) , area . getY1 ( ) , area . getX2 ( ) , area . getY2 ( ) ) ;


signature:
public class AreaGrid { /** * Finds a grid cell that contains the specified point
 * @ param x the x coordinate of the specified point
 * @ return the X offset of the grid cell that contains the specified absolute
 * x coordinate or - 1 when there is no such cell */
public int findCellX ( int x ) { } }

implementation: int ofs = abspos . getX1 ( ) ; for ( int i = 0 ; i < cols . length ; i ++ ) { ofs += cols [ i ] ; if ( x < ofs ) return i ; } return - 1 ;


signature:
public class AreaGrid { /** * Finds a grid cell that contains the specified point
 * @ param y the y coordinate of the specified point
 * @ return the Y offset of the grid cell that contains the specified absolute
 * y coordinate or - 1 when there is no such cell */
public int findCellY ( int y ) { } }

implementation: int ofs = 0 ; for ( int i = 0 ; i < rows . length ; i ++ ) { ofs += rows [ i ] ; if ( y < ofs + abspos . getY1 ( ) ) return i ; } return - 1 ;


signature:
public class AreaGrid { /** * Goes through the child areas and creates a list of collumns */
private void calculateColumns ( ) { } }

implementation:
// create the sorted list of points
GridPoint points [ ] = new GridPoint [ areas . size ( ) * 2 ] ; int pi = 0 ; for ( Area area : areas ) { points [ pi ] = new GridPoint ( area . getX1 ( ) , area , true ) ; points [ pi + 1 ] = new GridPoint ( area . getX2 ( ) + 1 , area , false ) ; pi += 2 ; // X2 + 1 ensures that the end of one box will be on the same point
// as the start of the following box
} Arrays . sort ( points ) ; // calculate the number of columns
int cnt = 0 ; int last = abspos . getX1 ( ) ; for ( int i = 0 ; i < points . length ; i ++ ) if ( ! theSame ( points [ i ] . value , last ) ) { last = points [ i ] . value ; cnt ++ ; } if ( ! theSame ( last , abspos . getX2 ( ) ) ) cnt ++ ; // last column finishes the whole area
width = cnt ; // calculate the column widths and the layout
maxindent = 0 ; minindent = - 1 ; cols = new int [ width ] ; cnt = 0 ; last = abspos . getX1 ( ) ; for ( int i = 0 ; i < points . length ; i ++ ) { if ( ! theSame ( points [ i ] . value , last ) ) { cols [ cnt ] = points [ i ] . value - last ; last = points [ i ] . value ; cnt ++ ; } if ( points [ i ] . begin ) { target . getPosition ( points [ i ] . area ) . setX1 ( cnt ) ; maxindent = cnt ; if ( minindent == - 1 ) minindent = maxindent ; // points [ i ] . node . getArea ( ) . setX1 ( parent . getArea ( ) . getX1 ( ) + getColOfs ( cnt ) ) ;
} else { Rectangular pos = target . getPosition ( points [ i ] . area ) ; pos . setX2 ( cnt - 1 ) ; if ( pos . getX2 ( ) < pos . getX1 ( ) ) pos . setX2 ( pos . getX1 ( ) ) ; // points [ i ] . node . getArea ( ) . setX2 ( parent . getArea ( ) . getX1 ( ) + getColOfs ( pos . getX2 ( ) + 1 ) ) ;
} } if ( ! theSame ( last , abspos . getX2 ( ) ) ) cols [ cnt ] = abspos . getX2 ( ) - last ; if ( minindent == - 1 ) minindent = 0 ;


signature:
public class AreaGrid { /** * Goes through the child areas and creates a list of rows */
private void calculateRows ( ) { } }

implementation:
// create the sorted list of points
GridPoint points [ ] = new GridPoint [ areas . size ( ) * 2 ] ; int pi = 0 ; for ( Area area : areas ) { points [ pi ] = new GridPoint ( area . getY1 ( ) , area , true ) ; points [ pi + 1 ] = new GridPoint ( area . getY2 ( ) + 1 , area , false ) ; pi += 2 ; // Y2 + 1 ensures that the end of one box will be on the same point
// as the start of the following box
} Arrays . sort ( points ) ; // calculate the number of rows
int cnt = 0 ; int last = abspos . getY1 ( ) ; for ( int i = 0 ; i < points . length ; i ++ ) if ( ! theSame ( points [ i ] . value , last ) ) { last = points [ i ] . value ; cnt ++ ; } if ( ! theSame ( last , abspos . getY2 ( ) ) ) cnt ++ ; // last row finishes the whole area
height = cnt ; // calculate the row heights and the layout
rows = new int [ height ] ; cnt = 0 ; last = abspos . getY1 ( ) ; for ( int i = 0 ; i < points . length ; i ++ ) { if ( ! theSame ( points [ i ] . value , last ) ) { rows [ cnt ] = points [ i ] . value - last ; last = points [ i ] . value ; cnt ++ ; } if ( points [ i ] . begin ) { target . getPosition ( points [ i ] . area ) . setY1 ( cnt ) ; // points [ i ] . node . getArea ( ) . setY1 ( parent . getArea ( ) . getY1 ( ) + getRowOfs ( cnt ) ) ;
} else { Rectangular pos = target . getPosition ( points [ i ] . area ) ; pos . setY2 ( cnt - 1 ) ; if ( pos . getY2 ( ) < pos . getY1 ( ) ) pos . setY2 ( pos . getY1 ( ) ) ; // points [ i ] . node . getArea ( ) . setY2 ( parent . getArea ( ) . getY1 ( ) + getRowOfs ( pos . getY2 ( ) + 1 ) ) ;
} } if ( ! theSame ( last , abspos . getY2 ( ) ) ) rows [ cnt ] = abspos . getY2 ( ) - last ;


signature:
public class ParameterReplacer { /** * Given a string potentially containing one or more copies of the replacement pattern , $ { name } , where name may be
 * any value identifier ( e . g . home _ dir1 ) , replace each occurrence with the value of the parameter with the enclosed
 * name .
 * @ param pattern string potentially containing one or more copies of the replacement pattern .
 * @ param parameterSource source of values for parameters for replacement into the given pattern .
 * @ return resulting string after replacing parameter values for the replacement pattern . */
public String replaceObjectNameParameters ( String pattern , MBeanLocationParameterSource parameterSource ) { } }

implementation: Matcher matcher = replaceParamPattern . matcher ( pattern ) ; StringBuffer result = new StringBuffer ( ) ; while ( matcher . find ( ) ) { String name = matcher . group ( "paramName" ) ; String value = parameterSource . getParameter ( name ) ; if ( value != null ) { matcher . appendReplacement ( result , value ) ; } else { matcher . appendReplacement ( result , Matcher . quoteReplacement ( matcher . group ( ) ) ) ; } } matcher . appendTail ( result ) ; return result . toString ( ) ;


signature:
public class MessageQFactory { /** * Return a new , fully initialized instance of a { @ link MessageQ } class to use for JAAS event messageing .
 * Classes implementing the { @ link MessageQ } interface < b > must < / b > be thread safe .
 * @ param className The name of a class that implements the Message interface
 * @ param properties The properties to initialize the instance with
 * @ return An instance of a class implementing the { @ link MessageQ } interface
 * @ throws FactoryException When the class cannot be instantiated
 * @ throws NullPointerException When the { @ code className } or { @ code properties } are { @ code null }
 * @ throws IllegalArgumentException When { @ code className } is empty */
public static MessageQ getInstance ( final String className , final CommonProperties properties ) throws FactoryException { } }

implementation: Validate . notBlank ( className , "The validated character sequence 'className' is null or empty" ) ; Validate . notNull ( properties , "The validated object 'properties' is null" ) ; final Class < ? extends MessageQ > messageClazz ; try { messageClazz = Class . forName ( className ) . asSubclass ( MessageQ . class ) ; } catch ( ClassNotFoundException e ) { final String error = "Class not found: " + className ; LOG . warn ( error ) ; throw new FactoryException ( error , e ) ; } catch ( ClassCastException e ) { final String error = "The provided registry factory class name ('" + className + "') is not a subclass of '" + MessageQ . class . getCanonicalName ( ) + "'" ; LOG . warn ( error ) ; throw new FactoryException ( error , e ) ; } final MessageQ messageQ ; try { final Constructor < ? extends MessageQ > constructor = messageClazz . getDeclaredConstructor ( ) ; if ( ! constructor . isAccessible ( ) ) { final String error = "Constructor of class '" + messageClazz . getCanonicalName ( ) + "' is not accessible, changing the accessible flag to instantiate the class" ; LOG . info ( error ) ; constructor . setAccessible ( true ) ; } messageQ = constructor . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | IllegalArgumentException e ) { final String error = "Cannot instantiate class '" + messageClazz . getCanonicalName ( ) + "'" ; LOG . warn ( error , e ) ; throw new FactoryException ( error , e ) ; } messageQ . init ( properties ) ; return messageQ ;


signature:
public class MessageQFactory { /** * Return a singleton , fully initialized instance of a { @ link MessageQ } class to use for JAAS event messageing .
 * Retrieving a singleton by this method will cause the factory to keep state , and store a reference to the
 * singleton for later use . You may reset the factory state using the { @ code reset ( ) } method to retrieve a new
 * / different singleton the next time this method is called . .
 * Note that any properties of the singleton ( e . g . configuration ) cannot necessarily be changed easily . You may call
 * the singleton ' s { @ code init ( ) } method , but depending on the implementation provided by the respective class , this
 * may or may not have the expected effect .
 * If you need tight control over the singleton , including its lifecycle and configuration , or you require more than
 * one singleton that are different in their internal state ( e . g . with different configurations ) , then you should
 * create such objects with the { @ code getInstance ( ) } method and maintain their state as " singletons " in your
 * application ' s business logic .
 * Classes implementing the { @ link MessageQ } interface < b > must < / b > be thread safe .
 * @ param className The name of a class that implements the Message interface
 * @ param properties The properties to initialize the instance with
 * @ return An instance of a class implementing the { @ link MessageQ } interface
 * @ throws FactoryException When the class cannot be instantiated
 * @ throws NullPointerException When the { @ code className } or { @ code properties } are { @ code null }
 * @ throws IllegalArgumentException When { @ code className } is empty */
@ SuppressWarnings ( "PMD.NonThreadSafeSingleton" ) public static MessageQ getSingleton ( final String className , final CommonProperties properties ) throws FactoryException { } }

implementation:
Validate . notBlank ( className , "The validated character sequence 'className' is null or empty" ) ; Validate . notNull ( properties , "The validated object 'properties' is null" ) ; // The double - check idiom is safe and acceptable here ( Bloch , 2nd ed . p 284)
if ( messageQInstance == null ) { synchronized ( MessageQFactory . class ) { if ( messageQInstance == null ) { messageQInstance = getInstance ( className , properties ) ; } } } return messageQInstance ;


signature:
public class SrvEntitySyncPersistableBaseVersion { /** * Synchronize APersistableBaseVersion ( itsVersion changed time ) .
 * @ param pAddParam additional params
 * @ param pEntity object
 * @ return isNew if entity exist in database ( need update )
 * @ throws Exception - an exception */
@ Override public final boolean sync ( final Map < String , Object > pAddParam , final Object pEntity ) throws Exception { } }

implementation: APersistableBaseVersion entityPb = ( APersistableBaseVersion ) pEntity ; int currDbId = getSrvOrm ( ) . getIdDatabase ( ) ; if ( currDbId == entityPb . getIdDatabaseBirth ( ) ) { throw new ExceptionWithCode ( ExceptionWithCode . SOMETHING_WRONG , "Foreign entity born in this database! {ID, ID BIRTH, DB BIRTH}:" + " {" + entityPb . getItsId ( ) + ", " + entityPb . getIdBirth ( ) + "," + entityPb . getIdDatabaseBirth ( ) ) ; } String tblNm = pEntity . getClass ( ) . getSimpleName ( ) . toUpperCase ( ) ; String whereStr = " where " + tblNm + ".IDBIRTH=" + entityPb . getItsId ( ) + " and " + tblNm + ".IDDATABASEBIRTH=" + entityPb . getIdDatabaseBirth ( ) ; APersistableBaseVersion entityPbDb = getSrvOrm ( ) . retrieveEntityWithConditions ( pAddParam , entityPb . getClass ( ) , whereStr ) ; entityPb . setIdBirth ( entityPb . getItsId ( ) ) ; entityPb . setItsId ( null ) ; boolean isNew = true ; if ( entityPbDb != null ) { entityPb . setItsVersion ( entityPbDb . getItsVersion ( ) ) ; entityPb . setItsId ( entityPbDb . getItsId ( ) ) ; isNew = false ; } return isNew ;


signature:
public class BaseDestinationPropertyView { /** * Add your property controls to this panel .
 * Remember to set your own layout manager .
 * Also , remember to create a new JPanel , and pass it to the super class
 * so controls of the superclass can be included .
 * You have a 3 x 3 grid , so add three columns for each control
 * @ param panel This is the panel to add your controls to . */
public void addControlsToView ( JPanel panel ) { } }

implementation: panel . setLayout ( new BorderLayout ( ) ) ; this . makeNewPanel ( panel , BorderLayout . CENTER ) ; JPanel panelSub = this . makeNewPanel ( panel , BorderLayout . SOUTH ) ; super . addControlsToView ( panelSub ) ;


signature:
public class JdbcLogSupport { /** * Examines a Throwable object and gets it ' s root cause
 * @ param t - the exception to examine
 * @ return The root cause */
protected Throwable unwrapThrowable ( Throwable t ) { } }

implementation: Throwable e = t ; while ( true ) { if ( e instanceof InvocationTargetException ) { e = ( ( InvocationTargetException ) t ) . getTargetException ( ) ; } else if ( t instanceof UndeclaredThrowableException ) { e = ( ( UndeclaredThrowableException ) t ) . getUndeclaredThrowable ( ) ; } else { return e ; } }


signature:
public class FastByteBuffer { /** * Appends single < code > byte < / code > to buffer . */
public FastByteBuffer append ( byte element ) { } }

implementation: if ( ( currentBuffer == null ) || ( offset == currentBuffer . length ) ) { needNewBuffer ( size + 1 ) ; } currentBuffer [ offset ] = element ; offset ++ ; size ++ ; return this ;


signature:
public class FastByteBuffer { /** * Appends another fast buffer to this one . */
public FastByteBuffer append ( FastByteBuffer buff ) { } }

implementation: if ( buff . size == 0 ) { return this ; } for ( int i = 0 ; i < buff . currentBufferIndex ; i ++ ) { append ( buff . buffers [ i ] ) ; } append ( buff . currentBuffer , 0 , buff . offset ) ; return this ;


signature:
public class MD5 { /** * Final wrapup - pad to 64 - byte boundary with the bit pattern
 * 1 0 * ( 64 - bit count of bits processed , MSB - first ) */
public void md5final ( byte [ ] digest ) { } }

implementation:
/* " final " is a poor method name in Java . : v ) */
int count ; int p ; // in original code , this is a pointer ; in this java code
// it ' s an index into the array this - > in .
/* Compute number of bytes mod 64 */
count = ( int ) ( ( bits >>> 3 ) & 0x3F ) ; /* Set the first char of padding to 0x80 . This is safe since there is
 always at least one byte free */
p = count ; in [ p ++ ] = ( byte ) 0x80 ; /* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count ; /* Pad out to 56 mod 64 */
if ( count < 8 ) { /* Two lots of padding : Pad the first block to 64 bytes */
zeroByteArray ( in , p , count ) ; transform ( ) ; /* Now fill the next block with 56 bytes */
zeroByteArray ( in , 0 , 56 ) ; } else { /* Pad block to 56 bytes */
zeroByteArray ( in , p , count - 8 ) ; } /* Append length in bits and transform */
// Could use a PUT _ 64BIT . . . func here . This is a fairly
// direct translation from the C code , where bits was an array
// of two 32 - bit ints .
int lowbits = ( int ) bits ; int highbits = ( int ) ( bits >>> 32 ) ; PUT_32BIT_LSB_FIRST ( in , 56 , lowbits ) ; PUT_32BIT_LSB_FIRST ( in , 60 , highbits ) ; transform ( ) ; PUT_32BIT_LSB_FIRST ( digest , 0 , buf [ 0 ] ) ; PUT_32BIT_LSB_FIRST ( digest , 4 , buf [ 1 ] ) ; PUT_32BIT_LSB_FIRST ( digest , 8 , buf [ 2 ] ) ; PUT_32BIT_LSB_FIRST ( digest , 12 , buf [ 3 ] ) ; /* zero sensitive data */
/* notice this misses any sneaking out on the stack . The C
 * version uses registers in some spots , perhaps because
 * they care about this . */
zeroByteArray ( in ) ; zeroIntArray ( buf ) ; bits = 0 ; zeroIntArray ( inint ) ;


signature:
public class MD5 { /** * private void debugStatus ( String m ) {
 * System . out . println ( m + " : " ) ;
 * System . out . println ( " in : " + dumpBytes ( in ) ) ;
 * System . out . println ( " bits : " + bits ) ;
 * System . out . println ( " buf : "
 * + Integer . toHexString ( buf [ 0 ] ) + " "
 * + Integer . toHexString ( buf [ 1 ] ) + " "
 * + Integer . toHexString ( buf [ 2 ] ) + " "
 * + Integer . toHexString ( buf [ 3 ] ) ) ; */
public static String dumpBytes ( byte [ ] bytes ) { } }

implementation: int i ; StringBuffer sb = new StringBuffer ( ) ; for ( i = 0 ; i < bytes . length ; i ++ ) { if ( i % 32 == 0 && i != 0 ) { sb . append ( "\n" ) ; } String s = Integer . toHexString ( bytes [ i ] ) ; if ( s . length ( ) < 2 ) { s = "0" + s ; } if ( s . length ( ) > 2 ) { s = s . substring ( s . length ( ) - 2 ) ; } sb . append ( s ) ; } return sb . toString ( ) ;


signature:
public class FileUploaderUtils { /** * multipart / form - data */
private static MultipartRequest asMultipartRequest ( HttpServletRequest request ) throws Exception { } }

implementation: String encoding = request . getCharacterEncoding ( ) ; MultipartRequest req = new MultipartRequest ( request ) ; ServletFileUpload upload = new ServletFileUpload ( ) ; upload . setHeaderEncoding ( encoding ) ; FileItemIterator it = upload . getItemIterator ( request ) ; while ( it . hasNext ( ) ) { FileItemStream item = it . next ( ) ; String fieldName = item . getFieldName ( ) ; InputStream stream = item . openStream ( ) ; try { if ( item . isFormField ( ) ) { req . setParameter ( fieldName , Streams . asString ( stream , encoding ) ) ; } else { String originalFilename = item . getName ( ) ; File diskFile = getTempFile ( originalFilename ) ; OutputStream fos = new FileOutputStream ( diskFile ) ; try { IoUtils . copy ( stream , fos ) ; } finally { IoUtils . closeQuietly ( fos ) ; } FilePart filePart = new FilePart ( fieldName , originalFilename , diskFile ) ; req . addFile ( filePart ) ; } } finally { IoUtils . closeQuietly ( stream ) ; } } return req ;


signature:
public class FileUploaderUtils { /** * application / octet - stream */
private static MultipartRequest asHtml5Request ( HttpServletRequest request ) throws Exception { } }

implementation: String originalFilename = request . getHeader ( "content-disposition" ) ; if ( originalFilename == null ) { throw new ServletException ( "The request is not a html5 file upload request." ) ; } originalFilename = new String ( originalFilename . getBytes ( "iso8859-1" ) , request . getCharacterEncoding ( ) ) ; originalFilename = StringUtils . substringAfter ( originalFilename , "; filename=" ) ; originalFilename = StringUtils . remove ( originalFilename , "\"" ) ; originalFilename = URLDecoder . decode ( originalFilename , "utf-8" ) ; File diskFile = getTempFile ( originalFilename ) ; InputStream fis = request . getInputStream ( ) ; OutputStream fos = new FileOutputStream ( diskFile ) ; try { IoUtils . copy ( fis , fos ) ; } finally { IoUtils . closeQuietly ( fis ) ; IoUtils . closeQuietly ( fos ) ; } MultipartRequest req = new MultipartRequest ( request ) ; FilePart filePart = new FilePart ( "file" , originalFilename , diskFile ) ; req . addFile ( filePart ) ; return req ;


signature:
public class MutableIoc { /** * 添加用户自定义的对象 */
public void addBean ( Object beanObject ) { } }

implementation: Validate . notNull ( beanObject ) ; addBean ( beanObject . getClass ( ) . getName ( ) , beanObject ) ;


signature:
public class MutableIoc { /** * 添加用户自定义的对象 */
public void addBean ( Class < ? > beanClass , Object beanObject ) { } }

implementation: Validate . notNull ( beanClass ) ; addBean ( beanClass . getName ( ) , beanObject ) ;


signature:
public class MutableIoc { /** * 添加用户自定义的对象 */
public void addBean ( String name , Object beanObject ) { } }

implementation: Validate . notNull ( beanObject ) ; addBean ( name , new ValueObject ( beanObject ) ) ;


signature:
public class MutableIoc { /** * 添加用户自定义的对象 */
public void addBean ( String name , IocObject object ) { } }

implementation: Validate . notNull ( name ) ; Validate . notNull ( object ) ; log . debug ( "addBean: {}" , name ) ; if ( pool . put ( name , object ) != null ) { log . warn ( "Duplicated Bean: {}" , name ) ; }


signature:
public class MutableIoc { /** * 注册 @ IocBean 标注的对象 */
public void addBean ( Class < ? > beanClass , Configuration properties , boolean singleton ) { } }

implementation: Validate . notNull ( beanClass ) ; addBean ( beanClass . getName ( ) , beanClass , properties , singleton ) ;


signature:
public class MutableIoc { /** * 注册 @ IocBean 标注的对象 */
public void addBean ( String name , Class < ? > beanClass , Configuration properties , boolean singleton ) { } }

implementation: Validate . notNull ( name ) ; Validate . notNull ( beanClass ) ; Validate . isFalse ( beanClass . isInterface ( ) , "Must not be interface: %s" , beanClass . getName ( ) ) ; Validate . isFalse ( Modifier . isAbstract ( beanClass . getModifiers ( ) ) , "Must not be abstract class: %s" , beanClass . getName ( ) ) ; log . debug ( "addBean: {}" , name , beanClass . getName ( ) ) ; IocObject iocObject = doGetIocObject ( beanClass , properties , singleton ) ; if ( pool . put ( name , iocObject ) != null ) { log . warn ( "Duplicated Bean: {}" , name ) ; }


signature:
public class MutableIoc { /** * 获取一个 Bean */
@ Override @ SuppressWarnings ( "unchecked" ) public < T > T getBean ( Class < T > beanClass ) { } }

implementation: Validate . notNull ( beanClass ) ; return ( T ) getBean ( beanClass . getName ( ) ) ;


signature:
public class MutableIoc { /** * 获取一个 Bean */
@ Override public Object getBean ( String name ) { } }

implementation: IocObject iocObject = pool . get ( name ) ; if ( iocObject == null ) { return null ; } return iocObject . getObject ( ) ;


signature: public class JsoupMicrodataProperty { public < T > T unwrap ( Class < T > type ) { } }

implementation: checkArgument ( Element . class . equals ( type ) , "Cannot unwrap to: %s" , type ) ; return type . cast ( element ) ;


signature:
public class Main { /** * Launches the debugger as a stand - alone Swing application .
 * @ param args Command line parameters . */
public static void main ( String [ ] args ) { } }

implementation: try { Main main = new Main ( ) ; main . start ( ) ; Runtime . getRuntime ( ) . addShutdownHook ( main . getShutdownHook ( ) ) ; main . awaitTermination ( 1 , TimeUnit . DAYS ) ; } catch ( InterruptedException e ) { e = null ; Thread . currentThread ( ) . interrupt ( ) ; }


signature:
public class ByteCodeMonitor { /** * Should be notified every time byte - code is added to the machine .
 * @ param codeBuffer A buffer containing the byte - code .
 * @ param start The start offset within the buffer of the new code .
 * @ param length The length of the new code .
 * @ param interner The machines interner to lookup interned names with .
 * @ param codeView The machines code view to find interned names matching addresses . */
public void onCodeUpdate ( ByteBuffer codeBuffer , int start , int length , VariableAndFunctorInterner interner , WAMCodeView codeView ) { } }

implementation:
log . fine ( "public void onCodeUpdate(ByteBuffer codeBuffer, int start = " + start + ", int length = " + length + ", VariableAndFunctorInterner interner, WAMCodeView codeView): called" ) ; // Take a copy of the new bytecode .
copyAndResizeCodeBuffer ( codeBuffer , start , length ) ; // Disassemble the new area of byte code .
SizeableList < WAMInstruction > instructions = WAMInstruction . disassemble ( start , length , this . codeBuffer , interner , codeView ) ; // Figure out where to start writing the disassembled code into the table .
Map . Entry < Integer , Integer > entry = addressToRow . floorEntry ( start ) ; int firstRow = ( entry == null ) ? 0 : ( entry . getValue ( ) + 1 ) ; int address = start ; int row = firstRow ; // Build the mapping between addresses and rows .
for ( WAMInstruction instruction : instructions ) { addressToRow . put ( address , row ) ; rowToAddress . add ( row , address ) ; row ++ ; address += instruction . sizeof ( ) ; } // Render the instructions into the table to be displayed .
renderInstructions ( instructions , firstRow , start ) ;


signature:
public class ByteCodeMonitor { /** * Copies code from the specified code buffer , into the internal one , resizing the internal code buffer if necessary
 * to make enough room .
 * @ param codeBuffer The code buffer to copy from .
 * @ param start The start offset within the buffer of the new code .
 * @ param length The length of the new code . */
private void copyAndResizeCodeBuffer ( ByteBuffer codeBuffer , int start , int length ) { } }

implementation:
// Check the internal code buffer is large enough or resize it , then copy in the new instructions .
int max = start + length ; if ( this . codeBuffer . limit ( ) <= max ) { ByteBuffer newCodeBuffer = ByteBuffer . allocate ( max * 2 ) ; newCodeBuffer . put ( this . codeBuffer . array ( ) , 0 , this . codeBuffer . limit ( ) ) ; log . fine ( "Re-sized code buffer to " + ( max * 2 ) ) ; } codeBuffer . position ( start ) ; codeBuffer . get ( this . codeBuffer . array ( ) , start , length ) ;


signature:
public class ByteCodeMonitor { /** * Renders disassembled instructions into the code table , starting at the specified row and instruction address .
 * @ param instructions A list of instructions to render into the table .
 * @ param row The table row to start at .
 * @ param address The code address to start at . */
private void renderInstructions ( Iterable < WAMInstruction > instructions , int row , int address ) { } }

implementation: for ( WAMInstruction instruction : instructions ) { WAMLabel label = instruction . getLabel ( ) ; labeledTable . put ( ADDRESS , row , String . format ( "%08X" , address ) ) ; labeledTable . put ( LABEL , row , ( label == null ) ? "" : ( label . toPrettyString ( ) + ":" ) ) ; labeledTable . put ( MNEMONIC , row , instruction . getMnemonic ( ) . getPretty ( ) ) ; int fieldMask = instruction . getMnemonic ( ) . getFieldMask ( ) ; String arg = "" ; for ( int i = 2 ; i < 32 ; i = i * 2 ) { if ( ( fieldMask & i ) != 0 ) { if ( ! "" . equals ( arg ) ) { arg += ", " ; } switch ( i ) { case 2 : arg += Integer . toString ( instruction . getReg1 ( ) ) ; break ; case 4 : arg += Integer . toString ( instruction . getReg2 ( ) ) ; break ; case 8 : FunctorName fn = instruction . getFn ( ) ; if ( fn != null ) { arg += fn . getName ( ) + "/" + fn . getArity ( ) ; } break ; case 16 : WAMLabel target1 = instruction . getTarget1 ( ) ; if ( target1 != null ) { arg += target1 . getName ( ) + "/" + target1 . getArity ( ) + "_" + target1 . getId ( ) ; } break ; } } } labeledTable . put ( ARG_1 , row , arg ) ; row ++ ; address += instruction . sizeof ( ) ; }


signature:
public class AnnotatingVisitor { /** * { @ inheritDoc } */
public void visit ( Functor functor ) { } }

implementation:
// functor is ground if all of its arguments are ground .
boolean ground = true ; if ( functor . getArguments ( ) != null ) { for ( Term argument : functor . getArguments ( ) ) { SymbolKey symbolKey = argument . getSymbolKey ( ) ; TermDomain annotation = ( TermDomain ) symbolTable . get ( symbolKey , TERM_DOMAIN ) ; if ( ( annotation == null ) || ! annotation . ground ) { ground = false ; break ; } } } /* log . fine ( ( ground ? " ground " : " non - ground " ) + functor . toString ( interner , true , false ) ) ; */
symbolTable . put ( functor . getSymbolKey ( ) , TERM_DOMAIN , new TermDomain ( ground ) ) ;


signature:
public class AnnotatingVisitor { /** * { @ inheritDoc } */
public void visit ( Variable variable ) { } }

implementation:
SymbolKey symbolKey = variable . getSymbolKey ( ) ; // Check if the variable has already been annotated .
TermDomain annotation = ( TermDomain ) symbolTable . get ( symbolKey , TERM_DOMAIN ) ; if ( annotation == null ) { // variable is ground if it appears in a call to a predicate that always grounds that argument .
/* log . fine ( " non - ground " + variable . toString ( interner , true , false ) ) ; */
symbolTable . put ( symbolKey , TERM_DOMAIN , new TermDomain ( false ) ) ; } else { /* log . fine ( " already seen " + variable . toString ( interner , true , false ) ) ; */
} // Check if the variable domain has already been annotated for a previous occurrence of the variable .
VarDomain varDomain = ( VarDomain ) symbolTable . get ( symbolKey , VARIABLE_DOMAIN ) ; if ( varDomain == null ) { varDomain = new VarDomain ( traverser . isInHead ( ) ) ; symbolTable . put ( symbolKey , VARIABLE_DOMAIN , varDomain ) ; } else { varDomain . isTemporary = traverser . isInHead ( ) && varDomain . isTemporary ( ) ; } /* log . fine ( variable . toString ( interner , true , false ) +
 ( varDomain . isTemporary ( ) ? " may be temporary . " : " is not temporary . " ) ) ; */


signature:
public class AnnotatingVisitor { /** * { @ inheritDoc } */
public void visit ( LiteralType literal ) { } }

implementation:
// literal is ground .
/* log . fine ( " ground " + literal . toString ( interner , true , false ) ) ; */
symbolTable . put ( literal . getSymbolKey ( ) , TERM_DOMAIN , new TermDomain ( true ) ) ;


signature:
public class BinaryArithmeticOperator { /** * Gets the actual value of a term , which is a numeric type equal in value to the arithmetic operator applied to its
 * arguments . This method checks that both arguments produce values which are fully instantiated and numeric when
 * their { @ link Term # getValue ( ) } methods are invoked .
 * @ return A numeric type equal in value to the the arithmetic operator applied to its arguments . */
public Term getValue ( ) { } }

implementation:
Term firstArgValue = arguments [ 0 ] . getValue ( ) ; Term secondArgValue = arguments [ 1 ] . getValue ( ) ; // Check that the arguments to operate on are both numeric values .
if ( firstArgValue . isNumber ( ) && secondArgValue . isNumber ( ) ) { return evaluate ( ( NumericType ) firstArgValue , ( NumericType ) secondArgValue ) ; } else { return this ; }


signature:
public class PropertyLoaderServlet { /** * Loads a properties file and stores it in the application context . The property resource name and the application
 * scope variable name are passed as initialization parameters in the servlet config in the web . xml . */
public void init ( ) { } }

implementation:
log . fine ( "public void init(): called" ) ; // Get the name of the property file resource to load and the application variable name to store it under
String propertyResource = getInitParameter ( PROPERTY_RESOURCE ) ; String varName = getInitParameter ( APP_VAR_NAME ) ; log . fine ( "varName = " + varName ) ; // Use the default property reader to load the resource
Properties properties = DefaultPropertyReader . getProperties ( propertyResource ) ; log . fine ( "properties = " + properties ) ; // Store the properties under the specified variable name in the application scope
getServletContext ( ) . setAttribute ( varName , properties ) ;


signature:
public class Unifies { /** * { @ inheritDoc } */
public boolean proofStep ( ResolutionState state ) { } }

implementation:
Functor goalTerm = state . getGoalStack ( ) . poll ( ) . getFunctor ( ) ; Term leftArg = goalTerm . getArgument ( 0 ) ; Term rightArg = goalTerm . getArgument ( 1 ) ; // This is used to record variables bound during the unification , so that they may be undone if the resolution
// state is backtracked over .
List < Variable > boundVariables = new LinkedList < Variable > ( ) ; // Unify the current query goal with the possibly matching clause , creating variable bindings .
boolean matched = state . getUnifier ( ) . unifyInternal ( leftArg , rightArg , boundVariables , boundVariables ) ; if ( matched ) { if ( TRACE ) { /* trace . fine ( state . getTraceIndenter ( ) . generateTraceIndent ( ) + " Unify " +
 leftArg . toString ( state . getInterner ( ) , true , true ) + " against " +
 rightArg . toString ( state . getInterner ( ) , true , true ) + " , ok . " ) ; */
} for ( Variable binding : boundVariables ) { state . getVariableBindings ( ) . offer ( binding ) ; } } return matched ;


signature:
public class QueryParameter { /** * Return a QueryParameter which contains reference to the original elements except for those from the exception list .
 * @ param excludedElements list of QueryParameterKind which will NOT be cloned
 * @ return */
public QueryParameter partialCopy ( final QueryParameterKind ... excludedElements ) { } }

implementation: List < QueryParameterKind > excludedList = Arrays . asList ( excludedElements ) ; QueryParameter returnValue = new QueryParameter ( ) ; if ( ! excludedList . contains ( QueryParameterKind . CONSTRAINTS ) ) { returnValue . rawConstraints = this . rawConstraints ; } if ( ! excludedList . contains ( QueryParameterKind . GROUPS ) ) { returnValue . groups = this . groups ; } if ( ! excludedList . contains ( QueryParameterKind . ORDERS ) ) { returnValue . orders = this . orders ; } if ( ! excludedList . contains ( QueryParameterKind . PAGE ) ) { returnValue . pageSize = this . pageSize ; returnValue . page = this . page ; } if ( ! excludedList . contains ( QueryParameterKind . TIMEZONE ) ) { returnValue . timezoneName = this . timezoneName ; } return returnValue ;


signature:
public class SimpleTree { /** * Adds a child tree to the children of this point in the tree . If this is already a node then it remains as a node .
 * If this is a leaf then adding a child to it must promote it to become a node . This implementation supports
 * turning leaves into nodes .
 * @ param child A child tree to add below this point in the tree . */
public void addChild ( Tree < E > child ) { } }

implementation:
initChildren ( ) ; // Add the new child to the collection of children .
children . add ( child ) ; // Set the type of this point in the tree to a node as it now has children .
nodeOrLeaf = Type . Node ; // Set the new childs parent to this .
child . setParent ( this ) ;


signature:
public class SimpleTree { /** * Clears all the children of this point in the tree . If this point is a leaf it will have no children so this
 * operation does nothing . If this point is a node it will be reduced to a leaf by this operation . This
 * implementation supports turning nodes into leaves . */
public void clearChildren ( ) { } }

implementation:
// Check that their are children to clear .
if ( children != null ) { // Loop over all the children setting their parent to null .
for ( Tree < E > child : children ) { child . setParent ( null ) ; } // Clear out the children collection .
children . clear ( ) ; // Mark this as a leaf node .
nodeOrLeaf = Type . Leaf ; }


signature:
public class SequenceIterator { /** * Gets the next element from the sequence if one is available . The difference between this method and
 * { @ link # nextInSequence } is that this method consumes any cached solution , so subsequent calls advance onto
 * subsequent solutions .
 * @ return The next solution from the search space if one is available .
 * @ throws NoSuchElementException If no solutions are available . */
public E next ( ) { } }

implementation:
// Consume the next element in the sequence , if one is available .
E result = nextInternal ( ) ; if ( exhausted ) { throw new NoSuchElementException ( ) ; } nextSolution = null ; return result ;


signature:
public class SequenceIterator { /** * Gets the next element from the sequence , the cached one if one has already been generated , or creating and
 * caching a new one if not . If the cached element from a previous call has not been consumed , then subsequent calls
 * to this method will not advance the iterator .
 * @ return The next solution from the search space if one is available .
 * @ throws NoSuchElementException If no solutions are available . */
private E nextInternal ( ) { } }

implementation:
// Check if the next soluation has already been cached , because of a call to hasNext .
if ( nextSolution != null ) { return nextSolution ; } // Otherwise , generate the next solution , if possible .
nextSolution = nextInSequence ( ) ; // Check if the solution was null , which indicates that the search space is exhausted .
if ( nextSolution == null ) { exhausted = true ; } return nextSolution ;


signature:
public class WAMCompiledClause { /** * Adds a conjunctive body functor , or head functor , to this clause , along with the instructions that implement it .
 * @ param body A conjunctive body functor to add to this clause .
 * @ param instructions A list of instructions to add to the body . */
public void addInstructions ( Functor body , SizeableList < WAMInstruction > instructions ) { } }

implementation: int oldLength ; if ( this . body == null ) { oldLength = 0 ; this . body = new Functor [ 1 ] ; } else { oldLength = this . body . length ; this . body = Arrays . copyOf ( this . body , oldLength + 1 ) ; } this . body [ oldLength ] = body ; addInstructionsAndThisToParent ( instructions ) ;


signature:
public class WAMCompiledClause { /** * Adds some instructions to the parent predicate , and also adds this as a clause on the parent , if it has not
 * already been added .
 * @ param instructions The instructions to add . */
private void addInstructionsAndThisToParent ( SizeableList < WAMInstruction > instructions ) { } }

implementation: if ( ! addedToParent ) { parent . addInstructions ( this , instructions ) ; addedToParent = true ; } else { parent . addInstructions ( instructions ) ; }


signature:
public class Minus { /** * Evaluates the arithmetic operator on its two numeric arguments .
 * @ param firstNumber The first argument .
 * @ param secondNumber The second argument .
 * @ return The result of performing the arithmetic operator on its arguments . */
protected NumericType evaluate ( NumericType firstNumber , NumericType secondNumber ) { } }

implementation:
// If either of the arguments is a real number , then use real number arithmetic , otherwise use integer arithmetic .
if ( firstNumber . isInteger ( ) && secondNumber . isInteger ( ) ) { return new IntLiteral ( firstNumber . intValue ( ) - secondNumber . intValue ( ) ) ; } else { return new DoubleLiteral ( firstNumber . doubleValue ( ) - secondNumber . doubleValue ( ) ) ; }


signature:
public class ButtonPanel { /** * Called when a property in the WorkPanelState is changed . This method calls initPanels to rebuild the user
 * interface to reflect the current application state .
 * @ param event The work panel state change event . All other event types are ignored . */
public void propertyChange ( PropertyChangeEvent event ) { } }

implementation:
/* log . fine ( " void propertyChange ( PropertyChangeEvent ) : called " ) ; */
// Check that the property change was sent by a WorkPanelState
if ( event . getSource ( ) instanceof WorkPanelState ) { // Get the state
String state = ( ( WorkPanelState ) event . getSource ( ) ) . getState ( ) ; // Check what the state to set is
if ( state . equals ( WorkPanelState . NOT_SAVED ) ) { // Set the Cancel and Apply buttons to enabled
cancelButton . setEnabled ( true ) ; applyButton . setEnabled ( true ) ; } else if ( state . equals ( WorkPanelState . READY ) ) { // Set the Cancel and Apply buttons to disabled
cancelButton . setEnabled ( false ) ; applyButton . setEnabled ( false ) ; } else if ( state . equals ( WorkPanelState . NOT_INITIALIZED ) ) { // Disable all the buttons
okButton . setEnabled ( false ) ; cancelButton . setEnabled ( false ) ; applyButton . setEnabled ( false ) ; } }


signature:
public class ButtonPanel { /** * Sets the specified work panel to listen to the button press events for all of the OK , Cancel and Apply buttons .
 * Regisers this object to listen for changes to the work panels state .
 * @ param panel The work panel to register with . */
public void registerWorkPanel ( WorkPanel panel ) { } }

implementation:
// Set the work panel to listen for actions generated by the buttons
okButton . addActionListener ( panel ) ; cancelButton . addActionListener ( panel ) ; applyButton . addActionListener ( panel ) ; // Register this to listen for changes to the work panels state
panel . getWorkPanelState ( ) . addPropertyChangeListener ( this ) ;


signature:
public class LessProcessor { /** * The { @ link ScopeNode } from a parent ' s result is placed on the parser ' s { @ link ValueStack } and joined
 * together to allow for variable and mixin resolution across scopes .
 * @ return A printable { @ link Result } of processing the given input . */
public Result process ( Result parent , InputStream input ) throws IOException { } }

implementation:
ValueStack < Node > stack = new DefaultValueStack < Node > ( ) ; // Make the scope of each parent result accessible for variable and mixin resolution during parsing
ScopeNode parentScope = null ; if ( parent != null ) { parentScope = parent . getScope ( ) ; stack . push ( parentScope ) ; } // Parse the input
ParseRunner < Node > parseRunner = new ReportingParseRunner < Node > ( Parboiled . createParser ( Parser . class , _translationEnabled ) . Document ( ) ) . withValueStack ( stack ) ; ParsingResult < Node > result = parseRunner . run ( IOUtils . toString ( input , "UTF-8" ) ) ; if ( result . hasErrors ( ) ) { throw new LessTranslationException ( "An error occurred while parsing a LESS input file:\n" + ErrorUtils . printParseErrors ( result ) ) ; } // Retrieve the processed result
ScopeNode scope = ( ScopeNode ) stack . pop ( ) ; // Link the new scope to the last parent for later variable resolution
if ( parentScope != null ) { scope . setParentScope ( parentScope ) ; } return new Result ( scope ) ;


signature:
public class DesktopAppLayout { /** * { @ inheritDoc } */
public void addLayoutComponent ( String name , Component comp ) { } }

implementation: componentMap . put ( name , comp ) ; reverseMap . put ( comp , name ) ;


signature:
public class DesktopAppLayout { /** * { @ inheritDoc } */
public void removeLayoutComponent ( Component comp ) { } }

implementation: String name = reverseMap . remove ( comp ) ; if ( name != null ) { componentMap . remove ( name ) ; }


signature:
public class DesktopAppLayout { /** * { @ inheritDoc } */
public Dimension preferredLayoutSize ( Container parent ) { } }

implementation: Insets insets = parent . getInsets ( ) ; return new Dimension ( insets . left + insets . right , insets . top + insets . bottom ) ;


signature:
public class DesktopAppLayout { /** * { @ inheritDoc } */
public void layoutContainer ( Container parent ) { } }

implementation:
// Get the available area to layout within .
Insets insets = parent . getInsets ( ) ; int maxWidth = parent . getWidth ( ) - ( insets . left + insets . right ) ; int maxHeight = parent . getHeight ( ) - ( insets . top + insets . bottom ) ; // Check which optional components are present .
updatePresentComponentFlags ( ) ; int centerHeight = maxHeight - ( ( hasConsole ? consoleHeight : 0 ) + ( hasStatusBar ? DEFAULT_STATUS_BAR_HEIGHT : 0 ) ) ; int statusBarTop = centerHeight ; int consoleTop = statusBarTop + DEFAULT_STATUS_BAR_HEIGHT ; int centerLeft = ( hasLeftPane ? leftPaneWidth : 0 ) + ( hasLeftBar ? DEFAULT_VBAR_WIDTH : 0 ) ; int centerRight = maxWidth - ( hasRightPane ? rightPaneWidth : 0 ) - ( hasRightBar ? DEFAULT_VBAR_WIDTH : 0 ) ; int centerWidth = centerRight - centerLeft ; int leftBarRight = centerLeft ; int leftBarLeft = leftBarRight - DEFAULT_VBAR_WIDTH ; int leftPaneRight = leftBarLeft ; int rightBarLeft = centerRight ; int rightPaneLeft = rightBarLeft + DEFAULT_VBAR_WIDTH ; for ( Component component : parent . getComponents ( ) ) { String type = reverseMap . get ( component ) ; int left = 0 ; int top = 0 ; int width = maxWidth ; int height = maxHeight ; if ( CENTER . equals ( type ) ) { left = centerLeft ; width = centerWidth ; height = centerHeight ; } else if ( STATUS_BAR . equals ( type ) ) { top = statusBarTop ; height = DEFAULT_STATUS_BAR_HEIGHT ; } else if ( CONSOLE . equals ( type ) ) { top = consoleTop ; height = consoleHeight ; } else if ( LEFT_PANE . equals ( type ) ) { width = leftPaneRight ; height = centerHeight ; } else if ( LEFT_VERTICAL_BAR . equals ( type ) ) { left = leftBarLeft ; width = DEFAULT_VBAR_WIDTH ; height = centerHeight ; } else if ( RIGHT_VERTICAL_BAR . equals ( type ) ) { left = rightBarLeft ; width = DEFAULT_VBAR_WIDTH ; height = centerHeight ; } else if ( RIGHT_PANE . equals ( type ) ) { left = rightPaneLeft ; width = rightPaneWidth ; height = centerHeight ; } component . setBounds ( left , top , width , height ) ; }


signature:
public class DesktopAppLayout { /** * Keeps the set of flags indicating which window components are present , up - to - date . */
private void updatePresentComponentFlags ( ) { } }

implementation: hasConsole = componentMap . containsKey ( CONSOLE ) ; hasStatusBar = componentMap . containsKey ( STATUS_BAR ) ; hasLeftBar = componentMap . containsKey ( LEFT_VERTICAL_BAR ) ; hasLeftPane = componentMap . containsKey ( LEFT_PANE ) ; hasRightBar = componentMap . containsKey ( RIGHT_VERTICAL_BAR ) ; hasRightPane = componentMap . containsKey ( RIGHT_PANE ) ;


signature: public class SeleniumMicrobrowser { public MicrodataDocument get ( String url ) { } }

implementation: newUrl ( url ) ; driver . get ( url ) ; return new SeleniumMicrodataDocument ( driver ) ;


signature:
public class BigDecimalTypeImpl { /** * Creates a new decimal type with the specified name , if it does not already exist .
 * @ param name The name of the decimal type to create .
 * @ param precision The precision of the decimal type .
 * @ param scale The scale of the decimal type .
 * @ return A new decimal type .
 * @ throws IllegalArgumentException If the named type already exists . */
public static Type createInstance ( String name , int precision , int scale , String min , String max ) { } }

implementation:
synchronized ( DECIMAL_TYPES ) { // Add the newly created type to the map of all types .
BigDecimalTypeImpl newType = new BigDecimalTypeImpl ( name , precision , scale , min , max ) ; // Ensure that the named type does not already exist , unless it has an identical definition already , in which
// case the old definition can be re - used and the new one discarded .
BigDecimalTypeImpl oldType = DECIMAL_TYPES . get ( name ) ; if ( ( oldType != null ) && ! oldType . equals ( newType ) ) { throw new IllegalArgumentException ( "The type '" + name + "' already exists and cannot be redefined." ) ; } else if ( ( oldType != null ) && oldType . equals ( newType ) ) { return oldType ; } else { DECIMAL_TYPES . put ( name , newType ) ; return newType ; } }


signature:
public class BigDecimalTypeImpl { /** * { @ inheritDoc } */
public void acceptVisitor ( TypeVisitor visitor ) { } }

implementation: if ( visitor instanceof BigDecimalTypeVisitor ) { ( ( BigDecimalTypeVisitor ) visitor ) . visit ( this ) ; } else { super . acceptVisitor ( visitor ) ; }


signature: public class FormMethodTck { @ Test public void submitSubmitsRequest ( ) throws InterruptedException { } }

implementation: server ( ) . enqueue ( new MockResponse ( ) . setBody ( String . format ( "" + "<form name='f' method='%s' action='/x'>" + "<input type='submit'/>" + "</form>" + "" , getMethod ( ) ) ) ) ; server ( ) . enqueue ( new MockResponse ( ) ) ; newBrowser ( ) . get ( url ( server ( ) ) ) . getForm ( "f" ) . submit ( ) ; server ( ) . takeRequest ( ) ; assertThat ( "request" , takeRequest ( server ( ) ) , is ( method ( "/x" ) ) ) ;


signature:
public class FreeNonAnonymousVariablePredicate { /** * Determine whether a term is a free variable .
 * @ param term The object to test for predicate membership .
 * @ return < tt > true < / tt > if the term is a free variable , < tt > false < / tt > otherwise . */
public boolean evaluate ( Term term ) { } }

implementation: if ( term . isVar ( ) && ( term instanceof Variable ) ) { Variable var = ( Variable ) term ; return ! var . isBound ( ) && ! var . isAnonymous ( ) ; } return false ;


signature:
public class WAMOptimizer { /** * { @ inheritDoc }
 * < p / > Runs the instruction listing through an optimizer pass , and replaces the original instruction listing with
 * the optimized version . */
public < T extends WAMOptimizeableListing > T apply ( WAMOptimizeableListing listing ) { } }

implementation: SizeableList < WAMInstruction > optListing = optimize ( listing . getInstructions ( ) ) ; listing . setOptimizedInstructions ( optListing ) ; return ( T ) listing ;


signature:
public class WAMOptimizer { /** * Performs an optimization pass for specialized instructions .
 * < p / > The following instruction sequences can be optimized :
 * < pre >
 * unify _ var Xi , get _ struc a / 0 , Xi - > unify _ const a / 0
 * get _ struc a / 0 , Xi - > get _ const a / 0
 * put _ struc a / 0 , Xi , set _ var Xi - > set _ const a / 0
 * put _ struc a / 0 , Xi - > put _ const a / 0
 * < / pre >
 * @ param instructions The instructions to optimize .
 * @ return An list of optimized instructions . */
private SizeableList < WAMInstruction > optimize ( List < WAMInstruction > instructions ) { } }

implementation: StateMachine optimizeConstants = new OptimizeInstructions ( symbolTable , interner ) ; Iterable < WAMInstruction > matcher = new Matcher < WAMInstruction , WAMInstruction > ( instructions . iterator ( ) , optimizeConstants ) ; SizeableList < WAMInstruction > result = new SizeableLinkedList < WAMInstruction > ( ) ; for ( WAMInstruction instruction : matcher ) { result . add ( instruction ) ; } return result ;


signature:
public class LexicographicalCollectionComparator { /** * Compares two collections using lexicographic ordering based on a comparator of their elements .
 * @ param c1 The first collection to compare .
 * @ param c2 The second collection to compare .
 * @ return A negative integer , zero , or a positive integer as the first argument is less than , equal to , or greater
 * than the second . */
public int compare ( Collection < T > c1 , Collection < T > c2 ) { } }

implementation:
// Simultaneously iterator over both collections until one runs out .
Iterator < T > i1 = c1 . iterator ( ) ; Iterator < T > i2 = c2 . iterator ( ) ; while ( i1 . hasNext ( ) && i2 . hasNext ( ) ) { T t1 = i1 . next ( ) ; T t2 = i2 . next ( ) ; // Compare t1 and t2.
int comp = comparator . compare ( t1 , t2 ) ; // Check if t1 < t2 in which case c1 < c2.
if ( comp < 0 ) { return - 1 ; } // Check if t2 < t1 in which case c2 < c1.
else if ( comp > 0 ) { return 1 ; } // Otherwise t1 = t2 in which case further elements must be examined in order to determine the ordering .
} // If this point is reached then one of the collections ran out of elements before the ordering was determined .
// Check if c1 ran out and c2 still has elements , in which case c1 < c2.
if ( ! i1 . hasNext ( ) && i2 . hasNext ( ) ) { return - 1 ; } // Check if c2 ran out and c1 still has elements , in which case c2 < c1.
if ( i1 . hasNext ( ) && ! i2 . hasNext ( ) ) { return 1 ; } // Otherwise both ran out in which case c1 = c2.
return 0 ;


signature: public class MicrodataPropertyTck { @ Test public void getNameReturnsName ( ) { } }

implementation:
server ( ) . enqueue ( new MockResponse ( ) . setBody ( "" + "
" + "
" + "
" + "" ) ) ; String actual = newBrowser ( ) . get ( url ( server ( ) ) ) . getItem ( "http://i" ) . getProperty ( "x" ) . getName ( ) ; assertThat ( "item property name" , actual , is ( "x" ) ) ;


signature: public class MicrodataPropertyTck { @ Test public void getValueWhenMetaReturnsContent ( ) { } }

implementation:
server ( ) . enqueue ( new MockResponse ( ) . setBody ( "" + "
" + "<meta itemprop='p' content='x'/>" + "
" + "" ) ) ; String actual = newBrowser ( ) . get ( url ( server ( ) ) ) . getItem ( "http://i" ) . getProperty ( "p" ) . getValue ( ) ; assertThat ( "item property value" , actual , is ( "x" ) ) ;


signature:
public class MicrodataPropertyTck { /** * TODO : fix for Selenium */
@ Ignore @ Test public void getValueWhenObjectReturnsAbsoluteUrl ( ) { } }

implementation:
server ( ) . enqueue ( new MockResponse ( ) . setBody ( "" + "
" + "<object itemprop='p' data='x'/>" + "
" + "" ) ) ; String actual = newBrowser ( ) . get ( url ( server ( ) ) ) . getItem ( "http://i" ) . getProperty ( "p" ) . getValue ( ) ; assertThat ( "item property value" , actual , equalToIgnoringCase ( url ( server ( ) , "/x" ) ) ) ;


signature: public class MicrodataPropertyTck { @ Test public void getBooleanValueWhenTrueReturnsTrue ( ) { } }

implementation:
server ( ) . enqueue ( new MockResponse ( ) . setBody ( "" + "
" + "
true
" + "
" + "" ) ) ; boolean actual = newBrowser ( ) . get ( url ( server ( ) ) ) . getItem ( "http://i" ) . getProperty ( "p" ) . getBooleanValue ( ) ; assertThat ( "item property value" , actual , is ( true ) ) ;


signature: public class MicrodataPropertyTck { @ Test public void getLongValueReturnsLong ( ) { } }

implementation:
server ( ) . enqueue ( new MockResponse ( ) . setBody ( "" + "
" + "
1
" + "
" + "" ) ) ; long actual = newBrowser ( ) . get ( url ( server ( ) ) ) . getItem ( "http://i" ) . getProperty ( "p" ) . getLongValue ( ) ; assertThat ( "item property value" , actual , is ( 1L ) ) ;


signature: public class MicrodataPropertyTck { @ Test public void getFloatValueReturnsFloat ( ) { } }

implementation:
server ( ) . enqueue ( new MockResponse ( ) . setBody ( "" + "
" + "
1
" + "
" + "" ) ) ; float actual = newBrowser ( ) . get ( url ( server ( ) ) ) . getItem ( "http://i" ) . getProperty ( "p" ) . getFloatValue ( ) ; assertThat ( "item property value" , actual , is ( 1f ) ) ;


signature: public class MicrodataPropertyTck { @ Test public void getDoubleValueReturnsDouble ( ) { } }

implementation:
server ( ) . enqueue ( new MockResponse ( ) . setBody ( "" + "
" + "
1
" + "
" + "" ) ) ; double actual = newBrowser ( ) . get ( url ( server ( ) ) ) . getItem ( "http://i" ) . getProperty ( "p" ) . getDoubleValue ( ) ; assertThat ( "item property value" , actual , is ( 1d ) ) ;


signature: public class MicrodataPropertyTck { @ Test public void unwrapWithUnknownTypeThrowsException ( ) { } }

implementation:
server ( ) . enqueue ( new MockResponse ( ) . setBody ( "" + "
" + "
" + "
" + "" ) ) ; MicrodataProperty property = newBrowser ( ) . get ( url ( server ( ) ) ) . getItem ( "http://i" ) . getProperty ( "x" ) ; thrown ( ) . expect ( IllegalArgumentException . class ) ; thrown ( ) . expectMessage ( "Cannot unwrap to: class java.lang.Void" ) ; property . unwrap ( Void . class ) ;


signature:
public class DataStreamServlet { /** * Processes the http request that is directed to this servlet .
 * @ param request The HTTP request .
 * @ param response The HTTP response .
 * @ throws IOException If the is an I / O error whilst writing data to the HTTP client through the remote output
 * stream . */
public void service ( HttpServletRequest request , HttpServletResponse response ) throws IOException { } }

implementation:
log . fine ( "void service(HttpServletRequest, HttpServletResponse): called" ) ; // Read the parameters and attributes from the request
String contentType = ( String ) request . getAttribute ( "contentType" ) ; String contentDisposition = ( String ) request . getAttribute ( "contentDisposition" ) ; InputStream inputStream = ( InputStream ) request . getAttribute ( "inputStream" ) ; // Build the response header
// response . addHeader ( " Content - disposition " , " attachment ; filename = " + fileName ) ;
if ( contentType != null ) { response . setContentType ( contentType ) ; } if ( contentDisposition != null ) { response . addHeader ( "Content-disposition" , contentDisposition ) ; } // response . setContentLength ( ( int ) f . length ( ) ) ;
// Create a stream to write the data out to
BufferedOutputStream outputStream = new BufferedOutputStream ( response . getOutputStream ( ) ) ; // Read the entire input stream until no more bytes can be read and write the results into the response
// This is done in chunks of 8k at a time .
int length = - 1 ; byte [ ] chunk = new byte [ 8192 ] ; while ( ( length = inputStream . read ( chunk ) ) != - 1 ) { outputStream . write ( chunk , 0 , length ) ; } // Clear up any open stream and ensure that they are flushed
outputStream . flush ( ) ; inputStream . close ( ) ;


signature:
public class PageControlTag { /** * Renders the paging control .
 * @ return Always SKIP _ BODY ;
 * @ throws JspException If the named paged list variable cannot be found . */
public int doStartTag ( ) throws JspException { } }

implementation:
log . fine ( "public int doStartTag(): called" ) ; TagUtils tagUtils = TagUtils . getInstance ( ) ; // Get a reference to the PagedList .
PagedList list = ( PagedList ) tagUtils . lookup ( pageContext , name , property , scope ) ; log . fine ( "list = " + list ) ; // Work out what the URL of the action to handle the paging events is .
String url ; try { url = tagUtils . computeURL ( pageContext , null , null , null , action , null , null , null , false ) ; } catch ( MalformedURLException e ) { throw new JspException ( "Got malformed URL exception: " , e ) ; } // Optionally render the first page button .
renderButton ( renderFirst , 0 , 0 , openDelimFirst , url , firstText , list . getCurrentPage ( ) != 0 ) ; // Optionally render the back button .
renderButton ( renderBack , list . getCurrentPage ( ) - 1 , ( ( list . getCurrentPage ( ) - 1 ) < list . getCurrentIndex ( ) ) ? ( list . getCurrentIndex ( ) - maxPages ) : list . getCurrentIndex ( ) , openDelimBack , url , backText , ( list . getCurrentPage ( ) - 1 ) >= 0 ) ; // Render links for pages from the current index to the current index plus the maximum number of pages .
int from = list . getCurrentIndex ( ) ; int to = list . getCurrentIndex ( ) + maxPages ; for ( int i = from ; ( i < list . size ( ) ) && ( i < to ) ; i ++ ) { renderButton ( true , i , list . getCurrentIndex ( ) , ( i == list . getCurrentPage ( ) ) ? openDelimCurrent : openDelimNumber , url , "" + ( i + 1 ) , i != list . getCurrentPage ( ) ) ; } // Optionally render a more button . The more button should only be rendered if the current index plus
// the maximum number of pages is less than the total number of pages so there are pages beyond those that
// have numeric link to them already .
renderButton ( ( list . getCurrentIndex ( ) + maxPages ) < list . size ( ) , list . getCurrentPage ( ) + maxPages , list . getCurrentPage ( ) + maxPages , openDelimMore , url , moreText , true ) ; // Optionally render a forward button .
renderButton ( renderForward , list . getCurrentPage ( ) + 1 , ( ( list . getCurrentPage ( ) + 1 ) >= ( list . getCurrentIndex ( ) + maxPages ) ) ? ( list . getCurrentIndex ( ) + maxPages ) : list . getCurrentIndex ( ) , openDelimForward , url , forwardText , ( list . getCurrentPage ( ) + 1 ) < list . size ( ) ) ; // Optionally render a last page button .
renderButton ( renderLast , list . size ( ) - 1 , ( list . size ( ) / maxPages ) * maxPages , openDelimLast , url , lastText , list . getCurrentPage ( ) != ( list . size ( ) - 1 ) ) ; return SKIP_BODY ;


signature:
public class PageControlTag { /** * Renders a button control as a hyperlink for the page control .
 * @ param render Whether or not to render the control .
 * @ param page The page number that the control links to .
 * @ param index The page secondary index that the control links to .
 * @ param openDelim The opening delimeter to put around the control . ( A snippet of HTML ) .
 * @ param url The url of the page action handler .
 * @ param text The text to render the control .
 * @ param active Whether or not the control should be made active .
 * @ throws JspException If an error occurs whilst writing out the response . */
private void renderButton ( boolean render , int page , int index , String openDelim , String url , String text , boolean active ) throws JspException { } }

implementation:
log . fine ( "private void renderButton(boolean render, int page, int index, String openDelim, String url, String text, boolean active): called" ) ; log . fine ( "render = " + render ) ; log . fine ( "page = " + page ) ; log . fine ( "index = " + index ) ; log . fine ( "openDelim = " + openDelim ) ; log . fine ( "url = " + url ) ; log . fine ( "text = " + text ) ; log . fine ( "active = " + active ) ; TagUtils tagUtils = TagUtils . getInstance ( ) ; if ( render ) { tagUtils . write ( pageContext , openDelim ) ; // Only render the button as active if the active flag is set .
if ( active ) { tagUtils . write ( pageContext , "" + text + "" ) ; } // Render an inactive button .
else { tagUtils . write ( pageContext , text ) ; } tagUtils . write ( pageContext , closeDelim ) ; }


signature:
public class VariableAndFunctorInternerImpl { /** * { @ inheritDoc } */
public int internFunctorName ( String name , int numArgs ) { } }

implementation: FunctorName functorName = new FunctorName ( name , numArgs ) ; return getFunctorInterner ( ) . createIdAttribute ( functorName ) . ordinal ( ) ;


signature:
public class Call { /** * { @ inheritDoc } */
public boolean proofStep ( ResolutionState state ) { } }

implementation:
Functor goalTerm = state . getGoalStack ( ) . poll ( ) . getFunctor ( ) ; Term argument = goalTerm . getArgument ( 0 ) . getValue ( ) ; // Check that the argument is not a free variable .
if ( argument . isVar ( ) ) { throw new IllegalStateException ( "instantiation_error, 'call' expects a fully instantiated term to unify against." ) ; } // Check that the argument is callable .
if ( ! argument . isFunctor ( ) && ! argument . isAtom ( ) ) { throw new IllegalStateException ( "type_error, callable expected as argument to 'call'." ) ; } // Set up the argument to call as a new goal .
state . getGoalStack ( ) . offer ( state . getBuiltInTransform ( ) . apply ( ( Functor ) argument ) ) ; return true ;


signature:
public class AbstractLearningMethod { /** * Resets the learning method . This should clear all the examples , properties to learn from and for and the input
 * machine to train . */
public void reset ( ) { } }

implementation: maxSteps = 0 ; machineToTrain = null ; inputExamples = new ArrayList < State > ( ) ; inputProperties = new HashSet < String > ( ) ; outputProperties = new HashSet < String > ( ) ; inputPropertiesSet = false ; outputPropertiesSet = false ;


signature:
public class AbstractLearningMethod { /** * This should be called at the start of the learn method to initialize the input and output property sets .
 * @ throws LearningFailureException If the set of training data and input and output properties are malformed .
 * Either because the training data set is empty or because there are input or
 * output properties that are not found in the training data set . */
protected void initialize ( ) throws LearningFailureException { } }

implementation:
// Check that at least one training example has been set .
if ( inputExamples . isEmpty ( ) ) { throw new LearningFailureException ( "No training examples to learn from." , null ) ; } // Check if an output property set to override the default was not set .
if ( ! outputPropertiesSet ) { // Set the ' goal ' property as the default .
addGoalProperty ( "goal" ) ; } // Check if an input property set to override the default was not set .
if ( ! inputPropertiesSet ) { // Extract all properties from the first example in the training data set as the input property set ,
// automatically excluding any properties which are in the output set .
State example = inputExamples . iterator ( ) . next ( ) ; Set < String > allProperties = example . getComponentType ( ) . getAllPropertyNames ( ) ; inputProperties = new HashSet < String > ( allProperties ) ; inputProperties . removeAll ( outputProperties ) ; inputPropertiesSet = true ; } // Check all the training examples have all the required input and output properties .
for ( State example : inputExamples ) { Set < String > properties = example . getComponentType ( ) . getAllPropertyNames ( ) ; String errorMessage = "" ; for ( String inputProperty : inputProperties ) { if ( ! properties . contains ( inputProperty ) ) { errorMessage += "The training example, " + example + " does not contain the specified input property, " + inputProperty + "\n" ; } } for ( String outputProperty : outputProperties ) { if ( ! properties . contains ( outputProperty ) ) { errorMessage += "The training example, " + example + " does not contain the specified output property, " + outputProperty + "\n" ; } } if ( ! "" . equals ( errorMessage ) ) { throw new LearningFailureException ( errorMessage , null ) ; } }


signature:
public class HashArray { /** * Returns the value to which this map maps the specified key .
 * @ param key The key to get the value from this map for .
 * @ return The object stored under the specified key , or null if the key is not in this map . */
public V get ( Object key ) { } }

implementation:
// Get the index from the map
Integer index = keyToIndex . get ( key ) ; // Check that the key is in the map
if ( index == null ) { return null ; } // Get the data from the array
return data . get ( index . intValue ( ) ) ;


signature:
public class HashArray { /** * Returns the index to which this map maps the specified key .
 * @ param key The key to get the index from this map for .
 * @ return The index of the specified key , or - 1 if the key is not in this map . */
public int getIndexOf ( Object key ) { } }

implementation:
// Get the index from the map
Integer index = keyToIndex . get ( key ) ; // Check that the key is in the map and return - 1 if it is not .
if ( index == null ) { return - 1 ; } return index ;


signature:
public class HashArray { /** * Associates the specified value with the specified key in this map .
 * @ param key The key to store against in this map .
 * @ param value The value to store against the key .
 * @ return The value that was previously stored against the key , or null if there was none . */
public V put ( K key , V value ) { } }

implementation:
// Remove any existing matching key from the data
V removedObject = remove ( key ) ; // Insert the data into the array
data . add ( value ) ; // Insert a key into the map that points to the end of the array
keyToIndex . put ( key , data . size ( ) - 1 ) ; // Create an entry in the key set to track the insertion order of the keys ( automatically goes at the end of
// a linked hash set )
keySet . add ( key ) ; // Return the replaced value if there was one
return removedObject ;


signature:
public class HashArray { /** * Inserts the element at the specified index . This only works if this index already exists .
 * @ param index The index to insert at .
 * @ param value The value to store at that index .
 * @ return The value that was previously stored at that index .
 * @ throws IndexOutOfBoundsException If the index is out of the range covered by this data structure . */
public V set ( int index , V value ) throws IndexOutOfBoundsException { } }

implementation:
// Check if the index does not already exist
if ( index >= data . size ( ) ) { throw new IndexOutOfBoundsException ( ) ; } return data . set ( index , value ) ;


signature:
public class HashArray { /** * Removes the mapping for the specified key from this map if present .
 * @ param key The key to remove from this map .
 * @ return The value that stored at that key , or null if there was none . */
public V remove ( Object key ) { } }

implementation:
// Check if the key is in the map
Integer index = keyToIndex . get ( key ) ; if ( index == null ) { return null ; } // Leave the data in the array but remove its key
keyToIndex . remove ( key ) ; keySet . remove ( key ) ; // Remove the data from the array
V removedValue = data . remove ( index . intValue ( ) ) ; // Go through the whole key to index map reducing by one the value of any indexes greater that the removed index
for ( K nextKey : keyToIndex . keySet ( ) ) { Integer nextIndex = keyToIndex . get ( nextKey ) ; if ( nextIndex > index ) { keyToIndex . put ( nextKey , nextIndex - 1 ) ; } } // Return the removed object
return removedValue ;


signature:
public class HashArray { /** * Removes the specified index from the data structure . This only works if the index already exists .
 * @ param index The index to remove .
 * @ return The value that stored at that index .
 * @ throws IndexOutOfBoundsException If the index is out of the range covered by this data structure . */
public V remove ( int index ) throws IndexOutOfBoundsException { } }

implementation:
// Check that the index is not too large
if ( index >= data . size ( ) ) { throw new IndexOutOfBoundsException ( ) ; } // Get the key for the index by scanning through the key to index mapping
for ( K nextKey : keyToIndex . keySet ( ) ) { int nextIndex = keyToIndex . get ( nextKey ) ; // Found the key for the index , now remove it
if ( index == nextIndex ) { return remove ( nextKey ) ; } } // No matching index was found
throw new IndexOutOfBoundsException ( ) ;


signature:
public class PropertyIntrospectorBase { /** * Checks if the bean has a named property . Note that if the property value is set to null on the bean , this method
 * will still return true , it tests for the existance of a named property , including null ones .
 * @ param property The property to check if this state contains .
 * @ return < tt > true < / tt > if this state has the property , < tt > false < / tt > if it does not . */
public boolean hasProperty ( String property ) { } }

implementation:
// Check if a getter method exists for the property .
Method getterMethod = getters . get ( property ) ; return getterMethod != null ;


signature:
public class PropertyIntrospectorBase { /** * Sets the value of a property of the bean by name .
 * @ param callee The object to call the setter method on .
 * @ param property The name of the property to set .
 * @ param value The value of the property to set . */
protected void setProperty ( Object callee , String property , Object value ) { } }

implementation:
// Initialize this meta bean if it has not already been initialized .
if ( ! initialized ) { initialize ( callee ) ; } // Check that at least one setter method exists for the property .
Method [ ] setterMethods = setters . get ( property ) ; if ( ( setterMethods == null ) || ( setterMethods . length == 0 ) ) { throw new IllegalArgumentException ( "No setter method for the property " + property + " exists." ) ; } // Choose which setter method to call based on the type of the value argument . If the value argument is null
// then call the first available one .
Method setterMethod = null ; Class valueType = ( value == null ) ? null : value . getClass ( ) ; // Check if the value is null and use the first available setter if so , as type cannot be extracted .
if ( value == null ) { setterMethod = setterMethods [ 0 ] ; } // Loop through the available setter methods for one that matches the arguments type .
else { for ( Method method : setterMethods ) { Class argType = method . getParameterTypes ( ) [ 0 ] ; if ( argType . isAssignableFrom ( valueType ) ) { setterMethod = method ; break ; } // Check if the arg type is primitive but the value type is a wrapper type that matches it .
else if ( argType . isPrimitive ( ) && ! valueType . isPrimitive ( ) && isAssignableFromPrimitive ( valueType , argType ) ) { setterMethod = method ; break ; } // Check if the arg type is a wrapper but the value type is a primitive type that matches it .
else if ( valueType . isPrimitive ( ) && ! argType . isPrimitive ( ) && isAssignableFromPrimitive ( argType , valueType ) ) { setterMethod = method ; break ; } } // Check if this point has been reached but no matching setter method could be found , in which case raise
// an exception .
if ( setterMethod == null ) { Class calleeType = ( callee == null ) ? null : callee . getClass ( ) ; throw new IllegalArgumentException ( "No setter method for property " + property + ", of type, " + calleeType + " will accept the type of value specified, " + valueType + "." ) ; } } // Call the setter method with the value .
try { Object [ ] args = new Object [ ] { value } ; setterMethod . invoke ( callee , args ) ; } catch ( InvocationTargetException e ) { throw new IllegalArgumentException ( "The setter method for the property " + property + " threw an invocation target exception." , e ) ; } // This should never happen as the initiliazed method should already have checked this .
catch ( IllegalAccessException e ) { throw new IllegalStateException ( "The setter method for the property " + property + " cannot be accessed." , e ) ; }


signature:
public class PropertyIntrospectorBase { /** * Returns a single named property of the bean .
 * @ param callee The object to call the setter method on .
 * @ param property The property of this state to get the value of .
 * @ return A single Object value of the bean for the specified property name . */
protected Object getProperty ( Object callee , String property ) { } }

implementation:
// Initialize this meta bean if it has not already been initialized .
if ( ! initialized ) { initialize ( callee ) ; } // Check if a getter method exists for the property being fetched .
Method getterMethod = getters . get ( property ) ; if ( getterMethod == null ) { throw new IllegalArgumentException ( "No getter method for the property " + property + " exists." ) ; } // Fetch the value by calling the getter method .
Object result ; try { result = getterMethod . invoke ( callee ) ; } // This should never happen as the initiliazation method should already have checked this .
catch ( InvocationTargetException e ) { throw new IllegalStateException ( "The getter method for the property " + property + " threw an invocation target exception." , e ) ; } // This should never happen as the initiliazation method should already have checked this .
catch ( IllegalAccessException e ) { throw new IllegalStateException ( "The getter method for the property " + property + " cannot be accessed." , e ) ; } return result ;


signature:
public class PropertyIntrospectorBase { /** * Checks if a wrapper type is assignable from a primtive type .
 * @ param wrapperType The wrapper type .
 * @ param primitiveType The primitive type .
 * @ return < tt > true < / tt > if the wrapper type can be assinged from the primitive . */
private boolean isAssignableFromPrimitive ( Class wrapperType , Class primitiveType ) { } }

implementation: boolean result = false ; if ( primitiveType . equals ( boolean . class ) && wrapperType . equals ( Boolean . class ) ) { result = true ; } else if ( primitiveType . equals ( byte . class ) && wrapperType . equals ( Byte . class ) ) { result = true ; } else if ( primitiveType . equals ( char . class ) && wrapperType . equals ( Character . class ) ) { result = true ; } else if ( primitiveType . equals ( short . class ) && wrapperType . equals ( Short . class ) ) { result = true ; } else if ( primitiveType . equals ( int . class ) && wrapperType . equals ( Integer . class ) ) { result = true ; } else if ( primitiveType . equals ( long . class ) && wrapperType . equals ( Long . class ) ) { result = true ; } else if ( primitiveType . equals ( float . class ) && wrapperType . equals ( Float . class ) ) { result = true ; } else if ( primitiveType . equals ( double . class ) && wrapperType . equals ( Double . class ) ) { result = true ; } else { result = false ; } return result ;


signature:
public class PropertyIntrospectorBase { /** * Initialized this property introspector on a specified object , building the caches of getter and setter methods .
 * @ param callee The object to call the getter and setter methods on . */
private void initialize ( Object callee ) { } }

implementation:
// This is used to build up all the setter methods in .
Map < String , List < Method > > settersTemp = new HashMap < String , List < Method > > ( ) ; // Get all the property getters and setters on this class .
Method [ ] methods = callee . getClass ( ) . getMethods ( ) ; for ( Method nextMethod : methods ) { String methodName = nextMethod . getName ( ) ; // Check if it is a getter method .
if ( methodName . startsWith ( "get" ) && ( methodName . length ( ) >= 4 ) && Character . isUpperCase ( methodName . charAt ( 3 ) ) && Modifier . isPublic ( nextMethod . getModifiers ( ) ) && ( nextMethod . getParameterTypes ( ) . length == 0 ) ) { String propertyName = methodName . substring ( 3 , 4 ) . toLowerCase ( ) + methodName . substring ( 4 ) ; getters . put ( propertyName , nextMethod ) ; } // Check if it is a setter method .
else if ( methodName . startsWith ( "set" ) && Modifier . isPublic ( nextMethod . getModifiers ( ) ) && ( nextMethod . getParameterTypes ( ) . length == 1 ) ) { /* log . fine ( " Found setter method . " ) ; */
String propertyName = methodName . substring ( 3 , 4 ) . toLowerCase ( ) + methodName . substring ( 4 ) ; /* log . fine ( " propertyName = " + propertyName ) ; */
// Check the setter to see if any for this name already exist , and start a new list if not .
List < Method > setterMethodsForName = settersTemp . get ( propertyName ) ; if ( setterMethodsForName == null ) { setterMethodsForName = new ArrayList < Method > ( ) ; settersTemp . put ( propertyName , setterMethodsForName ) ; } // Add the setter method to the list of setter methods for the named property .
setterMethodsForName . add ( nextMethod ) ; } } // Convert all the lists of setter methods into arrays .
for ( Map . Entry < String , List < Method > > entries : settersTemp . entrySet ( ) ) { String nextPropertyName = entries . getKey ( ) ; List < Method > nextMethodList = entries . getValue ( ) ; Method [ ] methodArray = nextMethodList . toArray ( new Method [ nextMethodList . size ( ) ] ) ; setters . put ( nextPropertyName , methodArray ) ; } // Initialization completed , set the initialized flag .
initialized = true ;


signature:
public class MemoryLayoutMonitor { /** * { @ inheritDoc } */
public void propertyChange ( PropertyChangeEvent evt ) { } }

implementation: String hex = String . format ( "%08X" , evt . getNewValue ( ) ) ; labeledTable . put ( evt . getPropertyName ( ) , hex ) ;