signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SarlPackageImpl { /** * Creates the meta - model objects for the package . This method is * guarded to have no affect on any invocation but its first . * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void createPackageContents ( ) { } }
if ( isCreated ) return ; isCreated = true ; // Create classes and their features sarlScriptEClass = createEClass ( SARL_SCRIPT ) ; sarlFieldEClass = createEClass ( SARL_FIELD ) ; sarlBreakExpressionEClass = createEClass ( SARL_BREAK_EXPRESSION ) ; sarlContinueExpressionEClass = createEClass ( SARL_CONTINUE_EXPRESSION ) ; sarlAssertExpressionEClass = createEClass ( SARL_ASSERT_EXPRESSION ) ; createEReference ( sarlAssertExpressionEClass , SARL_ASSERT_EXPRESSION__CONDITION ) ; createEAttribute ( sarlAssertExpressionEClass , SARL_ASSERT_EXPRESSION__MESSAGE ) ; createEAttribute ( sarlAssertExpressionEClass , SARL_ASSERT_EXPRESSION__IS_STATIC ) ; sarlActionEClass = createEClass ( SARL_ACTION ) ; createEReference ( sarlActionEClass , SARL_ACTION__FIRED_EVENTS ) ; sarlConstructorEClass = createEClass ( SARL_CONSTRUCTOR ) ; sarlBehaviorUnitEClass = createEClass ( SARL_BEHAVIOR_UNIT ) ; createEReference ( sarlBehaviorUnitEClass , SARL_BEHAVIOR_UNIT__NAME ) ; createEReference ( sarlBehaviorUnitEClass , SARL_BEHAVIOR_UNIT__GUARD ) ; createEReference ( sarlBehaviorUnitEClass , SARL_BEHAVIOR_UNIT__EXPRESSION ) ; sarlCapacityUsesEClass = createEClass ( SARL_CAPACITY_USES ) ; createEReference ( sarlCapacityUsesEClass , SARL_CAPACITY_USES__CAPACITIES ) ; sarlRequiredCapacityEClass = createEClass ( SARL_REQUIRED_CAPACITY ) ; createEReference ( sarlRequiredCapacityEClass , SARL_REQUIRED_CAPACITY__CAPACITIES ) ; sarlClassEClass = createEClass ( SARL_CLASS ) ; sarlInterfaceEClass = createEClass ( SARL_INTERFACE ) ; sarlEnumerationEClass = createEClass ( SARL_ENUMERATION ) ; sarlAnnotationTypeEClass = createEClass ( SARL_ANNOTATION_TYPE ) ; sarlEnumLiteralEClass = createEClass ( SARL_ENUM_LITERAL ) ; sarlEventEClass = createEClass ( SARL_EVENT ) ; createEReference ( sarlEventEClass , SARL_EVENT__EXTENDS ) ; sarlCastedExpressionEClass = createEClass ( SARL_CASTED_EXPRESSION ) ; createEReference ( sarlCastedExpressionEClass , SARL_CASTED_EXPRESSION__FEATURE ) ; createEReference ( sarlCastedExpressionEClass , SARL_CASTED_EXPRESSION__RECEIVER ) ; createEReference ( sarlCastedExpressionEClass , SARL_CASTED_EXPRESSION__ARGUMENT ) ; sarlSpaceEClass = createEClass ( SARL_SPACE ) ; createEReference ( sarlSpaceEClass , SARL_SPACE__EXTENDS ) ; sarlArtifactEClass = createEClass ( SARL_ARTIFACT ) ; createEReference ( sarlArtifactEClass , SARL_ARTIFACT__EXTENDS ) ; sarlAgentEClass = createEClass ( SARL_AGENT ) ; createEReference ( sarlAgentEClass , SARL_AGENT__EXTENDS ) ; sarlCapacityEClass = createEClass ( SARL_CAPACITY ) ; createEReference ( sarlCapacityEClass , SARL_CAPACITY__EXTENDS ) ; sarlBehaviorEClass = createEClass ( SARL_BEHAVIOR ) ; createEReference ( sarlBehaviorEClass , SARL_BEHAVIOR__EXTENDS ) ; sarlSkillEClass = createEClass ( SARL_SKILL ) ; createEReference ( sarlSkillEClass , SARL_SKILL__EXTENDS ) ; createEReference ( sarlSkillEClass , SARL_SKILL__IMPLEMENTS ) ; sarlFormalParameterEClass = createEClass ( SARL_FORMAL_PARAMETER ) ; createEReference ( sarlFormalParameterEClass , SARL_FORMAL_PARAMETER__DEFAULT_VALUE ) ;
public class NodeTypeImpl { /** * Check value constrains . * @ param requiredType int * @ param constraints - string constrains . * @ param value - value to check . * @ return result of check . */ private boolean checkValueConstraints ( int requiredType , String [ ] constraints , Value value ) { } }
ValueConstraintsMatcher constrMatcher = new ValueConstraintsMatcher ( constraints , locationFactory , dataManager , nodeTypeDataManager ) ; try { return constrMatcher . match ( ( ( BaseValue ) value ) . getInternalData ( ) , requiredType ) ; } catch ( RepositoryException e1 ) { return false ; }
public class LevenshteinEditDistance { /** * Returns a normalized edit distance between 0 and 1 . This is useful if you are comparing or * aggregating distances of different pairs of strings */ public static double getNormalizedEditDistance ( String source , String target , boolean caseSensitive ) { } }
if ( isEmptyOrWhitespace ( source ) && isEmptyOrWhitespace ( target ) ) { return 0.0 ; } return ( double ) getEditDistance ( source , target , caseSensitive ) / ( double ) getWorstCaseEditDistance ( source . length ( ) , target . length ( ) ) ;
public class FilteringBeanMap { /** * { @ inheritDoc } */ @ Override protected String transformPropertyName ( final String name ) { } }
if ( pathProperties != null ) { Set < String > props = pathProperties . getProperties ( null ) ; if ( ! props . contains ( "*" ) && ! props . contains ( name ) ) { return null ; } } return super . transformPropertyName ( name ) ;
public class InlineFunctions { /** * Checks if the given function matches the criteria for an inlinable function . */ private boolean isCandidateFunction ( Function fn ) { } }
// Don ' t inline exported functions . String fnName = fn . getName ( ) ; if ( compiler . getCodingConvention ( ) . isExported ( fnName ) ) { // TODO ( johnlenz ) : Should we allow internal references to be inlined ? // An exported name can be replaced externally , any inlined instance // would not reflect this change . // To allow inlining we need to be able to distinguish between exports // that are used in a read - only fashion and those that can be replaced // by external definitions . return false ; } // Don ' t inline this special function if ( compiler . getCodingConvention ( ) . isPropertyRenameFunction ( fnName ) ) { return false ; } Node fnNode = fn . getFunctionNode ( ) ; return injector . doesFunctionMeetMinimumRequirements ( fnName , fnNode ) ;
public class NetworkServiceRecordAgent { /** * Updates a VNFR of a defined VNFD in a running NSR . * @ param idNsr the ID of the NetworkServiceRecord * @ param idVnfr the ID of the VNFR to be upgraded * @ throws SDKException if the request fails */ @ Help ( help = "Updates a VNFR to a defined VNFD in a running NSR with specific id" ) public void updateVnfr ( final String idNsr , final String idVnfr ) throws SDKException { } }
String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/update" ; requestPost ( url ) ;
public class BinarySearch { /** * Search for the value in the sorted long array and return the index . * @ param longArray array that we are searching in . * @ param value value that is being searched in the array . * @ return the index where the value is found in the array , else - 1. */ public static int search ( long [ ] longArray , long value ) { } }
int start = 0 ; int end = longArray . length - 1 ; int middle = 0 ; while ( start <= end ) { middle = ( start + end ) >> 1 ; if ( value == longArray [ middle ] ) { return middle ; } if ( value < longArray [ middle ] ) { end = middle - 1 ; } else { start = middle + 1 ; } } return - 1 ;
public class ObjectAttributeActionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ObjectAttributeAction objectAttributeAction , ProtocolMarshaller protocolMarshaller ) { } }
if ( objectAttributeAction == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( objectAttributeAction . getObjectAttributeActionType ( ) , OBJECTATTRIBUTEACTIONTYPE_BINDING ) ; protocolMarshaller . marshall ( objectAttributeAction . getObjectAttributeUpdateValue ( ) , OBJECTATTRIBUTEUPDATEVALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JNoteElementAbstract { /** * / * Render each indiviual gracenote associated with this note . */ protected void renderGraceNotes ( Graphics2D context ) { } }
if ( m_jGracenotes != null ) { m_jGracenotes . setStaffLine ( getStaffLine ( ) ) ; m_jGracenotes . render ( context ) ; boolean addSlur = false ; if ( getMusicElement ( ) instanceof NoteAbstract ) { byte graceType = ( ( NoteAbstract ) getMusicElement ( ) ) . getGracingType ( ) ; addSlur = getTemplate ( ) . getAttributeBoolean ( graceType == GracingType . ACCIACCATURA ? ScoreAttribute . ACCIACCATURA_SLUR : ScoreAttribute . APPOGGIATURA_SLUR ) ; } if ( addSlur ) { boolean graceAfterNote = false ; if ( m_jGracenotes . getBase ( ) . getX ( ) > getBase ( ) . getX ( ) ) graceAfterNote = true ; boolean gracesUp = ( ( JStemmableElement ) m_jGracenotes ) . isStemUp ( ) ; Point2D p2dStart , p2dControl , p2dEnd ; JNoteElementAbstract start , end ; if ( graceAfterNote ) { if ( this instanceof JChord ) { start = gracesUp ? ( ( JChord ) this ) . getLowestNote ( ) : ( ( JChord ) this ) . getHighestNote ( ) ; } else start = this ; if ( m_jGracenotes instanceof JGraceNote ) end = ( JGraceNote ) m_jGracenotes ; else // JGroupOfGrace end = ( JGraceNotePartOfGroup ) ( ( JGroupOfGraceNotes ) m_jGracenotes ) . m_jNotes [ ( ( JGroupOfGraceNotes ) m_jGracenotes ) . m_jNotes . length - 1 ] ; } else { if ( m_jGracenotes instanceof JGraceNote ) start = ( JGraceNote ) m_jGracenotes ; else // JGroupOfGrace start = ( JGraceNotePartOfGroup ) ( ( JGroupOfGraceNotes ) m_jGracenotes ) . m_jNotes [ 0 ] ; if ( this instanceof JChord ) { end = gracesUp ? ( ( JChord ) this ) . getLowestNote ( ) : ( ( JChord ) this ) . getHighestNote ( ) ; } else end = this ; } p2dStart = gracesUp ? start . getTieStartUnderAnchor ( ) : start . getTieStartAboveAnchor ( ) ; p2dEnd = gracesUp ? end . getTieEndUnderAnchor ( ) : end . getTieEndAboveAnchor ( ) ; double yControl = gracesUp ? Math . max ( p2dStart . getY ( ) , p2dEnd . getY ( ) ) : Math . min ( p2dStart . getY ( ) , p2dEnd . getY ( ) ) ; if ( m_jGracenotes instanceof JGroupOfGraceNotes ) { Rectangle2D bounds = m_jGracenotes . getBoundingBox ( ) ; if ( gracesUp ) yControl = Math . max ( yControl , bounds . getMaxY ( ) ) ; else yControl = Math . min ( yControl , bounds . getMinY ( ) ) ; } p2dControl = new Point2D . Double ( p2dStart . getX ( ) + ( p2dEnd . getX ( ) - p2dStart . getX ( ) ) / 2 , yControl + ( ( gracesUp ? .5 : - .5 ) * getMetrics ( ) . getSlurAnchorYOffset ( ) ) ) ; Color previousColor = context . getColor ( ) ; setColor ( context , ScoreElements . GRACENOTE ) ; GeneralPath path = new GeneralPath ( ) ; path . moveTo ( ( float ) p2dStart . getX ( ) , ( float ) p2dStart . getY ( ) ) ; QuadCurve2D q = new QuadCurve2D . Float ( ) ; q . setCurve ( p2dStart , JTune . newControl ( p2dStart , p2dControl , p2dEnd ) , p2dEnd ) ; path . append ( q , true ) ; p2dControl . setLocation ( p2dControl . getX ( ) , p2dControl . getY ( ) + ( gracesUp ? 1 : - 1 ) ) ; q . setCurve ( p2dEnd , JTune . newControl ( p2dStart , p2dControl , p2dEnd ) , p2dStart ) ; path . append ( q , true ) ; context . fill ( path ) ; context . draw ( path ) ; context . setColor ( previousColor ) ; } }
public class MessageFormat { /** * Parse a list of zero or more arguments of the form : < key > : < value > . The " : < value > " is * optional and will set the key = null . */ private void parseArgs ( MessageArgsParser parser ) { } }
while ( tag . peek ( ) != Chars . EOF ) { tag . skip ( COMMA_WS ) ; // Look for the argument key if ( ! tag . seek ( IDENTIFIER , choice ) ) { return ; } // Parse the < key > ( : < value > ) ? sequence String key = choice . toString ( ) ; tag . jump ( choice ) ; if ( tag . seek ( ARG_SEP , choice ) ) { tag . jump ( choice ) ; if ( tag . seek ( ARG_VAL , choice ) ) { tag . jump ( choice ) ; parser . set ( key , choice . toString ( ) ) ; } else { parser . set ( key , "" ) ; } } else { parser . set ( key , "" ) ; if ( ! tag . seek ( COMMA_WS , choice ) ) { return ; } } }
public class CodecsUtil { /** * Document codecs */ public static Document readDocument ( BsonReader reader , DecoderContext decoderContext , Map < String , Decoder < ? > > fieldDecoders ) { } }
Document document = new Document ( ) ; reader . readStartDocument ( ) ; while ( reader . readBsonType ( ) != END_OF_DOCUMENT ) { String fieldName = reader . readName ( ) ; if ( fieldDecoders . containsKey ( fieldName ) ) { document . put ( fieldName , fieldDecoders . get ( fieldName ) . decode ( reader , decoderContext ) ) ; } else { throw new BsonInvalidOperationException ( format ( "The field %s is not expected here" , fieldName ) ) ; } } reader . readEndDocument ( ) ; return document ;
public class Table { /** * Creates and returns a copy of this table object . * @ return cloned table */ public Table cloneTable ( ) { } }
Table ret = null ; try { ret = ( Table ) super . clone ( ) ; } catch ( final CloneNotSupportedException e ) { e . printStackTrace ( ) ; } return ret ;
public class WVideo { /** * Retrieves the base parameter map for serving content ( videos + tracks ) . * @ return the base map for serving content . */ private Map < String , String > getBaseParameterMap ( ) { } }
Environment env = getEnvironment ( ) ; Map < String , String > parameters = env . getHiddenParameters ( ) ; parameters . put ( Environment . TARGET_ID , getTargetId ( ) ) ; if ( Util . empty ( getCacheKey ( ) ) ) { // Add some randomness to the URL to prevent caching String random = WebUtilities . generateRandom ( ) ; parameters . put ( Environment . UNIQUE_RANDOM_PARAM , random ) ; } else { // Remove step counter as not required for cached content parameters . remove ( Environment . STEP_VARIABLE ) ; parameters . remove ( Environment . SESSION_TOKEN_VARIABLE ) ; // Add the cache key parameters . put ( Environment . CONTENT_CACHE_KEY , getCacheKey ( ) ) ; } return parameters ;
public class Shell { /** * Returns the longest command that can be matched as first word ( s ) in the given buffer . * @ return a valid command name , or { @ literal null } if none matched */ private String findLongestCommand ( String prefix ) { } }
String result = methodTargets . keySet ( ) . stream ( ) . filter ( command -> prefix . equals ( command ) || prefix . startsWith ( command + " " ) ) . reduce ( "" , ( c1 , c2 ) -> c1 . length ( ) > c2 . length ( ) ? c1 : c2 ) ; return "" . equals ( result ) ? null : result ;
public class CcgParserUtils { /** * Returns { @ code true } if { @ code parser } can reproduce the * syntactic tree in { @ code example } . * @ param parser * @ param example * @ return */ public static boolean isPossibleExample ( CcgParser parser , CcgExample example ) { } }
CcgBeamSearchChart chart = new CcgBeamSearchChart ( example . getSentence ( ) , Integer . MAX_VALUE , 100 ) ; SyntacticChartCost filter = SyntacticChartCost . createAgreementCost ( example . getSyntacticParse ( ) ) ; parser . parseCommon ( chart , example . getSentence ( ) , filter , null , - 1 , 1 ) ; List < CcgParse > parses = chart . decodeBestParsesForSpan ( 0 , example . getSentence ( ) . size ( ) - 1 , 100 , parser ) ; if ( parses . size ( ) == 0 ) { // Provide a deeper analysis of why parsing failed . analyzeParseFailure ( example . getSyntacticParse ( ) , chart , parser . getSyntaxVarType ( ) , "Parse failure" , 0 ) ; System . out . println ( "Discarding example: " + example ) ; return false ; } else if ( parses . size ( ) > 1 ) { analyzeParseFailure ( example . getSyntacticParse ( ) , chart , parser . getSyntaxVarType ( ) , "Parse duplication" , 2 ) ; System . out . println ( "Duplicate correct parse: " + example . getSyntacticParse ( ) ) ; } return true ;
public class SearchableTextComponent { /** * Update the search results ( highlighting ) when the query in the * search panel changed * @ param selectFirstMatch Whether the first match should be selected */ void updateSearchResults ( boolean selectFirstMatch ) { } }
clearHighlights ( ) ; searchPanel . setMessage ( "" ) ; String query = searchPanel . getQuery ( ) ; if ( query . isEmpty ( ) ) { handleMatch ( null ) ; return ; } String text = getDocumentText ( ) ; boolean ignoreCase = ! searchPanel . isCaseSensitive ( ) ; List < Point > appearances = JTextComponents . find ( text , query , ignoreCase ) ; addHighlights ( appearances , highlightColor ) ; int caretPosition = textComponent . getCaretPosition ( ) ; Point match = JTextComponents . findNext ( text , query , caretPosition , ignoreCase ) ; if ( match == null ) { match = JTextComponents . findNext ( text , query , 0 , ignoreCase ) ; } if ( selectFirstMatch ) { handleMatch ( match ) ; } else { handleMatch ( null ) ; } if ( appearances . isEmpty ( ) ) { searchPanel . setMessage ( "Not found" ) ; } else { searchPanel . setMessage ( "Found " + appearances . size ( ) + " times" ) ; }
public class AbstractRestExceptionHandler { /** * Logs the exception ; on ERROR level when status is 5xx , otherwise on INFO level without stack * trace , or DEBUG level with stack trace . The logger name is * { @ code cz . jirutka . spring . exhandler . handlers . RestExceptionHandler } . * @ param ex The exception to log . * @ param req The current web request . */ protected void logException ( E ex , HttpServletRequest req ) { } }
if ( LOG . isErrorEnabled ( ) && getStatus ( ) . value ( ) >= 500 || LOG . isInfoEnabled ( ) ) { Marker marker = MarkerFactory . getMarker ( ex . getClass ( ) . getName ( ) ) ; String uri = req . getRequestURI ( ) ; if ( req . getQueryString ( ) != null ) { uri += '?' + req . getQueryString ( ) ; } String msg = String . format ( "%s %s ~> %s" , req . getMethod ( ) , uri , getStatus ( ) ) ; if ( getStatus ( ) . value ( ) >= 500 ) { LOG . error ( marker , msg , ex ) ; } else if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( marker , msg , ex ) ; } else { LOG . info ( marker , msg ) ; } }
public class CmsShellCommands { /** * Add the user to the given role . < p > * @ param user name of the user * @ param role name of the role , for example ' EDITOR ' * @ throws CmsException if something goes wrong */ public void addUserToRole ( String user , String role ) throws CmsException { } }
OpenCms . getRoleManager ( ) . addUserToRole ( m_cms , CmsRole . valueOfRoleName ( role ) , user ) ;
public class IconProviderBuilder { /** * Sets the icon to use for a specific shape / group in a { @ link MalisisModel } . * @ param shapeName the shape name * @ param iconName the icon name * @ return the icon provider builder */ public IconProviderBuilder forShape ( String shapeName , String iconName ) { } }
setType ( Type . MODEL ) ; shapeIcons . put ( shapeName , icon ( iconName ) ) ; return this ;
public class RingMembershipAtom { /** * { @ inheritDoc } */ @ Override public boolean matches ( IAtom atom ) { } }
if ( ringNumber < 0 ) return invariants ( atom ) . ringConnectivity ( ) > 0 ; else if ( ringNumber == 0 ) return invariants ( atom ) . ringConnectivity ( ) == 0 ; else return ringNumber == invariants ( atom ) . ringNumber ( ) ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcMonetaryMeasure ( ) { } }
if ( ifcMonetaryMeasureEClass == null ) { ifcMonetaryMeasureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 717 ) ; } return ifcMonetaryMeasureEClass ;
public class MarketplaceWebServiceOrdersConfig { /** * Sets the value of a request header to be included on every request * @ param name the name of the header to set * @ param value value to send with header * @ return the current config object */ public MarketplaceWebServiceOrdersConfig withRequestHeader ( String name , String value ) { } }
cc . includeRequestHeader ( name , value ) ; return this ;
public class InternalSimpleAntlrParser { /** * InternalSimpleAntlr . g : 454:1 : ruleParameter returns [ EObject current = null ] : ( ( ( lv _ type _ 0_0 = RULE _ ID ) ) ( ( lv _ name _ 1_0 = RULE _ ID ) ) ) ; */ public final EObject ruleParameter ( ) throws RecognitionException { } }
EObject current = null ; Token lv_type_0_0 = null ; Token lv_name_1_0 = null ; enterRule ( ) ; try { // InternalSimpleAntlr . g : 457:28 : ( ( ( ( lv _ type _ 0_0 = RULE _ ID ) ) ( ( lv _ name _ 1_0 = RULE _ ID ) ) ) ) // InternalSimpleAntlr . g : 458:1 : ( ( ( lv _ type _ 0_0 = RULE _ ID ) ) ( ( lv _ name _ 1_0 = RULE _ ID ) ) ) { // InternalSimpleAntlr . g : 458:1 : ( ( ( lv _ type _ 0_0 = RULE _ ID ) ) ( ( lv _ name _ 1_0 = RULE _ ID ) ) ) // InternalSimpleAntlr . g : 458:2 : ( ( lv _ type _ 0_0 = RULE _ ID ) ) ( ( lv _ name _ 1_0 = RULE _ ID ) ) { // InternalSimpleAntlr . g : 458:2 : ( ( lv _ type _ 0_0 = RULE _ ID ) ) // InternalSimpleAntlr . g : 459:1 : ( lv _ type _ 0_0 = RULE _ ID ) { // InternalSimpleAntlr . g : 459:1 : ( lv _ type _ 0_0 = RULE _ ID ) // InternalSimpleAntlr . g : 460:3 : lv _ type _ 0_0 = RULE _ ID { lv_type_0_0 = ( Token ) match ( input , RULE_ID , FOLLOW_3 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( lv_type_0_0 , grammarAccess . getParameterAccess ( ) . getTypeIDTerminalRuleCall_0_0 ( ) ) ; } if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElement ( grammarAccess . getParameterRule ( ) ) ; } setWithLastConsumed ( current , "type" , lv_type_0_0 , "org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.ID" ) ; } } } // InternalSimpleAntlr . g : 476:2 : ( ( lv _ name _ 1_0 = RULE _ ID ) ) // InternalSimpleAntlr . g : 477:1 : ( lv _ name _ 1_0 = RULE _ ID ) { // InternalSimpleAntlr . g : 477:1 : ( lv _ name _ 1_0 = RULE _ ID ) // InternalSimpleAntlr . g : 478:3 : lv _ name _ 1_0 = RULE _ ID { lv_name_1_0 = ( Token ) match ( input , RULE_ID , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( lv_name_1_0 , grammarAccess . getParameterAccess ( ) . getNameIDTerminalRuleCall_1_0 ( ) ) ; } if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElement ( grammarAccess . getParameterRule ( ) ) ; } setWithLastConsumed ( current , "name" , lv_name_1_0 , "org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.ID" ) ; } } } } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ;
public class Wills { /** * Creates Guava ' s { @ link FutureCallback } from provided Actions */ public static < A > FutureCallback < A > futureCallback ( final Action < A > success , final Action < Throwable > failure ) { } }
return new FutureCallback < A > ( ) { @ Override public void onSuccess ( A result ) { checkNotNull ( success ) . apply ( result ) ; } @ Override public void onFailure ( Throwable t ) { checkNotNull ( failure ) . apply ( t ) ; } } ;
public class appflowglobal_appflowpolicy_binding { /** * Use this API to fetch a appflowglobal _ appflowpolicy _ binding resources . */ public static appflowglobal_appflowpolicy_binding [ ] get ( nitro_service service ) throws Exception { } }
appflowglobal_appflowpolicy_binding obj = new appflowglobal_appflowpolicy_binding ( ) ; appflowglobal_appflowpolicy_binding response [ ] = ( appflowglobal_appflowpolicy_binding [ ] ) obj . get_resources ( service ) ; return response ;
public class ListDocumentsRequest { /** * One or more filters . Use a filter to return a more specific list of results . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setFilters ( java . util . Collection ) } or { @ link # withFilters ( java . util . Collection ) } if you want to override * the existing values . * @ param filters * One or more filters . Use a filter to return a more specific list of results . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListDocumentsRequest withFilters ( DocumentKeyValuesFilter ... filters ) { } }
if ( this . filters == null ) { setFilters ( new com . amazonaws . internal . SdkInternalList < DocumentKeyValuesFilter > ( filters . length ) ) ; } for ( DocumentKeyValuesFilter ele : filters ) { this . filters . add ( ele ) ; } return this ;
public class AbstractReporter { /** * Generate the specified output file by merging the specified * Velocity template with the supplied context . */ protected void generateFile ( File file , String templateName , VelocityContext context ) throws Exception { } }
Writer writer = new BufferedWriter ( new FileWriter ( file ) ) ; try { Velocity . mergeTemplate ( classpathPrefix + templateName , ENCODING , context , writer ) ; writer . flush ( ) ; } finally { writer . close ( ) ; }
public class JSTalkBackFilter { /** * Checks if given string is long . * @ param str { @ link String } * @ return true if it is long or false otherwise */ private boolean isLong ( final String str ) { } }
try { Long . valueOf ( str ) ; return true ; } catch ( NumberFormatException e ) { return false ; }
public class fis { /** * Use this API to fetch filtered set of fis resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static fis [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
fis obj = new fis ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; fis [ ] response = ( fis [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class AuthenticationManager { /** * Finds the user name associated with a given token ( e . g . for audit ) . * @ param token a token * @ return a user name , or null if the otken did not match anything */ public String findUsername ( String token ) { } }
return token == null ? null : this . tokenToUsername . get ( token ) ;
public class FrequentlyUsedPolicy { /** * Returns all variations of this policy based on the configuration parameters . */ public static Set < Policy > policies ( Config config , EvictionPolicy policy ) { } }
BasicSettings settings = new BasicSettings ( config ) ; return settings . admission ( ) . stream ( ) . map ( admission -> new FrequentlyUsedPolicy ( admission , policy , config ) ) . collect ( toSet ( ) ) ;
public class ZonesInner { /** * Deletes a DNS zone . WARNING : All DNS records in the zone will also be deleted . This operation cannot be undone . * @ param resourceGroupName The name of the resource group . * @ param zoneName The name of the DNS zone ( without a terminating dot ) . * @ param ifMatch The etag of the DNS zone . Omit this value to always delete the current zone . Specify the last - seen etag value to prevent accidentally deleting any concurrent changes . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ZoneDeleteResultInner object */ public Observable < ZoneDeleteResultInner > beginDeleteAsync ( String resourceGroupName , String zoneName , String ifMatch ) { } }
return beginDeleteWithServiceResponseAsync ( resourceGroupName , zoneName , ifMatch ) . map ( new Func1 < ServiceResponse < ZoneDeleteResultInner > , ZoneDeleteResultInner > ( ) { @ Override public ZoneDeleteResultInner call ( ServiceResponse < ZoneDeleteResultInner > response ) { return response . body ( ) ; } } ) ;
public class AnalysisJobImmutabilizer { /** * Gets or creates a { @ link TransformerJob } for a particular * { @ link TransformerComponentBuilder } . Since { @ link MultiStreamComponent } s * are subtypes of { @ link Transformer } it is necesary to have this caching * mechanism in place in order to allow diamond - shaped component graphs * where multiple streams include the same component . * @ param validate * @ param tjb * @ return */ public TransformerJob getOrCreateTransformerJob ( final boolean validate , final TransformerComponentBuilder < ? > tjb ) { } }
TransformerJob componentJob = ( TransformerJob ) _componentJobs . get ( tjb ) ; if ( componentJob == null ) { try { componentJob = tjb . toTransformerJob ( validate , this ) ; _componentJobs . put ( tjb , componentJob ) ; } catch ( final IllegalStateException e ) { throw new IllegalStateException ( "Could not create transformer job from builder: " + tjb + ", (" + e . getMessage ( ) + ")" , e ) ; } } return componentJob ;
public class GosuStringUtil { /** * < p > Checks if the String contains any character in the given * set of characters . < / p > * < p > A < code > null < / code > String will return < code > false < / code > . * A < code > null < / code > or zero length search array will return < code > false < / code > . < / p > * < pre > * GosuStringUtil . containsAny ( null , * ) = false * GosuStringUtil . containsAny ( " " , * ) = false * GosuStringUtil . containsAny ( * , null ) = false * GosuStringUtil . containsAny ( * , [ ] ) = false * GosuStringUtil . containsAny ( " zzabyycdxx " , [ ' z ' , ' a ' ] ) = true * GosuStringUtil . containsAny ( " zzabyycdxx " , [ ' b ' , ' y ' ] ) = true * GosuStringUtil . containsAny ( " aba " , [ ' z ' ] ) = false * < / pre > * @ param str the String to check , may be null * @ param searchChars the chars to search for , may be null * @ return the < code > true < / code > if any of the chars are found , * < code > false < / code > if no match or null input * @ since 2.4 */ public static boolean containsAny ( String str , char [ ] searchChars ) { } }
if ( str == null || str . length ( ) == 0 || searchChars == null || searchChars . length == 0 ) { return false ; } for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char ch = str . charAt ( i ) ; for ( int j = 0 ; j < searchChars . length ; j ++ ) { if ( searchChars [ j ] == ch ) { return true ; } } } return false ;
public class FootnoteDrawTextItem { /** * ( non - Javadoc ) * @ see com . alibaba . simpleimage . render . DrawTextItem # drawText ( java . awt . Graphics2D , int , int ) */ @ Override public void drawText ( Graphics2D graphics , int width , int height ) { } }
if ( StringUtils . isBlank ( text ) || StringUtils . isBlank ( domainName ) ) { return ; } int x = 0 , y = 0 ; int fontsize = ( ( int ) ( width * textWidthPercent ) ) / domainName . length ( ) ; if ( fontsize < minFontSize ) { return ; } float fsize = ( float ) fontsize ; Font font = domainFont . deriveFont ( fsize ) ; graphics . setFont ( font ) ; FontRenderContext context = graphics . getFontRenderContext ( ) ; int sw = ( int ) font . getStringBounds ( domainName , context ) . getWidth ( ) ; x = width - sw - fontsize ; y = height - fontsize ; if ( x <= 0 || y <= 0 ) { return ; } if ( fontShadowColor != null ) { graphics . setColor ( fontShadowColor ) ; graphics . drawString ( domainName , x + getShadowTranslation ( fontsize ) , y + getShadowTranslation ( fontsize ) ) ; } graphics . setColor ( fontColor ) ; graphics . drawString ( domainName , x , y ) ; // draw company name fsize = ( float ) fontsize ; font = defaultFont . deriveFont ( fsize ) ; graphics . setFont ( font ) ; context = graphics . getFontRenderContext ( ) ; sw = ( int ) font . getStringBounds ( text , context ) . getWidth ( ) ; x = width - sw - fontsize ; y = height - ( int ) ( fontsize * 2.5 ) ; if ( x <= 0 || y <= 0 ) { return ; } if ( fontShadowColor != null ) { graphics . setColor ( fontShadowColor ) ; graphics . drawString ( text , x + getShadowTranslation ( fontsize ) , y + getShadowTranslation ( fontsize ) ) ; } graphics . setColor ( fontColor ) ; graphics . drawString ( text , x , y ) ;
public class AbstractGenericRowMapper { /** * { @ inheritDoc } */ @ Override public T mapRow ( ResultSet rs , int rowNum ) throws SQLException { } }
try { Map < String , ColAttrMapping > colAttrMappings = getColumnAttributeMappings ( ) ; T bo = BoUtils . createObject ( typeClass . getName ( ) , getClassLoader ( ) , typeClass ) ; for ( Entry < String , ColAttrMapping > entry : colAttrMappings . entrySet ( ) ) { ColAttrMapping mapping = entry . getValue ( ) ; if ( mapping . attrClass == boolean . class || mapping . attrClass == Boolean . class ) { mapping . extractColumData ( bo , rs :: getBoolean ) ; } else if ( mapping . attrClass == char . class || mapping . attrClass == Character . class || mapping . attrClass == String . class ) { mapping . extractColumData ( bo , rs :: getString ) ; } else if ( mapping . attrClass == byte . class || mapping . attrClass == Byte . class ) { mapping . extractColumData ( bo , rs :: getByte ) ; } else if ( mapping . attrClass == short . class || mapping . attrClass == Short . class ) { mapping . extractColumData ( bo , rs :: getShort ) ; } else if ( mapping . attrClass == int . class || mapping . attrClass == Integer . class ) { mapping . extractColumData ( bo , rs :: getInt ) ; } else if ( mapping . attrClass == long . class || mapping . attrClass == Long . class || mapping . attrClass == BigInteger . class ) { mapping . extractColumData ( bo , rs :: getLong ) ; } else if ( mapping . attrClass == float . class || mapping . attrClass == Float . class ) { mapping . extractColumData ( bo , rs :: getFloat ) ; } else if ( mapping . attrClass == double . class || mapping . attrClass == Double . class ) { mapping . extractColumData ( bo , rs :: getDouble ) ; } else if ( mapping . attrClass == BigDecimal . class ) { mapping . extractColumData ( bo , rs :: getBigDecimal ) ; } else if ( mapping . attrClass == byte [ ] . class ) { mapping . extractColumData ( bo , rs :: getBytes ) ; } else if ( mapping . attrClass == Blob . class ) { mapping . extractColumData ( bo , rs :: getBlob ) ; } else if ( mapping . attrClass == Clob . class ) { mapping . extractColumData ( bo , rs :: getClob ) ; } else if ( mapping . attrClass == NClob . class ) { mapping . extractColumData ( bo , rs :: getNClob ) ; } else if ( mapping . attrClass == Date . class || mapping . attrClass == Timestamp . class ) { mapping . extractColumData ( bo , rs :: getTimestamp ) ; } else if ( mapping . attrClass == java . sql . Date . class ) { mapping . extractColumData ( bo , rs :: getDate ) ; } else if ( mapping . attrClass == java . sql . Time . class ) { mapping . extractColumData ( bo , rs :: getTime ) ; } else { throw new IllegalArgumentException ( "Unsupported attribute class " + mapping . attrClass ) ; } } if ( bo instanceof BaseBo ) { ( ( BaseBo ) bo ) . markClean ( ) ; } return bo ; } catch ( InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | ClassNotFoundException e ) { throw new RuntimeException ( e ) ; }
public class Utils { /** * Download a file asynchronously . * @ param url the URL pointing to the file * @ param retrofit the retrofit client * @ return an Observable pointing to the content of the file */ public static Observable < byte [ ] > downloadFileAsync ( String url , Retrofit retrofit ) { } }
FileService service = retrofit . create ( FileService . class ) ; Observable < ResponseBody > response = service . download ( url ) ; return response . map ( new Func1 < ResponseBody , byte [ ] > ( ) { @ Override public byte [ ] call ( ResponseBody responseBody ) { try { return responseBody . bytes ( ) ; } catch ( IOException e ) { throw Exceptions . propagate ( e ) ; } } } ) ;
public class IntFloatVectorSlice { /** * Updates this vector to be the entrywise product ( i . e . Hadamard product ) of this vector with the other . */ public void product ( IntFloatVector other ) { } }
// TODO : Add special case for IntFloatDenseVector . for ( int i = 0 ; i < size ; i ++ ) { elements [ i + start ] *= other . get ( i ) ; }
public class TorrentInfo { /** * Adds one url to the list of url seeds . Currently , the only transport protocol * supported for the url is http . * The { @ code externAuth } argument can be used for other authorization schemes than * basic HTTP authorization . If set , it will override any username and password * found in the URL itself . The string will be sent as the HTTP authorization header ' s * value ( without specifying " Basic " ) . * The { @ code extraHeaders } argument can be used to insert custom HTTP headers * in the requests to a specific web seed . * @ param url * @ param externAuth * @ param extraHeaders */ public void addUrlSeed ( String url , String externAuth , List < Pair < String , String > > extraHeaders ) { } }
string_string_pair_vector v = new string_string_pair_vector ( ) ; for ( Pair < String , String > p : extraHeaders ) { v . push_back ( p . to_string_string_pair ( ) ) ; } ti . add_url_seed ( url , externAuth , v ) ;
public class SourceFile { /** * Replace the source code between the start and end character positions with a new string . * < p > This method uses the same conventions as { @ link String # substring ( int , int ) } for its start * and end parameters . */ public void replaceChars ( int startPosition , int endPosition , String replacement ) { } }
try { sourceBuilder . replace ( startPosition , endPosition , replacement ) ; } catch ( StringIndexOutOfBoundsException e ) { throw new IndexOutOfBoundsException ( String . format ( "Replacement cannot be made. Source file %s has length %d, requested start " + "position %d, requested end position %d, replacement %s" , path , sourceBuilder . length ( ) , startPosition , endPosition , replacement ) ) ; }
public class CassandraClientBase { /** * Find . * @ param < E > * the element type * @ param entityClass * the entity class * @ param superColumnMap * the super column map * @ param dataHandler * the data handler * @ return the list */ public < E > List < E > find ( Class < E > entityClass , Map < String , String > superColumnMap , CassandraDataHandler dataHandler ) { } }
List < E > entities = null ; String entityId = null ; try { EntityMetadata entityMetadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , getPersistenceUnit ( ) , entityClass ) ; entities = new ArrayList < E > ( ) ; for ( String superColumnName : superColumnMap . keySet ( ) ) { entityId = superColumnMap . get ( superColumnName ) ; List < SuperColumn > superColumnList = loadSuperColumns ( entityMetadata . getSchema ( ) , entityMetadata . getTableName ( ) , entityId , new String [ ] { superColumnName . substring ( 0 , superColumnName . indexOf ( "|" ) ) } ) ; E e = ( E ) dataHandler . fromThriftRow ( entityMetadata . getEntityClazz ( ) , entityMetadata , new DataRow < SuperColumn > ( entityId , entityMetadata . getTableName ( ) , superColumnList ) ) ; if ( e != null ) { entities . add ( e ) ; } } } catch ( Exception e ) { log . error ( "Error while retrieving records from database for entity {} and key {}, Caused by: . " , entityClass , entityId , e ) ; throw new KunderaException ( e ) ; } return entities ;
public class DFSClient { /** * Get the checksum of a file . * @ param src The file path * @ return The checksum */ public static MD5MD5CRC32FileChecksum getFileChecksum ( int dataTransferVersion , String src , ClientProtocol namenode , ProtocolProxy < ClientProtocol > namenodeProxy , SocketFactory socketFactory , int socketTimeout ) throws IOException { } }
// get all block locations final LocatedBlocks locatedBlocks = callGetBlockLocations ( namenode , src , 0 , Long . MAX_VALUE , isMetaInfoSuppoted ( namenodeProxy ) ) ; if ( locatedBlocks == null ) { throw new IOException ( "Null block locations, mostly because non-existent file " + src ) ; } int namespaceId = 0 ; if ( locatedBlocks instanceof LocatedBlocksWithMetaInfo ) { LocatedBlocksWithMetaInfo lBlocks = ( LocatedBlocksWithMetaInfo ) locatedBlocks ; dataTransferVersion = lBlocks . getDataProtocolVersion ( ) ; namespaceId = lBlocks . getNamespaceID ( ) ; } else if ( dataTransferVersion == - 1 ) { dataTransferVersion = namenode . getDataTransferProtocolVersion ( ) ; } final List < LocatedBlock > locatedblocks = locatedBlocks . getLocatedBlocks ( ) ; final DataOutputBuffer md5out = new DataOutputBuffer ( ) ; int bytesPerCRC = 0 ; long crcPerBlock = 0 ; // get block checksum for each block for ( int i = 0 ; i < locatedblocks . size ( ) ; i ++ ) { LocatedBlock lb = locatedblocks . get ( i ) ; final Block block = lb . getBlock ( ) ; final DatanodeInfo [ ] datanodes = lb . getLocations ( ) ; // try each datanode location of the block final int timeout = ( socketTimeout > 0 ) ? ( socketTimeout + HdfsConstants . READ_TIMEOUT_EXTENSION * datanodes . length ) : 0 ; boolean done = false ; for ( int j = 0 ; ! done && j < datanodes . length ; j ++ ) { final Socket sock = socketFactory . createSocket ( ) ; DataOutputStream out = null ; DataInputStream in = null ; try { // connect to a datanode NetUtils . connect ( sock , NetUtils . createSocketAddr ( datanodes [ j ] . getName ( ) ) , timeout ) ; sock . setSoTimeout ( timeout ) ; out = new DataOutputStream ( new BufferedOutputStream ( NetUtils . getOutputStream ( sock ) , DataNode . SMALL_BUFFER_SIZE ) ) ; in = new DataInputStream ( NetUtils . getInputStream ( sock ) ) ; // get block MD5 if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "write to " + datanodes [ j ] . getName ( ) + ": " + DataTransferProtocol . OP_BLOCK_CHECKSUM + ", block=" + block ) ; } /* Write the header */ BlockChecksumHeader blockChecksumHeader = new BlockChecksumHeader ( dataTransferVersion , namespaceId , block . getBlockId ( ) , block . getGenerationStamp ( ) ) ; blockChecksumHeader . writeVersionAndOpCode ( out ) ; blockChecksumHeader . write ( out ) ; out . flush ( ) ; final short reply = in . readShort ( ) ; if ( reply != DataTransferProtocol . OP_STATUS_SUCCESS ) { throw new IOException ( "Bad response " + reply + " for block " + block + " from datanode " + datanodes [ j ] . getName ( ) ) ; } // read byte - per - checksum final int bpc = in . readInt ( ) ; if ( i == 0 ) { // first block bytesPerCRC = bpc ; } else if ( bpc != bytesPerCRC ) { throw new IOException ( "Byte-per-checksum not matched: bpc=" + bpc + " but bytesPerCRC=" + bytesPerCRC ) ; } // read crc - per - block final long cpb = in . readLong ( ) ; if ( locatedblocks . size ( ) > 1 && i == 0 ) { crcPerBlock = cpb ; } // read md5 final MD5Hash md5 = MD5Hash . read ( in ) ; md5 . write ( md5out ) ; done = true ; if ( LOG . isDebugEnabled ( ) ) { if ( i == 0 ) { LOG . debug ( "set bytesPerCRC=" + bytesPerCRC + ", crcPerBlock=" + crcPerBlock ) ; } LOG . debug ( "got reply from " + datanodes [ j ] . getName ( ) + ": md5=" + md5 ) ; } } catch ( IOException ie ) { LOG . warn ( "src=" + src + ", datanodes[" + j + "].getName()=" + datanodes [ j ] . getName ( ) , ie ) ; } finally { IOUtils . closeStream ( in ) ; IOUtils . closeStream ( out ) ; IOUtils . closeSocket ( sock ) ; } } if ( ! done ) { throw new IOException ( "Fail to get block MD5 for " + block ) ; } } // compute file MD5 final MD5Hash fileMD5 = MD5Hash . digest ( md5out . getData ( ) ) ; return new MD5MD5CRC32FileChecksum ( bytesPerCRC , crcPerBlock , fileMD5 ) ;
public class BugsnagAppender { /** * Whether or not a logger is excluded from generating Bugsnag reports * @ param loggerName The name of the logger * @ return true if the logger should be excluded */ private boolean isExcludedLogger ( String loggerName ) { } }
for ( Pattern excludedLoggerPattern : EXCLUDED_LOGGER_PATTERNS ) { if ( excludedLoggerPattern . matcher ( loggerName ) . matches ( ) ) { return true ; } } return false ;
public class UpdateRequestValidatorRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateRequestValidatorRequest updateRequestValidatorRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateRequestValidatorRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateRequestValidatorRequest . getRestApiId ( ) , RESTAPIID_BINDING ) ; protocolMarshaller . marshall ( updateRequestValidatorRequest . getRequestValidatorId ( ) , REQUESTVALIDATORID_BINDING ) ; protocolMarshaller . marshall ( updateRequestValidatorRequest . getPatchOperations ( ) , PATCHOPERATIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class RdmaEndpoint { /** * Close this endpoint . * This closes the connection and free ' s all the resources , e . g . , queue pair . * @ throws InterruptedException * @ throws Exception the exception */ public synchronized void close ( ) throws IOException , InterruptedException { } }
if ( isClosed ) { return ; } logger . info ( "closing client endpoint" ) ; if ( connState == CONN_STATE_CONNECTED ) { idPriv . disconnect ( ) ; this . wait ( 1000 ) ; } if ( connState >= CONN_STATE_RESOURCES_ALLOCATED ) { idPriv . destroyQP ( ) ; } idPriv . destroyId ( ) ; group . unregisterClientEp ( this ) ; isClosed = true ; logger . info ( "closing client done" ) ;
public class ChildList { /** * Returns an ArrayListImpl that is safe to modify . If delegate . count does not equal to zero , * returns a copy of delegate . */ private ArrayListImpl < ChildLink < T > > modifiableDelegate ( ) { } }
if ( delegate . getCount ( ) != 0 ) { delegate = new ArrayListImpl < > ( delegate ) ; } return delegate ;
public class XServletSettings { /** * The X - Frame - Options HTTP response header can be used to indicate whether or * not a browser should be allowed to render a page in a & lt ; frame & gt ; , * & lt ; iframe & gt ; or & lt ; object & gt ; . Sites can use this to avoid clickjacking * attacks , by ensuring that their content is not embedded into other sites . * Example : * < pre > * X - Frame - Options : DENY * X - Frame - Options : SAMEORIGIN * X - Frame - Options : ALLOW - FROM https : / / example . com / * < / pre > * @ param eType * The X - Frame - Options type to be set . May be < code > null < / code > . * @ param aDomain * The domain URL to be used in " ALLOW - FROM " . May be < code > null < / code > * for the other cases . * @ return this for chaining * @ since 9.1.1 */ @ Nonnull public XServletSettings setXFrameOptions ( @ Nullable final EXFrameOptionType eType , @ Nullable final ISimpleURL aDomain ) { } }
if ( eType != null && eType . isURLRequired ( ) ) ValueEnforcer . notNull ( aDomain , "Domain" ) ; m_eXFrameOptionsType = eType ; m_aXFrameOptionsDomain = aDomain ; return this ;
public class AlluxioJobWorker { /** * Starts the Alluxio job worker . * @ param args command line arguments , should be empty */ public static void main ( String [ ] args ) { } }
if ( args . length != 0 ) { LOG . info ( "java -cp {} {}" , RuntimeConstants . ALLUXIO_JAR , AlluxioJobWorker . class . getCanonicalName ( ) ) ; System . exit ( - 1 ) ; } if ( ! ConfigurationUtils . masterHostConfigured ( ServerConfiguration . global ( ) ) ) { System . out . println ( ConfigurationUtils . getMasterHostNotConfiguredMessage ( "Alluxio job worker" ) ) ; System . exit ( 1 ) ; } if ( ! ConfigurationUtils . jobMasterHostConfigured ( ServerConfiguration . global ( ) ) ) { System . out . println ( ConfigurationUtils . getJobMasterHostNotConfiguredMessage ( "Alluxio job worker" ) ) ; System . exit ( 1 ) ; } CommonUtils . PROCESS_TYPE . set ( CommonUtils . ProcessType . JOB_WORKER ) ; MasterInquireClient masterInquireClient = MasterInquireClient . Factory . create ( ServerConfiguration . global ( ) ) ; try { RetryUtils . retry ( "load cluster default configuration with master" , ( ) -> { InetSocketAddress masterAddress = masterInquireClient . getPrimaryRpcAddress ( ) ; ServerConfiguration . loadClusterDefaults ( masterAddress ) ; } , RetryUtils . defaultWorkerMasterClientRetry ( ServerConfiguration . getDuration ( PropertyKey . WORKER_MASTER_CONNECT_RETRY_TIMEOUT ) ) ) ; } catch ( IOException e ) { ProcessUtils . fatalError ( LOG , "Failed to load cluster default configuration for job worker: %s" , e . getMessage ( ) ) ; } JobWorkerProcess process = JobWorkerProcess . Factory . create ( ) ; ProcessUtils . run ( process ) ;
public class AutoModify { /** * Processes the modify directives . * @ param directivesFilePath - * The absolute file path of the file containing the modify * directives . * @ param logFilePath - * The absolute file path of the log file . * @ param isValidateOnly - * Boolean flag ; true indicates validate only ; false indicates * process the directives file . */ public void modify ( String directivesFilePath , String logFilePath , boolean isValidateOnly ) { } }
modify ( s_APIM , s_UPLOADER , s_APIA , directivesFilePath , logFilePath , isValidateOnly ) ;
public class RecognizeCelebritiesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RecognizeCelebritiesRequest recognizeCelebritiesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( recognizeCelebritiesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( recognizeCelebritiesRequest . getImage ( ) , IMAGE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ListenerUtils { /** * Add either an { @ link SuperToast . OnDismissListener } * or a { @ link SuperActivityToast . OnButtonClickListener } * to a stored HashMap along with a String tag . This is used to reattach listeners to a * { @ link SuperActivityToast } when recreated from an * orientation change . * @ param tag A unique tag for the listener * @ param onButtonClickListener The listener to be reattached * @ return The current instance of the { @ link ListenerUtils } */ public ListenerUtils putListener ( String tag , SuperActivityToast . OnButtonClickListener onButtonClickListener ) { } }
this . mOnButtonClickListenerHashMap . put ( tag , onButtonClickListener ) ; return this ;
public class UserPreferencesDao { /** * Sets the given preference key to the given preference value . * @ param key preference to set . Must be less than 256 characters . * @ param value preference to set . Must be less than 256 characters . * @ throws OsmAuthorizationException if this application is not authorized to change the * user ' s preferences . ( Permission . CHANGE _ PREFERENCES ) */ public void set ( String key , String value ) { } }
String urlKey = urlEncode ( key ) ; checkPreferenceKeyLength ( urlKey ) ; checkPreferenceValueLength ( value ) ; osm . makeAuthenticatedRequest ( USERPREFS + urlKey , "PUT" , new PlainTextWriter ( value ) ) ;
public class OWLDataPropertyImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the * { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } . * @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to read the * object ' s content from * @ param instance the object instance to deserialize * @ throws com . google . gwt . user . client . rpc . SerializationException * if the deserialization operation is not * successful */ @ Override public void deserializeInstance ( SerializationStreamReader streamReader , OWLDataPropertyImpl instance ) throws SerializationException { } }
deserialize ( streamReader , instance ) ;
public class QuickUtils { /** * Initialize QuickUtils */ public static synchronized void init ( Context context ) { } }
mContext = context ; // Set the appropriate log TAG setTAG ( QuickUtils . system . getApplicationNameByContext ( ) ) ; // resets all timestamps QuickUtils . timer . resetAllTimestamps ( ) ; // init Rest QuickUtils . rest . init ( ) ; // init image cache QuickUtils . imageCache . initialize ( context ) ; // init the objects cache try { cacheMagic . init ( 4096 ) ; // in bytes } catch ( Exception e ) { QuickUtils . log . e ( "Error initing cache" ) ; }
public class JournalReader { /** * Create an instance of the proper JournalReader child class , as determined * by the server parameters . */ public static JournalReader getInstance ( Map < String , String > parameters , String role , JournalRecoveryLog recoveryLog , ServerInterface server ) throws ModuleInitializationException { } }
try { Object journalReader = JournalHelper . createInstanceAccordingToParameter ( PARAMETER_JOURNAL_READER_CLASSNAME , new Class [ ] { Map . class , String . class , JournalRecoveryLog . class , ServerInterface . class } , new Object [ ] { parameters , role , recoveryLog , server } , parameters ) ; logger . info ( "JournalReader is " + journalReader . toString ( ) ) ; return ( JournalReader ) journalReader ; } catch ( JournalException e ) { String msg = "Can't create JournalReader" ; logger . error ( msg , e ) ; throw new ModuleInitializationException ( msg , role , e ) ; }
public class Config { /** * Returns a read - only { @ link com . hazelcast . core . IQueue } configuration for * the given name . * The name is matched by pattern to the configuration and by stripping the * partition ID qualifier from the given { @ code name } . * If there is no config found by the name , it will return the configuration * with the name { @ code default } . * @ param name name of the queue config * @ return the queue configuration * @ throws ConfigurationException if ambiguous configurations are found * @ see StringPartitioningStrategy # getBaseName ( java . lang . String ) * @ see # setConfigPatternMatcher ( ConfigPatternMatcher ) * @ see # getConfigPatternMatcher ( ) * @ see EvictionConfig # setSize ( int ) */ public QueueConfig findQueueConfig ( String name ) { } }
name = getBaseName ( name ) ; QueueConfig config = lookupByPattern ( configPatternMatcher , queueConfigs , name ) ; if ( config != null ) { return config . getAsReadOnly ( ) ; } return getQueueConfig ( "default" ) . getAsReadOnly ( ) ;
public class CPDefinitionOptionValueRelLocalServiceBaseImpl { /** * Returns the number of rows matching the dynamic query . * @ param dynamicQuery the dynamic query * @ param projection the projection to apply to the query * @ return the number of rows matching the dynamic query */ @ Override public long dynamicQueryCount ( DynamicQuery dynamicQuery , Projection projection ) { } }
return cpDefinitionOptionValueRelPersistence . countWithDynamicQuery ( dynamicQuery , projection ) ;
public class DiffConsumerLogMessages { /** * Logs the occurance of a DiffException . * @ param logger * reference to the logger * @ param e * reference to the exception */ public static void logDiffException ( final Logger logger , final DiffException e ) { } }
logger . logException ( Level . ERROR , "DiffException" , e ) ;
public class CmsVaadinUtils { /** * Returns the path to the design template file of the given component . < p > * @ param component the component * @ return the path */ public static String getDefaultDesignPath ( Component component ) { } }
String className = component . getClass ( ) . getName ( ) ; String designPath = className . replace ( "." , "/" ) + ".html" ; return designPath ;
public class RetryPolicy { /** * Determines if an exception is retry - able or not . Only transient exceptions should be retried . * @ param exception exception encountered by an operation , to be determined if it is retry - able . * @ return true if the exception is retry - able ( like ServerBusy or other transient exception ) , else returns false */ public static boolean isRetryableException ( Exception exception ) { } }
if ( exception == null ) { throw new IllegalArgumentException ( "exception cannot be null" ) ; } if ( exception instanceof ServiceBusException ) { return ( ( ServiceBusException ) exception ) . getIsTransient ( ) ; } return false ;
public class OCSP { /** * Called by com . sun . deploy . security . TrustDecider */ public static RevocationStatus check ( X509Certificate cert , X509Certificate issuerCert , URI responderURI , X509Certificate responderCert , Date date , List < Extension > extensions ) throws IOException , CertPathValidatorException { } }
CertId certId = null ; try { X509CertImpl certImpl = X509CertImpl . toImpl ( cert ) ; certId = new CertId ( issuerCert , certImpl . getSerialNumberObject ( ) ) ; } catch ( CertificateException | IOException e ) { throw new CertPathValidatorException ( "Exception while encoding OCSPRequest" , e ) ; } OCSPResponse ocspResponse = check ( Collections . singletonList ( certId ) , responderURI , issuerCert , responderCert , date , extensions ) ; return ( RevocationStatus ) ocspResponse . getSingleResponse ( certId ) ;
public class DefaultStreamHandler { /** * To make life easier for the user we will figure out the type of * { @ link StreamListener } the user passed and based on that setup the * correct stream analyzer etc . * { @ inheritDoc } */ @ SuppressWarnings ( "unchecked" ) @ Override public void addStreamListener ( final StreamListener < ? extends Packet > listener ) { } }
try { final Method method = listener . getClass ( ) . getMethod ( "endStream" , Stream . class ) ; final ParameterizedType parameterizedType = ( ParameterizedType ) method . getGenericParameterTypes ( ) [ 0 ] ; final Type [ ] parameterArgTypes = parameterizedType . getActualTypeArguments ( ) ; // TODO : could actually be more . final Type parameterArgType = parameterArgTypes [ 0 ] ; final Class < ? > parameterArgClass = ( Class < ? > ) parameterArgType ; if ( parameterArgClass . equals ( SipPacket . class ) ) { if ( this . sipStreamHandler == null ) { this . sipStreamHandler = new SipStreamHandler ( this . framerManager ) ; } this . sipStreamHandler . addListener ( ( StreamListener < SipPacket > ) listener ) ; } else if ( parameterArgClass . equals ( RtpPacket . class ) ) { if ( this . rtpStreamHandler == null ) { this . rtpStreamHandler = new RtpStreamHandler ( this . framerManager ) ; } this . rtpStreamHandler . addListener ( ( StreamListener < RtpPacket > ) listener ) ; } } catch ( final ArrayIndexOutOfBoundsException e ) { throw new RuntimeException ( "Unable to figure out the paramterized type" , e ) ; } catch ( final SecurityException e ) { throw new RuntimeException ( "Unable to access method information due to security constraints" , e ) ; } catch ( final NoSuchMethodException e ) { throw new RuntimeException ( "The startStream method doesn't exist. Signature changed?" , e ) ; } catch ( final ClassCastException e ) { // means that the user had not parameterized the StreamListener // interface , which means that we cannot actually detect streams . throw new IllegalArgumentException ( "The supplied listener has not been parameterized" ) ; }
public class LockingContainer { /** * this is called directly from tests but shouldn ' t be accessed otherwise . */ @ Override public void dispatch ( final KeyedMessage message , final boolean block ) throws IllegalArgumentException , ContainerException { } }
if ( ! isRunningLazy ) { LOGGER . debug ( "Dispacth called on stopped container" ) ; statCollector . messageFailed ( false ) ; } if ( message == null ) return ; // No . We didn ' t process the null message if ( ! inbound . doesMessageKeyBelongToNode ( message . key ) ) { if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "Message with key " + SafeString . objectDescription ( message . key ) + " sent to wrong container. " ) ; statCollector . messageFailed ( false ) ; return ; } boolean evictedAndBlocking ; if ( message == null || message . message == null ) throw new IllegalArgumentException ( "the container for " + clusterId + " attempted to dispatch null message." ) ; if ( message . key == null ) throw new ContainerException ( "Message " + objectDescription ( message . message ) + " contains no key." ) ; try { numBeingWorked . incrementAndGet ( ) ; do { evictedAndBlocking = false ; final InstanceWrapper wrapper = getInstanceForKey ( message . key ) ; // wrapper will be null if the activate returns ' false ' if ( wrapper != null ) { final Object instance = wrapper . getExclusive ( block ) ; if ( instance != null ) { // null indicates we didn ' t get the lock final List < KeyedMessageWithType > response ; try { if ( wrapper . isEvicted ( ) ) { response = null ; // if we ' re not blocking then we need to just return a failure . Otherwise we want to try again // because eventually the current Mp will be passivated and removed from the container and // a subsequent call to getInstanceForDispatch will create a new one . if ( block ) { Thread . yield ( ) ; evictedAndBlocking = true ; // we ' re going to try again . } else { // otherwise it ' s just like we couldn ' t get the lock . The Mp is busy being killed off . if ( LOGGER . isTraceEnabled ( ) ) LOGGER . trace ( "the container for " + clusterId + " failed handle message due to evicted Mp " + SafeString . valueOf ( prototype ) ) ; statCollector . messageCollision ( message ) ; } } else { response = invokeOperation ( wrapper . getInstance ( ) , Operation . handle , message ) ; } } finally { wrapper . releaseLock ( ) ; } if ( response != null ) { try { dispatcher . dispatch ( response ) ; } catch ( final Exception de ) { if ( isRunning . get ( ) ) LOGGER . warn ( "Failed on subsequent dispatch of " + response + ": " + de . getLocalizedMessage ( ) ) ; } } } else { // . . . we didn ' t get the lock if ( LOGGER . isTraceEnabled ( ) ) LOGGER . trace ( "the container for " + clusterId + " failed to obtain lock on " + SafeString . valueOf ( prototype ) ) ; statCollector . messageCollision ( message ) ; } } else { // if we got here then the activate on the Mp explicitly returned ' false ' if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "the container for " + clusterId + " failed to activate the Mp for " + SafeString . valueOf ( prototype ) ) ; // we consider this " processed " break ; // leave the do / while loop } } while ( evictedAndBlocking ) ; } finally { numBeingWorked . decrementAndGet ( ) ; }
public class TbxExporter { /** * Export the TBX document to a file specified in parameter . * @ throws TransformerException */ private void exportTBXDocument ( Document tbxDocument , Writer writer ) throws TransformerException { } }
// Prepare the transformer to persist the file TransformerFactory transformerFactory = TransformerFactory . newInstance ( ) ; Transformer transformer = transformerFactory . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . ENCODING , "UTF-8" ) ; transformer . setOutputProperty ( OutputKeys . DOCTYPE_SYSTEM , "http://ttc-project.googlecode.com/files/tbxcore.dtd" ) ; transformer . setOutputProperty ( OutputKeys . STANDALONE , "yes" ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; try { transformer . setOutputProperty ( "{http://xml.apache.org/xslt}indent-amount" , "2" ) ; } catch ( IllegalArgumentException e ) { throw new TransformerException ( e ) ; } // Ignore // Actually persist the file DOMSource source = new DOMSource ( tbxDocument ) ; StreamResult result = new StreamResult ( writer ) ; transformer . transform ( source , result ) ;
public class Types { /** * Determine if the type is assignable via Java boxing / unboxing rules . */ static boolean isJavaBoxTypesAssignable ( Class lhsType , Class rhsType ) { } }
// Assignment to loose type . . . defer to bsh extensions if ( lhsType == null ) return false ; // prim can be boxed and assigned to Object if ( lhsType == Object . class ) return true ; // null rhs type corresponds to type of Primitive . NULL // assignable to any object type but not array if ( rhsType == null ) return ! lhsType . isPrimitive ( ) && ! lhsType . isArray ( ) ; // prim numeric type can be boxed and assigned to number if ( lhsType == Number . class && rhsType != Character . TYPE && rhsType != Boolean . TYPE ) return true ; // General case prim type to wrapper or vice versa . // I don ' t know if this is faster than a flat list of ' if ' s like above . // wrapperMap maps both prim to wrapper and wrapper to prim types , // so this test is symmetric if ( Primitive . wrapperMap . get ( lhsType ) == rhsType ) return true ; return isJavaBaseAssignable ( lhsType , rhsType ) ;
public class CPDefinitionOptionRelPersistenceImpl { /** * Removes all the cp definition option rels where CPDefinitionId = & # 63 ; and skuContributor = & # 63 ; from the database . * @ param CPDefinitionId the cp definition ID * @ param skuContributor the sku contributor */ @ Override public void removeByC_SC ( long CPDefinitionId , boolean skuContributor ) { } }
for ( CPDefinitionOptionRel cpDefinitionOptionRel : findByC_SC ( CPDefinitionId , skuContributor , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( cpDefinitionOptionRel ) ; }
public class QueuedKeyedResourcePool { /** * Check the given resource back into the pool * @ param key The key for the resource * @ param resource The resource */ @ Override public void checkin ( K key , V resource ) { } }
super . checkin ( key , resource ) ; // NB : Blocking checkout calls for synchronous requests get the resource // checked in above before processQueueLoop ( ) attempts checkout below . // There is therefore a risk that asynchronous requests will be starved . processQueueLoop ( key ) ;
public class Beans { /** * Prints a bean to the StringBuilder . * @ param sb a StringBuilder * @ param bean an object * @ param level indentation level * @ return the original StringBuilder * @ throws IntrospectionException if bean introspection fails by { @ link java . beans . Introspector Introspector } */ public static StringBuilder print ( StringBuilder sb , Object bean , int level ) throws IntrospectionException { } }
return print ( sb , Collections . newSetFromMap ( new IdentityHashMap < Object , Boolean > ( ) ) , bean , level ) ;
public class MulticastJournalWriter { /** * Create a Map of Maps , holding parameters for all of the transports . * @ throws JournalException */ private Map < String , Map < String , String > > parseTransportParameters ( Map < String , String > parameters ) throws JournalException { } }
Map < String , Map < String , String > > allTransports = new LinkedHashMap < String , Map < String , String > > ( ) ; for ( String key : parameters . keySet ( ) ) { if ( isTransportParameter ( key ) ) { Map < String , String > thisTransport = getThisTransportMap ( allTransports , getTransportName ( key ) ) ; thisTransport . put ( getTransportParameterName ( key ) , parameters . get ( key ) ) ; } } return allTransports ;
public class XMLDecoder { /** * Decodes a File into a Vector of LoggingEvents . * @ param url the url of a file containing events to decode * @ return Vector of LoggingEvents * @ throws IOException if IO error during processing . */ public Vector decode ( final URL url ) throws IOException { } }
LineNumberReader reader ; boolean isZipFile = url . getPath ( ) . toLowerCase ( ) . endsWith ( ".zip" ) ; InputStream inputStream ; if ( isZipFile ) { inputStream = new ZipInputStream ( url . openStream ( ) ) ; // move stream to next entry so we can read it ( ( ZipInputStream ) inputStream ) . getNextEntry ( ) ; } else { inputStream = url . openStream ( ) ; } if ( owner != null ) { reader = new LineNumberReader ( new InputStreamReader ( new ProgressMonitorInputStream ( owner , "Loading " + url , inputStream ) , ENCODING ) ) ; } else { reader = new LineNumberReader ( new InputStreamReader ( inputStream , ENCODING ) ) ; } Vector v = new Vector ( ) ; String line ; Vector events ; try { while ( ( line = reader . readLine ( ) ) != null ) { StringBuffer buffer = new StringBuffer ( line ) ; for ( int i = 0 ; i < 1000 ; i ++ ) { buffer . append ( reader . readLine ( ) ) . append ( "\n" ) ; } events = decodeEvents ( buffer . toString ( ) ) ; if ( events != null ) { v . addAll ( events ) ; } } } finally { partialEvent = null ; try { if ( reader != null ) { reader . close ( ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } return v ;
public class CorcInputFormat { /** * / * This ugliness can go when the column id can be referenced from a public place . */ static private int getOrcAtomicRowColumnId ( ) { } }
try { Field rowField = OrcRecordUpdater . class . getDeclaredField ( "ROW" ) ; rowField . setAccessible ( true ) ; int rowId = ( int ) rowField . get ( null ) ; rowField . setAccessible ( false ) ; return rowId ; } catch ( NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e ) { throw new RuntimeException ( "Could not obtain OrcRecordUpdater.ROW value." , e ) ; }
public class Storage { /** * Creating a storage . This includes loading the storageconfiguration , * building up the structure and preparing everything for login . * @ param pStorageConfig * which are used for the storage , including storage location * @ return true if creation is valid , false otherwise * @ throws TTIOException * if something odd happens within the creation process . */ public static synchronized boolean createStorage ( final StorageConfiguration pStorageConfig ) throws TTIOException { } }
boolean returnVal = true ; // if file is existing , skipping if ( ! pStorageConfig . mFile . exists ( ) && pStorageConfig . mFile . mkdirs ( ) ) { returnVal = IOUtils . createFolderStructure ( pStorageConfig . mFile , StorageConfiguration . Paths . values ( ) ) ; // serialization of the config StorageConfiguration . serialize ( pStorageConfig ) ; // if something was not correct , delete the partly created // substructure if ( ! returnVal ) { pStorageConfig . mFile . delete ( ) ; } return returnVal ; } else { return false ; }
public class AvroSchemaConverter { /** * Converts an Avro schema string into a nested row structure with deterministic field order and data * types that are compatible with Flink ' s Table & SQL API . * @ param avroSchemaString Avro schema definition string * @ return type information matching the schema */ @ SuppressWarnings ( "unchecked" ) public static < T > TypeInformation < T > convertToTypeInfo ( String avroSchemaString ) { } }
Preconditions . checkNotNull ( avroSchemaString , "Avro schema must not be null." ) ; final Schema schema ; try { schema = new Schema . Parser ( ) . parse ( avroSchemaString ) ; } catch ( SchemaParseException e ) { throw new IllegalArgumentException ( "Could not parse Avro schema string." , e ) ; } return ( TypeInformation < T > ) convertToTypeInfo ( schema ) ;
public class ArrayUtil { /** * 交换数组中两个位置的值 * @ param array 数组对象 * @ param index1 位置1 * @ param index2 位置2 * @ return 交换后的数组 , 与传入数组为同一对象 * @ since 4.0.7 */ public static Object swap ( Object array , int index1 , int index2 ) { } }
if ( isEmpty ( array ) ) { throw new IllegalArgumentException ( "Array must not empty !" ) ; } Object tmp = get ( array , index1 ) ; Array . set ( array , index1 , Array . get ( array , index2 ) ) ; Array . set ( array , index2 , tmp ) ; return array ;
public class DaemonStarter { /** * Stop the service and end the program */ public static void stopService ( ) { } }
DaemonStarter . currentPhase . set ( LifecyclePhase . STOPPING ) ; final CountDownLatch cdl = new CountDownLatch ( 1 ) ; Executors . newSingleThreadExecutor ( ) . execute ( ( ) -> { DaemonStarter . getLifecycleListener ( ) . stopping ( ) ; DaemonStarter . daemon . stop ( ) ; cdl . countDown ( ) ; } ) ; try { int timeout = DaemonStarter . lifecycleListener . get ( ) . getShutdownTimeoutSeconds ( ) ; if ( ! cdl . await ( timeout , TimeUnit . SECONDS ) ) { DaemonStarter . rlog . error ( "Failed to stop gracefully" ) ; DaemonStarter . abortSystem ( ) ; } } catch ( InterruptedException e ) { DaemonStarter . rlog . error ( "Failure awaiting stop" , e ) ; Thread . currentThread ( ) . interrupt ( ) ; }
public class KeyVaultClientBaseImpl { /** * Sets the specified certificate issuer . * The SetCertificateIssuer operation adds or updates the specified certificate issuer . This operation requires the certificates / setissuers permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ param issuerName The name of the issuer . * @ param provider The issuer provider . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the IssuerBundle object */ public Observable < IssuerBundle > setCertificateIssuerAsync ( String vaultBaseUrl , String issuerName , String provider ) { } }
return setCertificateIssuerWithServiceResponseAsync ( vaultBaseUrl , issuerName , provider ) . map ( new Func1 < ServiceResponse < IssuerBundle > , IssuerBundle > ( ) { @ Override public IssuerBundle call ( ServiceResponse < IssuerBundle > response ) { return response . body ( ) ; } } ) ;
public class PostgreSqlRepository { /** * Selects MREF IDs for an MREF attribute from the junction table , in the order of the MREF * attribute value . * @ param entityType EntityType for the entities * @ param idAttributeDataType { @ link AttributeType } of the ID attribute of the entity * @ param mrefAttr Attribute of the MREF attribute to select the values for * @ param ids { @ link Set } of { @ link Object } s containing the values for the ID attribute of the * entity * @ param refIdDataType { @ link AttributeType } of the ID attribute of the refEntity of the * attribute * @ return Multimap mapping entity ID to a list containing the MREF IDs for the values in the * attribute */ private Multimap < Object , Object > selectMrefIDsForAttribute ( EntityType entityType , AttributeType idAttributeDataType , Attribute mrefAttr , Set < Object > ids , AttributeType refIdDataType ) { } }
Stopwatch stopwatch = null ; if ( LOG . isTraceEnabled ( ) ) stopwatch = createStarted ( ) ; String junctionTableSelect = getSqlJunctionTableSelect ( entityType , mrefAttr , ids . size ( ) ) ; LOG . trace ( "SQL: {}" , junctionTableSelect ) ; Multimap < Object , Object > mrefIDs = ArrayListMultimap . create ( ) ; jdbcTemplate . query ( junctionTableSelect , getJunctionTableRowCallbackHandler ( idAttributeDataType , refIdDataType , mrefIDs ) , ids . toArray ( ) ) ; if ( LOG . isTraceEnabled ( ) ) LOG . trace ( "Selected {} ID values for MREF attribute {} in {}" , mrefIDs . values ( ) . stream ( ) . collect ( counting ( ) ) , mrefAttr . getName ( ) , stopwatch ) ; return mrefIDs ;
public class PnPInfinitesimalPlanePoseEstimation { /** * Solves the IPPE problem */ protected void IPPE ( DMatrixRMaj R1 , DMatrixRMaj R2 ) { } }
// Equation 23 - Compute R _ v from v double norm_v = Math . sqrt ( v1 * v1 + v2 * v2 ) ; if ( norm_v <= UtilEjml . EPS ) { // the plane is fronto - parallel to the camera , so set the corrective rotation Rv to identity . // There will be only one solution to pose . CommonOps_DDRM . setIdentity ( R_v ) ; } else { compute_Rv ( ) ; } // [ B | 0 ] = [ I2 | - v ] * R _ v compute_B ( B , R_v , v1 , v2 ) ; CommonOps_DDF2 . invert ( B , B ) ; // A = inv ( B ) * J CommonOps_DDF2 . mult ( B , J , A ) ; // Find the largest singular value of A double gamma = largestSingularValue2x2 ( A ) ; // Compute R22 from A CommonOps_DDF2 . scale ( 1.0 / gamma , A , R22 ) ; // B = I2 - R22 ^ T * Rss CommonOps_DDF2 . setIdentity ( B ) ; CommonOps_DDF2 . multAddTransA ( - 1 , R22 , R22 , B ) ; double b1 = Math . sqrt ( B . a11 ) ; double b2 = Math . signum ( B . a12 ) * Math . sqrt ( B . a22 ) ; // [ c ; a ] = [ R22 ; b ^ T ] * [ 1;0 ] cross [ R22 ; b ^ T ] * [ 0;1] l0 . set ( R22 . a11 , R22 . a21 , b1 ) ; l1 . set ( R22 . a12 , R22 . a22 , b2 ) ; ca . cross ( l0 , l1 ) ; // ca = [ c ; a ] // This will be the solution for the two rotation matrices // R1 = R _ v * [ R22 , + c ; b ^ T , a ] constructR ( R1 , R_v , R22 , b1 , b2 , ca , 1 , tmp ) ; constructR ( R2 , R_v , R22 , b1 , b2 , ca , - 1 , tmp ) ;
public class ContentEscape { /** * Writes the content to the response . * @ throws IOException if there is an error writing the content . */ @ Override public void escape ( ) throws IOException { } }
LOG . debug ( "...ContentEscape escape()" ) ; if ( contentAccess == null ) { LOG . warn ( "No content to output" ) ; } else { String mimeType = contentAccess . getMimeType ( ) ; Response response = getResponse ( ) ; response . setContentType ( mimeType ) ; if ( isCacheable ( ) ) { getResponse ( ) . setHeader ( "Cache-Control" , CacheType . CONTENT_CACHE . getSettings ( ) ) ; } else { getResponse ( ) . setHeader ( "Cache-Control" , CacheType . CONTENT_NO_CACHE . getSettings ( ) ) ; } if ( contentAccess . getDescription ( ) != null ) { String fileName = WebUtilities . encodeForContentDispositionHeader ( contentAccess . getDescription ( ) ) ; if ( displayInline ) { response . setHeader ( "Content-Disposition" , "inline; filename=" + fileName ) ; } else { response . setHeader ( "Content-Disposition" , "attachment; filename=" + fileName ) ; } } if ( contentAccess instanceof ContentStreamAccess ) { InputStream stream = null ; try { stream = ( ( ContentStreamAccess ) contentAccess ) . getStream ( ) ; if ( stream == null ) { throw new SystemException ( "ContentAccess returned null stream, access=" + contentAccess ) ; } StreamUtil . copy ( stream , response . getOutputStream ( ) ) ; } finally { StreamUtil . safeClose ( stream ) ; } } else { byte [ ] bytes = contentAccess . getBytes ( ) ; if ( bytes == null ) { throw new SystemException ( "ContentAccess returned null data, access=" + contentAccess ) ; } response . getOutputStream ( ) . write ( bytes ) ; } }
public class XmlElementUtils { /** * XML中Element Name / Attribute Name与Class中Class Name / Method Name中名称映射 * @ param clazz Class Name / Method Name * @ return 映射后的名称 , 例如class映射后为kwClass */ public static String mapObjectToXML ( String clazz ) { } }
for ( int i = 0 ; i < keyWordMapping . length ; i ++ ) { if ( keyWordMapping [ i ] [ 1 ] . equalsIgnoreCase ( clazz ) ) { return keyWordMapping [ i ] [ 0 ] ; } } return clazz ;
public class BPTImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setPTdoName ( String newPTdoName ) { } }
String oldPTdoName = pTdoName ; pTdoName = newPTdoName ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . BPT__PTDO_NAME , oldPTdoName , pTdoName ) ) ;
public class JsonRpcBasicServer { /** * Invokes the given method on the { @ code handler } passing * the given params ( after converting them to beans \ objects ) * to it . * @ param target optional service name used to locate the target object * to invoke the Method on * @ param method the method to invoke * @ param params the params to pass to the method * @ return the return value ( or null if no return ) * @ throws IOException on error * @ throws IllegalAccessException on error * @ throws InvocationTargetException on error */ private JsonNode invoke ( Object target , Method method , List < JsonNode > params ) throws IOException , IllegalAccessException , InvocationTargetException { } }
logger . debug ( "Invoking method: {} with args {}" , method . getName ( ) , params ) ; Object result ; if ( method . getGenericParameterTypes ( ) . length == 1 && method . isVarArgs ( ) ) { Class < ? > componentType = method . getParameterTypes ( ) [ 0 ] . getComponentType ( ) ; result = componentType . isPrimitive ( ) ? invokePrimitiveVarargs ( target , method , params , componentType ) : invokeNonPrimitiveVarargs ( target , method , params , componentType ) ; } else { Object [ ] convertedParams = convertJsonToParameters ( method , params ) ; if ( convertedParameterTransformer != null ) { convertedParams = convertedParameterTransformer . transformConvertedParameters ( target , convertedParams ) ; } result = method . invoke ( target , convertedParams ) ; } logger . debug ( "Invoked method: {}, result {}" , method . getName ( ) , result ) ; return hasReturnValue ( method ) ? mapper . valueToTree ( result ) : null ;
public class PushSource { /** * This method instructs this source to start the capture and to push * to the captured frame to the * { @ link CaptureCallback } . * @ throws StateException if the capture has already been started */ public synchronized final long startCapture ( ) throws V4L4JException { } }
if ( state != STATE_STOPPED ) throw new StateException ( "The capture has already been started" ) ; // Update our state and start the thread state = STATE_RUNNING ; thread = threadFactory . newThread ( this ) ; thread . setName ( thread . getName ( ) + " - v4l4j push source" ) ; thread . start ( ) ; return thread . getId ( ) ;
public class RestDocObject { /** * Add additional field * @ param key the field name * @ param value the field value */ @ JsonAnySetter public void setAdditionalField ( final String key , final Object value ) { } }
this . additionalFields . put ( key , value ) ;
public class BuilderFactory { /** * Return an instance of the annotation type member builder for the given * class . * @ return an instance of the annotation type member builder for the given * annotation type . */ public AbstractBuilder getAnnotationTypeRequiredMemberBuilder ( AnnotationTypeWriter annotationTypeWriter ) throws Exception { } }
return AnnotationTypeRequiredMemberBuilder . getInstance ( context , annotationTypeWriter . getAnnotationTypeDoc ( ) , writerFactory . getAnnotationTypeRequiredMemberWriter ( annotationTypeWriter ) ) ;
public class MemoryFileSystem { /** * { @ inheritDoc } */ public synchronized DirectoryEntry mkdir ( DirectoryEntry parent , String name ) { } }
parent . getClass ( ) ; parent = getNormalizedParent ( parent ) ; List < Entry > entries = getEntriesList ( parent ) ; for ( Entry entry : entries ) { if ( name . equals ( entry . getName ( ) ) ) { if ( entry instanceof DirectoryEntry ) { return ( DirectoryEntry ) entry ; } return null ; } } DirectoryEntry entry = new DefaultDirectoryEntry ( this , parent , name ) ; entries . add ( entry ) ; return entry ;
public class AuthManager { /** * Add loginListener to listen to login events * @ param listener LoginListener to receive events . */ public void addLoginListener ( LoginListener listener ) { } }
logger . debug ( "addLoginListener" ) ; Subscription subscription = loginEventPublisher . subscribeOn ( config . subscribeOn ( ) ) . observeOn ( config . observeOn ( ) ) . subscribe ( listener ) ; listener . setSubscription ( subscription ) ;
public class WebAppMain { /** * Installs log handler to monitor all Hudson logs . */ @ edu . umd . cs . findbugs . annotations . SuppressFBWarnings ( "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE" ) private void installLogger ( ) { } }
Jenkins . logRecords = handler . getView ( ) ; Logger . getLogger ( "" ) . addHandler ( handler ) ;
public class DaoScanner { /** * { @ inheritDoc } */ @ Override protected boolean isCandidateComponent ( AnnotatedBeanDefinition beanDefinition ) { } }
if ( ! beanDefinition . getMetadata ( ) . isInterface ( ) || ! beanDefinition . getMetadata ( ) . isIndependent ( ) ) return false ; String [ ] intfs = beanDefinition . getMetadata ( ) . getInterfaceNames ( ) ; if ( intfs == null || intfs . length != 1 ) return false ; return DAO_SERVICE_NAME . equals ( intfs [ 0 ] ) ;
public class IdUtils { /** * 将自增id的值设置回去 * @ param po * @ param autoGeneratedId * @ param idValue * @ throws Exception * @ throws NoSuchMethodException */ public static void setAutoIncreamentIdValue ( Object po , String autoGeneratedId , Object idValue ) throws Exception , NoSuchMethodException { } }
String setterName = "set" + StringUtils . capitalize ( autoGeneratedId ) ; Method setter = po . getClass ( ) . getDeclaredMethod ( setterName , idValue . getClass ( ) ) ; setter . invoke ( po , idValue ) ;
public class SelfExtract { /** * TODO we should revisit this logic . The validate is doing more work than is required by this method . */ protected static File findValidWlpInstallPath ( File searchDirectory , SelfExtractor extractor ) { } }
// Checks the supplied directory to see if it either IS a valid wlp install dir for this archive , or CONTAINS a valid wlp install dir // ( For core , we ' ll usually break out right away , as any new directory is valid ) if ( ( extractor . isProductAddon ( ) || extractor . isUserSample ( ) ) && extractor . validate ( searchDirectory ) != ReturnCode . OK ) { // If the install path wasn ' t valid , and we are installing a product add on it could be // that we have been given the same path as the runtime archive installer was given . In this // case liberty will actually be installed in the wlp subfolder so we need to check there too . File wlpSubdir = new File ( searchDirectory , "wlp" ) ; ReturnCode rc = extractor . validate ( wlpSubdir ) ; // The validate call does two things , it checks to see if the provided dir is liberty install // and it also validates that the archive can be installed into it . If the wlp folder isn ' t a // valid liberty install then we need to return the searchDirectory . If it is a valid directory // but it isn ' t an applicable install we want to return wlpSubdir so a later call to validate // will result in the right error message . if ( rc . getCode ( ) == ReturnCode . BAD_OUTPUT && ( "invalidInstall" . equals ( rc . getMessageKey ( ) ) || "LICENSE_invalidInstall" . equals ( rc . getMessageKey ( ) ) ) ) { return searchDirectory ; } else { return wlpSubdir ; } } return searchDirectory ;
public class XMLResource { /** * Execute the given path query on the XML , POST the returned URI expecting XML * @ param path path to the URI to follow , must be a String QName result * @ param aContent the content to POST * @ return a new resource , as a result of getting it from the server in text format * @ throws Exception */ public XMLResource xml ( XPathQuery path , Content aContent ) throws Exception { } }
String uri = path . eval ( this , String . class ) ; return xml ( uri , aContent ) ;
public class DescriptionAnnotationClassDescriptor { /** * Add the proerties of this class and the parent class * @ param clazzToAdd * @ throws IntrospectionException */ private void exploreClass ( Class < ? > clazzToAdd ) throws IntrospectionException { } }
List < InnerPropertyDescriptor > classList = getProperties ( clazzToAdd ) ; for ( InnerPropertyDescriptor descriptor : classList ) { map . put ( descriptor . getName ( ) , descriptor ) ; } this . list . addAll ( classList ) ; Class < ? > superClazz = clazzToAdd . getSuperclass ( ) ; if ( superClazz != null ) { exploreClass ( superClazz ) ; }
public class NodeReadTrx { /** * Building QName out of uri and name . The name can have the prefix denoted * with " : " ; * @ param paramUri * the namespaceuri * @ param paramName * the name including a possible prefix * @ return the QName obj */ public static final QName buildQName ( final String paramUri , final String paramName ) { } }
QName qname ; if ( paramName . contains ( ":" ) ) { qname = new QName ( paramUri , paramName . split ( ":" ) [ 1 ] , paramName . split ( ":" ) [ 0 ] ) ; } else { qname = new QName ( paramUri , paramName ) ; } return qname ;
public class SdkUtils { /** * Utilitiy method to calculate sha1 based on given inputStream . * @ param inputStream InputStream of file to calculate sha1 for . * @ return the calculated sha1 for given stream . * @ throws IOException thrown if there was issue getting stream content . * @ throws NoSuchAlgorithmException thrown if Sha - 1 algorithm implementation is not supported by OS . */ public static String sha1 ( final InputStream inputStream ) throws IOException , NoSuchAlgorithmException { } }
MessageDigest md = MessageDigest . getInstance ( "SHA-1" ) ; byte [ ] bytes = new byte [ 8192 ] ; int byteCount ; while ( ( byteCount = inputStream . read ( bytes ) ) > 0 ) { md . update ( bytes , 0 , byteCount ) ; } inputStream . close ( ) ; return new String ( encodeHex ( md . digest ( ) ) ) ;
public class WorkflowServiceImpl { /** * Lists workflows for the given correlation id . * @ param name Name of the workflow . * @ param correlationId CorrelationID of the workflow you want to start . * @ param includeClosed IncludeClosed workflow which are not running . * @ param includeTasks Includes tasks associated with workflows . * @ return a list of { @ link Workflow } */ @ Service public List < Workflow > getWorkflows ( String name , String correlationId , boolean includeClosed , boolean includeTasks ) { } }
return executionService . getWorkflowInstances ( name , correlationId , includeClosed , includeTasks ) ;
public class TurfMeta { /** * Get all coordinates from a { @ link Feature } object , returning a { @ code List } of { @ link Point } * objects . * @ param feature the { @ link Feature } that you ' d like to extract the Points from . * @ param excludeWrapCoord whether or not to include the final coordinate of LinearRings that * wraps the ring in its iteration . Used if the { @ link Feature } * passed through the method is a { @ link Polygon } or { @ link MultiPolygon } * geometry . * @ return a { @ code List } made up of { @ link Point } s * @ since 4.8.0 */ @ NonNull public static List < Point > coordAll ( @ NonNull Feature feature , @ NonNull boolean excludeWrapCoord ) { } }
return addCoordAll ( new ArrayList < Point > ( ) , feature , excludeWrapCoord ) ;
public class ExtensionStorage { /** * Helper method . */ protected void error ( Element element , String message , Object ... args ) { } }
processor . error ( element , message , args ) ;
public class InlineTaglet { /** * Register this Taglet . * @ param tagletMap the map to register this tag to . */ public static void register ( Map < String , Taglet > tagletMap ) { } }
InlineTaglet tag = new InlineTaglet ( ) ; tagletMap . put ( tag . getName ( ) , tag ) ;
public class Slf4jAdapter { /** * { @ inheritDoc } */ @ Override public void debug ( final MessageItem messageItem , final Object ... parameters ) { } }
if ( getLogger ( ) . isDebugEnabled ( messageItem . getMarker ( ) ) ) { getLogger ( ) . debug ( messageItem . getMarker ( ) , messageItem . getText ( parameters ) ) ; }