idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
36,600
protected String getMetricName ( Map < String , String > metadata , String eventName ) { return JOINER . join ( METRIC_KEY_PREFIX , metadata . get ( METADATA_JOB_ID ) , metadata . get ( METADATA_TASK_ID ) , EVENTS_QUALIFIER , eventName ) ; }
Constructs the metric key to be emitted . The actual event name is enriched with the current job and task id to be able to keep track of its origin
36,601
public static < T extends Serializable > byte [ ] serializeIntoBytes ( T obj ) throws IOException { try ( ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( bos ) ) { oos . writeObject ( obj ) ; oos . flush ( ) ; return bos . toByteArray ( ) ; } }
Serialize an object into a byte array .
36,602
private < T extends URNIdentified > Stream < T > sortStreamLexicographically ( Stream < T > inputStream ) { Spliterator < T > spliterator = inputStream . spliterator ( ) ; if ( spliterator . hasCharacteristics ( Spliterator . SORTED ) && spliterator . getComparator ( ) . equals ( this . lexicographicalComparator ) ) { ...
Sort input stream lexicographically . Noop if the input stream is already sorted .
36,603
public void clean ( ) throws IOException { Path versionLocation = ( ( HivePartitionRetentionVersion ) this . datasetVersion ) . getLocation ( ) ; Path datasetLocation = ( ( CleanableHivePartitionDataset ) this . cleanableDataset ) . getLocation ( ) ; String completeName = ( ( HivePartitionRetentionVersion ) this . data...
If simulate is set to true will simply return . If a version is pointing to a non - existing location then drop the partition and close the jdbc connection . If a version is pointing to the same location as of the dataset then drop the partition and close the jdbc connection . If a version is staging it s data will be ...
36,604
public static List < Properties > loadGenericJobConfigs ( Properties sysProps ) throws ConfigurationException , IOException { Path rootPath = new Path ( sysProps . getProperty ( ConfigurationKeys . JOB_CONFIG_FILE_GENERAL_PATH_KEY ) ) ; PullFileLoader loader = new PullFileLoader ( rootPath , rootPath . getFileSystem ( ...
Load job configuration from job configuration files stored in general file system located by Path
36,605
public static Properties loadGenericJobConfig ( Properties sysProps , Path jobConfigPath , Path jobConfigPathDir ) throws ConfigurationException , IOException { PullFileLoader loader = new PullFileLoader ( jobConfigPathDir , jobConfigPathDir . getFileSystem ( new Configuration ( ) ) , getJobConfigurationFileExtensions ...
Load a given job configuration file from a general file system .
36,606
protected State getRuntimePropsEnrichedTblProps ( ) { State tableProps = new State ( this . props . getTablePartitionProps ( ) ) ; if ( this . props . getRuntimeTableProps ( ) . isPresent ( ) ) { tableProps . setProp ( HiveMetaStoreUtils . RUNTIME_PROPS , this . props . getRuntimeTableProps ( ) . get ( ) ) ; } return t...
Enrich the table - level properties with properties carried over from ingestion runtime . Extend this class to add more runtime properties if required .
36,607
protected static boolean isNameValid ( String name ) { Preconditions . checkNotNull ( name ) ; name = name . toLowerCase ( ) ; return VALID_DB_TABLE_NAME_PATTERN_1 . matcher ( name ) . matches ( ) && VALID_DB_TABLE_NAME_PATTERN_2 . matcher ( name ) . matches ( ) ; }
Determine whether a database or table name is valid .
36,608
private void movePos ( float deltaY ) { if ( ( deltaY < 0 && mPtrIndicator . isInStartPosition ( ) ) ) { if ( DEBUG ) { PtrCLog . e ( LOG_TAG , String . format ( "has reached the top" ) ) ; } return ; } int to = mPtrIndicator . getCurrentPosY ( ) + ( int ) deltaY ; if ( mPtrIndicator . willOverTop ( to ) ) { if ( DEBUG...
if deltaY > 0 move the content down
36,609
public void setRefreshCompleteHook ( PtrUIHandlerHook hook ) { mRefreshCompleteHook = hook ; hook . setResumeAction ( new Runnable ( ) { public void run ( ) { if ( DEBUG ) { PtrCLog . d ( LOG_TAG , "mRefreshCompleteHook resume." ) ; } notifyUIRefreshComplete ( true ) ; } } ) ; }
please DO REMEMBER resume the hook
36,610
private boolean tryToNotifyReset ( ) { if ( ( mStatus == PTR_STATUS_COMPLETE || mStatus == PTR_STATUS_PREPARE ) && mPtrIndicator . isInStartPosition ( ) ) { if ( mPtrUIHandlerHolder . hasHandler ( ) ) { mPtrUIHandlerHolder . onUIReset ( this ) ; if ( DEBUG ) { PtrCLog . i ( LOG_TAG , "PtrUIHandler: onUIReset" ) ; } } m...
If at the top and not in loading reset
36,611
private void notifyUIRefreshComplete ( boolean ignoreHook ) { if ( mPtrIndicator . hasLeftStartPosition ( ) && ! ignoreHook && mRefreshCompleteHook != null ) { if ( DEBUG ) { PtrCLog . d ( LOG_TAG , "notifyUIRefreshComplete mRefreshCompleteHook run." ) ; } mRefreshCompleteHook . takeOver ( ) ; return ; } if ( mPtrUIHan...
Do real refresh work . If there is a hook execute the hook first .
36,612
public static WaitStrategy join ( WaitStrategy ... waitStrategies ) { Preconditions . checkState ( waitStrategies . length > 0 , "Must have at least one wait strategy" ) ; List < WaitStrategy > waitStrategyList = Lists . newArrayList ( waitStrategies ) ; Preconditions . checkState ( ! waitStrategyList . contains ( null...
Joins one or more wait strategies to derive a composite wait strategy . The new joined strategy will have a wait time which is total of all wait times computed one after another in order .
36,613
public Retryer < V > build ( ) { AttemptTimeLimiter < V > theAttemptTimeLimiter = attemptTimeLimiter == null ? AttemptTimeLimiters . < V > noTimeLimit ( ) : attemptTimeLimiter ; StopStrategy theStopStrategy = stopStrategy == null ? StopStrategies . neverStop ( ) : stopStrategy ; WaitStrategy theWaitStrategy = waitStrat...
Builds the retryer .
36,614
public V call ( Callable < V > callable ) throws ExecutionException , RetryException { long startTime = System . nanoTime ( ) ; for ( int attemptNumber = 1 ; ; attemptNumber ++ ) { Attempt < V > attempt ; try { V result = attemptTimeLimiter . call ( callable ) ; attempt = new ResultAttempt < V > ( result , attemptNumbe...
Executes the given callable . If the rejection predicate accepts the attempt the stop strategy is used to decide if a new attempt must be made . Then the wait strategy is used to decide how much time to sleep and a new attempt is made .
36,615
public static void convertActivityToTranslucentBeforeL ( Activity activity ) { try { Class < ? > [ ] classes = Activity . class . getDeclaredClasses ( ) ; Class < ? > translucentConversionListenerClazz = null ; for ( Class clazz : classes ) { if ( clazz . getSimpleName ( ) . contains ( "TranslucentConversionListener" )...
Calling the convertToTranslucent method on platforms before Android 5 . 0
36,616
private static void convertActivityToTranslucentAfterL ( Activity activity ) { try { Method getActivityOptions = Activity . class . getDeclaredMethod ( "getActivityOptions" ) ; getActivityOptions . setAccessible ( true ) ; Object options = getActivityOptions . invoke ( activity ) ; Class < ? > [ ] classes = Activity . ...
Calling the convertToTranslucent method on platforms after Android 5 . 0
36,617
public void addSwipeListener ( SwipeListener listener ) { if ( mListeners == null ) { mListeners = new ArrayList < SwipeListener > ( ) ; } mListeners . add ( listener ) ; }
Add a callback to be invoked when a swipe event is sent to this view .
36,618
public void setShadow ( Drawable shadow , int edgeFlag ) { if ( ( edgeFlag & EDGE_LEFT ) != 0 ) { mShadowLeft = shadow ; } else if ( ( edgeFlag & EDGE_RIGHT ) != 0 ) { mShadowRight = shadow ; } else if ( ( edgeFlag & EDGE_BOTTOM ) != 0 ) { mShadowBottom = shadow ; } invalidate ( ) ; }
Set a drawable used for edge shadow .
36,619
public void scrollToFinishActivity ( ) { final int childWidth = mContentView . getWidth ( ) ; final int childHeight = mContentView . getHeight ( ) ; int left = 0 , top = 0 ; if ( ( mEdgeFlag & EDGE_LEFT ) != 0 ) { left = childWidth + mShadowLeft . getIntrinsicWidth ( ) + OVERSCROLL_DISTANCE ; mTrackingEdge = EDGE_LEFT ...
Scroll out contentView and finish the activity
36,620
public void setSensitivity ( Context context , float sensitivity ) { float s = Math . max ( 0f , Math . min ( 1.0f , sensitivity ) ) ; ViewConfiguration viewConfiguration = ViewConfiguration . get ( context ) ; mTouchSlop = ( int ) ( viewConfiguration . getScaledTouchSlop ( ) * ( 1 / s ) ) ; }
Sets the sensitivity of the dragger .
36,621
boolean isPreferredAddress ( InetAddress address ) { if ( this . properties . isUseOnlySiteLocalInterfaces ( ) ) { final boolean siteLocalAddress = address . isSiteLocalAddress ( ) ; if ( ! siteLocalAddress ) { this . log . trace ( "Ignoring address: " + address . getHostAddress ( ) ) ; } return siteLocalAddress ; } fi...
For testing .
36,622
public Rectangle closeRectFor ( final int tabIndex ) { final Rectangle rect = rects [ tabIndex ] ; final int x = rect . x + rect . width - CLOSE_ICON_WIDTH - CLOSE_ICON_RIGHT_MARGIN ; final int y = rect . y + ( rect . height - CLOSE_ICON_WIDTH ) / 2 ; final int width = CLOSE_ICON_WIDTH ; return new Rectangle ( x , y , ...
Helper - method to get a rectangle definition for the close - icon
36,623
protected int calculateTabWidth ( final int tabPlacement , final int tabIndex , final FontMetrics metrics ) { if ( _pane . getSeparators ( ) . contains ( tabIndex ) ) { return SEPARATOR_WIDTH ; } int width = super . calculateTabWidth ( tabPlacement , tabIndex , metrics ) ; if ( ! _pane . getUnclosables ( ) . contains (...
Override this to provide extra space on right for close button
36,624
protected void paintContentBorder ( final Graphics g , final int tabPlacement , final int tabIndex ) { final int w = tabPane . getWidth ( ) ; final int h = tabPane . getHeight ( ) ; final Insets tabAreaInsets = getTabAreaInsets ( tabPlacement ) ; final int x = 0 ; final int y = calculateTabAreaHeight ( tabPlacement , r...
Paints the border for the tab s content ie . the area below the tabs
36,625
protected static Map < String , UnicodeSet > createUnicodeSets ( ) { final Map < String , UnicodeSet > unicodeSets = new TreeMap < > ( ) ; unicodeSets . put ( "Latin, ASCII" , new UnicodeSet ( "[:ASCII:]" ) ) ; unicodeSets . put ( "Latin, non-ASCII" , subUnicodeSet ( "[:Latin:]" , "[:ASCII:]" ) ) ; unicodeSets . put ( ...
Creates a map of unicode sets with their names as keys .
36,626
public boolean isConfigured ( final boolean throwException ) throws UnconfiguredConfiguredPropertyException , ComponentValidationException , NoResultProducingComponentsException , IllegalStateException { return checkConfiguration ( throwException ) && isConsumedOutDataStreamsJobBuilderConfigured ( throwException ) ; }
Used to verify whether or not the builder s and its immediate children configuration is valid and all properties are satisfied .
36,627
private boolean isConsumedOutDataStreamsJobBuilderConfigured ( final boolean throwException ) { final List < AnalysisJobBuilder > consumedOutputDataStreamsJobBuilders = getConsumedOutputDataStreamsJobBuilders ( ) ; for ( final AnalysisJobBuilder analysisJobBuilder : consumedOutputDataStreamsJobBuilders ) { if ( ! analy...
Checks if a job children are configured .
36,628
public boolean isDistributable ( ) { final Collection < ComponentBuilder > componentBuilders = getComponentBuilders ( ) ; for ( final ComponentBuilder componentBuilder : componentBuilders ) { if ( ! componentBuilder . isDistributable ( ) ) { return false ; } } final List < AnalysisJobBuilder > childJobBuilders = getCon...
Determines if the job being built is going to be distributable in a cluster execution environment .
36,629
private static File getDirectoryIfExists ( final File existingCandidate , final String path ) { if ( existingCandidate != null ) { return existingCandidate ; } if ( ! Strings . isNullOrEmpty ( path ) ) { final File directory = new File ( path ) ; if ( directory . exists ( ) && directory . isDirectory ( ) ) { return dir...
Gets a candidate directory based on a file path if it exists and if it another candidate hasn t already been resolved .
36,630
public static void main ( final String [ ] args ) { LookAndFeelManager . get ( ) . init ( ) ; final Injector injector = Guice . createInjector ( new DCModuleImpl ( ) ) ; final AnalysisJobBuilder ajb = injector . getInstance ( AnalysisJobBuilder . class ) ; final Datastore ds = injector . getInstance ( DatastoreCatalog ...
A main method that will display the results of a few example pattern finder analyzers . Useful for tweaking the charts and UI .
36,631
public static void main ( final String [ ] args ) throws Exception { LookAndFeelManager . get ( ) . init ( ) ; final Injector injector = Guice . createInjector ( new DCModuleImpl ( VFSUtils . getFileSystemManager ( ) . resolveFile ( "." ) , null ) ) ; final AnalysisJobBuilder ajb = injector . getInstance ( AnalysisJobB...
A main method that will display the results of a few example number analyzers . Useful for tweaking the charts and UI .
36,632
private void configureComponentsBeforeBuilding ( final AnalysisJobBuilder jobBuilder , final int partitionNumber ) { for ( final ComponentBuilder cb : jobBuilder . getComponentBuilders ( ) ) { final Set < ConfiguredPropertyDescriptor > targetDatastoreProperties = cb . getDescriptor ( ) . getConfiguredPropertiesByType (...
Applies any partition - specific configuration to the job builder before building it .
36,633
public static void createDimensionsColumnCrosstab ( final List < CrosstabDimension > crosstabDimensions , final Crosstab < Number > partialCrosstab ) { if ( partialCrosstab != null ) { final List < CrosstabDimension > dimensions = partialCrosstab . getDimensions ( ) ; for ( final CrosstabDimension dimension : dimension...
Add the croosstab dimensions to the list of dimensions
36,634
public static void addData ( final Crosstab < Number > mainCrosstab , final Crosstab < Number > partialCrosstab , final CrosstabDimension columnDimension , final CrosstabDimension measureDimension ) { if ( partialCrosstab != null ) { final CrosstabNavigator < Number > mainNavigator = new CrosstabNavigator < > ( mainCro...
Add the values of partial crosstab to the main crosstab
36,635
private ChartPanel createChartPanel ( final ValueCountingAnalyzerResult result ) { if ( _valueCounts . size ( ) > ChartUtils . CATEGORY_COUNT_DISPLAY_THRESHOLD ) { logger . info ( "Display threshold of {} in chart surpassed (got {}). Skipping chart." , ChartUtils . CATEGORY_COUNT_DISPLAY_THRESHOLD , _valueCounts . size...
Creates a chart panel or null if chart display is not applicable .
36,636
public URI getResultPath ( ) { final String str = _customProperties . get ( PROPERTY_RESULT_PATH ) ; if ( Strings . isNullOrEmpty ( str ) ) { return null ; } return URI . create ( str ) ; }
Gets the path defined in the job properties file
36,637
public void setDatastore ( final Datastore datastore , final boolean expandTree ) { final DatastoreConnection con ; if ( datastore == null ) { con = null ; } else { con = datastore . openConnection ( ) ; } _datastore = datastore ; if ( _datastoreConnection != null ) { _datastoreConnection . close ( ) ; } _analysisJobBu...
Initializes the window to use a particular datastore in the schema tree .
36,638
public boolean upgrade ( final FileObject newFolder ) { try { if ( newFolder . getChildren ( ) . length != 0 ) { return false ; } final FileObject upgradeFromFolderCandidate = findUpgradeCandidate ( newFolder ) ; if ( upgradeFromFolderCandidate == null ) { logger . info ( "Did not find a suitable upgrade candidate" ) ;...
Finds a folder to upgrade from based on the newFolder parameter - upgrades are performed only within the same major version .
36,639
protected EnumerationValue [ ] getEnumConstants ( final InputColumn < ? > inputColumn , final ConfiguredPropertyDescriptor mappedEnumsProperty ) { if ( mappedEnumsProperty instanceof EnumerationProvider ) { return ( ( EnumerationProvider ) mappedEnumsProperty ) . values ( ) ; } else { return EnumerationValue . fromArra...
Produces a list of available enum values for a particular input column .
36,640
protected DCComboBox < EnumerationValue > createComboBox ( final InputColumn < ? > inputColumn , EnumerationValue mappedEnum ) { if ( mappedEnum == null && inputColumn != null ) { mappedEnum = getSuggestedValue ( inputColumn ) ; } final EnumerationValue [ ] enumConstants = getEnumConstants ( inputColumn , _mappedEnumsP...
Creates a combobox for a particular input column .
36,641
protected ListCellRenderer < ? super EnumerationValue > getComboBoxRenderer ( final InputColumn < ? > inputColumn , final Map < InputColumn < ? > , DCComboBox < EnumerationValue > > mappedEnumComboBoxes , final EnumerationValue [ ] enumConstants ) { return new EnumComboBoxListRenderer ( ) ; }
Gets the renderer of items in the comboboxes presenting the enum values .
36,642
public static String getValueLabel ( final Object value ) { if ( value == null ) { return NULL_LABEL ; } if ( value instanceof HasLabelAdvice ) { final String suggestedLabel = ( ( HasLabelAdvice ) value ) . getSuggestedLabel ( ) ; if ( ! Strings . isNullOrEmpty ( suggestedLabel ) ) { return suggestedLabel ; } } if ( va...
Gets the label of a value eg . a value in a crosstab .
36,643
public DCPanel createPanel ( ) { final DCPanel parentPanel = new DCPanel ( ) ; parentPanel . setLayout ( new BorderLayout ( ) ) ; parentPanel . add ( _sourceComboBoxPanel , BorderLayout . CENTER ) ; parentPanel . add ( _buttonPanel , BorderLayout . EAST ) ; return parentPanel ; }
Creates a panel containing ButtonPanel and SourceComboboxPanel
36,644
public void updateSourceComboBoxes ( final Datastore datastore , final Table table ) { _datastore = datastore ; _table = table ; for ( final SourceColumnComboBox sourceColComboBox : _sourceColumnComboBoxes ) { sourceColComboBox . setModel ( datastore , table ) ; } }
updates the SourceColumnComboBoxes with the provided datastore and table
36,645
public Date getFrom ( ) { final TimeInterval first = intervals . first ( ) ; if ( first != null ) { return new Date ( first . getFrom ( ) ) ; } return null ; }
Gets the first date in this timeline
36,646
public Date getTo ( ) { Long to = null ; for ( final TimeInterval interval : intervals ) { if ( to == null ) { to = interval . getTo ( ) ; } else { to = Math . max ( interval . getTo ( ) , to ) ; } } if ( to != null ) { return new Date ( to ) ; } return null ; }
Gets the last date in this timeline
36,647
public static double [ ] [ ] toFeatureVector ( Iterable < ? extends MLRecord > data , List < MLFeatureModifier > featureModifiers ) { final List < double [ ] > trainingInstances = new ArrayList < > ( ) ; for ( MLRecord record : data ) { final double [ ] features = generateFeatureValues ( record , featureModifiers ) ; t...
Generates a matrix of feature values for each record .
36,648
public static int [ ] toClassificationVector ( Iterable < MLClassificationRecord > data ) { final List < Integer > responseVariables = new ArrayList < > ( ) ; final List < Object > classifications = new ArrayList < > ( ) ; for ( MLClassificationRecord record : data ) { final Object classification = record . getClassifi...
Generates a vector of classifications for each record .
36,649
public static double [ ] toRegressionOutputVector ( Iterable < MLRegressionRecord > data ) { final Stream < MLRegressionRecord > stream = StreamSupport . stream ( data . spliterator ( ) , false ) ; return stream . mapToDouble ( MLRegressionRecord :: getRegressionOutput ) . toArray ( ) ; }
Generates a vector of regression outputs for every record
36,650
public final void batchUpdateWidget ( final Runnable action ) { _batchUpdateCounter ++ ; try { action . run ( ) ; } catch ( final RuntimeException e ) { logger . error ( "Exception occurred in widget batch update, fireValueChanged() will not be invoked" , e ) ; throw e ; } finally { _batchUpdateCounter -- ; } if ( _bat...
Executes a widget batch update . Listeners and other effects of updating individual parts of a widget may be turned off during batch updates .
36,651
public static ClassLoader getExtensionClassLoader ( ) { final Collection < ClassLoader > childClassLoaders = new ArrayList < > ( ) ; childClassLoaders . addAll ( _allExtensionClassLoaders ) ; childClassLoaders . add ( ClassLoaderUtils . getParentClassLoader ( ) ) ; return new CompoundClassLoader ( childClassLoaders ) ;...
Gets the classloader that represents the currently loaded extensions classes .
36,652
public boolean setProgress ( final int currentRow ) { final boolean result = _progressBar . setValueIfGreater ( currentRow ) ; if ( result ) { _progressCountLabel . setText ( formatNumber ( currentRow ) ) ; } return result ; }
Sets the progress of the processing of the table .
36,653
private Column [ ] getQueryOutputColumns ( final boolean checkNames ) { if ( queryOutputColumns == null ) { try ( DatastoreConnection con = datastore . openConnection ( ) ) { queryOutputColumns = con . getSchemaNavigator ( ) . convertToColumns ( schemaName , tableName , outputColumns ) ; } } else if ( checkNames ) { if...
Gets the output columns of the lookup query
36,654
public NamedPatternMatch < E > match ( final String string ) { final Matcher matcher = pattern . matcher ( string ) ; while ( matcher . find ( ) ) { final int start = matcher . start ( ) ; final int end = matcher . end ( ) ; if ( start == 0 && end == string . length ( ) ) { final Map < E , String > resultMap = new Enum...
Matches a string against this named pattern .
36,655
public static < E > int compare ( final Comparable < E > obj1 , final E obj2 ) { if ( obj1 == obj2 ) { return 0 ; } if ( obj1 == null ) { return - 1 ; } if ( obj2 == null ) { return 1 ; } return obj1 . compareTo ( obj2 ) ; }
Compares two objects of which one of them is a comparable of the other .
36,656
private URI findFile ( final String filePath , final boolean upload ) { try { URI fileURI ; try { fileURI = _hadoopDefaultFS . getUri ( ) . resolve ( filePath ) ; } catch ( final Exception e ) { fileURI = null ; } if ( ( fileURI == null || ! _hadoopDefaultFS . exists ( new Path ( fileURI ) ) ) && upload ) { final File ...
Tries to find a file on HDFS and optionally uploads it if not found .
36,657
public static void setFlotHome ( String flotHome ) { if ( flotHome == null || flotHome . trim ( ) . isEmpty ( ) ) { System . clearProperty ( SYSTEM_PROPERTY_FLOT_HOME ) ; } else { final String propValue = flotHome . endsWith ( "/" ) ? flotHome . substring ( 0 , flotHome . length ( ) - 1 ) : flotHome ; System . setPrope...
Sets the home folder of all flot javascript files
36,658
public void attach ( final AnalyzerResult explorationResult ) { final ResultProducer resultProducer ; if ( explorationResult == null ) { resultProducer = null ; } else { resultProducer = new DefaultResultProducer ( explorationResult ) ; } attach ( resultProducer ) ; }
Attaches an AnalyzerResult as result - exploration data for the navigated position of the crosstab .
36,659
public String getHref ( ) { final String displayName = _componentDescriptor . getDisplayName ( ) ; final String filename = StringUtils . replaceWhitespaces ( displayName . toLowerCase ( ) . trim ( ) , "_" ) . replaceAll ( "\\/" , "_" ) . replaceAll ( "\\\\" , "_" ) ; return filename + ".html" ; }
Gets the href attribute content if a link to this component should be made from elsewhere in the component docs .
36,660
public void reorderValue ( final InputColumn < ? > [ ] sortedValue ) { final int offset = 2 ; for ( int i = 0 ; i < sortedValue . length ; i ++ ) { final InputColumn < ? > inputColumn = sortedValue [ i ] ; final JComponent decoration = getOrCreateCheckBoxDecoration ( inputColumn , true ) ; final int position = offset +...
Reorders the values
36,661
public AverageBuilder addValue ( final Number number ) { final double total = _average * _numValues + number . doubleValue ( ) ; _numValues ++ ; _average = total / _numValues ; return this ; }
Adds a value to the average that is being built .
36,662
public boolean setValueIfGreater ( final int newValue ) { final boolean greater = _value . setIfSignificantToUser ( newValue ) ; if ( greater ) { WidgetUtils . invokeSwingAction ( ( ) -> DCProgressBar . super . setValue ( newValue ) ) ; } return greater ; }
Sets the value of the progress bar if the new value is greater than the previous value .
36,663
private void createAnalyzers ( final AnalysisJobBuilder ajb , final Class < ? extends Analyzer < ? > > analyzerClass , final List < InputColumn < ? > > columns ) { final int columnsPerAnalyzer = getColumnsPerAnalyzer ( ) ; AnalyzerComponentBuilder < ? > analyzerJobBuilder = ajb . addAnalyzer ( analyzerClass ) ; int col...
Registers analyzers and up to 4 columns per analyzer . This restriction is to ensure that results will be nicely readable . A table might contain hundreds of columns .
36,664
public static Field [ ] getAllFields ( final Class < ? > clazz ) { final List < Field > allFields = new ArrayList < > ( ) ; addFields ( allFields , clazz ) ; return allFields . toArray ( new Field [ allFields . size ( ) ] ) ; }
Gets all fields of a class including private fields in super - classes .
36,665
public static Field [ ] getNonSyntheticFields ( final Class < ? > clazz ) { final List < Field > fieldList = new ArrayList < > ( ) ; addFields ( fieldList , clazz , true ) ; return fieldList . toArray ( new Field [ fieldList . size ( ) ] ) ; }
Gets non - synthetic fields of a class including private fields in super - classes .
36,666
private void awaitTasks ( ) { if ( _tasksPending . get ( ) == 0 ) { return ; } synchronized ( this ) { while ( _tasksPending . get ( ) != 0 ) { try { logger . info ( "Scan tasks still pending, waiting" ) ; wait ( ) ; } catch ( final InterruptedException e ) { logger . debug ( "Interrupted while awaiting task completion...
Waits for all pending tasks to finish
36,667
public final boolean satisfiedForConsume ( final FilterOutcomes outcomes , final InputRow row ) { final boolean satisfiedOutcomesForConsume = satisfiedOutcomesForConsume ( _hasComponentRequirement , row , outcomes ) ; if ( ! satisfiedOutcomesForConsume ) { return false ; } return satisfiedInputsForConsume ( row , outco...
Ensures that just a single outcome is satisfied
36,668
public Object getVertex ( final Point2D point2D ) { final GraphElementAccessor < ? , ? > pickSupport = _visualizationViewer . getPickSupport ( ) ; @ SuppressWarnings ( "rawtypes" ) final Layout graphLayout = _visualizationViewer . getModel ( ) . getGraphLayout ( ) ; @ SuppressWarnings ( "unchecked" ) final Object verte...
Gets the vertex at a particular point or null if it does not exist .
36,669
public void cancelDownload ( final boolean hideWindowImmediately ) { logger . info ( "Cancel of download requested" ) ; _cancelled = true ; if ( hideWindowImmediately && _downloadProgressWindow != null ) { WidgetUtils . invokeSwingAction ( _downloadProgressWindow :: close ) ; } }
Cancels the file download .
36,670
public void updateProgress ( final Table table , final int currentRow ) { final TableProgressInformationPanel tableProgressInformationPanel = getTableProgressInformationPanel ( table , - 1 ) ; final boolean greater = tableProgressInformationPanel . setProgress ( currentRow ) ; if ( ! greater ) { return ; } ProgressCoun...
Informs the panel that the progress for a table is updated
36,671
private boolean scanHadoopConfigFiles ( final ServerInformationCatalog serverInformationCatalog , final String selectedServer ) { final HadoopClusterInformation clusterInformation ; if ( selectedServer != null ) { clusterInformation = ( HadoopClusterInformation ) serverInformationCatalog . getServer ( selectedServer ) ...
This scans Hadoop environment variables for a directory with configuration files
36,672
public Map < ComponentJob , AnalyzerResult > getUnsafeResultElements ( ) { if ( _unsafeResultElements == null ) { _unsafeResultElements = new LinkedHashMap < > ( ) ; final Map < ComponentJob , AnalyzerResult > resultMap = _analysisResult . getResultMap ( ) ; for ( final Entry < ComponentJob , AnalyzerResult > entry : r...
Gets a map of unsafe result elements ie . elements that cannot be saved because serialization fails .
36,673
private void escapeValueTo ( final String field , final StringBuilder target ) { if ( field == null ) { target . append ( DETAILS_QUOTE_CHAR ) ; target . append ( DETAILS_QUOTE_CHAR ) ; return ; } target . append ( DETAILS_QUOTE_CHAR ) ; if ( field . indexOf ( DETAILS_ESCAPE_CHAR ) == - 1 && field . indexOf ( DETAILS_Q...
Escapes value for a CSV line and appends it to the target .
36,674
public void createMeasureDimensionValueCombinationCrosstab ( final Map < ValueCombination < Number > , Number > valueCombinations , final Crosstab < Number > valueCombinationCrosstab ) { if ( CrosstabReducerHelper . findDimension ( valueCombinationCrosstab , BooleanAnalyzer . DIMENSION_MEASURE ) ) { final SortedSet < E...
Creates the measure dimension based on the sorted value combinations
36,675
public void addValueCombinationsCrosstabDimension ( final Map < ValueCombination < Number > , Number > valueCombMapList , final Crosstab < Number > partialCrosstab ) { final CrosstabNavigator < Number > nav = new CrosstabNavigator < > ( partialCrosstab ) ; final CrosstabDimension columnDimension = partialCrosstab . get...
Gather the sum of all possible value combinations of the partial crosstabs
36,676
public void onConfigurationChanged ( ) { final Collection < PropertyWidget < ? > > widgets = getWidgets ( ) ; if ( logger . isDebugEnabled ( ) ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "id=" ) ; sb . append ( System . identityHashCode ( this ) ) ; sb . append ( " - onConfigurationChanged() - no...
Invoked whenever a configured property within this widget factory is changed .
36,677
protected Collection < String > normalize ( String string , final boolean tokenize ) { if ( string == null ) { return Collections . emptyList ( ) ; } if ( tokenize ) { final Collection < String > result = new LinkedHashSet < > ( ) ; result . addAll ( normalize ( string , false ) ) ; final Splitter splitter = Splitter ....
Normalizes the incoming string before doing matching
36,678
private ValueFrequency getDistinctValueCount ( final ValueCountingAnalyzerResult res ) { int distinctValueCounter = 0 ; ValueFrequency valueCount = null ; if ( res . getNullCount ( ) > 0 ) { distinctValueCounter ++ ; valueCount = new SingleValueFrequency ( LabelUtils . NULL_LABEL , res . getNullCount ( ) ) ; } final in...
Determines if a group result has just a single distinct value count . If so this value count is returned or else null is returned .
36,679
public JToggleButton getSelectedToggleButton ( ) { for ( final AbstractButton button : _buttons ) { if ( button instanceof JToggleButton ) { if ( button . isSelected ( ) ) { return ( JToggleButton ) button ; } } } return null ; }
Gets the currently selected toggle button if any .
36,680
public static void main ( final String [ ] args ) { LookAndFeelManager . get ( ) . init ( ) ; final ComboButton comboButton1 = new ComboButton ( ) ; comboButton1 . addButton ( "Foo!" , IconUtils . ACTION_ADD_DARK , true ) ; comboButton1 . addButton ( "Boo!" , IconUtils . ACTION_REMOVE_DARK , true ) ; final ComboButton ...
a simple test app
36,681
public final void setMetadataProperty ( final String key , final String value ) { _metadataProperties . put ( key , value ) ; }
Sets a metadata property
36,682
public int launch ( final String configurationHdfsPath , final String jobHdfsPath ) throws Exception { final File hadoopConfDir = createTemporaryHadoopConfDir ( ) ; final SparkLauncher sparkLauncher = createSparkLauncher ( hadoopConfDir , configurationHdfsPath , jobHdfsPath , null ) ; return launch ( sparkLauncher ) ; ...
Launches and waits for the execution of a DataCleaner job on Spark .
36,683
public boolean removeHadoopClusterServerInformation ( final String serverName ) { final Element serverInformationCatalogElement = getServerInformationCatalogElement ( ) ; final Element hadoopClustersElement = getOrCreateChildElementByTagName ( serverInformationCatalogElement , "hadoop-clusters" ) ; return removeChildEl...
Removes a Hadoop cluster by its name if it exists and is recognizeable by the externalizer .
36,684
public Element getDictionariesElement ( ) { final Element referenceDataCatalogElement = getReferenceDataCatalogElement ( ) ; final Element dictionariesElement = getOrCreateChildElementByTagName ( referenceDataCatalogElement , "dictionaries" ) ; if ( dictionariesElement == null ) { throw new IllegalStateException ( "Cou...
Gets the XML element that represents the dictionaries
36,685
public Element getSynonymCatalogsElement ( ) { final Element referenceDataCatalogElement = getReferenceDataCatalogElement ( ) ; final Element synonymCatalogsElement = getOrCreateChildElementByTagName ( referenceDataCatalogElement , "synonym-catalogs" ) ; if ( synonymCatalogsElement == null ) { throw new IllegalStateExc...
Gets the XML element that represents the synonym catalogs
36,686
public Element getStringPatternsElement ( ) { final Element referenceDataCatalogElement = getReferenceDataCatalogElement ( ) ; final Element stringPatternsElement = getOrCreateChildElementByTagName ( referenceDataCatalogElement , "string-patterns" ) ; if ( stringPatternsElement == null ) { throw new IllegalStateExcepti...
Gets the XML element that represents the string patterns
36,687
public void setAvailableInputColumns ( final Collection < InputColumn < ? > > inputColumns ) { final InputColumn < ? > [ ] items = new InputColumn < ? > [ inputColumns . size ( ) + 1 ] ; int index = 1 ; for ( final InputColumn < ? > inputColumn : inputColumns ) { items [ index ] = inputColumn ; index ++ ; } final Defau...
Called by the parent widget to update the list of available columns
36,688
public static OutputWriter getWriter ( final String filename , final List < InputColumn < ? > > columns ) { final InputColumn < ? > [ ] columnArray = columns . toArray ( new InputColumn < ? > [ columns . size ( ) ] ) ; final String [ ] headers = new String [ columnArray . length ] ; for ( int i = 0 ; i < headers . leng...
Creates a CSV output writer with default configuration
36,689
public static OutputWriter getWriter ( final String filename , final String [ ] headers , final char separatorChar , final char quoteChar , final char escapeChar , final boolean includeHeader , final InputColumn < ? > ... columns ) { return getWriter ( new FileResource ( filename ) , headers , FileHelper . DEFAULT_ENCO...
Creates a CSV output writer
36,690
public void onComponentRightClicked ( final ComponentBuilder componentBuilder , final MouseEvent me ) { final boolean isMultiStream = componentBuilder . getDescriptor ( ) . isMultiStreamComponent ( ) ; final JPopupMenu popup = new JPopupMenu ( ) ; final JMenuItem configureComponentMenuItem = new JMenuItem ( "Configure ...
Invoked when a component is right - clicked
36,691
public void onCanvasRightClicked ( final MouseEvent me ) { _linkPainter . cancelLink ( ) ; final JPopupMenu popup = new JPopupMenu ( ) ; final Point point = me . getPoint ( ) ; final AnalysisJobBuilder analysisJobBuilder = _graphContext . getMainAnalysisJobBuilder ( ) ; final DataCleanerConfiguration configuration = an...
Invoked when the canvas is right - clicked
36,692
public void copyToClipboard ( final int rowIndex , final int colIndex , final int width , final int height ) { final StringBuilder sb = new StringBuilder ( ) ; if ( rowIndex == 0 && colIndex == 0 && width == getColumnCount ( ) && height == getRowCount ( ) ) { for ( int i = 0 ; i < width ; i ++ ) { sb . append ( getColu...
Copies content from the table to the clipboard . Algorithm is a slight rewrite of the article below .
36,693
public void run ( final R row , final String value , final int distinctCount ) { final List < Token > tokens ; try { tokens = _tokenizer . tokenize ( value ) ; } catch ( final RuntimeException e ) { throw new IllegalStateException ( "Error occurred while tokenizing value: " + value , e ) ; } final String patternCode = ...
This method should be invoked by the user of the PatternFinder . Invoke it for each value in your dataset . Repeated values are handled correctly but if available it is more efficient to handle only the distinct values and their corresponding distinct counts .
36,694
private String getPatternCode ( final List < Token > tokens ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( tokens . size ( ) ) ; for ( final Token token : tokens ) { sb . append ( token . getType ( ) . ordinal ( ) ) ; } return sb . toString ( ) ; }
Creates an almost unique String code for a list of tokens . This code is used to improve search time when looking for potential matching patterns .
36,695
public List < DatastoreDescriptor > getAvailableDatastoreDescriptors ( ) { final List < DatastoreDescriptor > availableDatabaseDescriptors = new ArrayList < > ( ) ; final List < DatastoreDescriptor > manualDatastoreDescriptors = getManualDatastoreDescriptors ( ) ; availableDatabaseDescriptors . addAll ( manualDatastore...
Returns the descriptors of datastore types available in DataCleaner .
36,696
public List < DatastoreDescriptor > getAvailableCloudBasedDatastoreDescriptors ( ) { final List < DatastoreDescriptor > availableCloudBasedDatabaseDescriptors = new ArrayList < > ( ) ; availableCloudBasedDatabaseDescriptors . add ( SALESFORCE_DATASTORE_DESCRIPTOR ) ; availableCloudBasedDatabaseDescriptors . add ( SUGAR...
Returns the descriptors of cloud - based datastore types available in DataCleaner .
36,697
public List < DatastoreDescriptor > getAvailableDatabaseBasedDatastoreDescriptors ( ) { final List < DatastoreDescriptor > availableCloudBasedDatabaseDescriptors = new ArrayList < > ( ) ; availableCloudBasedDatabaseDescriptors . add ( POSTGRESQL_DATASTORE_DESCRIPTOR ) ; availableCloudBasedDatabaseDescriptors . add ( SQ...
Returns the descriptors of database - based datastore types available in DataCleaner .
36,698
public void setTable ( final Table table ) { if ( table != _tableRef . get ( ) ) { _tableRef . set ( table ) ; if ( table == null ) { _comboBox . setEmptyModel ( ) ; } else { _comboBox . setModel ( table ) ; } } }
Sets the table to use as a source for the available columns in the combobox .
36,699
protected JScrollPane wrapContent ( final JComponent panel ) { panel . setMaximumSize ( new Dimension ( WIDTH_CONTENT , Integer . MAX_VALUE ) ) ; panel . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; final DCPanel wrappingPanel = new DCPanel ( ) ; final BoxLayout layout = new BoxLayout ( wrappingPanel , BoxLayout . PA...
Wraps a content panel in a scroll pane and applies a maximum width to the content to keep it nicely in place on the screen .