id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
4,800
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java
PreferenceActivity.setToolbarElevation
public final void setToolbarElevation(final int elevation) { Condition.INSTANCE.ensureAtLeast(elevation, 0, "The elevation must be at least 0"); Condition.INSTANCE.ensureAtMaximum(elevation, ElevationUtil.MAX_ELEVATION, "The elevation must at maximum " + ElevationUtil.MAX_ELEVATION); this.toolbarElevation = elevation; adaptToolbarElevation(); }
java
public final void setToolbarElevation(final int elevation) { Condition.INSTANCE.ensureAtLeast(elevation, 0, "The elevation must be at least 0"); Condition.INSTANCE.ensureAtMaximum(elevation, ElevationUtil.MAX_ELEVATION, "The elevation must at maximum " + ElevationUtil.MAX_ELEVATION); this.toolbarElevation = elevation; adaptToolbarElevation(); }
[ "public", "final", "void", "setToolbarElevation", "(", "final", "int", "elevation", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureAtLeast", "(", "elevation", ",", "0", ",", "\"The elevation must be at least 0\"", ")", ";", "Condition", ".", "INSTANCE", ".", "ensureAtMaximum", "(", "elevation", ",", "ElevationUtil", ".", "MAX_ELEVATION", ",", "\"The elevation must at maximum \"", "+", "ElevationUtil", ".", "MAX_ELEVATION", ")", ";", "this", ".", "toolbarElevation", "=", "elevation", ";", "adaptToolbarElevation", "(", ")", ";", "}" ]
Sets the elevation of the activity's toolbar. @param elevation The elevation, which should be set, in dp as an {@link Integer} value. The elevation must be at least 0 and at maximum 16
[ "Sets", "the", "elevation", "of", "the", "activity", "s", "toolbar", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java#L2405-L2411
4,801
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java
PreferenceActivity.setBreadCrumbElevation
public final void setBreadCrumbElevation(final int elevation) { Condition.INSTANCE.ensureAtLeast(elevation, 0, "The elevation must be at least 0"); Condition.INSTANCE.ensureAtMaximum(elevation, ElevationUtil.MAX_ELEVATION, "The elevation must at maximum " + ElevationUtil.MAX_ELEVATION); this.breadCrumbElevation = elevation; adaptBreadCrumbElevation(); }
java
public final void setBreadCrumbElevation(final int elevation) { Condition.INSTANCE.ensureAtLeast(elevation, 0, "The elevation must be at least 0"); Condition.INSTANCE.ensureAtMaximum(elevation, ElevationUtil.MAX_ELEVATION, "The elevation must at maximum " + ElevationUtil.MAX_ELEVATION); this.breadCrumbElevation = elevation; adaptBreadCrumbElevation(); }
[ "public", "final", "void", "setBreadCrumbElevation", "(", "final", "int", "elevation", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureAtLeast", "(", "elevation", ",", "0", ",", "\"The elevation must be at least 0\"", ")", ";", "Condition", ".", "INSTANCE", ".", "ensureAtMaximum", "(", "elevation", ",", "ElevationUtil", ".", "MAX_ELEVATION", ",", "\"The elevation must at maximum \"", "+", "ElevationUtil", ".", "MAX_ELEVATION", ")", ";", "this", ".", "breadCrumbElevation", "=", "elevation", ";", "adaptBreadCrumbElevation", "(", ")", ";", "}" ]
Sets the elevation of the toolbar, which is used to show the bread crumb of the currently selected navigation preference, when using the split screen layout. @param elevation The elevation, which should be set, in dp as an {@link Integer} value. The elevation must be at least 0 and at maximum 16
[ "Sets", "the", "elevation", "of", "the", "toolbar", "which", "is", "used", "to", "show", "the", "bread", "crumb", "of", "the", "currently", "selected", "navigation", "preference", "when", "using", "the", "split", "screen", "layout", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java#L2433-L2439
4,802
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java
PreferenceActivity.setCardViewElevation
public final void setCardViewElevation(final int elevation) { Condition.INSTANCE.ensureAtLeast(elevation, 0, "The elevation must be at least 0"); Condition.INSTANCE.ensureAtMaximum(elevation, ElevationUtil.MAX_ELEVATION, "The elevation must be at maximum " + ElevationUtil.MAX_ELEVATION); this.cardViewElevation = elevation; adaptCardViewElevation(); }
java
public final void setCardViewElevation(final int elevation) { Condition.INSTANCE.ensureAtLeast(elevation, 0, "The elevation must be at least 0"); Condition.INSTANCE.ensureAtMaximum(elevation, ElevationUtil.MAX_ELEVATION, "The elevation must be at maximum " + ElevationUtil.MAX_ELEVATION); this.cardViewElevation = elevation; adaptCardViewElevation(); }
[ "public", "final", "void", "setCardViewElevation", "(", "final", "int", "elevation", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureAtLeast", "(", "elevation", ",", "0", ",", "\"The elevation must be at least 0\"", ")", ";", "Condition", ".", "INSTANCE", ".", "ensureAtMaximum", "(", "elevation", ",", "ElevationUtil", ".", "MAX_ELEVATION", ",", "\"The elevation must be at maximum \"", "+", "ElevationUtil", ".", "MAX_ELEVATION", ")", ";", "this", ".", "cardViewElevation", "=", "elevation", ";", "adaptCardViewElevation", "(", ")", ";", "}" ]
Sets the elevation of the card view, which contains the currently shown prefernce fragment, when using the split screen layout. @param elevation The elevation, which should be set, in dp as an {@link Integer} value. The elevation must be at least 0 and at maximum 16
[ "Sets", "the", "elevation", "of", "the", "card", "view", "which", "contains", "the", "currently", "shown", "prefernce", "fragment", "when", "using", "the", "split", "screen", "layout", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java#L2460-L2466
4,803
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java
PreferenceActivity.setButtonBarElevation
public final void setButtonBarElevation(final int elevation) { Condition.INSTANCE.ensureAtLeast(elevation, 0, "The elevation must be at least 0"); Condition.INSTANCE.ensureAtMaximum(elevation, ElevationUtil.MAX_ELEVATION, "The elevation must be at maximum " + ElevationUtil.MAX_ELEVATION); this.buttonBarElevation = elevation; adaptButtonBarElevation(); }
java
public final void setButtonBarElevation(final int elevation) { Condition.INSTANCE.ensureAtLeast(elevation, 0, "The elevation must be at least 0"); Condition.INSTANCE.ensureAtMaximum(elevation, ElevationUtil.MAX_ELEVATION, "The elevation must be at maximum " + ElevationUtil.MAX_ELEVATION); this.buttonBarElevation = elevation; adaptButtonBarElevation(); }
[ "public", "final", "void", "setButtonBarElevation", "(", "final", "int", "elevation", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureAtLeast", "(", "elevation", ",", "0", ",", "\"The elevation must be at least 0\"", ")", ";", "Condition", ".", "INSTANCE", ".", "ensureAtMaximum", "(", "elevation", ",", "ElevationUtil", ".", "MAX_ELEVATION", ",", "\"The elevation must be at maximum \"", "+", "ElevationUtil", ".", "MAX_ELEVATION", ")", ";", "this", ".", "buttonBarElevation", "=", "elevation", ";", "adaptButtonBarElevation", "(", ")", ";", "}" ]
Sets the elevation of the button bar, which is shown when using the activity as a wizard. @param elevation The elevation, which should be set, in dp as an {@link Integer} value. The elevation must be at least 0 and at maximum 16
[ "Sets", "the", "elevation", "of", "the", "button", "bar", "which", "is", "shown", "when", "using", "the", "activity", "as", "a", "wizard", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java#L2485-L2491
4,804
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java
PreferenceActivity.getAllNavigationPreferences
@NonNull public final List<NavigationPreference> getAllNavigationPreferences() { return navigationFragment != null ? navigationFragment.getAllNavigationPreferences() : Collections.<NavigationPreference>emptyList(); }
java
@NonNull public final List<NavigationPreference> getAllNavigationPreferences() { return navigationFragment != null ? navigationFragment.getAllNavigationPreferences() : Collections.<NavigationPreference>emptyList(); }
[ "@", "NonNull", "public", "final", "List", "<", "NavigationPreference", ">", "getAllNavigationPreferences", "(", ")", "{", "return", "navigationFragment", "!=", "null", "?", "navigationFragment", ".", "getAllNavigationPreferences", "(", ")", ":", "Collections", ".", "<", "NavigationPreference", ">", "emptyList", "(", ")", ";", "}" ]
Returns a list, which contains all navigation preferences, which are contained by the activity. @return A list, which contains all navigation preferences, which are contained by the activity, as an instance of the type {@link List} or an empty collection, if no navigation preferences are contained by the activity
[ "Returns", "a", "list", "which", "contains", "all", "navigation", "preferences", "which", "are", "contained", "by", "the", "activity", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceActivity.java#L2705-L2709
4,805
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/DynamicSettingsActivity.java
DynamicSettingsActivity.addNavigationPreference
private void addNavigationPreference() { NavigationPreference navigationPreference = new NavigationPreference(this); navigationPreference.setTitle(getPreferenceHeaderTitle()); navigationPreference.setFragment(NewPreferenceHeaderFragment.class.getName()); getNavigationFragment().getPreferenceScreen().addPreference(navigationPreference); invalidateOptionsMenu(); }
java
private void addNavigationPreference() { NavigationPreference navigationPreference = new NavigationPreference(this); navigationPreference.setTitle(getPreferenceHeaderTitle()); navigationPreference.setFragment(NewPreferenceHeaderFragment.class.getName()); getNavigationFragment().getPreferenceScreen().addPreference(navigationPreference); invalidateOptionsMenu(); }
[ "private", "void", "addNavigationPreference", "(", ")", "{", "NavigationPreference", "navigationPreference", "=", "new", "NavigationPreference", "(", "this", ")", ";", "navigationPreference", ".", "setTitle", "(", "getPreferenceHeaderTitle", "(", ")", ")", ";", "navigationPreference", ".", "setFragment", "(", "NewPreferenceHeaderFragment", ".", "class", ".", "getName", "(", ")", ")", ";", "getNavigationFragment", "(", ")", ".", "getPreferenceScreen", "(", ")", ".", "addPreference", "(", "navigationPreference", ")", ";", "invalidateOptionsMenu", "(", ")", ";", "}" ]
Dynamically adds a new navigation preference to the activity.
[ "Dynamically", "adds", "a", "new", "navigation", "preference", "to", "the", "activity", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/DynamicSettingsActivity.java#L49-L55
4,806
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/DynamicSettingsActivity.java
DynamicSettingsActivity.getPreferenceHeaderTitle
private CharSequence getPreferenceHeaderTitle() { CharSequence originalTitle = getText(R.string.new_navigation_preference_title); CharSequence title = originalTitle; int counter = 1; while (isTitleAlreadyUsed(title)) { title = originalTitle + " (" + counter + ")"; counter++; } return title; }
java
private CharSequence getPreferenceHeaderTitle() { CharSequence originalTitle = getText(R.string.new_navigation_preference_title); CharSequence title = originalTitle; int counter = 1; while (isTitleAlreadyUsed(title)) { title = originalTitle + " (" + counter + ")"; counter++; } return title; }
[ "private", "CharSequence", "getPreferenceHeaderTitle", "(", ")", "{", "CharSequence", "originalTitle", "=", "getText", "(", "R", ".", "string", ".", "new_navigation_preference_title", ")", ";", "CharSequence", "title", "=", "originalTitle", ";", "int", "counter", "=", "1", ";", "while", "(", "isTitleAlreadyUsed", "(", "title", ")", ")", "{", "title", "=", "originalTitle", "+", "\" (\"", "+", "counter", "+", "\")\"", ";", "counter", "++", ";", "}", "return", "title", ";", "}" ]
Returns an unique title, which can be used for a new preference header. @return The title as an instance of the class {@link CharSequence}
[ "Returns", "an", "unique", "title", "which", "can", "be", "used", "for", "a", "new", "preference", "header", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/DynamicSettingsActivity.java#L70-L81
4,807
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/DynamicSettingsActivity.java
DynamicSettingsActivity.isTitleAlreadyUsed
private boolean isTitleAlreadyUsed(@NonNull final CharSequence title) { for (NavigationPreference navigationPreference : getAllNavigationPreferences()) { if (title.equals(navigationPreference.getTitle())) { return true; } } return false; }
java
private boolean isTitleAlreadyUsed(@NonNull final CharSequence title) { for (NavigationPreference navigationPreference : getAllNavigationPreferences()) { if (title.equals(navigationPreference.getTitle())) { return true; } } return false; }
[ "private", "boolean", "isTitleAlreadyUsed", "(", "@", "NonNull", "final", "CharSequence", "title", ")", "{", "for", "(", "NavigationPreference", "navigationPreference", ":", "getAllNavigationPreferences", "(", ")", ")", "{", "if", "(", "title", ".", "equals", "(", "navigationPreference", ".", "getTitle", "(", ")", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Returns, whether a preference header, which has a specific title, has already been added to the activity, or not. @param title The title, whose presence should be checked, as an instance of the class {@link CharSequence}. The tile may not be null @return True, if a preference header, which has the given title, has already been added to the activity, false otherwise
[ "Returns", "whether", "a", "preference", "header", "which", "has", "a", "specific", "title", "has", "already", "been", "added", "to", "the", "activity", "or", "not", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/DynamicSettingsActivity.java#L93-L101
4,808
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.obtainShowRestoreDefaultsButton
private void obtainShowRestoreDefaultsButton() { boolean show = ThemeUtil.getBoolean(getActivity(), R.attr.showRestoreDefaultsButton, false); showRestoreDefaultsButton(show); }
java
private void obtainShowRestoreDefaultsButton() { boolean show = ThemeUtil.getBoolean(getActivity(), R.attr.showRestoreDefaultsButton, false); showRestoreDefaultsButton(show); }
[ "private", "void", "obtainShowRestoreDefaultsButton", "(", ")", "{", "boolean", "show", "=", "ThemeUtil", ".", "getBoolean", "(", "getActivity", "(", ")", ",", "R", ".", "attr", ".", "showRestoreDefaultsButton", ",", "false", ")", ";", "showRestoreDefaultsButton", "(", "show", ")", ";", "}" ]
Obtains, whether the button, which allows to restore the preferences' default values, should be shown, or not, from the activity's current theme.
[ "Obtains", "whether", "the", "button", "which", "allows", "to", "restore", "the", "preferences", "default", "values", "should", "be", "shown", "or", "not", "from", "the", "activity", "s", "current", "theme", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L141-L144
4,809
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.obtainRestoreDefaultsButtonText
private void obtainRestoreDefaultsButtonText() { CharSequence text; try { text = ThemeUtil.getText(getActivity(), R.attr.restoreDefaultsButtonText); } catch (NotFoundException e) { text = getText(R.string.restore_defaults_button_text); } setRestoreDefaultsButtonText(text); }
java
private void obtainRestoreDefaultsButtonText() { CharSequence text; try { text = ThemeUtil.getText(getActivity(), R.attr.restoreDefaultsButtonText); } catch (NotFoundException e) { text = getText(R.string.restore_defaults_button_text); } setRestoreDefaultsButtonText(text); }
[ "private", "void", "obtainRestoreDefaultsButtonText", "(", ")", "{", "CharSequence", "text", ";", "try", "{", "text", "=", "ThemeUtil", ".", "getText", "(", "getActivity", "(", ")", ",", "R", ".", "attr", ".", "restoreDefaultsButtonText", ")", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "text", "=", "getText", "(", "R", ".", "string", ".", "restore_defaults_button_text", ")", ";", "}", "setRestoreDefaultsButtonText", "(", "text", ")", ";", "}" ]
Obtains the text of the button, which allows to restore the preferences' default values, from the activity's current theme.
[ "Obtains", "the", "text", "of", "the", "button", "which", "allows", "to", "restore", "the", "preferences", "default", "values", "from", "the", "activity", "s", "current", "theme", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L150-L160
4,810
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.obtainButtonBarBackground
private void obtainButtonBarBackground() { try { int color = ThemeUtil.getColor(getActivity(), R.attr.restoreDefaultsButtonBarBackground); setButtonBarBackgroundColor(color); } catch (NotFoundException e) { int resourceId = ThemeUtil .getResId(getActivity(), R.attr.restoreDefaultsButtonBarBackground, -1); if (resourceId != -1) { setButtonBarBackground(resourceId); } else { setButtonBarBackgroundColor( ContextCompat.getColor(getActivity(), R.color.button_bar_background_light)); } } }
java
private void obtainButtonBarBackground() { try { int color = ThemeUtil.getColor(getActivity(), R.attr.restoreDefaultsButtonBarBackground); setButtonBarBackgroundColor(color); } catch (NotFoundException e) { int resourceId = ThemeUtil .getResId(getActivity(), R.attr.restoreDefaultsButtonBarBackground, -1); if (resourceId != -1) { setButtonBarBackground(resourceId); } else { setButtonBarBackgroundColor( ContextCompat.getColor(getActivity(), R.color.button_bar_background_light)); } } }
[ "private", "void", "obtainButtonBarBackground", "(", ")", "{", "try", "{", "int", "color", "=", "ThemeUtil", ".", "getColor", "(", "getActivity", "(", ")", ",", "R", ".", "attr", ".", "restoreDefaultsButtonBarBackground", ")", ";", "setButtonBarBackgroundColor", "(", "color", ")", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "int", "resourceId", "=", "ThemeUtil", ".", "getResId", "(", "getActivity", "(", ")", ",", "R", ".", "attr", ".", "restoreDefaultsButtonBarBackground", ",", "-", "1", ")", ";", "if", "(", "resourceId", "!=", "-", "1", ")", "{", "setButtonBarBackground", "(", "resourceId", ")", ";", "}", "else", "{", "setButtonBarBackgroundColor", "(", "ContextCompat", ".", "getColor", "(", "getActivity", "(", ")", ",", "R", ".", "color", ".", "button_bar_background_light", ")", ")", ";", "}", "}", "}" ]
Obtains the background of the button bar from the activity's current theme.
[ "Obtains", "the", "background", "of", "the", "button", "bar", "from", "the", "activity", "s", "current", "theme", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L165-L181
4,811
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.handleArguments
private void handleArguments() { Bundle arguments = getArguments(); if (arguments != null) { handleShowRestoreDefaultsButtonArgument(arguments); handleRestoreDefaultsButtonTextArgument(arguments); } }
java
private void handleArguments() { Bundle arguments = getArguments(); if (arguments != null) { handleShowRestoreDefaultsButtonArgument(arguments); handleRestoreDefaultsButtonTextArgument(arguments); } }
[ "private", "void", "handleArguments", "(", ")", "{", "Bundle", "arguments", "=", "getArguments", "(", ")", ";", "if", "(", "arguments", "!=", "null", ")", "{", "handleShowRestoreDefaultsButtonArgument", "(", "arguments", ")", ";", "handleRestoreDefaultsButtonTextArgument", "(", "arguments", ")", ";", "}", "}" ]
Handles the arguments, which have been passed to the fragment.
[ "Handles", "the", "arguments", "which", "have", "been", "passed", "to", "the", "fragment", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L202-L209
4,812
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.handleShowRestoreDefaultsButtonArgument
private void handleShowRestoreDefaultsButtonArgument(@NonNull final Bundle arguments) { boolean showButton = arguments.getBoolean(EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON, false); showRestoreDefaultsButton(showButton); }
java
private void handleShowRestoreDefaultsButtonArgument(@NonNull final Bundle arguments) { boolean showButton = arguments.getBoolean(EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON, false); showRestoreDefaultsButton(showButton); }
[ "private", "void", "handleShowRestoreDefaultsButtonArgument", "(", "@", "NonNull", "final", "Bundle", "arguments", ")", "{", "boolean", "showButton", "=", "arguments", ".", "getBoolean", "(", "EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON", ",", "false", ")", ";", "showRestoreDefaultsButton", "(", "showButton", ")", ";", "}" ]
Handles the extra of the arguments, which have been passed to the fragment, that allows to show the button, which allows to restore the preferences' default values. @param arguments The arguments, which have been passed to the fragment, as an instance of the class {@link Bundle}. The arguments may not be null
[ "Handles", "the", "extra", "of", "the", "arguments", "which", "have", "been", "passed", "to", "the", "fragment", "that", "allows", "to", "show", "the", "button", "which", "allows", "to", "restore", "the", "preferences", "default", "values", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L219-L222
4,813
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.handleRestoreDefaultsButtonTextArgument
private void handleRestoreDefaultsButtonTextArgument(@NonNull final Bundle arguments) { CharSequence buttonText = getCharSequenceFromArguments(arguments, EXTRA_RESTORE_DEFAULTS_BUTTON_TEXT); if (!TextUtils.isEmpty(buttonText)) { setRestoreDefaultsButtonText(buttonText); } }
java
private void handleRestoreDefaultsButtonTextArgument(@NonNull final Bundle arguments) { CharSequence buttonText = getCharSequenceFromArguments(arguments, EXTRA_RESTORE_DEFAULTS_BUTTON_TEXT); if (!TextUtils.isEmpty(buttonText)) { setRestoreDefaultsButtonText(buttonText); } }
[ "private", "void", "handleRestoreDefaultsButtonTextArgument", "(", "@", "NonNull", "final", "Bundle", "arguments", ")", "{", "CharSequence", "buttonText", "=", "getCharSequenceFromArguments", "(", "arguments", ",", "EXTRA_RESTORE_DEFAULTS_BUTTON_TEXT", ")", ";", "if", "(", "!", "TextUtils", ".", "isEmpty", "(", "buttonText", ")", ")", "{", "setRestoreDefaultsButtonText", "(", "buttonText", ")", ";", "}", "}" ]
Handles the extra of the arguments, which have been passed to the fragment, that allows to specify a custom text for the button, which allows to restore the preferences' default values. @param arguments The arguments, which have been passed to the fragment, as an instance of the class {@link Bundle}. The arguments may not be null
[ "Handles", "the", "extra", "of", "the", "arguments", "which", "have", "been", "passed", "to", "the", "fragment", "that", "allows", "to", "specify", "a", "custom", "text", "for", "the", "button", "which", "allows", "to", "restore", "the", "preferences", "default", "values", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L233-L240
4,814
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.getCharSequenceFromArguments
private CharSequence getCharSequenceFromArguments(@NonNull final Bundle arguments, @NonNull final String name) { CharSequence charSequence = arguments.getCharSequence(name); if (charSequence == null) { int resourceId = arguments.getInt(name, -1); if (resourceId != -1) { charSequence = getText(resourceId); } } return charSequence; }
java
private CharSequence getCharSequenceFromArguments(@NonNull final Bundle arguments, @NonNull final String name) { CharSequence charSequence = arguments.getCharSequence(name); if (charSequence == null) { int resourceId = arguments.getInt(name, -1); if (resourceId != -1) { charSequence = getText(resourceId); } } return charSequence; }
[ "private", "CharSequence", "getCharSequenceFromArguments", "(", "@", "NonNull", "final", "Bundle", "arguments", ",", "@", "NonNull", "final", "String", "name", ")", "{", "CharSequence", "charSequence", "=", "arguments", ".", "getCharSequence", "(", "name", ")", ";", "if", "(", "charSequence", "==", "null", ")", "{", "int", "resourceId", "=", "arguments", ".", "getInt", "(", "name", ",", "-", "1", ")", ";", "if", "(", "resourceId", "!=", "-", "1", ")", "{", "charSequence", "=", "getText", "(", "resourceId", ")", ";", "}", "}", "return", "charSequence", ";", "}" ]
Returns the char sequence, which is specified by a specific extra of the arguments, which have been passed to the fragment. The char sequence can either be specified as a string or as a resource id. @param arguments The arguments, which have been passed to the fragment, as an instance of the class {@link Bundle}. The arguments may not be null @param name The name of the extra, which specifies the char sequence, as a {@link String}. The name may not be null @return The char sequence, which is specified by the arguments, as an instance of the class {@link CharSequence} or null, if the arguments do not specify a char sequence with the given name
[ "Returns", "the", "char", "sequence", "which", "is", "specified", "by", "a", "specific", "extra", "of", "the", "arguments", "which", "have", "been", "passed", "to", "the", "fragment", ".", "The", "char", "sequence", "can", "either", "be", "specified", "as", "a", "string", "or", "as", "a", "resource", "id", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L257-L270
4,815
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.restoreDefaults
private void restoreDefaults(@NonNull final PreferenceGroup preferenceGroup, @NonNull final SharedPreferences sharedPreferences) { for (int i = 0; i < preferenceGroup.getPreferenceCount(); i++) { Preference preference = preferenceGroup.getPreference(i); if (preference instanceof PreferenceGroup) { restoreDefaults((PreferenceGroup) preference, sharedPreferences); } else if (preference.getKey() != null && !preference.getKey().isEmpty()) { Object oldValue = sharedPreferences.getAll().get(preference.getKey()); if (notifyOnRestoreDefaultValueRequested(preference, oldValue)) { sharedPreferences.edit().remove(preference.getKey()).apply(); preferenceGroup.removePreference(preference); preferenceGroup.addPreference(preference); Object newValue = sharedPreferences.getAll().get(preference.getKey()); notifyOnRestoredDefaultValue(preference, oldValue, newValue); } else { preferenceGroup.removePreference(preference); preferenceGroup.addPreference(preference); } } } }
java
private void restoreDefaults(@NonNull final PreferenceGroup preferenceGroup, @NonNull final SharedPreferences sharedPreferences) { for (int i = 0; i < preferenceGroup.getPreferenceCount(); i++) { Preference preference = preferenceGroup.getPreference(i); if (preference instanceof PreferenceGroup) { restoreDefaults((PreferenceGroup) preference, sharedPreferences); } else if (preference.getKey() != null && !preference.getKey().isEmpty()) { Object oldValue = sharedPreferences.getAll().get(preference.getKey()); if (notifyOnRestoreDefaultValueRequested(preference, oldValue)) { sharedPreferences.edit().remove(preference.getKey()).apply(); preferenceGroup.removePreference(preference); preferenceGroup.addPreference(preference); Object newValue = sharedPreferences.getAll().get(preference.getKey()); notifyOnRestoredDefaultValue(preference, oldValue, newValue); } else { preferenceGroup.removePreference(preference); preferenceGroup.addPreference(preference); } } } }
[ "private", "void", "restoreDefaults", "(", "@", "NonNull", "final", "PreferenceGroup", "preferenceGroup", ",", "@", "NonNull", "final", "SharedPreferences", "sharedPreferences", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "preferenceGroup", ".", "getPreferenceCount", "(", ")", ";", "i", "++", ")", "{", "Preference", "preference", "=", "preferenceGroup", ".", "getPreference", "(", "i", ")", ";", "if", "(", "preference", "instanceof", "PreferenceGroup", ")", "{", "restoreDefaults", "(", "(", "PreferenceGroup", ")", "preference", ",", "sharedPreferences", ")", ";", "}", "else", "if", "(", "preference", ".", "getKey", "(", ")", "!=", "null", "&&", "!", "preference", ".", "getKey", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "Object", "oldValue", "=", "sharedPreferences", ".", "getAll", "(", ")", ".", "get", "(", "preference", ".", "getKey", "(", ")", ")", ";", "if", "(", "notifyOnRestoreDefaultValueRequested", "(", "preference", ",", "oldValue", ")", ")", "{", "sharedPreferences", ".", "edit", "(", ")", ".", "remove", "(", "preference", ".", "getKey", "(", ")", ")", ".", "apply", "(", ")", ";", "preferenceGroup", ".", "removePreference", "(", "preference", ")", ";", "preferenceGroup", ".", "addPreference", "(", "preference", ")", ";", "Object", "newValue", "=", "sharedPreferences", ".", "getAll", "(", ")", ".", "get", "(", "preference", ".", "getKey", "(", ")", ")", ";", "notifyOnRestoredDefaultValue", "(", "preference", ",", "oldValue", ",", "newValue", ")", ";", "}", "else", "{", "preferenceGroup", ".", "removePreference", "(", "preference", ")", ";", "preferenceGroup", ".", "addPreference", "(", "preference", ")", ";", "}", "}", "}", "}" ]
Restores the default preferences, which are contained by a specific preference group. @param preferenceGroup The preference group, whose preferences should be restored, as an instance of the class {@link PreferenceGroup}. The preference group may not be null @param sharedPreferences The shared preferences, which should be used to restore the preferences, as an instance of the type {@link SharedPreferences}. The shared preferences may not be null
[ "Restores", "the", "default", "preferences", "which", "are", "contained", "by", "a", "specific", "preference", "group", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L302-L325
4,816
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.notifyOnRestoreDefaultValuesRequested
private boolean notifyOnRestoreDefaultValuesRequested() { boolean result = true; for (RestoreDefaultsListener listener : restoreDefaultsListeners) { result &= listener.onRestoreDefaultValuesRequested(this); } return result; }
java
private boolean notifyOnRestoreDefaultValuesRequested() { boolean result = true; for (RestoreDefaultsListener listener : restoreDefaultsListeners) { result &= listener.onRestoreDefaultValuesRequested(this); } return result; }
[ "private", "boolean", "notifyOnRestoreDefaultValuesRequested", "(", ")", "{", "boolean", "result", "=", "true", ";", "for", "(", "RestoreDefaultsListener", "listener", ":", "restoreDefaultsListeners", ")", "{", "result", "&=", "listener", ".", "onRestoreDefaultValuesRequested", "(", "this", ")", ";", "}", "return", "result", ";", "}" ]
Notifies all registered listeners, that the preferences' default values should be restored. @return True, if restoring the preferences' default values should be proceeded, false otherwise
[ "Notifies", "all", "registered", "listeners", "that", "the", "preferences", "default", "values", "should", "be", "restored", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L333-L341
4,817
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.notifyOnRestoreDefaultValueRequested
private boolean notifyOnRestoreDefaultValueRequested(@NonNull final Preference preference, final Object currentValue) { boolean result = true; for (RestoreDefaultsListener listener : restoreDefaultsListeners) { result &= listener.onRestoreDefaultValueRequested(this, preference, currentValue); } return result; }
java
private boolean notifyOnRestoreDefaultValueRequested(@NonNull final Preference preference, final Object currentValue) { boolean result = true; for (RestoreDefaultsListener listener : restoreDefaultsListeners) { result &= listener.onRestoreDefaultValueRequested(this, preference, currentValue); } return result; }
[ "private", "boolean", "notifyOnRestoreDefaultValueRequested", "(", "@", "NonNull", "final", "Preference", "preference", ",", "final", "Object", "currentValue", ")", "{", "boolean", "result", "=", "true", ";", "for", "(", "RestoreDefaultsListener", "listener", ":", "restoreDefaultsListeners", ")", "{", "result", "&=", "listener", ".", "onRestoreDefaultValueRequested", "(", "this", ",", "preference", ",", "currentValue", ")", ";", "}", "return", "result", ";", "}" ]
Notifies all registered listeners, that the default value of a specific preference should be restored. @param preference The preference, whose default value should be restored, as an instance of the class {@link Preference}. The preference may not be null @param currentValue The current value of the preference, whose default value should be restored, as an instance of the class {@link Object} @return True, if restoring the preference's default value should be proceeded, false otherwise
[ "Notifies", "all", "registered", "listeners", "that", "the", "default", "value", "of", "a", "specific", "preference", "should", "be", "restored", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L356-L365
4,818
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.notifyOnRestoredDefaultValue
private void notifyOnRestoredDefaultValue(@NonNull final Preference preference, final Object oldValue, final Object newValue) { for (RestoreDefaultsListener listener : restoreDefaultsListeners) { listener.onRestoredDefaultValue(this, preference, oldValue, newValue != null ? newValue : oldValue); } }
java
private void notifyOnRestoredDefaultValue(@NonNull final Preference preference, final Object oldValue, final Object newValue) { for (RestoreDefaultsListener listener : restoreDefaultsListeners) { listener.onRestoredDefaultValue(this, preference, oldValue, newValue != null ? newValue : oldValue); } }
[ "private", "void", "notifyOnRestoredDefaultValue", "(", "@", "NonNull", "final", "Preference", "preference", ",", "final", "Object", "oldValue", ",", "final", "Object", "newValue", ")", "{", "for", "(", "RestoreDefaultsListener", "listener", ":", "restoreDefaultsListeners", ")", "{", "listener", ".", "onRestoredDefaultValue", "(", "this", ",", "preference", ",", "oldValue", ",", "newValue", "!=", "null", "?", "newValue", ":", "oldValue", ")", ";", "}", "}" ]
Notifies all registered listeners, that the default value of a specific preference has been be restored. @param preference The preference, whose default value has been restored, as an instance of the class {@link Preference}. The preference may not be null @param oldValue The old value of the preference, whose default value has been restored, as an instance of the class {@link Object} @param newValue The new value of the preference, whose default value has been restored, as an instance of the class {@link Object}
[ "Notifies", "all", "registered", "listeners", "that", "the", "default", "value", "of", "a", "specific", "preference", "has", "been", "be", "restored", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L381-L387
4,819
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.adaptButtonBarVisibility
private void adaptButtonBarVisibility() { if (buttonBarParent != null) { buttonBarParent.setVisibility(showRestoreDefaultsButton ? View.VISIBLE : View.GONE); } }
java
private void adaptButtonBarVisibility() { if (buttonBarParent != null) { buttonBarParent.setVisibility(showRestoreDefaultsButton ? View.VISIBLE : View.GONE); } }
[ "private", "void", "adaptButtonBarVisibility", "(", ")", "{", "if", "(", "buttonBarParent", "!=", "null", ")", "{", "buttonBarParent", ".", "setVisibility", "(", "showRestoreDefaultsButton", "?", "View", ".", "VISIBLE", ":", "View", ".", "GONE", ")", ";", "}", "}" ]
Adapts the visibility of the button bar.
[ "Adapts", "the", "visibility", "of", "the", "button", "bar", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L392-L396
4,820
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.addRestoreDefaultsListener
public final void addRestoreDefaultsListener(@NonNull final RestoreDefaultsListener listener) { Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null"); this.restoreDefaultsListeners.add(listener); }
java
public final void addRestoreDefaultsListener(@NonNull final RestoreDefaultsListener listener) { Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null"); this.restoreDefaultsListeners.add(listener); }
[ "public", "final", "void", "addRestoreDefaultsListener", "(", "@", "NonNull", "final", "RestoreDefaultsListener", "listener", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "listener", ",", "\"The listener may not be null\"", ")", ";", "this", ".", "restoreDefaultsListeners", ".", "add", "(", "listener", ")", ";", "}" ]
Adds a new listener, which should be notified, when the preferences' default values should be restored, to the fragment. @param listener The listener, which should be added as an instance of the type {@link RestoreDefaultsListener}. The listener may not be null
[ "Adds", "a", "new", "listener", "which", "should", "be", "notified", "when", "the", "preferences", "default", "values", "should", "be", "restored", "to", "the", "fragment", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L466-L469
4,821
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.removeRestoreDefaultsListener
public final void removeRestoreDefaultsListener( @NonNull final RestoreDefaultsListener listener) { Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null"); this.restoreDefaultsListeners.remove(listener); }
java
public final void removeRestoreDefaultsListener( @NonNull final RestoreDefaultsListener listener) { Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null"); this.restoreDefaultsListeners.remove(listener); }
[ "public", "final", "void", "removeRestoreDefaultsListener", "(", "@", "NonNull", "final", "RestoreDefaultsListener", "listener", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "listener", ",", "\"The listener may not be null\"", ")", ";", "this", ".", "restoreDefaultsListeners", ".", "remove", "(", "listener", ")", ";", "}" ]
Removes a specific listener, which should not be notified anymore, when the preferences' default values should be restored, from the fragment. @param listener The listener, which should be removed as an instance of the type {@link RestoreDefaultsListener}. The listener may not be null
[ "Removes", "a", "specific", "listener", "which", "should", "not", "be", "notified", "anymore", "when", "the", "preferences", "default", "values", "should", "be", "restored", "from", "the", "fragment", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L479-L483
4,822
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.restoreDefaults
public final void restoreDefaults() { SharedPreferences sharedPreferences = getPreferenceManager().getSharedPreferences(); if (getPreferenceScreen() != null) { restoreDefaults(getPreferenceScreen(), sharedPreferences); } }
java
public final void restoreDefaults() { SharedPreferences sharedPreferences = getPreferenceManager().getSharedPreferences(); if (getPreferenceScreen() != null) { restoreDefaults(getPreferenceScreen(), sharedPreferences); } }
[ "public", "final", "void", "restoreDefaults", "(", ")", "{", "SharedPreferences", "sharedPreferences", "=", "getPreferenceManager", "(", ")", ".", "getSharedPreferences", "(", ")", ";", "if", "(", "getPreferenceScreen", "(", ")", "!=", "null", ")", "{", "restoreDefaults", "(", "getPreferenceScreen", "(", ")", ",", "sharedPreferences", ")", ";", "}", "}" ]
Restores the default values of all preferences, which are contained by the fragment.
[ "Restores", "the", "default", "values", "of", "all", "preferences", "which", "are", "contained", "by", "the", "fragment", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L488-L494
4,823
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java
PreferenceFragment.setRestoreDefaultsButtonText
public final void setRestoreDefaultsButtonText(@NonNull final CharSequence text) { Condition.INSTANCE.ensureNotNull(text, "The text may not be null"); Condition.INSTANCE.ensureNotEmpty(text, "The text may not be empty"); this.restoreDefaultsButtonText = text; adaptRestoreDefaultsButtonText(); }
java
public final void setRestoreDefaultsButtonText(@NonNull final CharSequence text) { Condition.INSTANCE.ensureNotNull(text, "The text may not be null"); Condition.INSTANCE.ensureNotEmpty(text, "The text may not be empty"); this.restoreDefaultsButtonText = text; adaptRestoreDefaultsButtonText(); }
[ "public", "final", "void", "setRestoreDefaultsButtonText", "(", "@", "NonNull", "final", "CharSequence", "text", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "text", ",", "\"The text may not be null\"", ")", ";", "Condition", ".", "INSTANCE", ".", "ensureNotEmpty", "(", "text", ",", "\"The text may not be empty\"", ")", ";", "this", ".", "restoreDefaultsButtonText", "=", "text", ";", "adaptRestoreDefaultsButtonText", "(", ")", ";", "}" ]
Sets the text of the button, which allows to restore the preferences' default values. The text is only set, if the button is shown. @param text The text, which should be set, as an instance of the class {@link CharSequence}. The text may neither be null, nor empty
[ "Sets", "the", "text", "of", "the", "button", "which", "allows", "to", "restore", "the", "preferences", "default", "values", ".", "The", "text", "is", "only", "set", "if", "the", "button", "is", "shown", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/PreferenceFragment.java#L550-L555
4,824
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/operators/LatchedObserver.java
LatchedObserver.fail
protected boolean fail(Throwable e) { if (done.compareAndSet(false, true)) { onErrorCore(e); return true; } return false; }
java
protected boolean fail(Throwable e) { if (done.compareAndSet(false, true)) { onErrorCore(e); return true; } return false; }
[ "protected", "boolean", "fail", "(", "Throwable", "e", ")", "{", "if", "(", "done", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "onErrorCore", "(", "e", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Try to move into an error state. @param e @return true if succeded, false if this observable has already terminated
[ "Try", "to", "move", "into", "an", "error", "state", "." ]
6294e1da30e639df79f76399906229314c14e74d
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/operators/LatchedObserver.java#L69-L75
4,825
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java
AppearancePreferenceFragment.createToolbarElevationChangeListener
private OnPreferenceChangeListener createToolbarElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { int elevation = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()).setToolbarElevation(elevation); return true; } }; }
java
private OnPreferenceChangeListener createToolbarElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { int elevation = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()).setToolbarElevation(elevation); return true; } }; }
[ "private", "OnPreferenceChangeListener", "createToolbarElevationChangeListener", "(", ")", "{", "return", "new", "OnPreferenceChangeListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPreferenceChange", "(", "Preference", "preference", ",", "Object", "newValue", ")", "{", "int", "elevation", "=", "Integer", ".", "valueOf", "(", "(", "String", ")", "newValue", ")", ";", "(", "(", "PreferenceActivity", ")", "getActivity", "(", ")", ")", ".", "setToolbarElevation", "(", "elevation", ")", ";", "return", "true", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to adapt the elevation of the toolbar, when the value of the corresponding preference has been changed. @return The listener, which has been created, as an instance of the type {@link OnPreferenceChangeListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "adapt", "the", "elevation", "of", "the", "toolbar", "when", "the", "value", "of", "the", "corresponding", "preference", "has", "been", "changed", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java#L67-L78
4,826
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java
AppearancePreferenceFragment.createNavigationWidthChangeListener
private OnPreferenceChangeListener createNavigationWidthChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { int width = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()) .setNavigationWidth(dpToPixels(getActivity(), width)); return true; } }; }
java
private OnPreferenceChangeListener createNavigationWidthChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { int width = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()) .setNavigationWidth(dpToPixels(getActivity(), width)); return true; } }; }
[ "private", "OnPreferenceChangeListener", "createNavigationWidthChangeListener", "(", ")", "{", "return", "new", "OnPreferenceChangeListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPreferenceChange", "(", "final", "Preference", "preference", ",", "final", "Object", "newValue", ")", "{", "int", "width", "=", "Integer", ".", "valueOf", "(", "(", "String", ")", "newValue", ")", ";", "(", "(", "PreferenceActivity", ")", "getActivity", "(", ")", ")", ".", "setNavigationWidth", "(", "dpToPixels", "(", "getActivity", "(", ")", ",", "width", ")", ")", ";", "return", "true", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to adapt the width of the navigation, when the value of the corresponding preference has been changed. @return The listener, which has been created, as an instance of the type {@link OnPreferenceChangeListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "adapt", "the", "width", "of", "the", "navigation", "when", "the", "value", "of", "the", "corresponding", "preference", "has", "been", "changed", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java#L87-L99
4,827
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java
AppearancePreferenceFragment.createPreferenceScreenElevationChangeListener
private OnPreferenceChangeListener createPreferenceScreenElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { int elevation = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()).setCardViewElevation(elevation); return true; } }; }
java
private OnPreferenceChangeListener createPreferenceScreenElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { int elevation = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()).setCardViewElevation(elevation); return true; } }; }
[ "private", "OnPreferenceChangeListener", "createPreferenceScreenElevationChangeListener", "(", ")", "{", "return", "new", "OnPreferenceChangeListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPreferenceChange", "(", "final", "Preference", "preference", ",", "final", "Object", "newValue", ")", "{", "int", "elevation", "=", "Integer", ".", "valueOf", "(", "(", "String", ")", "newValue", ")", ";", "(", "(", "PreferenceActivity", ")", "getActivity", "(", ")", ")", ".", "setCardViewElevation", "(", "elevation", ")", ";", "return", "true", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to adapt the elevation of the preference screen, when the value of the corresponding preference has been changed. @return The listener, which has been created, as an instance of the type {@link OnPreferenceChangeListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "adapt", "the", "elevation", "of", "the", "preference", "screen", "when", "the", "value", "of", "the", "corresponding", "preference", "has", "been", "changed", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java#L108-L119
4,828
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java
AppearancePreferenceFragment.createBreadCrumbElevationChangeListener
private OnPreferenceChangeListener createBreadCrumbElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { int elevation = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()).setBreadCrumbElevation(elevation); return true; } }; }
java
private OnPreferenceChangeListener createBreadCrumbElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { int elevation = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()).setBreadCrumbElevation(elevation); return true; } }; }
[ "private", "OnPreferenceChangeListener", "createBreadCrumbElevationChangeListener", "(", ")", "{", "return", "new", "OnPreferenceChangeListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPreferenceChange", "(", "Preference", "preference", ",", "Object", "newValue", ")", "{", "int", "elevation", "=", "Integer", ".", "valueOf", "(", "(", "String", ")", "newValue", ")", ";", "(", "(", "PreferenceActivity", ")", "getActivity", "(", ")", ")", ".", "setBreadCrumbElevation", "(", "elevation", ")", ";", "return", "true", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to adapt the elevation of the bread crumbs, when the value of the corresponding preference has been changed. @return The listener, which has been created, as an instance of the type {@link OnPreferenceChangeListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "adapt", "the", "elevation", "of", "the", "bread", "crumbs", "when", "the", "value", "of", "the", "corresponding", "preference", "has", "been", "changed", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java#L128-L139
4,829
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java
AppearancePreferenceFragment.createWizardButtonBarElevationChangeListener
private OnPreferenceChangeListener createWizardButtonBarElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { int elevation = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()).setButtonBarElevation(elevation); return true; } }; }
java
private OnPreferenceChangeListener createWizardButtonBarElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { int elevation = Integer.valueOf((String) newValue); ((PreferenceActivity) getActivity()).setButtonBarElevation(elevation); return true; } }; }
[ "private", "OnPreferenceChangeListener", "createWizardButtonBarElevationChangeListener", "(", ")", "{", "return", "new", "OnPreferenceChangeListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPreferenceChange", "(", "final", "Preference", "preference", ",", "final", "Object", "newValue", ")", "{", "int", "elevation", "=", "Integer", ".", "valueOf", "(", "(", "String", ")", "newValue", ")", ";", "(", "(", "PreferenceActivity", ")", "getActivity", "(", ")", ")", ".", "setButtonBarElevation", "(", "elevation", ")", ";", "return", "true", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to adapt the elevation of a wizard's button bar, when the value of the corresponding preference has been changed. @return The listener, which has been created, as an instance of the type {@link OnPreferenceChangeListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "adapt", "the", "elevation", "of", "a", "wizard", "s", "button", "bar", "when", "the", "value", "of", "the", "corresponding", "preference", "has", "been", "changed", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java#L148-L159
4,830
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java
AppearancePreferenceFragment.createPreferenceFragmentButtonBarElevationChangeListener
private OnPreferenceChangeListener createPreferenceFragmentButtonBarElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { int elevation = Integer.valueOf((String) newValue); setButtonBarElevation(elevation); return true; } }; }
java
private OnPreferenceChangeListener createPreferenceFragmentButtonBarElevationChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { int elevation = Integer.valueOf((String) newValue); setButtonBarElevation(elevation); return true; } }; }
[ "private", "OnPreferenceChangeListener", "createPreferenceFragmentButtonBarElevationChangeListener", "(", ")", "{", "return", "new", "OnPreferenceChangeListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPreferenceChange", "(", "final", "Preference", "preference", ",", "final", "Object", "newValue", ")", "{", "int", "elevation", "=", "Integer", ".", "valueOf", "(", "(", "String", ")", "newValue", ")", ";", "setButtonBarElevation", "(", "elevation", ")", ";", "return", "true", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to adapt the elevation of a preference fragment's button bar, when the value of the corresponding preference has been changed. @return The listener, which has been created, as an instance of the type {@link OnPreferenceChangeListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "adapt", "the", "elevation", "of", "a", "preference", "fragment", "s", "button", "bar", "when", "the", "value", "of", "the", "corresponding", "preference", "has", "been", "changed", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java#L168-L179
4,831
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/fragment/AbstractPreferenceFragment.java
AbstractPreferenceFragment.obtainDividerDecoration
private void obtainDividerDecoration() { int dividerColor; try { dividerColor = ThemeUtil.getColor(getActivity(), R.attr.dividerColor); } catch (NotFoundException e) { dividerColor = ContextCompat.getColor(getActivity(), R.color.preference_divider_color_light); } this.dividerDecoration.setDividerColor(dividerColor); this.dividerDecoration.setDividerHeight(DisplayUtil.dpToPixels(getActivity(), 1)); }
java
private void obtainDividerDecoration() { int dividerColor; try { dividerColor = ThemeUtil.getColor(getActivity(), R.attr.dividerColor); } catch (NotFoundException e) { dividerColor = ContextCompat.getColor(getActivity(), R.color.preference_divider_color_light); } this.dividerDecoration.setDividerColor(dividerColor); this.dividerDecoration.setDividerHeight(DisplayUtil.dpToPixels(getActivity(), 1)); }
[ "private", "void", "obtainDividerDecoration", "(", ")", "{", "int", "dividerColor", ";", "try", "{", "dividerColor", "=", "ThemeUtil", ".", "getColor", "(", "getActivity", "(", ")", ",", "R", ".", "attr", ".", "dividerColor", ")", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "dividerColor", "=", "ContextCompat", ".", "getColor", "(", "getActivity", "(", ")", ",", "R", ".", "color", ".", "preference_divider_color_light", ")", ";", "}", "this", ".", "dividerDecoration", ".", "setDividerColor", "(", "dividerColor", ")", ";", "this", ".", "dividerDecoration", ".", "setDividerHeight", "(", "DisplayUtil", ".", "dpToPixels", "(", "getActivity", "(", ")", ",", "1", ")", ")", ";", "}" ]
Obtains the appearance of the dividers, which are shown above preference categories, from the activity's theme.
[ "Obtains", "the", "appearance", "of", "the", "dividers", "which", "are", "shown", "above", "preference", "categories", "from", "the", "activity", "s", "theme", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/fragment/AbstractPreferenceFragment.java#L194-L206
4,832
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/SettingsActivity.java
SettingsActivity.initializeAppearanceNavigationPreference
private void initializeAppearanceNavigationPreference( @NonNull final PreferenceFragmentCompat fragment) { String key = getString(R.string.appearance_navigation_preference_key); NavigationPreference navigationPreference = (NavigationPreference) fragment.findPreference(key); Bundle extras = new Bundle(); extras.putBoolean(PreferenceFragment.EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON, true); navigationPreference.setExtras(extras); }
java
private void initializeAppearanceNavigationPreference( @NonNull final PreferenceFragmentCompat fragment) { String key = getString(R.string.appearance_navigation_preference_key); NavigationPreference navigationPreference = (NavigationPreference) fragment.findPreference(key); Bundle extras = new Bundle(); extras.putBoolean(PreferenceFragment.EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON, true); navigationPreference.setExtras(extras); }
[ "private", "void", "initializeAppearanceNavigationPreference", "(", "@", "NonNull", "final", "PreferenceFragmentCompat", "fragment", ")", "{", "String", "key", "=", "getString", "(", "R", ".", "string", ".", "appearance_navigation_preference_key", ")", ";", "NavigationPreference", "navigationPreference", "=", "(", "NavigationPreference", ")", "fragment", ".", "findPreference", "(", "key", ")", ";", "Bundle", "extras", "=", "new", "Bundle", "(", ")", ";", "extras", ".", "putBoolean", "(", "PreferenceFragment", ".", "EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON", ",", "true", ")", ";", "navigationPreference", ".", "setExtras", "(", "extras", ")", ";", "}" ]
Initializes the navigation preference, which allows to navigate to the appearance settings. @param fragment The fragment, which contains the preference, as an instance of the class {@link PreferenceFragmentCompat}. The fragment may not be null
[ "Initializes", "the", "navigation", "preference", "which", "allows", "to", "navigate", "to", "the", "appearance", "settings", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/SettingsActivity.java#L39-L48
4,833
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/operators/OperatorFromFunctionals.java
OperatorFromFunctionals.fromAction
public static <R> OnSubscribe<R> fromAction(Action0 action, R result) { return new InvokeAsync<R>(Actions.toFunc(action, result)); }
java
public static <R> OnSubscribe<R> fromAction(Action0 action, R result) { return new InvokeAsync<R>(Actions.toFunc(action, result)); }
[ "public", "static", "<", "R", ">", "OnSubscribe", "<", "R", ">", "fromAction", "(", "Action0", "action", ",", "R", "result", ")", "{", "return", "new", "InvokeAsync", "<", "R", ">", "(", "Actions", ".", "toFunc", "(", "action", ",", "result", ")", ")", ";", "}" ]
Subscriber function that invokes an action and returns the given result.
[ "Subscriber", "function", "that", "invokes", "an", "action", "and", "returns", "the", "given", "result", "." ]
6294e1da30e639df79f76399906229314c14e74d
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/operators/OperatorFromFunctionals.java#L36-L38
4,834
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/operators/OperatorFromFunctionals.java
OperatorFromFunctionals.fromCallable
public static <R> OnSubscribe<R> fromCallable(Callable<? extends R> callable) { return new InvokeAsync<R>(callable); }
java
public static <R> OnSubscribe<R> fromCallable(Callable<? extends R> callable) { return new InvokeAsync<R>(callable); }
[ "public", "static", "<", "R", ">", "OnSubscribe", "<", "R", ">", "fromCallable", "(", "Callable", "<", "?", "extends", "R", ">", "callable", ")", "{", "return", "new", "InvokeAsync", "<", "R", ">", "(", "callable", ")", ";", "}" ]
Subscriber function that invokes the callable and returns its value or propagates its checked exception.
[ "Subscriber", "function", "that", "invokes", "the", "callable", "and", "returns", "its", "value", "or", "propagates", "its", "checked", "exception", "." ]
6294e1da30e639df79f76399906229314c14e74d
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/operators/OperatorFromFunctionals.java#L44-L46
4,835
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/operators/OperatorFromFunctionals.java
OperatorFromFunctionals.fromRunnable
public static <R> OnSubscribe<R> fromRunnable(final Runnable run, final R result) { return new InvokeAsync<R>(new Func0<R>() { @Override public R call() { run.run(); return result; } }); }
java
public static <R> OnSubscribe<R> fromRunnable(final Runnable run, final R result) { return new InvokeAsync<R>(new Func0<R>() { @Override public R call() { run.run(); return result; } }); }
[ "public", "static", "<", "R", ">", "OnSubscribe", "<", "R", ">", "fromRunnable", "(", "final", "Runnable", "run", ",", "final", "R", "result", ")", "{", "return", "new", "InvokeAsync", "<", "R", ">", "(", "new", "Func0", "<", "R", ">", "(", ")", "{", "@", "Override", "public", "R", "call", "(", ")", "{", "run", ".", "run", "(", ")", ";", "return", "result", ";", "}", "}", ")", ";", "}" ]
Subscriber function that invokes a runnable and returns the given result.
[ "Subscriber", "function", "that", "invokes", "a", "runnable", "and", "returns", "the", "given", "result", "." ]
6294e1da30e639df79f76399906229314c14e74d
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/operators/OperatorFromFunctionals.java#L48-L56
4,836
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java
HideViewOnScrollAnimation.notifyOnScrollingDown
private void notifyOnScrollingDown(@NonNull final View animatedView, final int scrollPosition) { for (HideViewOnScrollAnimationListener listener : listeners) { listener.onScrollingDown(this, animatedView, scrollPosition); } }
java
private void notifyOnScrollingDown(@NonNull final View animatedView, final int scrollPosition) { for (HideViewOnScrollAnimationListener listener : listeners) { listener.onScrollingDown(this, animatedView, scrollPosition); } }
[ "private", "void", "notifyOnScrollingDown", "(", "@", "NonNull", "final", "View", "animatedView", ",", "final", "int", "scrollPosition", ")", "{", "for", "(", "HideViewOnScrollAnimationListener", "listener", ":", "listeners", ")", "{", "listener", ".", "onScrollingDown", "(", "this", ",", "animatedView", ",", "scrollPosition", ")", ";", "}", "}" ]
Notifies all listeners, which have been registered to be notified about the animation's internal state, when the observed list view is scrolling downwards. @param animatedView The view, which is animated by the observed animation, as an instance of the class {@link View} @param scrollPosition The current scroll position of the list view's first item in pixels as an {@link Integer} value
[ "Notifies", "all", "listeners", "which", "have", "been", "registered", "to", "be", "notified", "about", "the", "animation", "s", "internal", "state", "when", "the", "observed", "list", "view", "is", "scrolling", "downwards", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L107-L111
4,837
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java
HideViewOnScrollAnimation.notifyOnScrollingUp
private void notifyOnScrollingUp(@NonNull final View animatedView, final int scrollPosition) { for (HideViewOnScrollAnimationListener listener : listeners) { listener.onScrollingUp(this, animatedView, scrollPosition); } }
java
private void notifyOnScrollingUp(@NonNull final View animatedView, final int scrollPosition) { for (HideViewOnScrollAnimationListener listener : listeners) { listener.onScrollingUp(this, animatedView, scrollPosition); } }
[ "private", "void", "notifyOnScrollingUp", "(", "@", "NonNull", "final", "View", "animatedView", ",", "final", "int", "scrollPosition", ")", "{", "for", "(", "HideViewOnScrollAnimationListener", "listener", ":", "listeners", ")", "{", "listener", ".", "onScrollingUp", "(", "this", ",", "animatedView", ",", "scrollPosition", ")", ";", "}", "}" ]
Notifies all listeners, which have been registered to be notified about the animation's internal state, when the observed list view is scrolling upwards. @param animatedView The view, which is animated by the observed animation, as an instance of the class {@link View} @param scrollPosition The current scroll position of the list view's first item in pixels as an {@link Integer} value
[ "Notifies", "all", "listeners", "which", "have", "been", "registered", "to", "be", "notified", "about", "the", "animation", "s", "internal", "state", "when", "the", "observed", "list", "view", "is", "scrolling", "upwards", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L124-L128
4,838
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java
HideViewOnScrollAnimation.onScrollingUp
private void onScrollingUp() { if (hidden) { hidden = false; if (animatedView.getAnimation() == null) { ObjectAnimator animator = createAnimator(false); animator.start(); } } }
java
private void onScrollingUp() { if (hidden) { hidden = false; if (animatedView.getAnimation() == null) { ObjectAnimator animator = createAnimator(false); animator.start(); } } }
[ "private", "void", "onScrollingUp", "(", ")", "{", "if", "(", "hidden", ")", "{", "hidden", "=", "false", ";", "if", "(", "animatedView", ".", "getAnimation", "(", ")", "==", "null", ")", "{", "ObjectAnimator", "animator", "=", "createAnimator", "(", "false", ")", ";", "animator", ".", "start", "(", ")", ";", "}", "}", "}" ]
The method, which is invoked, when the observed list view is scrolling upwards.
[ "The", "method", "which", "is", "invoked", "when", "the", "observed", "list", "view", "is", "scrolling", "upwards", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L133-L142
4,839
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java
HideViewOnScrollAnimation.onScrollingDown
private void onScrollingDown() { if (!hidden) { hidden = true; if (animatedView.getAnimation() == null) { ObjectAnimator animator = createAnimator(true); animator.start(); } } }
java
private void onScrollingDown() { if (!hidden) { hidden = true; if (animatedView.getAnimation() == null) { ObjectAnimator animator = createAnimator(true); animator.start(); } } }
[ "private", "void", "onScrollingDown", "(", ")", "{", "if", "(", "!", "hidden", ")", "{", "hidden", "=", "true", ";", "if", "(", "animatedView", ".", "getAnimation", "(", ")", "==", "null", ")", "{", "ObjectAnimator", "animator", "=", "createAnimator", "(", "true", ")", ";", "animator", ".", "start", "(", ")", ";", "}", "}", "}" ]
The method, which is invoked, when the observed list view is scrolling downwards.
[ "The", "method", "which", "is", "invoked", "when", "the", "observed", "list", "view", "is", "scrolling", "downwards", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L147-L156
4,840
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java
HideViewOnScrollAnimation.createAnimator
private ObjectAnimator createAnimator(final boolean hide) { if (initialPosition == -1.0f) { initialPosition = animatedView.getY(); } float targetPosition = hide ? initialPosition - animatedView.getHeight() : initialPosition; if (direction == Direction.DOWN) { targetPosition = hide ? initialPosition + animatedView.getHeight() : initialPosition; } ObjectAnimator animation = ObjectAnimator.ofFloat(animatedView, "y", animatedView.getY(), targetPosition); animation.setInterpolator(new AccelerateDecelerateInterpolator()); animation.setDuration(animationDuration); return animation; }
java
private ObjectAnimator createAnimator(final boolean hide) { if (initialPosition == -1.0f) { initialPosition = animatedView.getY(); } float targetPosition = hide ? initialPosition - animatedView.getHeight() : initialPosition; if (direction == Direction.DOWN) { targetPosition = hide ? initialPosition + animatedView.getHeight() : initialPosition; } ObjectAnimator animation = ObjectAnimator.ofFloat(animatedView, "y", animatedView.getY(), targetPosition); animation.setInterpolator(new AccelerateDecelerateInterpolator()); animation.setDuration(animationDuration); return animation; }
[ "private", "ObjectAnimator", "createAnimator", "(", "final", "boolean", "hide", ")", "{", "if", "(", "initialPosition", "==", "-", "1.0f", ")", "{", "initialPosition", "=", "animatedView", ".", "getY", "(", ")", ";", "}", "float", "targetPosition", "=", "hide", "?", "initialPosition", "-", "animatedView", ".", "getHeight", "(", ")", ":", "initialPosition", ";", "if", "(", "direction", "==", "Direction", ".", "DOWN", ")", "{", "targetPosition", "=", "hide", "?", "initialPosition", "+", "animatedView", ".", "getHeight", "(", ")", ":", "initialPosition", ";", "}", "ObjectAnimator", "animation", "=", "ObjectAnimator", ".", "ofFloat", "(", "animatedView", ",", "\"y\"", ",", "animatedView", ".", "getY", "(", ")", ",", "targetPosition", ")", ";", "animation", ".", "setInterpolator", "(", "new", "AccelerateDecelerateInterpolator", "(", ")", ")", ";", "animation", ".", "setDuration", "(", "animationDuration", ")", ";", "return", "animation", ";", "}" ]
Creates and returns an animator, which allows to translate the animated view to become shown or hidden. @param hide True, if the view should become hidden, false otherwise @return The animator, which has been created, as an instance of the class {@link ObjectAnimator}
[ "Creates", "and", "returns", "an", "animator", "which", "allows", "to", "translate", "the", "animated", "view", "to", "become", "shown", "or", "hidden", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L167-L183
4,841
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java
HideViewOnScrollAnimation.showView
public final void showView() { if (animatedView.getAnimation() != null) { animatedView.getAnimation().cancel(); } ObjectAnimator animator = createAnimator(false); animator.start(); }
java
public final void showView() { if (animatedView.getAnimation() != null) { animatedView.getAnimation().cancel(); } ObjectAnimator animator = createAnimator(false); animator.start(); }
[ "public", "final", "void", "showView", "(", ")", "{", "if", "(", "animatedView", ".", "getAnimation", "(", ")", "!=", "null", ")", "{", "animatedView", ".", "getAnimation", "(", ")", ".", "cancel", "(", ")", ";", "}", "ObjectAnimator", "animator", "=", "createAnimator", "(", "false", ")", ";", "animator", ".", "start", "(", ")", ";", "}" ]
Shows the view.
[ "Shows", "the", "view", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L233-L240
4,842
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java
HideViewOnScrollAnimation.hideView
public final void hideView() { if (animatedView.getAnimation() != null) { animatedView.getAnimation().cancel(); } ObjectAnimator animator = createAnimator(true); animator.start(); }
java
public final void hideView() { if (animatedView.getAnimation() != null) { animatedView.getAnimation().cancel(); } ObjectAnimator animator = createAnimator(true); animator.start(); }
[ "public", "final", "void", "hideView", "(", ")", "{", "if", "(", "animatedView", ".", "getAnimation", "(", ")", "!=", "null", ")", "{", "animatedView", ".", "getAnimation", "(", ")", ".", "cancel", "(", ")", ";", "}", "ObjectAnimator", "animator", "=", "createAnimator", "(", "true", ")", ";", "animator", ".", "start", "(", ")", ";", "}" ]
Hides the view.
[ "Hides", "the", "view", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L245-L252
4,843
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java
HideViewOnScrollAnimation.addListener
public final void addListener(@NonNull final HideViewOnScrollAnimationListener listener) { Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null"); listeners.add(listener); }
java
public final void addListener(@NonNull final HideViewOnScrollAnimationListener listener) { Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null"); listeners.add(listener); }
[ "public", "final", "void", "addListener", "(", "@", "NonNull", "final", "HideViewOnScrollAnimationListener", "listener", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "listener", ",", "\"The listener may not be null\"", ")", ";", "listeners", ".", "add", "(", "listener", ")", ";", "}" ]
Adds a new listener, which should be notified about the animation's internal state, to the animation. @param listener The listener, which should be added, as an instance of the type {@link HideViewOnScrollAnimationListener}. The listener may not be null
[ "Adds", "a", "new", "listener", "which", "should", "be", "notified", "about", "the", "animation", "s", "internal", "state", "to", "the", "animation", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L292-L295
4,844
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java
HideViewOnScrollAnimation.removeListener
public final void removeListener(@NonNull final HideViewOnScrollAnimationListener listener) { Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null"); listeners.remove(listener); }
java
public final void removeListener(@NonNull final HideViewOnScrollAnimationListener listener) { Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null"); listeners.remove(listener); }
[ "public", "final", "void", "removeListener", "(", "@", "NonNull", "final", "HideViewOnScrollAnimationListener", "listener", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "listener", ",", "\"The listener may not be null\"", ")", ";", "listeners", ".", "remove", "(", "listener", ")", ";", "}" ]
Removes a specific listener, which should not be notified about the animation's internal state, from the animation. @param listener The listener, which should be removed, as an instance of the tpye {@link HideViewOnScrollAnimationListener}. The listener may not be null
[ "Removes", "a", "specific", "listener", "which", "should", "not", "be", "notified", "about", "the", "animation", "s", "internal", "state", "from", "the", "animation", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L305-L308
4,845
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/adapter/PreferenceAdapter.java
PreferenceAdapter.onVisualizePreference
@CallSuper protected void onVisualizePreference(@NonNull final Preference preference, @NonNull final PreferenceViewHolder viewHolder) { if (preference instanceof PreferenceCategory) { RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) viewHolder.itemView.getLayoutParams(); layoutParams.height = TextUtils.isEmpty(preference.getTitle()) ? 0 : RecyclerView.LayoutParams.WRAP_CONTENT; } }
java
@CallSuper protected void onVisualizePreference(@NonNull final Preference preference, @NonNull final PreferenceViewHolder viewHolder) { if (preference instanceof PreferenceCategory) { RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) viewHolder.itemView.getLayoutParams(); layoutParams.height = TextUtils.isEmpty(preference.getTitle()) ? 0 : RecyclerView.LayoutParams.WRAP_CONTENT; } }
[ "@", "CallSuper", "protected", "void", "onVisualizePreference", "(", "@", "NonNull", "final", "Preference", "preference", ",", "@", "NonNull", "final", "PreferenceViewHolder", "viewHolder", ")", "{", "if", "(", "preference", "instanceof", "PreferenceCategory", ")", "{", "RecyclerView", ".", "LayoutParams", "layoutParams", "=", "(", "RecyclerView", ".", "LayoutParams", ")", "viewHolder", ".", "itemView", ".", "getLayoutParams", "(", ")", ";", "layoutParams", ".", "height", "=", "TextUtils", ".", "isEmpty", "(", "preference", ".", "getTitle", "(", ")", ")", "?", "0", ":", "RecyclerView", ".", "LayoutParams", ".", "WRAP_CONTENT", ";", "}", "}" ]
The method, which is invoked, when a specific preference is visualized. This method may be overridden by subclasses in order to modify the appearance of the preference. @param preference The preference, which is visualized, as an instance of the class Preference. The preference may not be null @param viewHolder The view holder, which corresponds to the preference, as an instance of the class PreferenceViewHolder. The view holder may not be null
[ "The", "method", "which", "is", "invoked", "when", "a", "specific", "preference", "is", "visualized", ".", "This", "method", "may", "be", "overridden", "by", "subclasses", "in", "order", "to", "modify", "the", "appearance", "of", "the", "preference", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/adapter/PreferenceAdapter.java#L49-L58
4,846
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java
NavigationPreferenceAdapter.updateNavigationPreferences
private void updateNavigationPreferences() { List<NavigationPreference> oldNavigationPreferences = new ArrayList<>(navigationPreferences); navigationPreferences.clear(); boolean selectedNavigationPreferenceFound = selectedNavigationPreference == null; for (int i = 0; i < getItemCount(); i++) { Preference item = getItem(i); if (item instanceof NavigationPreference) { NavigationPreference navigationPreference = (NavigationPreference) item; navigationPreferences.add(navigationPreference); if (selectedNavigationPreference == navigationPreference) { selectedNavigationPreferenceFound = true; } if (!oldNavigationPreferences.contains(navigationPreference)) { notifyOnNavigationPreferenceAdded(navigationPreference); oldNavigationPreferences.remove(navigationPreference); } } } for (NavigationPreference removedNavigationPreference : oldNavigationPreferences) { notifyOnNavigationPreferenceRemoved(removedNavigationPreference); } if (!selectedNavigationPreferenceFound) { if (getNavigationPreferenceCount() > 0) { selectNavigationPreference(Math.min(selectedNavigationPreferenceIndex, getNavigationPreferenceCount() - 1), null); } else { selectNavigationPreference(null, null); } } }
java
private void updateNavigationPreferences() { List<NavigationPreference> oldNavigationPreferences = new ArrayList<>(navigationPreferences); navigationPreferences.clear(); boolean selectedNavigationPreferenceFound = selectedNavigationPreference == null; for (int i = 0; i < getItemCount(); i++) { Preference item = getItem(i); if (item instanceof NavigationPreference) { NavigationPreference navigationPreference = (NavigationPreference) item; navigationPreferences.add(navigationPreference); if (selectedNavigationPreference == navigationPreference) { selectedNavigationPreferenceFound = true; } if (!oldNavigationPreferences.contains(navigationPreference)) { notifyOnNavigationPreferenceAdded(navigationPreference); oldNavigationPreferences.remove(navigationPreference); } } } for (NavigationPreference removedNavigationPreference : oldNavigationPreferences) { notifyOnNavigationPreferenceRemoved(removedNavigationPreference); } if (!selectedNavigationPreferenceFound) { if (getNavigationPreferenceCount() > 0) { selectNavigationPreference(Math.min(selectedNavigationPreferenceIndex, getNavigationPreferenceCount() - 1), null); } else { selectNavigationPreference(null, null); } } }
[ "private", "void", "updateNavigationPreferences", "(", ")", "{", "List", "<", "NavigationPreference", ">", "oldNavigationPreferences", "=", "new", "ArrayList", "<>", "(", "navigationPreferences", ")", ";", "navigationPreferences", ".", "clear", "(", ")", ";", "boolean", "selectedNavigationPreferenceFound", "=", "selectedNavigationPreference", "==", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getItemCount", "(", ")", ";", "i", "++", ")", "{", "Preference", "item", "=", "getItem", "(", "i", ")", ";", "if", "(", "item", "instanceof", "NavigationPreference", ")", "{", "NavigationPreference", "navigationPreference", "=", "(", "NavigationPreference", ")", "item", ";", "navigationPreferences", ".", "add", "(", "navigationPreference", ")", ";", "if", "(", "selectedNavigationPreference", "==", "navigationPreference", ")", "{", "selectedNavigationPreferenceFound", "=", "true", ";", "}", "if", "(", "!", "oldNavigationPreferences", ".", "contains", "(", "navigationPreference", ")", ")", "{", "notifyOnNavigationPreferenceAdded", "(", "navigationPreference", ")", ";", "oldNavigationPreferences", ".", "remove", "(", "navigationPreference", ")", ";", "}", "}", "}", "for", "(", "NavigationPreference", "removedNavigationPreference", ":", "oldNavigationPreferences", ")", "{", "notifyOnNavigationPreferenceRemoved", "(", "removedNavigationPreference", ")", ";", "}", "if", "(", "!", "selectedNavigationPreferenceFound", ")", "{", "if", "(", "getNavigationPreferenceCount", "(", ")", ">", "0", ")", "{", "selectNavigationPreference", "(", "Math", ".", "min", "(", "selectedNavigationPreferenceIndex", ",", "getNavigationPreferenceCount", "(", ")", "-", "1", ")", ",", "null", ")", ";", "}", "else", "{", "selectNavigationPreference", "(", "null", ",", "null", ")", ";", "}", "}", "}" ]
Updates the navigation preferences, which are contained by the adapter.
[ "Updates", "the", "navigation", "preferences", "which", "are", "contained", "by", "the", "adapter", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java#L140-L176
4,847
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java
NavigationPreferenceAdapter.notifyOnNavigationPreferenceSelected
private void notifyOnNavigationPreferenceSelected( @NonNull final NavigationPreference navigationPreference, @Nullable final Bundle arguments) { if (callback != null) { callback.onNavigationPreferenceSelected(navigationPreference, arguments); } }
java
private void notifyOnNavigationPreferenceSelected( @NonNull final NavigationPreference navigationPreference, @Nullable final Bundle arguments) { if (callback != null) { callback.onNavigationPreferenceSelected(navigationPreference, arguments); } }
[ "private", "void", "notifyOnNavigationPreferenceSelected", "(", "@", "NonNull", "final", "NavigationPreference", "navigationPreference", ",", "@", "Nullable", "final", "Bundle", "arguments", ")", "{", "if", "(", "callback", "!=", "null", ")", "{", "callback", ".", "onNavigationPreferenceSelected", "(", "navigationPreference", ",", "arguments", ")", ";", "}", "}" ]
Notifies te callback, that a navigation preference has been selected. @param navigationPreference The navigation preference, which has been selected, as an instance of the class {@link NavigationPreference}. The navigation preference may not be null @param arguments The arguments, which should be passed to the fragment, which is associated with the navigation preference, as an instance of the class {@link Bundle} or null, if no arguments should be passed to the fragment
[ "Notifies", "te", "callback", "that", "a", "navigation", "preference", "has", "been", "selected", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java#L202-L208
4,848
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java
NavigationPreferenceAdapter.createAdapterDataObserver
@NonNull private RecyclerView.AdapterDataObserver createAdapterDataObserver() { return new RecyclerView.AdapterDataObserver() { @Override public void onChanged() { super.onChanged(); updateNavigationPreferences(); } @Override public void onItemRangeChanged(final int positionStart, final int itemCount) { super.onItemRangeChanged(positionStart, itemCount); updateNavigationPreferences(); } @Override public void onItemRangeChanged(final int positionStart, final int itemCount, @Nullable final Object payload) { super.onItemRangeChanged(positionStart, itemCount, payload); updateNavigationPreferences(); } @Override public void onItemRangeInserted(final int positionStart, final int itemCount) { super.onItemRangeInserted(positionStart, itemCount); updateNavigationPreferences(); } @Override public void onItemRangeRemoved(final int positionStart, final int itemCount) { super.onItemRangeRemoved(positionStart, itemCount); updateNavigationPreferences(); } @Override public void onItemRangeMoved(final int fromPosition, final int toPosition, final int itemCount) { super.onItemRangeMoved(fromPosition, toPosition, itemCount); updateNavigationPreferences(); } }; }
java
@NonNull private RecyclerView.AdapterDataObserver createAdapterDataObserver() { return new RecyclerView.AdapterDataObserver() { @Override public void onChanged() { super.onChanged(); updateNavigationPreferences(); } @Override public void onItemRangeChanged(final int positionStart, final int itemCount) { super.onItemRangeChanged(positionStart, itemCount); updateNavigationPreferences(); } @Override public void onItemRangeChanged(final int positionStart, final int itemCount, @Nullable final Object payload) { super.onItemRangeChanged(positionStart, itemCount, payload); updateNavigationPreferences(); } @Override public void onItemRangeInserted(final int positionStart, final int itemCount) { super.onItemRangeInserted(positionStart, itemCount); updateNavigationPreferences(); } @Override public void onItemRangeRemoved(final int positionStart, final int itemCount) { super.onItemRangeRemoved(positionStart, itemCount); updateNavigationPreferences(); } @Override public void onItemRangeMoved(final int fromPosition, final int toPosition, final int itemCount) { super.onItemRangeMoved(fromPosition, toPosition, itemCount); updateNavigationPreferences(); } }; }
[ "@", "NonNull", "private", "RecyclerView", ".", "AdapterDataObserver", "createAdapterDataObserver", "(", ")", "{", "return", "new", "RecyclerView", ".", "AdapterDataObserver", "(", ")", "{", "@", "Override", "public", "void", "onChanged", "(", ")", "{", "super", ".", "onChanged", "(", ")", ";", "updateNavigationPreferences", "(", ")", ";", "}", "@", "Override", "public", "void", "onItemRangeChanged", "(", "final", "int", "positionStart", ",", "final", "int", "itemCount", ")", "{", "super", ".", "onItemRangeChanged", "(", "positionStart", ",", "itemCount", ")", ";", "updateNavigationPreferences", "(", ")", ";", "}", "@", "Override", "public", "void", "onItemRangeChanged", "(", "final", "int", "positionStart", ",", "final", "int", "itemCount", ",", "@", "Nullable", "final", "Object", "payload", ")", "{", "super", ".", "onItemRangeChanged", "(", "positionStart", ",", "itemCount", ",", "payload", ")", ";", "updateNavigationPreferences", "(", ")", ";", "}", "@", "Override", "public", "void", "onItemRangeInserted", "(", "final", "int", "positionStart", ",", "final", "int", "itemCount", ")", "{", "super", ".", "onItemRangeInserted", "(", "positionStart", ",", "itemCount", ")", ";", "updateNavigationPreferences", "(", ")", ";", "}", "@", "Override", "public", "void", "onItemRangeRemoved", "(", "final", "int", "positionStart", ",", "final", "int", "itemCount", ")", "{", "super", ".", "onItemRangeRemoved", "(", "positionStart", ",", "itemCount", ")", ";", "updateNavigationPreferences", "(", ")", ";", "}", "@", "Override", "public", "void", "onItemRangeMoved", "(", "final", "int", "fromPosition", ",", "final", "int", "toPosition", ",", "final", "int", "itemCount", ")", "{", "super", ".", "onItemRangeMoved", "(", "fromPosition", ",", "toPosition", ",", "itemCount", ")", ";", "updateNavigationPreferences", "(", ")", ";", "}", "}", ";", "}" ]
Creates and returns a data observer, which allows to adapt the navigation preferences, when the adapter's underlying data has been changed. @return The data observer, which has been created, as an instance of the class {@link RecyclerView.AdapterDataObserver}. The data observer may not be null
[ "Creates", "and", "returns", "a", "data", "observer", "which", "allows", "to", "adapt", "the", "navigation", "preferences", "when", "the", "adapter", "s", "underlying", "data", "has", "been", "changed", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java#L254-L297
4,849
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java
NavigationPreferenceAdapter.indexOfNavigationPreference
public final int indexOfNavigationPreference( @NonNull final NavigationPreference navigationPreference) { Condition.INSTANCE .ensureNotNull(navigationPreference, "The navigation preference may not be null"); return navigationPreferences.indexOf(navigationPreference); }
java
public final int indexOfNavigationPreference( @NonNull final NavigationPreference navigationPreference) { Condition.INSTANCE .ensureNotNull(navigationPreference, "The navigation preference may not be null"); return navigationPreferences.indexOf(navigationPreference); }
[ "public", "final", "int", "indexOfNavigationPreference", "(", "@", "NonNull", "final", "NavigationPreference", "navigationPreference", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "navigationPreference", ",", "\"The navigation preference may not be null\"", ")", ";", "return", "navigationPreferences", ".", "indexOf", "(", "navigationPreference", ")", ";", "}" ]
Returns the index of a specific navigation preference among all navigation preferences, which are contained by the adapter. @param navigationPreference The navigation preference, whose index should be returned, as an instance of the class {@link NavigationPreference}. The navigation preference may not be null @return The index of the given navigation preference as an {@link Integer} value or -1, if the navigation preference is not contained by the adapter
[ "Returns", "the", "index", "of", "a", "specific", "navigation", "preference", "among", "all", "navigation", "preferences", "which", "are", "contained", "by", "the", "adapter", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/adapter/NavigationPreferenceAdapter.java#L356-L361
4,850
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AbstractPreferenceFragment.java
AbstractPreferenceFragment.initializeButtonBarElevation
private void initializeButtonBarElevation(final SharedPreferences sharedPreferences) { String key = getString(R.string.preference_fragment_button_bar_elevation_preference_key); String defaultValue = getString( R.string.preference_fragment_button_bar_elevation_preference_default_value); int elevation = Integer.valueOf(sharedPreferences.getString(key, defaultValue)); setButtonBarElevation(elevation); }
java
private void initializeButtonBarElevation(final SharedPreferences sharedPreferences) { String key = getString(R.string.preference_fragment_button_bar_elevation_preference_key); String defaultValue = getString( R.string.preference_fragment_button_bar_elevation_preference_default_value); int elevation = Integer.valueOf(sharedPreferences.getString(key, defaultValue)); setButtonBarElevation(elevation); }
[ "private", "void", "initializeButtonBarElevation", "(", "final", "SharedPreferences", "sharedPreferences", ")", "{", "String", "key", "=", "getString", "(", "R", ".", "string", ".", "preference_fragment_button_bar_elevation_preference_key", ")", ";", "String", "defaultValue", "=", "getString", "(", "R", ".", "string", ".", "preference_fragment_button_bar_elevation_preference_default_value", ")", ";", "int", "elevation", "=", "Integer", ".", "valueOf", "(", "sharedPreferences", ".", "getString", "(", "key", ",", "defaultValue", ")", ")", ";", "setButtonBarElevation", "(", "elevation", ")", ";", "}" ]
Initializes the elevation of the button bar. @param sharedPreferences The shared preferences, which should be used, as an instance of the type {@link SharedPreferences}
[ "Initializes", "the", "elevation", "of", "the", "button", "bar", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AbstractPreferenceFragment.java#L43-L49
4,851
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AbstractPreferenceFragment.java
AbstractPreferenceFragment.createRestoreDefaultsListener
private DialogInterface.OnClickListener createRestoreDefaultsListener() { return new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { restoreDefaults(); } }; }
java
private DialogInterface.OnClickListener createRestoreDefaultsListener() { return new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { restoreDefaults(); } }; }
[ "private", "DialogInterface", ".", "OnClickListener", "createRestoreDefaultsListener", "(", ")", "{", "return", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "final", "DialogInterface", "dialog", ",", "final", "int", "which", ")", "{", "restoreDefaults", "(", ")", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to restore the default values of the fragment's preferences. @return The listener, which has been created, as an instance of the type {@link DialogInterface.OnClickListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "restore", "the", "default", "values", "of", "the", "fragment", "s", "preferences", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AbstractPreferenceFragment.java#L58-L67
4,852
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java
ToolbarLarge.inflate
private void inflate() { inflate(getContext(), R.layout.toolbar_large, this); this.backgroundView = findViewById(R.id.toolbar_background_view); this.toolbar = findViewById(R.id.navigation_toolbar); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) toolbar.getLayoutParams(); this.navigationWidth = layoutParams.width; }
java
private void inflate() { inflate(getContext(), R.layout.toolbar_large, this); this.backgroundView = findViewById(R.id.toolbar_background_view); this.toolbar = findViewById(R.id.navigation_toolbar); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) toolbar.getLayoutParams(); this.navigationWidth = layoutParams.width; }
[ "private", "void", "inflate", "(", ")", "{", "inflate", "(", "getContext", "(", ")", ",", "R", ".", "layout", ".", "toolbar_large", ",", "this", ")", ";", "this", ".", "backgroundView", "=", "findViewById", "(", "R", ".", "id", ".", "toolbar_background_view", ")", ";", "this", ".", "toolbar", "=", "findViewById", "(", "R", ".", "id", ".", "navigation_toolbar", ")", ";", "RelativeLayout", ".", "LayoutParams", "layoutParams", "=", "(", "RelativeLayout", ".", "LayoutParams", ")", "toolbar", ".", "getLayoutParams", "(", ")", ";", "this", ".", "navigationWidth", "=", "layoutParams", ".", "width", ";", "}" ]
Inflates the view's layout.
[ "Inflates", "the", "view", "s", "layout", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java#L58-L65
4,853
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java
ToolbarLarge.obtainTheme
private int obtainTheme() { TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(new int[]{R.attr.toolbarTheme}); return typedArray.getResourceId(0, 0); }
java
private int obtainTheme() { TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(new int[]{R.attr.toolbarTheme}); return typedArray.getResourceId(0, 0); }
[ "private", "int", "obtainTheme", "(", ")", "{", "TypedArray", "typedArray", "=", "getContext", "(", ")", ".", "getTheme", "(", ")", ".", "obtainStyledAttributes", "(", "new", "int", "[", "]", "{", "R", ".", "attr", ".", "toolbarTheme", "}", ")", ";", "return", "typedArray", ".", "getResourceId", "(", "0", ",", "0", ")", ";", "}" ]
Obtains the resource id of the theme, which should be applied on the toolbar. @return The resource id of the theme as an {@link Integer} value
[ "Obtains", "the", "resource", "id", "of", "the", "theme", "which", "should", "be", "applied", "on", "the", "toolbar", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java#L84-L88
4,854
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java
ToolbarLarge.obtainBackgroundColor
private void obtainBackgroundColor(final int theme) { TypedArray typedArray = getContext().getTheme() .obtainStyledAttributes(theme, new int[]{R.attr.colorPrimary}); int colorPrimary = typedArray.getColor(0, 0); typedArray.recycle(); if (colorPrimary != 0) { backgroundView.setBackgroundColor(colorPrimary); } }
java
private void obtainBackgroundColor(final int theme) { TypedArray typedArray = getContext().getTheme() .obtainStyledAttributes(theme, new int[]{R.attr.colorPrimary}); int colorPrimary = typedArray.getColor(0, 0); typedArray.recycle(); if (colorPrimary != 0) { backgroundView.setBackgroundColor(colorPrimary); } }
[ "private", "void", "obtainBackgroundColor", "(", "final", "int", "theme", ")", "{", "TypedArray", "typedArray", "=", "getContext", "(", ")", ".", "getTheme", "(", ")", ".", "obtainStyledAttributes", "(", "theme", ",", "new", "int", "[", "]", "{", "R", ".", "attr", ".", "colorPrimary", "}", ")", ";", "int", "colorPrimary", "=", "typedArray", ".", "getColor", "(", "0", ",", "0", ")", ";", "typedArray", ".", "recycle", "(", ")", ";", "if", "(", "colorPrimary", "!=", "0", ")", "{", "backgroundView", ".", "setBackgroundColor", "(", "colorPrimary", ")", ";", "}", "}" ]
Obtains the color of the toolbar's background from a specific typed array. @param theme The resource id of the theme, which should be applied on the toolbar, as an {@link Integer} value
[ "Obtains", "the", "color", "of", "the", "toolbar", "s", "background", "from", "a", "specific", "typed", "array", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java#L97-L106
4,855
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java
ToolbarLarge.obtainTitleColor
private void obtainTitleColor(final int theme) { TypedArray typedArray = getContext().getTheme() .obtainStyledAttributes(theme, new int[]{android.R.attr.textColorPrimary}); int textColorPrimary = typedArray.getResourceId(0, 0); typedArray.recycle(); if (textColorPrimary != 0) { int titleColor = ContextCompat.getColor(getContext(), textColorPrimary); toolbar.setTitleTextColor(titleColor); } }
java
private void obtainTitleColor(final int theme) { TypedArray typedArray = getContext().getTheme() .obtainStyledAttributes(theme, new int[]{android.R.attr.textColorPrimary}); int textColorPrimary = typedArray.getResourceId(0, 0); typedArray.recycle(); if (textColorPrimary != 0) { int titleColor = ContextCompat.getColor(getContext(), textColorPrimary); toolbar.setTitleTextColor(titleColor); } }
[ "private", "void", "obtainTitleColor", "(", "final", "int", "theme", ")", "{", "TypedArray", "typedArray", "=", "getContext", "(", ")", ".", "getTheme", "(", ")", ".", "obtainStyledAttributes", "(", "theme", ",", "new", "int", "[", "]", "{", "android", ".", "R", ".", "attr", ".", "textColorPrimary", "}", ")", ";", "int", "textColorPrimary", "=", "typedArray", ".", "getResourceId", "(", "0", ",", "0", ")", ";", "typedArray", ".", "recycle", "(", ")", ";", "if", "(", "textColorPrimary", "!=", "0", ")", "{", "int", "titleColor", "=", "ContextCompat", ".", "getColor", "(", "getContext", "(", ")", ",", "textColorPrimary", ")", ";", "toolbar", ".", "setTitleTextColor", "(", "titleColor", ")", ";", "}", "}" ]
Obtains the color of the toolbar's title from a specific typed array. @param theme The resource id of the theme, which should be applied on the toolbar, as an {@link Integer} value
[ "Obtains", "the", "color", "of", "the", "toolbar", "s", "title", "from", "a", "specific", "typed", "array", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java#L115-L125
4,856
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java
ToolbarLarge.setNavigationWidth
public final void setNavigationWidth(@Px final int width) { Condition.INSTANCE.ensureGreater(width, 0, "The width must be greater than 0"); this.navigationWidth = width; if (!isNavigationHidden()) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) toolbar.getLayoutParams(); layoutParams.width = width; toolbar.requestLayout(); } }
java
public final void setNavigationWidth(@Px final int width) { Condition.INSTANCE.ensureGreater(width, 0, "The width must be greater than 0"); this.navigationWidth = width; if (!isNavigationHidden()) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) toolbar.getLayoutParams(); layoutParams.width = width; toolbar.requestLayout(); } }
[ "public", "final", "void", "setNavigationWidth", "(", "@", "Px", "final", "int", "width", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureGreater", "(", "width", ",", "0", ",", "\"The width must be greater than 0\"", ")", ";", "this", ".", "navigationWidth", "=", "width", ";", "if", "(", "!", "isNavigationHidden", "(", ")", ")", "{", "RelativeLayout", ".", "LayoutParams", "layoutParams", "=", "(", "RelativeLayout", ".", "LayoutParams", ")", "toolbar", ".", "getLayoutParams", "(", ")", ";", "layoutParams", ".", "width", "=", "width", ";", "toolbar", ".", "requestLayout", "(", ")", ";", "}", "}" ]
Sets the width of the navigation. @param width The width, which should be set, in pixels as an {@link Integer} value. The width must be greater than 0
[ "Sets", "the", "width", "of", "the", "navigation", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java#L228-L238
4,857
michael-rapp/AndroidPreferenceActivity
library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java
ToolbarLarge.hideNavigation
public final void hideNavigation(final boolean navigationHidden) { toolbar.setVisibility(navigationHidden ? View.INVISIBLE : View.VISIBLE); if (!navigationHidden) { setNavigationWidth(navigationWidth); } }
java
public final void hideNavigation(final boolean navigationHidden) { toolbar.setVisibility(navigationHidden ? View.INVISIBLE : View.VISIBLE); if (!navigationHidden) { setNavigationWidth(navigationWidth); } }
[ "public", "final", "void", "hideNavigation", "(", "final", "boolean", "navigationHidden", ")", "{", "toolbar", ".", "setVisibility", "(", "navigationHidden", "?", "View", ".", "INVISIBLE", ":", "View", ".", "VISIBLE", ")", ";", "if", "(", "!", "navigationHidden", ")", "{", "setNavigationWidth", "(", "navigationWidth", ")", ";", "}", "}" ]
Hides or shows the navigation. @param navigationHidden True, if the navigation should be hidden, false otherwise
[ "Hides", "or", "shows", "the", "navigation", "." ]
0fcde73815b4b3bf6bcb36acd3d5733e301bbba5
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/view/ToolbarLarge.java#L255-L261
4,858
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java
WorkArounds.interfaceTypesOf
public List<TypeMirror> interfaceTypesOf(TypeMirror type) { com.sun.tools.javac.util.List<com.sun.tools.javac.code.Type> interfaces = ((DocEnvImpl)configuration.docEnv).toolEnv.getTypes().interfaces((com.sun.tools.javac.code.Type)type); if (interfaces.isEmpty()) { return Collections.emptyList(); } List<TypeMirror> list = new ArrayList<>(interfaces.size()); for (com.sun.tools.javac.code.Type t : interfaces) { list.add((TypeMirror)t); } return list; }
java
public List<TypeMirror> interfaceTypesOf(TypeMirror type) { com.sun.tools.javac.util.List<com.sun.tools.javac.code.Type> interfaces = ((DocEnvImpl)configuration.docEnv).toolEnv.getTypes().interfaces((com.sun.tools.javac.code.Type)type); if (interfaces.isEmpty()) { return Collections.emptyList(); } List<TypeMirror> list = new ArrayList<>(interfaces.size()); for (com.sun.tools.javac.code.Type t : interfaces) { list.add((TypeMirror)t); } return list; }
[ "public", "List", "<", "TypeMirror", ">", "interfaceTypesOf", "(", "TypeMirror", "type", ")", "{", "com", ".", "sun", ".", "tools", ".", "javac", ".", "util", ".", "List", "<", "com", ".", "sun", ".", "tools", ".", "javac", ".", "code", ".", "Type", ">", "interfaces", "=", "(", "(", "DocEnvImpl", ")", "configuration", ".", "docEnv", ")", ".", "toolEnv", ".", "getTypes", "(", ")", ".", "interfaces", "(", "(", "com", ".", "sun", ".", "tools", ".", "javac", ".", "code", ".", "Type", ")", "type", ")", ";", "if", "(", "interfaces", ".", "isEmpty", "(", ")", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "List", "<", "TypeMirror", ">", "list", "=", "new", "ArrayList", "<>", "(", "interfaces", ".", "size", "(", ")", ")", ";", "for", "(", "com", ".", "sun", ".", "tools", ".", "javac", ".", "code", ".", "Type", "t", ":", "interfaces", ")", "{", "list", ".", "add", "(", "(", "TypeMirror", ")", "t", ")", ";", "}", "return", "list", ";", "}" ]
so we use javac directly, investigate why jx.l.m is not cutting it.
[ "so", "we", "use", "javac", "directly", "investigate", "why", "jx", ".", "l", ".", "m", "is", "not", "cutting", "it", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java#L155-L166
4,859
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java
WorkArounds.getUnnamedPackage
PackageElement getUnnamedPackage() { return (toolEnv.source.allowModules()) ? toolEnv.syms.unnamedModule.unnamedPackage : toolEnv.syms.noModule.unnamedPackage; }
java
PackageElement getUnnamedPackage() { return (toolEnv.source.allowModules()) ? toolEnv.syms.unnamedModule.unnamedPackage : toolEnv.syms.noModule.unnamedPackage; }
[ "PackageElement", "getUnnamedPackage", "(", ")", "{", "return", "(", "toolEnv", ".", "source", ".", "allowModules", "(", ")", ")", "?", "toolEnv", ".", "syms", ".", "unnamedModule", ".", "unnamedPackage", ":", "toolEnv", ".", "syms", ".", "noModule", ".", "unnamedPackage", ";", "}" ]
to return the proper unnamedPackage for all supported releases.
[ "to", "return", "the", "proper", "unnamedPackage", "for", "all", "supported", "releases", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java#L203-L207
4,860
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java
WorkArounds.getAbbreviatedPackageElement
public PackageElement getAbbreviatedPackageElement(PackageElement pkg) { String parsedPackageName = utils.parsePackageName(pkg); ModuleElement encl = (ModuleElement) pkg.getEnclosingElement(); PackageElement abbrevPkg = encl == null ? utils.elementUtils.getPackageElement(parsedPackageName) : ((JavacElements) utils.elementUtils).getPackageElement(encl, parsedPackageName); return abbrevPkg; }
java
public PackageElement getAbbreviatedPackageElement(PackageElement pkg) { String parsedPackageName = utils.parsePackageName(pkg); ModuleElement encl = (ModuleElement) pkg.getEnclosingElement(); PackageElement abbrevPkg = encl == null ? utils.elementUtils.getPackageElement(parsedPackageName) : ((JavacElements) utils.elementUtils).getPackageElement(encl, parsedPackageName); return abbrevPkg; }
[ "public", "PackageElement", "getAbbreviatedPackageElement", "(", "PackageElement", "pkg", ")", "{", "String", "parsedPackageName", "=", "utils", ".", "parsePackageName", "(", "pkg", ")", ";", "ModuleElement", "encl", "=", "(", "ModuleElement", ")", "pkg", ".", "getEnclosingElement", "(", ")", ";", "PackageElement", "abbrevPkg", "=", "encl", "==", "null", "?", "utils", ".", "elementUtils", ".", "getPackageElement", "(", "parsedPackageName", ")", ":", "(", "(", "JavacElements", ")", "utils", ".", "elementUtils", ")", ".", "getPackageElement", "(", "encl", ",", "parsedPackageName", ")", ";", "return", "abbrevPkg", ";", "}" ]
Returns a representation of the package truncated to two levels. For instance if the given package represents foo.bar.baz will return a representation of foo.bar @param pkg the PackageElement @return an abbreviated PackageElement
[ "Returns", "a", "representation", "of", "the", "package", "truncated", "to", "two", "levels", ".", "For", "instance", "if", "the", "given", "package", "represents", "foo", ".", "bar", ".", "baz", "will", "return", "a", "representation", "of", "foo", ".", "bar" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java#L582-L589
4,861
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java
ListBuffer.copy
private void copy() { if (elems.nonEmpty()) { List<A> orig = elems; elems = last = List.of(orig.head); while ((orig = orig.tail).nonEmpty()) { last.tail = List.of(orig.head); last = last.tail; } } }
java
private void copy() { if (elems.nonEmpty()) { List<A> orig = elems; elems = last = List.of(orig.head); while ((orig = orig.tail).nonEmpty()) { last.tail = List.of(orig.head); last = last.tail; } } }
[ "private", "void", "copy", "(", ")", "{", "if", "(", "elems", ".", "nonEmpty", "(", ")", ")", "{", "List", "<", "A", ">", "orig", "=", "elems", ";", "elems", "=", "last", "=", "List", ".", "of", "(", "orig", ".", "head", ")", ";", "while", "(", "(", "orig", "=", "orig", ".", "tail", ")", ".", "nonEmpty", "(", ")", ")", "{", "last", ".", "tail", "=", "List", ".", "of", "(", "orig", ".", "head", ")", ";", "last", "=", "last", ".", "tail", ";", "}", "}", "}" ]
Copy list and sets last.
[ "Copy", "list", "and", "sets", "last", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java#L102-L113
4,862
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java
ListBuffer.prepend
public ListBuffer<A> prepend(A x) { elems = elems.prepend(x); if (last == null) last = elems; count++; return this; }
java
public ListBuffer<A> prepend(A x) { elems = elems.prepend(x); if (last == null) last = elems; count++; return this; }
[ "public", "ListBuffer", "<", "A", ">", "prepend", "(", "A", "x", ")", "{", "elems", "=", "elems", ".", "prepend", "(", "x", ")", ";", "if", "(", "last", "==", "null", ")", "last", "=", "elems", ";", "count", "++", ";", "return", "this", ";", "}" ]
Prepend an element to buffer.
[ "Prepend", "an", "element", "to", "buffer", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java#L117-L122
4,863
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java
ListBuffer.append
public ListBuffer<A> append(A x) { Assert.checkNonNull(x); if (shared) copy(); List<A> newLast = List.of(x); if (last != null) { last.tail = newLast; last = newLast; } else { elems = last = newLast; } count++; return this; }
java
public ListBuffer<A> append(A x) { Assert.checkNonNull(x); if (shared) copy(); List<A> newLast = List.of(x); if (last != null) { last.tail = newLast; last = newLast; } else { elems = last = newLast; } count++; return this; }
[ "public", "ListBuffer", "<", "A", ">", "append", "(", "A", "x", ")", "{", "Assert", ".", "checkNonNull", "(", "x", ")", ";", "if", "(", "shared", ")", "copy", "(", ")", ";", "List", "<", "A", ">", "newLast", "=", "List", ".", "of", "(", "x", ")", ";", "if", "(", "last", "!=", "null", ")", "{", "last", ".", "tail", "=", "newLast", ";", "last", "=", "newLast", ";", "}", "else", "{", "elems", "=", "last", "=", "newLast", ";", "}", "count", "++", ";", "return", "this", ";", "}" ]
Append an element to buffer.
[ "Append", "an", "element", "to", "buffer", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java#L126-L138
4,864
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java
ListBuffer.appendList
public ListBuffer<A> appendList(List<A> xs) { while (xs.nonEmpty()) { append(xs.head); xs = xs.tail; } return this; }
java
public ListBuffer<A> appendList(List<A> xs) { while (xs.nonEmpty()) { append(xs.head); xs = xs.tail; } return this; }
[ "public", "ListBuffer", "<", "A", ">", "appendList", "(", "List", "<", "A", ">", "xs", ")", "{", "while", "(", "xs", ".", "nonEmpty", "(", ")", ")", "{", "append", "(", "xs", ".", "head", ")", ";", "xs", "=", "xs", ".", "tail", ";", "}", "return", "this", ";", "}" ]
Append all elements in a list to buffer.
[ "Append", "all", "elements", "in", "a", "list", "to", "buffer", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java#L142-L148
4,865
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java
ListBuffer.next
public A next() { A x = elems.head; if (!elems.isEmpty()) { elems = elems.tail; if (elems.isEmpty()) last = null; count--; } return x; }
java
public A next() { A x = elems.head; if (!elems.isEmpty()) { elems = elems.tail; if (elems.isEmpty()) last = null; count--; } return x; }
[ "public", "A", "next", "(", ")", "{", "A", "x", "=", "elems", ".", "head", ";", "if", "(", "!", "elems", ".", "isEmpty", "(", ")", ")", "{", "elems", "=", "elems", ".", "tail", ";", "if", "(", "elems", ".", "isEmpty", "(", ")", ")", "last", "=", "null", ";", "count", "--", ";", "}", "return", "x", ";", "}" ]
Return first element in this buffer and remove
[ "Return", "first", "element", "in", "this", "buffer", "and", "remove" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java#L195-L203
4,866
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java
ListBuffer.iterator
public Iterator<A> iterator() { return new Iterator<A>() { List<A> elems = ListBuffer.this.elems; public boolean hasNext() { return !elems.isEmpty(); } public A next() { if (elems.isEmpty()) throw new NoSuchElementException(); A elem = elems.head; elems = elems.tail; return elem; } public void remove() { throw new UnsupportedOperationException(); } }; }
java
public Iterator<A> iterator() { return new Iterator<A>() { List<A> elems = ListBuffer.this.elems; public boolean hasNext() { return !elems.isEmpty(); } public A next() { if (elems.isEmpty()) throw new NoSuchElementException(); A elem = elems.head; elems = elems.tail; return elem; } public void remove() { throw new UnsupportedOperationException(); } }; }
[ "public", "Iterator", "<", "A", ">", "iterator", "(", ")", "{", "return", "new", "Iterator", "<", "A", ">", "(", ")", "{", "List", "<", "A", ">", "elems", "=", "ListBuffer", ".", "this", ".", "elems", ";", "public", "boolean", "hasNext", "(", ")", "{", "return", "!", "elems", ".", "isEmpty", "(", ")", ";", "}", "public", "A", "next", "(", ")", "{", "if", "(", "elems", ".", "isEmpty", "(", ")", ")", "throw", "new", "NoSuchElementException", "(", ")", ";", "A", "elem", "=", "elems", ".", "head", ";", "elems", "=", "elems", ".", "tail", ";", "return", "elem", ";", "}", "public", "void", "remove", "(", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "}", ";", "}" ]
An enumeration of all elements in this buffer.
[ "An", "enumeration", "of", "all", "elements", "in", "this", "buffer", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ListBuffer.java#L207-L224
4,867
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java
InferenceContext.addVar
void addVar(TypeVar t) { this.undetvars = this.undetvars.prepend(infer.fromTypeVarFun.apply(t)); this.inferencevars = this.inferencevars.prepend(t); }
java
void addVar(TypeVar t) { this.undetvars = this.undetvars.prepend(infer.fromTypeVarFun.apply(t)); this.inferencevars = this.inferencevars.prepend(t); }
[ "void", "addVar", "(", "TypeVar", "t", ")", "{", "this", ".", "undetvars", "=", "this", ".", "undetvars", ".", "prepend", "(", "infer", ".", "fromTypeVarFun", ".", "apply", "(", "t", ")", ")", ";", "this", ".", "inferencevars", "=", "this", ".", "inferencevars", ".", "prepend", "(", "t", ")", ";", "}" ]
add a new inference var to this inference context
[ "add", "a", "new", "inference", "var", "to", "this", "inference", "context" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java#L101-L104
4,868
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java
InferenceContext.freeVarsIn
final List<Type> freeVarsIn(Type t) { ListBuffer<Type> buf = new ListBuffer<>(); for (Type iv : inferenceVars()) { if (t.contains(iv)) { buf.add(iv); } } return buf.toList(); }
java
final List<Type> freeVarsIn(Type t) { ListBuffer<Type> buf = new ListBuffer<>(); for (Type iv : inferenceVars()) { if (t.contains(iv)) { buf.add(iv); } } return buf.toList(); }
[ "final", "List", "<", "Type", ">", "freeVarsIn", "(", "Type", "t", ")", "{", "ListBuffer", "<", "Type", ">", "buf", "=", "new", "ListBuffer", "<>", "(", ")", ";", "for", "(", "Type", "iv", ":", "inferenceVars", "(", ")", ")", "{", "if", "(", "t", ".", "contains", "(", "iv", ")", ")", "{", "buf", ".", "add", "(", "iv", ")", ";", "}", "}", "return", "buf", ".", "toList", "(", ")", ";", "}" ]
Returns a list of free variables in a given type
[ "Returns", "a", "list", "of", "free", "variables", "in", "a", "given", "type" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java#L177-L185
4,869
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java
InferenceContext.addFreeTypeListener
void addFreeTypeListener(List<Type> types, FreeTypeListener ftl) { freeTypeListeners.put(ftl, freeVarsIn(types)); }
java
void addFreeTypeListener(List<Type> types, FreeTypeListener ftl) { freeTypeListeners.put(ftl, freeVarsIn(types)); }
[ "void", "addFreeTypeListener", "(", "List", "<", "Type", ">", "types", ",", "FreeTypeListener", "ftl", ")", "{", "freeTypeListeners", ".", "put", "(", "ftl", ",", "freeVarsIn", "(", "types", ")", ")", ";", "}" ]
Add custom hook for performing post-inference action
[ "Add", "custom", "hook", "for", "performing", "post", "-", "inference", "action" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java#L247-L249
4,870
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java
InferenceContext.save
public List<Type> save() { ListBuffer<Type> buf = new ListBuffer<>(); for (Type t : undetvars) { buf.add(((UndetVar)t).dup(infer.types)); } return buf.toList(); }
java
public List<Type> save() { ListBuffer<Type> buf = new ListBuffer<>(); for (Type t : undetvars) { buf.add(((UndetVar)t).dup(infer.types)); } return buf.toList(); }
[ "public", "List", "<", "Type", ">", "save", "(", ")", "{", "ListBuffer", "<", "Type", ">", "buf", "=", "new", "ListBuffer", "<>", "(", ")", ";", "for", "(", "Type", "t", ":", "undetvars", ")", "{", "buf", ".", "add", "(", "(", "(", "UndetVar", ")", "t", ")", ".", "dup", "(", "infer", ".", "types", ")", ")", ";", "}", "return", "buf", ".", "toList", "(", ")", ";", "}" ]
Save the state of this inference context
[ "Save", "the", "state", "of", "this", "inference", "context" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java#L284-L290
4,871
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java
InferenceContext.rollback
public void rollback(List<Type> saved_undet) { Assert.check(saved_undet != null); //restore bounds (note: we need to preserve the old instances) ListBuffer<Type> newUndetVars = new ListBuffer<>(); ListBuffer<Type> newInferenceVars = new ListBuffer<>(); while (saved_undet.nonEmpty() && undetvars.nonEmpty()) { UndetVar uv = (UndetVar)undetvars.head; UndetVar uv_saved = (UndetVar)saved_undet.head; if (uv.qtype == uv_saved.qtype) { uv_saved.dupTo(uv, types); undetvars = undetvars.tail; saved_undet = saved_undet.tail; newUndetVars.add(uv); newInferenceVars.add(uv.qtype); } else { undetvars = undetvars.tail; } } undetvars = newUndetVars.toList(); inferencevars = newInferenceVars.toList(); }
java
public void rollback(List<Type> saved_undet) { Assert.check(saved_undet != null); //restore bounds (note: we need to preserve the old instances) ListBuffer<Type> newUndetVars = new ListBuffer<>(); ListBuffer<Type> newInferenceVars = new ListBuffer<>(); while (saved_undet.nonEmpty() && undetvars.nonEmpty()) { UndetVar uv = (UndetVar)undetvars.head; UndetVar uv_saved = (UndetVar)saved_undet.head; if (uv.qtype == uv_saved.qtype) { uv_saved.dupTo(uv, types); undetvars = undetvars.tail; saved_undet = saved_undet.tail; newUndetVars.add(uv); newInferenceVars.add(uv.qtype); } else { undetvars = undetvars.tail; } } undetvars = newUndetVars.toList(); inferencevars = newInferenceVars.toList(); }
[ "public", "void", "rollback", "(", "List", "<", "Type", ">", "saved_undet", ")", "{", "Assert", ".", "check", "(", "saved_undet", "!=", "null", ")", ";", "//restore bounds (note: we need to preserve the old instances)", "ListBuffer", "<", "Type", ">", "newUndetVars", "=", "new", "ListBuffer", "<>", "(", ")", ";", "ListBuffer", "<", "Type", ">", "newInferenceVars", "=", "new", "ListBuffer", "<>", "(", ")", ";", "while", "(", "saved_undet", ".", "nonEmpty", "(", ")", "&&", "undetvars", ".", "nonEmpty", "(", ")", ")", "{", "UndetVar", "uv", "=", "(", "UndetVar", ")", "undetvars", ".", "head", ";", "UndetVar", "uv_saved", "=", "(", "UndetVar", ")", "saved_undet", ".", "head", ";", "if", "(", "uv", ".", "qtype", "==", "uv_saved", ".", "qtype", ")", "{", "uv_saved", ".", "dupTo", "(", "uv", ",", "types", ")", ";", "undetvars", "=", "undetvars", ".", "tail", ";", "saved_undet", "=", "saved_undet", ".", "tail", ";", "newUndetVars", ".", "add", "(", "uv", ")", ";", "newInferenceVars", ".", "add", "(", "uv", ".", "qtype", ")", ";", "}", "else", "{", "undetvars", "=", "undetvars", ".", "tail", ";", "}", "}", "undetvars", "=", "newUndetVars", ".", "toList", "(", ")", ";", "inferencevars", "=", "newInferenceVars", ".", "toList", "(", ")", ";", "}" ]
Restore the state of this inference context to the previous known checkpoint. Consider that the number of saved undetermined variables can be different to the current amount. This is because new captured variables could have been added.
[ "Restore", "the", "state", "of", "this", "inference", "context", "to", "the", "previous", "known", "checkpoint", ".", "Consider", "that", "the", "number", "of", "saved", "undetermined", "variables", "can", "be", "different", "to", "the", "current", "amount", ".", "This", "is", "because", "new", "captured", "variables", "could", "have", "been", "added", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java#L296-L316
4,872
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java
ModuleFrameWriter.generate
public static void generate(ConfigurationImpl configuration, ModuleElement moduleElement) throws DocFileIOException { ModuleFrameWriter mdlgen = new ModuleFrameWriter(configuration, moduleElement); String mdlName = moduleElement.getQualifiedName().toString(); Content mdlLabel = new StringContent(mdlName); HtmlTree body = mdlgen.getBody(false, mdlgen.getWindowTitle(mdlName)); HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN() : body; Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, mdlgen.getHyperLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame")); htmlTree.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.indexContainer); mdlgen.addClassListing(div); htmlTree.addContent(div); if (configuration.allowTag(HtmlTag.MAIN)) { body.addContent(htmlTree); } mdlgen.printHtmlDocument( configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body); }
java
public static void generate(ConfigurationImpl configuration, ModuleElement moduleElement) throws DocFileIOException { ModuleFrameWriter mdlgen = new ModuleFrameWriter(configuration, moduleElement); String mdlName = moduleElement.getQualifiedName().toString(); Content mdlLabel = new StringContent(mdlName); HtmlTree body = mdlgen.getBody(false, mdlgen.getWindowTitle(mdlName)); HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN() : body; Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, mdlgen.getHyperLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame")); htmlTree.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.indexContainer); mdlgen.addClassListing(div); htmlTree.addContent(div); if (configuration.allowTag(HtmlTag.MAIN)) { body.addContent(htmlTree); } mdlgen.printHtmlDocument( configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body); }
[ "public", "static", "void", "generate", "(", "ConfigurationImpl", "configuration", ",", "ModuleElement", "moduleElement", ")", "throws", "DocFileIOException", "{", "ModuleFrameWriter", "mdlgen", "=", "new", "ModuleFrameWriter", "(", "configuration", ",", "moduleElement", ")", ";", "String", "mdlName", "=", "moduleElement", ".", "getQualifiedName", "(", ")", ".", "toString", "(", ")", ";", "Content", "mdlLabel", "=", "new", "StringContent", "(", "mdlName", ")", ";", "HtmlTree", "body", "=", "mdlgen", ".", "getBody", "(", "false", ",", "mdlgen", ".", "getWindowTitle", "(", "mdlName", ")", ")", ";", "HtmlTree", "htmlTree", "=", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "MAIN", ")", ")", "?", "HtmlTree", ".", "MAIN", "(", ")", ":", "body", ";", "Content", "heading", "=", "HtmlTree", ".", "HEADING", "(", "HtmlConstants", ".", "TITLE_HEADING", ",", "HtmlStyle", ".", "bar", ",", "mdlgen", ".", "getHyperLink", "(", "DocPaths", ".", "moduleSummary", "(", "moduleElement", ")", ",", "mdlLabel", ",", "\"\"", ",", "\"classFrame\"", ")", ")", ";", "htmlTree", ".", "addContent", "(", "heading", ")", ";", "HtmlTree", "div", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "DIV", ")", ";", "div", ".", "addStyle", "(", "HtmlStyle", ".", "indexContainer", ")", ";", "mdlgen", ".", "addClassListing", "(", "div", ")", ";", "htmlTree", ".", "addContent", "(", "div", ")", ";", "if", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "MAIN", ")", ")", "{", "body", ".", "addContent", "(", "htmlTree", ")", ";", "}", "mdlgen", ".", "printHtmlDocument", "(", "configuration", ".", "metakeywords", ".", "getMetaKeywordsForModule", "(", "moduleElement", ")", ",", "false", ",", "body", ")", ";", "}" ]
Generate a module type summary page for the left-hand bottom frame. @param configuration the current configuration of the doclet. @param moduleElement The package for which "module_name-type-frame.html" is to be generated. @throws DocFileIOException if there is a problem generating the module summary file
[ "Generate", "a", "module", "type", "summary", "page", "for", "the", "left", "-", "hand", "bottom", "frame", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java#L94-L115
4,873
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java
ModuleFrameWriter.addClassListing
protected void addClassListing(HtmlTree contentTree) { List<PackageElement> packagesIn = ElementFilter.packagesIn(mdle.getEnclosedElements()); SortedSet<TypeElement> interfaces = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> classes = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> enums = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> exceptions = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> errors = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> annotationTypes = new TreeSet<>(utils.makeGeneralPurposeComparator()); for (PackageElement pkg : packagesIn) { if (utils.isIncluded(pkg)) { interfaces.addAll(utils.getInterfaces(pkg)); classes.addAll(utils.getOrdinaryClasses(pkg)); enums.addAll(utils.getEnums(pkg)); exceptions.addAll(utils.getExceptions(pkg)); errors.addAll(utils.getErrors(pkg)); annotationTypes.addAll(utils.getAnnotationTypes(pkg)); } } addClassKindListing(interfaces, contents.interfaces, contentTree); addClassKindListing(classes, contents.classes, contentTree); addClassKindListing(enums, contents.enums, contentTree); addClassKindListing(exceptions, contents.exceptions, contentTree); addClassKindListing(errors, contents.errors, contentTree); addClassKindListing(annotationTypes, contents.annotationTypes, contentTree); }
java
protected void addClassListing(HtmlTree contentTree) { List<PackageElement> packagesIn = ElementFilter.packagesIn(mdle.getEnclosedElements()); SortedSet<TypeElement> interfaces = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> classes = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> enums = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> exceptions = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> errors = new TreeSet<>(utils.makeGeneralPurposeComparator()); SortedSet<TypeElement> annotationTypes = new TreeSet<>(utils.makeGeneralPurposeComparator()); for (PackageElement pkg : packagesIn) { if (utils.isIncluded(pkg)) { interfaces.addAll(utils.getInterfaces(pkg)); classes.addAll(utils.getOrdinaryClasses(pkg)); enums.addAll(utils.getEnums(pkg)); exceptions.addAll(utils.getExceptions(pkg)); errors.addAll(utils.getErrors(pkg)); annotationTypes.addAll(utils.getAnnotationTypes(pkg)); } } addClassKindListing(interfaces, contents.interfaces, contentTree); addClassKindListing(classes, contents.classes, contentTree); addClassKindListing(enums, contents.enums, contentTree); addClassKindListing(exceptions, contents.exceptions, contentTree); addClassKindListing(errors, contents.errors, contentTree); addClassKindListing(annotationTypes, contents.annotationTypes, contentTree); }
[ "protected", "void", "addClassListing", "(", "HtmlTree", "contentTree", ")", "{", "List", "<", "PackageElement", ">", "packagesIn", "=", "ElementFilter", ".", "packagesIn", "(", "mdle", ".", "getEnclosedElements", "(", ")", ")", ";", "SortedSet", "<", "TypeElement", ">", "interfaces", "=", "new", "TreeSet", "<>", "(", "utils", ".", "makeGeneralPurposeComparator", "(", ")", ")", ";", "SortedSet", "<", "TypeElement", ">", "classes", "=", "new", "TreeSet", "<>", "(", "utils", ".", "makeGeneralPurposeComparator", "(", ")", ")", ";", "SortedSet", "<", "TypeElement", ">", "enums", "=", "new", "TreeSet", "<>", "(", "utils", ".", "makeGeneralPurposeComparator", "(", ")", ")", ";", "SortedSet", "<", "TypeElement", ">", "exceptions", "=", "new", "TreeSet", "<>", "(", "utils", ".", "makeGeneralPurposeComparator", "(", ")", ")", ";", "SortedSet", "<", "TypeElement", ">", "errors", "=", "new", "TreeSet", "<>", "(", "utils", ".", "makeGeneralPurposeComparator", "(", ")", ")", ";", "SortedSet", "<", "TypeElement", ">", "annotationTypes", "=", "new", "TreeSet", "<>", "(", "utils", ".", "makeGeneralPurposeComparator", "(", ")", ")", ";", "for", "(", "PackageElement", "pkg", ":", "packagesIn", ")", "{", "if", "(", "utils", ".", "isIncluded", "(", "pkg", ")", ")", "{", "interfaces", ".", "addAll", "(", "utils", ".", "getInterfaces", "(", "pkg", ")", ")", ";", "classes", ".", "addAll", "(", "utils", ".", "getOrdinaryClasses", "(", "pkg", ")", ")", ";", "enums", ".", "addAll", "(", "utils", ".", "getEnums", "(", "pkg", ")", ")", ";", "exceptions", ".", "addAll", "(", "utils", ".", "getExceptions", "(", "pkg", ")", ")", ";", "errors", ".", "addAll", "(", "utils", ".", "getErrors", "(", "pkg", ")", ")", ";", "annotationTypes", ".", "addAll", "(", "utils", ".", "getAnnotationTypes", "(", "pkg", ")", ")", ";", "}", "}", "addClassKindListing", "(", "interfaces", ",", "contents", ".", "interfaces", ",", "contentTree", ")", ";", "addClassKindListing", "(", "classes", ",", "contents", ".", "classes", ",", "contentTree", ")", ";", "addClassKindListing", "(", "enums", ",", "contents", ".", "enums", ",", "contentTree", ")", ";", "addClassKindListing", "(", "exceptions", ",", "contents", ".", "exceptions", ",", "contentTree", ")", ";", "addClassKindListing", "(", "errors", ",", "contents", ".", "errors", ",", "contentTree", ")", ";", "addClassKindListing", "(", "annotationTypes", ",", "contents", ".", "annotationTypes", ",", "contentTree", ")", ";", "}" ]
Add class listing for all the classes in this module. Divide class listing as per the class kind and generate separate listing for Classes, Interfaces, Exceptions and Errors. @param contentTree the content tree to which the listing will be added
[ "Add", "class", "listing", "for", "all", "the", "classes", "in", "this", "module", ".", "Divide", "class", "listing", "as", "per", "the", "class", "kind", "and", "generate", "separate", "listing", "for", "Classes", "Interfaces", "Exceptions", "and", "Errors", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java#L124-L148
4,874
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/WildcardTypeImpl.java
WildcardTypeImpl.asClassDoc
@Override public ClassDoc asClassDoc() { return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym); }
java
@Override public ClassDoc asClassDoc() { return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym); }
[ "@", "Override", "public", "ClassDoc", "asClassDoc", "(", ")", "{", "return", "env", ".", "getClassDoc", "(", "(", "ClassSymbol", ")", "env", ".", "types", ".", "erasure", "(", "type", ")", ".", "tsym", ")", ";", "}" ]
Return the ClassDoc of the erasure of this wildcard type.
[ "Return", "the", "ClassDoc", "of", "the", "erasure", "of", "this", "wildcard", "type", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/WildcardTypeImpl.java#L75-L78
4,875
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java
PackageIndexWriter.addOverview
@Override protected void addOverview(Content body) { if (configuration.allowTag(HtmlTag.MAIN)) { body.addContent(htmlTree); } }
java
@Override protected void addOverview(Content body) { if (configuration.allowTag(HtmlTag.MAIN)) { body.addContent(htmlTree); } }
[ "@", "Override", "protected", "void", "addOverview", "(", "Content", "body", ")", "{", "if", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "MAIN", ")", ")", "{", "body", ".", "addContent", "(", "htmlTree", ")", ";", "}", "}" ]
For HTML 5, add the htmlTree to the body. For HTML 4, do nothing. @param body the documentation tree to which the overview will be added
[ "For", "HTML", "5", "add", "the", "htmlTree", "to", "the", "body", ".", "For", "HTML", "4", "do", "nothing", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java#L211-L216
4,876
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java
Items.makeLocalItem
LocalItem makeLocalItem(VarSymbol v) { return new LocalItem(v.erasure(types), v.adr); }
java
LocalItem makeLocalItem(VarSymbol v) { return new LocalItem(v.erasure(types), v.adr); }
[ "LocalItem", "makeLocalItem", "(", "VarSymbol", "v", ")", "{", "return", "new", "LocalItem", "(", "v", ".", "erasure", "(", "types", ")", ",", "v", ".", "adr", ")", ";", "}" ]
Make an item representing a local variable. @param v The represented variable.
[ "Make", "an", "item", "representing", "a", "local", "variable", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java#L130-L132
4,877
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java
Items.makeCondItem
CondItem makeCondItem(int opcode, Chain trueJumps, Chain falseJumps) { return new CondItem(opcode, trueJumps, falseJumps); }
java
CondItem makeCondItem(int opcode, Chain trueJumps, Chain falseJumps) { return new CondItem(opcode, trueJumps, falseJumps); }
[ "CondItem", "makeCondItem", "(", "int", "opcode", ",", "Chain", "trueJumps", ",", "Chain", "falseJumps", ")", "{", "return", "new", "CondItem", "(", "opcode", ",", "trueJumps", ",", "falseJumps", ")", ";", "}" ]
Make an item representing a conditional or unconditional jump. @param opcode The jump's opcode. @param trueJumps A chain encomassing all jumps that can be taken if the condition evaluates to true. @param falseJumps A chain encomassing all jumps that can be taken if the condition evaluates to false.
[ "Make", "an", "item", "representing", "a", "conditional", "or", "unconditional", "jump", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java#L180-L182
4,878
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java
Analyzer.dependences
Set<String> dependences(Archive source) { if (!results.containsKey(source)) { return Collections.emptySet(); } return results.get(source).dependencies() .stream() .map(Dep::target) .collect(Collectors.toSet()); }
java
Set<String> dependences(Archive source) { if (!results.containsKey(source)) { return Collections.emptySet(); } return results.get(source).dependencies() .stream() .map(Dep::target) .collect(Collectors.toSet()); }
[ "Set", "<", "String", ">", "dependences", "(", "Archive", "source", ")", "{", "if", "(", "!", "results", ".", "containsKey", "(", "source", ")", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", "}", "return", "results", ".", "get", "(", "source", ")", ".", "dependencies", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "Dep", "::", "target", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "}" ]
Returns the dependences, either class name or package name as specified in the given verbose level, from the given source.
[ "Returns", "the", "dependences", "either", "class", "name", "or", "package", "name", "as", "specified", "in", "the", "given", "verbose", "level", "from", "the", "given", "source", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java#L128-L137
4,879
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java
Analyzer.requires
Stream<Archive> requires(Archive source) { if (!results.containsKey(source)) { return Stream.empty(); } return results.get(source).requires() .stream(); }
java
Stream<Archive> requires(Archive source) { if (!results.containsKey(source)) { return Stream.empty(); } return results.get(source).requires() .stream(); }
[ "Stream", "<", "Archive", ">", "requires", "(", "Archive", "source", ")", "{", "if", "(", "!", "results", ".", "containsKey", "(", "source", ")", ")", "{", "return", "Stream", ".", "empty", "(", ")", ";", "}", "return", "results", ".", "get", "(", "source", ")", ".", "requires", "(", ")", ".", "stream", "(", ")", ";", "}" ]
Returns the direct dependences of the given source
[ "Returns", "the", "direct", "dependences", "of", "the", "given", "source" ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java#L142-L148
4,880
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java
JdiDefaultExecutionControl.stop
@Override public void stop() throws EngineTerminationException, InternalException { synchronized (STOP_LOCK) { if (!userCodeRunning) { return; } vm().suspend(); try { OUTER: for (ThreadReference thread : vm().allThreads()) { // could also tag the thread (e.g. using name), to find it easier for (StackFrame frame : thread.frames()) { if (remoteAgent.equals(frame.location().declaringType().name()) && ( "invoke".equals(frame.location().method().name()) || "varValue".equals(frame.location().method().name()))) { ObjectReference thiz = frame.thisObject(); Field inClientCode = thiz.referenceType().fieldByName("inClientCode"); Field expectingStop = thiz.referenceType().fieldByName("expectingStop"); Field stopException = thiz.referenceType().fieldByName("stopException"); if (((BooleanValue) thiz.getValue(inClientCode)).value()) { thiz.setValue(expectingStop, vm().mirrorOf(true)); ObjectReference stopInstance = (ObjectReference) thiz.getValue(stopException); vm().resume(); debug("Attempting to stop the client code...\n"); thread.stop(stopInstance); thiz.setValue(expectingStop, vm().mirrorOf(false)); } break OUTER; } } } } catch (ClassNotLoadedException | IncompatibleThreadStateException | InvalidTypeException ex) { throw new InternalException("Exception on remote stop: " + ex); } finally { vm().resume(); } } }
java
@Override public void stop() throws EngineTerminationException, InternalException { synchronized (STOP_LOCK) { if (!userCodeRunning) { return; } vm().suspend(); try { OUTER: for (ThreadReference thread : vm().allThreads()) { // could also tag the thread (e.g. using name), to find it easier for (StackFrame frame : thread.frames()) { if (remoteAgent.equals(frame.location().declaringType().name()) && ( "invoke".equals(frame.location().method().name()) || "varValue".equals(frame.location().method().name()))) { ObjectReference thiz = frame.thisObject(); Field inClientCode = thiz.referenceType().fieldByName("inClientCode"); Field expectingStop = thiz.referenceType().fieldByName("expectingStop"); Field stopException = thiz.referenceType().fieldByName("stopException"); if (((BooleanValue) thiz.getValue(inClientCode)).value()) { thiz.setValue(expectingStop, vm().mirrorOf(true)); ObjectReference stopInstance = (ObjectReference) thiz.getValue(stopException); vm().resume(); debug("Attempting to stop the client code...\n"); thread.stop(stopInstance); thiz.setValue(expectingStop, vm().mirrorOf(false)); } break OUTER; } } } } catch (ClassNotLoadedException | IncompatibleThreadStateException | InvalidTypeException ex) { throw new InternalException("Exception on remote stop: " + ex); } finally { vm().resume(); } } }
[ "@", "Override", "public", "void", "stop", "(", ")", "throws", "EngineTerminationException", ",", "InternalException", "{", "synchronized", "(", "STOP_LOCK", ")", "{", "if", "(", "!", "userCodeRunning", ")", "{", "return", ";", "}", "vm", "(", ")", ".", "suspend", "(", ")", ";", "try", "{", "OUTER", ":", "for", "(", "ThreadReference", "thread", ":", "vm", "(", ")", ".", "allThreads", "(", ")", ")", "{", "// could also tag the thread (e.g. using name), to find it easier", "for", "(", "StackFrame", "frame", ":", "thread", ".", "frames", "(", ")", ")", "{", "if", "(", "remoteAgent", ".", "equals", "(", "frame", ".", "location", "(", ")", ".", "declaringType", "(", ")", ".", "name", "(", ")", ")", "&&", "(", "\"invoke\"", ".", "equals", "(", "frame", ".", "location", "(", ")", ".", "method", "(", ")", ".", "name", "(", ")", ")", "||", "\"varValue\"", ".", "equals", "(", "frame", ".", "location", "(", ")", ".", "method", "(", ")", ".", "name", "(", ")", ")", ")", ")", "{", "ObjectReference", "thiz", "=", "frame", ".", "thisObject", "(", ")", ";", "Field", "inClientCode", "=", "thiz", ".", "referenceType", "(", ")", ".", "fieldByName", "(", "\"inClientCode\"", ")", ";", "Field", "expectingStop", "=", "thiz", ".", "referenceType", "(", ")", ".", "fieldByName", "(", "\"expectingStop\"", ")", ";", "Field", "stopException", "=", "thiz", ".", "referenceType", "(", ")", ".", "fieldByName", "(", "\"stopException\"", ")", ";", "if", "(", "(", "(", "BooleanValue", ")", "thiz", ".", "getValue", "(", "inClientCode", ")", ")", ".", "value", "(", ")", ")", "{", "thiz", ".", "setValue", "(", "expectingStop", ",", "vm", "(", ")", ".", "mirrorOf", "(", "true", ")", ")", ";", "ObjectReference", "stopInstance", "=", "(", "ObjectReference", ")", "thiz", ".", "getValue", "(", "stopException", ")", ";", "vm", "(", ")", ".", "resume", "(", ")", ";", "debug", "(", "\"Attempting to stop the client code...\\n\"", ")", ";", "thread", ".", "stop", "(", "stopInstance", ")", ";", "thiz", ".", "setValue", "(", "expectingStop", ",", "vm", "(", ")", ".", "mirrorOf", "(", "false", ")", ")", ";", "}", "break", "OUTER", ";", "}", "}", "}", "}", "catch", "(", "ClassNotLoadedException", "|", "IncompatibleThreadStateException", "|", "InvalidTypeException", "ex", ")", "{", "throw", "new", "InternalException", "(", "\"Exception on remote stop: \"", "+", "ex", ")", ";", "}", "finally", "{", "vm", "(", ")", ".", "resume", "(", ")", ";", "}", "}", "}" ]
Interrupts a running remote invoke by manipulating remote variables and sending a stop via JDI. @throws EngineTerminationException the execution engine has terminated @throws InternalException an internal problem occurred
[ "Interrupts", "a", "running", "remote", "invoke", "by", "manipulating", "remote", "variables", "and", "sending", "a", "stop", "via", "JDI", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java#L176-L216
4,881
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ModuleFinder.java
ModuleFinder.instance
public static ModuleFinder instance(Context context) { ModuleFinder instance = context.get(moduleFinderKey); if (instance == null) instance = new ModuleFinder(context); return instance; }
java
public static ModuleFinder instance(Context context) { ModuleFinder instance = context.get(moduleFinderKey); if (instance == null) instance = new ModuleFinder(context); return instance; }
[ "public", "static", "ModuleFinder", "instance", "(", "Context", "context", ")", "{", "ModuleFinder", "instance", "=", "context", ".", "get", "(", "moduleFinderKey", ")", ";", "if", "(", "instance", "==", "null", ")", "instance", "=", "new", "ModuleFinder", "(", "context", ")", ";", "return", "instance", ";", "}" ]
Get the ModuleFinder instance for this invocation.
[ "Get", "the", "ModuleFinder", "instance", "for", "this", "invocation", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ModuleFinder.java#L97-L102
4,882
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java
PathFileObject.forDirectoryPath
static PathFileObject forDirectoryPath(BaseFileManager fileManager, Path path, Path userPackageRootDir, RelativePath relativePath) { return new DirectoryFileObject(fileManager, path, userPackageRootDir, relativePath); }
java
static PathFileObject forDirectoryPath(BaseFileManager fileManager, Path path, Path userPackageRootDir, RelativePath relativePath) { return new DirectoryFileObject(fileManager, path, userPackageRootDir, relativePath); }
[ "static", "PathFileObject", "forDirectoryPath", "(", "BaseFileManager", "fileManager", ",", "Path", "path", ",", "Path", "userPackageRootDir", ",", "RelativePath", "relativePath", ")", "{", "return", "new", "DirectoryFileObject", "(", "fileManager", ",", "path", ",", "userPackageRootDir", ",", "relativePath", ")", ";", "}" ]
Create a PathFileObject for a file within a directory, such that the binary name can be inferred from the relationship to an enclosing directory. The binary name is derived from {@code relativePath}. The name is derived from the composition of {@code userPackageRootDir} and {@code relativePath}. @param fileManager the file manager creating this file object @param path the absolute path referred to by this file object @param userPackageRootDir the path of the directory containing the root of the package hierarchy @param relativePath the path of this file relative to {@code userPackageRootDir}
[ "Create", "a", "PathFileObject", "for", "a", "file", "within", "a", "directory", "such", "that", "the", "binary", "name", "can", "be", "inferred", "from", "the", "relationship", "to", "an", "enclosing", "directory", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java#L100-L103
4,883
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java
PathFileObject.forJarPath
public static PathFileObject forJarPath(BaseFileManager fileManager, Path path, Path userJarPath) { return new JarFileObject(fileManager, path, userJarPath); }
java
public static PathFileObject forJarPath(BaseFileManager fileManager, Path path, Path userJarPath) { return new JarFileObject(fileManager, path, userJarPath); }
[ "public", "static", "PathFileObject", "forJarPath", "(", "BaseFileManager", "fileManager", ",", "Path", "path", ",", "Path", "userJarPath", ")", "{", "return", "new", "JarFileObject", "(", "fileManager", ",", "path", ",", "userJarPath", ")", ";", "}" ]
Create a PathFileObject for a file in a file system such as a jar file, such that the binary name can be inferred from its position within the file system. The binary name is derived from {@code path}. The name is derived from the composition of {@code userJarPath} and {@code path}. @param fileManager the file manager creating this file object @param path the path referred to by this file object @param userJarPath the path of the jar file containing the file system. @return the file object
[ "Create", "a", "PathFileObject", "for", "a", "file", "in", "a", "file", "system", "such", "as", "a", "jar", "file", "such", "that", "the", "binary", "name", "can", "be", "inferred", "from", "its", "position", "within", "the", "file", "system", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java#L155-L158
4,884
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java
PathFileObject.forSimplePath
static PathFileObject forSimplePath(BaseFileManager fileManager, Path path, Path userPath) { return new SimpleFileObject(fileManager, path, userPath); }
java
static PathFileObject forSimplePath(BaseFileManager fileManager, Path path, Path userPath) { return new SimpleFileObject(fileManager, path, userPath); }
[ "static", "PathFileObject", "forSimplePath", "(", "BaseFileManager", "fileManager", ",", "Path", "path", ",", "Path", "userPath", ")", "{", "return", "new", "SimpleFileObject", "(", "fileManager", ",", "path", ",", "userPath", ")", ";", "}" ]
Create a PathFileObject for a file whose binary name must be inferred from its position on a search path. The binary name is inferred by finding an enclosing directory in the sequence of paths associated with the location given to {@link JavaFileManager#inferBinaryName). The name is derived from {@code userPath}. @param fileManager the file manager creating this file object @param path the path referred to by this file object @param userPath the "user-friendly" name for this path.
[ "Create", "a", "PathFileObject", "for", "a", "file", "whose", "binary", "name", "must", "be", "inferred", "from", "its", "position", "on", "a", "search", "path", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java#L274-L277
4,885
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
ModuleIndexWriter.generate
public static void generate(ConfigurationImpl configuration) throws DocFileIOException { DocPath filename = DocPaths.overviewSummary(configuration.frames); ModuleIndexWriter mdlgen = new ModuleIndexWriter(configuration, filename); mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", true); }
java
public static void generate(ConfigurationImpl configuration) throws DocFileIOException { DocPath filename = DocPaths.overviewSummary(configuration.frames); ModuleIndexWriter mdlgen = new ModuleIndexWriter(configuration, filename); mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", true); }
[ "public", "static", "void", "generate", "(", "ConfigurationImpl", "configuration", ")", "throws", "DocFileIOException", "{", "DocPath", "filename", "=", "DocPaths", ".", "overviewSummary", "(", "configuration", ".", "frames", ")", ";", "ModuleIndexWriter", "mdlgen", "=", "new", "ModuleIndexWriter", "(", "configuration", ",", "filename", ")", ";", "mdlgen", ".", "buildModuleIndexFile", "(", "\"doclet.Window_Overview_Summary\"", ",", "true", ")", ";", "}" ]
Generate the module index page for the right-hand frame. @param configuration the current configuration of the doclet. @throws DocFileIOException if there is a problem generating the module index page
[ "Generate", "the", "module", "index", "page", "for", "the", "right", "-", "hand", "frame", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java#L92-L96
4,886
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
ModuleIndexWriter.addIndex
@Override protected void addIndex(Content body) { for (String groupname : groupList) { SortedSet<ModuleElement> list = groupModuleMap.get(groupname); if (list != null && !list.isEmpty()) { addIndexContents(list, groupname, configuration.getText("doclet.Member_Table_Summary", groupname, configuration.getText("doclet.modules")), body); } } }
java
@Override protected void addIndex(Content body) { for (String groupname : groupList) { SortedSet<ModuleElement> list = groupModuleMap.get(groupname); if (list != null && !list.isEmpty()) { addIndexContents(list, groupname, configuration.getText("doclet.Member_Table_Summary", groupname, configuration.getText("doclet.modules")), body); } } }
[ "@", "Override", "protected", "void", "addIndex", "(", "Content", "body", ")", "{", "for", "(", "String", "groupname", ":", "groupList", ")", "{", "SortedSet", "<", "ModuleElement", ">", "list", "=", "groupModuleMap", ".", "get", "(", "groupname", ")", ";", "if", "(", "list", "!=", "null", "&&", "!", "list", ".", "isEmpty", "(", ")", ")", "{", "addIndexContents", "(", "list", ",", "groupname", ",", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "groupname", ",", "configuration", ".", "getText", "(", "\"doclet.modules\"", ")", ")", ",", "body", ")", ";", "}", "}", "}" ]
Add the module index. @param body the documentation tree to which the index will be added
[ "Add", "the", "module", "index", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java#L103-L113
4,887
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
ModuleIndexWriter.addIndexContents
protected void addIndexContents(Collection<ModuleElement> modules, String title, String tableSummary, Content body) { HtmlTree htmltree = (configuration.allowTag(HtmlTag.NAV)) ? HtmlTree.NAV() : new HtmlTree(HtmlTag.DIV); htmltree.addStyle(HtmlStyle.indexNav); HtmlTree ul = new HtmlTree(HtmlTag.UL); addAllClassesLink(ul); if (configuration.showModules) { addAllModulesLink(ul); } htmltree.addContent(ul); body.addContent(htmltree); addModulesList(modules, title, tableSummary, body); }
java
protected void addIndexContents(Collection<ModuleElement> modules, String title, String tableSummary, Content body) { HtmlTree htmltree = (configuration.allowTag(HtmlTag.NAV)) ? HtmlTree.NAV() : new HtmlTree(HtmlTag.DIV); htmltree.addStyle(HtmlStyle.indexNav); HtmlTree ul = new HtmlTree(HtmlTag.UL); addAllClassesLink(ul); if (configuration.showModules) { addAllModulesLink(ul); } htmltree.addContent(ul); body.addContent(htmltree); addModulesList(modules, title, tableSummary, body); }
[ "protected", "void", "addIndexContents", "(", "Collection", "<", "ModuleElement", ">", "modules", ",", "String", "title", ",", "String", "tableSummary", ",", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "NAV", ")", ")", "?", "HtmlTree", ".", "NAV", "(", ")", ":", "new", "HtmlTree", "(", "HtmlTag", ".", "DIV", ")", ";", "htmltree", ".", "addStyle", "(", "HtmlStyle", ".", "indexNav", ")", ";", "HtmlTree", "ul", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "UL", ")", ";", "addAllClassesLink", "(", "ul", ")", ";", "if", "(", "configuration", ".", "showModules", ")", "{", "addAllModulesLink", "(", "ul", ")", ";", "}", "htmltree", ".", "addContent", "(", "ul", ")", ";", "body", ".", "addContent", "(", "htmltree", ")", ";", "addModulesList", "(", "modules", ",", "title", ",", "tableSummary", ",", "body", ")", ";", "}" ]
Adds module index contents. @param title the title of the section @param tableSummary summary for the table @param body the document tree to which the index contents will be added
[ "Adds", "module", "index", "contents", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java#L122-L135
4,888
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
ModuleIndexWriter.addModulesList
protected void addModulesList(Collection<ModuleElement> modules, String text, String tableSummary, Content body) { Content table = (configuration.isOutputHtml5()) ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text))) : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text))); table.addContent(getSummaryTableHeader(moduleTableHeader, "col")); Content tbody = new HtmlTree(HtmlTag.TBODY); addModulesList(modules, tbody); table.addContent(tbody); Content anchor = getMarkerAnchor(text); Content div = HtmlTree.DIV(HtmlStyle.contentContainer, anchor); div.addContent(table); if (configuration.allowTag(HtmlTag.MAIN)) { htmlTree.addContent(div); } else { body.addContent(div); } }
java
protected void addModulesList(Collection<ModuleElement> modules, String text, String tableSummary, Content body) { Content table = (configuration.isOutputHtml5()) ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text))) : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text))); table.addContent(getSummaryTableHeader(moduleTableHeader, "col")); Content tbody = new HtmlTree(HtmlTag.TBODY); addModulesList(modules, tbody); table.addContent(tbody); Content anchor = getMarkerAnchor(text); Content div = HtmlTree.DIV(HtmlStyle.contentContainer, anchor); div.addContent(table); if (configuration.allowTag(HtmlTag.MAIN)) { htmlTree.addContent(div); } else { body.addContent(div); } }
[ "protected", "void", "addModulesList", "(", "Collection", "<", "ModuleElement", ">", "modules", ",", "String", "text", ",", "String", "tableSummary", ",", "Content", "body", ")", "{", "Content", "table", "=", "(", "configuration", ".", "isOutputHtml5", "(", ")", ")", "?", "HtmlTree", ".", "TABLE", "(", "HtmlStyle", ".", "overviewSummary", ",", "getTableCaption", "(", "new", "RawHtml", "(", "text", ")", ")", ")", ":", "HtmlTree", ".", "TABLE", "(", "HtmlStyle", ".", "overviewSummary", ",", "tableSummary", ",", "getTableCaption", "(", "new", "RawHtml", "(", "text", ")", ")", ")", ";", "table", ".", "addContent", "(", "getSummaryTableHeader", "(", "moduleTableHeader", ",", "\"col\"", ")", ")", ";", "Content", "tbody", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "TBODY", ")", ";", "addModulesList", "(", "modules", ",", "tbody", ")", ";", "table", ".", "addContent", "(", "tbody", ")", ";", "Content", "anchor", "=", "getMarkerAnchor", "(", "text", ")", ";", "Content", "div", "=", "HtmlTree", ".", "DIV", "(", "HtmlStyle", ".", "contentContainer", ",", "anchor", ")", ";", "div", ".", "addContent", "(", "table", ")", ";", "if", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "MAIN", ")", ")", "{", "htmlTree", ".", "addContent", "(", "div", ")", ";", "}", "else", "{", "body", ".", "addContent", "(", "div", ")", ";", "}", "}" ]
Add the list of modules. @param text The table caption @param tableSummary the summary of the table tag @param body the content tree to which the module list will be added
[ "Add", "the", "list", "of", "modules", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java#L144-L160
4,889
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
ModuleIndexWriter.addModulesList
protected void addModulesList(Collection<ModuleElement> modules, Content tbody) { boolean altColor = true; for (ModuleElement mdle : modules) { if (!mdle.isUnnamed()) { Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString())); Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent); HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); tdSummary.addStyle(HtmlStyle.colLast); addSummaryComment(mdle, tdSummary); HtmlTree tr = HtmlTree.TR(thModule); tr.addContent(tdSummary); tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); tbody.addContent(tr); } altColor = !altColor; } }
java
protected void addModulesList(Collection<ModuleElement> modules, Content tbody) { boolean altColor = true; for (ModuleElement mdle : modules) { if (!mdle.isUnnamed()) { Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString())); Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent); HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); tdSummary.addStyle(HtmlStyle.colLast); addSummaryComment(mdle, tdSummary); HtmlTree tr = HtmlTree.TR(thModule); tr.addContent(tdSummary); tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); tbody.addContent(tr); } altColor = !altColor; } }
[ "protected", "void", "addModulesList", "(", "Collection", "<", "ModuleElement", ">", "modules", ",", "Content", "tbody", ")", "{", "boolean", "altColor", "=", "true", ";", "for", "(", "ModuleElement", "mdle", ":", "modules", ")", "{", "if", "(", "!", "mdle", ".", "isUnnamed", "(", ")", ")", "{", "Content", "moduleLinkContent", "=", "getModuleLink", "(", "mdle", ",", "new", "StringContent", "(", "mdle", ".", "getQualifiedName", "(", ")", ".", "toString", "(", ")", ")", ")", ";", "Content", "thModule", "=", "HtmlTree", ".", "TH_ROW_SCOPE", "(", "HtmlStyle", ".", "colFirst", ",", "moduleLinkContent", ")", ";", "HtmlTree", "tdSummary", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "TD", ")", ";", "tdSummary", ".", "addStyle", "(", "HtmlStyle", ".", "colLast", ")", ";", "addSummaryComment", "(", "mdle", ",", "tdSummary", ")", ";", "HtmlTree", "tr", "=", "HtmlTree", ".", "TR", "(", "thModule", ")", ";", "tr", ".", "addContent", "(", "tdSummary", ")", ";", "tr", ".", "addStyle", "(", "altColor", "?", "HtmlStyle", ".", "altColor", ":", "HtmlStyle", ".", "rowColor", ")", ";", "tbody", ".", "addContent", "(", "tr", ")", ";", "}", "altColor", "=", "!", "altColor", ";", "}", "}" ]
Adds list of modules in the index table. Generate link to each module. @param tbody the documentation tree to which the list will be added
[ "Adds", "list", "of", "modules", "in", "the", "index", "table", ".", "Generate", "link", "to", "each", "module", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java#L167-L183
4,890
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.convertRoot
public static void convertRoot(ConfigurationImpl configuration, RootDoc rd, DocPath outputdir) { new SourceToHTMLConverter(configuration, rd, outputdir).generate(); }
java
public static void convertRoot(ConfigurationImpl configuration, RootDoc rd, DocPath outputdir) { new SourceToHTMLConverter(configuration, rd, outputdir).generate(); }
[ "public", "static", "void", "convertRoot", "(", "ConfigurationImpl", "configuration", ",", "RootDoc", "rd", ",", "DocPath", "outputdir", ")", "{", "new", "SourceToHTMLConverter", "(", "configuration", ",", "rd", ",", "outputdir", ")", ".", "generate", "(", ")", ";", "}" ]
Convert the Classes in the given RootDoc to an HTML. @param configuration the configuration. @param rd the RootDoc to convert. @param outputdir the name of the directory to output to.
[ "Convert", "the", "Classes", "in", "the", "given", "RootDoc", "to", "an", "HTML", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java#L93-L96
4,891
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.addLineNo
private static void addLineNo(Content pre, int lineno) { HtmlTree span = new HtmlTree(HtmlTag.SPAN); span.addStyle(HtmlStyle.sourceLineNo); if (lineno < 10) { span.addContent("00" + Integer.toString(lineno)); } else if (lineno < 100) { span.addContent("0" + Integer.toString(lineno)); } else { span.addContent(Integer.toString(lineno)); } pre.addContent(span); }
java
private static void addLineNo(Content pre, int lineno) { HtmlTree span = new HtmlTree(HtmlTag.SPAN); span.addStyle(HtmlStyle.sourceLineNo); if (lineno < 10) { span.addContent("00" + Integer.toString(lineno)); } else if (lineno < 100) { span.addContent("0" + Integer.toString(lineno)); } else { span.addContent(Integer.toString(lineno)); } pre.addContent(span); }
[ "private", "static", "void", "addLineNo", "(", "Content", "pre", ",", "int", "lineno", ")", "{", "HtmlTree", "span", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "SPAN", ")", ";", "span", ".", "addStyle", "(", "HtmlStyle", ".", "sourceLineNo", ")", ";", "if", "(", "lineno", "<", "10", ")", "{", "span", ".", "addContent", "(", "\"00\"", "+", "Integer", ".", "toString", "(", "lineno", ")", ")", ";", "}", "else", "if", "(", "lineno", "<", "100", ")", "{", "span", ".", "addContent", "(", "\"0\"", "+", "Integer", ".", "toString", "(", "lineno", ")", ")", ";", "}", "else", "{", "span", ".", "addContent", "(", "Integer", ".", "toString", "(", "lineno", ")", ")", ";", "}", "pre", ".", "addContent", "(", "span", ")", ";", "}" ]
Add the line numbers for the source code. @param pre the content tree to which the line number will be added @param lineno The line number
[ "Add", "the", "line", "numbers", "for", "the", "source", "code", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java#L247-L258
4,892
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.addBlankLines
private static void addBlankLines(Content pre) { for (int i = 0; i < NUM_BLANK_LINES; i++) { pre.addContent(NEW_LINE); } }
java
private static void addBlankLines(Content pre) { for (int i = 0; i < NUM_BLANK_LINES; i++) { pre.addContent(NEW_LINE); } }
[ "private", "static", "void", "addBlankLines", "(", "Content", "pre", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "NUM_BLANK_LINES", ";", "i", "++", ")", "{", "pre", ".", "addContent", "(", "NEW_LINE", ")", ";", "}", "}" ]
Add trailing blank lines at the end of the page. @param pre the content tree to which the blank lines will be added.
[ "Add", "trailing", "blank", "lines", "at", "the", "end", "of", "the", "page", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java#L282-L286
4,893
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
SerializedFormWriterImpl.getSerializedSummariesHeader
public Content getSerializedSummariesHeader() { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.blockList); return ul; }
java
public Content getSerializedSummariesHeader() { HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.addStyle(HtmlStyle.blockList); return ul; }
[ "public", "Content", "getSerializedSummariesHeader", "(", ")", "{", "HtmlTree", "ul", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "UL", ")", ";", "ul", ".", "addStyle", "(", "HtmlStyle", ".", "blockList", ")", ";", "return", "ul", ";", "}" ]
Get the serialized form summaries header. @return the serialized form summary header tree
[ "Get", "the", "serialized", "form", "summaries", "header", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java#L102-L106
4,894
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
SerializedFormWriterImpl.getSerialUIDInfoHeader
public Content getSerialUIDInfoHeader() { HtmlTree dl = new HtmlTree(HtmlTag.DL); dl.addStyle(HtmlStyle.nameValue); return dl; }
java
public Content getSerialUIDInfoHeader() { HtmlTree dl = new HtmlTree(HtmlTag.DL); dl.addStyle(HtmlStyle.nameValue); return dl; }
[ "public", "Content", "getSerialUIDInfoHeader", "(", ")", "{", "HtmlTree", "dl", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "DL", ")", ";", "dl", ".", "addStyle", "(", "HtmlStyle", ".", "nameValue", ")", ";", "return", "dl", ";", "}" ]
Get the serial UID info header. @return a content tree for the serial uid info header
[ "Get", "the", "serial", "UID", "info", "header", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java#L196-L200
4,895
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
SerializedFormWriterImpl.addSerialUIDInfo
public void addSerialUIDInfo(String header, String serialUID, Content serialUidTree) { Content headerContent = new StringContent(header); serialUidTree.addContent(HtmlTree.DT(headerContent)); Content serialContent = new StringContent(serialUID); serialUidTree.addContent(HtmlTree.DD(serialContent)); }
java
public void addSerialUIDInfo(String header, String serialUID, Content serialUidTree) { Content headerContent = new StringContent(header); serialUidTree.addContent(HtmlTree.DT(headerContent)); Content serialContent = new StringContent(serialUID); serialUidTree.addContent(HtmlTree.DD(serialContent)); }
[ "public", "void", "addSerialUIDInfo", "(", "String", "header", ",", "String", "serialUID", ",", "Content", "serialUidTree", ")", "{", "Content", "headerContent", "=", "new", "StringContent", "(", "header", ")", ";", "serialUidTree", ".", "addContent", "(", "HtmlTree", ".", "DT", "(", "headerContent", ")", ")", ";", "Content", "serialContent", "=", "new", "StringContent", "(", "serialUID", ")", ";", "serialUidTree", ".", "addContent", "(", "HtmlTree", ".", "DD", "(", "serialContent", ")", ")", ";", "}" ]
Adds the serial UID info. @param header the header that will show up before the UID. @param serialUID the serial UID to print. @param serialUidTree the serial UID content tree to which the serial UID content will be added
[ "Adds", "the", "serial", "UID", "info", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java#L210-L216
4,896
google/error-prone-javac
src/sample/share/language/model/CoreReflectionFactory.java
CoreReflectionFactory.main
public static void main(String... args) { getElements().printElements(new java.io.PrintWriter(System.out), createMirror(CoreReflectionFactory.class)); }
java
public static void main(String... args) { getElements().printElements(new java.io.PrintWriter(System.out), createMirror(CoreReflectionFactory.class)); }
[ "public", "static", "void", "main", "(", "String", "...", "args", ")", "{", "getElements", "(", ")", ".", "printElements", "(", "new", "java", ".", "io", ".", "PrintWriter", "(", "System", ".", "out", ")", ",", "createMirror", "(", "CoreReflectionFactory", ".", "class", ")", ")", ";", "}" ]
Main method; prints out a representation of this class. @param args command-line arguments, currently ignored
[ "Main", "method", ";", "prints", "out", "a", "representation", "of", "this", "class", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/sample/share/language/model/CoreReflectionFactory.java#L194-L197
4,897
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellToolBuilder.java
JShellToolBuilder.persistence
@Override public JavaShellToolBuilder persistence(Map<String, String> prefsMap) { this.prefs = new MapStorage(prefsMap); return this; }
java
@Override public JavaShellToolBuilder persistence(Map<String, String> prefsMap) { this.prefs = new MapStorage(prefsMap); return this; }
[ "@", "Override", "public", "JavaShellToolBuilder", "persistence", "(", "Map", "<", "String", ",", "String", ">", "prefsMap", ")", "{", "this", ".", "prefs", "=", "new", "MapStorage", "(", "prefsMap", ")", ";", "return", "this", ";", "}" ]
Set the storage mechanism for persistent information which includes input history and retained settings. Default if not set is the tool's standard persistence mechanism. @param prefsMap an instance of {@link java.util.Map} that is used to retrieve and store persistent information @return the {@code JavaShellToolBuilder} instance
[ "Set", "the", "storage", "mechanism", "for", "persistent", "information", "which", "includes", "input", "history", "and", "retained", "settings", ".", "Default", "if", "not", "set", "is", "the", "tool", "s", "standard", "persistence", "mechanism", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellToolBuilder.java#L164-L168
4,898
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellToolBuilder.java
JShellToolBuilder.rawTool
public JShellTool rawTool() { if (prefs == null) { prefs = new PreferencesStorage(Preferences.userRoot().node(PREFERENCES_NODE)); } if (vars == null) { vars = System.getenv(); } JShellTool sh = new JShellTool(cmdIn, cmdOut, cmdErr, console, userIn, userOut, userErr, prefs, vars, locale); sh.testPrompt = capturePrompt; return sh; }
java
public JShellTool rawTool() { if (prefs == null) { prefs = new PreferencesStorage(Preferences.userRoot().node(PREFERENCES_NODE)); } if (vars == null) { vars = System.getenv(); } JShellTool sh = new JShellTool(cmdIn, cmdOut, cmdErr, console, userIn, userOut, userErr, prefs, vars, locale); sh.testPrompt = capturePrompt; return sh; }
[ "public", "JShellTool", "rawTool", "(", ")", "{", "if", "(", "prefs", "==", "null", ")", "{", "prefs", "=", "new", "PreferencesStorage", "(", "Preferences", ".", "userRoot", "(", ")", ".", "node", "(", "PREFERENCES_NODE", ")", ")", ";", "}", "if", "(", "vars", "==", "null", ")", "{", "vars", "=", "System", ".", "getenv", "(", ")", ";", "}", "JShellTool", "sh", "=", "new", "JShellTool", "(", "cmdIn", ",", "cmdOut", ",", "cmdErr", ",", "console", ",", "userIn", ",", "userOut", ",", "userErr", ",", "prefs", ",", "vars", ",", "locale", ")", ";", "sh", ".", "testPrompt", "=", "capturePrompt", ";", "return", "sh", ";", "}" ]
Create a tool instance for testing. Not in JavaShellToolBuilder. @return the tool instance
[ "Create", "a", "tool", "instance", "for", "testing", ".", "Not", "in", "JavaShellToolBuilder", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellToolBuilder.java#L216-L227
4,899
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java
ModulePackageIndexFrameWriter.generate
public static void generate(ConfigurationImpl configuration, ModuleElement mdle) throws DocFileIOException { DocPath filename = DocPaths.moduleFrame(mdle); ModulePackageIndexFrameWriter modpackgen = new ModulePackageIndexFrameWriter(configuration, filename); modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle); }
java
public static void generate(ConfigurationImpl configuration, ModuleElement mdle) throws DocFileIOException { DocPath filename = DocPaths.moduleFrame(mdle); ModulePackageIndexFrameWriter modpackgen = new ModulePackageIndexFrameWriter(configuration, filename); modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle); }
[ "public", "static", "void", "generate", "(", "ConfigurationImpl", "configuration", ",", "ModuleElement", "mdle", ")", "throws", "DocFileIOException", "{", "DocPath", "filename", "=", "DocPaths", ".", "moduleFrame", "(", "mdle", ")", ";", "ModulePackageIndexFrameWriter", "modpackgen", "=", "new", "ModulePackageIndexFrameWriter", "(", "configuration", ",", "filename", ")", ";", "modpackgen", ".", "buildModulePackagesIndexFile", "(", "\"doclet.Window_Overview\"", ",", "false", ",", "mdle", ")", ";", "}" ]
Generate the module package index file. @throws DocFileIOException @param configuration the configuration object @param mdle the module being documented
[ "Generate", "the", "module", "package", "index", "file", "." ]
a53d069bbdb2c60232ed3811c19b65e41c3e60e0
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java#L78-L82