id_within_dataset
int64 0
69.7k
| snippet
stringlengths 16
26.4k
| tokens
sequence | nl
stringlengths 15
2.45k
| split_within_dataset
stringclasses 1
value | is_duplicated
bool 2
classes | func_name
stringlengths 1
85
|
---|---|---|---|---|---|---|
0 | @ Override public int function ( boolean mergeErrorIntoOutput , String ... commands ) throws IOException , InterruptedException { return runCommand ( mergeErrorIntoOutput , new ArrayList < String > ( Arrays . asList ( commands ) ) ) ; } | [
"@",
"Override",
"public",
"int",
"function",
"(",
"boolean",
"mergeErrorIntoOutput",
",",
"String",
"...",
"commands",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"runCommand",
"(",
"mergeErrorIntoOutput",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"Arrays",
".",
"asList",
"(",
"commands",
")",
")",
")",
";",
"}"
] | runs a command on the command line synchronously .
| train | false | runCommand |
1 | private int function ( int M_PriceList_ID ) { Timestamp priceDate = null ; String dateStr = Env . getContext ( Env . getCtx ( ) , p_WindowNo , "DateOrdered" ) ; if ( dateStr != null && dateStr . length ( ) > 0 ) priceDate = Env . getContextAsDate ( Env . getCtx ( ) , p_WindowNo , "DateOrdered" ) ; else { dateStr = Env . getContext ( Env . getCtx ( ) , p_WindowNo , "DateInvoiced" ) ; if ( dateStr != null && dateStr . length ( ) > 0 ) priceDate = Env . getContextAsDate ( Env . getCtx ( ) , p_WindowNo , "DateInvoiced" ) ; } if ( priceDate == null ) priceDate = new Timestamp ( System . currentTimeMillis ( ) ) ; log . config ( "M_PriceList_ID=" + M_PriceList_ID + " - " + priceDate ) ; int retValue = 0 ; String sql = "SELECT plv.M_PriceList_Version_ID, plv.ValidFrom " + "FROM M_PriceList pl, M_PriceList_Version plv " + "WHERE pl.M_PriceList_ID=plv.M_PriceList_ID" + " AND plv.IsActive='Y'" + " AND pl.M_PriceList_ID=? " + "ORDER BY plv.ValidFrom DESC" ; try { PreparedStatement pstmt = DB . prepareStatement ( sql , null ) ; pstmt . setInt ( 1 , M_PriceList_ID ) ; ResultSet rs = pstmt . executeQuery ( ) ; while ( rs . next ( ) && retValue == 0 ) { Timestamp plDate = rs . getTimestamp ( 2 ) ; if ( ! priceDate . before ( plDate ) ) retValue = rs . getInt ( 1 ) ; } rs . close ( ) ; pstmt . close ( ) ; } catch ( SQLException e ) { log . log ( Level . SEVERE , sql , e ) ; } Env . setContext ( Env . getCtx ( ) , p_WindowNo , "M_PriceList_Version_ID" , retValue ) ; return retValue ; } | [
"private",
"int",
"function",
"(",
"int",
"M_PriceList_ID",
")",
"{",
"Timestamp",
"priceDate",
"=",
"null",
";",
"String",
"dateStr",
"=",
"Env",
".",
"getContext",
"(",
"Env",
".",
"getCtx",
"(",
")",
",",
"p_WindowNo",
",",
"\"DateOrdered\"",
")",
";",
"if",
"(",
"dateStr",
"!=",
"null",
"&&",
"dateStr",
".",
"length",
"(",
")",
">",
"0",
")",
"priceDate",
"=",
"Env",
".",
"getContextAsDate",
"(",
"Env",
".",
"getCtx",
"(",
")",
",",
"p_WindowNo",
",",
"\"DateOrdered\"",
")",
";",
"else",
"{",
"dateStr",
"=",
"Env",
".",
"getContext",
"(",
"Env",
".",
"getCtx",
"(",
")",
",",
"p_WindowNo",
",",
"\"DateInvoiced\"",
")",
";",
"if",
"(",
"dateStr",
"!=",
"null",
"&&",
"dateStr",
".",
"length",
"(",
")",
">",
"0",
")",
"priceDate",
"=",
"Env",
".",
"getContextAsDate",
"(",
"Env",
".",
"getCtx",
"(",
")",
",",
"p_WindowNo",
",",
"\"DateInvoiced\"",
")",
";",
"}",
"if",
"(",
"priceDate",
"==",
"null",
")",
"priceDate",
"=",
"new",
"Timestamp",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"log",
".",
"config",
"(",
"\"M_PriceList_ID=\"",
"+",
"M_PriceList_ID",
"+",
"\" - \"",
"+",
"priceDate",
")",
";",
"int",
"retValue",
"=",
"0",
";",
"String",
"sql",
"=",
"\"SELECT plv.M_PriceList_Version_ID, plv.ValidFrom \"",
"+",
"\"FROM M_PriceList pl, M_PriceList_Version plv \"",
"+",
"\"WHERE pl.M_PriceList_ID=plv.M_PriceList_ID\"",
"+",
"\" AND plv.IsActive='Y'\"",
"+",
"\" AND pl.M_PriceList_ID=? \"",
"+",
"\"ORDER BY plv.ValidFrom DESC\"",
";",
"try",
"{",
"PreparedStatement",
"pstmt",
"=",
"DB",
".",
"prepareStatement",
"(",
"sql",
",",
"null",
")",
";",
"pstmt",
".",
"setInt",
"(",
"1",
",",
"M_PriceList_ID",
")",
";",
"ResultSet",
"rs",
"=",
"pstmt",
".",
"executeQuery",
"(",
")",
";",
"while",
"(",
"rs",
".",
"next",
"(",
")",
"&&",
"retValue",
"==",
"0",
")",
"{",
"Timestamp",
"plDate",
"=",
"rs",
".",
"getTimestamp",
"(",
"2",
")",
";",
"if",
"(",
"!",
"priceDate",
".",
"before",
"(",
"plDate",
")",
")",
"retValue",
"=",
"rs",
".",
"getInt",
"(",
"1",
")",
";",
"}",
"rs",
".",
"close",
"(",
")",
";",
"pstmt",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"sql",
",",
"e",
")",
";",
"}",
"Env",
".",
"setContext",
"(",
"Env",
".",
"getCtx",
"(",
")",
",",
"p_WindowNo",
",",
"\"M_PriceList_Version_ID\"",
",",
"retValue",
")",
";",
"return",
"retValue",
";",
"}"
] | find price list version and update context
| train | false | findPLV |
2 | public static boolean function ( ) { return availableMemory ( ) * 100 < RUNTIME . totalMemory ( ) * 5 ; } | [
"public",
"static",
"boolean",
"function",
"(",
")",
"{",
"return",
"availableMemory",
"(",
")",
"*",
"100",
"<",
"RUNTIME",
".",
"totalMemory",
"(",
")",
"*",
"5",
";",
"}"
] | returns true if less then 5 % of the available memory is free .
| train | false | memoryIsLow |
3 | public String function ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "[" ) ; boolean first = true ; for ( Object key : attributes . keySet ( ) ) { if ( first ) { first = false ; } else { sb . append ( ", " ) ; } sb . append ( key ) ; sb . append ( "==" ) ; sb . append ( attributes . get ( key ) ) ; } sb . append ( "]" ) ; return sb . toString ( ) ; } | [
"public",
"String",
"function",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"[\"",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Object",
"key",
":",
"attributes",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"first",
")",
"{",
"first",
"=",
"false",
";",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"key",
")",
";",
"sb",
".",
"append",
"(",
"\"==\"",
")",
";",
"sb",
".",
"append",
"(",
"attributes",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\"]\"",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | returns a string representation of the object ' s current attributes
| train | false | describeAttributes |
4 | public static byte [ ] function ( byte [ ] buffer ) { sRandom . nextBytes ( buffer ) ; return buffer ; } | [
"public",
"static",
"byte",
"[",
"]",
"function",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"sRandom",
".",
"nextBytes",
"(",
"buffer",
")",
";",
"return",
"buffer",
";",
"}"
] | fill the given buffer with random bytes .
| train | false | nextBytes |
5 | public void function ( final Collection < Unit > damagedUnits ) { for ( final Unit u : damagedUnits ) { while ( m_damaged . contains ( u ) ) { m_damaged . remove ( u ) ; } } } | [
"public",
"void",
"function",
"(",
"final",
"Collection",
"<",
"Unit",
">",
"damagedUnits",
")",
"{",
"for",
"(",
"final",
"Unit",
"u",
":",
"damagedUnits",
")",
"{",
"while",
"(",
"m_damaged",
".",
"contains",
"(",
"u",
")",
")",
"{",
"m_damaged",
".",
"remove",
"(",
"u",
")",
";",
"}",
"}",
"}"
] | can have multiple of the same unit , to show multiple hits to that unit .
| train | false | removeAllFromDamaged |
6 | private IJavaElement [ ] function ( ArrayList namesWithoutExtension ) { int size = namesWithoutExtension . size ( ) ; if ( size == 0 ) return NO_ELEMENTS ; IJavaElement [ ] children = new IJavaElement [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { String nameWithoutExtension = ( String ) namesWithoutExtension . get ( i ) ; children [ i ] = new ClassFile ( this , manager , nameWithoutExtension ) ; } return children ; } | [
"private",
"IJavaElement",
"[",
"]",
"function",
"(",
"ArrayList",
"namesWithoutExtension",
")",
"{",
"int",
"size",
"=",
"namesWithoutExtension",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"NO_ELEMENTS",
";",
"IJavaElement",
"[",
"]",
"children",
"=",
"new",
"IJavaElement",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"String",
"nameWithoutExtension",
"=",
"(",
"String",
")",
"namesWithoutExtension",
".",
"get",
"(",
"i",
")",
";",
"children",
"[",
"i",
"]",
"=",
"new",
"ClassFile",
"(",
"this",
",",
"manager",
",",
"nameWithoutExtension",
")",
";",
"}",
"return",
"children",
";",
"}"
] | compute the children of this package fragment . children of jar package fragments can only be iclassfile ( representing . class files ) .
| train | false | computeChildren |
7 | public Object [ ] function ( ) { Object [ ] result = new Object [ size ] ; System . arraycopy ( elementData , 0 , result , 0 , size ) ; return result ; } | [
"public",
"Object",
"[",
"]",
"function",
"(",
")",
"{",
"Object",
"[",
"]",
"result",
"=",
"new",
"Object",
"[",
"size",
"]",
";",
"System",
".",
"arraycopy",
"(",
"elementData",
",",
"0",
",",
"result",
",",
"0",
",",
"size",
")",
";",
"return",
"result",
";",
"}"
] | returns an array containing all of the elements in this list in the correct order .
| train | false | toArray |
10 | @ Override protected void function ( int token , Object cookie , int result ) { if ( token == mDeleteToken ) { synchronized ( sDeletingThreadsLock ) { sDeletingThreads = false ; if ( DELETEDEBUG ) { Log . v ( TAG , "Conversation onDeleteComplete sDeletingThreads: " + sDeletingThreads ) ; } sDeletingThreadsLock . notifyAll ( ) ; } UnreadBadgeService . update ( mContext ) ; NotificationManager . create ( mContext ) ; } } | [
"@",
"Override",
"protected",
"void",
"function",
"(",
"int",
"token",
",",
"Object",
"cookie",
",",
"int",
"result",
")",
"{",
"if",
"(",
"token",
"==",
"mDeleteToken",
")",
"{",
"synchronized",
"(",
"sDeletingThreadsLock",
")",
"{",
"sDeletingThreads",
"=",
"false",
";",
"if",
"(",
"DELETEDEBUG",
")",
"{",
"Log",
".",
"v",
"(",
"TAG",
",",
"\"Conversation onDeleteComplete sDeletingThreads: \"",
"+",
"sDeletingThreads",
")",
";",
"}",
"sDeletingThreadsLock",
".",
"notifyAll",
"(",
")",
";",
"}",
"UnreadBadgeService",
".",
"update",
"(",
"mContext",
")",
";",
"NotificationManager",
".",
"create",
"(",
"mContext",
")",
";",
"}",
"}"
] | always call this super method from your overridden ondeletecomplete function .
| train | false | onDeleteComplete |
11 | public static double function ( double val ) { if ( val > 0.0 ) return Math . log10 ( val ) ; return HUGE_NEGATIVE ; } | [
"public",
"static",
"double",
"function",
"(",
"double",
"val",
")",
"{",
"if",
"(",
"val",
">",
"0.0",
")",
"return",
"Math",
".",
"log10",
"(",
"val",
")",
";",
"return",
"HUGE_NEGATIVE",
";",
"}"
] | adjusted log10 to handle values less or equal to zero . < p > the logarithm does not result in real numbers for arguments less or equal to zero , but the plot should still somehow handle such values without crashing . so anything & le ; 0 is mapped to a ' really big negative ' number just for the sake of plotting . < p > note that logarithmicaxis . java in the jfreechart has another interesting idea for modifying the log10 of values & le ; 10 , resulting in a smooth plot for the full real argument range . unfortunately that clobbers values like 1e - 7 , which might be a very real vacuum reading .
| train | false | log10 |
12 | private static ILaunchConfiguration function ( IProject project ) throws CoreException , OperationCanceledException { String initialName = calculateLaunchConfigName ( project ) ; ILaunchConfiguration launchConfig = GwtSuperDevModeCodeServerLaunchUtil . createLaunchConfig ( initialName , project ) ; return launchConfig ; } | [
"private",
"static",
"ILaunchConfiguration",
"function",
"(",
"IProject",
"project",
")",
"throws",
"CoreException",
",",
"OperationCanceledException",
"{",
"String",
"initialName",
"=",
"calculateLaunchConfigName",
"(",
"project",
")",
";",
"ILaunchConfiguration",
"launchConfig",
"=",
"GwtSuperDevModeCodeServerLaunchUtil",
".",
"createLaunchConfig",
"(",
"initialName",
",",
"project",
")",
";",
"return",
"launchConfig",
";",
"}"
] | create a new launch configuration .
| train | false | createNewLaunchConfiguration |
13 | protected long function ( ) throws IOException { if ( _utcCalendar == null ) _utcCalendar = Calendar . getInstance ( TimeZone . getTimeZone ( "UTC" ) ) ; return parseDate ( _utcCalendar ) ; } | [
"protected",
"long",
"function",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_utcCalendar",
"==",
"null",
")",
"_utcCalendar",
"=",
"Calendar",
".",
"getInstance",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"UTC\"",
")",
")",
";",
"return",
"parseDate",
"(",
"_utcCalendar",
")",
";",
"}"
] | parses a date value from the stream .
| train | false | parseDate |
14 | @ Override public Request < List < BuilderStatus > > function ( ProjectReference projectReference ) { List < DummyBuilderStatus > current = currentBuilderStatuses . get ( projectReference . name ( ) ) ; List < BuilderStatus > update = new ArrayList < > ( ) ; if ( current != null ) { for ( DummyBuilderStatus dummyBuilderStatus : current ) { update . add ( dummyBuilderStatus ) ; } } return new DummyRequest < > ( update ) ; } | [
"@",
"Override",
"public",
"Request",
"<",
"List",
"<",
"BuilderStatus",
">",
">",
"function",
"(",
"ProjectReference",
"projectReference",
")",
"{",
"List",
"<",
"DummyBuilderStatus",
">",
"current",
"=",
"currentBuilderStatuses",
".",
"get",
"(",
"projectReference",
".",
"name",
"(",
")",
")",
";",
"List",
"<",
"BuilderStatus",
">",
"update",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"if",
"(",
"current",
"!=",
"null",
")",
"{",
"for",
"(",
"DummyBuilderStatus",
"dummyBuilderStatus",
":",
"current",
")",
"{",
"update",
".",
"add",
"(",
"dummyBuilderStatus",
")",
";",
"}",
"}",
"return",
"new",
"DummyRequest",
"<",
">",
"(",
"update",
")",
";",
"}"
] | gets the project builds for the given project
| train | false | builds |
15 | public String function ( ) { if ( buf != null ) { return new String ( buf , bufPos , buf . length - bufPos ) ; } else { return text . substring ( pos . getIndex ( ) ) ; } } | [
"public",
"String",
"function",
"(",
")",
"{",
"if",
"(",
"buf",
"!=",
"null",
")",
"{",
"return",
"new",
"String",
"(",
"buf",
",",
"bufPos",
",",
"buf",
".",
"length",
"-",
"bufPos",
")",
";",
"}",
"else",
"{",
"return",
"text",
".",
"substring",
"(",
"pos",
".",
"getIndex",
"(",
")",
")",
";",
"}",
"}"
] | returns a string containing the remainder of the characters to be returned by this iterator , without any option processing . if the iterator is currently within a variable expansion , this will only extend to the end of the variable expansion . this method is provided so that iterators may interoperate with string - based apis . the typical sequence of calls is to call skipignored ( ) , then call lookahead ( ) , then parse the string returned by lookahead ( ) , then call jumpahead ( ) to resynchronize the iterator .
| train | true | lookahead |
18 | public void function ( ) throws Exception { SimpleDateFormat format = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm zzzz" , Locale . US ) ; Date normal = format . parse ( "1970-01-01T00:00 EET" ) ; Date dst = format . parse ( "1970-01-01T00:00 EEST" ) ; assertEquals ( 60 * 60 * 1000 , normal . getTime ( ) - dst . getTime ( ) ) ; } | [
"public",
"void",
"function",
"(",
")",
"throws",
"Exception",
"{",
"SimpleDateFormat",
"format",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm zzzz\"",
",",
"Locale",
".",
"US",
")",
";",
"Date",
"normal",
"=",
"format",
".",
"parse",
"(",
"\"1970-01-01T00:00 EET\"",
")",
";",
"Date",
"dst",
"=",
"format",
".",
"parse",
"(",
"\"1970-01-01T00:00 EEST\"",
")",
";",
"assertEquals",
"(",
"60",
"*",
"60",
"*",
"1000",
",",
"normal",
".",
"getTime",
"(",
")",
"-",
"dst",
".",
"getTime",
"(",
")",
")",
";",
"}"
] | africa / cairo standard time is eet and daylight time is eest . they no longer use their dst zone but we should continue to parse it properly .
| train | false | testObsoleteDstZoneName |
19 | public abstract boolean function ( Level level ) ; | [
"public",
"abstract",
"boolean",
"function",
"(",
"Level",
"level",
")",
";"
] | " logger like " api to be used by rmi implementation
| train | false | isLoggable |
20 | public String function ( String queryString , String replacement , String ... nonReplacementTokenPrefixes ) { Matcher matcher = tokenPattern . matcher ( queryString ) ; StringBuffer buf = new StringBuffer ( ) ; while ( matcher . find ( ) ) { String origToken = matcher . group ( 1 ) ; if ( origToken != null ) { matcher . appendReplacement ( buf , "" ) ; if ( tokenStartsWithPrefix ( origToken , nonReplacementTokenPrefixes ) ) { buf . append ( "${" + origToken + "}" ) ; } else { buf . append ( replacement ) ; } } } matcher . appendTail ( buf ) ; return buf . toString ( ) ; } | [
"public",
"String",
"function",
"(",
"String",
"queryString",
",",
"String",
"replacement",
",",
"String",
"...",
"nonReplacementTokenPrefixes",
")",
"{",
"Matcher",
"matcher",
"=",
"tokenPattern",
".",
"matcher",
"(",
"queryString",
")",
";",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"String",
"origToken",
"=",
"matcher",
".",
"group",
"(",
"1",
")",
";",
"if",
"(",
"origToken",
"!=",
"null",
")",
"{",
"matcher",
".",
"appendReplacement",
"(",
"buf",
",",
"\"\"",
")",
";",
"if",
"(",
"tokenStartsWithPrefix",
"(",
"origToken",
",",
"nonReplacementTokenPrefixes",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"${\"",
"+",
"origToken",
"+",
"\"}\"",
")",
";",
"}",
"else",
"{",
"buf",
".",
"append",
"(",
"replacement",
")",
";",
"}",
"}",
"}",
"matcher",
".",
"appendTail",
"(",
"buf",
")",
";",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}"
] | replaces a query string with tokens of format $ { token - name } with the specified replacement string for all tokens .
| train | false | replaceTokens |
21 | public boolean function ( ) { return typeString . contains ( SUFFIX_PLURAL ) ; } | [
"public",
"boolean",
"function",
"(",
")",
"{",
"return",
"typeString",
".",
"contains",
"(",
"SUFFIX_PLURAL",
")",
";",
"}"
] | determine if the expression is in plural form .
| train | false | isPlural |
22 | public void function ( ForceItem item ) { try { insert ( item , root , xMin , yMin , xMax , yMax ) ; } catch ( StackOverflowError e ) { e . printStackTrace ( ) ; } } | [
"public",
"void",
"function",
"(",
"ForceItem",
"item",
")",
"{",
"try",
"{",
"insert",
"(",
"item",
",",
"root",
",",
"xMin",
",",
"yMin",
",",
"xMax",
",",
"yMax",
")",
";",
"}",
"catch",
"(",
"StackOverflowError",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | inserts an item into the quadtree .
| train | false | insert |
23 | private void function ( int x , int y ) { handleCellHover ( x , y ) ; if ( columnHeadersVisible ) { handleHoverOnColumnHeader ( x , y ) ; } } | [
"private",
"void",
"function",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"handleCellHover",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"columnHeadersVisible",
")",
"{",
"handleHoverOnColumnHeader",
"(",
"x",
",",
"y",
")",
";",
"}",
"}"
] | handles the assignment of the correct values to the hover * field variables that let the painting code now what to paint as hovered .
| train | false | handleHovering |
24 | public static void function ( Graphics2D g , Font font , String text , int x , int y ) { Graphics2D g2 = ( Graphics2D ) g . create ( ) ; g2 . setFont ( font ) ; FontMetrics fm = g2 . getFontMetrics ( ) ; int padding = 4 ; Rectangle2D bounds = fm . getStringBounds ( text , g2 ) ; double th = bounds . getHeight ( ) ; double tw = bounds . getWidth ( ) ; float radius = ( float ) ( Math . max ( th , tw ) / 2f + padding ) ; Ellipse2D . Float circle = new Ellipse2D . Float ( x - radius , y - radius , 2 * radius + 1 , 2 * radius + 1 ) ; g2 . fill ( circle ) ; g2 . setColor ( Color . BLACK ) ; g2 . drawString ( text , ( int ) ( x - tw / 2 ) , ( y + fm . getAscent ( ) / 2 ) ) ; if ( DEBUG ) { g2 . setColor ( Color . RED ) ; g2 . drawLine ( x - 50 , y , x + 50 , y ) ; g2 . drawLine ( x , y - 50 , x , y + 50 ) ; } g2 . dispose ( ) ; } | [
"public",
"static",
"void",
"function",
"(",
"Graphics2D",
"g",
",",
"Font",
"font",
",",
"String",
"text",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"Graphics2D",
"g2",
"=",
"(",
"Graphics2D",
")",
"g",
".",
"create",
"(",
")",
";",
"g2",
".",
"setFont",
"(",
"font",
")",
";",
"FontMetrics",
"fm",
"=",
"g2",
".",
"getFontMetrics",
"(",
")",
";",
"int",
"padding",
"=",
"4",
";",
"Rectangle2D",
"bounds",
"=",
"fm",
".",
"getStringBounds",
"(",
"text",
",",
"g2",
")",
";",
"double",
"th",
"=",
"bounds",
".",
"getHeight",
"(",
")",
";",
"double",
"tw",
"=",
"bounds",
".",
"getWidth",
"(",
")",
";",
"float",
"radius",
"=",
"(",
"float",
")",
"(",
"Math",
".",
"max",
"(",
"th",
",",
"tw",
")",
"/",
"2f",
"+",
"padding",
")",
";",
"Ellipse2D",
".",
"Float",
"circle",
"=",
"new",
"Ellipse2D",
".",
"Float",
"(",
"x",
"-",
"radius",
",",
"y",
"-",
"radius",
",",
"2",
"*",
"radius",
"+",
"1",
",",
"2",
"*",
"radius",
"+",
"1",
")",
";",
"g2",
".",
"fill",
"(",
"circle",
")",
";",
"g2",
".",
"setColor",
"(",
"Color",
".",
"BLACK",
")",
";",
"g2",
".",
"drawString",
"(",
"text",
",",
"(",
"int",
")",
"(",
"x",
"-",
"tw",
"/",
"2",
")",
",",
"(",
"y",
"+",
"fm",
".",
"getAscent",
"(",
")",
"/",
"2",
")",
")",
";",
"if",
"(",
"DEBUG",
")",
"{",
"g2",
".",
"setColor",
"(",
"Color",
".",
"RED",
")",
";",
"g2",
".",
"drawLine",
"(",
"x",
"-",
"50",
",",
"y",
",",
"x",
"+",
"50",
",",
"y",
")",
";",
"g2",
".",
"drawLine",
"(",
"x",
",",
"y",
"-",
"50",
",",
"x",
",",
"y",
"+",
"50",
")",
";",
"}",
"g2",
".",
"dispose",
"(",
")",
";",
"}"
] | utility function to draw a circle text centered at coordinates ( x , y )
| train | false | drawCircledText |
25 | private void function ( final String prefixSingular , final String prefixPlural , final String endString ) { prefixEndList . add ( new PrefixEntry ( endString , prefixSingular , prefixPlural ) ) ; registerPrefix ( prefixSingular , prefixPlural ) ; } | [
"private",
"void",
"function",
"(",
"final",
"String",
"prefixSingular",
",",
"final",
"String",
"prefixPlural",
",",
"final",
"String",
"endString",
")",
"{",
"prefixEndList",
".",
"add",
"(",
"new",
"PrefixEntry",
"(",
"endString",
",",
"prefixSingular",
",",
"prefixPlural",
")",
")",
";",
"registerPrefix",
"(",
"prefixSingular",
",",
"prefixPlural",
")",
";",
"}"
] | define the singular and plural prefix strings for an item name to be matched at the end , for example " bottle of . . . potion " .
| train | false | registerEnd |
27 | public String function ( ) { return "[PKCS #10 certificate request:\n" + subjectPublicKeyInfo . toString ( ) + " subject: <" + subject + ">" + "\n" + " attributes: " + attributeSet . toString ( ) + "\n]" ; } | [
"public",
"String",
"function",
"(",
")",
"{",
"return",
"\"[PKCS #10 certificate request:\\n\"",
"+",
"subjectPublicKeyInfo",
".",
"toString",
"(",
")",
"+",
"\" subject: <\"",
"+",
"subject",
"+",
"\">\"",
"+",
"\"\\n\"",
"+",
"\" attributes: \"",
"+",
"attributeSet",
".",
"toString",
"(",
")",
"+",
"\"\\n]\"",
";",
"}"
] | provides a short description of this request .
| train | false | toString |
28 | public function ( ) { columnNames = new String [ 2 ] ; columnNames [ 0 ] = res . getString ( "SystemPropertiesTableModel.NameColumn" ) ; columnNames [ 1 ] = res . getString ( "SystemPropertiesTableModel.ValueColumn" ) ; data = new Object [ 0 ] [ 0 ] ; } | [
"public",
"function",
"(",
")",
"{",
"columnNames",
"=",
"new",
"String",
"[",
"2",
"]",
";",
"columnNames",
"[",
"0",
"]",
"=",
"res",
".",
"getString",
"(",
"\"SystemPropertiesTableModel.NameColumn\"",
")",
";",
"columnNames",
"[",
"1",
"]",
"=",
"res",
".",
"getString",
"(",
"\"SystemPropertiesTableModel.ValueColumn\"",
")",
";",
"data",
"=",
"new",
"Object",
"[",
"0",
"]",
"[",
"0",
"]",
";",
"}"
] | construct a new systempropertiestablemodel .
| train | false | SystemPropertiesTableModel |
29 | public boolean function ( long id , boolean isPersistent ) { JobHolder holder ; synchronized ( getNextJobLock ) { if ( jobConsumerExecutor . isRunning ( id , isPersistent ) ) return false ; if ( isPersistent ) { synchronized ( persistentJobQueue ) { holder = persistentJobQueue . findJobById ( id ) ; if ( holder == null ) return false ; persistentJobQueue . remove ( holder ) ; } } else { synchronized ( nonPersistentJobQueue ) { holder = nonPersistentJobQueue . findJobById ( id ) ; if ( holder == null ) return false ; nonPersistentJobQueue . remove ( holder ) ; } } } BaseJob baseJob = holder . getBaseJob ( ) ; if ( dependencyInjector != null ) { dependencyInjector . inject ( baseJob ) ; } baseJob . onCancel ( ) ; return true ; } | [
"public",
"boolean",
"function",
"(",
"long",
"id",
",",
"boolean",
"isPersistent",
")",
"{",
"JobHolder",
"holder",
";",
"synchronized",
"(",
"getNextJobLock",
")",
"{",
"if",
"(",
"jobConsumerExecutor",
".",
"isRunning",
"(",
"id",
",",
"isPersistent",
")",
")",
"return",
"false",
";",
"if",
"(",
"isPersistent",
")",
"{",
"synchronized",
"(",
"persistentJobQueue",
")",
"{",
"holder",
"=",
"persistentJobQueue",
".",
"findJobById",
"(",
"id",
")",
";",
"if",
"(",
"holder",
"==",
"null",
")",
"return",
"false",
";",
"persistentJobQueue",
".",
"remove",
"(",
"holder",
")",
";",
"}",
"}",
"else",
"{",
"synchronized",
"(",
"nonPersistentJobQueue",
")",
"{",
"holder",
"=",
"nonPersistentJobQueue",
".",
"findJobById",
"(",
"id",
")",
";",
"if",
"(",
"holder",
"==",
"null",
")",
"return",
"false",
";",
"nonPersistentJobQueue",
".",
"remove",
"(",
"holder",
")",
";",
"}",
"}",
"}",
"BaseJob",
"baseJob",
"=",
"holder",
".",
"getBaseJob",
"(",
")",
";",
"if",
"(",
"dependencyInjector",
"!=",
"null",
")",
"{",
"dependencyInjector",
".",
"inject",
"(",
"baseJob",
")",
";",
"}",
"baseJob",
".",
"onCancel",
"(",
")",
";",
"return",
"true",
";",
"}"
] | cancels job which is waiting to be run .
| train | false | cancelJob |
30 | public static boolean function ( String str ) { return str . indexOf ( '*' ) != - 1 ; } | [
"public",
"static",
"boolean",
"function",
"(",
"String",
"str",
")",
"{",
"return",
"str",
".",
"indexOf",
"(",
"'*'",
")",
"!=",
"-",
"1",
";",
"}"
] | is the str a simple match pattern .
| train | false | isSimpleMatchPattern |
31 | public String function ( String fname ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; BufferedReader in = null ; try { if ( fname . startsWith ( "hdfs:" ) || fname . startsWith ( "gpfs:" ) ) { FileSystem fs = FileSystem . get ( ConfigurationManager . getCachedJobConf ( ) ) ; Path scriptPath = new Path ( fname ) ; in = new BufferedReader ( new InputStreamReader ( fs . open ( scriptPath ) ) ) ; } else { in = new BufferedReader ( new FileReader ( fname ) ) ; } String tmp = null ; while ( ( tmp = in . readLine ( ) ) != null ) { sb . append ( tmp ) ; sb . append ( "\n" ) ; } } finally { IOUtilFunctions . closeSilently ( in ) ; } return sb . toString ( ) ; } | [
"public",
"String",
"function",
"(",
"String",
"fname",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"BufferedReader",
"in",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"fname",
".",
"startsWith",
"(",
"\"hdfs:\"",
")",
"||",
"fname",
".",
"startsWith",
"(",
"\"gpfs:\"",
")",
")",
"{",
"FileSystem",
"fs",
"=",
"FileSystem",
".",
"get",
"(",
"ConfigurationManager",
".",
"getCachedJobConf",
"(",
")",
")",
";",
"Path",
"scriptPath",
"=",
"new",
"Path",
"(",
"fname",
")",
";",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"fs",
".",
"open",
"(",
"scriptPath",
")",
")",
")",
";",
"}",
"else",
"{",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"fname",
")",
")",
";",
"}",
"String",
"tmp",
"=",
"null",
";",
"while",
"(",
"(",
"tmp",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"tmp",
")",
";",
"sb",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
"}",
"finally",
"{",
"IOUtilFunctions",
".",
"closeSilently",
"(",
"in",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | read a dml or pydml file as a string .
| train | false | readScript |
32 | public static BinaryFieldAccessor function ( Field field , int id ) { BinaryWriteMode mode = BinaryUtils . mode ( field . getType ( ) ) ; switch ( mode ) { case P_BYTE : return new BytePrimitiveAccessor ( field , id ) ; case P_BOOLEAN : return new BooleanPrimitiveAccessor ( field , id ) ; case P_SHORT : return new ShortPrimitiveAccessor ( field , id ) ; case P_CHAR : return new CharPrimitiveAccessor ( field , id ) ; case P_INT : return new IntPrimitiveAccessor ( field , id ) ; case P_LONG : return new LongPrimitiveAccessor ( field , id ) ; case P_FLOAT : return new FloatPrimitiveAccessor ( field , id ) ; case P_DOUBLE : return new DoublePrimitiveAccessor ( field , id ) ; case BYTE : case BOOLEAN : case SHORT : case CHAR : case INT : case LONG : case FLOAT : case DOUBLE : case DECIMAL : case STRING : case UUID : case DATE : case TIMESTAMP : case BYTE_ARR : case SHORT_ARR : case INT_ARR : case LONG_ARR : case FLOAT_ARR : case DOUBLE_ARR : case CHAR_ARR : case BOOLEAN_ARR : case DECIMAL_ARR : case STRING_ARR : case UUID_ARR : case DATE_ARR : case TIMESTAMP_ARR : case ENUM_ARR : case OBJECT_ARR : case BINARY_OBJ : case BINARY : return new DefaultFinalClassAccessor ( field , id , mode , false ) ; default : return new DefaultFinalClassAccessor ( field , id , mode , ! U . isFinal ( field . getType ( ) ) ) ; } } | [
"public",
"static",
"BinaryFieldAccessor",
"function",
"(",
"Field",
"field",
",",
"int",
"id",
")",
"{",
"BinaryWriteMode",
"mode",
"=",
"BinaryUtils",
".",
"mode",
"(",
"field",
".",
"getType",
"(",
")",
")",
";",
"switch",
"(",
"mode",
")",
"{",
"case",
"P_BYTE",
":",
"return",
"new",
"BytePrimitiveAccessor",
"(",
"field",
",",
"id",
")",
";",
"case",
"P_BOOLEAN",
":",
"return",
"new",
"BooleanPrimitiveAccessor",
"(",
"field",
",",
"id",
")",
";",
"case",
"P_SHORT",
":",
"return",
"new",
"ShortPrimitiveAccessor",
"(",
"field",
",",
"id",
")",
";",
"case",
"P_CHAR",
":",
"return",
"new",
"CharPrimitiveAccessor",
"(",
"field",
",",
"id",
")",
";",
"case",
"P_INT",
":",
"return",
"new",
"IntPrimitiveAccessor",
"(",
"field",
",",
"id",
")",
";",
"case",
"P_LONG",
":",
"return",
"new",
"LongPrimitiveAccessor",
"(",
"field",
",",
"id",
")",
";",
"case",
"P_FLOAT",
":",
"return",
"new",
"FloatPrimitiveAccessor",
"(",
"field",
",",
"id",
")",
";",
"case",
"P_DOUBLE",
":",
"return",
"new",
"DoublePrimitiveAccessor",
"(",
"field",
",",
"id",
")",
";",
"case",
"BYTE",
":",
"case",
"BOOLEAN",
":",
"case",
"SHORT",
":",
"case",
"CHAR",
":",
"case",
"INT",
":",
"case",
"LONG",
":",
"case",
"FLOAT",
":",
"case",
"DOUBLE",
":",
"case",
"DECIMAL",
":",
"case",
"STRING",
":",
"case",
"UUID",
":",
"case",
"DATE",
":",
"case",
"TIMESTAMP",
":",
"case",
"BYTE_ARR",
":",
"case",
"SHORT_ARR",
":",
"case",
"INT_ARR",
":",
"case",
"LONG_ARR",
":",
"case",
"FLOAT_ARR",
":",
"case",
"DOUBLE_ARR",
":",
"case",
"CHAR_ARR",
":",
"case",
"BOOLEAN_ARR",
":",
"case",
"DECIMAL_ARR",
":",
"case",
"STRING_ARR",
":",
"case",
"UUID_ARR",
":",
"case",
"DATE_ARR",
":",
"case",
"TIMESTAMP_ARR",
":",
"case",
"ENUM_ARR",
":",
"case",
"OBJECT_ARR",
":",
"case",
"BINARY_OBJ",
":",
"case",
"BINARY",
":",
"return",
"new",
"DefaultFinalClassAccessor",
"(",
"field",
",",
"id",
",",
"mode",
",",
"false",
")",
";",
"default",
":",
"return",
"new",
"DefaultFinalClassAccessor",
"(",
"field",
",",
"id",
",",
"mode",
",",
"!",
"U",
".",
"isFinal",
"(",
"field",
".",
"getType",
"(",
")",
")",
")",
";",
"}",
"}"
] | create accessor for the field .
| train | false | create |
33 | private String function ( HttpURLConnection conn , boolean input ) throws IOException { StringBuffer sb = new StringBuffer ( ) ; if ( input ) { InputStream is = conn . getInputStream ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( is , "utf-8" ) ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line ) ; } reader . close ( ) ; is . close ( ) ; } Map < String , Object > result = new HashMap < String , Object > ( ) ; result . put ( "code" , conn . getResponseCode ( ) ) ; result . put ( "mesg" , conn . getResponseMessage ( ) ) ; result . put ( "type" , conn . getContentType ( ) ) ; result . put ( "data" , sb ) ; String output = String . valueOf ( conn . getResponseCode ( ) ) ; setOutputResponseCode ( output ) ; Gson gson = new Gson ( ) ; String json = gson . toJson ( result ) ; logger . info ( "json = " + json ) ; return json ; } | [
"private",
"String",
"function",
"(",
"HttpURLConnection",
"conn",
",",
"boolean",
"input",
")",
"throws",
"IOException",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"input",
")",
"{",
"InputStream",
"is",
"=",
"conn",
".",
"getInputStream",
"(",
")",
";",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"is",
",",
"\"utf-8\"",
")",
")",
";",
"String",
"line",
"=",
"null",
";",
"while",
"(",
"(",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"line",
")",
";",
"}",
"reader",
".",
"close",
"(",
")",
";",
"is",
".",
"close",
"(",
")",
";",
"}",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"result",
".",
"put",
"(",
"\"code\"",
",",
"conn",
".",
"getResponseCode",
"(",
")",
")",
";",
"result",
".",
"put",
"(",
"\"mesg\"",
",",
"conn",
".",
"getResponseMessage",
"(",
")",
")",
";",
"result",
".",
"put",
"(",
"\"type\"",
",",
"conn",
".",
"getContentType",
"(",
")",
")",
";",
"result",
".",
"put",
"(",
"\"data\"",
",",
"sb",
")",
";",
"String",
"output",
"=",
"String",
".",
"valueOf",
"(",
"conn",
".",
"getResponseCode",
"(",
")",
")",
";",
"setOutputResponseCode",
"(",
"output",
")",
";",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"String",
"json",
"=",
"gson",
".",
"toJson",
"(",
"result",
")",
";",
"logger",
".",
"info",
"(",
"\"json = \"",
"+",
"json",
")",
";",
"return",
"json",
";",
"}"
] | report the result in json way
| train | false | result |
34 | public boolean function ( String sig ) { return banned_methods . contains ( sig ) ; } | [
"public",
"boolean",
"function",
"(",
"String",
"sig",
")",
"{",
"return",
"banned_methods",
".",
"contains",
"(",
"sig",
")",
";",
"}"
] | used by the specification create to check if a method is legal to put in the spec . must check the method , and all superclass definitions of the method .
| train | false | isBannedMethod |
35 | private SendReturn function ( int messageType , String message ) throws InterruptedException , ExtractorException { String length = String . format ( "%d" , message . length ( ) ) ; String lenlen = String . format ( "%d" , length . length ( ) ) ; String type = String . format ( "%04d" , messageType ) ; String outMessage ; int bytesRead ; String replyString ; int ll ; int t ; SendReturn retval = new SendReturn ( ) ; boolean lengthKnown ; int totalBytesRead = 0 ; int totalBytesNeeded ; boolean longMessageSupport = true ; if ( ! connected ) throw new OracleExtractException ( "Not connected" ) ; outMessage = lenlen + length + type + message ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Sending Message type " + messageType ) ; logger . debug ( " - Message is -> " + message ) ; logger . debug ( " - Therefore sending -> " + outMessage ) ; } out . println ( outMessage ) ; if ( messageType != Const . MessageControl ) { try { if ( longMessageSupport ) { lengthKnown = false ; totalBytesRead = 0 ; totalBytesNeeded = 0 ; for ( ; ; ) { bytesRead = in . read ( replyBuffer , totalBytesRead , replyBufferSize - totalBytesRead - 1 ) ; if ( bytesRead == - 1 ) { throw new OracleExtractException ( "End of Stream" ) ; } totalBytesRead += bytesRead ; logger . debug ( "Read = " + bytesRead + " total = " + totalBytesRead + " needed = " + totalBytesNeeded ) ; if ( lengthKnown ) { if ( totalBytesRead >= totalBytesNeeded ) break ; else continue ; } if ( totalBytesRead <= 9 ) continue ; lengthKnown = true ; replyBuffer [ totalBytesRead ] = '\0' ; lengthBuffer [ 0 ] = replyBuffer [ 0 ] ; lengthBuffer [ 1 ] = replyBuffer [ 1 ] ; lengthBuffer [ 2 ] = replyBuffer [ 2 ] ; lengthBuffer [ 3 ] = replyBuffer [ 3 ] ; lengthBuffer [ 4 ] = replyBuffer [ 4 ] ; lengthBuffer [ 5 ] = replyBuffer [ 5 ] ; lengthBuffer [ 6 ] = replyBuffer [ 6 ] ; lengthBuffer [ 7 ] = replyBuffer [ 7 ] ; lengthBuffer [ 8 ] = replyBuffer [ 8 ] ; lengthBuffer [ 9 ] = replyBuffer [ 9 ] ; lengthBuffer [ 10 ] = '\0' ; String lengthString = new String ( lengthBuffer ) ; totalBytesNeeded = Integer . parseInt ( lengthString . substring ( 1 , 9 ) , 16 ) ; totalBytesNeeded += 13 ; if ( totalBytesNeeded + 1 > replyBufferSize ) increaseReplyBuffer ( totalBytesNeeded + 1 ) ; if ( totalBytesRead >= totalBytesNeeded ) break ; } } else { totalBytesRead = in . read ( replyBuffer ) ; } } catch ( ClosedByInterruptException e ) { throw new InterruptedException ( "Oracle extractor was interrupted" ) ; } catch ( IOException e ) { throw new OracleExtractException ( "End of Stream" ) ; } if ( totalBytesRead == - 1 ) { throw new OracleExtractException ( "End of Stream" ) ; } replyBuffer [ totalBytesRead ] = '\0' ; replyString = new String ( replyBuffer , 0 , totalBytesRead ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Reply = \"" + replyString + "\"\n" ) ; } ll = Integer . parseInt ( replyString . substring ( 0 , 1 ) ) ; t = Integer . parseInt ( replyString . substring ( 1 + ll , 1 + ll + 4 ) ) ; replyString = replyString . substring ( 1 + ll + 4 ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Reply = \"" + replyString + "\"\n" ) ; } retval . type = t ; retval . reply = replyString ; } else { retval . type = Const . ReplyReserved ; retval . reply = new String ( "Empty" ) ; } if ( retval . type == Const . ReplyError ) throw new OracleExtractException ( "Error from C Oracle Extractor" ) ; msgCount ++ ; return retval ; } | [
"private",
"SendReturn",
"function",
"(",
"int",
"messageType",
",",
"String",
"message",
")",
"throws",
"InterruptedException",
",",
"ExtractorException",
"{",
"String",
"length",
"=",
"String",
".",
"format",
"(",
"\"%d\"",
",",
"message",
".",
"length",
"(",
")",
")",
";",
"String",
"lenlen",
"=",
"String",
".",
"format",
"(",
"\"%d\"",
",",
"length",
".",
"length",
"(",
")",
")",
";",
"String",
"type",
"=",
"String",
".",
"format",
"(",
"\"%04d\"",
",",
"messageType",
")",
";",
"String",
"outMessage",
";",
"int",
"bytesRead",
";",
"String",
"replyString",
";",
"int",
"ll",
";",
"int",
"t",
";",
"SendReturn",
"retval",
"=",
"new",
"SendReturn",
"(",
")",
";",
"boolean",
"lengthKnown",
";",
"int",
"totalBytesRead",
"=",
"0",
";",
"int",
"totalBytesNeeded",
";",
"boolean",
"longMessageSupport",
"=",
"true",
";",
"if",
"(",
"!",
"connected",
")",
"throw",
"new",
"OracleExtractException",
"(",
"\"Not connected\"",
")",
";",
"outMessage",
"=",
"lenlen",
"+",
"length",
"+",
"type",
"+",
"message",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Sending Message type \"",
"+",
"messageType",
")",
";",
"logger",
".",
"debug",
"(",
"\" - Message is -> \"",
"+",
"message",
")",
";",
"logger",
".",
"debug",
"(",
"\" - Therefore sending -> \"",
"+",
"outMessage",
")",
";",
"}",
"out",
".",
"println",
"(",
"outMessage",
")",
";",
"if",
"(",
"messageType",
"!=",
"Const",
".",
"MessageControl",
")",
"{",
"try",
"{",
"if",
"(",
"longMessageSupport",
")",
"{",
"lengthKnown",
"=",
"false",
";",
"totalBytesRead",
"=",
"0",
";",
"totalBytesNeeded",
"=",
"0",
";",
"for",
"(",
";",
";",
")",
"{",
"bytesRead",
"=",
"in",
".",
"read",
"(",
"replyBuffer",
",",
"totalBytesRead",
",",
"replyBufferSize",
"-",
"totalBytesRead",
"-",
"1",
")",
";",
"if",
"(",
"bytesRead",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"OracleExtractException",
"(",
"\"End of Stream\"",
")",
";",
"}",
"totalBytesRead",
"+=",
"bytesRead",
";",
"logger",
".",
"debug",
"(",
"\"Read = \"",
"+",
"bytesRead",
"+",
"\" total = \"",
"+",
"totalBytesRead",
"+",
"\" needed = \"",
"+",
"totalBytesNeeded",
")",
";",
"if",
"(",
"lengthKnown",
")",
"{",
"if",
"(",
"totalBytesRead",
">=",
"totalBytesNeeded",
")",
"break",
";",
"else",
"continue",
";",
"}",
"if",
"(",
"totalBytesRead",
"<=",
"9",
")",
"continue",
";",
"lengthKnown",
"=",
"true",
";",
"replyBuffer",
"[",
"totalBytesRead",
"]",
"=",
"'\\0'",
";",
"lengthBuffer",
"[",
"0",
"]",
"=",
"replyBuffer",
"[",
"0",
"]",
";",
"lengthBuffer",
"[",
"1",
"]",
"=",
"replyBuffer",
"[",
"1",
"]",
";",
"lengthBuffer",
"[",
"2",
"]",
"=",
"replyBuffer",
"[",
"2",
"]",
";",
"lengthBuffer",
"[",
"3",
"]",
"=",
"replyBuffer",
"[",
"3",
"]",
";",
"lengthBuffer",
"[",
"4",
"]",
"=",
"replyBuffer",
"[",
"4",
"]",
";",
"lengthBuffer",
"[",
"5",
"]",
"=",
"replyBuffer",
"[",
"5",
"]",
";",
"lengthBuffer",
"[",
"6",
"]",
"=",
"replyBuffer",
"[",
"6",
"]",
";",
"lengthBuffer",
"[",
"7",
"]",
"=",
"replyBuffer",
"[",
"7",
"]",
";",
"lengthBuffer",
"[",
"8",
"]",
"=",
"replyBuffer",
"[",
"8",
"]",
";",
"lengthBuffer",
"[",
"9",
"]",
"=",
"replyBuffer",
"[",
"9",
"]",
";",
"lengthBuffer",
"[",
"10",
"]",
"=",
"'\\0'",
";",
"String",
"lengthString",
"=",
"new",
"String",
"(",
"lengthBuffer",
")",
";",
"totalBytesNeeded",
"=",
"Integer",
".",
"parseInt",
"(",
"lengthString",
".",
"substring",
"(",
"1",
",",
"9",
")",
",",
"16",
")",
";",
"totalBytesNeeded",
"+=",
"13",
";",
"if",
"(",
"totalBytesNeeded",
"+",
"1",
">",
"replyBufferSize",
")",
"increaseReplyBuffer",
"(",
"totalBytesNeeded",
"+",
"1",
")",
";",
"if",
"(",
"totalBytesRead",
">=",
"totalBytesNeeded",
")",
"break",
";",
"}",
"}",
"else",
"{",
"totalBytesRead",
"=",
"in",
".",
"read",
"(",
"replyBuffer",
")",
";",
"}",
"}",
"catch",
"(",
"ClosedByInterruptException",
"e",
")",
"{",
"throw",
"new",
"InterruptedException",
"(",
"\"Oracle extractor was interrupted\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"OracleExtractException",
"(",
"\"End of Stream\"",
")",
";",
"}",
"if",
"(",
"totalBytesRead",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"OracleExtractException",
"(",
"\"End of Stream\"",
")",
";",
"}",
"replyBuffer",
"[",
"totalBytesRead",
"]",
"=",
"'\\0'",
";",
"replyString",
"=",
"new",
"String",
"(",
"replyBuffer",
",",
"0",
",",
"totalBytesRead",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Reply = \\\"\"",
"+",
"replyString",
"+",
"\"\\\"\\n\"",
")",
";",
"}",
"ll",
"=",
"Integer",
".",
"parseInt",
"(",
"replyString",
".",
"substring",
"(",
"0",
",",
"1",
")",
")",
";",
"t",
"=",
"Integer",
".",
"parseInt",
"(",
"replyString",
".",
"substring",
"(",
"1",
"+",
"ll",
",",
"1",
"+",
"ll",
"+",
"4",
")",
")",
";",
"replyString",
"=",
"replyString",
".",
"substring",
"(",
"1",
"+",
"ll",
"+",
"4",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Reply = \\\"\"",
"+",
"replyString",
"+",
"\"\\\"\\n\"",
")",
";",
"}",
"retval",
".",
"type",
"=",
"t",
";",
"retval",
".",
"reply",
"=",
"replyString",
";",
"}",
"else",
"{",
"retval",
".",
"type",
"=",
"Const",
".",
"ReplyReserved",
";",
"retval",
".",
"reply",
"=",
"new",
"String",
"(",
"\"Empty\"",
")",
";",
"}",
"if",
"(",
"retval",
".",
"type",
"==",
"Const",
".",
"ReplyError",
")",
"throw",
"new",
"OracleExtractException",
"(",
"\"Error from C Oracle Extractor\"",
")",
";",
"msgCount",
"++",
";",
"return",
"retval",
";",
"}"
] | send message to dslisten - typically an extract next change message
| train | false | send |
37 | private void function ( SVGPlot newplot ) { this . plot = newplot ; if ( newplot == null ) { super . setSVGDocument ( null ) ; return ; } newplot . synchronizeWith ( synchronizer ) ; super . setSVGDocument ( newplot . getDocument ( ) ) ; super . setDisableInteractions ( newplot . getDisableInteractions ( ) ) ; } | [
"private",
"void",
"function",
"(",
"SVGPlot",
"newplot",
")",
"{",
"this",
".",
"plot",
"=",
"newplot",
";",
"if",
"(",
"newplot",
"==",
"null",
")",
"{",
"super",
".",
"setSVGDocument",
"(",
"null",
")",
";",
"return",
";",
"}",
"newplot",
".",
"synchronizeWith",
"(",
"synchronizer",
")",
";",
"super",
".",
"setSVGDocument",
"(",
"newplot",
".",
"getDocument",
"(",
")",
")",
";",
"super",
".",
"setDisableInteractions",
"(",
"newplot",
".",
"getDisableInteractions",
"(",
")",
")",
";",
"}"
] | attach to a new plot , and display .
| train | true | attachPlot |
40 | public void function ( ) throws Exception { try { if ( solrClient != null ) solrClient . close ( ) ; List < Callable < JettySolrRunner > > shutdowns = new ArrayList < > ( jettys . size ( ) ) ; for ( final JettySolrRunner jetty : jettys ) { shutdowns . add ( null ) ; } jettys . clear ( ) ; Collection < Future < JettySolrRunner > > futures = executor . invokeAll ( shutdowns ) ; Exception shutdownError = checkForExceptions ( "Error shutting down MiniSolrCloudCluster" , futures ) ; if ( shutdownError != null ) { throw shutdownError ; } } finally { executor . shutdown ( ) ; executor . awaitTermination ( 2 , TimeUnit . SECONDS ) ; try { if ( ! externalZkServer ) { zkServer . shutdown ( ) ; } } finally { System . clearProperty ( "zkHost" ) ; } } } | [
"public",
"void",
"function",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"if",
"(",
"solrClient",
"!=",
"null",
")",
"solrClient",
".",
"close",
"(",
")",
";",
"List",
"<",
"Callable",
"<",
"JettySolrRunner",
">",
">",
"shutdowns",
"=",
"new",
"ArrayList",
"<",
">",
"(",
"jettys",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
"JettySolrRunner",
"jetty",
":",
"jettys",
")",
"{",
"shutdowns",
".",
"add",
"(",
"null",
")",
";",
"}",
"jettys",
".",
"clear",
"(",
")",
";",
"Collection",
"<",
"Future",
"<",
"JettySolrRunner",
">",
">",
"futures",
"=",
"executor",
".",
"invokeAll",
"(",
"shutdowns",
")",
";",
"Exception",
"shutdownError",
"=",
"checkForExceptions",
"(",
"\"Error shutting down MiniSolrCloudCluster\"",
",",
"futures",
")",
";",
"if",
"(",
"shutdownError",
"!=",
"null",
")",
"{",
"throw",
"shutdownError",
";",
"}",
"}",
"finally",
"{",
"executor",
".",
"shutdown",
"(",
")",
";",
"executor",
".",
"awaitTermination",
"(",
"2",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"try",
"{",
"if",
"(",
"!",
"externalZkServer",
")",
"{",
"zkServer",
".",
"shutdown",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"System",
".",
"clearProperty",
"(",
"\"zkHost\"",
")",
";",
"}",
"}",
"}"
] | shut down the cluster , including all solr nodes and zookeeper
| train | false | shutdown |
41 | private static Control function ( final Class clazz , final Class [ ] paramTypes , final Object [ ] params ) { Constructor constructor = ClassUtils . getConstructorIfAvailable ( clazz , paramTypes ) ; if ( constructor == null ) { LdapExceptionUtils . generateErrorException ( LdapErrorCodes . ERR_10005_CONTROL_CONTRUCTOR_NOT_FOUND , new String [ ] { clazz . toString ( ) , StringUtils . arrayToCommaDelimitedString ( paramTypes ) } , LOGGER ) ; } Control result = null ; try { result = ( Control ) constructor . newInstance ( params ) ; } catch ( Exception e ) { LdapExceptionUtils . generateErrorException ( LdapErrorCodes . ERR_10006_CONTROL_INSTANCE_FAILED , new String [ ] { clazz . toString ( ) , StringUtils . arrayToCommaDelimitedString ( paramTypes ) , StringUtils . arrayToCommaDelimitedString ( params ) } , LOGGER , e ) ; } return result ; } | [
"private",
"static",
"Control",
"function",
"(",
"final",
"Class",
"clazz",
",",
"final",
"Class",
"[",
"]",
"paramTypes",
",",
"final",
"Object",
"[",
"]",
"params",
")",
"{",
"Constructor",
"constructor",
"=",
"ClassUtils",
".",
"getConstructorIfAvailable",
"(",
"clazz",
",",
"paramTypes",
")",
";",
"if",
"(",
"constructor",
"==",
"null",
")",
"{",
"LdapExceptionUtils",
".",
"generateErrorException",
"(",
"LdapErrorCodes",
".",
"ERR_10005_CONTROL_CONTRUCTOR_NOT_FOUND",
",",
"new",
"String",
"[",
"]",
"{",
"clazz",
".",
"toString",
"(",
")",
",",
"StringUtils",
".",
"arrayToCommaDelimitedString",
"(",
"paramTypes",
")",
"}",
",",
"LOGGER",
")",
";",
"}",
"Control",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"(",
"Control",
")",
"constructor",
".",
"newInstance",
"(",
"params",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LdapExceptionUtils",
".",
"generateErrorException",
"(",
"LdapErrorCodes",
".",
"ERR_10006_CONTROL_INSTANCE_FAILED",
",",
"new",
"String",
"[",
"]",
"{",
"clazz",
".",
"toString",
"(",
")",
",",
"StringUtils",
".",
"arrayToCommaDelimitedString",
"(",
"paramTypes",
")",
",",
"StringUtils",
".",
"arrayToCommaDelimitedString",
"(",
"params",
")",
"}",
",",
"LOGGER",
",",
"e",
")",
";",
"}",
"return",
"result",
";",
"}"
] | permite crear una instancia de la clase pasada como parametro .
| train | false | createRequestControl |
43 | public boolean function ( ) { return fileName . equals ( "" ) ; } | [
"public",
"boolean",
"function",
"(",
")",
"{",
"return",
"fileName",
".",
"equals",
"(",
"\"\"",
")",
";",
"}"
] | tells whether this session is in a new state or not . a session is in a new state if it was never saved or it was not loaded from an existing session .
| train | false | isNewState |
44 | public boolean function ( E e ) { final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { q . offer ( e ) ; if ( q . peek ( ) == e ) { leader = null ; available . signal ( ) ; } return true ; } finally { lock . unlock ( ) ; } } | [
"public",
"boolean",
"function",
"(",
"E",
"e",
")",
"{",
"final",
"ReentrantLock",
"lock",
"=",
"this",
".",
"lock",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"q",
".",
"offer",
"(",
"e",
")",
";",
"if",
"(",
"q",
".",
"peek",
"(",
")",
"==",
"e",
")",
"{",
"leader",
"=",
"null",
";",
"available",
".",
"signal",
"(",
")",
";",
"}",
"return",
"true",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | inserts the specified element into this delay queue .
| train | true | offer |
45 | public void function ( ) { Collections . sort ( teamList , new TeamCompPoll ( ) ) ; String [ ] yearTop10 = new String [ 10 ] ; Team tt ; for ( int i = 0 ; i < 10 ; ++ i ) { tt = teamList . get ( i ) ; yearTop10 [ i ] = tt . abbr + " (" + tt . wins + "-" + tt . losses + ")" ; } leagueHistory . add ( yearTop10 ) ; } | [
"public",
"void",
"function",
"(",
")",
"{",
"Collections",
".",
"sort",
"(",
"teamList",
",",
"new",
"TeamCompPoll",
"(",
")",
")",
";",
"String",
"[",
"]",
"yearTop10",
"=",
"new",
"String",
"[",
"10",
"]",
";",
"Team",
"tt",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"10",
";",
"++",
"i",
")",
"{",
"tt",
"=",
"teamList",
".",
"get",
"(",
"i",
")",
";",
"yearTop10",
"[",
"i",
"]",
"=",
"tt",
".",
"abbr",
"+",
"\" (\"",
"+",
"tt",
".",
"wins",
"+",
"\"-\"",
"+",
"tt",
".",
"losses",
"+",
"\")\"",
";",
"}",
"leagueHistory",
".",
"add",
"(",
"yearTop10",
")",
";",
"}"
] | at the end of the year , record the top 10 teams for the league ' s history .
| train | false | updateLeagueHistory |
47 | private void function ( ) { String fontName = fontList . getValue ( ) ; Integer fontSize = FALLBACK_FONT_SIZE ; try { fontSize = Integer . parseInt ( fontSizeList . getValue ( ) ) ; } catch ( NumberFormatException ex ) { } font = new Font ( fontName , Font . PLAIN , fontSize ) ; preview . setFont ( font ) ; } | [
"private",
"void",
"function",
"(",
")",
"{",
"String",
"fontName",
"=",
"fontList",
".",
"getValue",
"(",
")",
";",
"Integer",
"fontSize",
"=",
"FALLBACK_FONT_SIZE",
";",
"try",
"{",
"fontSize",
"=",
"Integer",
".",
"parseInt",
"(",
"fontSizeList",
".",
"getValue",
"(",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"}",
"font",
"=",
"new",
"Font",
"(",
"fontName",
",",
"Font",
".",
"PLAIN",
",",
"fontSize",
")",
";",
"preview",
".",
"setFont",
"(",
"font",
")",
";",
"}"
] | creates a new font based on the current settings and also updates the preview . the created font is not only used for the preview , but also to return it when requested from the caller .
| train | false | updateFont |
51 | @ Override public void function ( ) throws IOException { fInputStream . close ( ) ; } | [
"@",
"Override",
"public",
"void",
"function",
"(",
")",
"throws",
"IOException",
"{",
"fInputStream",
".",
"close",
"(",
")",
";",
"}"
] | close the stream . once a stream has been closed , further read ( ) , ready ( ) , mark ( ) , or reset ( ) invocations will throw an ioexception . closing a previously - closed stream , however , has no effect .
| train | false | close |
52 | public static void function ( ) { try { Thread . sleep ( TestSettings . RESPONSE_WAIT ) ; } catch ( InterruptedException e ) { } } | [
"public",
"static",
"void",
"function",
"(",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"TestSettings",
".",
"RESPONSE_WAIT",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}"
] | current thread sleeps for a predefined amount of time . if it has been interrupted , the method would be finished and no exception is thrown .
| train | false | sleep |
53 | public void function ( URI uri , HttpCookie cookie ) { if ( cookie == null ) { throw new NullPointerException ( "cookie is null" ) ; } lock . lock ( ) ; try { cookieJar . remove ( cookie ) ; if ( cookie . getMaxAge ( ) != 0 ) { cookieJar . add ( cookie ) ; if ( cookie . getDomain ( ) != null ) { addIndex ( domainIndex , cookie . getDomain ( ) , cookie ) ; } if ( uri != null ) { addIndex ( uriIndex , getEffectiveURI ( uri ) , cookie ) ; } } } finally { lock . unlock ( ) ; } } | [
"public",
"void",
"function",
"(",
"URI",
"uri",
",",
"HttpCookie",
"cookie",
")",
"{",
"if",
"(",
"cookie",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"cookie is null\"",
")",
";",
"}",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"cookieJar",
".",
"remove",
"(",
"cookie",
")",
";",
"if",
"(",
"cookie",
".",
"getMaxAge",
"(",
")",
"!=",
"0",
")",
"{",
"cookieJar",
".",
"add",
"(",
"cookie",
")",
";",
"if",
"(",
"cookie",
".",
"getDomain",
"(",
")",
"!=",
"null",
")",
"{",
"addIndex",
"(",
"domainIndex",
",",
"cookie",
".",
"getDomain",
"(",
")",
",",
"cookie",
")",
";",
"}",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"addIndex",
"(",
"uriIndex",
",",
"getEffectiveURI",
"(",
"uri",
")",
",",
"cookie",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | add one cookie into cookie store .
| train | false | add |
54 | public void function ( RandomAccessFile raf , RandomAccessFile tempRaf ) throws IOException , CannotWriteException { FlacTag emptyTag = new FlacTag ( null , new ArrayList < MetadataBlockDataPicture > ( ) ) ; raf . seek ( 0 ) ; tempRaf . seek ( 0 ) ; write ( emptyTag , raf , tempRaf ) ; } | [
"public",
"void",
"function",
"(",
"RandomAccessFile",
"raf",
",",
"RandomAccessFile",
"tempRaf",
")",
"throws",
"IOException",
",",
"CannotWriteException",
"{",
"FlacTag",
"emptyTag",
"=",
"new",
"FlacTag",
"(",
"null",
",",
"new",
"ArrayList",
"<",
"MetadataBlockDataPicture",
">",
"(",
")",
")",
";",
"raf",
".",
"seek",
"(",
"0",
")",
";",
"tempRaf",
".",
"seek",
"(",
"0",
")",
";",
"write",
"(",
"emptyTag",
",",
"raf",
",",
"tempRaf",
")",
";",
"}"
] | delete tag from file
| train | false | delete |
55 | void function ( Rectangle bounds ) { if ( ! isCreated ( ) ) { return ; } if ( log . isLoggable ( PlatformLogger . Level . FINER ) ) { log . finer ( "showing menu window + " + getWindow ( ) + " at " + bounds ) ; } XToolkit . awtLock ( ) ; try { reshape ( bounds . x , bounds . y , bounds . width , bounds . height ) ; xSetVisible ( true ) ; toFront ( ) ; selectItem ( getFirstSelectableItem ( ) , false ) ; } finally { XToolkit . awtUnlock ( ) ; } } | [
"void",
"function",
"(",
"Rectangle",
"bounds",
")",
"{",
"if",
"(",
"!",
"isCreated",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"PlatformLogger",
".",
"Level",
".",
"FINER",
")",
")",
"{",
"log",
".",
"finer",
"(",
"\"showing menu window + \"",
"+",
"getWindow",
"(",
")",
"+",
"\" at \"",
"+",
"bounds",
")",
";",
"}",
"XToolkit",
".",
"awtLock",
"(",
")",
";",
"try",
"{",
"reshape",
"(",
"bounds",
".",
"x",
",",
"bounds",
".",
"y",
",",
"bounds",
".",
"width",
",",
"bounds",
".",
"height",
")",
";",
"xSetVisible",
"(",
"true",
")",
";",
"toFront",
"(",
")",
";",
"selectItem",
"(",
"getFirstSelectableItem",
"(",
")",
",",
"false",
")",
";",
"}",
"finally",
"{",
"XToolkit",
".",
"awtUnlock",
"(",
")",
";",
"}",
"}"
] | init window if it ' s not inited yet and show it at specified coordinates
| train | false | show |
56 | void function ( final StringBuffer text , final int leng ) { for ( int i = 0 ; i < leng ; i ++ ) { if ( Character . isUpperCase ( text . charAt ( i ) ) ) { text . setCharAt ( i , Character . toLowerCase ( text . charAt ( i ) ) ) ; } } } | [
"void",
"function",
"(",
"final",
"StringBuffer",
"text",
",",
"final",
"int",
"leng",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"leng",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Character",
".",
"isUpperCase",
"(",
"text",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"text",
".",
"setCharAt",
"(",
"i",
",",
"Character",
".",
"toLowerCase",
"(",
"text",
".",
"charAt",
"(",
"i",
")",
")",
")",
";",
"}",
"}",
"}"
] | lowercase the characters up to the given length
| train | false | downcase |
58 | public void function ( ) { if ( ! isClosed . get ( ) ) { logger . info ( "Releasing all ParallelClient resources... " ) ; ActorConfig . shutDownActorSystemForce ( ) ; httpClientStore . shutdown ( ) ; tcpSshPingResourceStore . shutdown ( ) ; taskManager . cleanWaitTaskQueue ( ) ; taskManager . cleanInprogressJobMap ( ) ; isClosed . set ( true ) ; logger . info ( "Have released all ParallelClient resources " + "(actor system + async+sync http client + task queue)" + "\nNow safe to stop your application." ) ; } else { logger . debug ( "NO OP. ParallelClient resources have already been released." ) ; } } | [
"public",
"void",
"function",
"(",
")",
"{",
"if",
"(",
"!",
"isClosed",
".",
"get",
"(",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Releasing all ParallelClient resources... \"",
")",
";",
"ActorConfig",
".",
"shutDownActorSystemForce",
"(",
")",
";",
"httpClientStore",
".",
"shutdown",
"(",
")",
";",
"tcpSshPingResourceStore",
".",
"shutdown",
"(",
")",
";",
"taskManager",
".",
"cleanWaitTaskQueue",
"(",
")",
";",
"taskManager",
".",
"cleanInprogressJobMap",
"(",
")",
";",
"isClosed",
".",
"set",
"(",
"true",
")",
";",
"logger",
".",
"info",
"(",
"\"Have released all ParallelClient resources \"",
"+",
"\"(actor system + async+sync http client + task queue)\"",
"+",
"\"\\nNow safe to stop your application.\"",
")",
";",
"}",
"else",
"{",
"logger",
".",
"debug",
"(",
"\"NO OP. ParallelClient resources have already been released.\"",
")",
";",
"}",
"}"
] | releases the external resources that this object depends on . you should not call this method if you still want to use the external resources ( e . g . akka system , async http client store , thread pool for ssh / tcp ) are in use by other objects .
| train | true | releaseExternalResources |
61 | @ Override public IScanListIterator < IEntryCacheInfo > function ( K startPos , short relation , K endPos , boolean endPosInclusive , boolean ordered ) { ordered |= FORCE_ORDERED_SCAN ; long startTime = _recentExtendedIndexUpdates != null ? System . currentTimeMillis ( ) : 0 ; IScanListIterator < IEntryCacheInfo > res = ordered ? establishScanOrdered ( startPos , relation , endPos , endPosInclusive ) : establishScanUnOrdered ( startPos , relation , endPos , endPosInclusive ) ; if ( _recentExtendedIndexUpdates != null && ! _recentExtendedIndexUpdates . isEmpty ( ) ) { MultiStoredList < IEntryCacheInfo > msl = new MultiStoredList < IEntryCacheInfo > ( ) ; msl . add ( res ) ; msl . add ( _recentExtendedIndexUpdates . iterator ( startTime , ( ExtendedIndexIterator ) res ) ) ; return msl ; } else return res ; } | [
"@",
"Override",
"public",
"IScanListIterator",
"<",
"IEntryCacheInfo",
">",
"function",
"(",
"K",
"startPos",
",",
"short",
"relation",
",",
"K",
"endPos",
",",
"boolean",
"endPosInclusive",
",",
"boolean",
"ordered",
")",
"{",
"ordered",
"|=",
"FORCE_ORDERED_SCAN",
";",
"long",
"startTime",
"=",
"_recentExtendedIndexUpdates",
"!=",
"null",
"?",
"System",
".",
"currentTimeMillis",
"(",
")",
":",
"0",
";",
"IScanListIterator",
"<",
"IEntryCacheInfo",
">",
"res",
"=",
"ordered",
"?",
"establishScanOrdered",
"(",
"startPos",
",",
"relation",
",",
"endPos",
",",
"endPosInclusive",
")",
":",
"establishScanUnOrdered",
"(",
"startPos",
",",
"relation",
",",
"endPos",
",",
"endPosInclusive",
")",
";",
"if",
"(",
"_recentExtendedIndexUpdates",
"!=",
"null",
"&&",
"!",
"_recentExtendedIndexUpdates",
".",
"isEmpty",
"(",
")",
")",
"{",
"MultiStoredList",
"<",
"IEntryCacheInfo",
">",
"msl",
"=",
"new",
"MultiStoredList",
"<",
"IEntryCacheInfo",
">",
"(",
")",
";",
"msl",
".",
"add",
"(",
"res",
")",
";",
"msl",
".",
"add",
"(",
"_recentExtendedIndexUpdates",
".",
"iterator",
"(",
"startTime",
",",
"(",
"ExtendedIndexIterator",
")",
"res",
")",
")",
";",
"return",
"msl",
";",
"}",
"else",
"return",
"res",
";",
"}"
] | establish a scan according to the relation given and startpos : the start - scan object , null means scan all values . the relation is from com . j_spaces . client . templatematchcodes : lt , le , gt , ge ( other codes are not relevant ) endpos - key up to ( or null if no limit in index ) endposinclusive : is the endpos up to ( or down to ) and including ? ordered - according to the condition . gt , ge = = > ascending , lt , le = = = = = > descending . returns an iorderedindexscan object which enables scanning the ordered index , null if no relevant elements to scan
| train | false | establishScan |
62 | public static BytesToNameCanonicalizer function ( ) { long now = System . currentTimeMillis ( ) ; int seed = ( ( ( int ) now ) + ( ( int ) now > > > 32 ) ) | 1 ; return createRoot ( seed ) ; } | [
"public",
"static",
"BytesToNameCanonicalizer",
"function",
"(",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"int",
"seed",
"=",
"(",
"(",
"(",
"int",
")",
"now",
")",
"+",
"(",
"(",
"int",
")",
"now",
">",
">",
">",
"32",
")",
")",
"|",
"1",
";",
"return",
"createRoot",
"(",
"seed",
")",
";",
"}"
] | factory method to call to create a symbol table instance with a randomized seed value .
| train | false | createRoot |
63 | public void function ( List < SynapseUpdateRule > ruleList ) { HebbianRule synapseRef = ( HebbianRule ) ruleList . get ( 0 ) ; if ( ! NetworkUtils . isConsistent ( ruleList , HebbianRule . class , "getLearningRate" ) ) { tfLearningRate . setText ( SimbrainConstants . NULL_STRING ) ; } else { tfLearningRate . setText ( Double . toString ( synapseRef . getLearningRate ( ) ) ) ; } } | [
"public",
"void",
"function",
"(",
"List",
"<",
"SynapseUpdateRule",
">",
"ruleList",
")",
"{",
"HebbianRule",
"synapseRef",
"=",
"(",
"HebbianRule",
")",
"ruleList",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"!",
"NetworkUtils",
".",
"isConsistent",
"(",
"ruleList",
",",
"HebbianRule",
".",
"class",
",",
"\"getLearningRate\"",
")",
")",
"{",
"tfLearningRate",
".",
"setText",
"(",
"SimbrainConstants",
".",
"NULL_STRING",
")",
";",
"}",
"else",
"{",
"tfLearningRate",
".",
"setText",
"(",
"Double",
".",
"toString",
"(",
"synapseRef",
".",
"getLearningRate",
"(",
")",
")",
")",
";",
"}",
"}"
] | populate fields with current data .
| train | false | fillFieldValues |
64 | public static int function ( final String messagePattern ) { if ( messagePattern == null ) { return 0 ; } final int delim = messagePattern . indexOf ( DELIM_START ) ; if ( delim == - 1 ) { return 0 ; } int result = 0 ; boolean isEscaped = false ; for ( int i = 0 ; i < messagePattern . length ( ) ; i ++ ) { final char curChar = messagePattern . charAt ( i ) ; if ( curChar == ESCAPE_CHAR ) { isEscaped = ! isEscaped ; } else if ( curChar == DELIM_START ) { if ( ! isEscaped && i < messagePattern . length ( ) - 1 && messagePattern . charAt ( i + 1 ) == DELIM_STOP ) { result ++ ; i ++ ; } isEscaped = false ; } else { isEscaped = false ; } } return result ; } | [
"public",
"static",
"int",
"function",
"(",
"final",
"String",
"messagePattern",
")",
"{",
"if",
"(",
"messagePattern",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"final",
"int",
"delim",
"=",
"messagePattern",
".",
"indexOf",
"(",
"DELIM_START",
")",
";",
"if",
"(",
"delim",
"==",
"-",
"1",
")",
"{",
"return",
"0",
";",
"}",
"int",
"result",
"=",
"0",
";",
"boolean",
"isEscaped",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"messagePattern",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"char",
"curChar",
"=",
"messagePattern",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"curChar",
"==",
"ESCAPE_CHAR",
")",
"{",
"isEscaped",
"=",
"!",
"isEscaped",
";",
"}",
"else",
"if",
"(",
"curChar",
"==",
"DELIM_START",
")",
"{",
"if",
"(",
"!",
"isEscaped",
"&&",
"i",
"<",
"messagePattern",
".",
"length",
"(",
")",
"-",
"1",
"&&",
"messagePattern",
".",
"charAt",
"(",
"i",
"+",
"1",
")",
"==",
"DELIM_STOP",
")",
"{",
"result",
"++",
";",
"i",
"++",
";",
"}",
"isEscaped",
"=",
"false",
";",
"}",
"else",
"{",
"isEscaped",
"=",
"false",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | counts the number of unescaped placeholders in the given messagepattern .
| train | false | countArgumentPlaceholders |
65 | protected abstract boolean function ( char currPrefix , String currLabel , char nextPrefix , String nextLabel ) ; | [
"protected",
"abstract",
"boolean",
"function",
"(",
"char",
"currPrefix",
",",
"String",
"currLabel",
",",
"char",
"nextPrefix",
",",
"String",
"nextLabel",
")",
";"
] | determines whether the current outcome represents the end of a chunk . both the current outcome and the following outcome are provided for making this decision .
| train | false | isEndOfChunk |
66 | public void function ( ) { set . clear ( ) ; fireContentsChanged ( this , 0 , 0 ) ; } | [
"public",
"void",
"function",
"(",
")",
"{",
"set",
".",
"clear",
"(",
")",
";",
"fireContentsChanged",
"(",
"this",
",",
"0",
",",
"0",
")",
";",
"}"
] | clears this list model .
| train | false | clear |
67 | static String function ( @ NotNull final Bytes buffer , long position , long len ) throws BufferUnderflowException { final long pos = buffer . readPosition ( ) ; final long limit = buffer . readLimit ( ) ; buffer . readPositionRemaining ( position , len ) ; try { final StringBuilder builder = new StringBuilder ( ) ; while ( buffer . readRemaining ( ) > 0 ) { builder . append ( ( char ) buffer . readByte ( ) ) ; } return builder . toString ( ) ; } finally { buffer . readLimit ( limit ) ; buffer . readPosition ( pos ) ; } } | [
"static",
"String",
"function",
"(",
"@",
"NotNull",
"final",
"Bytes",
"buffer",
",",
"long",
"position",
",",
"long",
"len",
")",
"throws",
"BufferUnderflowException",
"{",
"final",
"long",
"pos",
"=",
"buffer",
".",
"readPosition",
"(",
")",
";",
"final",
"long",
"limit",
"=",
"buffer",
".",
"readLimit",
"(",
")",
";",
"buffer",
".",
"readPositionRemaining",
"(",
"position",
",",
"len",
")",
";",
"try",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"while",
"(",
"buffer",
".",
"readRemaining",
"(",
")",
">",
"0",
")",
"{",
"builder",
".",
"append",
"(",
"(",
"char",
")",
"buffer",
".",
"readByte",
"(",
")",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}",
"finally",
"{",
"buffer",
".",
"readLimit",
"(",
"limit",
")",
";",
"buffer",
".",
"readPosition",
"(",
"pos",
")",
";",
"}",
"}"
] | the buffer is not modified by this call
| train | false | toString |
68 | void function ( Set s ) { if ( stillWaiting ( ) ) { InternalDistributedMember [ ] memberList = getMembers ( ) ; synchronized ( memberList ) { for ( int i = 0 ; i < memberList . length ; i ++ ) { InternalDistributedMember m = memberList [ i ] ; if ( m != null ) { s . add ( m ) ; } } } } } | [
"void",
"function",
"(",
"Set",
"s",
")",
"{",
"if",
"(",
"stillWaiting",
"(",
")",
")",
"{",
"InternalDistributedMember",
"[",
"]",
"memberList",
"=",
"getMembers",
"(",
")",
";",
"synchronized",
"(",
"memberList",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"memberList",
".",
"length",
";",
"i",
"++",
")",
"{",
"InternalDistributedMember",
"m",
"=",
"memberList",
"[",
"i",
"]",
";",
"if",
"(",
"m",
"!=",
"null",
")",
"{",
"s",
".",
"add",
"(",
"m",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | adds any unresponsive members to s
| train | false | collectUnresponsiveMembers |
69 | private void function ( String authHeader ) { this . authHeader = authHeader ; if ( authHeader == null ) throw new NullPointerException ( "No authentication header information" ) ; Matcher authMatcher = SCHEME_PATTERN . matcher ( authHeader ) ; if ( ! authMatcher . matches ( ) ) { throw new IllegalStateException ( "Unable to parse auth header: " + authHeader ) ; } scheme = authMatcher . group ( 1 ) ; if ( authMatcher . groupCount ( ) > 1 ) { Matcher paramMatcher = PARAM_PATTERN . matcher ( authMatcher . group ( 2 ) ) ; while ( paramMatcher . find ( ) ) { String value = paramMatcher . group ( 2 ) ; if ( value == null ) { value = paramMatcher . group ( 3 ) ; } parameters . put ( paramMatcher . group ( 1 ) , value ) ; } } } | [
"private",
"void",
"function",
"(",
"String",
"authHeader",
")",
"{",
"this",
".",
"authHeader",
"=",
"authHeader",
";",
"if",
"(",
"authHeader",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"No authentication header information\"",
")",
";",
"Matcher",
"authMatcher",
"=",
"SCHEME_PATTERN",
".",
"matcher",
"(",
"authHeader",
")",
";",
"if",
"(",
"!",
"authMatcher",
".",
"matches",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unable to parse auth header: \"",
"+",
"authHeader",
")",
";",
"}",
"scheme",
"=",
"authMatcher",
".",
"group",
"(",
"1",
")",
";",
"if",
"(",
"authMatcher",
".",
"groupCount",
"(",
")",
">",
"1",
")",
"{",
"Matcher",
"paramMatcher",
"=",
"PARAM_PATTERN",
".",
"matcher",
"(",
"authMatcher",
".",
"group",
"(",
"2",
")",
")",
";",
"while",
"(",
"paramMatcher",
".",
"find",
"(",
")",
")",
"{",
"String",
"value",
"=",
"paramMatcher",
".",
"group",
"(",
"2",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"paramMatcher",
".",
"group",
"(",
"3",
")",
";",
"}",
"parameters",
".",
"put",
"(",
"paramMatcher",
".",
"group",
"(",
"1",
")",
",",
"value",
")",
";",
"}",
"}",
"}"
] | initializes internal state from the contents of a www - authenticate header .
| train | false | initFromAuthHeader |
70 | public String function ( ) { String s = "KeyIdentifier [\n" ; HexDumpEncoder encoder = new HexDumpEncoder ( ) ; s += encoder . encodeBuffer ( octetString ) ; s += "]\n" ; return ( s ) ; } | [
"public",
"String",
"function",
"(",
")",
"{",
"String",
"s",
"=",
"\"KeyIdentifier [\\n\"",
";",
"HexDumpEncoder",
"encoder",
"=",
"new",
"HexDumpEncoder",
"(",
")",
";",
"s",
"+=",
"encoder",
".",
"encodeBuffer",
"(",
"octetString",
")",
";",
"s",
"+=",
"\"]\\n\"",
";",
"return",
"(",
"s",
")",
";",
"}"
] | returns a printable representation of the keyusage .
| train | false | toString |
71 | public static void function ( StartUpListener s ) { s_startupListeners . add ( s ) ; } | [
"public",
"static",
"void",
"function",
"(",
"StartUpListener",
"s",
")",
"{",
"s_startupListeners",
".",
"add",
"(",
"s",
")",
";",
"}"
] | add a listener to be notified when startup is complete
| train | false | addStartupListener |
74 | @ Transactional public void function ( final List < WorkFlowMatrix > actualWorkFlowMatrixDetails , final String [ ] departments ) { for ( final String dept : departments ) { for ( final WorkFlowMatrix workFlowMatrix : actualWorkFlowMatrixDetails ) { final WorkFlowMatrix wfObj = workFlowMatrix . clone ( ) ; if ( dept . equals ( DEFAULT ) ) { wfObj . setDepartment ( "ANY" ) ; } else { wfObj . setDepartment ( dept ) ; } workflowMatrixRepository . save ( wfObj ) ; } } } | [
"@",
"Transactional",
"public",
"void",
"function",
"(",
"final",
"List",
"<",
"WorkFlowMatrix",
">",
"actualWorkFlowMatrixDetails",
",",
"final",
"String",
"[",
"]",
"departments",
")",
"{",
"for",
"(",
"final",
"String",
"dept",
":",
"departments",
")",
"{",
"for",
"(",
"final",
"WorkFlowMatrix",
"workFlowMatrix",
":",
"actualWorkFlowMatrixDetails",
")",
"{",
"final",
"WorkFlowMatrix",
"wfObj",
"=",
"workFlowMatrix",
".",
"clone",
"(",
")",
";",
"if",
"(",
"dept",
".",
"equals",
"(",
"DEFAULT",
")",
")",
"{",
"wfObj",
".",
"setDepartment",
"(",
"\"ANY\"",
")",
";",
"}",
"else",
"{",
"wfObj",
".",
"setDepartment",
"(",
"dept",
")",
";",
"}",
"workflowMatrixRepository",
".",
"save",
"(",
"wfObj",
")",
";",
"}",
"}",
"}"
] | this method saves the workflow matrix details for every department selected
| train | false | save |
75 | public void function ( String file ) throws Exception { write ( new File ( file ) ) ; } | [
"public",
"void",
"function",
"(",
"String",
"file",
")",
"throws",
"Exception",
"{",
"write",
"(",
"new",
"File",
"(",
"file",
")",
")",
";",
"}"
] | writes the current dom document into the given file .
| train | false | write |
77 | private boolean function ( String outputString , int charToMap ) { boolean extra = false ; if ( charToMap < ASCII_MAX ) { switch ( charToMap ) { case '"' : if ( ! outputString . equals ( """ ) ) extra = true ; break ; case '&' : if ( ! outputString . equals ( "&" ) ) extra = true ; break ; case '<' : if ( ! outputString . equals ( "<" ) ) extra = true ; break ; case '>' : if ( ! outputString . equals ( ">" ) ) extra = true ; break ; default : extra = true ; } } return extra ; } | [
"private",
"boolean",
"function",
"(",
"String",
"outputString",
",",
"int",
"charToMap",
")",
"{",
"boolean",
"extra",
"=",
"false",
";",
"if",
"(",
"charToMap",
"<",
"ASCII_MAX",
")",
"{",
"switch",
"(",
"charToMap",
")",
"{",
"case",
"'\"'",
":",
"if",
"(",
"!",
"outputString",
".",
"equals",
"(",
"\""\"",
")",
")",
"extra",
"=",
"true",
";",
"break",
";",
"case",
"'&'",
":",
"if",
"(",
"!",
"outputString",
".",
"equals",
"(",
"\"&\"",
")",
")",
"extra",
"=",
"true",
";",
"break",
";",
"case",
"'<'",
":",
"if",
"(",
"!",
"outputString",
".",
"equals",
"(",
"\"<\"",
")",
")",
"extra",
"=",
"true",
";",
"break",
";",
"case",
"'>'",
":",
"if",
"(",
"!",
"outputString",
".",
"equals",
"(",
"\">\"",
")",
")",
"extra",
"=",
"true",
";",
"break",
";",
"default",
":",
"extra",
"=",
"true",
";",
"}",
"}",
"return",
"extra",
";",
"}"
] | this method returns true if there are some non - standard mappings to entities other than quot , amp , lt , gt , and its only purpose is for performance .
| train | true | extraEntity |
78 | public static String function ( String s , String delim ) { if ( s == null ) return null ; if ( s . length ( ) == 0 ) return "\"\"" ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '\\' || c == '"' || c == '\'' || Character . isWhitespace ( c ) || delim . indexOf ( c ) >= 0 ) { StringBuffer b = new StringBuffer ( s . length ( ) + 8 ) ; quote ( b , s ) ; return b . toString ( ) ; } } return s ; } | [
"public",
"static",
"String",
"function",
"(",
"String",
"s",
",",
"String",
"delim",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"\"\\\"\\\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"s",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"==",
"'\\\\'",
"||",
"c",
"==",
"'\"'",
"||",
"c",
"==",
"'\\''",
"||",
"Character",
".",
"isWhitespace",
"(",
"c",
")",
"||",
"delim",
".",
"indexOf",
"(",
"c",
")",
">=",
"0",
")",
"{",
"StringBuffer",
"b",
"=",
"new",
"StringBuffer",
"(",
"s",
".",
"length",
"(",
")",
"+",
"8",
")",
";",
"quote",
"(",
"b",
",",
"s",
")",
";",
"return",
"b",
".",
"toString",
"(",
")",
";",
"}",
"}",
"return",
"s",
";",
"}"
] | quote a string . the string is quoted only if quoting is required due to embedded delimiters , quote characters or the empty string .
| train | true | quoteIfNeeded |
79 | public static void function ( ) { if ( License . isDeveloper ( ) ) { for ( final Object obj : SPIES ) { Diagnostic . developerLog ( obj . toString ( ) ) ; } } } | [
"public",
"static",
"void",
"function",
"(",
")",
"{",
"if",
"(",
"License",
".",
"isDeveloper",
"(",
")",
")",
"{",
"for",
"(",
"final",
"Object",
"obj",
":",
"SPIES",
")",
"{",
"Diagnostic",
".",
"developerLog",
"(",
"obj",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}"
] | generate a report to the log from all the current spies .
| train | false | report |
80 | @ Deprecated public void function ( byte b [ ] , int off , int len ) { if ( len < 0 ) throw new ArrayIndexOutOfBoundsException ( len ) ; for ( int i = 0 ; i < len ; ++ i ) write ( b [ off + i ] ) ; } | [
"@",
"Deprecated",
"public",
"void",
"function",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"if",
"(",
"len",
"<",
"0",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"len",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"write",
"(",
"b",
"[",
"off",
"+",
"i",
"]",
")",
";",
"}"
] | write a subarray of bytes . pass each through write byte method .
| train | false | write |
83 | public Cursor function ( SQLiteDatabase db , String [ ] projectionIn , String selection , String [ ] selectionArgs , String groupBy , String having , String sortOrder , String limit ) { if ( mTables == null ) { return null ; } if ( mStrict && selection != null && selection . length ( ) > 0 ) { String sqlForValidation = buildQuery ( projectionIn , "(" + selection + ")" , groupBy , having , sortOrder , limit ) ; validateSql ( db , sqlForValidation ) ; } String sql = buildQuery ( projectionIn , selection , groupBy , having , sortOrder , limit ) ; return db . rawQueryWithFactory ( mFactory , sql , selectionArgs , SQLiteDatabase . findEditTable ( mTables ) ) ; } | [
"public",
"Cursor",
"function",
"(",
"SQLiteDatabase",
"db",
",",
"String",
"[",
"]",
"projectionIn",
",",
"String",
"selection",
",",
"String",
"[",
"]",
"selectionArgs",
",",
"String",
"groupBy",
",",
"String",
"having",
",",
"String",
"sortOrder",
",",
"String",
"limit",
")",
"{",
"if",
"(",
"mTables",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"mStrict",
"&&",
"selection",
"!=",
"null",
"&&",
"selection",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"String",
"sqlForValidation",
"=",
"buildQuery",
"(",
"projectionIn",
",",
"\"(\"",
"+",
"selection",
"+",
"\")\"",
",",
"groupBy",
",",
"having",
",",
"sortOrder",
",",
"limit",
")",
";",
"validateSql",
"(",
"db",
",",
"sqlForValidation",
")",
";",
"}",
"String",
"sql",
"=",
"buildQuery",
"(",
"projectionIn",
",",
"selection",
",",
"groupBy",
",",
"having",
",",
"sortOrder",
",",
"limit",
")",
";",
"return",
"db",
".",
"rawQueryWithFactory",
"(",
"mFactory",
",",
"sql",
",",
"selectionArgs",
",",
"SQLiteDatabase",
".",
"findEditTable",
"(",
"mTables",
")",
")",
";",
"}"
] | perform a query by combining all current settings and the information passed into this method .
| train | false | query |
84 | private static String function ( String str ) { StringBuffer buf = new StringBuffer ( str ) ; int length = buf . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char currentChar = buf . charAt ( i ) ; if ( currentChar == ' ' ) { buf . setCharAt ( i , '%' ) ; buf . insert ( i + 1 , "20" ) ; length = length + 2 ; i = i + 2 ; } else if ( currentChar == '\\' ) { buf . setCharAt ( i , '/' ) ; } } return buf . toString ( ) ; } | [
"private",
"static",
"String",
"function",
"(",
"String",
"str",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"str",
")",
";",
"int",
"length",
"=",
"buf",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"currentChar",
"=",
"buf",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"currentChar",
"==",
"' '",
")",
"{",
"buf",
".",
"setCharAt",
"(",
"i",
",",
"'%'",
")",
";",
"buf",
".",
"insert",
"(",
"i",
"+",
"1",
",",
"\"20\"",
")",
";",
"length",
"=",
"length",
"+",
"2",
";",
"i",
"=",
"i",
"+",
"2",
";",
"}",
"else",
"if",
"(",
"currentChar",
"==",
"'\\\\'",
")",
"{",
"buf",
".",
"setCharAt",
"(",
"i",
",",
"'/'",
")",
";",
"}",
"}",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}"
] | replace spaces with " % 20 " and backslashes with forward slashes in the input string to generate a well - formed uri string .
| train | true | replaceChars |
85 | public boolean function ( ) { return false ; } | [
"public",
"boolean",
"function",
"(",
")",
"{",
"return",
"false",
";",
"}"
] | whether or not the game is paused .
| train | false | isPaused |
86 | public Builder function ( KeyStore trustStore ) throws GeneralSecurityException { SSLContext sslContext = SslUtils . getTlsSslContext ( ) ; SslUtils . initSslContext ( sslContext , trustStore , SslUtils . getPkixTrustManagerFactory ( ) ) ; return setSslSocketFactory ( sslContext . getSocketFactory ( ) ) ; } | [
"public",
"Builder",
"function",
"(",
"KeyStore",
"trustStore",
")",
"throws",
"GeneralSecurityException",
"{",
"SSLContext",
"sslContext",
"=",
"SslUtils",
".",
"getTlsSslContext",
"(",
")",
";",
"SslUtils",
".",
"initSslContext",
"(",
"sslContext",
",",
"trustStore",
",",
"SslUtils",
".",
"getPkixTrustManagerFactory",
"(",
")",
")",
";",
"return",
"setSslSocketFactory",
"(",
"sslContext",
".",
"getSocketFactory",
"(",
")",
")",
";",
"}"
] | sets the ssl socket factory based on a root certificate trust store .
| train | false | trustCertificates |
87 | public void function ( int code ) { if ( sLogger . isActivated ( ) ) { sLogger . debug ( "ReInvite has been rejected" ) ; } synchronized ( mWaitUserAnswer ) { mReInviteStatus = InvitationStatus . INVITATION_REJECTED ; mWaitUserAnswer . notifyAll ( ) ; } } | [
"public",
"void",
"function",
"(",
"int",
"code",
")",
"{",
"if",
"(",
"sLogger",
".",
"isActivated",
"(",
")",
")",
"{",
"sLogger",
".",
"debug",
"(",
"\"ReInvite has been rejected\"",
")",
";",
"}",
"synchronized",
"(",
"mWaitUserAnswer",
")",
"{",
"mReInviteStatus",
"=",
"InvitationStatus",
".",
"INVITATION_REJECTED",
";",
"mWaitUserAnswer",
".",
"notifyAll",
"(",
")",
";",
"}",
"}"
] | reject the session invitation
| train | false | rejectReInvite |
89 | public boolean function ( ) { return prune ; } | [
"public",
"boolean",
"function",
"(",
")",
"{",
"return",
"prune",
";",
"}"
] | returns the value of the prune attribute .
| train | false | isPrune |
90 | public void function ( String methodName , int count ) { Deque < InvocationHandler > handlers = getHandlers ( methodName ) ; for ( int i = 0 ; i < count ; i ++ ) { handlers . add ( delegateHandler ) ; } } | [
"public",
"void",
"function",
"(",
"String",
"methodName",
",",
"int",
"count",
")",
"{",
"Deque",
"<",
"InvocationHandler",
">",
"handlers",
"=",
"getHandlers",
"(",
"methodName",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"handlers",
".",
"add",
"(",
"delegateHandler",
")",
";",
"}",
"}"
] | enqueues the specified number of normal operations . useful to delay faults .
| train | false | enqueueNormal |
91 | @ function ( "unchecked" ) @ Override protected Object readPostProcess ( Object o ) throws Exception { Enumeration < Object > enm ; Vector < Vector < ? > > deserialized ; Object key ; deserialized = ( Vector < Vector < ? > > ) super . readPostProcess ( o ) ; rebuildBeanConnections ( deserialized , REGULAR_CONNECTION ) ; enm = m_BeanConnectionRelation . keys ( ) ; while ( enm . hasMoreElements ( ) ) { key = enm . nextElement ( ) ; if ( ! ( key instanceof MetaBean ) ) { continue ; } rebuildBeanConnections ( deserialized , key ) ; } if ( getDataType ( ) == DATATYPE_USERCOMPONENTS ) { removeUserToolBarBeans ( deserialized ) ; } return deserialized ; } | [
"@",
"function",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"protected",
"Object",
"readPostProcess",
"(",
"Object",
"o",
")",
"throws",
"Exception",
"{",
"Enumeration",
"<",
"Object",
">",
"enm",
";",
"Vector",
"<",
"Vector",
"<",
"?",
">",
">",
"deserialized",
";",
"Object",
"key",
";",
"deserialized",
"=",
"(",
"Vector",
"<",
"Vector",
"<",
"?",
">",
">",
")",
"super",
".",
"readPostProcess",
"(",
"o",
")",
";",
"rebuildBeanConnections",
"(",
"deserialized",
",",
"REGULAR_CONNECTION",
")",
";",
"enm",
"=",
"m_BeanConnectionRelation",
".",
"keys",
"(",
")",
";",
"while",
"(",
"enm",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"key",
"=",
"enm",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"!",
"(",
"key",
"instanceof",
"MetaBean",
")",
")",
"{",
"continue",
";",
"}",
"rebuildBeanConnections",
"(",
"deserialized",
",",
"key",
")",
";",
"}",
"if",
"(",
"getDataType",
"(",
")",
"==",
"DATATYPE_USERCOMPONENTS",
")",
"{",
"removeUserToolBarBeans",
"(",
"deserialized",
")",
";",
"}",
"return",
"deserialized",
";",
"}"
] | additional post - processing can happen in derived classes after reading from xml . re - builds the beanconnections .
| train | false | SuppressWarnings |
92 | public static boolean function ( IGame game , Entity ae , Targetable target ) { return canSee ( game , ae , target , true , null , null ) ; } | [
"public",
"static",
"boolean",
"function",
"(",
"IGame",
"game",
",",
"Entity",
"ae",
",",
"Targetable",
"target",
")",
"{",
"return",
"canSee",
"(",
"game",
",",
"ae",
",",
"target",
",",
"true",
",",
"null",
",",
"null",
")",
";",
"}"
] | checks to see if the target is visible to the unit , always considering sensors .
| train | false | canSee |
93 | @ Override void function ( StringBuilder xml , int level ) { indent ( xml , level ) ; xml . append ( "<string>" ) ; for ( int i = 0 ; i < bytes . length ; i ++ ) { byte b = bytes [ i ] ; if ( b < 16 ) xml . append ( '0' ) ; xml . append ( Integer . toHexString ( b ) ) ; } xml . append ( "</string>" ) ; } | [
"@",
"Override",
"void",
"function",
"(",
"StringBuilder",
"xml",
",",
"int",
"level",
")",
"{",
"indent",
"(",
"xml",
",",
"level",
")",
";",
"xml",
".",
"append",
"(",
"\"<string>\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bytes",
".",
"length",
";",
"i",
"++",
")",
"{",
"byte",
"b",
"=",
"bytes",
"[",
"i",
"]",
";",
"if",
"(",
"b",
"<",
"16",
")",
"xml",
".",
"append",
"(",
"'0'",
")",
";",
"xml",
".",
"append",
"(",
"Integer",
".",
"toHexString",
"(",
"b",
")",
")",
";",
"}",
"xml",
".",
"append",
"(",
"\"</string>\"",
")",
";",
"}"
] | there is no xml representation specified for uids . in this implementation uids are represented as strings in the xml output .
| train | false | toXML |
94 | public final int function ( char [ ] buf , int length , boolean isChop ) throws IOException { byte [ ] readBuffer = _readBuffer ; int offset = 0 ; while ( true ) { int readOffset = _readOffset ; int sublen = Math . min ( length , _readLength - readOffset ) ; for ( ; sublen > 0 ; sublen -- ) { int ch = readBuffer [ readOffset ++ ] & 0xff ; if ( ch != '\n' ) { } else if ( isChop ) { _readOffset = readOffset ; if ( offset > 0 && buf [ offset - 1 ] == '\r' ) return offset - 1 ; else return offset ; } else { buf [ offset ++ ] = ( char ) ch ; _readOffset = readOffset ; return offset + 1 ; } buf [ offset ++ ] = ( char ) ch ; } _readOffset = readOffset ; if ( readOffset <= _readLength ) { if ( ! readBuffer ( ) ) { return offset ; } } if ( length <= offset ) return length + 1 ; } } | [
"public",
"final",
"int",
"function",
"(",
"char",
"[",
"]",
"buf",
",",
"int",
"length",
",",
"boolean",
"isChop",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"readBuffer",
"=",
"_readBuffer",
";",
"int",
"offset",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"int",
"readOffset",
"=",
"_readOffset",
";",
"int",
"sublen",
"=",
"Math",
".",
"min",
"(",
"length",
",",
"_readLength",
"-",
"readOffset",
")",
";",
"for",
"(",
";",
"sublen",
">",
"0",
";",
"sublen",
"--",
")",
"{",
"int",
"ch",
"=",
"readBuffer",
"[",
"readOffset",
"++",
"]",
"&",
"0xff",
";",
"if",
"(",
"ch",
"!=",
"'\\n'",
")",
"{",
"}",
"else",
"if",
"(",
"isChop",
")",
"{",
"_readOffset",
"=",
"readOffset",
";",
"if",
"(",
"offset",
">",
"0",
"&&",
"buf",
"[",
"offset",
"-",
"1",
"]",
"==",
"'\\r'",
")",
"return",
"offset",
"-",
"1",
";",
"else",
"return",
"offset",
";",
"}",
"else",
"{",
"buf",
"[",
"offset",
"++",
"]",
"=",
"(",
"char",
")",
"ch",
";",
"_readOffset",
"=",
"readOffset",
";",
"return",
"offset",
"+",
"1",
";",
"}",
"buf",
"[",
"offset",
"++",
"]",
"=",
"(",
"char",
")",
"ch",
";",
"}",
"_readOffset",
"=",
"readOffset",
";",
"if",
"(",
"readOffset",
"<=",
"_readLength",
")",
"{",
"if",
"(",
"!",
"readBuffer",
"(",
")",
")",
"{",
"return",
"offset",
";",
"}",
"}",
"if",
"(",
"length",
"<=",
"offset",
")",
"return",
"length",
"+",
"1",
";",
"}",
"}"
] | reads a line into the character buffer . \ r \ n is converted to \ n .
| train | true | readLine |
95 | public static void function ( final CDebugPerspectiveModel model , final IAddress offset , final boolean focusMemoryWindow ) { model . setActiveMemoryAddress ( offset , focusMemoryWindow ) ; } | [
"public",
"static",
"void",
"function",
"(",
"final",
"CDebugPerspectiveModel",
"model",
",",
"final",
"IAddress",
"offset",
",",
"final",
"boolean",
"focusMemoryWindow",
")",
"{",
"model",
".",
"setActiveMemoryAddress",
"(",
"offset",
",",
"focusMemoryWindow",
")",
";",
"}"
] | sets the caret of a hex control to a given offset .
| train | false | gotoOffset |
96 | public List < AbstractCondition > function ( ) { List < AbstractCondition > list = new ArrayList < > ( ) ; for ( Node < AbstractCondition > node : toList ( ) ) { list . add ( node . getData ( ) ) ; } return list ; } | [
"public",
"List",
"<",
"AbstractCondition",
">",
"function",
"(",
")",
"{",
"List",
"<",
"AbstractCondition",
">",
"list",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"for",
"(",
"Node",
"<",
"AbstractCondition",
">",
"node",
":",
"toList",
"(",
")",
")",
"{",
"list",
".",
"add",
"(",
"node",
".",
"getData",
"(",
")",
")",
";",
"}",
"return",
"list",
";",
"}"
] | get all conditions as a plain list .
| train | false | toConditionsList |
97 | protected void function ( ) { try { if ( ! isIncremental ( ) ) { m_BatchBuffer = m_Loader . getDataSet ( ) ; } else { m_BatchBuffer = null ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } | [
"protected",
"void",
"function",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"isIncremental",
"(",
")",
")",
"{",
"m_BatchBuffer",
"=",
"m_Loader",
".",
"getDataSet",
"(",
")",
";",
"}",
"else",
"{",
"m_BatchBuffer",
"=",
"null",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | initializes the batch buffer if necessary , i . e . , for non - incremental loaders .
| train | false | initBatchBuffer |
98 | public BigdataSailRepositoryConnection function ( ) { return tlTx . get ( ) ; } | [
"public",
"BigdataSailRepositoryConnection",
"function",
"(",
")",
"{",
"return",
"tlTx",
".",
"get",
"(",
")",
";",
"}"
] | direct access to the unisolated connection . may return null if the connection has not been opened yet by this thread .
| train | false | cxn |
99 | public void function ( DataInputStream dis , DataOutputStream dosParam ) throws IOException , Exception { GZIPOutputStream gzip = new GZIPOutputStream ( new BufferedOutputStream ( dosParam ) ) ; DataOutputStream dos = new DataOutputStream ( gzip ) ; byte responseStatus = ResponseStatus . STATUS_ERROR ; try { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; String name = dis . readUTF ( ) ; String pw = dis . readUTF ( ) ; String serializer = dis . readUTF ( ) ; @ SuppressWarnings ( "unused" ) String locale = dis . readUTF ( ) ; byte action = dis . readByte ( ) ; Context . openSession ( ) ; try { Context . authenticate ( name , pw ) ; } catch ( ContextAuthenticationException ex ) { responseStatus = ResponseStatus . STATUS_ACCESS_DENIED ; } if ( responseStatus != ResponseStatus . STATUS_ACCESS_DENIED ) { DataOutputStream dosTemp = new DataOutputStream ( baos ) ; if ( action == ACTION_DOWNLOAD_PATIENTS ) downloadPatients ( String . valueOf ( dis . readInt ( ) ) , dosTemp , serializer , false ) ; else if ( action == ACTION_DOWNLOAD_SS_PATIENTS ) downloadPatients ( String . valueOf ( dis . readInt ( ) ) , dosTemp , serializer , true ) ; else if ( action == ACTION_DOWNLOAD_COHORTS ) PatientDownloadManager . downloadCohorts ( dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_SAVED_SEARCHES ) PatientDownloadManager . downloadSavesSearches ( dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_FORMS ) XformDownloadManager . downloadXforms ( dosTemp , serializer ) ; else if ( action == ACTION_UPLOAD_FORMS ) submitXforms ( dis , dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_USERS ) UserDownloadManager . downloadUsers ( dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_USERS_AND_FORMS ) downloadUsersAndForms ( dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_FILTERED_PATIENTS ) downloadPatients ( dis . readUTF ( ) , dis . readUTF ( ) , dosTemp , serializer ) ; responseStatus = ResponseStatus . STATUS_SUCCESS ; } dos . writeByte ( responseStatus ) ; if ( responseStatus == ResponseStatus . STATUS_SUCCESS ) dos . write ( baos . toByteArray ( ) ) ; dos . close ( ) ; gzip . finish ( ) ; } catch ( Exception ex ) { log . error ( ex . getMessage ( ) , ex ) ; try { dos . writeByte ( responseStatus ) ; dos . flush ( ) ; gzip . finish ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } finally { Context . closeSession ( ) ; } } | [
"public",
"void",
"function",
"(",
"DataInputStream",
"dis",
",",
"DataOutputStream",
"dosParam",
")",
"throws",
"IOException",
",",
"Exception",
"{",
"GZIPOutputStream",
"gzip",
"=",
"new",
"GZIPOutputStream",
"(",
"new",
"BufferedOutputStream",
"(",
"dosParam",
")",
")",
";",
"DataOutputStream",
"dos",
"=",
"new",
"DataOutputStream",
"(",
"gzip",
")",
";",
"byte",
"responseStatus",
"=",
"ResponseStatus",
".",
"STATUS_ERROR",
";",
"try",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"String",
"name",
"=",
"dis",
".",
"readUTF",
"(",
")",
";",
"String",
"pw",
"=",
"dis",
".",
"readUTF",
"(",
")",
";",
"String",
"serializer",
"=",
"dis",
".",
"readUTF",
"(",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"String",
"locale",
"=",
"dis",
".",
"readUTF",
"(",
")",
";",
"byte",
"action",
"=",
"dis",
".",
"readByte",
"(",
")",
";",
"Context",
".",
"openSession",
"(",
")",
";",
"try",
"{",
"Context",
".",
"authenticate",
"(",
"name",
",",
"pw",
")",
";",
"}",
"catch",
"(",
"ContextAuthenticationException",
"ex",
")",
"{",
"responseStatus",
"=",
"ResponseStatus",
".",
"STATUS_ACCESS_DENIED",
";",
"}",
"if",
"(",
"responseStatus",
"!=",
"ResponseStatus",
".",
"STATUS_ACCESS_DENIED",
")",
"{",
"DataOutputStream",
"dosTemp",
"=",
"new",
"DataOutputStream",
"(",
"baos",
")",
";",
"if",
"(",
"action",
"==",
"ACTION_DOWNLOAD_PATIENTS",
")",
"downloadPatients",
"(",
"String",
".",
"valueOf",
"(",
"dis",
".",
"readInt",
"(",
")",
")",
",",
"dosTemp",
",",
"serializer",
",",
"false",
")",
";",
"else",
"if",
"(",
"action",
"==",
"ACTION_DOWNLOAD_SS_PATIENTS",
")",
"downloadPatients",
"(",
"String",
".",
"valueOf",
"(",
"dis",
".",
"readInt",
"(",
")",
")",
",",
"dosTemp",
",",
"serializer",
",",
"true",
")",
";",
"else",
"if",
"(",
"action",
"==",
"ACTION_DOWNLOAD_COHORTS",
")",
"PatientDownloadManager",
".",
"downloadCohorts",
"(",
"dosTemp",
",",
"serializer",
")",
";",
"else",
"if",
"(",
"action",
"==",
"ACTION_DOWNLOAD_SAVED_SEARCHES",
")",
"PatientDownloadManager",
".",
"downloadSavesSearches",
"(",
"dosTemp",
",",
"serializer",
")",
";",
"else",
"if",
"(",
"action",
"==",
"ACTION_DOWNLOAD_FORMS",
")",
"XformDownloadManager",
".",
"downloadXforms",
"(",
"dosTemp",
",",
"serializer",
")",
";",
"else",
"if",
"(",
"action",
"==",
"ACTION_UPLOAD_FORMS",
")",
"submitXforms",
"(",
"dis",
",",
"dosTemp",
",",
"serializer",
")",
";",
"else",
"if",
"(",
"action",
"==",
"ACTION_DOWNLOAD_USERS",
")",
"UserDownloadManager",
".",
"downloadUsers",
"(",
"dosTemp",
",",
"serializer",
")",
";",
"else",
"if",
"(",
"action",
"==",
"ACTION_DOWNLOAD_USERS_AND_FORMS",
")",
"downloadUsersAndForms",
"(",
"dosTemp",
",",
"serializer",
")",
";",
"else",
"if",
"(",
"action",
"==",
"ACTION_DOWNLOAD_FILTERED_PATIENTS",
")",
"downloadPatients",
"(",
"dis",
".",
"readUTF",
"(",
")",
",",
"dis",
".",
"readUTF",
"(",
")",
",",
"dosTemp",
",",
"serializer",
")",
";",
"responseStatus",
"=",
"ResponseStatus",
".",
"STATUS_SUCCESS",
";",
"}",
"dos",
".",
"writeByte",
"(",
"responseStatus",
")",
";",
"if",
"(",
"responseStatus",
"==",
"ResponseStatus",
".",
"STATUS_SUCCESS",
")",
"dos",
".",
"write",
"(",
"baos",
".",
"toByteArray",
"(",
")",
")",
";",
"dos",
".",
"close",
"(",
")",
";",
"gzip",
".",
"finish",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"log",
".",
"error",
"(",
"ex",
".",
"getMessage",
"(",
")",
",",
"ex",
")",
";",
"try",
"{",
"dos",
".",
"writeByte",
"(",
"responseStatus",
")",
";",
"dos",
".",
"flush",
"(",
")",
";",
"gzip",
".",
"finish",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"Context",
".",
"closeSession",
"(",
")",
";",
"}",
"}"
] | called when a new connection has been received . failures are not handled in this class as different servers ( bt , sms , etc ) may want to handle them differently .
| train | false | processConnection |
100 | public static int function ( Object o ) { return o == null ? 0 : o . hashCode ( ) ; } | [
"public",
"static",
"int",
"function",
"(",
"Object",
"o",
")",
"{",
"return",
"o",
"==",
"null",
"?",
"0",
":",
"o",
".",
"hashCode",
"(",
")",
";",
"}"
] | null - safe hash code method for objects . returns the object hash code if it is not null , and 0 otherwise .
| train | false | hashObject |
101 | boolean function ( ) { return false ; } | [
"boolean",
"function",
"(",
")",
"{",
"return",
"false",
";",
"}"
] | return whether we need to check namespace prefixes against and exclude result prefixes list .
| train | false | needToCheckExclude |
103 | public function ( final StendhalRPZone zone , int x , int y , int width , int height ) { this . zone = zone ; final Rectangle2D myshape = new Rectangle2D . Double ( ) ; myshape . setRect ( x , y , width , height ) ; this . shape = myshape ; } | [
"public",
"function",
"(",
"final",
"StendhalRPZone",
"zone",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"this",
".",
"zone",
"=",
"zone",
";",
"final",
"Rectangle2D",
"myshape",
"=",
"new",
"Rectangle2D",
".",
"Double",
"(",
")",
";",
"myshape",
".",
"setRect",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
";",
"this",
".",
"shape",
"=",
"myshape",
";",
"}"
] | creates a new area .
| train | false | Area |
104 | private byte function ( ) throws IOException { if ( hasPushbackTC ) { hasPushbackTC = false ; } else { pushbackTC = input . readByte ( ) ; } return pushbackTC ; } | [
"private",
"byte",
"function",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"hasPushbackTC",
")",
"{",
"hasPushbackTC",
"=",
"false",
";",
"}",
"else",
"{",
"pushbackTC",
"=",
"input",
".",
"readByte",
"(",
")",
";",
"}",
"return",
"pushbackTC",
";",
"}"
] | return the next token code ( tc ) from the receiver , which indicates what kind of object follows
| train | false | nextTC |
105 | private void function ( ) { print ( "\n" ) ; } | [
"private",
"void",
"function",
"(",
")",
"{",
"print",
"(",
"\"\\n\"",
")",
";",
"}"
] | put the line separator string onto the print stream .
| train | false | newline |
106 | public int function ( ) { return seq . size ( ) ; } | [
"public",
"int",
"function",
"(",
")",
"{",
"return",
"seq",
".",
"size",
"(",
")",
";",
"}"
] | return the number of objects in this sequence .
| train | false | size |
107 | public static String function ( String pass , String algorithm ) throws NoSuchAlgorithmException { MessageDigest md ; ByteArrayOutputStream bos ; try { md = MessageDigest . getInstance ( algorithm ) ; byte [ ] digest = md . digest ( pass . getBytes ( "iso-8859-1" ) ) ; bos = new ByteArrayOutputStream ( ) ; OutputStream encodedStream = MimeUtility . encode ( bos , "base64" ) ; encodedStream . write ( digest ) ; return bos . toString ( "iso-8859-1" ) ; } catch ( IOException ioe ) { throw new RuntimeException ( "Fatal error: " + ioe ) ; } catch ( MessagingException me ) { throw new RuntimeException ( "Fatal error: " + me ) ; } } | [
"public",
"static",
"String",
"function",
"(",
"String",
"pass",
",",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"MessageDigest",
"md",
";",
"ByteArrayOutputStream",
"bos",
";",
"try",
"{",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"algorithm",
")",
";",
"byte",
"[",
"]",
"digest",
"=",
"md",
".",
"digest",
"(",
"pass",
".",
"getBytes",
"(",
"\"iso-8859-1\"",
")",
")",
";",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"OutputStream",
"encodedStream",
"=",
"MimeUtility",
".",
"encode",
"(",
"bos",
",",
"\"base64\"",
")",
";",
"encodedStream",
".",
"write",
"(",
"digest",
")",
";",
"return",
"bos",
".",
"toString",
"(",
"\"iso-8859-1\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Fatal error: \"",
"+",
"ioe",
")",
";",
"}",
"catch",
"(",
"MessagingException",
"me",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Fatal error: \"",
"+",
"me",
")",
";",
"}",
"}"
] | calculate digest of given string using given algorithm . encode digest in mime - like base64 .
| train | false | digestString |
108 | void function ( long lobId , int seq , long pos , byte [ ] b , String compressAlgorithm ) throws SQLException { long block ; boolean blockExists = false ; if ( compressAlgorithm != null ) { b = compress . compress ( b , compressAlgorithm ) ; } int hash = Arrays . hashCode ( b ) ; assertHoldsLock ( conn . getSession ( ) ) ; assertHoldsLock ( database ) ; block = getHashCacheBlock ( hash ) ; if ( block != - 1 ) { String sql = "SELECT COMPRESSED, DATA FROM " + LOB_DATA + " WHERE BLOCK = ?" ; PreparedStatement prep = prepare ( sql ) ; prep . setLong ( 1 , block ) ; ResultSet rs = prep . executeQuery ( ) ; if ( rs . next ( ) ) { boolean compressed = rs . getInt ( 1 ) != 0 ; byte [ ] compare = rs . getBytes ( 2 ) ; if ( compressed == ( compressAlgorithm != null ) && Arrays . equals ( b , compare ) ) { blockExists = true ; } } reuse ( sql , prep ) ; } if ( ! blockExists ) { block = nextBlock ++ ; setHashCacheBlock ( hash , block ) ; String sql = "INSERT INTO " + LOB_DATA + "(BLOCK, COMPRESSED, DATA) VALUES(?, ?, ?)" ; PreparedStatement prep = prepare ( sql ) ; prep . setLong ( 1 , block ) ; prep . setInt ( 2 , compressAlgorithm == null ? 0 : 1 ) ; prep . setBytes ( 3 , b ) ; prep . execute ( ) ; reuse ( sql , prep ) ; } String sql = "INSERT INTO " + LOB_MAP + "(LOB, SEQ, POS, HASH, BLOCK) VALUES(?, ?, ?, ?, ?)" ; PreparedStatement prep = prepare ( sql ) ; prep . setLong ( 1 , lobId ) ; prep . setInt ( 2 , seq ) ; prep . setLong ( 3 , pos ) ; prep . setLong ( 4 , hash ) ; prep . setLong ( 5 , block ) ; prep . execute ( ) ; reuse ( sql , prep ) ; } | [
"void",
"function",
"(",
"long",
"lobId",
",",
"int",
"seq",
",",
"long",
"pos",
",",
"byte",
"[",
"]",
"b",
",",
"String",
"compressAlgorithm",
")",
"throws",
"SQLException",
"{",
"long",
"block",
";",
"boolean",
"blockExists",
"=",
"false",
";",
"if",
"(",
"compressAlgorithm",
"!=",
"null",
")",
"{",
"b",
"=",
"compress",
".",
"compress",
"(",
"b",
",",
"compressAlgorithm",
")",
";",
"}",
"int",
"hash",
"=",
"Arrays",
".",
"hashCode",
"(",
"b",
")",
";",
"assertHoldsLock",
"(",
"conn",
".",
"getSession",
"(",
")",
")",
";",
"assertHoldsLock",
"(",
"database",
")",
";",
"block",
"=",
"getHashCacheBlock",
"(",
"hash",
")",
";",
"if",
"(",
"block",
"!=",
"-",
"1",
")",
"{",
"String",
"sql",
"=",
"\"SELECT COMPRESSED, DATA FROM \"",
"+",
"LOB_DATA",
"+",
"\" WHERE BLOCK = ?\"",
";",
"PreparedStatement",
"prep",
"=",
"prepare",
"(",
"sql",
")",
";",
"prep",
".",
"setLong",
"(",
"1",
",",
"block",
")",
";",
"ResultSet",
"rs",
"=",
"prep",
".",
"executeQuery",
"(",
")",
";",
"if",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"boolean",
"compressed",
"=",
"rs",
".",
"getInt",
"(",
"1",
")",
"!=",
"0",
";",
"byte",
"[",
"]",
"compare",
"=",
"rs",
".",
"getBytes",
"(",
"2",
")",
";",
"if",
"(",
"compressed",
"==",
"(",
"compressAlgorithm",
"!=",
"null",
")",
"&&",
"Arrays",
".",
"equals",
"(",
"b",
",",
"compare",
")",
")",
"{",
"blockExists",
"=",
"true",
";",
"}",
"}",
"reuse",
"(",
"sql",
",",
"prep",
")",
";",
"}",
"if",
"(",
"!",
"blockExists",
")",
"{",
"block",
"=",
"nextBlock",
"++",
";",
"setHashCacheBlock",
"(",
"hash",
",",
"block",
")",
";",
"String",
"sql",
"=",
"\"INSERT INTO \"",
"+",
"LOB_DATA",
"+",
"\"(BLOCK, COMPRESSED, DATA) VALUES(?, ?, ?)\"",
";",
"PreparedStatement",
"prep",
"=",
"prepare",
"(",
"sql",
")",
";",
"prep",
".",
"setLong",
"(",
"1",
",",
"block",
")",
";",
"prep",
".",
"setInt",
"(",
"2",
",",
"compressAlgorithm",
"==",
"null",
"?",
"0",
":",
"1",
")",
";",
"prep",
".",
"setBytes",
"(",
"3",
",",
"b",
")",
";",
"prep",
".",
"execute",
"(",
")",
";",
"reuse",
"(",
"sql",
",",
"prep",
")",
";",
"}",
"String",
"sql",
"=",
"\"INSERT INTO \"",
"+",
"LOB_MAP",
"+",
"\"(LOB, SEQ, POS, HASH, BLOCK) VALUES(?, ?, ?, ?, ?)\"",
";",
"PreparedStatement",
"prep",
"=",
"prepare",
"(",
"sql",
")",
";",
"prep",
".",
"setLong",
"(",
"1",
",",
"lobId",
")",
";",
"prep",
".",
"setInt",
"(",
"2",
",",
"seq",
")",
";",
"prep",
".",
"setLong",
"(",
"3",
",",
"pos",
")",
";",
"prep",
".",
"setLong",
"(",
"4",
",",
"hash",
")",
";",
"prep",
".",
"setLong",
"(",
"5",
",",
"block",
")",
";",
"prep",
".",
"execute",
"(",
")",
";",
"reuse",
"(",
"sql",
",",
"prep",
")",
";",
"}"
] | store a block in the lob storage .
| train | false | storeBlock |
109 | public static boolean function ( String path ) { File f = new File ( path ) ; return f . isDirectory ( ) ; } | [
"public",
"static",
"boolean",
"function",
"(",
"String",
"path",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"path",
")",
";",
"return",
"f",
".",
"isDirectory",
"(",
")",
";",
"}"
] | checks if the given path is a directory
| train | false | isDirectory |
111 | static void function ( final RPObject object ) { final RPObject kills = KeyedSlotUtil . getKeyedSlotObject ( object , "!kills" ) ; if ( kills != null ) { final RPObject newKills = new RPObject ( ) ; for ( final String attr : kills ) { if ( ! attr . equals ( "id" ) ) { String newAttr = attr ; String value = kills . get ( attr ) ; if ( attr . indexOf ( '.' ) < 0 ) { newAttr = updateItemName ( newAttr ) ; newAttr = value + "." + newAttr ; value = "1" ; } newKills . put ( newAttr , value ) ; } } final RPSlot slot = object . getSlot ( "!kills" ) ; slot . remove ( kills . getID ( ) ) ; slot . add ( newKills ) ; } } | [
"static",
"void",
"function",
"(",
"final",
"RPObject",
"object",
")",
"{",
"final",
"RPObject",
"kills",
"=",
"KeyedSlotUtil",
".",
"getKeyedSlotObject",
"(",
"object",
",",
"\"!kills\"",
")",
";",
"if",
"(",
"kills",
"!=",
"null",
")",
"{",
"final",
"RPObject",
"newKills",
"=",
"new",
"RPObject",
"(",
")",
";",
"for",
"(",
"final",
"String",
"attr",
":",
"kills",
")",
"{",
"if",
"(",
"!",
"attr",
".",
"equals",
"(",
"\"id\"",
")",
")",
"{",
"String",
"newAttr",
"=",
"attr",
";",
"String",
"value",
"=",
"kills",
".",
"get",
"(",
"attr",
")",
";",
"if",
"(",
"attr",
".",
"indexOf",
"(",
"'.'",
")",
"<",
"0",
")",
"{",
"newAttr",
"=",
"updateItemName",
"(",
"newAttr",
")",
";",
"newAttr",
"=",
"value",
"+",
"\".\"",
"+",
"newAttr",
";",
"value",
"=",
"\"1\"",
";",
"}",
"newKills",
".",
"put",
"(",
"newAttr",
",",
"value",
")",
";",
"}",
"}",
"final",
"RPSlot",
"slot",
"=",
"object",
".",
"getSlot",
"(",
"\"!kills\"",
")",
";",
"slot",
".",
"remove",
"(",
"kills",
".",
"getID",
"(",
")",
")",
";",
"slot",
".",
"add",
"(",
"newKills",
")",
";",
"}",
"}"
] | transform kill slot content to the new kill recording system .
| train | false | transformKillSlot |
112 | public static CharSequence function ( CharSequence source ) { if ( source == null ) return "" ; int i = source . length ( ) ; while ( -- i >= 0 && Character . isWhitespace ( source . charAt ( i ) ) ) { } return source . subSequence ( 0 , i + 1 ) ; } | [
"public",
"static",
"CharSequence",
"function",
"(",
"CharSequence",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"return",
"\"\"",
";",
"int",
"i",
"=",
"source",
".",
"length",
"(",
")",
";",
"while",
"(",
"--",
"i",
">=",
"0",
"&&",
"Character",
".",
"isWhitespace",
"(",
"source",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"}",
"return",
"source",
".",
"subSequence",
"(",
"0",
",",
"i",
"+",
"1",
")",
";",
"}"
] | trims trailing whitespace . removes any of these characters : 0009 , horizontal tabulation 000a , line feed 000b , vertical tabulation 000c , form feed 000d , carriage return 001c , file separator 001d , group separator 001e , record separator 001f , unit separator
| train | false | trimTrailingWhitespace |
113 | private static void function ( Vector inputVec , String fileName ) throws StringVectorToFileException { try { BufferedWriter fileW = new BufferedWriter ( new FileWriter ( fileName ) ) ; int lineNum = 0 ; while ( lineNum < inputVec . size ( ) ) { fileW . write ( ( String ) inputVec . elementAt ( lineNum ) ) ; fileW . newLine ( ) ; lineNum = lineNum + 1 ; } ; fileW . close ( ) ; } catch ( Exception e ) { throw new StringVectorToFileException ( "Could not write file " + fileName ) ; } ; } | [
"private",
"static",
"void",
"function",
"(",
"Vector",
"inputVec",
",",
"String",
"fileName",
")",
"throws",
"StringVectorToFileException",
"{",
"try",
"{",
"BufferedWriter",
"fileW",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"fileName",
")",
")",
";",
"int",
"lineNum",
"=",
"0",
";",
"while",
"(",
"lineNum",
"<",
"inputVec",
".",
"size",
"(",
")",
")",
"{",
"fileW",
".",
"write",
"(",
"(",
"String",
")",
"inputVec",
".",
"elementAt",
"(",
"lineNum",
")",
")",
";",
"fileW",
".",
"newLine",
"(",
")",
";",
"lineNum",
"=",
"lineNum",
"+",
"1",
";",
"}",
";",
"fileW",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"StringVectorToFileException",
"(",
"\"Could not write file \"",
"+",
"fileName",
")",
";",
"}",
";",
"}"
] | methods for reading and writing files
| train | false | WriteStringVectorToFile |
114 | public boolean function ( String userDefinedValue ) throws IllegalArgumentException { try { return value . before ( getDate ( userDefinedValue ) ) ; } catch ( DataTypeValidationException e ) { throw new IllegalArgumentException ( e . getMessage ( ) ) ; } } | [
"public",
"boolean",
"function",
"(",
"String",
"userDefinedValue",
")",
"throws",
"IllegalArgumentException",
"{",
"try",
"{",
"return",
"value",
".",
"before",
"(",
"getDate",
"(",
"userDefinedValue",
")",
")",
";",
"}",
"catch",
"(",
"DataTypeValidationException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | indicates whether or not provided value is before .
| train | false | before |
115 | public void function ( ) { if ( null != inputStreamReader ) { CarbonUtil . closeStreams ( inputStreamReader ) ; } } | [
"public",
"void",
"function",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"inputStreamReader",
")",
"{",
"CarbonUtil",
".",
"closeStreams",
"(",
"inputStreamReader",
")",
";",
"}",
"}"
] | below method will be used to clear all the stream
| train | false | close |
116 | public static double function ( Object left , Object right ) throws PageException { return StrictMath . pow ( Caster . toDoubleValue ( left ) , Caster . toDoubleValue ( right ) ) ; } | [
"public",
"static",
"double",
"function",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"throws",
"PageException",
"{",
"return",
"StrictMath",
".",
"pow",
"(",
"Caster",
".",
"toDoubleValue",
"(",
"left",
")",
",",
"Caster",
".",
"toDoubleValue",
"(",
"right",
")",
")",
";",
"}"
] | calculate the exponent of the left value
| train | true | exponent |
117 | public synchronized void function ( ActionListener actionListener ) { if ( actionListeners == null ) actionListeners = new ArrayList < ActionListener > ( ) ; actionListeners . add ( actionListener ) ; if ( fired ) { actionListener . actionPerformed ( new ActionEvent ( this , ActionEvent . ACTION_PERFORMED , "" ) ) ; } } | [
"public",
"synchronized",
"void",
"function",
"(",
"ActionListener",
"actionListener",
")",
"{",
"if",
"(",
"actionListeners",
"==",
"null",
")",
"actionListeners",
"=",
"new",
"ArrayList",
"<",
"ActionListener",
">",
"(",
")",
";",
"actionListeners",
".",
"add",
"(",
"actionListener",
")",
";",
"if",
"(",
"fired",
")",
"{",
"actionListener",
".",
"actionPerformed",
"(",
"new",
"ActionEvent",
"(",
"this",
",",
"ActionEvent",
".",
"ACTION_PERFORMED",
",",
"\"\"",
")",
")",
";",
"}",
"}"
] | adds a listener that will be notified upon completion of all of the running threads . its actionperformed method will be called immediately if the threads already finished .
| train | false | addActionListener |
118 | public String function ( ) throws DataFileException { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; writeDataFile ( bos ) ; String outString = bos . toString ( ) ; try { if ( bos != null ) bos . close ( ) ; } catch ( IOException e ) { Debug . logWarning ( e , module ) ; } return outString ; } | [
"public",
"String",
"function",
"(",
")",
"throws",
"DataFileException",
"{",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"writeDataFile",
"(",
"bos",
")",
";",
"String",
"outString",
"=",
"bos",
".",
"toString",
"(",
")",
";",
"try",
"{",
"if",
"(",
"bos",
"!=",
"null",
")",
"bos",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Debug",
".",
"logWarning",
"(",
"e",
",",
"module",
")",
";",
"}",
"return",
"outString",
";",
"}"
] | returns the records in this datafile object as a plain text data file content
| train | false | writeDataFile |
119 | public static Color function ( final INaviInstruction startInstruction , final String trackedRegister , final CInstructionResult result ) { Preconditions . checkNotNull ( startInstruction , "IE01671: Start instruction argument can not be null" ) ; Preconditions . checkNotNull ( trackedRegister , "IE01672: Tracked register argument can not be null" ) ; Preconditions . checkNotNull ( result , "IE01673: Result argument can not be null" ) ; if ( result . getInstruction ( ) == startInstruction ) { return Color . decode ( "0x00BF00" ) ; } else if ( result . undefinesAll ( ) ) { return Color . decode ( "0xB30000" ) ; } else if ( result . clearsTrackedRegister ( trackedRegister ) ) { return Color . decode ( "0xA12967" ) ; } else if ( result . undefinesSome ( ) ) { return Color . decode ( "0xED693F" ) ; } else if ( result . defines ( ) ) { return Color . decode ( "0xFFCD55" ) ; } else if ( result . updates ( ) ) { return Color . decode ( "0x5AAB47" ) ; } else if ( result . uses ( ) ) { return Color . decode ( "0x414142" ) ; } else { return Color . WHITE ; } } | [
"public",
"static",
"Color",
"function",
"(",
"final",
"INaviInstruction",
"startInstruction",
",",
"final",
"String",
"trackedRegister",
",",
"final",
"CInstructionResult",
"result",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"startInstruction",
",",
"\"IE01671: Start instruction argument can not be null\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"trackedRegister",
",",
"\"IE01672: Tracked register argument can not be null\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"result",
",",
"\"IE01673: Result argument can not be null\"",
")",
";",
"if",
"(",
"result",
".",
"getInstruction",
"(",
")",
"==",
"startInstruction",
")",
"{",
"return",
"Color",
".",
"decode",
"(",
"\"0x00BF00\"",
")",
";",
"}",
"else",
"if",
"(",
"result",
".",
"undefinesAll",
"(",
")",
")",
"{",
"return",
"Color",
".",
"decode",
"(",
"\"0xB30000\"",
")",
";",
"}",
"else",
"if",
"(",
"result",
".",
"clearsTrackedRegister",
"(",
"trackedRegister",
")",
")",
"{",
"return",
"Color",
".",
"decode",
"(",
"\"0xA12967\"",
")",
";",
"}",
"else",
"if",
"(",
"result",
".",
"undefinesSome",
"(",
")",
")",
"{",
"return",
"Color",
".",
"decode",
"(",
"\"0xED693F\"",
")",
";",
"}",
"else",
"if",
"(",
"result",
".",
"defines",
"(",
")",
")",
"{",
"return",
"Color",
".",
"decode",
"(",
"\"0xFFCD55\"",
")",
";",
"}",
"else",
"if",
"(",
"result",
".",
"updates",
"(",
")",
")",
"{",
"return",
"Color",
".",
"decode",
"(",
"\"0x5AAB47\"",
")",
";",
"}",
"else",
"if",
"(",
"result",
".",
"uses",
"(",
")",
")",
"{",
"return",
"Color",
".",
"decode",
"(",
"\"0x414142\"",
")",
";",
"}",
"else",
"{",
"return",
"Color",
".",
"WHITE",
";",
"}",
"}"
] | determines the background color to be used in the table and in the graph to highlight a given instruction result .
| train | false | determineBackgroundColor |
120 | public void function ( OnCentralPositionChangedListener listener ) { mOnCentralPositionChangedListeners . remove ( listener ) ; } | [
"public",
"void",
"function",
"(",
"OnCentralPositionChangedListener",
"listener",
")",
"{",
"mOnCentralPositionChangedListeners",
".",
"remove",
"(",
"listener",
")",
";",
"}"
] | removes a listener that would be called when the central item of the list changes .
| train | false | removeOnCentralPositionChangedListener |
121 | public void function ( ) { int old = _pickupRS ; _pickupRS ++ ; setDirtyAndFirePropertyChange ( "locationAddPickupRS" , Integer . toString ( old ) , Integer . toString ( _pickupRS ) ) ; } | [
"public",
"void",
"function",
"(",
")",
"{",
"int",
"old",
"=",
"_pickupRS",
";",
"_pickupRS",
"++",
";",
"setDirtyAndFirePropertyChange",
"(",
"\"locationAddPickupRS\"",
",",
"Integer",
".",
"toString",
"(",
"old",
")",
",",
"Integer",
".",
"toString",
"(",
"_pickupRS",
")",
")",
";",
"}"
] | increments the number of cars and or engines that will be picked up by a train at this location .
| train | false | addPickupRS |
123 | public double function ( ) { return Double . longBitsToDouble ( ints2long ( high , low ) ) ; } | [
"public",
"double",
"function",
"(",
")",
"{",
"return",
"Double",
".",
"longBitsToDouble",
"(",
"ints2long",
"(",
"high",
",",
"low",
")",
")",
";",
"}"
] | converts the internal representation ( two ints ) to a double .
| train | false | convert |
125 | public void function ( ) { File directory = new File ( getArchiveDirectory ( ) ) ; if ( directory . exists ( ) && directory . isDirectory ( ) ) { String [ ] listing = directory . list ( ) ; for ( String aListing : listing ) { File file = new File ( getArchiveDirectory ( ) , aListing ) ; file . delete ( ) ; } } if ( ! directory . exists ( ) ) { directory . mkdirs ( ) ; } } | [
"public",
"void",
"function",
"(",
")",
"{",
"File",
"directory",
"=",
"new",
"File",
"(",
"getArchiveDirectory",
"(",
")",
")",
";",
"if",
"(",
"directory",
".",
"exists",
"(",
")",
"&&",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"String",
"[",
"]",
"listing",
"=",
"directory",
".",
"list",
"(",
")",
";",
"for",
"(",
"String",
"aListing",
":",
"listing",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"getArchiveDirectory",
"(",
")",
",",
"aListing",
")",
";",
"file",
".",
"delete",
"(",
")",
";",
"}",
"}",
"if",
"(",
"!",
"directory",
".",
"exists",
"(",
")",
")",
"{",
"directory",
".",
"mkdirs",
"(",
")",
";",
"}",
"}"
] | clears the archive directory .
| train | false | clearArchiveDirectory |
End of preview. Expand
in Dataset Viewer.
- Downloads last month
- 1