idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
23,800
private static boolean functionsAreAllowed ( boolean isAddAllFunction , boolean isPutAllFunction , Class < ? > classD , Class < ? > classS ) { if ( isAddAllFunction ) return collectionIsAssignableFrom ( classD ) && collectionIsAssignableFrom ( classS ) ; if ( isPutAllFunction ) return mapIsAssignableFrom ( classD ) && ...
Returns true if the function to check is allowed .
23,801
public static String getGenericString ( Field field ) { String fieldDescription = field . toGenericString ( ) ; List < String > splitResult = new ArrayList < String > ( ) ; char [ ] charResult = fieldDescription . toCharArray ( ) ; boolean isFinished = false ; int separatorIndex = fieldDescription . indexOf ( " " ) ; i...
Splits the fieldDescription to obtain his class type generics inclusive .
23,802
public static boolean areEqual ( Field destination , Field source ) { return getGenericString ( destination ) . equals ( getGenericString ( source ) ) ; }
Returns true if destination and source have the same structure .
23,803
public static String mapperClassName ( Class < ? > destination , Class < ? > source , String resource ) { String className = destination . getName ( ) . replaceAll ( "\\." , "" ) + source . getName ( ) . replaceAll ( "\\." , "" ) ; if ( isEmpty ( resource ) ) return className ; if ( ! isPath ( resource ) ) return write...
Returns the name of mapper that identifies the destination and source classes .
23,804
public static boolean areMappedObjects ( Class < ? > dClass , Class < ? > sClass , XML xml ) { return isMapped ( dClass , xml ) || isMapped ( sClass , xml ) ; }
returns true if almost one class is configured false otherwise .
23,805
private static boolean isMapped ( Class < ? > aClass , XML xml ) { return xml . isInheritedMapped ( aClass ) || Annotation . isInheritedMapped ( aClass ) ; }
Returns true if the class is configured in annotation or xml false otherwise .
23,806
public static List < Class < ? > > getAllsuperClasses ( Class < ? > aClass ) { List < Class < ? > > result = new ArrayList < Class < ? > > ( ) ; result . add ( aClass ) ; Class < ? > superclass = aClass . getSuperclass ( ) ; while ( ! isNull ( superclass ) && superclass != Object . class ) { result . add ( superclass )...
Returns a list with the class passed in input plus his superclasses .
23,807
public InfoOperation getInfoOperation ( final Field destination , final Field source ) { Class < ? > dClass = destination . getType ( ) ; Class < ? > sClass = source . getType ( ) ; Class < ? > dItem = null ; Class < ? > sItem = null ; InfoOperation operation = new InfoOperation ( ) . setConversionType ( UNDEFINED ) ; ...
This method calculates and returns information relating the operation to be performed .
23,808
private MapperConstructor getMapper ( String dName ) { return new MapperConstructor ( destinationType ( ) , sourceType ( ) , dName , dName , getSName ( ) , configChosen , xml , methodsToGenerate ) ; }
Returns a new instance of MapperConstructor
23,809
public Map < String , String > getMappings ( ) { HashMap < String , String > mappings = new HashMap < String , String > ( ) ; HashMap < String , Boolean > destInstance = new HashMap < String , Boolean > ( ) ; String s = "V" ; destInstance . put ( "null" , true ) ; destInstance . put ( "v" , false ) ; HashMap < String ,...
Returns a Map where the keys are the mappings names and relative values are the mappings .
23,810
private String wrappedMapping ( boolean makeDest , NullPointerControl npc , MappingType mtd , MappingType mts ) { String sClass = source . getName ( ) ; String dClass = destination . getName ( ) ; String str = ( makeDest ? " " + sClass + " " + stringOfGetSource + " = (" + sClass + ") $1;" : " " + dClass + " " + str...
This method adds the Null Pointer Control to mapping created by the mapping method . wrapMapping is used to wrap the mapping returned by mapping method .
23,811
public StringBuilder mapping ( boolean makeDest , MappingType mtd , MappingType mts ) { StringBuilder sb = new StringBuilder ( ) ; if ( isNullSetting ( makeDest , mtd , mts , sb ) ) return sb ; if ( makeDest ) sb . append ( newInstance ( destination , stringOfSetDestination ) ) ; for ( ASimpleOperation simpleOperation ...
This method writes the mapping based on the value of the three MappingType taken in input .
23,812
private < T extends AGeneralOperation > T setOperation ( T operation , MappingType mtd , MappingType mts ) { operation . setMtd ( mtd ) . setMts ( mts ) . initialDSetPath ( stringOfSetDestination ) . initialDGetPath ( stringOfGetDestination ) . initialSGetPath ( stringOfGetSource ) ; return operation ; }
Setting common to all operations .
23,813
private boolean isNullSetting ( boolean makeDest , MappingType mtd , MappingType mts , StringBuilder result ) { if ( makeDest && ( mtd == ALL_FIELDS || mtd == ONLY_VALUED_FIELDS ) && mts == ONLY_NULL_FIELDS ) { result . append ( " " + stringOfSetDestination + "(null);" + newLine ) ; return true ; } return false ; }
if it is a null setting returns the null mapping
23,814
private final StringBuilder genericFlow ( boolean newInstance ) { if ( newInstance || getMtd ( ) == ONLY_NULL_FIELDS ) return sourceControl ( fieldToCreate ( ) ) ; if ( getMtd ( ) == ALL_FIELDS && ! destinationType ( ) . isPrimitive ( ) ) return write ( " if(" , getDestination ( ) , "!=null){" , newLine , sourceContr...
This method specifies the general flow of the complex mapping .
23,815
private StringBuilder sourceControl ( StringBuilder mapping ) { if ( getMts ( ) == ALL_FIELDS && ! sourceType ( ) . isPrimitive ( ) ) { StringBuilder write = write ( " if(" , getSource ( ) , "!=null){" , newLine , sharedCode ( mapping ) , newLine , " }" ) ; if ( ! destinationType ( ) . isPrimitive ( ) && ! avoidSet...
This method is used when the MappingType of Source is setting to ALL .
23,816
public static Redirect moved ( String url , Object ... args ) { touchPayload ( ) . message ( url , args ) ; return _INSTANCE ; }
This method is deprecated
23,817
public Binder < T > attribute ( String key , Object value ) { if ( null == value ) { attributes . remove ( value ) ; } else { attributes . put ( key , value ) ; } return this ; }
Set attribute of this binder .
23,818
public Binder < T > attributes ( Map < String , Object > attributes ) { this . attributes . putAll ( attributes ) ; return this ; }
Set attributes to this binder
23,819
static boolean isPortAvailable ( int port ) { ServerSocket ss = null ; try { ss = new ServerSocket ( port ) ; ss . setReuseAddress ( true ) ; return true ; } catch ( IOException ioe ) { return false ; } finally { closeQuietly ( ss ) ; } }
Find out if the provided port is available .
23,820
public RenderBinary name ( String attachmentName ) { this . name = attachmentName ; this . disposition = Disposition . of ( S . notBlank ( attachmentName ) ) ; return this ; }
Set the attachment name .
23,821
private static void addNonHeapMetrics ( Collection < Metric < ? > > result ) { MemoryUsage memoryUsage = ManagementFactory . getMemoryMXBean ( ) . getNonHeapMemoryUsage ( ) ; result . add ( newMemoryMetric ( "nonheap.committed" , memoryUsage . getCommitted ( ) ) ) ; result . add ( newMemoryMetric ( "nonheap.init" , mem...
Add JVM non - heap metrics .
23,822
protected void addBasicMetrics ( Collection < Metric < ? > > result ) { Runtime runtime = Runtime . getRuntime ( ) ; result . add ( newMemoryMetric ( "mem" , runtime . totalMemory ( ) + getTotalNonHeapMemoryIfPossible ( ) ) ) ; result . add ( newMemoryMetric ( "mem.free" , runtime . freeMemory ( ) ) ) ; result . add ( ...
Add basic system metrics .
23,823
protected void addClassLoadingMetrics ( Collection < Metric < ? > > result ) { ClassLoadingMXBean classLoadingMxBean = ManagementFactory . getClassLoadingMXBean ( ) ; result . add ( new Metric < > ( "classes" , ( long ) classLoadingMxBean . getLoadedClassCount ( ) ) ) ; result . add ( new Metric < > ( "classes.loaded" ...
Add class loading metrics .
23,824
protected void addGarbageCollectionMetrics ( Collection < Metric < ? > > result ) { List < GarbageCollectorMXBean > garbageCollectorMxBeans = ManagementFactory . getGarbageCollectorMXBeans ( ) ; for ( GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMxBeans ) { String name = beautifyGcName ( garbageColle...
Add garbage collection metrics .
23,825
protected void addHeapMetrics ( Collection < Metric < ? > > result ) { MemoryUsage memoryUsage = ManagementFactory . getMemoryMXBean ( ) . getHeapMemoryUsage ( ) ; result . add ( newMemoryMetric ( "heap.committed" , memoryUsage . getCommitted ( ) ) ) ; result . add ( newMemoryMetric ( "heap.init" , memoryUsage . getIni...
Add JVM heap metrics .
23,826
protected void addThreadMetrics ( Collection < Metric < ? > > result ) { ThreadMXBean threadMxBean = ManagementFactory . getThreadMXBean ( ) ; result . add ( new Metric < > ( "threads.peak" , ( long ) threadMxBean . getPeakThreadCount ( ) ) ) ; result . add ( new Metric < > ( "threads.daemon" , ( long ) threadMxBean . ...
Add thread metrics .
23,827
private void addManagementMetrics ( Collection < Metric < ? > > result ) { try { result . add ( new Metric < > ( "uptime" , ManagementFactory . getRuntimeMXBean ( ) . getUptime ( ) ) ) ; result . add ( new Metric < > ( "systemload.average" , ManagementFactory . getOperatingSystemMXBean ( ) . getSystemLoadAverage ( ) ) ...
Add metrics from ManagementFactory if possible . Note that ManagementFactory is not available on Google App Engine .
23,828
public void invoke ( StartupLifecycle lifecycle ) { this . initializeAsciiLogo ( ) ; this . printLogo ( ) ; lifecycle . willInitialize ( ) ; this . logInitializationStart ( ) ; lifecycle . willCreateSpringContext ( ) ; this . initializeApplicationContext ( ) ; lifecycle . didCreateSpringContext ( this . context ) ; thi...
Start the Indoqa - Boot application and hook into the startup lifecycle .
23,829
public static void save ( ) { H . Response resp = H . Response . current ( ) ; H . Session session = H . Session . current ( ) ; serialize ( session ) ; H . Flash flash = H . Flash . current ( ) ; serialize ( flash ) ; }
Persist session and flash to cookie write all cookies to http response
23,830
private Connection connect ( ) throws SQLException { if ( DefaultContentLoader . localDataSource == null ) { LOG . error ( "Data Source is null" ) ; return null ; } final Connection conn = DataSourceUtils . getConnection ( DefaultContentLoader . localDataSource ) ; if ( conn == null ) { LOG . error ( "Connection is nul...
Establish a connection to underlying db .
23,831
protected RequestData initializeRequestData ( final MessageContext messageContext ) { RequestData requestData = new RequestData ( ) ; requestData . setMsgContext ( messageContext ) ; String contextUsername = ( String ) messageContext . getProperty ( SECUREMENT_USER_PROPERTY_NAME ) ; if ( StringUtils . hasLength ( conte...
Creates and initializes a request data for the given message context .
23,832
protected void checkResults ( final List < WSSecurityEngineResult > results , final List < Integer > validationActions ) throws Wss4jSecurityValidationException { if ( ! handler . checkReceiverResultsAnyOrder ( results , validationActions ) ) { throw new Wss4jSecurityValidationException ( "Security processing failed (a...
Checks whether the received headers match the configured validation actions . Subclasses could override this method for custom verification behavior .
23,833
@ SuppressWarnings ( "unchecked" ) private void updateContextWithResults ( final MessageContext messageContext , final WSHandlerResult result ) { List < WSHandlerResult > handlerResults ; if ( ( handlerResults = ( List < WSHandlerResult > ) messageContext . getProperty ( WSHandlerConstants . RECV_RESULTS ) ) == null ) ...
Puts the results of WS - Security headers processing in the message context . Some actions like Signature Confirmation require this .
23,834
protected void verifyCertificateTrust ( WSHandlerResult result ) throws WSSecurityException { List < WSSecurityEngineResult > signResults = result . getActionResults ( ) . getOrDefault ( WSConstants . SIGN , emptyList ( ) ) ; if ( signResults . isEmpty ( ) ) { throw new Wss4jSecurityValidationException ( "No action res...
Verifies the trust of a certificate .
23,835
protected void verifyTimestamp ( WSHandlerResult result ) throws WSSecurityException { List < WSSecurityEngineResult > insertTimestampResults = result . getActionResults ( ) . getOrDefault ( WSConstants . TS , emptyList ( ) ) ; if ( insertTimestampResults . isEmpty ( ) ) { throw new Wss4jSecurityValidationException ( "...
Verifies the timestamp .
23,836
public static void addMissingColumns ( SQLiteDatabase database , Class contractClass ) { Contract contract = new Contract ( contractClass ) ; Cursor cursor = database . rawQuery ( "PRAGMA table_info(" + contract . getTable ( ) + ")" , null ) ; for ( ContractField field : contract . getFields ( ) ) { if ( ! fieldExistAs...
Adds missing table columns for the given contract class .
23,837
public TableBuilder addConstraint ( String columnName , String constraintType , String constraintConflictClause ) { constraints . add ( new Constraint ( columnName , constraintType , constraintConflictClause ) ) ; return this ; }
Adds the specified constraint to the created table .
23,838
public static Predicate < ColumnModel > allOf ( final Predicate < ColumnModel > ... conditions ) { return ( cM ) -> Arrays . stream ( conditions ) . allMatch ( c -> c . test ( cM ) ) ; }
A condition that returns true if all of the provided conditions return true . Equivalent to logical AND operator .
23,839
public static Predicate < ColumnModel > anyOf ( final Predicate < ColumnModel > ... conditions ) { return ( cM ) -> Arrays . stream ( conditions ) . anyMatch ( c -> c . test ( cM ) ) ; }
A condition that returns true if any of the provided conditions return true . Equivalent to logical OR operator .
23,840
public static Predicate < ColumnModel > oneOf ( final Predicate < ColumnModel > ... conditions ) { return ( cM ) -> Arrays . stream ( conditions ) . map ( c -> c . test ( cM ) ) . filter ( b -> b ) . count ( ) == 1 ; }
A condition that returns true if exactly one of the provided conditions return true . Equivalent to logical XOR operator .
23,841
public < T extends RedGEntity > T getDummy ( final AbstractRedG redG , final Class < T > dummyClass ) { if ( this . dummyCache . containsKey ( dummyClass ) ) { return dummyClass . cast ( this . dummyCache . get ( dummyClass ) ) ; } final T obj = createNewDummy ( redG , dummyClass ) ; this . dummyCache . put ( dummyClas...
Returns a dummy entity for the requested type . All this method guarantees is that the returned entity is a valid entity with all non null foreign key relations filled in it does not guarantee useful or even semantically correct data . The dummy objects get taken either from the list of objects to insert from the redG ...
23,842
private boolean hasTemplate ( String href ) { if ( href == null ) { return false ; } return URI_TEMPLATE_PATTERN . matcher ( href ) . find ( ) ; }
Determine whether the argument href contains at least one URI template as defined in RFC 6570 .
23,843
private static void processJoinTables ( final List < TableModel > result , final Map < String , Map < Table , List < String > > > joinTableMetadata ) { joinTableMetadata . entrySet ( ) . forEach ( entry -> { LOG . debug ( "Processing join tables for {}. Found {} join tables to process" , entry . getKey ( ) , entry . ge...
Processes the information about the join tables that were collected during table model extraction .
23,844
private static Map < String , Map < Table , List < String > > > mergeJoinTableMetadata ( Map < String , Map < Table , List < String > > > data , Map < String , Map < Table , List < String > > > extension ) { for ( String key : extension . keySet ( ) ) { Map < Table , List < String > > dataForTable = data . get ( key ) ...
Performs a deep - merge on the two provided maps integrating everything from the second map into the first and returning the first map .
23,845
private String validatePath ( String path , int line ) throws ParseException { if ( ! path . startsWith ( "/" ) ) { throw new ParseException ( "Path must start with '/'" , line ) ; } boolean openedKey = false ; for ( int i = 0 ; i < path . length ( ) ; i ++ ) { boolean validChar = isValidCharForPath ( path . charAt ( i...
Helper method . It validates if the path is valid .
23,846
private boolean isValidCharForPath ( char c , boolean openedKey ) { char [ ] invalidChars = { '?' , '#' , ' ' } ; for ( char invalidChar : invalidChars ) { if ( c == invalidChar ) { return false ; } } if ( openedKey ) { char [ ] moreInvalidChars = { '/' , '{' } ; for ( char invalidChar : moreInvalidChars ) { if ( c == ...
Helper method . Tells if a char is valid in a the path of a route line .
23,847
public static void notEmpty ( String value , String message ) throws IllegalArgumentException { if ( value == null || "" . equals ( value . trim ( ) ) ) { throw new IllegalArgumentException ( "A precondition failed: " + message ) ; } }
Checks that a string is not null or empty .
23,848
protected void initPathVariables ( String routePath ) { pathVariables . clear ( ) ; List < String > variables = getVariables ( routePath ) ; String regexPath = routePath . replaceAll ( Path . VAR_REGEXP , Path . VAR_REPLACE ) ; Matcher matcher = Pattern . compile ( "(?i)" + regexPath ) . matcher ( getPath ( ) ) ; match...
Helper method . Initializes the pathVariables property of this class .
23,849
private List < String > getVariables ( String routePath ) { List < String > variables = new ArrayList < String > ( ) ; Matcher matcher = Pattern . compile ( Path . VAR_REGEXP ) . matcher ( routePath ) ; while ( matcher . find ( ) ) { variables . add ( matcher . group ( 1 ) ) ; } return variables ; }
Helper method . Retrieves all the variables defined in the path .
23,850
public ConfigurationBuilder withRemoteSocket ( String host , int port ) { configuration . connector = new NioSocketConnector ( ) ; configuration . address = new InetSocketAddress ( host , port ) ; return this ; }
Use a TCP connection for remotely connecting to the IT - 100 .
23,851
public ConfigurationBuilder withSerialPort ( String serialPort , int baudRate ) { configuration . connector = new SerialConnector ( ) ; configuration . address = new SerialAddress ( serialPort , baudRate , DataBits . DATABITS_8 , StopBits . BITS_1 , Parity . NONE , FlowControl . NONE ) ; return this ; }
Use a local serial port for communicating with the IT - 100 .
23,852
public Configuration build ( ) { if ( configuration . connector == null || configuration . address == null ) { throw new IllegalArgumentException ( "You must call either withRemoteSocket or withSerialPort." ) ; } return configuration ; }
Create an immutable Configuration instance .
23,853
public static Catalog crawlDatabase ( final Connection connection , final InclusionRule schemaRule , final InclusionRule tableRule ) throws SchemaCrawlerException { final SchemaCrawlerOptions options = SchemaCrawlerOptionsBuilder . builder ( ) . withSchemaInfoLevel ( SchemaInfoLevelBuilder . standard ( ) . setRetrieveI...
Starts the schema crawler and lets it crawl the given JDBC connection .
23,854
public String generateMainClass ( final Collection < TableModel > tables , final boolean enableVisualizationSupport ) { Objects . requireNonNull ( tables ) ; final String targetPackage = ( ( TableModel ) tables . toArray ( ) [ 0 ] ) . getPackageName ( ) ; final ST template = this . stGroup . getInstanceOf ( "mainClass"...
Generates the main class used for creating the extractor objects and later generating the insert statements . For each passed table a appropriate creation method will be generated that will return the new object and internally add it to the list of objects that will be used to generate the insert strings
23,855
public RedGBuilder < T > withDefaultValueStrategy ( final DefaultValueStrategy strategy ) { if ( instance == null ) { throw new IllegalStateException ( "Using the builder after build() was called is not allowed!" ) ; } instance . setDefaultValueStrategy ( strategy ) ; return this ; }
Sets the default value strategy
23,856
public RedGBuilder < T > withPreparedStatementParameterSetter ( final PreparedStatementParameterSetter setter ) { if ( instance == null ) { throw new IllegalStateException ( "Using the builder after build() was called is not allowed!" ) ; } instance . setPreparedStatementParameterSetter ( setter ) ; return this ; }
Sets the PreparedStatement parameter setter
23,857
public RedGBuilder < T > withSqlValuesFormatter ( final SQLValuesFormatter formatter ) { if ( instance == null ) { throw new IllegalStateException ( "Using the builder after build() was called is not allowed!" ) ; } instance . setSqlValuesFormatter ( formatter ) ; return this ; }
Sets the SQL values formatter
23,858
public RedGBuilder < T > withDummyFactory ( final DummyFactory dummyFactory ) { if ( instance == null ) { throw new IllegalStateException ( "Using the builder after build() was called is not allowed!" ) ; } instance . setDummyFactory ( dummyFactory ) ; return this ; }
Sets the dummy factory
23,859
private boolean isOneOf ( char ch , final char [ ] charray ) { boolean result = false ; for ( int i = 0 ; i < charray . length ; i ++ ) { if ( ch == charray [ i ] ) { result = true ; break ; } } return result ; }
Tests if the given character is present in the array of characters .
23,860
public static String get ( ) { String env = System . getProperty ( "JOGGER_ENV" ) ; if ( env == null ) { env = System . getenv ( "JOGGER_ENV" ) ; } if ( env == null ) { return "dev" ; } return env ; }
Retrieves the environment in which Jogger is working .
23,861
public List < String > generateSQLStatements ( ) { return getEntitiesSortedForInsert ( ) . stream ( ) . map ( RedGEntity :: getSQLString ) . collect ( Collectors . toList ( ) ) ; }
Returns a list of insert statements one for each added entity in the respective order they were added .
23,862
public String getMethodNameForReference ( final ForeignKey foreignKey ) { final Column c = foreignKey . getColumnReferences ( ) . get ( 0 ) . getForeignKeyColumn ( ) ; if ( foreignKey . getColumnReferences ( ) . size ( ) == 1 ) { return getMethodNameForColumn ( c ) + getClassNameForTable ( c . getReferencedColumn ( ) ....
Generates an appropriate method name for a foreign key
23,863
public void handle ( Request request , Response response ) throws Exception { if ( Environment . isDevelopment ( ) ) { this . middlewares = this . middlewareFactory . create ( ) ; } try { handle ( request , response , new ArrayList < Middleware > ( Arrays . asList ( middlewares ) ) ) ; } catch ( Exception e ) { if ( ex...
Handles an HTTP request by delgating the call to the middlewares .
23,864
private synchronized void performReliableSubscription ( ) { if ( subscriberTimer == null ) { LOGGER . info ( "Initializing reliable subscriber" ) ; subscriberTimer = createTimerInternal ( ) ; ExponentialBackOff backOff = new ExponentialBackOff . Builder ( ) . setMaxElapsedTimeMillis ( Integer . MAX_VALUE ) . setMaxInte...
Task that performs Subscription .
23,865
protected Mesos startInternal ( ) { String version = System . getenv ( "MESOS_API_VERSION" ) ; if ( version == null ) { version = "V0" ; } LOGGER . info ( "Using Mesos API version: {}" , version ) ; if ( version . equals ( "V0" ) ) { if ( credential == null ) { return new V0Mesos ( this , frameworkInfo , master ) ; } e...
Broken out into a separate function to allow testing with custom Mesos implementations .
23,866
public TableModel extractTableModel ( final Table table ) { Objects . requireNonNull ( table ) ; final TableModel model = new TableModel ( ) ; model . setClassName ( this . classPrefix + this . nameProvider . getClassNameForTable ( table ) ) ; model . setName ( this . nameProvider . getClassNameForTable ( table ) ) ; m...
Extracts the table model from a single table . Every table this table references via foreign keys must be fully loaded otherwise an exception will be thrown .
23,867
private ServletRequest init ( ) throws MultipartException , IOException { if ( Multipart . isMultipartContent ( request ) ) { Multipart multipart = new Multipart ( ) ; multipart . parse ( request , new PartHandler ( ) { public void handleFormItem ( String name , String value ) { multipartParams . put ( name , value ) ;...
Initializes the path variables and the multipart content .
23,868
private String fixRequestPath ( String path ) { return path . endsWith ( "/" ) ? path . substring ( 0 , path . length ( ) - 1 ) : path ; }
Helper method . The request path shouldn t have a trailing slash .
23,869
private List < Interceptor > getInterceptors ( String path ) { List < Interceptor > ret = new ArrayList < Interceptor > ( ) ; for ( InterceptorEntry entry : getInterceptors ( ) ) { if ( matches ( path , entry . getPaths ( ) ) ) { ret . add ( entry . getInterceptor ( ) ) ; } } return ret ; }
Returns a list of interceptors that match a path
23,870
private boolean matchesPath ( String routePath , String pathToMatch ) { routePath = routePath . replaceAll ( Path . VAR_REGEXP , Path . VAR_REPLACE ) ; return pathToMatch . matches ( "(?i)" + routePath ) ; }
Helper method . Tells if the the HTTP path matches the route path .
23,871
public static boolean isMultipartContent ( HttpServletRequest request ) { if ( ! "post" . equals ( request . getMethod ( ) . toLowerCase ( ) ) ) { return false ; } String contentType = request . getContentType ( ) ; if ( contentType == null ) { return false ; } if ( contentType . toLowerCase ( ) . startsWith ( MULTIPAR...
Tells if a request is multipart or not .
23,872
protected Map < String , String > getHeadersMap ( String headerPart ) { final int len = headerPart . length ( ) ; final Map < String , String > headers = new HashMap < String , String > ( ) ; int start = 0 ; for ( ; ; ) { int end = parseEndOfLine ( headerPart , start ) ; if ( start == end ) { break ; } String header = ...
Retreives a map with the headers of a part .
23,873
private String getFieldName ( String contentDisposition ) { String fieldName = null ; if ( contentDisposition != null && contentDisposition . toLowerCase ( ) . startsWith ( FORM_DATA ) ) { ParameterParser parser = new ParameterParser ( ) ; parser . setLowerCaseNames ( true ) ; Map < String , String > params = parser . ...
Retrieves the name of the field from the Content - Disposition header of the part .
23,874
protected byte [ ] getBoundary ( String contentType ) { ParameterParser parser = new ParameterParser ( ) ; parser . setLowerCaseNames ( true ) ; Map < String , String > params = parser . parse ( contentType , new char [ ] { ';' , ',' } ) ; String boundaryStr = ( String ) params . get ( "boundary" ) ; if ( boundaryStr =...
Retrieves the boundary that is used to separate the request parts from the Content - Type header .
23,875
private String getFileName ( String contentDisposition ) { String fileName = null ; if ( contentDisposition != null ) { String cdl = contentDisposition . toLowerCase ( ) ; if ( cdl . startsWith ( FORM_DATA ) || cdl . startsWith ( ATTACHMENT ) ) { ParameterParser parser = new ParameterParser ( ) ; parser . setLowerCaseN...
Retrieves the file name of a file from the filename attribute of the Content - Disposition header of the part .
23,876
public void connect ( ) throws Exception { final IT100CodecFactory it100CodecFactory = new IT100CodecFactory ( ) ; final ProtocolCodecFilter protocolCodecFilter = new ProtocolCodecFilter ( it100CodecFactory ) ; final CommandLogFilter loggingFilter = new CommandLogFilter ( LOGGER , Level . DEBUG ) ; final PollKeepAliveF...
Begin communicating with the IT - 100 .
23,877
public void disconnect ( ) throws Exception { if ( session != null ) { session . getCloseFuture ( ) . awaitUninterruptibly ( ) ; } if ( connector != null ) { connector . dispose ( ) ; } }
Stop communicating with the IT - 100 and release the port .
23,878
public static int registerBitSize ( final long expectedUniqueElements ) { return Math . max ( HLL . MINIMUM_REGWIDTH_PARAM , ( int ) Math . ceil ( NumberUtil . log2 ( NumberUtil . log2 ( expectedUniqueElements ) ) ) ) ; }
Computes the bit - width of HLL registers necessary to estimate a set of the specified cardinality .
23,879
public static double alphaMSquared ( final int m ) { switch ( m ) { case 1 : case 2 : case 4 : case 8 : throw new IllegalArgumentException ( "'m' cannot be less than 16 (" + m + " < 16)." ) ; case 16 : return 0.673 * m * m ; case 32 : return 0.697 * m * m ; case 64 : return 0.709 * m * m ; default : return ( 0.7213 / (...
Computes the alpha - m - squared constant used by the HyperLogLog algorithm .
23,880
public long cardinality ( ) { switch ( type ) { case EMPTY : return 0 ; case EXPLICIT : return explicitStorage . size ( ) ; case SPARSE : return ( long ) Math . ceil ( sparseProbabilisticAlgorithmCardinality ( ) ) ; case FULL : return ( long ) Math . ceil ( fullProbabilisticAlgorithmCardinality ( ) ) ; default : throw ...
Computes the cardinality of the HLL .
23,881
public void union ( final HLL other ) { final HLLType otherType = other . getType ( ) ; if ( type . equals ( otherType ) ) { homogeneousUnion ( other ) ; return ; } else { heterogenousUnion ( other ) ; return ; } }
Computes the union of HLLs and stores the result in this instance .
23,882
private void homogeneousUnion ( final HLL other ) { switch ( type ) { case EMPTY : return ; case EXPLICIT : for ( final long value : other . explicitStorage ) { addRaw ( value ) ; } return ; case SPARSE : for ( final int registerIndex : other . sparseProbabilisticStorage . keySet ( ) ) { final byte registerValue = othe...
Computes the union of two HLLs of the same type and stores the result in this instance .
23,883
public byte [ ] toBytes ( final ISchemaVersion schemaVersion ) { final byte [ ] bytes ; switch ( type ) { case EMPTY : bytes = new byte [ schemaVersion . paddingBytes ( type ) ] ; break ; case EXPLICIT : { final IWordSerializer serializer = schemaVersion . getSerializer ( type , Long . SIZE , explicitStorage . size ( )...
Serializes the HLL to an array of bytes in correspondence with the format of the specified schema version .
23,884
public void getRegisterContents ( final IWordSerializer serializer ) { for ( final LongIterator iter = registerIterator ( ) ; iter . hasNext ( ) ; ) { serializer . writeWord ( iter . next ( ) ) ; } }
Serializes the registers of the vector using the specified serializer .
23,885
private static Date parseDate ( @ SuppressWarnings ( "SameParameterValue" ) String stringDate ) { try { return formatter . parse ( stringDate ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; return null ; } }
Helper method used to parse a date in string format . Meant to encapsulate the error handling .
23,886
protected MavenPomDescriptor createMavenPomDescriptor ( Model model , Scanner scanner ) { ScannerContext context = scanner . getContext ( ) ; MavenPomDescriptor pomDescriptor = context . peek ( MavenPomDescriptor . class ) ; if ( model instanceof EffectiveModel ) { context . getStore ( ) . addDescriptorType ( pomDescri...
Create the descriptor and set base information .
23,887
private void addActivation ( MavenProfileDescriptor mavenProfileDescriptor , Activation activation , Store store ) { if ( null == activation ) { return ; } MavenProfileActivationDescriptor profileActivationDescriptor = store . create ( MavenProfileActivationDescriptor . class ) ; mavenProfileDescriptor . setActivation ...
Adds activation information for the given profile .
23,888
private void addConfiguration ( ConfigurableDescriptor configurableDescriptor , Xpp3Dom config , Store store ) { if ( null == config ) { return ; } MavenConfigurationDescriptor configDescriptor = store . create ( MavenConfigurationDescriptor . class ) ; configurableDescriptor . setConfiguration ( configDescriptor ) ; X...
Adds configuration information .
23,889
private < P extends MavenDependentDescriptor , D extends AbstractDependencyDescriptor > List < MavenDependencyDescriptor > getDependencies ( P dependent , List < Dependency > dependencies , Class < D > dependsOnType , ScannerContext scannerContext ) { Store store = scannerContext . getStore ( ) ; List < MavenDependency...
Adds information about artifact dependencies .
23,890
private void addExecutionGoals ( MavenPluginExecutionDescriptor executionDescriptor , PluginExecution pluginExecution , Store store ) { List < String > goals = pluginExecution . getGoals ( ) ; for ( String goal : goals ) { MavenExecutionGoalDescriptor goalDescriptor = store . create ( MavenExecutionGoalDescriptor . cla...
Adds information about execution goals .
23,891
private void addLicenses ( MavenPomDescriptor pomDescriptor , Model model , Store store ) { List < License > licenses = model . getLicenses ( ) ; for ( License license : licenses ) { MavenLicenseDescriptor licenseDescriptor = store . create ( MavenLicenseDescriptor . class ) ; licenseDescriptor . setUrl ( license . get...
Adds information about references licenses .
23,892
private void addDevelopers ( MavenPomDescriptor pomDescriptor , Model model , Store store ) { List < Developer > developers = model . getDevelopers ( ) ; for ( Developer developer : developers ) { MavenDeveloperDescriptor developerDescriptor = store . create ( MavenDeveloperDescriptor . class ) ; developerDescriptor . ...
Adds information about developers .
23,893
private List < MavenDependencyDescriptor > addManagedDependencies ( MavenDependentDescriptor pomDescriptor , DependencyManagement dependencyManagement , ScannerContext scannerContext , Class < ? extends AbstractDependencyDescriptor > relationClass ) { if ( dependencyManagement == null ) { return Collections . emptyList...
Adds dependency management information .
23,894
private void addManagedPlugins ( BaseProfileDescriptor pomDescriptor , BuildBase build , ScannerContext scannerContext ) { if ( null == build ) { return ; } PluginManagement pluginManagement = build . getPluginManagement ( ) ; if ( null == pluginManagement ) { return ; } List < MavenPluginDescriptor > pluginDescriptors...
Adds information about managed plugins .
23,895
private List < MavenPluginDescriptor > createMavenPluginDescriptors ( List < Plugin > plugins , ScannerContext context ) { Store store = context . getStore ( ) ; List < MavenPluginDescriptor > pluginDescriptors = new ArrayList < > ( ) ; for ( Plugin plugin : plugins ) { MavenPluginDescriptor mavenPluginDescriptor = sto...
Create plugin descriptors for the given plugins .
23,896
private void addModules ( BaseProfileDescriptor pomDescriptor , List < String > modules , Store store ) { for ( String module : modules ) { MavenModuleDescriptor moduleDescriptor = store . create ( MavenModuleDescriptor . class ) ; moduleDescriptor . setName ( module ) ; pomDescriptor . getModules ( ) . add ( moduleDes...
Adds information about referenced modules .
23,897
private void addParent ( MavenPomDescriptor pomDescriptor , Model model , ScannerContext context ) { Parent parent = model . getParent ( ) ; if ( null != parent ) { ArtifactResolver resolver = getArtifactResolver ( context ) ; MavenArtifactDescriptor parentDescriptor = resolver . resolve ( new ParentCoordinates ( paren...
Adds information about parent POM .
23,898
private void addPluginExecutions ( MavenPluginDescriptor mavenPluginDescriptor , Plugin plugin , Store store ) { List < PluginExecution > executions = plugin . getExecutions ( ) ; for ( PluginExecution pluginExecution : executions ) { MavenPluginExecutionDescriptor executionDescriptor = store . create ( MavenPluginExec...
Adds information about plugin executions .
23,899
private void addPlugins ( BaseProfileDescriptor pomDescriptor , BuildBase build , ScannerContext scannerContext ) { if ( null == build ) { return ; } List < Plugin > plugins = build . getPlugins ( ) ; List < MavenPluginDescriptor > pluginDescriptors = createMavenPluginDescriptors ( plugins , scannerContext ) ; pomDescr...
Adds information about plugins .