idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
3,800 | public static < T > T getMostCommonElementInList ( List < T > sourceList ) { if ( sourceList == null || sourceList . isEmpty ( ) ) { return null ; } Map < T , Integer > hashMap = new HashMap < T , Integer > ( ) ; for ( T element : sourceList ) { Integer countOrNull = hashMap . get ( element ) ; int newCount = ( countOr... | getMostCommonElementInList This returns the most common element in the supplied list . In the event of a tie any element that is tied as the largest element may be returned . If the list has no elements or if the list is null then this will return null . This can also return null if null happens to be the most common e... |
3,801 | static public Insets getScreenInsets ( Window windowOrNull ) { Insets insets ; if ( windowOrNull == null ) { insets = Toolkit . getDefaultToolkit ( ) . getScreenInsets ( GraphicsEnvironment . getLocalGraphicsEnvironment ( ) . getDefaultScreenDevice ( ) . getDefaultConfiguration ( ) ) ; } else { insets = windowOrNull . ... | getScreenInsets This returns the insets of the screen which are defined by any task bars that have been set up by the user . This function accounts for multi - monitor setups . If a window is supplied then the the monitor that contains the window will be used . If a window is not supplied then the primary monitor will ... |
3,802 | public static DateTimeFormatter generateDefaultFormatterCE ( Locale pickerLocale ) { DateTimeFormatter formatCE = new DateTimeFormatterBuilder ( ) . parseLenient ( ) . parseCaseInsensitive ( ) . appendLocalized ( FormatStyle . LONG , null ) . toFormatter ( pickerLocale ) ; String language = pickerLocale . getLanguage (... | generateDefaultFormatterCE This returns a default formatter for the specified locale that can be used for displaying or parsing AD dates . The formatter is generated from the default FormatStyle . LONG formatter in the specified locale . |
3,803 | public static DateTimeFormatter generateDefaultFormatterBCE ( Locale pickerLocale ) { String displayFormatterBCPattern = DateTimeFormatterBuilder . getLocalizedDateTimePattern ( FormatStyle . LONG , null , IsoChronology . INSTANCE , pickerLocale ) ; displayFormatterBCPattern = displayFormatterBCPattern . replace ( "y" ... | generateDefaultFormatterBCE This returns a default formatter for the specified locale that can be used for displaying or parsing BC dates . The formatter is generated from the default FormatStyle . LONG formatter in the specified locale . The resulting format is intended to be nearly identical to the default formatter ... |
3,804 | static public LocalDate getParsedDateOrNull ( String text , DateTimeFormatter displayFormatterADStrict , DateTimeFormatter displayFormatterBCStrict , ArrayList < DateTimeFormatter > parsingFormattersStrict , Locale formatLocale ) { if ( text == null || text . trim ( ) . isEmpty ( ) ) { return null ; } text = text . tri... | getParsedDateOrNull This takes text from the date picker text field and tries to parse it into a java . time . LocalDate instance . If the text cannot be parsed this will return null . |
3,805 | static String capitalizeFirstLetterOfString ( String text , Locale locale ) { if ( text == null || text . length ( ) < 1 ) { return text ; } String textCapitalized = text . substring ( 0 , 1 ) . toUpperCase ( locale ) + text . substring ( 1 ) ; return textCapitalized ; } | capitalizeFirstLetterOfString This capitalizes the first letter of the supplied string in a way that is sensitive to the specified locale . |
3,806 | static public boolean isDateVetoed ( DateVetoPolicy policy , LocalDate date ) { if ( policy == null || date == null ) { return false ; } return ( ! policy . isDateAllowed ( date ) ) ; } | isDateVetoed This is a convenience function for checking whether or not a particular date is vetoed . Note that veto policies do not have any say about null dates so this function always returns false for null dates . |
3,807 | static public boolean isMouseWithinComponent ( Component component ) { Point mousePos = MouseInfo . getPointerInfo ( ) . getLocation ( ) ; Rectangle bounds = component . getBounds ( ) ; bounds . setLocation ( component . getLocationOnScreen ( ) ) ; return bounds . contains ( mousePos ) ; } | isMouseWithinComponent This returns true if the mouse is inside of the specified component otherwise returns false . |
3,808 | static public String safeSubstring ( String text , int beginIndex , int endIndexExclusive ) { if ( text == null ) { return null ; } int textLength = text . length ( ) ; if ( beginIndex < 0 ) { beginIndex = 0 ; } if ( endIndexExclusive < 0 ) { endIndexExclusive = 0 ; } if ( endIndexExclusive > textLength ) { endIndexExc... | safeSubstring This is a version of the substring function which is guaranteed to never throw an exception . If the supplied string is null then this will return null . If the beginIndex or endIndexExclusive are out of range for the string then the indexes will be compressed to fit within the bounds of the supplied stri... |
3,809 | public static int getCompiledJavaVersionFromJavaClassFile ( InputStream classByteStream , boolean majorVersionRequested ) throws Exception { DataInputStream dataInputStream = new DataInputStream ( classByteStream ) ; dataInputStream . readInt ( ) ; int minorVersion = dataInputStream . readUnsignedShort ( ) ; int majorV... | getCompiledJavaVersionFromJavaClassFile Given an input stream to a Java class file this will return the major or minor version of Java that was used to compile the file . In a Maven POM file this is known as the target version of Java that was used to compile the file . |
3,810 | public static void setDefaultTableEditorsClicks ( JTable table , int clickCountToStart ) { TableCellEditor editor ; editor = table . getDefaultEditor ( Object . class ) ; if ( editor instanceof DefaultCellEditor ) { ( ( DefaultCellEditor ) editor ) . setClickCountToStart ( clickCountToStart ) ; } editor = table . getDe... | setDefaultTableEditorsClicks This sets the number of clicks required to start the default table editors in the supplied table . Typically you would set the table editors to start after 1 click or 2 clicks as desired . |
3,811 | public void generatePotentialMenuTimes ( ArrayList < LocalTime > desiredTimes ) { potentialMenuTimes = new ArrayList < LocalTime > ( ) ; if ( desiredTimes == null || desiredTimes . isEmpty ( ) ) { return ; } TreeSet < LocalTime > timeSet = new TreeSet < LocalTime > ( ) ; for ( LocalTime desiredTime : desiredTimes ) { i... | generatePotentialMenuTimes This will generate the menu times for populating the combo box menu using the items from a list of LocalTime instances . The list will be sorted and cleaned of duplicates before use . Null values and duplicate values will not be added . When this function is complete the menu will contain one... |
3,812 | public boolean isTimeAllowed ( LocalTime time ) { if ( time == null ) { return allowEmptyTimes ; } return ( ! ( InternalUtilities . isTimeVetoed ( vetoPolicy , time ) ) ) ; } | isTimeAllowed This checks to see if the specified time is allowed by any currently set veto policy and allowed by the current setting of allowEmptyTimes . |
3,813 | public void setFormatForDisplayTime ( String patternString ) { DateTimeFormatter formatter = PickerUtilities . createFormatterFromPatternString ( patternString , locale ) ; setFormatForDisplayTime ( formatter ) ; } | setFormatForDisplayTime This sets the format that is used to display or parse the text field time times in the time picker using a pattern string . The default format is generated using the locale of the settings instance . |
3,814 | public void setFormatForMenuTimes ( String patternString ) { DateTimeFormatter formatter = PickerUtilities . createFormatterFromPatternString ( patternString , locale ) ; setFormatForMenuTimes ( formatter ) ; } | setFormatForMenuTimes This sets the format that is used to display or parse menu times in the time picker using a pattern string . The default format is generated using the locale of the settings instance . |
3,815 | private void zApplyAllowEmptyTimes ( ) { if ( ( ! allowEmptyTimes ) && ( parent . getTime ( ) == null ) ) { LocalTime defaultTime = LocalTime . of ( 7 , 0 ) ; if ( InternalUtilities . isTimeVetoed ( vetoPolicy , defaultTime ) ) { throw new RuntimeException ( "Exception in TimePickerSettings.zApplyAllowEmptyTimes(), " +... | zApplyAllowEmptyTimes This applies the named setting to the parent component . |
3,816 | void zApplyDisplaySpinnerButtons ( ) { if ( parent == null ) { return ; } parent . getComponentDecreaseSpinnerButton ( ) . setEnabled ( displaySpinnerButtons ) ; parent . getComponentDecreaseSpinnerButton ( ) . setVisible ( displaySpinnerButtons ) ; parent . getComponentIncreaseSpinnerButton ( ) . setEnabled ( displayS... | zApplyDisplaySpinnerButtons This applies the specified setting to the time picker . |
3,817 | void zApplyDisplayToggleTimeMenuButton ( ) { if ( parent == null ) { return ; } parent . getComponentToggleTimeMenuButton ( ) . setEnabled ( displayToggleTimeMenuButton ) ; parent . getComponentToggleTimeMenuButton ( ) . setVisible ( displayToggleTimeMenuButton ) ; } | zApplyDisplayToggleTimeMenuButton This applies the specified setting to the time picker . |
3,818 | private void zApplyInitialTime ( ) { if ( allowEmptyTimes == true && initialTime == null ) { parent . setTime ( null ) ; } if ( initialTime != null ) { parent . setTime ( initialTime ) ; } } | zApplyInitialTime This applies the named setting to the parent component . |
3,819 | void zApplyMinimumSpinnerButtonWidthInPixels ( ) { if ( parent == null ) { return ; } Dimension decreaseButtonPreferredSize = parent . getComponentDecreaseSpinnerButton ( ) . getPreferredSize ( ) ; Dimension increaseButtonPreferredSize = parent . getComponentIncreaseSpinnerButton ( ) . getPreferredSize ( ) ; int width ... | zApplyMinimumSpinnerButtonWidthInPixels The applies the specified setting to the time picker . |
3,820 | void zApplyMinimumToggleTimeMenuButtonWidthInPixels ( ) { if ( parent == null ) { return ; } Dimension menuButtonPreferredSize = parent . getComponentToggleTimeMenuButton ( ) . getPreferredSize ( ) ; int width = menuButtonPreferredSize . width ; int height = menuButtonPreferredSize . height ; int minimumWidth = minimum... | zApplyMinimumToggleTimeMenuButtonWidthInPixels This applies the specified setting to the time picker . |
3,821 | static ConstantSize valueOf ( String encodedValueAndUnit , boolean horizontal ) { String [ ] split = ConstantSize . splitValueAndUnit ( encodedValueAndUnit ) ; String encodedValue = split [ 0 ] ; String encodedUnit = split [ 1 ] ; Unit unit = Unit . valueOf ( encodedUnit , horizontal ) ; double value = Double . parseDo... | Creates and returns a ConstantSize from the given encoded size and unit description . |
3,822 | public int getPixelSize ( Component component ) { if ( unit == PIXEL ) { return intValue ( ) ; } else if ( unit == POINT ) { return Sizes . pointAsPixel ( intValue ( ) , component ) ; } else if ( unit == INCH ) { return Sizes . inchAsPixel ( value , component ) ; } else if ( unit == MILLIMETER ) { return Sizes . millim... | Converts the size if necessary and returns the value in pixels . |
3,823 | public String encode ( ) { return value == intValue ( ) ? Integer . toString ( intValue ( ) ) + unit . encode ( ) : Double . toString ( value ) + unit . encode ( ) ; } | Returns a parseable string representation of this constant size . |
3,824 | private static String [ ] splitValueAndUnit ( String encodedValueAndUnit ) { String [ ] result = new String [ 2 ] ; int len = encodedValueAndUnit . length ( ) ; int firstLetterIndex = len ; while ( firstLetterIndex > 0 && Character . isLetter ( encodedValueAndUnit . charAt ( firstLetterIndex - 1 ) ) ) { firstLetterInde... | Splits a string that encodes size with unit into the size and unit substrings . Returns an array of two strings . |
3,825 | public static ColumnSpec decode ( String encodedColumnSpec , LayoutMap layoutMap ) { checkNotBlank ( encodedColumnSpec , "The encoded column specification must not be null, empty or whitespace." ) ; checkNotNull ( layoutMap , "The LayoutMap must not be null." ) ; String trimmed = encodedColumnSpec . trim ( ) ; String l... | Parses the encoded column specifications and returns a ColumnSpec object that represents the string . Variables are expanded using the given LayoutMap . |
3,826 | static ColumnSpec decodeExpanded ( String expandedTrimmedLowerCaseSpec ) { ColumnSpec spec = CACHE . get ( expandedTrimmedLowerCaseSpec ) ; if ( spec == null ) { spec = new ColumnSpec ( expandedTrimmedLowerCaseSpec ) ; CACHE . put ( expandedTrimmedLowerCaseSpec , spec ) ; } return spec ; } | Decodes an expanded trimmed lower case column spec . Called by the public ColumnSpec factory methods . Looks up and returns the ColumnSpec object from the cache - if any or constructs and returns a new ColumnSpec instance . |
3,827 | public Component getTableCellEditorComponent ( JTable table , Object value , boolean isSelected , int row , int column ) { setCellEditorValue ( value ) ; zAdjustTableRowHeightIfNeeded ( table ) ; timePicker . getComponentTimeTextField ( ) . setScrollOffset ( 0 ) ; return timePicker ; } | getTableCellEditorComponent this returns the editor that is used for editing the cell . This is required by the TableCellEditor interface . |
3,828 | public Image getIcon ( int iconType ) { Pair < String , Image > pair = iconInformation . get ( iconType ) ; String imagePath = pair . first ; Image imageOrNull = pair . second ; if ( ( imageOrNull == null ) && ( imagePath != null ) ) { imageOrNull = loadImage ( imagePath ) ; } return imageOrNull ; } | getIcon Returns the requested BeanInfo icon type or null if an icon does not exist or cannot be retrieved . |
3,829 | protected double computeAverageCharWidth ( FontMetrics metrics , String testString ) { int width = metrics . stringWidth ( testString ) ; double average = ( double ) width / testString . length ( ) ; return average ; } | Computes and returns the average character width of the specified test string using the given FontMetrics . The test string shall represent an average text . |
3,830 | protected int getScreenResolution ( Component c ) { if ( c == null ) { return getDefaultScreenResolution ( ) ; } Toolkit toolkit = c . getToolkit ( ) ; return toolkit != null ? toolkit . getScreenResolution ( ) : getDefaultScreenResolution ( ) ; } | Returns the components screen resolution or the default screen resolution if the component is null or has no toolkit assigned yet . |
3,831 | public String encode ( ) { StringBuffer buffer = new StringBuffer ( "[" ) ; if ( lowerBound != null ) { buffer . append ( lowerBound . encode ( ) ) ; buffer . append ( ',' ) ; } buffer . append ( basis . encode ( ) ) ; if ( upperBound != null ) { buffer . append ( ',' ) ; buffer . append ( upperBound . encode ( ) ) ; }... | Returns a parseable string representation of this bounded size . |
3,832 | public static boolean isLocalTimeInRange ( LocalTime value , LocalTime optionalMinimum , LocalTime optionalMaximum , boolean inclusiveOfEndpoints ) { LocalTime minimum = ( optionalMinimum == null ) ? LocalTime . MIN : optionalMinimum ; LocalTime maximum = ( optionalMaximum == null ) ? LocalTime . MAX : optionalMaximum ... | isLocalTimeInRange This returns true if the specified value is inside of the specified range . This returns false if the specified value is outside of the specified range . If the specified value is null then this will return false . |
3,833 | static public boolean isSameLocalDate ( LocalDate first , LocalDate second ) { if ( first == null && second == null ) { return true ; } if ( first == null || second == null ) { return false ; } return first . isEqual ( second ) ; } | isSameLocalDate This compares two date variables to see if their values are equal . Returns true if the values are equal otherwise returns false . |
3,834 | public static boolean isSameYearMonth ( YearMonth first , YearMonth second ) { if ( first == null && second == null ) { return true ; } if ( first == null || second == null ) { return false ; } return first . equals ( second ) ; } | isSameYearMonth This compares two YearMonth variables to see if their values are equal . Returns true if the values are equal otherwise returns false . |
3,835 | public static String localTimeToString ( LocalTime time , String emptyTimeString ) { return ( time == null ) ? emptyTimeString : time . toString ( ) ; } | localTimeToString This will return the supplied time as a string . If the time is null this will return the value of emptyTimeString . |
3,836 | private static Integer decodeInt ( String token ) { try { return Integer . decode ( token ) ; } catch ( NumberFormatException e ) { return null ; } } | Decodes an integer string representation and returns the associated Integer or null in case of an invalid number format . |
3,837 | void ensureValidGridBounds ( int colCount , int rowCount ) { if ( gridX <= 0 ) { throw new IndexOutOfBoundsException ( "The column index " + gridX + " must be positive." ) ; } if ( gridX > colCount ) { throw new IndexOutOfBoundsException ( "The column index " + gridX + " must be less than or equal to " + colCount + "."... | Checks and verifies that this constraints object has valid grid index values i . e . the display area cells are inside the form s grid . |
3,838 | private static void ensureValidOrientations ( Alignment horizontalAlignment , Alignment verticalAlignment ) { if ( ! horizontalAlignment . isHorizontal ( ) ) { throw new IllegalArgumentException ( "The horizontal alignment must be one of: left, center, right, fill, default." ) ; } if ( ! verticalAlignment . isVertical ... | Checks and verifies that the horizontal alignment is a horizontal and the vertical alignment is vertical . |
3,839 | void setBounds ( Component c , FormLayout layout , Rectangle cellBounds , FormLayout . Measure minWidthMeasure , FormLayout . Measure minHeightMeasure , FormLayout . Measure prefWidthMeasure , FormLayout . Measure prefHeightMeasure ) { ColumnSpec colSpec = gridWidth == 1 ? layout . getColumnSpec ( gridX ) : null ; RowS... | Sets the component s bounds using the given component and cell bounds . |
3,840 | private static int componentSize ( Component component , FormSpec formSpec , int cellSize , FormLayout . Measure minMeasure , FormLayout . Measure prefMeasure ) { if ( formSpec == null ) { return prefMeasure . sizeOf ( component ) ; } else if ( formSpec . getSize ( ) == Sizes . MINIMUM ) { return minMeasure . sizeOf ( ... | Computes and returns the pixel size of the given component using the given form specification measures and cell size . |
3,841 | private static int origin ( Alignment alignment , int cellOrigin , int cellSize , int componentSize ) { if ( alignment == RIGHT || alignment == BOTTOM ) { return cellOrigin + cellSize - componentSize ; } else if ( alignment == CENTER ) { return cellOrigin + ( cellSize - componentSize ) / 2 ; } else { return cellOrigin ... | Computes and returns the component s pixel origin . |
3,842 | private static String formatInt ( int number ) { String str = Integer . toString ( number ) ; return number < 10 ? " " + str : str ; } | Returns an integer that has a minimum of two characters . |
3,843 | protected final void firePropertyChange ( String propertyName , Object oldValue , Object newValue ) { PropertyChangeSupport aChangeSupport = this . changeSupport ; if ( aChangeSupport == null ) { return ; } aChangeSupport . firePropertyChange ( propertyName , oldValue , newValue ) ; } | Support for reporting bound property changes for Object properties . This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners . |
3,844 | protected final void firePropertyChange ( String propertyName , double oldValue , double newValue ) { firePropertyChange ( propertyName , Double . valueOf ( oldValue ) , Double . valueOf ( newValue ) ) ; } | Support for reporting bound property changes for integer properties . This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners . |
3,845 | protected final void fireVetoableChange ( String propertyName , Object oldValue , Object newValue ) throws PropertyVetoException { VetoableChangeSupport aVetoSupport = this . vetoSupport ; if ( aVetoSupport == null ) { return ; } aVetoSupport . fireVetoableChange ( propertyName , oldValue , newValue ) ; } | Support for reporting changes for constrained Object properties . This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners . |
3,846 | protected final void fireVetoableChange ( String propertyName , long oldValue , long newValue ) throws PropertyVetoException { fireVetoableChange ( propertyName , Long . valueOf ( oldValue ) , Long . valueOf ( newValue ) ) ; } | Support for reporting changes for constrained integer properties . This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners . |
3,847 | public static void main ( String [ ] args ) { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { BasicDemo basicDemo = new BasicDemo ( ) ; basicDemo . setVisible ( true ) ; } } ) ; } | main This is the entry point for the basic demo . |
3,848 | private void parseAndInitValues ( String encodedDescription ) { checkNotBlank ( encodedDescription , "The encoded form specification must not be null, empty or whitespace." ) ; String [ ] token = TOKEN_SEPARATOR_PATTERN . split ( encodedDescription ) ; checkArgument ( token . length > 0 , "The form spec must not be emp... | Parses an encoded form specification and initializes all required fields . The encoded description must be in lower case . |
3,849 | private Size parseSize ( String token ) { if ( token . startsWith ( "[" ) && token . endsWith ( "]" ) ) { return parseBoundedSize ( token ) ; } if ( token . startsWith ( "max(" ) && token . endsWith ( ")" ) ) { return parseOldBoundedSize ( token , false ) ; } if ( token . startsWith ( "min(" ) && token . endsWith ( ")"... | Parses an encoded size spec and returns the size . |
3,850 | private Size parseAtomicSize ( String token ) { String trimmedToken = token . trim ( ) ; if ( trimmedToken . startsWith ( "'" ) && trimmedToken . endsWith ( "'" ) ) { int length = trimmedToken . length ( ) ; if ( length < 2 ) { throw new IllegalArgumentException ( "Missing closing \"'\" for prototype." ) ; } return new... | Decodes and returns an atomic size that is either a constant size or a component size . |
3,851 | private static double parseResizeWeight ( String token ) { if ( token . equals ( "g" ) || token . equals ( "grow" ) ) { return DEFAULT_GROW ; } if ( token . equals ( "n" ) || token . equals ( "nogrow" ) || token . equals ( "none" ) ) { return NO_GROW ; } if ( ( token . startsWith ( "grow(" ) || token . startsWith ( "g(... | Decodes an encoded resize mode and resize weight and answers the resize weight . |
3,852 | public void hide ( ) { if ( displayWindow != null ) { displayWindow . setVisible ( false ) ; displayWindow . removeWindowFocusListener ( this ) ; displayWindow = null ; } if ( topWindow != null ) { topWindow . removeComponentListener ( this ) ; topWindow = null ; } if ( optionalCustomPopupCloseListener != null ) { opti... | hide This hides the popup window . This removes this class from the list of window focus listeners for the popup window and removes this class from the list of window movement listeners for the top window . This can be called internally or externally . If this is called multiple times then only the first call will have... |
3,853 | public void windowLostFocus ( WindowEvent e ) { if ( ! enableHideWhenFocusIsLost ) { e . getWindow ( ) . requestFocus ( ) ; return ; } if ( InternalUtilities . isMouseWithinComponent ( displayWindow ) ) { return ; } hide ( ) ; } | windowLostFocus Part of WindowFocusListener . Whenever the popup window loses focus it will be hidden . |
3,854 | public java . util . Date getDateWithDefaultZone ( ) { LocalDate pickerDate = parentDatePicker . getDate ( ) ; if ( pickerDate == null ) { return null ; } Instant instant = pickerDate . atStartOfDay ( ZoneId . systemDefault ( ) ) . toInstant ( ) ; java . util . Date javaUtilDate = getJavaUtilDateFromInstant ( instant )... | getDateWithDefaultZone Returns the date picker value as a java . util . Date that was created using the system default time zone or returns null . This will return null when the date picker has no value . |
3,855 | public java . util . Date getDateWithZone ( ZoneId timezone ) { LocalDate pickerDate = parentDatePicker . getDate ( ) ; if ( pickerDate == null || timezone == null ) { return null ; } Instant instant = pickerDate . atStartOfDay ( timezone ) . toInstant ( ) ; java . util . Date javaUtilDate = getJavaUtilDateFromInstant ... | getDateWithZone Returns the date picker value as a java . util . Date that was created using the specified time zone or returns null . This will return null if either the date picker has no value or if the supplied time zone was null . |
3,856 | public void setDateWithDefaultZone ( java . util . Date javaUtilDate ) { if ( javaUtilDate == null ) { parentDatePicker . setDate ( null ) ; return ; } Instant instant = Instant . ofEpochMilli ( javaUtilDate . getTime ( ) ) ; ZonedDateTime zonedDateTime = instant . atZone ( ZoneId . systemDefault ( ) ) ; LocalDate loca... | setDateWithDefaultZone Sets the date picker value from a java . util . Date using the system default time zone . If either the date or the time zone are null the date picker will be cleared . |
3,857 | private java . util . Date getJavaUtilDateFromInstant ( Instant instant ) { java . util . Date javaUtilDate ; try { javaUtilDate = new java . util . Date ( instant . toEpochMilli ( ) ) ; } catch ( ArithmeticException ex ) { throw new IllegalArgumentException ( ex ) ; } return javaUtilDate ; } | getJavaUtilDateFromInstant Converts a Java . time or backport310 instant to a java . util . Date . This code was copied from backport310 and should work in both java . time and backport310 . |
3,858 | public boolean isDateAllowed ( LocalDate date ) { if ( ( firstAllowedDate != null ) && ( date . isBefore ( firstAllowedDate ) ) ) { return false ; } if ( ( lastAllowedDate != null ) && ( date . isAfter ( lastAllowedDate ) ) ) { return false ; } return true ; } | isDateAllowed This implements the DateVetoPolicy interface . This returns true if the date is allowed otherwise this returns false . The value of null will never be passed to this function under any case . |
3,859 | public void setDateRangeLimits ( LocalDate firstAllowedDate , LocalDate lastAllowedDate ) { if ( firstAllowedDate == null && lastAllowedDate == null ) { throw new RuntimeException ( "DateVetoPolicyMinimumMaximumDate.setDateRangeLimits()," + "The variable firstAllowedDate can be null, or lastAllowedDate can be null, " +... | setDateRangeLimits This sets the currently used date limits . |
3,860 | public static void createAndShowTableDemoFrame ( ) { JFrame frame = new JFrame ( "LGoodDatePicker Table Editors Demo " + InternalUtilities . getProjectVersionString ( ) ) ; frame . setDefaultCloseOperation ( JFrame . DISPOSE_ON_CLOSE ) ; TableEditorsDemo tableDemoPanel = new TableEditorsDemo ( ) ; frame . setContentPan... | createAndShowTableDemoFrame This creates and displays a frame with the table demo . |
3,861 | public void setDefaultDialogFont ( Font newFont ) { Font oldFont = defaultDialogFont ; defaultDialogFont = newFont ; clearCache ( ) ; firePropertyChange ( PROPERTY_DEFAULT_DIALOG_FONT , oldFont , newFont ) ; } | Sets a dialog font that will be used to compute the dialog base units . |
3,862 | private static Font lookupDefaultDialogFont ( ) { Font buttonFont = UIManager . getFont ( "Button.font" ) ; return buttonFont != null ? buttonFont : new JButton ( ) . getFont ( ) ; } | Looks up and returns the font used by buttons . First tries to request the button font from the UIManager ; if this fails a JButton is created and asked for its font . |
3,863 | IntTree < V > changeKeysAbove ( final long key , final int delta ) { if ( size == 0 || delta == 0 ) return this ; if ( this . key >= key ) return new IntTree < V > ( this . key + delta , value , left . changeKeysBelow ( key - this . key , - delta ) , right ) ; IntTree < V > newRight = right . changeKeysAbove ( key - th... | Changes every key k > = key to k + delta . |
3,864 | public static void copyRecursively ( Path source , Path destination ) throws IOException { if ( Files . isDirectory ( source ) ) { Files . createDirectories ( destination ) ; final Set < Path > sources = listFiles ( source ) ; for ( Path srcFile : sources ) { Path destFile = destination . resolve ( srcFile . getFileNam... | Copy a directory recursively preserving attributes in particular permissions . |
3,865 | public static void setScriptPermission ( InstanceConfiguration config , String scriptName ) { if ( SystemUtils . IS_OS_WINDOWS ) { return ; } if ( VersionUtil . isEqualOrGreater_7_0_0 ( config . getClusterConfiguration ( ) . getVersion ( ) ) ) { return ; } CommandLine command = new CommandLine ( "chmod" ) . addArgument... | Set the 755 permissions on the given script . |
3,866 | public void lock ( ) { log . info ( "Elasticsearch has started and the maven process has been blocked. Press CTRL+C to stop the process." ) ; synchronized ( lock ) { try { lock . wait ( ) ; } catch ( InterruptedException exception ) { log . warn ( "RunElasticsearchNodeMojo interrupted" ) ; } } } | Causes the current thread to wait indefinitely . This method does not return . |
3,867 | private File resolveArtifact ( ClusterConfiguration config ) throws ArtifactException , IOException { String flavour = config . getFlavour ( ) ; String version = config . getVersion ( ) ; String artifactId = getArtifactId ( flavour , version ) ; String classifier = getArtifactClassifier ( version ) ; String type = getA... | Resolve the artifact and return a file reference to the local file . |
3,868 | private File downloadArtifact ( ElasticsearchArtifact artifactReference , ClusterConfiguration config ) throws IOException { String filename = Joiner . on ( "-" ) . skipNulls ( ) . join ( artifactReference . getArtifactId ( ) , artifactReference . getVersion ( ) , artifactReference . getClassifier ( ) ) + "." + artifac... | Download the artifact from the download repository . |
3,869 | public static boolean isProcessRunning ( String baseDir ) { File pidFile = new File ( baseDir , "pid" ) ; boolean exists = pidFile . isFile ( ) ; return exists ; } | Check whether the PID file created by the ES process exists or not . |
3,870 | public boolean isInstanceRunning ( String clusterName ) { boolean result ; try { @ SuppressWarnings ( "unchecked" ) Map < String , Object > response = client . get ( "/" , Map . class ) ; result = clusterName . equals ( response . get ( "cluster_name" ) ) ; } catch ( ElasticsearchClientException e ) { result = false ; ... | Check whether the cluster with the given name exists in the current ES instance . |
3,871 | public static CommandLine buildKillCommandLine ( String pid ) { CommandLine command ; if ( SystemUtils . IS_OS_WINDOWS ) { command = new CommandLine ( "taskkill" ) . addArgument ( "/F" ) . addArgument ( "/pid" ) . addArgument ( pid ) ; } else { command = new CommandLine ( "kill" ) . addArgument ( pid ) ; } return comma... | Build an OS dependent command line to kill the process with the given PID . |
3,872 | public static String getElasticsearchPid ( String baseDir ) { try { String pid = new String ( Files . readAllBytes ( Paths . get ( baseDir , "pid" ) ) ) ; return pid ; } catch ( IOException e ) { throw new IllegalStateException ( String . format ( "Cannot read the PID of the Elasticsearch process from the pid file in d... | Read the ES PID from the pid file and return it . |
3,873 | public static boolean isWindowsProcessAlive ( InstanceConfiguration config , String pid ) { CommandLine command = new CommandLine ( "tasklist" ) . addArgument ( "/FI" ) . addArgument ( "PID eq " + pid , true ) ; List < String > output = executeScript ( config , command , true ) ; String keyword = String . format ( " %s... | Check if the process with the given PID is running or not . This method only handles processes running on Windows . |
3,874 | public static Map < String , String > createEnvironment ( Map < String , String > environment ) { Map < String , String > result = null ; try { result = EnvironmentUtils . getProcEnvironment ( ) ; } catch ( IOException ex ) { throw new ElasticsearchSetupException ( "Cannot get the current process environment" , ex ) ; ... | Create an environment by merging the current environment and the supplied one . If the supplied environment is null null is returned . |
3,875 | public File resolveArtifact ( String coordinates ) throws ArtifactException { ArtifactRequest request = new ArtifactRequest ( ) ; Artifact artifact = new DefaultArtifact ( coordinates ) ; request . setArtifact ( artifact ) ; request . setRepositories ( remoteRepositories ) ; log . debug ( String . format ( "Resolving a... | Resolves an Artifact from the repositories . |
3,876 | public Future < AsperaTransaction > upload ( String bucket , File localFileName , String remoteFileName ) { return upload ( bucket , localFileName , remoteFileName , asperaConfig , null ) ; } | Uploads a file via Aspera FASP |
3,877 | public AsperaTransaction processTransfer ( String transferSpecStr , String bucketName , String key , String fileName , ProgressListener progressListener ) { String xferId = UUID . randomUUID ( ) . toString ( ) ; AsperaTransactionImpl asperaTransaction = null ; try { TransferProgress transferProgress = new TransferProgr... | Process the transfer spec to call the underlying Aspera libraries to begin the transfer |
3,878 | public FASPConnectionInfo getFaspConnectionInfo ( String bucketName ) { log . trace ( "AsperaTransferManager.getFaspConnectionInfo >> start " + System . nanoTime ( ) ) ; FASPConnectionInfo faspConnectionInfo = akCache . get ( bucketName ) ; if ( null == faspConnectionInfo ) { log . trace ( "AsperaTransferManager.getFas... | Check the LRU cache to see if the Aspera Key has already been retrieved for this bucket . If it has return it else call onto the s3Client to get the FASPConnectionInfo for the bucket name |
3,879 | public void checkMultiSessionAllGlobalConfig ( TransferSpecs transferSpecs ) { if ( asperaTransferManagerConfig . isMultiSession ( ) ) { for ( TransferSpec transferSpec : transferSpecs . transfer_specs ) { transferSpec . setRemote_host ( updateRemoteHost ( transferSpec . getRemote_host ( ) ) ) ; } } } | Modify the retrieved TransferSpec and apply an - all suffix to the subdomain on the remote ) host field |
3,880 | public void modifyTransferSpec ( AsperaConfig sessionDetails , TransferSpecs transferSpecs ) { for ( TransferSpec transferSpec : transferSpecs . transfer_specs ) { if ( ! StringUtils . isNullOrEmpty ( String . valueOf ( sessionDetails . getTargetRateKbps ( ) ) ) ) transferSpec . setTarget_rate_kbps ( sessionDetails . g... | Modify the retrieved TransferSpec with the customised AsperaConfig object created by the user |
3,881 | public void excludeSubdirectories ( File directory , TransferSpecs transferSpecs ) { if ( directory == null || ! directory . exists ( ) || ! directory . isDirectory ( ) ) { throw new IllegalArgumentException ( "Must provide a directory to upload" ) ; } List < File > files = new LinkedList < File > ( ) ; listFiles ( dir... | List all files within the folder to exclude all subdirectories & modify the transfer spec to pass onto Aspera SDK |
3,882 | private void listFiles ( File dir , List < File > results ) { File [ ] found = dir . listFiles ( ) ; if ( found != null ) { for ( File f : found ) { if ( f . isDirectory ( ) ) { } else { results . add ( f ) ; } } } } | Lists files in the directory given and adds them to the result list passed in optionally adding subdirectories recursively . |
3,883 | private String updateRemoteHost ( String remoteHost ) { String [ ] splitStr = remoteHost . split ( "\\." ) ; remoteHost = new StringBuilder ( remoteHost ) . insert ( splitStr [ 0 ] . length ( ) , "-all" ) . toString ( ) ; return remoteHost ; } | Update the remoteHost parameter with the suffix - all within the subdomain name |
3,884 | protected void checkAscpThreshold ( ) { if ( TransferListener . getAscpCount ( ) >= asperaTransferManagerConfig . getAscpMaxConcurrent ( ) ) { log . error ( "ASCP process threshold has been reached, there are currently " + TransferListener . getAscpCount ( ) + " processes running" ) ; throw new AsperaTransferException ... | Check if ascp count has hit limit If it has throw an exception |
3,885 | public void setProgressListener ( com . ibm . cloud . objectstorage . services . s3 . model . ProgressListener progressListener ) { setGeneralProgressListener ( new LegacyS3ProgressListener ( progressListener ) ) ; } | Sets the optional progress listener for receiving updates about object download status . |
3,886 | public com . ibm . cloud . objectstorage . services . s3 . model . ProgressListener getProgressListener ( ) { ProgressListener generalProgressListener = getGeneralProgressListener ( ) ; if ( generalProgressListener instanceof LegacyS3ProgressListener ) { return ( ( LegacyS3ProgressListener ) generalProgressListener ) .... | Returns the optional progress listener for receiving updates about object download status . |
3,887 | public GetObjectRequest withProgressListener ( com . ibm . cloud . objectstorage . services . s3 . model . ProgressListener progressListener ) { setProgressListener ( progressListener ) ; return this ; } | Sets the optional progress listener for receiving updates about object download status and returns this updated object so that additional method calls can be chained together . |
3,888 | public static boolean isThrottlingException ( SdkBaseException exception ) { if ( ! isAse ( exception ) ) { return false ; } final AmazonServiceException ase = toAse ( exception ) ; return THROTTLING_ERROR_CODES . contains ( ase . getErrorCode ( ) ) || ase . getStatusCode ( ) == 429 ; } | Returns true if the specified exception is a throttling error . |
3,889 | public static boolean isRequestEntityTooLargeException ( SdkBaseException exception ) { return isAse ( exception ) && toAse ( exception ) . getStatusCode ( ) == HttpStatus . SC_REQUEST_TOO_LONG ; } | Returns true if the specified exception is a request entity too large error . |
3,890 | public static boolean isClockSkewError ( SdkBaseException exception ) { return isAse ( exception ) && CLOCK_SKEW_ERROR_CODES . contains ( toAse ( exception ) . getErrorCode ( ) ) ; } | Returns true if the specified exception is a clock skew error . |
3,891 | private static SecuredCEK secureCEK ( SecretKey cek , EncryptionMaterials materials , S3KeyWrapScheme kwScheme , SecureRandom srand , Provider p , AWSKMS kms , AmazonWebServiceRequest req ) { final Map < String , String > matdesc ; if ( materials . isKMSEnabled ( ) ) { matdesc = mergeMaterialDescriptions ( materials , ... | Secure the given CEK . Note network calls are involved if the CEK is to be protected by KMS . |
3,892 | public void abort ( ) throws IOException { for ( Transfer fileDownload : subTransfers ) { ( ( DownloadImpl ) fileDownload ) . abortWithoutNotifyingStateChangeListener ( ) ; } for ( Transfer fileDownload : subTransfers ) { ( ( DownloadImpl ) fileDownload ) . notifyStateChangeListeners ( TransferState . Canceled ) ; } } | Aborts all outstanding downloads . |
3,893 | protected Request < CreateBucketRequest > addIAMHeaders ( Request < CreateBucketRequest > request , CreateBucketRequest createBucketRequest ) { if ( ( null != this . awsCredentialsProvider ) && ( this . awsCredentialsProvider . getCredentials ( ) instanceof IBMOAuthCredentials ) ) { if ( null != createBucketRequest . g... | Add IAM specific headers based on the credentials set & any optional parameters added to the CreateBucketRequest object |
3,894 | private ContentCryptoMaterial newContentCryptoMaterial ( EncryptionMaterialsProvider kekMaterialProvider , Map < String , String > materialsDescription , Provider provider , AmazonWebServiceRequest req ) { EncryptionMaterials kekMaterials = kekMaterialProvider . getEncryptionMaterials ( materialsDescription ) ; if ( ke... | Returns the content encryption material generated with the given kek material material description and security providers ; or null if the encryption material cannot be found for the specified description . |
3,895 | private ContentCryptoMaterial newContentCryptoMaterial ( EncryptionMaterialsProvider kekMaterialProvider , Provider provider , AmazonWebServiceRequest req ) { EncryptionMaterials kekMaterials = kekMaterialProvider . getEncryptionMaterials ( ) ; if ( kekMaterials == null ) throw new SdkClientException ( "No material ava... | Returns a non - null content encryption material generated with the given kek material and security providers . |
3,896 | public FASPConnectionInfoHandler parseFASPConnectionInfoResponse ( InputStream inputStream ) throws IOException { FASPConnectionInfoHandler handler = new FASPConnectionInfoHandler ( ) ; parseXmlInputStream ( handler , inputStream ) ; return handler ; } | Parses an FASPConnectionInfoHandler response XML document from an input stream . |
3,897 | public void setOutputSchemaVersion ( StorageClassAnalysisSchemaVersion outputSchemaVersion ) { if ( outputSchemaVersion == null ) { setOutputSchemaVersion ( ( String ) null ) ; } else { setOutputSchemaVersion ( outputSchemaVersion . toString ( ) ) ; } } | Sets the version of the output schema to use when exporting data . |
3,898 | public static S3Objects withPrefix ( AmazonS3 s3 , String bucketName , String prefix ) { S3Objects objects = new S3Objects ( s3 , bucketName ) ; objects . prefix = prefix ; return objects ; } | Constructs an iterable that covers the objects in an Amazon S3 bucket where the key begins with the given prefix . |
3,899 | private static synchronized ProfileCredentialsService getProfileCredentialService ( ) { if ( STS_CREDENTIALS_SERVICE == null ) { try { STS_CREDENTIALS_SERVICE = ( ProfileCredentialsService ) Class . forName ( CLASS_NAME ) . newInstance ( ) ; } catch ( ClassNotFoundException ex ) { throw new SdkClientException ( "To use... | Only called once per creation of each profile credential provider so we don t bother with any double checked locking . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.