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
partition
stringclasses
1 value
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleControl.java
SimpleControl.toggleTooltip
@Override protected void toggleTooltip(Node reference) { if (reference instanceof Control) { this.toggleTooltip(reference, (Control) reference); } }
java
@Override protected void toggleTooltip(Node reference) { if (reference instanceof Control) { this.toggleTooltip(reference, (Control) reference); } }
[ "@", "Override", "protected", "void", "toggleTooltip", "(", "Node", "reference", ")", "{", "if", "(", "reference", "instanceof", "Control", ")", "{", "this", ".", "toggleTooltip", "(", "reference", ",", "(", "Control", ")", "reference", ")", ";", "}", "}" ...
Sets the error message as tooltip for the matching control and shows them below the same control. @param reference The control which gets the tooltip.
[ "Sets", "the", "error", "message", "as", "tooltip", "for", "the", "matching", "control", "and", "shows", "them", "below", "the", "same", "control", "." ]
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleControl.java#L148-L153
train
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleControl.java
SimpleControl.toggleTooltip
@Override protected void toggleTooltip(Node reference, Control below) { String fieldTooltip = field.getTooltip(); if ((reference.isFocused() || reference.isHover()) && (!fieldTooltip.equals("") || field.getErrorMessages().size() > 0)) { tooltip.setText((!fieldTooltip.equals("") ? fieldTooltip +...
java
@Override protected void toggleTooltip(Node reference, Control below) { String fieldTooltip = field.getTooltip(); if ((reference.isFocused() || reference.isHover()) && (!fieldTooltip.equals("") || field.getErrorMessages().size() > 0)) { tooltip.setText((!fieldTooltip.equals("") ? fieldTooltip +...
[ "@", "Override", "protected", "void", "toggleTooltip", "(", "Node", "reference", ",", "Control", "below", ")", "{", "String", "fieldTooltip", "=", "field", ".", "getTooltip", "(", ")", ";", "if", "(", "(", "reference", ".", "isFocused", "(", ")", "||", "...
Sets the error message as tooltip for the matching control. @param below The control needed for positioning the tooltip. @param reference The control which gets the tooltip.
[ "Sets", "the", "error", "message", "as", "tooltip", "for", "the", "matching", "control", "." ]
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleControl.java#L161-L185
train
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleControl.java
SimpleControl.updateStyle
@Override protected void updateStyle(PseudoClass pseudo, boolean newValue) { if (node != null) { node.pseudoClassStateChanged(pseudo, newValue); } if (fieldLabel != null) { fieldLabel.pseudoClassStateChanged(pseudo, newValue); } }
java
@Override protected void updateStyle(PseudoClass pseudo, boolean newValue) { if (node != null) { node.pseudoClassStateChanged(pseudo, newValue); } if (fieldLabel != null) { fieldLabel.pseudoClassStateChanged(pseudo, newValue); } }
[ "@", "Override", "protected", "void", "updateStyle", "(", "PseudoClass", "pseudo", ",", "boolean", "newValue", ")", "{", "if", "(", "node", "!=", "null", ")", "{", "node", ".", "pseudoClassStateChanged", "(", "pseudo", ",", "newValue", ")", ";", "}", "if",...
Sets the css style for the defined properties. @param pseudo The CSS pseudo class to toggle. @param newValue Determines whether the CSS class should be applied.
[ "Sets", "the", "css", "style", "for", "the", "defined", "properties", "." ]
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleControl.java#L193-L201
train
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/history/Change.java
Change.createListToObjectBinding
private Callable createListToObjectBinding(ListProperty<P> listProperty) { return () -> { if (!isListChange() && listProperty.get() != null && listProperty.get().size() != 0) { return listProperty.get().get(0); } return null; }; }
java
private Callable createListToObjectBinding(ListProperty<P> listProperty) { return () -> { if (!isListChange() && listProperty.get() != null && listProperty.get().size() != 0) { return listProperty.get().get(0); } return null; }; }
[ "private", "Callable", "createListToObjectBinding", "(", "ListProperty", "<", "P", ">", "listProperty", ")", "{", "return", "(", ")", "->", "{", "if", "(", "!", "isListChange", "(", ")", "&&", "listProperty", ".", "get", "(", ")", "!=", "null", "&&", "li...
Creates a function, which handles binding between a ListProperty and an ObjectProperty. <p>If this change isn't a list change, oldValue and newValue properties will have the single element inside of the list, for easier usage. @param listProperty to be bound to the object property @return Callable function, which bin...
[ "Creates", "a", "function", "which", "handles", "binding", "between", "a", "ListProperty", "and", "an", "ObjectProperty", "." ]
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/history/Change.java#L114-L121
train
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/history/Change.java
Change.isRedundant
public boolean isRedundant() { if (isListChange()) { return Objects.equals(oldList.get(),newList.get()); } return oldValue.get().equals(newValue.get()); }
java
public boolean isRedundant() { if (isListChange()) { return Objects.equals(oldList.get(),newList.get()); } return oldValue.get().equals(newValue.get()); }
[ "public", "boolean", "isRedundant", "(", ")", "{", "if", "(", "isListChange", "(", ")", ")", "{", "return", "Objects", ".", "equals", "(", "oldList", ".", "get", "(", ")", ",", "newList", ".", "get", "(", ")", ")", ";", "}", "return", "oldValue", "...
Compares newValue and oldValue to see if they are the same. If this is the case, this change is redundant, since it doesn't represent a true change. This can happen on compounded changes. @return true if redundant, else if otherwise.
[ "Compares", "newValue", "and", "oldValue", "to", "see", "if", "they", "are", "the", "same", ".", "If", "this", "is", "the", "case", "this", "change", "is", "redundant", "since", "it", "doesn", "t", "represent", "a", "true", "change", ".", "This", "can", ...
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/history/Change.java#L130-L135
train
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/view/BreadCrumbPresenter.java
BreadCrumbPresenter.setupBreadCrumbBar
public void setupBreadCrumbBar() { String[] stringArr = model.getDisplayedCategory().getBreadcrumb().split(BREADCRUMB_DELIMITER); Category[] categories = new Category[stringArr.length]; // Collecting all parent categories from the displayed category using the breadcrumb. // There will always be at leas...
java
public void setupBreadCrumbBar() { String[] stringArr = model.getDisplayedCategory().getBreadcrumb().split(BREADCRUMB_DELIMITER); Category[] categories = new Category[stringArr.length]; // Collecting all parent categories from the displayed category using the breadcrumb. // There will always be at leas...
[ "public", "void", "setupBreadCrumbBar", "(", ")", "{", "String", "[", "]", "stringArr", "=", "model", ".", "getDisplayedCategory", "(", ")", ".", "getBreadcrumb", "(", ")", ".", "split", "(", "BREADCRUMB_DELIMITER", ")", ";", "Category", "[", "]", "categorie...
Sets up the BreadcrumbBar depending on the displayed category.
[ "Sets", "up", "the", "BreadcrumbBar", "depending", "on", "the", "displayed", "category", "." ]
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/view/BreadCrumbPresenter.java#L52-L69
train
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/view/BreadCrumbPresenter.java
BreadCrumbPresenter.searchCategory
private Category searchCategory(String breadcrumb) { return model.getFlatCategoriesLst().stream().filter( cat -> cat.getBreadcrumb().equals(breadcrumb) ).findAny().orElse(null); }
java
private Category searchCategory(String breadcrumb) { return model.getFlatCategoriesLst().stream().filter( cat -> cat.getBreadcrumb().equals(breadcrumb) ).findAny().orElse(null); }
[ "private", "Category", "searchCategory", "(", "String", "breadcrumb", ")", "{", "return", "model", ".", "getFlatCategoriesLst", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "cat", "->", "cat", ".", "getBreadcrumb", "(", ")", ".", "equals", "(", ...
Searches in all categories for the category that matches a breadcrumb. @param breadcrumb the breadcrumb, which the matching category should have @return a matching category or null if nothing is found
[ "Searches", "in", "all", "categories", "for", "the", "category", "that", "matches", "a", "breadcrumb", "." ]
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/view/BreadCrumbPresenter.java#L77-L81
train
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java
Category.of
public static Category of(String description, Node itemIcon, Group... groups) { return new Category(description, itemIcon, groups); }
java
public static Category of(String description, Node itemIcon, Group... groups) { return new Category(description, itemIcon, groups); }
[ "public", "static", "Category", "of", "(", "String", "description", ",", "Node", "itemIcon", ",", "Group", "...", "groups", ")", "{", "return", "new", "Category", "(", "description", ",", "itemIcon", ",", "groups", ")", ";", "}" ]
Creates a new category from groups. @param description Category name, for display in {@link CategoryView} @param itemIcon Icon to be shown next to the category name @param groups {@link Group} with {@link Setting} to be shown in the {@link CategoryView} @return initialized Category object
[ "Creates", "a", "new", "category", "from", "groups", "." ]
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java#L116-L118
train
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java
Category.createBreadcrumbs
public void createBreadcrumbs(List<Category> categories) { categories.forEach(category -> { category.setBreadcrumb(getBreadcrumb() + BREADCRUMB_DELIMITER + category.getDescription()); if (!Objects.equals(category.getGroups(), null)) { category.getGroups().forEach(group -> group.addToBreadcrumb(g...
java
public void createBreadcrumbs(List<Category> categories) { categories.forEach(category -> { category.setBreadcrumb(getBreadcrumb() + BREADCRUMB_DELIMITER + category.getDescription()); if (!Objects.equals(category.getGroups(), null)) { category.getGroups().forEach(group -> group.addToBreadcrumb(g...
[ "public", "void", "createBreadcrumbs", "(", "List", "<", "Category", ">", "categories", ")", "{", "categories", ".", "forEach", "(", "category", "->", "{", "category", ".", "setBreadcrumb", "(", "getBreadcrumb", "(", ")", "+", "BREADCRUMB_DELIMITER", "+", "cat...
Creates and defines all of the breadcrumbs for all of the categories. @param categories the categories to create breadcrumbs for
[ "Creates", "and", "defines", "all", "of", "the", "breadcrumbs", "for", "all", "of", "the", "categories", "." ]
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java#L148-L158
train
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java
Category.translate
public void translate(TranslationService translationService) { if (translationService == null) { description.setValue(descriptionKey.getValue()); return; } if (!Strings.isNullOrEmpty(descriptionKey.get())) { description.setValue(translationService.translate(descriptionKey.get())); } ...
java
public void translate(TranslationService translationService) { if (translationService == null) { description.setValue(descriptionKey.getValue()); return; } if (!Strings.isNullOrEmpty(descriptionKey.get())) { description.setValue(translationService.translate(descriptionKey.get())); } ...
[ "public", "void", "translate", "(", "TranslationService", "translationService", ")", "{", "if", "(", "translationService", "==", "null", ")", "{", "description", ".", "setValue", "(", "descriptionKey", ".", "getValue", "(", ")", ")", ";", "return", ";", "}", ...
This internal method is used as a callback for when the translation service or its locale changes. Also applies the translation to all contained sections. @see com.dlsc.formsfx.model.structure.Group ::translate
[ "This", "internal", "method", "is", "used", "as", "a", "callback", "for", "when", "the", "translation", "service", "or", "its", "locale", "changes", ".", "Also", "applies", "the", "translation", "to", "all", "contained", "sections", "." ]
e06a49663ec949c2f7eb56e6b5952c030ed42d33
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java#L200-L209
train
mkolisnyk/cucumber-reports
cucumber-report-generator/src/main/java/com/github/mkolisnyk/cucumber/reporting/types/OverviewStats.java
OverviewStats.add
public OverviewStats add(OverviewStats other) { this.addFeaturesFailed(other.getFeaturesFailed()); this.addFeaturesKnown(other.getFeaturesKnown()); this.addFeaturesPassed(other.getFeaturesPassed()); this.addFeaturesUndefined(other.getFeaturesUndefined()); this.addScenariosFailed(...
java
public OverviewStats add(OverviewStats other) { this.addFeaturesFailed(other.getFeaturesFailed()); this.addFeaturesKnown(other.getFeaturesKnown()); this.addFeaturesPassed(other.getFeaturesPassed()); this.addFeaturesUndefined(other.getFeaturesUndefined()); this.addScenariosFailed(...
[ "public", "OverviewStats", "add", "(", "OverviewStats", "other", ")", "{", "this", ".", "addFeaturesFailed", "(", "other", ".", "getFeaturesFailed", "(", ")", ")", ";", "this", ".", "addFeaturesKnown", "(", "other", ".", "getFeaturesKnown", "(", ")", ")", ";...
Merges 2 overview statistic structures where all corresponding values are simply added to current object. @param other the other structure of the {@link OverviewStats} type to add values from. @return the structure containing the sum of current statistics and the statistics from the parameter.
[ "Merges", "2", "overview", "statistic", "structures", "where", "all", "corresponding", "values", "are", "simply", "added", "to", "current", "object", "." ]
9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e
https://github.com/mkolisnyk/cucumber-reports/blob/9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e/cucumber-report-generator/src/main/java/com/github/mkolisnyk/cucumber/reporting/types/OverviewStats.java#L212-L226
train
mkolisnyk/cucumber-reports
cucumber-report-generator/src/main/java/com/github/mkolisnyk/cucumber/reporting/types/OverviewStats.java
OverviewStats.valuate
public OverviewStats valuate(CucumberScenarioResult scenario) { this.reset(); scenario.valuate(); this.addOverallDuration((float) scenario.getDuration()); this.addStepsPassed(scenario.getPassed()); this.addStepsFailed(scenario.getFailed()); this.addStepsKnown(scenario.get...
java
public OverviewStats valuate(CucumberScenarioResult scenario) { this.reset(); scenario.valuate(); this.addOverallDuration((float) scenario.getDuration()); this.addStepsPassed(scenario.getPassed()); this.addStepsFailed(scenario.getFailed()); this.addStepsKnown(scenario.get...
[ "public", "OverviewStats", "valuate", "(", "CucumberScenarioResult", "scenario", ")", "{", "this", ".", "reset", "(", ")", ";", "scenario", ".", "valuate", "(", ")", ";", "this", ".", "addOverallDuration", "(", "(", "float", ")", "scenario", ".", "getDuratio...
Calculates overall statistics for specific scenario. @param scenario the scenario result to calculate statistics for. @return calculated statistics for specific scenario.
[ "Calculates", "overall", "statistics", "for", "specific", "scenario", "." ]
9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e
https://github.com/mkolisnyk/cucumber-reports/blob/9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e/cucumber-report-generator/src/main/java/com/github/mkolisnyk/cucumber/reporting/types/OverviewStats.java#L232-L241
train
mkolisnyk/cucumber-reports
cucumber-report-generator/src/main/java/com/github/mkolisnyk/cucumber/reporting/types/OverviewStats.java
OverviewStats.valuate
public OverviewStats valuate(CucumberFeatureResult result) { this.reset(); result.valuate(); this.addOverallDuration(result.getDuration()); if (result.getStatus().equals("passed")) { this.addFeaturesPassed(1); } else if (result.getStatus().equals("failed")) { ...
java
public OverviewStats valuate(CucumberFeatureResult result) { this.reset(); result.valuate(); this.addOverallDuration(result.getDuration()); if (result.getStatus().equals("passed")) { this.addFeaturesPassed(1); } else if (result.getStatus().equals("failed")) { ...
[ "public", "OverviewStats", "valuate", "(", "CucumberFeatureResult", "result", ")", "{", "this", ".", "reset", "(", ")", ";", "result", ".", "valuate", "(", ")", ";", "this", ".", "addOverallDuration", "(", "result", ".", "getDuration", "(", ")", ")", ";", ...
Calculates run statistics for the single feature result. @param result the feature result data to calculate statistics for. @return the calculated statistics for the specific feature.
[ "Calculates", "run", "statistics", "for", "the", "single", "feature", "result", "." ]
9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e
https://github.com/mkolisnyk/cucumber-reports/blob/9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e/cucumber-report-generator/src/main/java/com/github/mkolisnyk/cucumber/reporting/types/OverviewStats.java#L247-L272
train
mkolisnyk/cucumber-reports
cucumber-report-generator/src/main/java/com/github/mkolisnyk/cucumber/reporting/types/OverviewStats.java
OverviewStats.valuate
public OverviewStats valuate(CucumberFeatureResult[] results) { this.reset(); for (CucumberFeatureResult result : results) { result.valuate(); this.addOverallDuration(result.getDuration()); OverviewStats stats = new OverviewStats(); stats.valuate(result); ...
java
public OverviewStats valuate(CucumberFeatureResult[] results) { this.reset(); for (CucumberFeatureResult result : results) { result.valuate(); this.addOverallDuration(result.getDuration()); OverviewStats stats = new OverviewStats(); stats.valuate(result); ...
[ "public", "OverviewStats", "valuate", "(", "CucumberFeatureResult", "[", "]", "results", ")", "{", "this", ".", "reset", "(", ")", ";", "for", "(", "CucumberFeatureResult", "result", ":", "results", ")", "{", "result", ".", "valuate", "(", ")", ";", "this"...
Calculates overall statistics for the group of features. @param results the list of features to calculate run statistics for. @return calculated statistics for the specified set of features.
[ "Calculates", "overall", "statistics", "for", "the", "group", "of", "features", "." ]
9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e
https://github.com/mkolisnyk/cucumber-reports/blob/9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e/cucumber-report-generator/src/main/java/com/github/mkolisnyk/cucumber/reporting/types/OverviewStats.java#L278-L288
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/util/ReorderingBlockingQueue.java
ReorderingBlockingQueue.put
public void put(final E e, final long timeStamp) throws InterruptedException { final ReentrantLock lock = this.lock; lock.lockInterruptibly(); try { // mask is a.length - 1 while(timeStamp - this.timeStamp > mask) newSpaceAvailable.await(); final int timeOffset = (int)(timeStamp - this.timeStamp); ass...
java
public void put(final E e, final long timeStamp) throws InterruptedException { final ReentrantLock lock = this.lock; lock.lockInterruptibly(); try { // mask is a.length - 1 while(timeStamp - this.timeStamp > mask) newSpaceAvailable.await(); final int timeOffset = (int)(timeStamp - this.timeStamp); ass...
[ "public", "void", "put", "(", "final", "E", "e", ",", "final", "long", "timeStamp", ")", "throws", "InterruptedException", "{", "final", "ReentrantLock", "lock", "=", "this", ".", "lock", ";", "lock", ".", "lockInterruptibly", "(", ")", ";", "try", "{", ...
Inserts an element with given timestamp, waiting for space to become available if the timestamp of the element minus the current timestamp of the queue exceeds the queue capacity. @param e an element. @param timeStamp the timestamp of {@code e}.
[ "Inserts", "an", "element", "with", "given", "timestamp", "waiting", "for", "space", "to", "become", "available", "if", "the", "timestamp", "of", "the", "element", "minus", "the", "current", "timestamp", "of", "the", "queue", "exceeds", "the", "queue", "capaci...
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/util/ReorderingBlockingQueue.java#L77-L92
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/util/ReorderingBlockingQueue.java
ReorderingBlockingQueue.take
public E take() throws InterruptedException { final ReentrantLock lock = this.lock; lock.lockInterruptibly(); try { while (a[start] == null) nextObjectReady.await(); @SuppressWarnings("unchecked") final E x = (E)a[start]; a[start] = null; start = start + 1 & mask; --count; timeStamp++; new...
java
public E take() throws InterruptedException { final ReentrantLock lock = this.lock; lock.lockInterruptibly(); try { while (a[start] == null) nextObjectReady.await(); @SuppressWarnings("unchecked") final E x = (E)a[start]; a[start] = null; start = start + 1 & mask; --count; timeStamp++; new...
[ "public", "E", "take", "(", ")", "throws", "InterruptedException", "{", "final", "ReentrantLock", "lock", "=", "this", ".", "lock", ";", "lock", ".", "lockInterruptibly", "(", ")", ";", "try", "{", "while", "(", "a", "[", "start", "]", "==", "null", ")...
Returns the element with the next timestamp, waiting until it is available. <p>Note that because of the reordering semantics, an invocation of this method on a {@linkplain #isEmpty() nonempty} queue might block nonetheless. @return the element with the next timestamp.
[ "Returns", "the", "element", "with", "the", "next", "timestamp", "waiting", "until", "it", "is", "available", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/util/ReorderingBlockingQueue.java#L101-L118
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/RuntimeConfiguration.java
RuntimeConfiguration.parsersFromSpecs
public static ArrayList<Parser<?>> parsersFromSpecs(String[] specs) throws IllegalArgumentException, ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException, IOException { final ArrayList<Parser<?>> parsers = new ArrayList<>(); for(final String spec :...
java
public static ArrayList<Parser<?>> parsersFromSpecs(String[] specs) throws IllegalArgumentException, ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException, IOException { final ArrayList<Parser<?>> parsers = new ArrayList<>(); for(final String spec :...
[ "public", "static", "ArrayList", "<", "Parser", "<", "?", ">", ">", "parsersFromSpecs", "(", "String", "[", "]", "specs", ")", "throws", "IllegalArgumentException", ",", "ClassNotFoundException", ",", "IllegalAccessException", ",", "InvocationTargetException", ",", ...
Given an array of parser specifications, it returns the corresponding list of parsers (only the correct specifications are put in the list. @param specs the parser specifications (they will be parsed using {@link ObjectParser}. @return a list of parsers built according to the specifications (only the parseable items a...
[ "Given", "an", "array", "of", "parser", "specifications", "it", "returns", "the", "corresponding", "list", "of", "parsers", "(", "only", "the", "correct", "specifications", "are", "put", "in", "the", "list", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/RuntimeConfiguration.java#L497-L501
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/StartupConfiguration.java
StartupConfiguration.append
private static Configuration append(Configuration base, Configuration additional) { final CompositeConfiguration result = new CompositeConfiguration(); result.addConfiguration(additional); result.addConfiguration(base); return result; }
java
private static Configuration append(Configuration base, Configuration additional) { final CompositeConfiguration result = new CompositeConfiguration(); result.addConfiguration(additional); result.addConfiguration(base); return result; }
[ "private", "static", "Configuration", "append", "(", "Configuration", "base", ",", "Configuration", "additional", ")", "{", "final", "CompositeConfiguration", "result", "=", "new", "CompositeConfiguration", "(", ")", ";", "result", ".", "addConfiguration", "(", "add...
Takes two configuration and returns their union, with the second overriding the first. @param base the base configuration. @param additional the additional set of properties, some of which may override those specified in <code>base</code>. @return the union of the two configurations, as specified above.
[ "Takes", "two", "configuration", "and", "returns", "their", "union", "with", "the", "second", "overriding", "the", "first", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/StartupConfiguration.java#L634-L639
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java
ConcurrentCountingMap.get
public int get(final byte[] array, final int offset, final int length) { final long hash = MurmurHash3.hash(array, offset, length); final ReadLock readLock = lock[(int)(hash >>> shift)].readLock(); try { readLock.lock(); return stripe[(int)(hash >>> shift)].get(array, offset, length, hash); } finally { ...
java
public int get(final byte[] array, final int offset, final int length) { final long hash = MurmurHash3.hash(array, offset, length); final ReadLock readLock = lock[(int)(hash >>> shift)].readLock(); try { readLock.lock(); return stripe[(int)(hash >>> shift)].get(array, offset, length, hash); } finally { ...
[ "public", "int", "get", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ",", "final", "int", "length", ")", "{", "final", "long", "hash", "=", "MurmurHash3", ".", "hash", "(", "array", ",", "offset", ",", "length", ")", ";", ...
Gets the value of the counter associated with a given key. @param array a byte array. @param offset the first valid byte in {@code array}. @param length the number of valid elements in {@code array}. @return the current value of the counter associated with the specified key.
[ "Gets", "the", "value", "of", "the", "counter", "associated", "with", "a", "given", "key", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java#L85-L95
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java
ConcurrentCountingMap.addTo
public int addTo(final byte[] array, final int offset, final int length, final int delta) { final long hash = MurmurHash3.hash(array, offset, length); final WriteLock writeLock = lock[(int)(hash >>> shift)].writeLock(); try { writeLock.lock(); return stripe[(int)(hash >>> shift)].addTo(array, offset, length...
java
public int addTo(final byte[] array, final int offset, final int length, final int delta) { final long hash = MurmurHash3.hash(array, offset, length); final WriteLock writeLock = lock[(int)(hash >>> shift)].writeLock(); try { writeLock.lock(); return stripe[(int)(hash >>> shift)].addTo(array, offset, length...
[ "public", "int", "addTo", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ",", "final", "int", "length", ",", "final", "int", "delta", ")", "{", "final", "long", "hash", "=", "MurmurHash3", ".", "hash", "(", "array", ",", "off...
Adds a value to the counter associated with a given key. @param array a byte array. @param offset the first valid byte in {@code array}. @param length the number of valid elements in {@code array}. @param delta a value to be added to the counter associated with the specified key. @return the previous value of the coun...
[ "Adds", "a", "value", "to", "the", "counter", "associated", "with", "a", "given", "key", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java#L115-L125
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java
ConcurrentCountingMap.put
public int put(final byte[] array, final int offset, final int length, final int value) { final long hash = MurmurHash3.hash(array, offset, length); final WriteLock writeLock = lock[(int)(hash >>> shift)].writeLock(); try { writeLock.lock(); return stripe[(int)(hash >>> shift)].put(array, offset, length, ha...
java
public int put(final byte[] array, final int offset, final int length, final int value) { final long hash = MurmurHash3.hash(array, offset, length); final WriteLock writeLock = lock[(int)(hash >>> shift)].writeLock(); try { writeLock.lock(); return stripe[(int)(hash >>> shift)].put(array, offset, length, ha...
[ "public", "int", "put", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ",", "final", "int", "length", ",", "final", "int", "value", ")", "{", "final", "long", "hash", "=", "MurmurHash3", ".", "hash", "(", "array", ",", "offse...
Sets the value associated with a given key. @param array a byte array. @param offset the first valid byte in {@code array}. @param length the number of valid elements in {@code array}. @param value a value to be associated with the specified key. @return the previous value of the counter associated with the specified ...
[ "Sets", "the", "value", "associated", "with", "a", "given", "key", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ConcurrentCountingMap.java#L145-L155
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchEntry.java
WorkbenchEntry.add
public synchronized void add(VisitState visitState) { final boolean wasEntirelyBroken = isEntirelyBroken(); if (visitState.lastExceptionClass != null) brokenVisitStates++; visitStates.add(visitState); assert brokenVisitStates <= visitStates.size(); if (wasEntirelyBroken && ! isEntirelyBroken()) workbenchBroke...
java
public synchronized void add(VisitState visitState) { final boolean wasEntirelyBroken = isEntirelyBroken(); if (visitState.lastExceptionClass != null) brokenVisitStates++; visitStates.add(visitState); assert brokenVisitStates <= visitStates.size(); if (wasEntirelyBroken && ! isEntirelyBroken()) workbenchBroke...
[ "public", "synchronized", "void", "add", "(", "VisitState", "visitState", ")", "{", "final", "boolean", "wasEntirelyBroken", "=", "isEntirelyBroken", "(", ")", ";", "if", "(", "visitState", ".", "lastExceptionClass", "!=", "null", ")", "brokenVisitStates", "++", ...
Adds the given visit state to the visit-state queue. <p>This method is used for deserialization only. @param visitState the visit state that must be added to the visit-state queue. @see PriorityQueue#add(Object)
[ "Adds", "the", "given", "visit", "state", "to", "the", "visit", "-", "state", "queue", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchEntry.java#L97-L104
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/VisitState.java
VisitState.setWorkbenchEntry
public synchronized void setWorkbenchEntry(final WorkbenchEntry workbenchEntry) { assert ! acquired : this; this.workbenchEntry = workbenchEntry; if (! isEmpty()) workbenchEntry.add(this, frontier.workbench); }
java
public synchronized void setWorkbenchEntry(final WorkbenchEntry workbenchEntry) { assert ! acquired : this; this.workbenchEntry = workbenchEntry; if (! isEmpty()) workbenchEntry.add(this, frontier.workbench); }
[ "public", "synchronized", "void", "setWorkbenchEntry", "(", "final", "WorkbenchEntry", "workbenchEntry", ")", "{", "assert", "!", "acquired", ":", "this", ";", "this", ".", "workbenchEntry", "=", "workbenchEntry", ";", "if", "(", "!", "isEmpty", "(", ")", ")",...
Sets the workbench entry and put this visit state in its entry if it is nonempty. <ul> <li>Preconditions: not {{@link #acquired}}. </ul>
[ "Sets", "the", "workbench", "entry", "and", "put", "this", "visit", "state", "in", "its", "entry", "if", "it", "is", "nonempty", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/VisitState.java#L147-L151
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/VisitState.java
VisitState.putInEntryIfNotEmpty
public synchronized void putInEntryIfNotEmpty() { assert workbenchEntry != null : this; assert acquired : this; assert workbenchEntry.acquired : workbenchEntry; if (! isEmpty()) workbenchEntry.add(this); acquired = false; }
java
public synchronized void putInEntryIfNotEmpty() { assert workbenchEntry != null : this; assert acquired : this; assert workbenchEntry.acquired : workbenchEntry; if (! isEmpty()) workbenchEntry.add(this); acquired = false; }
[ "public", "synchronized", "void", "putInEntryIfNotEmpty", "(", ")", "{", "assert", "workbenchEntry", "!=", "null", ":", "this", ";", "assert", "acquired", ":", "this", ";", "assert", "workbenchEntry", ".", "acquired", ":", "workbenchEntry", ";", "if", "(", "!"...
Puts this visit state in its entry, if it not empty. <p>This method is called only by {@link Workbench#release(VisitState)}. Note that the associated entry is <em>not</em> put back on the workbench. Use {@link WorkbenchEntry#putOnWorkbenchIfNotEmpty(Workbench)} for that purpose. <ul> <li>Preconditions: {@link #workbe...
[ "Puts", "this", "visit", "state", "in", "its", "entry", "if", "it", "not", "empty", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/VisitState.java#L177-L183
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/VisitState.java
VisitState.enqueuePathQuery
public void enqueuePathQuery(final byte[] pathQuery) { synchronized (this) { if (nextFetch == Long.MAX_VALUE) return; final boolean wasEmpty = pathQueries.isEmpty(); pathQueries.enqueue(pathQuery); if (wasEmpty) putInEntryIfNotAcquired(); } frontier.pathQueriesInQueues.incrementAndGet(); frontier.we...
java
public void enqueuePathQuery(final byte[] pathQuery) { synchronized (this) { if (nextFetch == Long.MAX_VALUE) return; final boolean wasEmpty = pathQueries.isEmpty(); pathQueries.enqueue(pathQuery); if (wasEmpty) putInEntryIfNotAcquired(); } frontier.pathQueriesInQueues.incrementAndGet(); frontier.we...
[ "public", "void", "enqueuePathQuery", "(", "final", "byte", "[", "]", "pathQuery", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "nextFetch", "==", "Long", ".", "MAX_VALUE", ")", "return", ";", "final", "boolean", "wasEmpty", "=", "pathQuerie...
Enqueues a path+query in byte-array representation, possibly putting this visit state in its entry. <p>Note that if you enqueue more than once the same URL to a visit state using this method, it will be fetched twice. Thus, this method should be called only by the {@linkplain NewFlowReceiver receiver of new flows from...
[ "Enqueues", "a", "path", "+", "query", "in", "byte", "-", "array", "representation", "possibly", "putting", "this", "visit", "state", "in", "its", "entry", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/VisitState.java#L265-L274
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/VisitState.java
VisitState.dequeue
public byte[] dequeue() { final byte[] array; synchronized (this) { array = pathQueries.dequeue(); } if (array != ROBOTS_PATH) { frontier.pathQueriesInQueues.decrementAndGet(); frontier.weightOfpathQueriesInQueues.addAndGet(-BURL.memoryUsageOf(array)); } return array; }
java
public byte[] dequeue() { final byte[] array; synchronized (this) { array = pathQueries.dequeue(); } if (array != ROBOTS_PATH) { frontier.pathQueriesInQueues.decrementAndGet(); frontier.weightOfpathQueriesInQueues.addAndGet(-BURL.memoryUsageOf(array)); } return array; }
[ "public", "byte", "[", "]", "dequeue", "(", ")", "{", "final", "byte", "[", "]", "array", ";", "synchronized", "(", "this", ")", "{", "array", "=", "pathQueries", ".", "dequeue", "(", ")", ";", "}", "if", "(", "array", "!=", "ROBOTS_PATH", ")", "{"...
Removes the first path in the queue. @return the first path in the queue. @throws NoSuchElementException if the queue of path+queries is empty.
[ "Removes", "the", "first", "path", "in", "the", "queue", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/VisitState.java#L293-L304
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/VisitState.java
VisitState.pathQueryLimit
public int pathQueryLimit() { /* We first compute the ratio beween the delay for scheme+authorities and the IP delay. * It is usually greater than one and it expresses the number of scheme+authorities * that can "fit" the IP delay. */ final double delayRatio = Math.max(1 , (frontier.rc.schemeAuthorityDelay + ...
java
public int pathQueryLimit() { /* We first compute the ratio beween the delay for scheme+authorities and the IP delay. * It is usually greater than one and it expresses the number of scheme+authorities * that can "fit" the IP delay. */ final double delayRatio = Math.max(1 , (frontier.rc.schemeAuthorityDelay + ...
[ "public", "int", "pathQueryLimit", "(", ")", "{", "/* We first compute the ratio beween the delay for scheme+authorities and the IP delay.\n\t\t * It is usually greater than one and it expresses the number of scheme+authorities\n\t\t * that can \"fit\" the IP delay. */", "final", "double", "delayR...
Returns an estimate of the number of path+queries that this visit state should keep in memory. @return an estimate of the number of path+queries that this visit state should keep in memory.
[ "Returns", "an", "estimate", "of", "the", "number", "of", "path", "+", "queries", "that", "this", "visit", "state", "should", "keep", "in", "memory", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/VisitState.java#L400-L419
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/parser/BinaryParser.java
BinaryParser.forName
@SuppressWarnings("deprecation") public final static HashFunction forName(final String messageDigest) throws NoSuchAlgorithmException { if ("".equals(messageDigest)) return null; if ("MD5".equalsIgnoreCase(messageDigest)) return Hashing.md5(); if ("MurmurHash3".equalsIgnoreCase(messageDigest)) return Hashing.mur...
java
@SuppressWarnings("deprecation") public final static HashFunction forName(final String messageDigest) throws NoSuchAlgorithmException { if ("".equals(messageDigest)) return null; if ("MD5".equalsIgnoreCase(messageDigest)) return Hashing.md5(); if ("MurmurHash3".equalsIgnoreCase(messageDigest)) return Hashing.mur...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "final", "static", "HashFunction", "forName", "(", "final", "String", "messageDigest", ")", "throws", "NoSuchAlgorithmException", "{", "if", "(", "\"\"", ".", "equals", "(", "messageDigest", ")", ")",...
Return the hash function corresponding to a given message-digest algorithm given by name. @param messageDigest a message-digest algorithm (e.g., <code>MurmurHash3</code> or <code>MD5</code>); {@code null} if {@code messageDigest} is the empty string.
[ "Return", "the", "hash", "function", "corresponding", "to", "a", "given", "message", "-", "digest", "algorithm", "given", "by", "name", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/parser/BinaryParser.java#L44-L50
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java
GZIPArchiveWriter.writeEntry
protected void writeEntry(final GZIPArchive.Entry entry) throws IOException { // ID1 ID2 CM FLG this.output.write(GZIPArchive.GZIP_START); // MTIME writeLEInt(this.output, entry.mtime); // XFL OS this.output.write(GZIPArchive.XFL_OS); /* EXTRA begin */ // XLEN writeLEShort(this.output, GZIPAr...
java
protected void writeEntry(final GZIPArchive.Entry entry) throws IOException { // ID1 ID2 CM FLG this.output.write(GZIPArchive.GZIP_START); // MTIME writeLEInt(this.output, entry.mtime); // XFL OS this.output.write(GZIPArchive.XFL_OS); /* EXTRA begin */ // XLEN writeLEShort(this.output, GZIPAr...
[ "protected", "void", "writeEntry", "(", "final", "GZIPArchive", ".", "Entry", "entry", ")", "throws", "IOException", "{", "// ID1 ID2 CM FLG", "this", ".", "output", ".", "write", "(", "GZIPArchive", ".", "GZIP_START", ")", ";", "// MTIME", "writeLEInt", "(", ...
Writes the entry on the underlying stream. More precisely, it writes the GZIP header, the content of the (bufferized) deflater stream and then the CZIP trailer.
[ "Writes", "the", "entry", "on", "the", "underlying", "stream", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java#L54-L114
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java
GZIPArchiveWriter.getEntry
public GZIPArchive.WriteEntry getEntry(final String name, final String comment, final Date creationDate) { crc.reset(); deflater.reset(); deflaterStream.reset(); final GZIPArchive.WriteEntry entry = new GZIPArchive.WriteEntry(); entry.setName(name); entry.setComment(comment); entry.deflater = new Filter...
java
public GZIPArchive.WriteEntry getEntry(final String name, final String comment, final Date creationDate) { crc.reset(); deflater.reset(); deflaterStream.reset(); final GZIPArchive.WriteEntry entry = new GZIPArchive.WriteEntry(); entry.setName(name); entry.setComment(comment); entry.deflater = new Filter...
[ "public", "GZIPArchive", ".", "WriteEntry", "getEntry", "(", "final", "String", "name", ",", "final", "String", "comment", ",", "final", "Date", "creationDate", ")", "{", "crc", ".", "reset", "(", ")", ";", "deflater", ".", "reset", "(", ")", ";", "defla...
Returns an object that can be used to write an entry in the GZIP archive. In order to write the actual entry, one must write the entry content on the {@link GZIPArchive.WriteEntry#deflater} and, at the end, call its <code>close()</code> method (to actually write the compressed content). @param name the name of the en...
[ "Returns", "an", "object", "that", "can", "be", "used", "to", "write", "an", "entry", "in", "the", "GZIP", "archive", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java#L127-L171
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java
GZIPArchiveWriter.writeLEInt
private static void writeLEInt(OutputStream out, int i) throws IOException { out.write((byte)i); out.write((byte)((i >> 8) & 0xFF)); out.write((byte)((i >> 16) & 0xFF)); out.write((byte)((i >> 24) & 0xFF)); }
java
private static void writeLEInt(OutputStream out, int i) throws IOException { out.write((byte)i); out.write((byte)((i >> 8) & 0xFF)); out.write((byte)((i >> 16) & 0xFF)); out.write((byte)((i >> 24) & 0xFF)); }
[ "private", "static", "void", "writeLEInt", "(", "OutputStream", "out", ",", "int", "i", ")", "throws", "IOException", "{", "out", ".", "write", "(", "(", "byte", ")", "i", ")", ";", "out", ".", "write", "(", "(", "byte", ")", "(", "(", "i", ">>", ...
Writes the given integer in little-endian on the stream.
[ "Writes", "the", "given", "integer", "in", "little", "-", "endian", "on", "the", "stream", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java#L174-L179
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java
GZIPArchiveWriter.writeLEShort
private static void writeLEShort(OutputStream out, short s) throws IOException { out.write((byte)s); out.write((byte)((s >> 8) & 0xFF)); }
java
private static void writeLEShort(OutputStream out, short s) throws IOException { out.write((byte)s); out.write((byte)((s >> 8) & 0xFF)); }
[ "private", "static", "void", "writeLEShort", "(", "OutputStream", "out", ",", "short", "s", ")", "throws", "IOException", "{", "out", ".", "write", "(", "(", "byte", ")", "s", ")", ";", "out", ".", "write", "(", "(", "byte", ")", "(", "(", "s", ">>...
Writes the given short in little-endian on the stream.
[ "Writes", "the", "given", "short", "in", "little", "-", "endian", "on", "the", "stream", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java#L182-L185
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ObjectDiskQueue.java
ObjectDiskQueue.createNew
public static <T> ObjectDiskQueue<T> createNew(final File file, final int bufferSize, final boolean direct) throws IOException { return new ObjectDiskQueue<>(ByteDiskQueue.createNew(file, bufferSize, direct)); }
java
public static <T> ObjectDiskQueue<T> createNew(final File file, final int bufferSize, final boolean direct) throws IOException { return new ObjectDiskQueue<>(ByteDiskQueue.createNew(file, bufferSize, direct)); }
[ "public", "static", "<", "T", ">", "ObjectDiskQueue", "<", "T", ">", "createNew", "(", "final", "File", "file", ",", "final", "int", "bufferSize", ",", "final", "boolean", "direct", ")", "throws", "IOException", "{", "return", "new", "ObjectDiskQueue", "<>",...
Creates a new disk-based queue of objects. @param file the file that will be used to dump the queue on disk. @param bufferSize the number of items in the circular buffer (will be possibly decreased so to be a power of two). @param direct whether the {@link ByteBuffer} used by this queue should be {@linkplain ByteBuffe...
[ "Creates", "a", "new", "disk", "-", "based", "queue", "of", "objects", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ObjectDiskQueue.java#L69-L71
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ObjectDiskQueue.java
ObjectDiskQueue.createFromFile
public static <T> ObjectDiskQueue<T> createFromFile(final long size, final File file, final int bufferSize, final boolean direct) throws IOException { final ObjectDiskQueue<T> byteArrayDiskQueue = new ObjectDiskQueue<>(ByteDiskQueue.createFromFile(file, bufferSize, direct)); byteArrayDiskQueue.size = size; return...
java
public static <T> ObjectDiskQueue<T> createFromFile(final long size, final File file, final int bufferSize, final boolean direct) throws IOException { final ObjectDiskQueue<T> byteArrayDiskQueue = new ObjectDiskQueue<>(ByteDiskQueue.createFromFile(file, bufferSize, direct)); byteArrayDiskQueue.size = size; return...
[ "public", "static", "<", "T", ">", "ObjectDiskQueue", "<", "T", ">", "createFromFile", "(", "final", "long", "size", ",", "final", "File", "file", ",", "final", "int", "bufferSize", ",", "final", "boolean", "direct", ")", "throws", "IOException", "{", "fin...
Creates a new disk-based queue of objects using an existing file. <p>Note that you have to supply the correct number of objects contained in the dump file of the underlying {@link ByteDiskQueue}. Failure to do so will cause unpredictable behaviour. @param size the number of objects contained in {@code file}. @param f...
[ "Creates", "a", "new", "disk", "-", "based", "queue", "of", "objects", "using", "an", "existing", "file", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ObjectDiskQueue.java#L84-L88
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ObjectDiskQueue.java
ObjectDiskQueue.enqueue
public synchronized void enqueue(final T o) throws IOException { assert o != null; fbaos.reset(); BinIO.storeObject(o, fbaos); byteDiskQueue.enqueueInt(fbaos.length); byteDiskQueue.enqueue(fbaos.array, 0, fbaos.length); size++; }
java
public synchronized void enqueue(final T o) throws IOException { assert o != null; fbaos.reset(); BinIO.storeObject(o, fbaos); byteDiskQueue.enqueueInt(fbaos.length); byteDiskQueue.enqueue(fbaos.array, 0, fbaos.length); size++; }
[ "public", "synchronized", "void", "enqueue", "(", "final", "T", "o", ")", "throws", "IOException", "{", "assert", "o", "!=", "null", ";", "fbaos", ".", "reset", "(", ")", ";", "BinIO", ".", "storeObject", "(", "o", ",", "fbaos", ")", ";", "byteDiskQueu...
Enqueues an object to this queue. @param o the object to be enqueued.
[ "Enqueues", "an", "object", "to", "this", "queue", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ObjectDiskQueue.java#L94-L101
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ObjectDiskQueue.java
ObjectDiskQueue.dequeue
@SuppressWarnings("unchecked") public synchronized T dequeue() throws IOException { final int length = byteDiskQueue.dequeueInt(); fbaos.array = ByteArrays.grow(fbaos.array, length); byteDiskQueue.dequeue(fbaos.array, 0, length); size--; try { return (T)BinIO.loadObject(new FastByteArrayInputStream(fbaos....
java
@SuppressWarnings("unchecked") public synchronized T dequeue() throws IOException { final int length = byteDiskQueue.dequeueInt(); fbaos.array = ByteArrays.grow(fbaos.array, length); byteDiskQueue.dequeue(fbaos.array, 0, length); size--; try { return (T)BinIO.loadObject(new FastByteArrayInputStream(fbaos....
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "synchronized", "T", "dequeue", "(", ")", "throws", "IOException", "{", "final", "int", "length", "=", "byteDiskQueue", ".", "dequeueInt", "(", ")", ";", "fbaos", ".", "array", "=", "ByteArrays", ...
Dequeues an object from the queue in FIFO fashion.
[ "Dequeues", "an", "object", "from", "the", "queue", "in", "FIFO", "fashion", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ObjectDiskQueue.java#L104-L116
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/StatsThread.java
StatsThread.start
public void start(long previousCrawlDuration) { requestLogger.start(previousCrawlDuration); resourceLogger.start(previousCrawlDuration); transferredBytesLogger.start(previousCrawlDuration); receivedURLsLogger.start(previousCrawlDuration); }
java
public void start(long previousCrawlDuration) { requestLogger.start(previousCrawlDuration); resourceLogger.start(previousCrawlDuration); transferredBytesLogger.start(previousCrawlDuration); receivedURLsLogger.start(previousCrawlDuration); }
[ "public", "void", "start", "(", "long", "previousCrawlDuration", ")", "{", "requestLogger", ".", "start", "(", "previousCrawlDuration", ")", ";", "resourceLogger", ".", "start", "(", "previousCrawlDuration", ")", ";", "transferredBytesLogger", ".", "start", "(", "...
Starst all progress loggers. @param previousCrawlDuration the duration of the previous crawl, or zero for a new crawl.
[ "Starst", "all", "progress", "loggers", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/StatsThread.java#L98-L103
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/StatsThread.java
StatsThread.emit
public void emit() { requestLogger.setAndDisplay(frontier.fetchedResources.get() + frontier.fetchedRobots.get()); final long duplicates = frontier.duplicates.get(); final long archetypes = frontier.archetypes(); resourceLogger.setAndDisplay(archetypes + duplicates); transferredBytesLogger.setAndDisplay(fronti...
java
public void emit() { requestLogger.setAndDisplay(frontier.fetchedResources.get() + frontier.fetchedRobots.get()); final long duplicates = frontier.duplicates.get(); final long archetypes = frontier.archetypes(); resourceLogger.setAndDisplay(archetypes + duplicates); transferredBytesLogger.setAndDisplay(fronti...
[ "public", "void", "emit", "(", ")", "{", "requestLogger", ".", "setAndDisplay", "(", "frontier", ".", "fetchedResources", ".", "get", "(", ")", "+", "frontier", ".", "fetchedRobots", ".", "get", "(", ")", ")", ";", "final", "long", "duplicates", "=", "fr...
Emits the statistics.
[ "Emits", "the", "statistics", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/StatsThread.java#L130-L160
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveReader.java
GZIPArchiveReader.readLEInt
private static int readLEInt(InputStream in) throws IOException { int i = in.read() & 0xFF; i |= (in.read() & 0xFF) << 8; i |= (in.read() & 0xFF) << 16; i |= (in.read() & 0xFF) << 24; return i; }
java
private static int readLEInt(InputStream in) throws IOException { int i = in.read() & 0xFF; i |= (in.read() & 0xFF) << 8; i |= (in.read() & 0xFF) << 16; i |= (in.read() & 0xFF) << 24; return i; }
[ "private", "static", "int", "readLEInt", "(", "InputStream", "in", ")", "throws", "IOException", "{", "int", "i", "=", "in", ".", "read", "(", ")", "&", "0xFF", ";", "i", "|=", "(", "in", ".", "read", "(", ")", "&", "0xFF", ")", "<<", "8", ";", ...
Reads an integer in little-endian from the stream.
[ "Reads", "an", "integer", "in", "little", "-", "endian", "from", "the", "stream", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveReader.java#L261-L267
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveReader.java
GZIPArchiveReader.readLEShort
private static short readLEShort(InputStream in) throws IOException { short s = (byte)in.read(); s |= (byte)in.read() << 8; return s; }
java
private static short readLEShort(InputStream in) throws IOException { short s = (byte)in.read(); s |= (byte)in.read() << 8; return s; }
[ "private", "static", "short", "readLEShort", "(", "InputStream", "in", ")", "throws", "IOException", "{", "short", "s", "=", "(", "byte", ")", "in", ".", "read", "(", ")", ";", "s", "|=", "(", "byte", ")", "in", ".", "read", "(", ")", "<<", "8", ...
Reads a short in little-endian from the stream.
[ "Reads", "a", "short", "in", "little", "-", "endian", "from", "the", "stream", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveReader.java#L270-L274
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/records/WarcHeader.java
WarcHeader.getFirstHeader
public static Header getFirstHeader(final HeaderGroup headers, final WarcHeader.Name name) { return headers.getFirstHeader(name.value); }
java
public static Header getFirstHeader(final HeaderGroup headers, final WarcHeader.Name name) { return headers.getFirstHeader(name.value); }
[ "public", "static", "Header", "getFirstHeader", "(", "final", "HeaderGroup", "headers", ",", "final", "WarcHeader", ".", "Name", "name", ")", "{", "return", "headers", ".", "getFirstHeader", "(", "name", ".", "value", ")", ";", "}" ]
Returns the first header of given name. @param headers the headers to search from. @param name the name of the header to lookup. @return the header.
[ "Returns", "the", "first", "header", "of", "given", "name", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/records/WarcHeader.java#L123-L125
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/URLRespectsRobots.java
URLRespectsRobots.apply
public static boolean apply(final char[][] robotsFilter, final URI url) { if (robotsFilter.length == 0) return true; final String pathQuery = BURL.pathAndQuery(url); int from = 0; int to = robotsFilter.length - 1; while (from <= to) { final int mid = (from + to) >>> 1; final int cmp = compare(robotsFilt...
java
public static boolean apply(final char[][] robotsFilter, final URI url) { if (robotsFilter.length == 0) return true; final String pathQuery = BURL.pathAndQuery(url); int from = 0; int to = robotsFilter.length - 1; while (from <= to) { final int mid = (from + to) >>> 1; final int cmp = compare(robotsFilt...
[ "public", "static", "boolean", "apply", "(", "final", "char", "[", "]", "[", "]", "robotsFilter", ",", "final", "URI", "url", ")", "{", "if", "(", "robotsFilter", ".", "length", "==", "0", ")", "return", "true", ";", "final", "String", "pathQuery", "="...
Checks whether a specified URL passes a specified robots filter. @param robotsFilter a robot filter. @param url a URL to check against {@code robotsFilter}. @return true if {@code url} passes {@code robotsFilter}.
[ "Checks", "whether", "a", "specified", "URL", "passes", "a", "specified", "robots", "filter", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/URLRespectsRobots.java#L214-L227
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/filters/IsProbablyBinary.java
IsProbablyBinary.apply
@Override public boolean apply(final HttpResponse httpResponse) { try { final InputStream content = httpResponse.getEntity().getContent(); int count = 0; for(int i = BINARY_CHECK_SCAN_LENGTH; i-- != 0;) { final int b = content.read(); if (b == -1) return false; if (b == 0 && ++count == THRESHOLD...
java
@Override public boolean apply(final HttpResponse httpResponse) { try { final InputStream content = httpResponse.getEntity().getContent(); int count = 0; for(int i = BINARY_CHECK_SCAN_LENGTH; i-- != 0;) { final int b = content.read(); if (b == -1) return false; if (b == 0 && ++count == THRESHOLD...
[ "@", "Override", "public", "boolean", "apply", "(", "final", "HttpResponse", "httpResponse", ")", "{", "try", "{", "final", "InputStream", "content", "=", "httpResponse", ".", "getEntity", "(", ")", ".", "getContent", "(", ")", ";", "int", "count", "=", "0...
This method implements a simple heuristic for guessing whether a page is binary. <P>The first {@link #BINARY_CHECK_SCAN_LENGTH} bytes are scanned: if we find more than {@link #THRESHOLD} zeroes, we deduce that this page is binary. Note that this works also with UTF-8, as no UTF-8 legal character encoding contains thes...
[ "This", "method", "implements", "a", "simple", "heuristic", "for", "guessing", "whether", "a", "page", "is", "binary", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/filters/IsProbablyBinary.java#L48-L63
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/sieve/ByteArrayListByteSerializerDeserializer.java
ByteArrayListByteSerializerDeserializer.fromStream
@Override public ByteArrayList fromStream(final InputStream is) throws IOException { final int length = Util.readVByte(is); buffer.size(length); final int actual = is.read(buffer.elements(), 0, length); if (actual != length) throw new IOException("Asked for " + length + " but got " + actual); return buffer; ...
java
@Override public ByteArrayList fromStream(final InputStream is) throws IOException { final int length = Util.readVByte(is); buffer.size(length); final int actual = is.read(buffer.elements(), 0, length); if (actual != length) throw new IOException("Asked for " + length + " but got " + actual); return buffer; ...
[ "@", "Override", "public", "ByteArrayList", "fromStream", "(", "final", "InputStream", "is", ")", "throws", "IOException", "{", "final", "int", "length", "=", "Util", ".", "readVByte", "(", "is", ")", ";", "buffer", ".", "size", "(", "length", ")", ";", ...
A serializer-deserializer for byte arrays that write the array length using variable-length byte encoding, and the writes the content of the array.
[ "A", "serializer", "-", "deserializer", "for", "byte", "arrays", "that", "write", "the", "array", "length", "using", "variable", "-", "length", "byte", "encoding", "and", "the", "writes", "the", "content", "of", "the", "array", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/sieve/ByteArrayListByteSerializerDeserializer.java#L36-L43
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/VisitStateSet.java
VisitStateSet.add
public boolean add(final VisitState v) { // The starting point. int pos = (int)(MurmurHash3.hash(v.schemeAuthority) & mask); // There's always an unused entry. while (visitState[pos] != null) { if (Arrays.equals(visitState[pos].schemeAuthority, v.schemeAuthority)) return false; pos = (pos + 1) & mask; }...
java
public boolean add(final VisitState v) { // The starting point. int pos = (int)(MurmurHash3.hash(v.schemeAuthority) & mask); // There's always an unused entry. while (visitState[pos] != null) { if (Arrays.equals(visitState[pos].schemeAuthority, v.schemeAuthority)) return false; pos = (pos + 1) & mask; }...
[ "public", "boolean", "add", "(", "final", "VisitState", "v", ")", "{", "// The starting point.", "int", "pos", "=", "(", "int", ")", "(", "MurmurHash3", ".", "hash", "(", "v", ".", "schemeAuthority", ")", "&", "mask", ")", ";", "// There's always an unused e...
Adds a visit state to the set, if necessary. @param v the state to be added. @return true if the state set changed as a result of this operation.
[ "Adds", "a", "visit", "state", "to", "the", "set", "if", "necessary", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/VisitStateSet.java#L73-L84
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/VisitStateSet.java
VisitStateSet.remove
public boolean remove(final VisitState k) { // The starting point. int pos = (int)(MurmurHash3.hash(k.schemeAuthority) & mask); // There's always an unused entry. while (visitState[pos] != null) { if (visitState[pos] == k) { size--; shiftKeys(pos); // TODO: implement resize return true; } ...
java
public boolean remove(final VisitState k) { // The starting point. int pos = (int)(MurmurHash3.hash(k.schemeAuthority) & mask); // There's always an unused entry. while (visitState[pos] != null) { if (visitState[pos] == k) { size--; shiftKeys(pos); // TODO: implement resize return true; } ...
[ "public", "boolean", "remove", "(", "final", "VisitState", "k", ")", "{", "// The starting point.", "int", "pos", "=", "(", "int", ")", "(", "MurmurHash3", ".", "hash", "(", "k", ".", "schemeAuthority", ")", "&", "mask", ")", ";", "// There's always an unuse...
Removes a given visit state. @param k the visit state to be removed. @return true if the state set changed as a result of this operation.
[ "Removes", "a", "given", "visit", "state", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/VisitStateSet.java#L113-L127
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/VisitStateSet.java
VisitStateSet.rehash
protected void rehash(final int newN) { int i = 0, pos; final VisitState[] visitState = this.visitState; final int newMask = newN - 1; final VisitState[] newVisitState = new VisitState[newN]; for (int j = size; j-- != 0;) { while (visitState[i] == null) i++; VisitState v = visitState[i]; pos = (int)...
java
protected void rehash(final int newN) { int i = 0, pos; final VisitState[] visitState = this.visitState; final int newMask = newN - 1; final VisitState[] newVisitState = new VisitState[newN]; for (int j = size; j-- != 0;) { while (visitState[i] == null) i++; VisitState v = visitState[i]; pos = (int)...
[ "protected", "void", "rehash", "(", "final", "int", "newN", ")", "{", "int", "i", "=", "0", ",", "pos", ";", "final", "VisitState", "[", "]", "visitState", "=", "this", ".", "visitState", ";", "final", "int", "newMask", "=", "newN", "-", "1", ";", ...
Rehashes the state set to a new size. @param newN the new size.
[ "Rehashes", "the", "state", "set", "to", "a", "new", "size", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/VisitStateSet.java#L208-L226
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java
ByteArrayDiskQueue.createNew
public static ByteArrayDiskQueue createNew(final File file, final int bufferSize, final boolean direct) throws IOException { return new ByteArrayDiskQueue(ByteDiskQueue.createNew(file, bufferSize, direct)); }
java
public static ByteArrayDiskQueue createNew(final File file, final int bufferSize, final boolean direct) throws IOException { return new ByteArrayDiskQueue(ByteDiskQueue.createNew(file, bufferSize, direct)); }
[ "public", "static", "ByteArrayDiskQueue", "createNew", "(", "final", "File", "file", ",", "final", "int", "bufferSize", ",", "final", "boolean", "direct", ")", "throws", "IOException", "{", "return", "new", "ByteArrayDiskQueue", "(", "ByteDiskQueue", ".", "createN...
Creates a new disk-based queue of byte arrays. @param file the file that will be used to dump the queue on disk. @param bufferSize the number of items in the circular buffer (will be possibly decreased so to be a power of two). @param direct whether the {@link ByteBuffer} used by this queue should be {@linkplain ByteB...
[ "Creates", "a", "new", "disk", "-", "based", "queue", "of", "byte", "arrays", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java#L66-L68
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java
ByteArrayDiskQueue.createFromFile
public static ByteArrayDiskQueue createFromFile(final long size, final File file, final int bufferSize, final boolean direct) throws IOException { final ByteArrayDiskQueue byteArrayDiskQueue = new ByteArrayDiskQueue(ByteDiskQueue.createFromFile(file, bufferSize, direct)); byteArrayDiskQueue.size = size; return by...
java
public static ByteArrayDiskQueue createFromFile(final long size, final File file, final int bufferSize, final boolean direct) throws IOException { final ByteArrayDiskQueue byteArrayDiskQueue = new ByteArrayDiskQueue(ByteDiskQueue.createFromFile(file, bufferSize, direct)); byteArrayDiskQueue.size = size; return by...
[ "public", "static", "ByteArrayDiskQueue", "createFromFile", "(", "final", "long", "size", ",", "final", "File", "file", ",", "final", "int", "bufferSize", ",", "final", "boolean", "direct", ")", "throws", "IOException", "{", "final", "ByteArrayDiskQueue", "byteArr...
Creates a new disk-based queue of byte arrays using an existing file. <p>Note that you have to supply the correct number of byte arrays contained in the dump file of the underlying {@link ByteDiskQueue}. Failure to do so will cause unpredictable behaviour. @param size the number of byte arrays contained in {@code fil...
[ "Creates", "a", "new", "disk", "-", "based", "queue", "of", "byte", "arrays", "using", "an", "existing", "file", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java#L81-L85
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java
ByteArrayDiskQueue.enqueue
public synchronized void enqueue(final byte[] array) throws IOException { assert array != null; byteDiskQueue.enqueueInt(array.length); byteDiskQueue.enqueue(array); size++; }
java
public synchronized void enqueue(final byte[] array) throws IOException { assert array != null; byteDiskQueue.enqueueInt(array.length); byteDiskQueue.enqueue(array); size++; }
[ "public", "synchronized", "void", "enqueue", "(", "final", "byte", "[", "]", "array", ")", "throws", "IOException", "{", "assert", "array", "!=", "null", ";", "byteDiskQueue", ".", "enqueueInt", "(", "array", ".", "length", ")", ";", "byteDiskQueue", ".", ...
Enqueues a byte array to this queue. @param array the array to be enqueued.
[ "Enqueues", "a", "byte", "array", "to", "this", "queue", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java#L91-L96
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/filters/Filters.java
Filters.and
@SafeVarargs public static<T> Filter<T> and(final Filter<T>... f) { return new Filter<T>() { @Override public boolean apply(final T x) { for (final Filter<T> filter: f) if (! filter.apply(x)) return false; return true; } @Override public String toString() { return "(" + StringUtils.join(f...
java
@SafeVarargs public static<T> Filter<T> and(final Filter<T>... f) { return new Filter<T>() { @Override public boolean apply(final T x) { for (final Filter<T> filter: f) if (! filter.apply(x)) return false; return true; } @Override public String toString() { return "(" + StringUtils.join(f...
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "Filter", "<", "T", ">", "and", "(", "final", "Filter", "<", "T", ">", "...", "f", ")", "{", "return", "new", "Filter", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "boolean", "ap...
Produces the conjunction of the given filters. @param <T> the type of objects that the filters deal with. @param f the filters. @return the conjunction.
[ "Produces", "the", "conjunction", "of", "the", "given", "filters", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/filters/Filters.java#L60-L79
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/filters/Filters.java
Filters.not
public static<T> Filter<T> not(final Filter<T> filter) { return new AbstractFilter<T>() { @Override public boolean apply(final T x) { return ! filter.apply(x); } @Override public String toString() { return "(not " + filter + ")"; } @Override public Filter<T> copy() { return not(f...
java
public static<T> Filter<T> not(final Filter<T> filter) { return new AbstractFilter<T>() { @Override public boolean apply(final T x) { return ! filter.apply(x); } @Override public String toString() { return "(not " + filter + ")"; } @Override public Filter<T> copy() { return not(f...
[ "public", "static", "<", "T", ">", "Filter", "<", "T", ">", "not", "(", "final", "Filter", "<", "T", ">", "filter", ")", "{", "return", "new", "AbstractFilter", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "boolean", "apply", "(", "fina...
Produces the negation of the given filter. @param <T> the type of objects that the filter deal with. @param filter the filter. @return the negation of the given filter.
[ "Produces", "the", "negation", "of", "the", "given", "filter", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/filters/Filters.java#L115-L132
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/filters/Filters.java
Filters.getFilterFromSpec
@SuppressWarnings("unchecked") public static<T> Filter<T> getFilterFromSpec(String className, String spec, Class<T> tClass) throws ParseException { String filterClassName; if (className.indexOf('.') >= 0) filterClassName = className; else filterClassName = Filter.FILTER_PACKAGE_NAME + "." + className; try { ...
java
@SuppressWarnings("unchecked") public static<T> Filter<T> getFilterFromSpec(String className, String spec, Class<T> tClass) throws ParseException { String filterClassName; if (className.indexOf('.') >= 0) filterClassName = className; else filterClassName = Filter.FILTER_PACKAGE_NAME + "." + className; try { ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Filter", "<", "T", ">", "getFilterFromSpec", "(", "String", "className", ",", "String", "spec", ",", "Class", "<", "T", ">", "tClass", ")", "throws", "ParseException", ...
Creates a filter from a filter class name and an external form. @param className the name of a filter class; it may either be a single class name (in which case it will be qualified with {@link Filter#FILTER_PACKAGE_NAME}) or a fully qualified classname. @param spec the specification from which the filter will be crea...
[ "Creates", "a", "filter", "from", "a", "filter", "class", "name", "and", "an", "external", "form", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/filters/Filters.java#L184-L226
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/Util.java
Util.createHierarchicalTempFile
public static File createHierarchicalTempFile(final File baseDirectory, final int pathElements, final String prefix, final String suffix) throws IOException { if (! baseDirectory.isDirectory()) throw new IllegalArgumentException(baseDirectory + " is not a directory."); if (pathElements < 0 || pathElements > 8) thro...
java
public static File createHierarchicalTempFile(final File baseDirectory, final int pathElements, final String prefix, final String suffix) throws IOException { if (! baseDirectory.isDirectory()) throw new IllegalArgumentException(baseDirectory + " is not a directory."); if (pathElements < 0 || pathElements > 8) thro...
[ "public", "static", "File", "createHierarchicalTempFile", "(", "final", "File", "baseDirectory", ",", "final", "int", "pathElements", ",", "final", "String", "prefix", ",", "final", "String", "suffix", ")", "throws", "IOException", "{", "if", "(", "!", "baseDire...
Creates a temporary file with a random hierachical path. <p> A random hierarchical path of <var>n</var> path elements is a sequence of <var>n</var> directories of two hexadecimal digits each, followed by a filename created by {@link File#createTempFile(String, String, File)}. <p> This method creates an empty file hav...
[ "Creates", "a", "temporary", "file", "with", "a", "random", "hierachical", "path", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/Util.java#L72-L96
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/Util.java
Util.writeByteArray
public final static void writeByteArray(final byte[] a, final ObjectOutputStream s) throws IOException { writeVByte(a.length, s); s.write(a); }
java
public final static void writeByteArray(final byte[] a, final ObjectOutputStream s) throws IOException { writeVByte(a.length, s); s.write(a); }
[ "public", "final", "static", "void", "writeByteArray", "(", "final", "byte", "[", "]", "a", ",", "final", "ObjectOutputStream", "s", ")", "throws", "IOException", "{", "writeVByte", "(", "a", ".", "length", ",", "s", ")", ";", "s", ".", "write", "(", "...
Writes a byte array prefixed by its length encoded using vByte. @param a the array to be written. @param s the stream where the array should be written.
[ "Writes", "a", "byte", "array", "prefixed", "by", "its", "length", "encoded", "using", "vByte", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/Util.java#L167-L170
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/Util.java
Util.readByteArray
public final static byte[] readByteArray(final ObjectInputStream s) throws IOException { final byte[] a = new byte[readVByte(s)]; s.readFully(a); return a; }
java
public final static byte[] readByteArray(final ObjectInputStream s) throws IOException { final byte[] a = new byte[readVByte(s)]; s.readFully(a); return a; }
[ "public", "final", "static", "byte", "[", "]", "readByteArray", "(", "final", "ObjectInputStream", "s", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "a", "=", "new", "byte", "[", "readVByte", "(", "s", ")", "]", ";", "s", ".", "readFul...
Reads a byte array prefixed by its length encoded using vByte. @param s the stream from which the array should be read. @return the array.
[ "Reads", "a", "byte", "array", "prefixed", "by", "its", "length", "encoded", "using", "vByte", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/Util.java#L177-L181
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/Util.java
Util.toByteArray
public static byte[] toByteArray(final String s) { final byte[] byteArray = new byte[s.length()]; // This needs to be fast. for(int i = s.length(); i-- != 0;) { assert s.charAt(i) < (char)0x80 : s.charAt(i); byteArray[i] = (byte)s.charAt(i); } return byteArray; }
java
public static byte[] toByteArray(final String s) { final byte[] byteArray = new byte[s.length()]; // This needs to be fast. for(int i = s.length(); i-- != 0;) { assert s.charAt(i) < (char)0x80 : s.charAt(i); byteArray[i] = (byte)s.charAt(i); } return byteArray; }
[ "public", "static", "byte", "[", "]", "toByteArray", "(", "final", "String", "s", ")", "{", "final", "byte", "[", "]", "byteArray", "=", "new", "byte", "[", "s", ".", "length", "(", ")", "]", ";", "// This needs to be fast.", "for", "(", "int", "i", ...
Returns a byte-array representation of an ASCII string. <p>This method is significantly faster than those relying on character encoders, and it allocates just one object&mdash;the resulting byte array. @param s an ASCII string. @return a byte-array representation of {@code s}. @throws AssertionError if assertions are...
[ "Returns", "a", "byte", "-", "array", "representation", "of", "an", "ASCII", "string", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/Util.java#L192-L200
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/Util.java
Util.toOutputStream
public static OutputStream toOutputStream(final String s, final OutputStream os) throws IOException { // This needs to be fast. final int length = s.length(); for(int i = 0; i < length; i++) { assert s.charAt(i) < (char)0x100 : s.charAt(i); os.write(s.charAt(i)); } return os; }
java
public static OutputStream toOutputStream(final String s, final OutputStream os) throws IOException { // This needs to be fast. final int length = s.length(); for(int i = 0; i < length; i++) { assert s.charAt(i) < (char)0x100 : s.charAt(i); os.write(s.charAt(i)); } return os; }
[ "public", "static", "OutputStream", "toOutputStream", "(", "final", "String", "s", ",", "final", "OutputStream", "os", ")", "throws", "IOException", "{", "// This needs to be fast.", "final", "int", "length", "=", "s", ".", "length", "(", ")", ";", "for", "(",...
Writes a string to an output stream, discarding higher order bits. <p>This method is significantly faster than those relying on character encoders, and it does not allocate any object. @param s a string. @param os an output stream. @return {@code os}. @throws AssertionError if assertions are enabled and some characte...
[ "Writes", "a", "string", "to", "an", "output", "stream", "discarding", "higher", "order", "bits", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/Util.java#L211-L220
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchEntrySet.java
WorkbenchEntrySet.add
public boolean add(final WorkbenchEntry e) { // The starting point. int pos = hashCode(e.ipAddress) & mask; // There's always an unused entry. while (workbenchEntry[pos] != null) { if (Arrays.equals(workbenchEntry[pos].ipAddress, e.ipAddress)) return false; pos = (pos + 1) & mask; } workbenchEntry[pos...
java
public boolean add(final WorkbenchEntry e) { // The starting point. int pos = hashCode(e.ipAddress) & mask; // There's always an unused entry. while (workbenchEntry[pos] != null) { if (Arrays.equals(workbenchEntry[pos].ipAddress, e.ipAddress)) return false; pos = (pos + 1) & mask; } workbenchEntry[pos...
[ "public", "boolean", "add", "(", "final", "WorkbenchEntry", "e", ")", "{", "// The starting point.", "int", "pos", "=", "hashCode", "(", "e", ".", "ipAddress", ")", "&", "mask", ";", "// There's always an unused entry.", "while", "(", "workbenchEntry", "[", "pos...
Adds a workbench entry to the set, if necessary. @param e the entry to be added. @return true if the state set changed as a result of this operation.
[ "Adds", "a", "workbench", "entry", "to", "the", "set", "if", "necessary", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchEntrySet.java#L77-L88
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchEntrySet.java
WorkbenchEntrySet.remove
public boolean remove(final WorkbenchEntry e) { // The starting point. int pos = hashCode(e.ipAddress) & mask; // There's always an unused entry. while (workbenchEntry[pos] != null) { if (workbenchEntry[pos] == e) { size--; shiftKeys(pos); // TODO: implement resize return true; } pos = ...
java
public boolean remove(final WorkbenchEntry e) { // The starting point. int pos = hashCode(e.ipAddress) & mask; // There's always an unused entry. while (workbenchEntry[pos] != null) { if (workbenchEntry[pos] == e) { size--; shiftKeys(pos); // TODO: implement resize return true; } pos = ...
[ "public", "boolean", "remove", "(", "final", "WorkbenchEntry", "e", ")", "{", "// The starting point.", "int", "pos", "=", "hashCode", "(", "e", ".", "ipAddress", ")", "&", "mask", ";", "// There's always an unused entry.", "while", "(", "workbenchEntry", "[", "...
Removes a given workbench entry. @param e the workbench entry to be removed. @return true if the state set changed as a result of this operation.
[ "Removes", "a", "given", "workbench", "entry", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchEntrySet.java#L117-L131
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchEntrySet.java
WorkbenchEntrySet.get
public WorkbenchEntry get(final byte[] address) { // The starting point. int pos = hashCode(address) & mask; // There's always an unused entry. while (workbenchEntry[pos] != null) { if (Arrays.equals(workbenchEntry[pos].ipAddress, address)) return workbenchEntry[pos]; pos = (pos + 1) & mask; } return ...
java
public WorkbenchEntry get(final byte[] address) { // The starting point. int pos = hashCode(address) & mask; // There's always an unused entry. while (workbenchEntry[pos] != null) { if (Arrays.equals(workbenchEntry[pos].ipAddress, address)) return workbenchEntry[pos]; pos = (pos + 1) & mask; } return ...
[ "public", "WorkbenchEntry", "get", "(", "final", "byte", "[", "]", "address", ")", "{", "// The starting point.", "int", "pos", "=", "hashCode", "(", "address", ")", "&", "mask", ";", "// There's always an unused entry.", "while", "(", "workbenchEntry", "[", "po...
Returns the entry for a given IP address. @param address the IP address. @return the workbench entry corresponding to a given address, or {@code null}.
[ "Returns", "the", "entry", "for", "a", "given", "IP", "address", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchEntrySet.java#L138-L147
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchEntrySet.java
WorkbenchEntrySet.rehash
protected void rehash(final int newN) { int i = 0, pos; final WorkbenchEntry[] workbenchEntry = this.workbenchEntry; final int newMask = newN - 1; final WorkbenchEntry[] newWorkbenchEntry = new WorkbenchEntry[newN]; for (int j = size; j-- != 0;) { while (workbenchEntry[i] == null) i++; WorkbenchEntry e...
java
protected void rehash(final int newN) { int i = 0, pos; final WorkbenchEntry[] workbenchEntry = this.workbenchEntry; final int newMask = newN - 1; final WorkbenchEntry[] newWorkbenchEntry = new WorkbenchEntry[newN]; for (int j = size; j-- != 0;) { while (workbenchEntry[i] == null) i++; WorkbenchEntry e...
[ "protected", "void", "rehash", "(", "final", "int", "newN", ")", "{", "int", "i", "=", "0", ",", "pos", ";", "final", "WorkbenchEntry", "[", "]", "workbenchEntry", "=", "this", ".", "workbenchEntry", ";", "final", "int", "newMask", "=", "newN", "-", "1...
Rehashes the set to a new size. @param newN the new size.
[ "Rehashes", "the", "set", "to", "a", "new", "size", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchEntrySet.java#L179-L197
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java
WorkbenchVirtualizer.dequeuePathQueries
public int dequeuePathQueries(final VisitState visitState, final int maxUrls) throws IOException { if (maxUrls == 0) return 0; final int dequeued = (int)Math.min(maxUrls, byteArrayDiskQueues.count(visitState)); for(int i = dequeued; i-- != 0;) visitState.enqueuePathQuery(byteArrayDiskQueues.dequeue(visitState)); ...
java
public int dequeuePathQueries(final VisitState visitState, final int maxUrls) throws IOException { if (maxUrls == 0) return 0; final int dequeued = (int)Math.min(maxUrls, byteArrayDiskQueues.count(visitState)); for(int i = dequeued; i-- != 0;) visitState.enqueuePathQuery(byteArrayDiskQueues.dequeue(visitState)); ...
[ "public", "int", "dequeuePathQueries", "(", "final", "VisitState", "visitState", ",", "final", "int", "maxUrls", ")", "throws", "IOException", "{", "if", "(", "maxUrls", "==", "0", ")", "return", "0", ";", "final", "int", "dequeued", "=", "(", "int", ")", ...
Dequeues at most the given number of path+queries into the given visit state. <p>Note that the path+queries are directly enqueued into the visit state using {@link VisitState#enqueuePathQuery(byte[])}. @param visitState the visitState in which path+queries will be moved. @param maxUrls the maximum number of path+quer...
[ "Dequeues", "at", "most", "the", "given", "number", "of", "path", "+", "queries", "into", "the", "given", "visit", "state", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java#L87-L92
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java
WorkbenchVirtualizer.enqueueURL
public void enqueueURL(VisitState visitState, final ByteArrayList url) throws IOException { final byte[] urlBuffer = url.elements(); final int pathQueryStart = BURL.startOfpathAndQuery(urlBuffer); byteArrayDiskQueues.enqueue(visitState, urlBuffer, pathQueryStart, url.size() - pathQueryStart); }
java
public void enqueueURL(VisitState visitState, final ByteArrayList url) throws IOException { final byte[] urlBuffer = url.elements(); final int pathQueryStart = BURL.startOfpathAndQuery(urlBuffer); byteArrayDiskQueues.enqueue(visitState, urlBuffer, pathQueryStart, url.size() - pathQueryStart); }
[ "public", "void", "enqueueURL", "(", "VisitState", "visitState", ",", "final", "ByteArrayList", "url", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "urlBuffer", "=", "url", ".", "elements", "(", ")", ";", "final", "int", "pathQueryStart", "=...
Enqueues the given URL as a path+query associated to the scheme+authority of the given visit state. @param visitState the visitState to which the URL must be added. @param url a {@link BURL BUbiNG URL}. @throws IOException
[ "Enqueues", "the", "given", "URL", "as", "a", "path", "+", "query", "associated", "to", "the", "scheme", "+", "authority", "of", "the", "given", "visit", "state", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java#L126-L130
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java
WorkbenchVirtualizer.collectIf
public void collectIf(final double threshold, final double targetRatio) throws IOException { if (byteArrayDiskQueues.ratio() < threshold) { LOGGER.info("Starting collection..."); byteArrayDiskQueues.collect(targetRatio); LOGGER.info("Completed collection."); } }
java
public void collectIf(final double threshold, final double targetRatio) throws IOException { if (byteArrayDiskQueues.ratio() < threshold) { LOGGER.info("Starting collection..."); byteArrayDiskQueues.collect(targetRatio); LOGGER.info("Completed collection."); } }
[ "public", "void", "collectIf", "(", "final", "double", "threshold", ",", "final", "double", "targetRatio", ")", "throws", "IOException", "{", "if", "(", "byteArrayDiskQueues", ".", "ratio", "(", ")", "<", "threshold", ")", "{", "LOGGER", ".", "info", "(", ...
Performs a garbage collection if the space used is below a given threshold, reaching a given target ratio. @param threshold if {@link ByteArrayDiskQueues#ratio()} is below this value, a garbage collection will be performed. @param targetRatio passed to {@link ByteArrayDiskQueues#count(Object)}.
[ "Performs", "a", "garbage", "collection", "if", "the", "space", "used", "is", "below", "a", "given", "threshold", "reaching", "a", "given", "target", "ratio", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/WorkbenchVirtualizer.java#L137-L143
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ConcurrentSummaryStats.java
ConcurrentSummaryStats.add
public synchronized void add(double x) { final double oldA = a; a += (x - a) / ++size; q += (x - a) * (x - oldA); min = Math.min(min, x); max = Math.max(max, x); }
java
public synchronized void add(double x) { final double oldA = a; a += (x - a) / ++size; q += (x - a) * (x - oldA); min = Math.min(min, x); max = Math.max(max, x); }
[ "public", "synchronized", "void", "add", "(", "double", "x", ")", "{", "final", "double", "oldA", "=", "a", ";", "a", "+=", "(", "x", "-", "a", ")", "/", "++", "size", ";", "q", "+=", "(", "x", "-", "a", ")", "*", "(", "x", "-", "oldA", ")"...
Adds a value to the stream. @param x the new value.
[ "Adds", "a", "value", "to", "the", "stream", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ConcurrentSummaryStats.java#L41-L47
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/Workbench.java
Workbench.add
public void add(WorkbenchEntry entry) { assert ! entry.isEmpty() : entry; assert ! entry.acquired : entry; entries.add(entry); approximatedSize.incrementAndGet(); }
java
public void add(WorkbenchEntry entry) { assert ! entry.isEmpty() : entry; assert ! entry.acquired : entry; entries.add(entry); approximatedSize.incrementAndGet(); }
[ "public", "void", "add", "(", "WorkbenchEntry", "entry", ")", "{", "assert", "!", "entry", ".", "isEmpty", "(", ")", ":", "entry", ";", "assert", "!", "entry", ".", "acquired", ":", "entry", ";", "entries", ".", "add", "(", "entry", ")", ";", "approx...
Adds a nonempty, not acquired workbench entry to the workbench. @param entry a nonempty, not acquired workbench entry.
[ "Adds", "a", "nonempty", "not", "acquired", "workbench", "entry", "to", "the", "workbench", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/Workbench.java#L140-L145
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/Workbench.java
Workbench.acquire
public VisitState acquire() throws InterruptedException { final WorkbenchEntry entry = entries.take(); assert ! entry.isEmpty(); // No race condition is possible here, because entry is nonempty. assert ! entry.acquired; entry.acquired = true; final VisitState visitState = entry.remove(); assert visitStat...
java
public VisitState acquire() throws InterruptedException { final WorkbenchEntry entry = entries.take(); assert ! entry.isEmpty(); // No race condition is possible here, because entry is nonempty. assert ! entry.acquired; entry.acquired = true; final VisitState visitState = entry.remove(); assert visitStat...
[ "public", "VisitState", "acquire", "(", ")", "throws", "InterruptedException", "{", "final", "WorkbenchEntry", "entry", "=", "entries", ".", "take", "(", ")", ";", "assert", "!", "entry", ".", "isEmpty", "(", ")", ";", "// No race condition is possible here, becau...
Acquires a visit state for a scheme+authority accessible by politeness. Note that this is a blocking method that will wait until such a state is available. <p>You <strong>must</strong> call {@link #release(VisitState)} when you have finished. @return a visit state with nonempty URL queue for a scheme+authority access...
[ "Acquires", "a", "visit", "state", "for", "a", "scheme", "+", "authority", "accessible", "by", "politeness", ".", "Note", "that", "this", "is", "a", "blocking", "method", "that", "will", "wait", "until", "such", "a", "state", "is", "available", "." ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/Workbench.java#L155-L171
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/filters/IsHttpResponse.java
IsHttpResponse.apply
@Override public boolean apply(final WarcRecord x) { Header messageType = x.getWarcHeader(WarcHeader.Name.CONTENT_TYPE); return (x.getWarcType() == WarcRecord.Type.RESPONSE) && (messageType != null && messageType.getValue().equals(HttpResponseWarcRecord.HTTP_RESPONSE_MSGTYPE)); }
java
@Override public boolean apply(final WarcRecord x) { Header messageType = x.getWarcHeader(WarcHeader.Name.CONTENT_TYPE); return (x.getWarcType() == WarcRecord.Type.RESPONSE) && (messageType != null && messageType.getValue().equals(HttpResponseWarcRecord.HTTP_RESPONSE_MSGTYPE)); }
[ "@", "Override", "public", "boolean", "apply", "(", "final", "WarcRecord", "x", ")", "{", "Header", "messageType", "=", "x", ".", "getWarcHeader", "(", "WarcHeader", ".", "Name", ".", "CONTENT_TYPE", ")", ";", "return", "(", "x", ".", "getWarcType", "(", ...
Apply the filter to a WarcRecord @param x the <code>WarcRecord</code> to be filtered @return <code>true</code> if <code>x</code> is an http/https response.
[ "Apply", "the", "filter", "to", "a", "WarcRecord" ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/filters/IsHttpResponse.java#L40-L45
train
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/filters/DigestEquals.java
DigestEquals.apply
@Override public boolean apply(final WarcRecord x) { Header s = x.getWarcHeader(WarcHeader.Name.WARC_PAYLOAD_DIGEST); return s != null && Arrays.equals(digest, Util.fromHexString(s.getValue())); }
java
@Override public boolean apply(final WarcRecord x) { Header s = x.getWarcHeader(WarcHeader.Name.WARC_PAYLOAD_DIGEST); return s != null && Arrays.equals(digest, Util.fromHexString(s.getValue())); }
[ "@", "Override", "public", "boolean", "apply", "(", "final", "WarcRecord", "x", ")", "{", "Header", "s", "=", "x", ".", "getWarcHeader", "(", "WarcHeader", ".", "Name", ".", "WARC_PAYLOAD_DIGEST", ")", ";", "return", "s", "!=", "null", "&&", "Arrays", "....
Apply the filter to a given WarcRecord @param x the WarcRecord to be filtered @return <code>true</code> if the <code>WarcHeader.Name.WARC_PAYLOAD_DIGEST</code> of the <code>WarcHeader</code> of <code>x</code> is not null and equal to the inner digest (hexadecimal comparison)
[ "Apply", "the", "filter", "to", "a", "given", "WarcRecord" ]
e148acc90031a4f3967422705a9fb07ddaf155e4
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/filters/DigestEquals.java#L52-L56
train
wg/lettuce
src/main/java/com/lambdaworks/redis/protocol/Command.java
Command.cancel
@Override public boolean cancel(boolean ignored) { boolean cancelled = false; if (latch.getCount() == 1) { latch.countDown(); output = null; cancelled = true; } return cancelled; }
java
@Override public boolean cancel(boolean ignored) { boolean cancelled = false; if (latch.getCount() == 1) { latch.countDown(); output = null; cancelled = true; } return cancelled; }
[ "@", "Override", "public", "boolean", "cancel", "(", "boolean", "ignored", ")", "{", "boolean", "cancelled", "=", "false", ";", "if", "(", "latch", ".", "getCount", "(", ")", "==", "1", ")", "{", "latch", ".", "countDown", "(", ")", ";", "output", "=...
Cancel the command and notify any waiting consumers. This does not cause the redis server to stop executing the command. @param ignored Ignored parameter. @return true if the command was cancelled.
[ "Cancel", "the", "command", "and", "notify", "any", "waiting", "consumers", ".", "This", "does", "not", "cause", "the", "redis", "server", "to", "stop", "executing", "the", "command", "." ]
5141640dc8289ff3af07b44a87020cef719c5f4a
https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/protocol/Command.java#L49-L58
train
wg/lettuce
src/main/java/com/lambdaworks/redis/protocol/Command.java
Command.get
@Override public T get() { try { latch.await(); return output.get(); } catch (InterruptedException e) { throw new RedisCommandInterruptedException(e); } }
java
@Override public T get() { try { latch.await(); return output.get(); } catch (InterruptedException e) { throw new RedisCommandInterruptedException(e); } }
[ "@", "Override", "public", "T", "get", "(", ")", "{", "try", "{", "latch", ".", "await", "(", ")", ";", "return", "output", ".", "get", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "RedisCommandInterruptedExc...
Get the command output and if the command hasn't completed yet, wait until it does. @return The command output.
[ "Get", "the", "command", "output", "and", "if", "the", "command", "hasn", "t", "completed", "yet", "wait", "until", "it", "does", "." ]
5141640dc8289ff3af07b44a87020cef719c5f4a
https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/protocol/Command.java#L86-L94
train
wg/lettuce
src/main/java/com/lambdaworks/redis/protocol/Command.java
Command.get
@Override public T get(long timeout, TimeUnit unit) throws TimeoutException { try { if (!latch.await(timeout, unit)) { throw new TimeoutException("Command timed out"); } } catch (InterruptedException e) { throw new RedisCommandInterruptedException(...
java
@Override public T get(long timeout, TimeUnit unit) throws TimeoutException { try { if (!latch.await(timeout, unit)) { throw new TimeoutException("Command timed out"); } } catch (InterruptedException e) { throw new RedisCommandInterruptedException(...
[ "@", "Override", "public", "T", "get", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "TimeoutException", "{", "try", "{", "if", "(", "!", "latch", ".", "await", "(", "timeout", ",", "unit", ")", ")", "{", "throw", "new", "TimeoutExcep...
Get the command output and if the command hasn't completed yet, wait up to the specified time until it does. @param timeout Maximum time to wait for a result. @param unit Unit of time for the timeout. @return The command output. @throws TimeoutException if the wait timed out.
[ "Get", "the", "command", "output", "and", "if", "the", "command", "hasn", "t", "completed", "yet", "wait", "up", "to", "the", "specified", "time", "until", "it", "does", "." ]
5141640dc8289ff3af07b44a87020cef719c5f4a
https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/protocol/Command.java#L107-L117
train
wg/lettuce
src/main/java/com/lambdaworks/redis/protocol/Command.java
Command.writeInt
protected static void writeInt(ChannelBuffer buf, int value) { if (value < 10) { buf.writeByte('0' + value); return; } StringBuilder sb = new StringBuilder(8); while (value > 0) { int digit = value % 10; sb.append((char) ('0' + digit)); ...
java
protected static void writeInt(ChannelBuffer buf, int value) { if (value < 10) { buf.writeByte('0' + value); return; } StringBuilder sb = new StringBuilder(8); while (value > 0) { int digit = value % 10; sb.append((char) ('0' + digit)); ...
[ "protected", "static", "void", "writeInt", "(", "ChannelBuffer", "buf", ",", "int", "value", ")", "{", "if", "(", "value", "<", "10", ")", "{", "buf", ".", "writeByte", "(", "'", "'", "+", "value", ")", ";", "return", ";", "}", "StringBuilder", "sb",...
Write the textual value of a positive integer to the supplied buffer. @param buf Buffer to write to. @param value Value to write.
[ "Write", "the", "textual", "value", "of", "a", "positive", "integer", "to", "the", "supplied", "buffer", "." ]
5141640dc8289ff3af07b44a87020cef719c5f4a
https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/protocol/Command.java#L178-L194
train
wg/lettuce
src/main/java/com/lambdaworks/codec/Base16.java
Base16.decode
public static byte[] decode(char[] src) { byte[] dst = new byte[src.length / 2]; for (int si = 0, di = 0; di < dst.length; di++) { byte high = decode[src[si++] & 0x7f]; byte low = decode[src[si++] & 0x7f]; dst[di] = (byte) ((high << 4) + low); } ret...
java
public static byte[] decode(char[] src) { byte[] dst = new byte[src.length / 2]; for (int si = 0, di = 0; di < dst.length; di++) { byte high = decode[src[si++] & 0x7f]; byte low = decode[src[si++] & 0x7f]; dst[di] = (byte) ((high << 4) + low); } ret...
[ "public", "static", "byte", "[", "]", "decode", "(", "char", "[", "]", "src", ")", "{", "byte", "[", "]", "dst", "=", "new", "byte", "[", "src", ".", "length", "/", "2", "]", ";", "for", "(", "int", "si", "=", "0", ",", "di", "=", "0", ";",...
Decode base16 chars to bytes. @param src Chars to decode. @return Decoded bytes.
[ "Decode", "base16", "chars", "to", "bytes", "." ]
5141640dc8289ff3af07b44a87020cef719c5f4a
https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/codec/Base16.java#L51-L61
train
andygibson/datafactory
src/main/java/org/fluttercode/datafactory/impl/DataFactory.java
DataFactory.getNumberBetween
public int getNumberBetween(final int min, final int max) { if (max < min) { throw new IllegalArgumentException(String.format("Minimum must be less than minimum (min=%d, max=%d)", min, max)); } if (max == min) { return min; } return min + random.nextInt(max - min); }
java
public int getNumberBetween(final int min, final int max) { if (max < min) { throw new IllegalArgumentException(String.format("Minimum must be less than minimum (min=%d, max=%d)", min, max)); } if (max == min) { return min; } return min + random.nextInt(max - min); }
[ "public", "int", "getNumberBetween", "(", "final", "int", "min", ",", "final", "int", "max", ")", "{", "if", "(", "max", "<", "min", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Minimum must be less than minimum (...
Returns a number betwen min and max @param min minimum value of result @param max maximum value of result @return Random number within range
[ "Returns", "a", "number", "betwen", "min", "and", "max" ]
f748beb93844dea2ad6174715be3b70df0448a9c
https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L322-L332
train
andygibson/datafactory
src/main/java/org/fluttercode/datafactory/impl/DataFactory.java
DataFactory.getDateBetween
public Date getDateBetween(final Date minDate, final Date maxDate) { // this can break if seconds is an int long seconds = (maxDate.getTime() - minDate.getTime()) / 1000; seconds = (long) (random.nextDouble() * seconds); Date result = new Date(); result.setTime(minDate.getTime() + (seconds * 10...
java
public Date getDateBetween(final Date minDate, final Date maxDate) { // this can break if seconds is an int long seconds = (maxDate.getTime() - minDate.getTime()) / 1000; seconds = (long) (random.nextDouble() * seconds); Date result = new Date(); result.setTime(minDate.getTime() + (seconds * 10...
[ "public", "Date", "getDateBetween", "(", "final", "Date", "minDate", ",", "final", "Date", "maxDate", ")", "{", "// this can break if seconds is an int\r", "long", "seconds", "=", "(", "maxDate", ".", "getTime", "(", ")", "-", "minDate", ".", "getTime", "(", "...
Returns a random date between two dates. This method will alter the time component of the dates @param minDate Minimum date that can be returned @param maxDate Maximum date that can be returned @return random date between these two dates.
[ "Returns", "a", "random", "date", "between", "two", "dates", ".", "This", "method", "will", "alter", "the", "time", "component", "of", "the", "dates" ]
f748beb93844dea2ad6174715be3b70df0448a9c
https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L374-L381
train
andygibson/datafactory
src/main/java/org/fluttercode/datafactory/impl/DataFactory.java
DataFactory.getRandomText
public String getRandomText(final int minLength, final int maxLength) { validateMinMaxParams(minLength, maxLength); StringBuilder sb = new StringBuilder(maxLength); int length = minLength; if (maxLength != minLength) { length = length + random.nextInt(maxLength - minLength); } whi...
java
public String getRandomText(final int minLength, final int maxLength) { validateMinMaxParams(minLength, maxLength); StringBuilder sb = new StringBuilder(maxLength); int length = minLength; if (maxLength != minLength) { length = length + random.nextInt(maxLength - minLength); } whi...
[ "public", "String", "getRandomText", "(", "final", "int", "minLength", ",", "final", "int", "maxLength", ")", "{", "validateMinMaxParams", "(", "minLength", ",", "maxLength", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "maxLength", ")", ...
Returns random text made up of english words @param minLength minimum length of returned string @param maxLength maximum length of returned string @return string of length between min and max length
[ "Returns", "random", "text", "made", "up", "of", "english", "words" ]
f748beb93844dea2ad6174715be3b70df0448a9c
https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L401-L422
train
andygibson/datafactory
src/main/java/org/fluttercode/datafactory/impl/DataFactory.java
DataFactory.getRandomWord
public String getRandomWord(final int minLength, final int maxLength) { validateMinMaxParams(minLength, maxLength); // special case if we need a single char if (maxLength == 1) { if (chance(50)) { return "a"; } return "I"; } // start from random pos and find ...
java
public String getRandomWord(final int minLength, final int maxLength) { validateMinMaxParams(minLength, maxLength); // special case if we need a single char if (maxLength == 1) { if (chance(50)) { return "a"; } return "I"; } // start from random pos and find ...
[ "public", "String", "getRandomWord", "(", "final", "int", "minLength", ",", "final", "int", "maxLength", ")", "{", "validateMinMaxParams", "(", "minLength", ",", "maxLength", ")", ";", "// special case if we need a single char\r", "if", "(", "maxLength", "==", "1", ...
Returns a valid word based on the length range passed in. The length will always be between the min and max length range inclusive. @param minLength minimum length of the word @param maxLength maximum length of the word @return a word of a length between min and max length
[ "Returns", "a", "valid", "word", "based", "on", "the", "length", "range", "passed", "in", ".", "The", "length", "will", "always", "be", "between", "the", "min", "and", "max", "length", "range", "inclusive", "." ]
f748beb93844dea2ad6174715be3b70df0448a9c
https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L521-L545
train
andygibson/datafactory
src/main/java/org/fluttercode/datafactory/impl/DataFactory.java
DataFactory.getNumberText
public String getNumberText(final int digits) { String result = ""; for (int i = 0; i < digits; i++) { result = result + random.nextInt(10); } return result; }
java
public String getNumberText(final int digits) { String result = ""; for (int i = 0; i < digits; i++) { result = result + random.nextInt(10); } return result; }
[ "public", "String", "getNumberText", "(", "final", "int", "digits", ")", "{", "String", "result", "=", "\"\"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "digits", ";", "i", "++", ")", "{", "result", "=", "result", "+", "random", ".", ...
Returns a string containing a set of numbers with a fixed number of digits @param digits number of digits in the final number @return Random number as a string with a fixed length
[ "Returns", "a", "string", "containing", "a", "set", "of", "numbers", "with", "a", "fixed", "number", "of", "digits" ]
f748beb93844dea2ad6174715be3b70df0448a9c
https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L572-L578
train
andygibson/datafactory
src/main/java/org/fluttercode/datafactory/impl/DataFactory.java
DataFactory.getEmailAddress
public String getEmailAddress() { int test = random.nextInt(100); String email = ""; if (test < 50) { // name and initial email = getFirstName().charAt(0) + getLastName(); } else { // 2 words email = getItem(contentDataValues.getWords()) + getItem(contentDataValues.getWor...
java
public String getEmailAddress() { int test = random.nextInt(100); String email = ""; if (test < 50) { // name and initial email = getFirstName().charAt(0) + getLastName(); } else { // 2 words email = getItem(contentDataValues.getWords()) + getItem(contentDataValues.getWor...
[ "public", "String", "getEmailAddress", "(", ")", "{", "int", "test", "=", "random", ".", "nextInt", "(", "100", ")", ";", "String", "email", "=", "\"\"", ";", "if", "(", "test", "<", "50", ")", "{", "// name and initial\r", "email", "=", "getFirstName", ...
Generates an email address @return an email address
[ "Generates", "an", "email", "address" ]
f748beb93844dea2ad6174715be3b70df0448a9c
https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L594-L609
train
SQLDroid/SQLDroid
src/main/java/org/sqldroid/SQLDroidPreparedStatement.java
SQLDroidPreparedStatement.setBinaryStream
@Override public void setBinaryStream(int parameterIndex, InputStream inputStream, int length) throws SQLException { if (length <= 0) { throw new SQLException ("Invalid length " + length); } if (inputStream == null ) { throw new SQLException ("Input Stream cannot be null"); } final in...
java
@Override public void setBinaryStream(int parameterIndex, InputStream inputStream, int length) throws SQLException { if (length <= 0) { throw new SQLException ("Invalid length " + length); } if (inputStream == null ) { throw new SQLException ("Input Stream cannot be null"); } final in...
[ "@", "Override", "public", "void", "setBinaryStream", "(", "int", "parameterIndex", ",", "InputStream", "inputStream", ",", "int", "length", ")", "throws", "SQLException", "{", "if", "(", "length", "<=", "0", ")", "{", "throw", "new", "SQLException", "(", "\...
Set the parameter from the contents of a binary stream. @param parameterIndex the index of the parameter to set @param inputStream the input stream from which a byte array will be read and set as the value. If inputStream is null this method will throw a SQLException @param length a positive non-zero length values @ex...
[ "Set", "the", "parameter", "from", "the", "contents", "of", "a", "binary", "stream", "." ]
4fb38ee40338673cb0205044571e4379573762c4
https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLDroidPreparedStatement.java#L514-L544
train
SQLDroid/SQLDroid
src/main/java/org/sqldroid/SQLDroidPreparedStatement.java
SQLDroidPreparedStatement.setBinaryStream
@Override public void setBinaryStream(int parameterIndex, InputStream inputStream, long length) throws SQLException { if ( length > Integer.MAX_VALUE ) { throw new SQLException ("SQLDroid does not allow input stream data greater than " + Integer.MAX_VALUE ); } setBinaryStream(parameterIndex, inputSt...
java
@Override public void setBinaryStream(int parameterIndex, InputStream inputStream, long length) throws SQLException { if ( length > Integer.MAX_VALUE ) { throw new SQLException ("SQLDroid does not allow input stream data greater than " + Integer.MAX_VALUE ); } setBinaryStream(parameterIndex, inputSt...
[ "@", "Override", "public", "void", "setBinaryStream", "(", "int", "parameterIndex", ",", "InputStream", "inputStream", ",", "long", "length", ")", "throws", "SQLException", "{", "if", "(", "length", ">", "Integer", ".", "MAX_VALUE", ")", "{", "throw", "new", ...
This is a pass through to the integer version of the same method. That is, the long is downcast to an integer. If the length is greater than Integer.MAX_VALUE this method will throw a SQLException. @see #setBinaryStream(int, InputStream, int) @exception SQLException thrown if length is greater than Integer.MAX_VALUE ...
[ "This", "is", "a", "pass", "through", "to", "the", "integer", "version", "of", "the", "same", "method", ".", "That", "is", "the", "long", "is", "downcast", "to", "an", "integer", ".", "If", "the", "length", "is", "greater", "than", "Integer", ".", "MAX...
4fb38ee40338673cb0205044571e4379573762c4
https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLDroidPreparedStatement.java#L747-L753
train
SQLDroid/SQLDroid
src/main/java/org/sqldroid/SQLDroidDatabaseMetaData.java
SQLDroidDatabaseMetaData.escape
private String escape(final String val) { // TODO: this function is ugly, pass this work off to SQLite, then we // don't have to worry about Unicode 4, other characters needing // escaping, etc. int len = val.length(); StringBuilder buf = new StringBuilder(len); for (int i = 0; i < len; i++) { ...
java
private String escape(final String val) { // TODO: this function is ugly, pass this work off to SQLite, then we // don't have to worry about Unicode 4, other characters needing // escaping, etc. int len = val.length(); StringBuilder buf = new StringBuilder(len); for (int i = 0; i < len; i++) { ...
[ "private", "String", "escape", "(", "final", "String", "val", ")", "{", "// TODO: this function is ugly, pass this work off to SQLite, then we", "// don't have to worry about Unicode 4, other characters needing", "// escaping, etc.", "int", "len", "=", "val", ".", "leng...
Applies SQL escapes for special characters in a given string. @param val The string to escape. @return The SQL escaped string.
[ "Applies", "SQL", "escapes", "for", "special", "characters", "in", "a", "given", "string", "." ]
4fb38ee40338673cb0205044571e4379573762c4
https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLDroidDatabaseMetaData.java#L1555-L1568
train
SQLDroid/SQLDroid
src/main/java/org/sqldroid/SQLDroidClob.java
SQLDroidClob.free
public void free() throws SQLException { if (freed) { return; } string = null; if (reader != null) { reader.close(); } if (inputStream != null) { try { inputStream.close(); ...
java
public void free() throws SQLException { if (freed) { return; } string = null; if (reader != null) { reader.close(); } if (inputStream != null) { try { inputStream.close(); ...
[ "public", "void", "free", "(", ")", "throws", "SQLException", "{", "if", "(", "freed", ")", "{", "return", ";", "}", "string", "=", "null", ";", "if", "(", "reader", "!=", "null", ")", "{", "reader", ".", "close", "(", ")", ";", "}", "if", "(", ...
Free the Blob object and releases the resources that it holds. The object is invalid once the free method is called. @throws SQLException if an error occurs
[ "Free", "the", "Blob", "object", "and", "releases", "the", "resources", "that", "it", "holds", ".", "The", "object", "is", "invalid", "once", "the", "free", "method", "is", "called", "." ]
4fb38ee40338673cb0205044571e4379573762c4
https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLDroidClob.java#L136-L160
train
SQLDroid/SQLDroid
src/main/java/org/sqldroid/SQLiteDatabase.java
SQLiteDatabase.isLockedException
protected boolean isLockedException ( SQLiteException maybeLocked ) { try { if (Class.forName("android.database.sqlite.SQLiteDatabaseLockedException", false, getClass().getClassLoader()).isAssignableFrom(maybeLocked.getClass()) ) { return true; } } catch (ClassNotFoundException e) { //...
java
protected boolean isLockedException ( SQLiteException maybeLocked ) { try { if (Class.forName("android.database.sqlite.SQLiteDatabaseLockedException", false, getClass().getClassLoader()).isAssignableFrom(maybeLocked.getClass()) ) { return true; } } catch (ClassNotFoundException e) { //...
[ "protected", "boolean", "isLockedException", "(", "SQLiteException", "maybeLocked", ")", "{", "try", "{", "if", "(", "Class", ".", "forName", "(", "\"android.database.sqlite.SQLiteDatabaseLockedException\"", ",", "false", ",", "getClass", "(", ")", ".", "getClassLoade...
Returns true if the exception is an instance of "SQLiteDatabaseLockedException". Since this exception does not exist in APIs below 11 this code uses reflection to check the exception type.
[ "Returns", "true", "if", "the", "exception", "is", "an", "instance", "of", "SQLiteDatabaseLockedException", ".", "Since", "this", "exception", "does", "not", "exist", "in", "APIs", "below", "11", "this", "code", "uses", "reflection", "to", "check", "the", "exc...
4fb38ee40338673cb0205044571e4379573762c4
https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLiteDatabase.java#L97-L106
train
SQLDroid/SQLDroid
src/main/java/org/sqldroid/SQLiteDatabase.java
SQLiteDatabase.rawQuery
public Cursor rawQuery(String sql, String[] makeArgListQueryString) throws SQLException { Log.v("SQLiteDatabase rawQuery: " + Thread.currentThread().getId() + " \"" + Thread.currentThread().getName() + "\" " + sql); long timeNow = System.currentTimeMillis(); long delta = 0; do { try { Curs...
java
public Cursor rawQuery(String sql, String[] makeArgListQueryString) throws SQLException { Log.v("SQLiteDatabase rawQuery: " + Thread.currentThread().getId() + " \"" + Thread.currentThread().getName() + "\" " + sql); long timeNow = System.currentTimeMillis(); long delta = 0; do { try { Curs...
[ "public", "Cursor", "rawQuery", "(", "String", "sql", ",", "String", "[", "]", "makeArgListQueryString", ")", "throws", "SQLException", "{", "Log", ".", "v", "(", "\"SQLiteDatabase rawQuery: \"", "+", "Thread", ".", "currentThread", "(", ")", ".", "getId", "("...
Proxy for the "rawQuery" command. @throws SQLException
[ "Proxy", "for", "the", "rawQuery", "command", "." ]
4fb38ee40338673cb0205044571e4379573762c4
https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLiteDatabase.java#L111-L129
train
SQLDroid/SQLDroid
src/main/java/org/sqldroid/SQLiteDatabase.java
SQLiteDatabase.execNoArgVoidMethod
public void execNoArgVoidMethod (Transaction transaction ) throws SQLException { long timeNow = System.currentTimeMillis(); long delta = 0; do { try { switch ( transaction ) { case setTransactionSuccessful: sqliteDatabase.setTransactionSuccessful(); return; ...
java
public void execNoArgVoidMethod (Transaction transaction ) throws SQLException { long timeNow = System.currentTimeMillis(); long delta = 0; do { try { switch ( transaction ) { case setTransactionSuccessful: sqliteDatabase.setTransactionSuccessful(); return; ...
[ "public", "void", "execNoArgVoidMethod", "(", "Transaction", "transaction", ")", "throws", "SQLException", "{", "long", "timeNow", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "delta", "=", "0", ";", "do", "{", "try", "{", "switch", "(", ...
Executes one of the methods in the "transactions" enum. This just allows the timeout code to be combined in one method. @throws SQLException thrown if the timeout expires before the method successfully executes.
[ "Executes", "one", "of", "the", "methods", "in", "the", "transactions", "enum", ".", "This", "just", "allows", "the", "timeout", "code", "to", "be", "combined", "in", "one", "method", "." ]
4fb38ee40338673cb0205044571e4379573762c4
https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLiteDatabase.java#L195-L223
train
SQLDroid/SQLDroid
src/main/java/org/sqldroid/SQLiteDatabase.java
SQLiteDatabase.changedRowCount
public int changedRowCount () { if ( getChangedRowCount == null ) { try { // JNA/J2SE compatibility method. getChangedRowCount = sqliteDatabase.getClass().getMethod("changedRowCount", (Class<?>[])null); } catch ( Exception any ) { try { // Android getChangedRowCount ...
java
public int changedRowCount () { if ( getChangedRowCount == null ) { try { // JNA/J2SE compatibility method. getChangedRowCount = sqliteDatabase.getClass().getMethod("changedRowCount", (Class<?>[])null); } catch ( Exception any ) { try { // Android getChangedRowCount ...
[ "public", "int", "changedRowCount", "(", ")", "{", "if", "(", "getChangedRowCount", "==", "null", ")", "{", "try", "{", "// JNA/J2SE compatibility method.", "getChangedRowCount", "=", "sqliteDatabase", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"changedRo...
The count of changed rows. On JNA platforms, this is a call to sqlite3_changes On Android, it's a convoluted call to a package-private method (or, if that fails, the response is '1'.
[ "The", "count", "of", "changed", "rows", ".", "On", "JNA", "platforms", "this", "is", "a", "call", "to", "sqlite3_changes", "On", "Android", "it", "s", "a", "convoluted", "call", "to", "a", "package", "-", "private", "method", "(", "or", "if", "that", ...
4fb38ee40338673cb0205044571e4379573762c4
https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLiteDatabase.java#L254-L276
train
SQLDroid/SQLDroid
src/main/java/org/sqldroid/SQLDroidConnection.java
SQLDroidConnection.chainException
public static SQLException chainException(android.database.SQLException sqlException) { if ( sqlThrowable < 0 || sqlThrowable >= 9 ) { try { sqlThrowable = 9; //return new SQLException (sqlException); // creating by reflection is significantly slower, ...
java
public static SQLException chainException(android.database.SQLException sqlException) { if ( sqlThrowable < 0 || sqlThrowable >= 9 ) { try { sqlThrowable = 9; //return new SQLException (sqlException); // creating by reflection is significantly slower, ...
[ "public", "static", "SQLException", "chainException", "(", "android", ".", "database", ".", "SQLException", "sqlException", ")", "{", "if", "(", "sqlThrowable", "<", "0", "||", "sqlThrowable", ">=", "9", ")", "{", "try", "{", "sqlThrowable", "=", "9", ";", ...
This will create and return an exception. For API levels less than 9 this will return a SQLDroidSQLException, for later APIs it will return a SQLException.
[ "This", "will", "create", "and", "return", "an", "exception", ".", "For", "API", "levels", "less", "than", "9", "this", "will", "return", "a", "SQLDroidSQLException", "for", "later", "APIs", "it", "will", "return", "a", "SQLException", "." ]
4fb38ee40338673cb0205044571e4379573762c4
https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLDroidConnection.java#L182-L206
train
mattprecious/telescope
telescope/src/main/java/com/mattprecious/telescope/FileProvider.java
FileProvider.attachInfo
@Override public void attachInfo(Context context, ProviderInfo info) { super.attachInfo(context, info); // Sanity check our security if (info.exported) { throw new SecurityException("Provider must not be exported"); } if (!info.grantUriPermissions) { throw new SecurityException("Provide...
java
@Override public void attachInfo(Context context, ProviderInfo info) { super.attachInfo(context, info); // Sanity check our security if (info.exported) { throw new SecurityException("Provider must not be exported"); } if (!info.grantUriPermissions) { throw new SecurityException("Provide...
[ "@", "Override", "public", "void", "attachInfo", "(", "Context", "context", ",", "ProviderInfo", "info", ")", "{", "super", ".", "attachInfo", "(", "context", ",", "info", ")", ";", "// Sanity check our security", "if", "(", "info", ".", "exported", ")", "{"...
After the FileProvider is instantiated, this method is called to provide the system with information about the provider. @param context A {@link Context} for the current component. @param info A {@link ProviderInfo} for the new provider.
[ "After", "the", "FileProvider", "is", "instantiated", "this", "method", "is", "called", "to", "provide", "the", "system", "with", "information", "about", "the", "provider", "." ]
ce5e2710fb16ee214026fc25b091eb946fdbbb3c
https://github.com/mattprecious/telescope/blob/ce5e2710fb16ee214026fc25b091eb946fdbbb3c/telescope/src/main/java/com/mattprecious/telescope/FileProvider.java#L347-L359
train
mattprecious/telescope
telescope/src/main/java/com/mattprecious/telescope/TelescopeLayout.java
TelescopeLayout.cleanUp
public static void cleanUp(Context context) { File path = getScreenshotFolder(context); if (!path.exists()) { return; } delete(path); }
java
public static void cleanUp(Context context) { File path = getScreenshotFolder(context); if (!path.exists()) { return; } delete(path); }
[ "public", "static", "void", "cleanUp", "(", "Context", "context", ")", "{", "File", "path", "=", "getScreenshotFolder", "(", "context", ")", ";", "if", "(", "!", "path", ".", "exists", "(", ")", ")", "{", "return", ";", "}", "delete", "(", "path", ")...
Delete the screenshot folder for this app. Be careful not to call this before any intents have finished using a screenshot reference.
[ "Delete", "the", "screenshot", "folder", "for", "this", "app", ".", "Be", "careful", "not", "to", "call", "this", "before", "any", "intents", "have", "finished", "using", "a", "screenshot", "reference", "." ]
ce5e2710fb16ee214026fc25b091eb946fdbbb3c
https://github.com/mattprecious/telescope/blob/ce5e2710fb16ee214026fc25b091eb946fdbbb3c/telescope/src/main/java/com/mattprecious/telescope/TelescopeLayout.java#L224-L231
train
mattprecious/telescope
telescope/src/main/java/com/mattprecious/telescope/TelescopeLayout.java
TelescopeLayout.delete
private static void delete(File file) { if (file.isDirectory()) { File[] files = file.listFiles(); if (files != null) { for (File child : files) { delete(child); } } } file.delete(); }
java
private static void delete(File file) { if (file.isDirectory()) { File[] files = file.listFiles(); if (files != null) { for (File child : files) { delete(child); } } } file.delete(); }
[ "private", "static", "void", "delete", "(", "File", "file", ")", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "File", "[", "]", "files", "=", "file", ".", "listFiles", "(", ")", ";", "if", "(", "files", "!=", "null", ")", "{", ...
Recursive delete of a file or directory.
[ "Recursive", "delete", "of", "a", "file", "or", "directory", "." ]
ce5e2710fb16ee214026fc25b091eb946fdbbb3c
https://github.com/mattprecious/telescope/blob/ce5e2710fb16ee214026fc25b091eb946fdbbb3c/telescope/src/main/java/com/mattprecious/telescope/TelescopeLayout.java#L517-L528
train
palaima/DebugDrawer
debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java
UIUtils.getCompatDrawable
public static Drawable getCompatDrawable(Context c, int drawableRes) { Drawable d = null; try { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { d = c.getResources().getDrawable(drawableRes); } else { d = c.getResources().getDrawable(dra...
java
public static Drawable getCompatDrawable(Context c, int drawableRes) { Drawable d = null; try { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { d = c.getResources().getDrawable(drawableRes); } else { d = c.getResources().getDrawable(dra...
[ "public", "static", "Drawable", "getCompatDrawable", "(", "Context", "c", ",", "int", "drawableRes", ")", "{", "Drawable", "d", "=", "null", ";", "try", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", "<", "Build", ".", "VERSION_CODES", ".", "LO...
helper method to get the drawable by its resource. specific to the correct android version @param c @param drawableRes @return
[ "helper", "method", "to", "get", "the", "drawable", "by", "its", "resource", ".", "specific", "to", "the", "correct", "android", "version" ]
49b5992a1148757bd740c4a0b7df10ef70ade6d8
https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java#L64-L75
train
palaima/DebugDrawer
debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java
UIUtils.getThemeAttributeDimensionSize
public static int getThemeAttributeDimensionSize(Context context, int attr) { TypedArray a = null; try { a = context.getTheme().obtainStyledAttributes(new int[]{attr}); return a.getDimensionPixelSize(0, 0); } finally { if (a != null) { a.recycl...
java
public static int getThemeAttributeDimensionSize(Context context, int attr) { TypedArray a = null; try { a = context.getTheme().obtainStyledAttributes(new int[]{attr}); return a.getDimensionPixelSize(0, 0); } finally { if (a != null) { a.recycl...
[ "public", "static", "int", "getThemeAttributeDimensionSize", "(", "Context", "context", ",", "int", "attr", ")", "{", "TypedArray", "a", "=", "null", ";", "try", "{", "a", "=", "context", ".", "getTheme", "(", ")", ".", "obtainStyledAttributes", "(", "new", ...
Returns the size in pixels of an attribute dimension @param context the context to get the resources from @param attr is the attribute dimension we want to know the size from @return the size in pixels of an attribute dimension
[ "Returns", "the", "size", "in", "pixels", "of", "an", "attribute", "dimension" ]
49b5992a1148757bd740c4a0b7df10ef70ade6d8
https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java#L123-L133
train
palaima/DebugDrawer
debugdrawer-commons/src/main/java/io/palaima/debugdrawer/commons/NetworkModule.java
NetworkModule.isMobileNetworkEnabled
private boolean isMobileNetworkEnabled(ConnectivityManager connectivityManager) { final NetworkInfo info = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); return (info != null && info.isConnected()); }
java
private boolean isMobileNetworkEnabled(ConnectivityManager connectivityManager) { final NetworkInfo info = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); return (info != null && info.isConnected()); }
[ "private", "boolean", "isMobileNetworkEnabled", "(", "ConnectivityManager", "connectivityManager", ")", "{", "final", "NetworkInfo", "info", "=", "connectivityManager", ".", "getNetworkInfo", "(", "ConnectivityManager", ".", "TYPE_MOBILE", ")", ";", "return", "(", "info...
True if mobile network enabled
[ "True", "if", "mobile", "network", "enabled" ]
49b5992a1148757bd740c4a0b7df10ef70ade6d8
https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer-commons/src/main/java/io/palaima/debugdrawer/commons/NetworkModule.java#L120-L123
train
palaima/DebugDrawer
debugdrawer/src/main/java/io/palaima/debugdrawer/DebugDrawer.java
DebugDrawer.closeDrawer
public void closeDrawer() { if (drawerLayout != null) { if (drawerGravity != 0) { drawerLayout.closeDrawer(drawerGravity); } else { drawerLayout.closeDrawer(sliderLayout); } } }
java
public void closeDrawer() { if (drawerLayout != null) { if (drawerGravity != 0) { drawerLayout.closeDrawer(drawerGravity); } else { drawerLayout.closeDrawer(sliderLayout); } } }
[ "public", "void", "closeDrawer", "(", ")", "{", "if", "(", "drawerLayout", "!=", "null", ")", "{", "if", "(", "drawerGravity", "!=", "0", ")", "{", "drawerLayout", ".", "closeDrawer", "(", "drawerGravity", ")", ";", "}", "else", "{", "drawerLayout", ".",...
close the drawer
[ "close", "the", "drawer" ]
49b5992a1148757bd740c4a0b7df10ef70ade6d8
https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer/src/main/java/io/palaima/debugdrawer/DebugDrawer.java#L76-L84
train
palaima/DebugDrawer
debugdrawer-timber/src/main/java/io/palaima/debugdrawer/timber/data/LumberYard.java
LumberYard.save
public void save(OnSaveLogListener listener) { File dir = getLogDir(); if (dir == null) { listener.onError("Can't save logs. External storage is not mounted. " + "Check android.permission.WRITE_EXTERNAL_STORAGE permission"); return; } FileWriter ...
java
public void save(OnSaveLogListener listener) { File dir = getLogDir(); if (dir == null) { listener.onError("Can't save logs. External storage is not mounted. " + "Check android.permission.WRITE_EXTERNAL_STORAGE permission"); return; } FileWriter ...
[ "public", "void", "save", "(", "OnSaveLogListener", "listener", ")", "{", "File", "dir", "=", "getLogDir", "(", ")", ";", "if", "(", "dir", "==", "null", ")", "{", "listener", ".", "onError", "(", "\"Can't save logs. External storage is not mounted. \"", "+", ...
Save the current logs to disk.
[ "Save", "the", "current", "logs", "to", "disk", "." ]
49b5992a1148757bd740c4a0b7df10ef70ade6d8
https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer-timber/src/main/java/io/palaima/debugdrawer/timber/data/LumberYard.java#L98-L134
train
palaima/DebugDrawer
debugdrawer-commons/src/main/java/io/palaima/debugdrawer/commons/NetworkController.java
NetworkController.unregisterReceiver
void unregisterReceiver() { try { final Context context = contextRef.get(); if (context != null) { context.unregisterReceiver(receiver); } } catch (IllegalArgumentException e) { } }
java
void unregisterReceiver() { try { final Context context = contextRef.get(); if (context != null) { context.unregisterReceiver(receiver); } } catch (IllegalArgumentException e) { } }
[ "void", "unregisterReceiver", "(", ")", "{", "try", "{", "final", "Context", "context", "=", "contextRef", ".", "get", "(", ")", ";", "if", "(", "context", "!=", "null", ")", "{", "context", ".", "unregisterReceiver", "(", "receiver", ")", ";", "}", "}...
Unregister network state broadcast receiver
[ "Unregister", "network", "state", "broadcast", "receiver" ]
49b5992a1148757bd740c4a0b7df10ef70ade6d8
https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer-commons/src/main/java/io/palaima/debugdrawer/commons/NetworkController.java#L74-L82
train
palaima/DebugDrawer
debugdrawer-commons/src/main/java/io/palaima/debugdrawer/commons/NetworkController.java
NetworkController.registerReceiver
void registerReceiver() { if (receiver == null) { receiver = new NetworkReceiver(new Listener() { @Override public void post(NetworkChangeEvent event) { if (onNetworkChangedListener != null) { onNetworkChangedListener.onChan...
java
void registerReceiver() { if (receiver == null) { receiver = new NetworkReceiver(new Listener() { @Override public void post(NetworkChangeEvent event) { if (onNetworkChangedListener != null) { onNetworkChangedListener.onChan...
[ "void", "registerReceiver", "(", ")", "{", "if", "(", "receiver", "==", "null", ")", "{", "receiver", "=", "new", "NetworkReceiver", "(", "new", "Listener", "(", ")", "{", "@", "Override", "public", "void", "post", "(", "NetworkChangeEvent", "event", ")", ...
Register network state broadcast receiver
[ "Register", "network", "state", "broadcast", "receiver" ]
49b5992a1148757bd740c4a0b7df10ef70ade6d8
https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer-commons/src/main/java/io/palaima/debugdrawer/commons/NetworkController.java#L87-L105
train