idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
139,400 | private void addToArray ( JsonNode j ) { if ( j instanceof ArrayNode ) { for ( Iterator < JsonNode > itr = ( ( ArrayNode ) j ) . elements ( ) ; itr . hasNext ( ) ; ) { addToArray ( itr . next ( ) ) ; } } else { ( ( ArrayNode ) node ) . add ( j ) ; } } | Adds p into this array projection |
139,401 | public int getFeaturePosition ( AbstractFeature feature ) { AbstractFeature result = feature ; if ( ! featurePositions . containsKey ( feature ) ) { if ( feature instanceof FeatureGroup ) { FeatureGroup featureGroup = ( FeatureGroup ) feature ; List < Feature > features = featureGroup . getConcreteFeatures ( ) ; if ( !... | Returns the absolute position of the feature or create if not exists |
139,402 | public List < Product > getSortedProducts ( ) { ArrayList < Product > result = new ArrayList < > ( pcm . getProducts ( ) ) ; Collections . sort ( result , new Comparator < Product > ( ) { public int compare ( Product o1 , Product o2 ) { Integer op1 = getProductPosition ( o1 ) ; Integer op2 = getProductPosition ( o2 ) ;... | Return the sorted products concordingly with metadata |
139,403 | public List < Feature > getSortedFeatures ( ) { ArrayList < Feature > result = new ArrayList < > ( pcm . getConcreteFeatures ( ) ) ; Collections . sort ( result , new Comparator < Feature > ( ) { public int compare ( Feature f1 , Feature f2 ) { Integer fp1 = getFeaturePosition ( f1 ) ; Integer fp2 = getFeaturePosition ... | Return the sorted features concordingly with metadata |
139,404 | public FacetBuilder setItemsList ( Map < String , String > items ) { ArrayList < FacetWidgetItem > facetWidgetItems = new ArrayList < FacetWidgetItem > ( ) ; for ( String key : items . keySet ( ) ) { String label = items . get ( key ) ; FacetWidgetItem facetWidgetItem = new FacetWidgetItem ( key , label ) ; facetWidget... | Takes a map of value to labels and the unique name of the list |
139,405 | public void updateRuleBasicInfo ( ValidationRule rule ) { this . orderIdx = rule . orderIdx ; this . parentDependency = rule . parentDependency ; this . standardValueType = rule . standardValueType ; this . validationCheck = rule . validationCheck ; this . overlapBanRuleName = rule . overlapBanRuleName ; this . assistT... | Update rule basic info . |
139,406 | public boolean isUse ( ) { if ( ! this . use ) { return this . use ; } return ! ( this . standardValueType != null && ! this . standardValueType . equals ( StandardValueType . NONE ) && this . standardValue == null ) ; } | Is use boolean . |
139,407 | public boolean isUsedMyRule ( ValidationData item ) { List < ValidationRule > usedRules = item . getValidationRules ( ) ; if ( usedRules == null || usedRules . isEmpty ( ) ) { return false ; } return usedRules . stream ( ) . filter ( ur -> ur . getRuleName ( ) . equals ( this . ruleName ) && ur . isUse ( ) ) . findAny ... | Is used my rule boolean . |
139,408 | public List < ValidationData > filter ( List < ValidationData > allList ) { return allList . stream ( ) . filter ( vd -> this . isUsedMyRule ( vd ) ) . collect ( Collectors . toList ( ) ) ; } | Filter list . |
139,409 | public void updateMethodKey ( ) { Arrays . stream ( ParamType . values ( ) ) . forEach ( paramType -> this . syncMethodKey ( paramType ) ) ; this . validationDataRepository . flush ( ) ; this . validationStore . refresh ( ) ; log . info ( "[METHOD_KEY_SYNC] Complete" ) ; } | Update method key . |
139,410 | public void setSelected ( String s ) { for ( int i = 0 ; i < listBox . getItemCount ( ) ; i ++ ) { if ( listBox . getItemText ( i ) . equals ( s ) ) listBox . setSelectedIndex ( i ) ; } } | Given a string will find an item in the list box with matching text and select it . |
139,411 | public Panel draw ( TemplateViewNodesConfig config , RecordList recordList ) { final TemplateViewNodesConfig . TemplateNode rootTemplateNode = config . getRootTemplateNode ( ) ; if ( rootTemplateNode == null ) { throw new IllegalArgumentException ( "RootTemplate node is empty" ) ; } Panel panel = draw ( rootTemplateNod... | call this with config to initialize the view |
139,412 | private VerticalPanel fixedWidthAndHeightPanel ( ) { final VerticalPanel verticalPanel = new VerticalPanel ( ) ; verticalPanel . setHeight ( "300px" ) ; verticalPanel . setWidth ( "500px" ) ; return verticalPanel ; } | Need fix width and height to ensure info widget panel is drawn correctly |
139,413 | protected void initNewThread ( Path monitoredFile , CountDownLatch start , CountDownLatch stop ) throws IOException { final Runnable watcher = initializeWatcherWithDirectory ( monitoredFile , start , stop ) ; final Thread thread = new Thread ( watcher ) ; thread . setDaemon ( false ) ; thread . start ( ) ; } | Added countdown latches as a synchronization aid to allow better unit testing Allows one or more threads to wait until a set of operations being performed in other threads completes |
139,414 | public void initSynchronous ( Path monitoredFile ) throws IOException { final Runnable watcher = initializeWatcherWithDirectory ( monitoredFile , new CountDownLatch ( 1 ) , new CountDownLatch ( 1 ) ) ; watcher . run ( ) ; } | A blocking method to start begin the monitoring of a directory only exists on thread interrupt |
139,415 | protected static void registerGraphiteMetricObserver ( List < MetricObserver > observers , String prefix , String host , String port ) { if ( null == host || host . trim ( ) . isEmpty ( ) ) { LOGGER . info ( "GraphiteMetricObserver not configured, missing environment variable: {}" , ENV_GRAPHITE_HOSTNAME ) ; return ; }... | If there is sufficient configuration register a Graphite observer to publish metrics . Requires at a minimum a host . Optionally can set prefix as well as port . The prefix defaults to the host and port defaults to 2004 . |
139,416 | protected static void registerStatsdMetricObserver ( List < MetricObserver > observers , String prefix , String host , String port ) { if ( null == host || host . trim ( ) . isEmpty ( ) ) { LOGGER . info ( "StatdsMetricObserver not configured, missing environment variable: {}" , ENV_STATSD_HOSTNAME ) ; return ; } LOGGE... | If there is sufficient configuration register a StatsD metric observer to publish metrics . Requires at a minimum a host . Optionally can set prefix as well as port . The prefix defaults to an empty string and port defaults to 8125 . |
139,417 | private static String findVariable ( String key ) { String value = System . getProperty ( key ) ; if ( value == null ) { return System . getenv ( key ) ; } return value ; } | Looks for the value of the key as a key firstly as a JVM argument and if not found to an environment variable . If still not found then null is returned . |
139,418 | public void addOverrideMap ( Map < String , String > overrideMap ) { if ( sealed ) { throw new IllegalStateException ( "Instance is sealed." ) ; } for ( Map . Entry < String , String > entry : overrideMap . entrySet ( ) ) { try { ParameterOverrideInfo info = new ParameterOverrideInfo ( entry . getKey ( ) ) ; if ( info ... | Adds map containing parameter override definitions . Can be called multiple times . New calls do not override settings from previous calls only add new settings . Thus maps with highest priority should be added first . |
139,419 | public void seal ( ) { lockedParameterNamesSet = ImmutableSet . copyOf ( lockedParameterNamesSet ) ; lockedParameterNamesScopeMap = ImmutableMap . copyOf ( Maps . transformValues ( lockedParameterNamesScopeMap , new Function < Set < String > , Set < String > > ( ) { public Set < String > apply ( Set < String > input ) ... | Make all maps and sets immutable . |
139,420 | public String getOverrideForce ( String configurationId , String parameterName ) { Map < String , String > overrideForceScopeMapEntry = overrideForceScopeMap . get ( configurationId ) ; if ( overrideForceScopeMapEntry != null ) { return overrideForceScopeMapEntry . get ( parameterName ) ; } return null ; } | Lookup force override for given configuration Id . |
139,421 | public Set < String > getLockedParameterNames ( String configurationId ) { Set < String > lockedParameterNamesScopeMapEntry = lockedParameterNamesScopeMap . get ( configurationId ) ; if ( lockedParameterNamesScopeMapEntry != null ) { return lockedParameterNamesScopeMapEntry ; } else { return ImmutableSet . of ( ) ; } } | Get locked parameter names for specific configuration Id . |
139,422 | @ GetMapping ( "/setting/download/api/json/all" ) public void downloadApiJsonAll ( HttpServletRequest req , HttpServletResponse res ) { this . validationSessionComponent . sessionCheck ( req ) ; List < ValidationData > list = this . msgSettingService . getAllValidationData ( ) ; ValidationFileUtil . sendFileToHttpServi... | Download api json all . |
139,423 | @ GetMapping ( "/setting/download/api/json" ) public void downloadApiJson ( HttpServletRequest req , @ RequestParam ( "method" ) String method , @ RequestParam ( "url" ) String url , HttpServletResponse res ) { this . validationSessionComponent . sessionCheck ( req ) ; url = new String ( Base64 . getDecoder ( ) . decod... | Download api json . |
139,424 | @ GetMapping ( "/setting/download/api/excel/all" ) public void downloadApiAll ( HttpServletRequest req , HttpServletResponse res ) { this . validationSessionComponent . sessionCheck ( req ) ; PoiWorkBook workBook = this . msgExcelService . getAllExcels ( ) ; workBook . writeFile ( "ValidationApis_" + System . currentTi... | Download api all . |
139,425 | @ GetMapping ( "/setting/download/api/excel" ) public void downloadApi ( HttpServletRequest req , @ RequestParam ( "method" ) String method , @ RequestParam ( "url" ) String url , HttpServletResponse res ) { this . validationSessionComponent . sessionCheck ( req ) ; url = new String ( Base64 . getDecoder ( ) . decode (... | Download api . |
139,426 | @ PostMapping ( "/setting/upload/json" ) public void uploadSetting ( HttpServletRequest req ) { this . validationSessionComponent . sessionCheck ( req ) ; this . msgSettingService . updateValidationData ( ( MultipartHttpServletRequest ) req ) ; } | Upload setting . |
139,427 | @ GetMapping ( "/setting/url/list/all" ) public List < ReqUrl > reqUrlAllList ( HttpServletRequest req ) { this . validationSessionComponent . sessionCheck ( req ) ; return this . msgSettingService . getAllUrlList ( ) ; } | Req url all list list . |
139,428 | @ GetMapping ( "/setting/param/from/url" ) public List < ValidationData > getValidationDataLists ( HttpServletRequest req ) { this . validationSessionComponent . sessionCheck ( req ) ; ValidationData data = ParameterMapper . requestParamaterToObject ( req , ValidationData . class , "UTF-8" ) ; return this . msgSettingS... | Gets validation data lists . |
139,429 | private int transactionToIndex ( T t ) { Integer r = allTransactions . absoluteIndexOf ( t ) ; return r == null ? - 1 : r . intValue ( ) ; } | maps a transaction to its index and returns - 1 if not found |
139,430 | private int itemToIndex ( I i ) { Integer r = allItems . absoluteIndexOf ( i ) ; return r == null ? - 1 : r . intValue ( ) ; } | maps an item to its index and returns - 1 if not found |
139,431 | public boolean add ( T transaction , I item ) { return matrix . add ( transactionToIndex ( transaction ) , itemToIndex ( item ) ) ; } | Adds a single transaction - item pair |
139,432 | public boolean contains ( T transaction , I item ) { int t = transactionToIndex ( transaction ) ; if ( t < 0 ) return false ; int i = itemToIndex ( item ) ; if ( i < 0 ) return false ; return matrix . contains ( t , i ) ; } | Checks if the given transaction - item pair is contained within the set |
139,433 | public boolean remove ( T transaction , I item ) { return matrix . remove ( transactionToIndex ( transaction ) , itemToIndex ( item ) ) ; } | Removes a single transaction - item pair |
139,434 | public boolean removeAll ( Collection < T > trans , Collection < I > items ) { if ( trans == null || trans . isEmpty ( ) || items == null || items . isEmpty ( ) ) return false ; return matrix . removeAll ( allTransactions . convert ( trans ) . indices ( ) , allItems . convert ( items ) . indices ( ) ) ; } | Removes the pairs obtained from the Cartesian product of transactions and items |
139,435 | public boolean retainAll ( Collection < T > trans , I item ) { if ( isEmpty ( ) ) return false ; if ( trans == null || trans . isEmpty ( ) || item == null ) { clear ( ) ; return true ; } return matrix . retainAll ( allTransactions . convert ( trans ) . indices ( ) , itemToIndex ( item ) ) ; } | Retains the pairs obtained from the Cartesian product of transactions and items |
139,436 | public IndexedSet < I > itemsOf ( T transaction ) { IndexedSet < I > res = allItems . empty ( ) ; res . indices ( ) . addAll ( matrix . getRow ( transactionToIndex ( transaction ) ) ) ; return res ; } | Lists all items contained within a given transaction |
139,437 | public IndexedSet < T > transactionsOf ( I item ) { IndexedSet < T > res = allTransactions . empty ( ) ; res . indices ( ) . addAll ( matrix . getCol ( itemToIndex ( item ) ) ) ; return res ; } | Lists all transactions involved with a specified item |
139,438 | private List < File > unTar ( final File inputFile , final File outputDir ) throws FileNotFoundException , IOException , ArchiveException { _log . info ( String . format ( "Untaring %s to dir %s." , inputFile . getAbsolutePath ( ) , outputDir . getAbsolutePath ( ) ) ) ; final List < File > untaredFiles = new LinkedList... | Untar an input file into an output file . |
139,439 | private void updateLoockup ( ) { synchronized ( parameterOverrideProviders ) { ParameterOverrideInfoLookup newLookup = new ParameterOverrideInfoLookup ( ) ; for ( ParameterOverrideProvider provider : parameterOverrideProviders ) { newLookup . addOverrideMap ( provider . getOverrideMap ( ) ) ; } newLookup . seal ( ) ; l... | Update lookup maps with override maps from all override providers . |
139,440 | public static void load ( ) { if ( ! isLoaded ( ) ) { ScriptInjector . fromString ( LocalForageResources . INSTANCE . js ( ) . getText ( ) ) . setWindow ( ScriptInjector . TOP_WINDOW ) . inject ( ) ; } } | Loads the offline library . You normally never have to do this manually |
139,441 | public static void resetCounters ( ) { unionCount = intersectionCount = differenceCount = symmetricDifferenceCount = complementCount = unionSizeCount = intersectionSizeCount = differenceSizeCount = symmetricDifferenceSizeCount = complementSizeCount = equalsCount = hashCodeCount = containsAllCount = containsAnyCount = c... | Resets all counters |
139,442 | public void setMarkers ( List < GenericMarker > m ) { this . markers = m ; for ( GenericMarker marker : m ) { marker . setMap ( this ) ; } clusterMarkers ( ) ; } | Set markers would be a better description of this method behaviour effectively replaces the references to all markers |
139,443 | public static void load ( ) { if ( ! isLoaded ( ) ) { ScriptInjector . fromString ( OpenLayersV3Resources . INSTANCE . js ( ) . getText ( ) ) . setWindow ( ScriptInjector . TOP_WINDOW ) . inject ( ) ; StyleInjector . injectStylesheetAtStart ( OpenLayersV3Resources . INSTANCE . css ( ) . getText ( ) ) ; } } | Loads the offline library . |
139,444 | protected void display ( ) { new FilterPresenter ( new FilterViewUI ( ) ) . go ( layout ) ; resultPresenter = new ResultPresenter ( getResultView ( ) ) ; loadStatusListener . registerObserver ( resultPresenter ) ; resultPresenter . go ( layout ) ; } | Display home screen |
139,445 | public BaseValidationCheck getValidationChecker ( ValidationRule rule ) { ValidationRule existRule = this . rules . stream ( ) . filter ( r -> r . getRuleName ( ) . equals ( rule . getRuleName ( ) ) ) . findFirst ( ) . orElse ( null ) ; if ( existRule == null ) { throw new ValidationLibException ( "rulename : " + rule ... | Gets validation checker . |
139,446 | public synchronized ValidationRuleStore addRule ( ValidationRule rule ) { rule . setOrderIdx ( this . rules . size ( ) ) ; this . rules . add ( rule ) ; this . checkHashMap . put ( rule . getRuleName ( ) , rule . getValidationCheck ( ) ) ; return this ; } | Add rule validation rule store . |
139,447 | private static PCM clear_ligne ( PCM pcm , PCM pcm_return ) { List < Product > pdts = pcm . getProducts ( ) ; List < Cell > cells = new ArrayList < Cell > ( ) ; for ( Product pr : pdts ) { float nbCellsEmpty = 0 ; cells = pr . getCells ( ) ; for ( Cell c : cells ) { if ( c . getContent ( ) . isEmpty ( ) ) { nbCellsEmpt... | Enlever les lignes inutiles |
139,448 | private static PCM clear_colonne ( PCM pcm , PCM pcm_return ) { List < Feature > pdts = pcm . getConcreteFeatures ( ) ; List < Cell > cells = new ArrayList < Cell > ( ) ; for ( Feature pr : pdts ) { float nbCellsEmpty = 0 ; cells = pr . getCells ( ) ; for ( Cell c : cells ) { if ( c . getContent ( ) . isEmpty ( ) ) { n... | Enlever les colonnes inutiles |
139,449 | public boolean sameFeature ( JFeature f ) { return this . name . equals ( f . name ) && this . type . equals ( f . type ) ; } | Compares the name and type of the 2 features |
139,450 | public static void nodeWalker ( NodeList childNodes , NodeElementParser parser ) throws ParseException { for ( int i = 0 ; i < childNodes . getLength ( ) ; i ++ ) { Node item = childNodes . item ( i ) ; String node = item . getNodeName ( ) ; if ( item . getNodeType ( ) == Node . ELEMENT_NODE ) { parser . parse ( item )... | nodeWalker walker implementation simple depth first recursive implementation |
139,451 | protected boolean isObject ( String text ) { final String trim = text . trim ( ) ; return trim . startsWith ( "{" ) && trim . endsWith ( "}" ) ; } | Checks if the serialized content is a JSON Object . |
139,452 | @ SuppressWarnings ( "unchecked" ) protected < D > void evalResponse ( Request request , Deferred < D > deferred , Class < D > resolveType , Class < ? > parametrizedType , RawResponse response ) { if ( parametrizedType != null ) { processor . process ( request , response , parametrizedType , ( Class < Collection > ) re... | Evaluates the response and resolves the deferred . This method must be called by implementations after the response is received . |
139,453 | private void assertNotNull ( Object value , String message ) throws IllegalArgumentException { if ( value == null ) { throw new IllegalArgumentException ( message ) ; } } | Assert that the value is not null . |
139,454 | public List < ReqUrl > getUrlList ( ) { List < ReqUrl > reqUrls = new ArrayList < > ( ) ; for ( String key : this . methodAndUrlIndex . getMap ( ) . keySet ( ) ) { List < ValidationData > datas = this . methodAndUrlIndex . getMap ( ) . get ( key ) ; if ( ! datas . isEmpty ( ) ) { reqUrls . add ( new ReqUrl ( datas . ge... | Gets url list . |
139,455 | public ValidationData findById ( Long id ) { List < ValidationData > datas = this . idIndex . get ( ValidationIndexUtil . makeKey ( String . valueOf ( id ) ) ) ; if ( datas . isEmpty ( ) ) { return null ; } return datas . get ( 0 ) ; } | Find by id validation data . |
139,456 | public void addIndex ( ValidationData data ) { for ( ValidationDataIndex idx : this . idxs ) { ValidationIndexUtil . addIndexData ( data , idx ) ; } } | Add index . |
139,457 | public void removeIndex ( ValidationData data ) { for ( ValidationDataIndex idx : this . idxs ) { ValidationIndexUtil . removeIndexData ( data , idx ) ; } } | Remove index . |
139,458 | public void updateFromFile ( MultipartFile file ) { ObjectMapper objectMapper = ValidationObjUtil . getDefaultObjectMapper ( ) ; try { String jsonStr = new String ( file . getBytes ( ) , "UTF-8" ) ; List < ValidationData > list = objectMapper . readValue ( jsonStr , objectMapper . getTypeFactory ( ) . constructCollecti... | Update from file . |
139,459 | public static boolean isNotScanClass ( String className ) { String block = BASIC_PACKAGE_PREFIX_LIST . stream ( ) . filter ( prefix -> className . startsWith ( prefix ) ) . findAny ( ) . orElse ( null ) ; return block != null ; } | Is not scan class boolean . |
139,460 | public static boolean isObjClass ( Class < ? > type ) { if ( type . isPrimitive ( ) || type . isEnum ( ) || type . isArray ( ) ) { return false ; } String block = BASIC_PACKAGE_PREFIX_LIST . stream ( ) . filter ( prefix -> type . getName ( ) . startsWith ( prefix ) ) . findAny ( ) . orElse ( null ) ; if ( block != null... | Is obj class boolean . |
139,461 | public static boolean isListClass ( Class < ? > type ) { if ( type . isPrimitive ( ) || type . isEnum ( ) ) { return false ; } return type . equals ( List . class ) ; } | Is list class boolean . |
139,462 | public void initBeans ( Object [ ] beans ) { this . controllers = Arrays . stream ( beans ) . filter ( bean -> this . getController ( bean ) != null ) . map ( bean -> this . getController ( bean ) ) . collect ( Collectors . toList ( ) ) ; } | Init beans . |
139,463 | public List < DetailParam > getParameterFromMethodWithAnnotation ( Class < ? > parentClass , Method method , Class < ? > annotationClass ) { List < DetailParam > params = new ArrayList < > ( ) ; if ( method . getParameterCount ( ) < 1 ) { return params ; } for ( Parameter param : method . getParameters ( ) ) { Annotati... | Gets parameter from method with annotation . |
139,464 | public List < DetailParam > getParameterFromClassWithAnnotation ( Class < ? > baseClass , Class < ? > annotationClass ) { List < DetailParam > params = new ArrayList < > ( ) ; Arrays . stream ( baseClass . getDeclaredMethods ( ) ) . forEach ( method -> params . addAll ( this . getParameterFromMethodWithAnnotation ( bas... | Gets parameter from class with annotation . |
139,465 | public List < DetailParam > getParameterWithAnnotation ( Class < ? > annotation ) { List < DetailParam > params = new ArrayList < > ( ) ; this . controllers . stream ( ) . forEach ( cla -> params . addAll ( this . getParameterFromClassWithAnnotation ( cla , annotation ) ) ) ; return params ; } | Gets parameter with annotation . |
139,466 | public Row nextRow ( int cnt ) { Row lastrow = null ; for ( int i = 0 ; i < cnt ; i ++ ) { lastrow = this . nextRow ( ) ; } return lastrow ; } | Next row row . |
139,467 | public List < Cell > createTitleCells ( String ... strs ) { List < Cell > cells = new ArrayList < > ( ) ; for ( String s : strs ) { Cell cell = this . createTitleCell ( s , DEFAULT_WIDTH ) ; cells . add ( cell ) ; } return cells ; } | Create title cells list . |
139,468 | public void createTitleCells ( double width , String ... strs ) { for ( String s : strs ) { this . createTitleCell ( s , width ) ; } } | Create title cells . |
139,469 | public Cell createTitleCell ( String str , double width ) { int cellCnt = this . getCellCnt ( ) ; Cell cell = this . getLastRow ( ) . createCell ( cellCnt ) ; cell . setCellValue ( str ) ; cell . setCellType ( CellType . STRING ) ; cell . setCellStyle ( this . style . getStringCs ( ) ) ; sheet . setColumnWidth ( cellCn... | Create title cell cell . |
139,470 | public void createValueCells ( Object ... values ) { for ( Object value : values ) { if ( value == null ) { this . createCell ( "" ) ; continue ; } if ( value instanceof String ) { this . createCell ( ( String ) value ) ; } else if ( value instanceof Date ) { this . createCell ( ( Date ) value ) ; } else if ( Validatio... | Create value cells . |
139,471 | private String printStackTrace ( Object [ ] stackTrace ) { StringBuilder output = new StringBuilder ( ) ; for ( Object line : stackTrace ) { output . append ( line ) ; output . append ( newline ) ; } return output . toString ( ) ; } | Given a stack trace turn it into a HTML formatted string - to improve its display |
139,472 | public IndexedSet < T > universe ( ) { IntSet allItems = indices . empty ( ) ; allItems . fill ( 0 , indexToItem . length - 1 ) ; return createFromIndices ( allItems ) ; } | Returns the collection of all possible elements |
139,473 | boolean expiringSoon ( TokenInfo info ) { return Double . valueOf ( info . getExpires ( ) ) < ( clock . now ( ) + TEN_MINUTES ) ; } | Returns whether or not the token will be expiring within the next ten minutes . |
139,474 | public DataBulkRequest insertBefore ( CRUDRequest request , CRUDRequest before ) { this . requests . add ( requests . indexOf ( before ) , request ) ; return this ; } | Inserts a request before another specified request . This guarantees that the first request parameter will be executed sequentially before the second request parameter . It does not guarantee consecutive execution . |
139,475 | public DataBulkRequest insertAfter ( CRUDRequest request , CRUDRequest after ) { this . requests . add ( requests . indexOf ( after ) + 1 , request ) ; return this ; } | Inserts a request after another specified request . This guarantees that the first request parameter will be executed sequentially after the second request parameter . It does not guarantee consecutive execution . |
139,476 | public static String readFileToString ( File file , final Charset charset ) throws IOException { String line = null ; BufferedReader reader = getBufferReader ( file , charset ) ; StringBuffer strBuffer = new StringBuffer ( ) ; while ( ( line = reader . readLine ( ) ) != null ) { strBuffer . append ( line ) ; } return s... | Read file to string string . |
139,477 | public static void writeStringToFile ( File file , String content ) throws IOException { OutputStream outputStream = getOutputStream ( file ) ; outputStream . write ( content . getBytes ( ) ) ; } | Write string to file . |
139,478 | public static String getEncodingFileName ( String fn ) { try { return URLEncoder . encode ( fn , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { throw new ValidationLibException ( "unSupported fiel encoding : " + e . getMessage ( ) , HttpStatus . INTERNAL_SERVER_ERROR ) ; } } | Gets encoding file name . |
139,479 | public static void initFileSendHeader ( HttpServletResponse res , String filename , String contentType ) { filename = getEncodingFileName ( filename ) ; if ( contentType != null ) { res . setContentType ( contentType ) ; } else { res . setContentType ( "applicaiton/download;charset=utf-8" ) ; } res . setHeader ( "Conte... | Init file send header . |
139,480 | public static DataError fromJson ( ObjectNode node ) { DataError error = new DataError ( ) ; JsonNode x = node . get ( "data" ) ; if ( x != null ) { error . entityData = x ; } x = node . get ( "errors" ) ; if ( x instanceof ArrayNode ) { error . errors = new ArrayList < > ( ) ; for ( Iterator < JsonNode > itr = ( ( Arr... | Parses a Json object node and returns the DataError corresponding to it . It is up to the client to make sure that the object node is a DataError representation . Any unrecognized elements are ignored . |
139,481 | public static DataError findErrorForDoc ( List < DataError > list , JsonNode node ) { for ( DataError x : list ) { if ( x . entityData == node ) { return x ; } } return null ; } | Returns the data error for the given json doc in the list |
139,482 | public void setMarkers ( QueryResult queryResult ) { mapWidget . clearMarkers ( ) ; RecordList recordList = queryResult . getRecordList ( ) ; List < RecordList . Record > records = recordList . getRecords ( ) ; List < GenericMarker > markers = new ArrayList < GenericMarker > ( ) ; final MarkerCoordinateSource markerCoo... | Contain logic for getting records building marker from results Called on start and when filters are changed |
139,483 | public Uri getUri ( ) { if ( uri == null ) { try { uri = uriBuilder . build ( ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Could not build the URI." , e ) ; } } return uri ; } | Get the URI identifying the resource . |
139,484 | private < T > void setupMarkerFixedNoRepeatHack ( GoogleV3Marker < T > genericMarker ) { final Marker marker1 = genericMarker . getMarker ( ) ; final LatLng [ ] initialPosition = new LatLng [ 1 ] ; marker1 . addDragStartHandler ( new DragStartMapHandler ( ) { public void onEvent ( DragStartMapEvent dragStartMapEvent ) ... | Prevent marker from repeating horizontally by setting marker drag and adjusting drag behaviour to reset |
139,485 | public void setComparator ( Column < T , ? > column , Comparator < T > comparator ) { columnSortHandler . setComparator ( column , comparator ) ; } | Sets a comparator to use when sorting the given column |
139,486 | String toUrl ( Auth . UrlCodex urlCodex ) { return new StringBuilder ( authUrl ) . append ( authUrl . contains ( "?" ) ? "&" : "?" ) . append ( "client_id" ) . append ( "=" ) . append ( urlCodex . encode ( clientId ) ) . append ( "&" ) . append ( "response_type" ) . append ( "=" ) . append ( "token" ) . append ( "&" ) ... | Returns a URL representation of this request appending the client ID and scopes to the original authUrl . |
139,487 | public synchronized static < T > T get ( Class < T > cType ) { if ( map . get ( cType ) != null ) { return cType . cast ( map . get ( cType ) ) ; } try { Object obj = cType . newInstance ( ) ; log . debug ( "[CREATE INSTANCE] : " + cType . getSimpleName ( ) ) ; map . put ( cType , obj ) ; return cType . cast ( obj ) ; ... | Get t . |
139,488 | public WriteStreamOld openWrite ( ) { if ( _cb != null ) _cb . clear ( ) ; else _cb = CharBuffer . allocate ( ) ; if ( _ws == null ) _ws = new WriteStreamOld ( this ) ; else _ws . init ( this ) ; try { _ws . setEncoding ( "utf-8" ) ; } catch ( UnsupportedEncodingException e ) { } return _ws ; } | Opens a write stream using this StringWriter as the resulting string |
139,489 | public void write ( byte [ ] buf , int offset , int length , boolean isEnd ) throws IOException { int end = offset + length ; while ( offset < end ) { int ch1 = buf [ offset ++ ] & 0xff ; if ( ch1 < 0x80 ) _cb . append ( ( char ) ch1 ) ; else if ( ( ch1 & 0xe0 ) == 0xc0 ) { if ( offset >= end ) throw new EOFException (... | Writes a utf - 8 encoded buffer to the underlying string . |
139,490 | public List < String > extractMetricNames ( ) { List < String > result = new ArrayList < > ( ) ; for ( MonitoringRule rule : monitoringRules . getMonitoringRules ( ) ) { for ( Action action : rule . getActions ( ) . getActions ( ) ) { if ( action . getName ( ) . equalsIgnoreCase ( "OutputMetric" ) ) { for ( Parameter p... | Helper method to extract metric names from Monitoring Rules |
139,491 | public static String escapeHtml ( String s ) { if ( s == null ) return null ; StringBuilder cb = new StringBuilder ( ) ; int lineCharacter = 0 ; boolean startsWithSpace = false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; lineCharacter ++ ; if ( ch == '<' ) cb . append ( "<" ) ; els... | Escapes special symbols in a string . For example < becomes < ; |
139,492 | public static void inc ( byte [ ] nonce , byte value ) { int i = nonce . length - 1 ; nonce [ i ] += value ; if ( value > 0 && ( nonce [ i ] < 0 || nonce [ i ] >= value ) ) return ; if ( value < 0 && ( nonce [ i ] < 0 && nonce [ i ] >= value ) ) return ; for ( i = i - 1 ; i >= 0 ; i -- ) { nonce [ i ] ++ ; if ( nonce [... | Increases nonce by value which is used as an unsigned byte value . |
139,493 | public < T > T run ( long timeout , TimeUnit unit , Consumer < Result < T > > task ) { try ( OutboxAmp outbox = OutboxAmp . currentOrCreate ( this ) ) { ResultFuture < T > future = new ResultFuture < > ( ) ; task . accept ( future ) ; return future . get ( timeout , unit ) ; } } | Run a task that returns a future in an outbox context . |
139,494 | public String address ( Class < ? > api , String address ) { Objects . requireNonNull ( address ) ; if ( address . isEmpty ( ) ) { address = addressDefault ( api ) ; } int slash = address . indexOf ( "/" ) ; if ( address . endsWith ( ":" ) && slash < 0 ) { address += "//" ; } int p = address . indexOf ( "://" ) ; int q... | Calculate address from an API with an address default |
139,495 | public ServiceRefAmp bind ( ServiceRefAmp service , String address ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( L . l ( "bind {0} for {1} in {2}" , address , service . api ( ) . getType ( ) , this ) ) ; } address = toCanonical ( address ) ; registry ( ) . bind ( address , service ) ; return service ;... | Publish reusing the mailbox for an existing service . |
139,496 | private boolean isSeedHeartbeatValid ( ) { boolean isSeed = false ; for ( ServerHeartbeat server : _serverSelf . getCluster ( ) . getSeedServers ( ) ) { if ( server . port ( ) > 0 ) { isSeed = true ; if ( server . isUp ( ) ) { return true ; } } } return ! isSeed ; } | Returns true if one of the cluster seeds is an active server . |
139,497 | public UpdateRackHeartbeat join ( String extAddress , int extPort , String clusterId , String address , int port , int portBartender , String displayName , String serverHash , int seedIndex ) { Objects . requireNonNull ( extAddress ) ; Objects . requireNonNull ( address ) ; ClusterHeartbeat cluster = _root . findCluste... | joinServer message to an external configured address from a new server including SelfServer . |
139,498 | private void joinSelf ( ServerHeartbeat server , String extAddress , int extPort , String address , int port , String serverHash ) { if ( server != _serverSelf ) { throw new IllegalStateException ( L . l ( "Invalid self: {0} vs {1}" , server , _serverSelf ) ) ; } if ( ! serverHash . equals ( _serverSelf . getMachineHas... | received a join from this server . Used to update external IPs . |
139,499 | public void hubHeartbeat ( UpdateServerHeartbeat updateServer , UpdateRackHeartbeat updateRack , UpdatePodSystem updatePod , long sourceTime ) { RackHeartbeat rack = getCluster ( ) . findRack ( updateRack . getId ( ) ) ; if ( rack == null ) { rack = getRack ( ) ; } updateRack ( updateRack ) ; updateServerStart ( update... | Heartbeat from a hub server includes the heartbeat status of its rack . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.