_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q157800 | Recur.getNextDate | train | public final Date getNextDate(final Date seed, final Date startDate) {
final Calendar cal = getCalendarInstance(seed, true);
final Calendar rootSeed = (Calendar)cal.clone();
// optimize the start time for selecting candidates
// (only applicable where a COUNT is not specified)
... | java | {
"resource": ""
} |
q157801 | Recur.increment | train | private void increment(final Calendar cal) {
// initialise interval..
final int calInterval = (getInterval() >= 1) ? getInterval() : 1;
cal.add(calIncField, calInterval);
} | java | {
"resource": ""
} |
q157802 | CalendarOutputter.output | train | public final void output(final Calendar calendar, final OutputStream out)
throws IOException, ValidationException {
output(calendar, new OutputStreamWriter(out, DEFAULT_CHARSET));
} | java | {
"resource": ""
} |
q157803 | CalendarOutputter.output | train | public final void output(final Calendar calendar, final Writer out)
throws IOException, ValidationException {
if (isValidating()) {
calendar.validate();
}
try (FoldingWriter writer = new FoldingWriter(out, foldLength)) {
writer.write(calendar.toString());
... | java | {
"resource": ""
} |
q157804 | CalendarParserImpl.parseCalendar | train | private void parseCalendar(final StreamTokenizer tokeniser, Reader in,
final ContentHandler handler) throws IOException, ParseException,
URISyntaxException, ParserException {
assertToken(tokeniser, in, ':');
assertToken(tokeniser, in, Calendar.VCALENDAR, true, false);
... | java | {
"resource": ""
} |
q157805 | CalendarParserImpl.parseCalendarList | train | private void parseCalendarList(final StreamTokenizer tokeniser, Reader in,
final ContentHandler handler) throws IOException, ParseException,
URISyntaxException, ParserException {
// BEGIN:VCALENDAR
int ntok = assertToken(tokeniser, in, Calendar.BEGIN, false, true);
whil... | java | {
"resource": ""
} |
q157806 | CalendarParserImpl.assertToken | train | private int assertToken(final StreamTokenizer tokeniser, Reader in, final String token)
throws IOException, ParserException {
return assertToken(tokeniser, in, token, false, false);
} | java | {
"resource": ""
} |
q157807 | CalendarParserImpl.skipNewLines | train | private int skipNewLines(StreamTokenizer tokeniser, Reader in, String token) throws ParserException, IOException {
for (int i = 0;; i++) {
try {
return assertToken(tokeniser, in, StreamTokenizer.TT_WORD);
} catch (ParserException exc) {
//Skip a maximum of... | java | {
"resource": ""
} |
q157808 | CalendarParserImpl.getSvalIgnoringBom | train | private String getSvalIgnoringBom(StreamTokenizer tokeniser, Reader in, String token) {
if(tokeniser.sval != null) {
if(tokeniser.sval.contains(token)) {
return token;
}
}
return tokeniser.sval;
} | java | {
"resource": ""
} |
q157809 | CalendarParserImpl.absorbWhitespace | train | private int absorbWhitespace(final StreamTokenizer tokeniser, Reader in, boolean ignoreEOF) throws IOException, ParserException {
// HACK: absorb extraneous whitespace between components (KOrganizer)..
int ntok;
while ((ntok = nextToken(tokeniser, in, ignoreEOF)) == StreamTokenizer.TT_EOL) {
... | java | {
"resource": ""
} |
q157810 | CalendarParserImpl.nextToken | train | private int nextToken(StreamTokenizer tokeniser, Reader in, boolean ignoreEOF) throws IOException, ParserException {
int token = tokeniser.nextToken();
if (!ignoreEOF && token == StreamTokenizer.TT_EOF) {
throw new ParserException("Unexpected end of file", getLineNumber(tokeniser, in));
... | java | {
"resource": ""
} |
q157811 | IndexedComponentList.getComponents | train | public ComponentList<T> getComponents(final String propertyValue) {
ComponentList<T> components = index.get(propertyValue);
if (components == null) {
components = EMPTY_LIST;
}
return components;
} | java | {
"resource": ""
} |
q157812 | IndexedComponentList.getComponent | train | public T getComponent(final String propertyValue) {
final ComponentList<T> components = getComponents(propertyValue);
if (!components.isEmpty()) {
return components.get(0);
}
return null;
} | java | {
"resource": ""
} |
q157813 | DateListProperty.setTimeZone | train | public void setTimeZone(final TimeZone timezone) {
if (dates == null) {
throw new UnsupportedOperationException(
"TimeZone is not applicable to current value");
}
this.timeZone = timezone;
if (timezone != null) {
if (!Value.DATE_TIME.equals(get... | java | {
"resource": ""
} |
q157814 | Dur.negate | train | public final Dur negate() {
final Dur negated = new Dur(days, hours, minutes, seconds);
negated.weeks = weeks;
negated.negative = !negative;
return negated;
} | java | {
"resource": ""
} |
q157815 | Dur.add | train | public final Dur add(final Dur duration) {
if ((!isNegative() && duration.isNegative())
|| (isNegative() && !duration.isNegative())) {
throw new IllegalArgumentException(
"Cannot add a negative and a positive duration");
}
Dur sum;
if (we... | java | {
"resource": ""
} |
q157816 | Dur.compareTo | train | public final int compareTo(final Dur arg0) {
int result;
if (isNegative() != arg0.isNegative()) {
// return Boolean.valueOf(isNegative()).compareTo(Boolean.valueOf(arg0.isNegative()));
// for pre-java 1.5 compatibility..
if (isNegative()) {
return Inte... | java | {
"resource": ""
} |
q157817 | AbstractDateExpansionRule.getCalendarInstance | train | protected Calendar getCalendarInstance(final Date date, final boolean lenient) {
Calendar cal = Dates.getCalendarInstance(date);
// A week should have at least 4 days to be considered as such per RFC5545
cal.setMinimalDaysInFirstWeek(4);
cal.setFirstDayOfWeek(calendarWeekStartDay);
... | java | {
"resource": ""
} |
q157818 | Component.getProperties | train | public final <C extends Property> PropertyList<C> getProperties(final String name) {
return getProperties().getProperties(name);
} | java | {
"resource": ""
} |
q157819 | Component.getProperty | train | public final <T extends Property> T getProperty(final String name) {
return (T) getProperties().getProperty(name);
} | java | {
"resource": ""
} |
q157820 | Component.getRequiredProperty | train | protected final Property getRequiredProperty(String name) throws ConstraintViolationException {
Property p = getProperties().getProperty(name);
if (p == null) {
throw new ConstraintViolationException(String.format("Missing %s property", name));
}
return p;
} | java | {
"resource": ""
} |
q157821 | WeekDay.getWeekDay | train | public static WeekDay getWeekDay(final Calendar cal) {
return new WeekDay(getDay(cal.get(Calendar.DAY_OF_WEEK)), 0);
} | java | {
"resource": ""
} |
q157822 | WeekDay.getDay | train | public static WeekDay getDay(final int calDay) {
WeekDay day = null;
switch (calDay) {
case Calendar.SUNDAY:
day = SU;
break;
case Calendar.MONDAY:
day = MO;
break;
case Calendar.TUESDAY:
... | java | {
"resource": ""
} |
q157823 | Filter.filter | train | @SuppressWarnings("unchecked")
public final Collection<T> filter(final Collection<T> c) {
if (getRules() != null && getRules().length > 0) {
// attempt to use the same concrete collection type
// as is passed in..
Collection<T> filtered;
try {
... | java | {
"resource": ""
} |
q157824 | Filter.filter | train | @SuppressWarnings("unchecked")
public final T[] filter(final T[] objects) {
final Collection<T> filtered = filter(Arrays.asList(objects));
try {
return filtered.toArray((T[]) Array.newInstance(objects
.getClass(), filtered.size()));
} catch (ArrayStoreExceptio... | java | {
"resource": ""
} |
q157825 | VFreeBusy.getConsumedTime | train | private PeriodList getConsumedTime(final ComponentList<CalendarComponent> components, final DateTime rangeStart,
final DateTime rangeEnd) {
final PeriodList periods = new PeriodList();
// only events consume time..
for (final Component event : components.getComponents(Compon... | java | {
"resource": ""
} |
q157826 | InetAddressHostInfo.findNonLoopbackAddress | train | private static InetAddress findNonLoopbackAddress() throws SocketException {
final Enumeration<NetworkInterface> enumInterfaceAddress = NetworkInterface.getNetworkInterfaces();
while (enumInterfaceAddress.hasMoreElements()) {
final NetworkInterface netIf = enumInterfaceAddress.nextElement();... | java | {
"resource": ""
} |
q157827 | ComponentList.getComponent | train | public final T getComponent(final String aName) {
for (final T c : this) {
if (c.getName().equals(aName)) {
return c;
}
}
return null;
} | java | {
"resource": ""
} |
q157828 | ComponentList.getComponents | train | @SuppressWarnings("unchecked")
public final <C extends T> ComponentList<C> getComponents(final String name) {
final ComponentList<C> components = new ComponentList<C>();
for (final T c : this) {
if (c.getName().equals(name)) {
components.add((C) c);
}
}
... | java | {
"resource": ""
} |
q157829 | FixedUidGenerator.uniqueTimestamp | train | private static DateTime uniqueTimestamp() {
long currentMillis;
synchronized (FixedUidGenerator.class) {
currentMillis = System.currentTimeMillis();
// guarantee uniqueness by ensuring timestamp is always greater
// than the previous..
if (currentMillis < ... | java | {
"resource": ""
} |
q157830 | PeriodList.add | train | public final boolean add(final Period period) {
if (isUtc()) {
period.setUtc(true);
}
else {
period.setTimeZone(timezone);
}
return periods.add(period);
} | java | {
"resource": ""
} |
q157831 | PeriodList.add | train | public final PeriodList add(final PeriodList periods) {
if (periods != null) {
final PeriodList newList = new PeriodList();
newList.addAll(this);
newList.addAll(periods);
return newList.normalise();
}
return this;
} | java | {
"resource": ""
} |
q157832 | PeriodList.subtract | train | public final PeriodList subtract(final PeriodList subtractions) {
if (subtractions == null || subtractions.isEmpty()) {
return this;
}
PeriodList result = this;
PeriodList tmpResult = new PeriodList();
for (final Period subtraction : subtractions) {
... | java | {
"resource": ""
} |
q157833 | FileUtil.getFileFilter | train | public static FileFilter getFileFilter() {
return new FileFilter() {
@Override
public boolean accept(File pathname) {
//Accept if input is a non-hidden file with registered extension
//or if a non-hidden and not-ignored directory
return !... | java | {
"resource": ""
} |
q157834 | FileUtil.getRunningLocation | train | public static File getRunningLocation() throws Exception {
String codePath = FileUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String decodedPath = URLDecoder.decode(codePath, "UTF-8");
File codeFile = new File(decodedPath);
if (!codeFile.exists()) {
... | java | {
"resource": ""
} |
q157835 | FileUtil.sha1 | train | public static String sha1(File sourceFile) throws Exception {
byte[] buffer = new byte[1024];
MessageDigest complete = MessageDigest.getInstance("SHA-1");
updateDigest(complete, sourceFile, buffer);
byte[] bytes = complete.digest();
StringBuilder sb = new StringBuilder();
... | java | {
"resource": ""
} |
q157836 | FileUtil.isFileInDirectory | train | public static boolean isFileInDirectory(File file, File directory) throws IOException {
return (file.exists()
&& !file.isHidden()
&& directory.isDirectory()
&& file.getCanonicalPath().startsWith(directory.getCanonicalPath()));
} | java | {
"resource": ""
} |
q157837 | Crawler.crawl | train | private void crawl(File path) {
File[] contents = path.listFiles(FileUtil.getFileFilter());
if (contents != null) {
Arrays.sort(contents);
for (File sourceFile : contents) {
if (sourceFile.isFile()) {
StringBuilder sb = new StringBuilder();
... | java | {
"resource": ""
} |
q157838 | Crawler.createUri | train | private String createUri(String uri) {
try {
return FileUtil.URI_SEPARATOR_CHAR
+ FilenameUtils.getPath(uri)
+ URLEncoder.encode(FilenameUtils.getBaseName(uri), StandardCharsets.UTF_8.name())
+ config.getOutputExtension();
} catch (UnsupportedE... | java | {
"resource": ""
} |
q157839 | Parser.processFile | train | public Map<String, Object> processFile(File file) {
ParserEngine engine = Engines.get(FileUtil.fileExt(file));
if (engine==null) {
LOGGER.error("Unable to find suitable markup engine for {}",file);
return null;
}
return engine.parse(config, file);
} | java | {
"resource": ""
} |
q157840 | MarkupEngine.parse | train | public Map<String, Object> parse(JBakeConfiguration config, File file) {
this.configuration = config;
List<String> fileContents;
try (InputStream is = new FileInputStream(file)) {
fileContents = IOUtils.readLines(is, config.getRenderEncoding());
} catch (IOException e) {
... | java | {
"resource": ""
} |
q157841 | MarkupEngine.hasHeader | train | private boolean hasHeader(List<String> contents) {
boolean headerValid = true;
boolean statusFound = false;
boolean typeFound = false;
if (!headerSeparatorDemarcatesHeader(contents)) {
return false;
}
for (String line : contents) {
if (hasHeaderS... | java | {
"resource": ""
} |
q157842 | MarkupEngine.headerSeparatorDemarcatesHeader | train | private boolean headerSeparatorDemarcatesHeader(List<String> contents) {
List<String> subContents = null;
int index = contents.indexOf(configuration.getHeaderSeparator());
if (index != -1) {
// get every line above header separator
subContents = contents.subList(0, index)... | java | {
"resource": ""
} |
q157843 | MarkupEngine.processDefaultHeader | train | private void processDefaultHeader(ParserContext context) {
for (String line : context.getFileLines()) {
if (hasHeaderSeparator(line)) {
break;
}
processHeaderLine(line, context.getDocumentModel());
}
} | java | {
"resource": ""
} |
q157844 | MarkupEngine.processDefaultBody | train | private void processDefaultBody(ParserContext context) {
StringBuilder body = new StringBuilder();
boolean inBody = false;
for (String line : context.getFileLines()) {
if (inBody) {
body.append(line).append("\n");
}
if (line.equals(configuratio... | java | {
"resource": ""
} |
q157845 | ZipUtil.extract | train | public static void extract(InputStream is, File outputFolder) throws IOException {
ZipInputStream zis = new ZipInputStream(is);
ZipEntry entry;
byte[] buffer = new byte[1024];
while ((entry = zis.getNextEntry()) != null) {
File outputFile = new File(outputFolder.getCanonical... | java | {
"resource": ""
} |
q157846 | Asset.copy | train | public void copy(File path) {
FileFilter filter = new FileFilter() {
@Override
public boolean accept(File file) {
return (!config.getAssetIgnoreHidden() || !file.isHidden()) && (file.isFile() || FileUtil.directoryOnlyIfNotIgnored(file));
}
};
c... | java | {
"resource": ""
} |
q157847 | Asset.copySingleFile | train | public void copySingleFile(File asset) {
try {
if ( !asset.isDirectory() ) {
String targetPath = config.getDestinationFolder().getCanonicalPath() + File.separatorChar + assetSubPath(asset);
LOGGER.info("Copying single asset file to [{}]", targetPath);
... | java | {
"resource": ""
} |
q157848 | Asset.isAssetFile | train | public boolean isAssetFile(File path) {
boolean isAsset = false;
try {
if(FileUtil.directoryOnlyIfNotIgnored(path.getParentFile())) {
if (FileUtil.isFileInDirectory(path, config.getAssetFolder())) {
isAsset = true;
} else if (FileUtil.isFi... | java | {
"resource": ""
} |
q157849 | Oven.bake | train | public void bake(File fileToBake) {
Asset asset = utensils.getAsset();
if(asset.isAssetFile(fileToBake)) {
LOGGER.info("Baking a change to an asset [" + fileToBake.getPath() + "]");
asset.copySingleFile(fileToBake);
} else {
LOGGER.info("Playing it safe and ru... | java | {
"resource": ""
} |
q157850 | Oven.bake | train | public void bake() {
ContentStore contentStore = utensils.getContentStore();
JBakeConfiguration config = utensils.getConfiguration();
Crawler crawler = utensils.getCrawler();
Asset asset = utensils.getAsset();
try {
final long start = new Date().getTime();
... | java | {
"resource": ""
} |
q157851 | Oven.updateDocTypesFromConfiguration | train | private void updateDocTypesFromConfiguration() {
resetDocumentTypesAndExtractors();
JBakeConfiguration config = utensils.getConfiguration();
ModelExtractorsDocumentTypeListener listener = new ModelExtractorsDocumentTypeListener();
DocumentTypes.addListener(listener);
for (Strin... | java | {
"resource": ""
} |
q157852 | DBUtil.toStringArray | train | @SuppressWarnings("unchecked")
public static String[] toStringArray(Object entry) {
if (entry instanceof String[]) {
return (String[]) entry;
} else if (entry instanceof OTrackedList) {
OTrackedList<String> list = (OTrackedList<String>) entry;
return list.toArray(... | java | {
"resource": ""
} |
q157853 | DocumentsRenderer.getContentForNav | train | private Map<String, Object> getContentForNav(Map<String, Object> document) {
Map<String, Object> navDocument = new HashMap<>();
navDocument.put(Attributes.NO_EXTENSION_URI, document.get(Attributes.NO_EXTENSION_URI));
navDocument.put(Attributes.URI, document.get(Attributes.URI));
navDocum... | java | {
"resource": ""
} |
q157854 | ContentStore.mergeDocument | train | public ODocument mergeDocument(Map<String, ? extends Object> incomingDocMap)
{
String sourceUri = (String) incomingDocMap.get(DocumentAttributes.SOURCE_URI.toString());
if (null == sourceUri)
throw new IllegalArgumentException("Document sourceUri is null.");
String docType = (Str... | java | {
"resource": ""
} |
q157855 | Init.run | train | public void run(File outputFolder, File templateLocationFolder, String templateType) throws Exception {
if (!outputFolder.canWrite()) {
throw new Exception("Output folder is not writeable!");
}
File[] contents = outputFolder.listFiles();
boolean safe = true;
if (cont... | java | {
"resource": ""
} |
q157856 | JettyServer.run | train | public void run(String path, String port) {
Server server = new Server();
ServerConnector connector = new ServerConnector(server);
connector.setHost("localhost");
connector.setPort(Integer.parseInt(port));
server.addConnector(connector);
ResourceHandler resource_handler ... | java | {
"resource": ""
} |
q157857 | Main.main | train | public static void main(final String[] args) {
try {
new Main().run(args);
} catch (final JBakeException e) {
System.err.println(e.getMessage());
e.printStackTrace();
System.exit(1);
} catch (final Throwable e) {
System.err.println("An ... | java | {
"resource": ""
} |
q157858 | Renderer.render | train | public void render(Map<String, Object> content) throws Exception {
String docType = (String) content.get(Crawler.Attributes.TYPE);
String outputFilename = config.getDestinationFolder().getPath() + File.separatorChar + content.get(Attributes.URI);
if (outputFilename.lastIndexOf('.') > outputFilen... | java | {
"resource": ""
} |
q157859 | Renderer.renderTags | train | public int renderTags(String tagPath) throws Exception {
int renderedCount = 0;
final List<Throwable> errors = new LinkedList<>();
for (String tag : db.getAllTags()) {
try {
Map<String, Object> model = new HashMap<>();
model.put("renderer", renderingE... | java | {
"resource": ""
} |
q157860 | Utils.darker | train | static int darker(int color, float factor) {
return Color.argb(Color.alpha(color), Math.max((int) (Color.red(color) * factor), 0),
Math.max((int) (Color.green(color) * factor), 0), Math.max((int) (Color.blue(color) * factor), 0));
} | java | {
"resource": ""
} |
q157861 | Utils.isRtl | train | static boolean isRtl(Context context) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1
&& context.getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
} | java | {
"resource": ""
} |
q157862 | MaterialSpinner.setSelectedIndex | train | public void setSelectedIndex(int position) {
if (adapter != null) {
if (position >= 0 && position <= adapter.getCount()) {
adapter.notifyItemSelected(position);
selectedIndex = position;
setText(adapter.get(position).toString());
} else {
throw new IllegalArgumentExceptio... | java | {
"resource": ""
} |
q157863 | MaterialSpinner.setAdapter | train | public <T> void setAdapter(MaterialSpinnerAdapter<T> adapter) {
this.adapter = adapter;
this.adapter.setTextColor(textColor);
this.adapter.setBackgroundSelector(backgroundSelector);
this.adapter.setPopupPadding(popupPaddingLeft, popupPaddingTop, popupPaddingRight, popupPaddingBottom);
setAdapterInte... | java | {
"resource": ""
} |
q157864 | ThreadUtil.doInBackground | train | public static Future doInBackground(Callable callable) {
final ExecutorService executor = Executors.newSingleThreadExecutor();
Future future = executor.submit(callable);
if(executor.isTerminated()) {
executor.shutdown();
}
return future;
} | java | {
"resource": ""
} |
q157865 | NamingHelper.toSQLNameDefault | train | public static String toSQLNameDefault(String camelCased) {
if (camelCased.equalsIgnoreCase("_id")) {
return "_id";
}
StringBuilder sb = new StringBuilder();
char[] buf = camelCased.toCharArray();
for (int i = 0; i < buf.length; i++) {
char prevChar = (i ... | java | {
"resource": ""
} |
q157866 | NamingHelper.toColumnName | train | public static String toColumnName(Field field) {
if (field.isAnnotationPresent(Column.class)) {
Column annotation = field.getAnnotation(Column.class);
return annotation.name();
}
return toSQLNameDefault(field.getName());
} | java | {
"resource": ""
} |
q157867 | NamingHelper.toTableName | train | public static String toTableName(Class<?> table) {
if (table.isAnnotationPresent(Table.class)) {
Table annotation = table.getAnnotation(Table.class);
if ("".equals(annotation.name())) {
return NamingHelper.toSQLNameDefault(table.getSimpleName());
}
... | java | {
"resource": ""
} |
q157868 | ManifestHelper.getDatabaseVersion | train | public static int getDatabaseVersion() {
Integer databaseVersion = getMetaDataInteger(METADATA_VERSION);
if ((databaseVersion == null) || (databaseVersion == 0)) {
databaseVersion = 1;
}
return databaseVersion;
} | java | {
"resource": ""
} |
q157869 | ManifestHelper.getDomainPackageName | train | public static String getDomainPackageName() {
String domainPackageName = getMetaDataString(METADATA_DOMAIN_PACKAGE_NAME);
if (domainPackageName == null) {
domainPackageName = "";
}
return domainPackageName;
} | java | {
"resource": ""
} |
q157870 | ManifestHelper.getDatabaseName | train | public static String getDatabaseName() {
String databaseName = getMetaDataString(METADATA_DATABASE);
if (databaseName == null) {
databaseName = DATABASE_DEFAULT_NAME;
}
return databaseName;
} | java | {
"resource": ""
} |
q157871 | SugarDataSource.bulkInsert | train | public void bulkInsert(final List<T> objects, final SuccessCallback<List<Long>> successCallback, final ErrorCallback errorCallback) {
checkNotNull(successCallback);
checkNotNull(errorCallback);
checkNotNull(objects);
final Callable<List<Long>> call = new Callable<List<Long>>() {
... | java | {
"resource": ""
} |
q157872 | SugarDataSource.query | train | public void query(final String whereClause, final String[] whereArgs, final String groupBy, final String orderBy, final String limit, final SuccessCallback<Cursor> successCallback, final ErrorCallback errorCallback) {
checkNotNull(successCallback);
checkNotNull(errorCallback);
final Callable<Cu... | java | {
"resource": ""
} |
q157873 | SugarDataSource.listAll | train | public void listAll(final String orderBy, final SuccessCallback<List<T>> successCallback, final ErrorCallback errorCallback) {
checkNotNull(successCallback);
checkNotNull(errorCallback);
final Callable<List<T>> call = new Callable<List<T>>() {
@Override
public List<T> ca... | java | {
"resource": ""
} |
q157874 | SugarDataSource.update | train | public void update(final T object, final SuccessCallback<Long> successCallback, final ErrorCallback errorCallback) {
checkNotNull(successCallback);
checkNotNull(errorCallback);
checkNotNull(object);
final Callable<Long> call = new Callable<Long>() {
@Override
pub... | java | {
"resource": ""
} |
q157875 | SugarDataSource.delete | train | public void delete(final T object, final SuccessCallback<Boolean> successCallback, final ErrorCallback errorCallback) {
checkNotNull(successCallback);
checkNotNull(errorCallback);
checkNotNull(object);
final Callable<Boolean> call = new Callable<Boolean>() {
@Override
... | java | {
"resource": ""
} |
q157876 | SugarDataSource.delete | train | public void delete(final String whereClause, final String[] whereArgs, final SuccessCallback<Integer> successCallback, final ErrorCallback errorCallback) {
checkNotNull(successCallback);
checkNotNull(errorCallback);
final Callable<Integer> call = new Callable<Integer>() {
@Override
... | java | {
"resource": ""
} |
q157877 | SugarDataSource.deleteAll | train | public void deleteAll(final SuccessCallback<Integer> successCallback, final ErrorCallback errorCallback) {
delete(null, null, successCallback, errorCallback);
} | java | {
"resource": ""
} |
q157878 | SugarDataSource.count | train | public void count(final SuccessCallback<Long> successCallback, final ErrorCallback errorCallback) {
checkNotNull(successCallback);
checkNotNull(errorCallback);
final Callable<Long> call = new Callable<Long>() {
@Override
public Long call() throws Exception {
... | java | {
"resource": ""
} |
q157879 | DiffImage.calcCombinedIntensity | train | private static int calcCombinedIntensity(final int element) {
final Color color = new Color(element);
return Math.min(255, (color.getRed() + color.getGreen() + color.getRed()) / 3);
} | java | {
"resource": ""
} |
q157880 | FilterAdapter.buildAdapter | train | public static FilterAdapter buildAdapter() {
FilterAdapter adapter = new FilterAdapter();
adapter.addFilterAdapter(
ColumnPrefixFilter.class, new ColumnPrefixFilterAdapter());
adapter.addFilterAdapter(
ColumnRangeFilter.class, new ColumnRangeFilterAdapter());
adapter.addFilterAdapter(
... | java | {
"resource": ""
} |
q157881 | FilterAdapter.adaptFilter | train | public Optional<Filters.Filter> adaptFilter(FilterAdapterContext context, Filter filter)
throws IOException {
SingleFilterAdapter<?> adapter = getAdapterForFilterOrThrow(filter);
return Optional.fromNullable(adapter.adapt(context, filter));
} | java | {
"resource": ""
} |
q157882 | FilterAdapter.throwIfUnsupportedFilter | train | public void throwIfUnsupportedFilter(Scan scan, Filter filter) {
List<FilterSupportStatus> filterSupportStatuses = new ArrayList<>();
FilterAdapterContext context = new FilterAdapterContext(scan, null);
collectUnsupportedStatuses(context, filter, filterSupportStatuses);
if (!filterSupportStatuses.isEmpt... | java | {
"resource": ""
} |
q157883 | FilterAdapter.getAdapterForFilterOrThrow | train | protected SingleFilterAdapter<?> getAdapterForFilterOrThrow(Filter filter) {
if (adapterMap.containsKey(filter.getClass())) {
return adapterMap.get(filter.getClass());
} else {
throw new UnsupportedFilterException(
ImmutableList.of(FilterSupportStatus.newUnknownFilterType(filter)));
}
... | java | {
"resource": ""
} |
q157884 | ColumnPaginationFilterAdapter.createChain | train | private Filter createChain(
ColumnPaginationFilter filter, Filter intermediate) {
ChainFilter chain = FILTERS.chain();
chain.filter(FILTERS.limit().cellsPerColumn(1));
if (intermediate != null) {
chain.filter(intermediate);
}
chain.filter(FILTERS.limit().cellsPerRow(filter.getLimit()));
... | java | {
"resource": ""
} |
q157885 | TimestampFilterUtil.hbaseToTimestampRangeFilter | train | public static Filter hbaseToTimestampRangeFilter(long hbaseStartTimestamp,
long hbaseEndTimestamp) {
return toTimestampRangeFilter(
TimestampConverter.hbase2bigtable(hbaseStartTimestamp),
TimestampConverter.hbase2bigtable(hbaseEndTimestamp));
} | java | {
"resource": ""
} |
q157886 | TimestampFilterUtil.toTimestampRangeFilter | train | public static Filter toTimestampRangeFilter(long bigtableStartTimestamp,
long bigtableEndTimestamp) {
return FILTERS.timestamp().range().of(bigtableStartTimestamp, bigtableEndTimestamp);
} | java | {
"resource": ""
} |
q157887 | FilterSupportStatus.newUnknownFilterType | train | public static FilterSupportStatus newUnknownFilterType(Filter unknownFilterType) {
return new FilterSupportStatus(
false,
String.format(
"Don't know how to adapt Filter class '%s'", unknownFilterType.getClass()));
} | java | {
"resource": ""
} |
q157888 | FilterSupportStatus.newCompositeNotSupported | train | public static FilterSupportStatus newCompositeNotSupported(
List<FilterSupportStatus> unsupportedSubfilters) {
StringBuilder builder = new StringBuilder();
for (FilterSupportStatus subStatus: unsupportedSubfilters) {
builder.append(subStatus.getReason());
builder.append("\n");
}
return... | java | {
"resource": ""
} |
q157889 | BigtableVersionInfo.getVersion | train | private static String getVersion() {
final String defaultVersion = "dev-" + System.currentTimeMillis();
final String fileName = "bigtable-version.properties";
final String versionProperty = "bigtable.version";
try (InputStream stream =
BigtableVersionInfo.class.getResourceAsStream(fileName)) {
... | java | {
"resource": ""
} |
q157890 | AbstractBigtableConnection.getTable | train | @Deprecated
public Table getTable(String tableName) throws IOException {
return getTable(TableName.valueOf(tableName));
} | java | {
"resource": ""
} |
q157891 | ColumnDescriptorAdapter.getUnknownFeatures | train | public static List<String> getUnknownFeatures(HColumnDescriptor columnDescriptor) {
List<String> unknownFeatures = new ArrayList<String>();
for (Map.Entry<String, String> entry : columnDescriptor.getConfiguration().entrySet()) {
String key = entry.getKey();
if (!SUPPORTED_OPTION_KEYS.contains(key)
... | java | {
"resource": ""
} |
q157892 | ColumnDescriptorAdapter.getUnsupportedFeatures | train | public static Map<String, String> getUnsupportedFeatures(HColumnDescriptor columnDescriptor) {
Map<String, String> unsupportedConfiguration = new HashMap<String, String>();
Map<String, String> configuration = columnDescriptor.getConfiguration();
for (Map.Entry<String, String> entry : SUPPORTED_OPTION_VALUE... | java | {
"resource": ""
} |
q157893 | OAuthCredentialsCache.syncRefresh | train | private HeaderCacheElement syncRefresh(long timeout, TimeUnit timeUnit) {
Span span = TRACER.spanBuilder("Bigtable.CredentialsRefresh").startSpan();
try (Scope scope = TRACER.withSpan(span)) {
return asyncRefresh().get(timeout, timeUnit);
} catch (InterruptedException e) {
LOG.warn("Interrupted ... | java | {
"resource": ""
} |
q157894 | OAuthCredentialsCache.asyncRefresh | train | Future<HeaderCacheElement> asyncRefresh() {
LOG.trace("asyncRefresh");
synchronized (lock) {
try {
if (futureToken != null) {
return futureToken;
}
if (headerCache.getCacheState() == CacheState.Good) {
return Futures.immediateFuture(headerCache);
}
... | java | {
"resource": ""
} |
q157895 | OAuthCredentialsCache.revokeUnauthToken | train | void revokeUnauthToken(HeaderToken oldToken) {
synchronized (lock) {
if (headerCache.getToken() == oldToken) {
LOG.warn("Got unauthenticated response from server, revoking the current token");
headerCache = EMPTY_HEADER;
} else {
LOG.info("Skipping revoke, since the revoked token... | java | {
"resource": ""
} |
q157896 | ResultQueueEntry.toResultQueueEntryForEquals | train | @SuppressWarnings("unchecked")
protected ResultQueueEntry<T> toResultQueueEntryForEquals(Object obj) {
if (!(obj instanceof ResultQueueEntry) || obj == null) {
return null;
}
ResultQueueEntry<T> other = (ResultQueueEntry<T>) obj;
return type == other.type && getClass() == other.getClass() ? othe... | java | {
"resource": ""
} |
q157897 | FilterAdapterHelper.getSingleFamilyName | train | public static String getSingleFamilyName(FilterAdapterContext context) {
Preconditions.checkState(
context.getScan().numFamilies() == 1,
"Cannot getSingleFamilyName() unless there is exactly 1 family.");
return Bytes.toString(context.getScan().getFamilies()[0]);
} | java | {
"resource": ""
} |
q157898 | HBaseResultToMutationFn.checkEmptyRow | train | private List<Cell> checkEmptyRow(KV<ImmutableBytesWritable, Result> kv) {
List<Cell> cells = kv.getValue().listCells();
if (cells == null) {
cells = Collections.emptyList();
}
if (!isEmptyRowWarned && cells.isEmpty()) {
logger.warn("Encountered empty row. Was input file serialized by HBase 0... | java | {
"resource": ""
} |
q157899 | TemplateUtils.BuildImportConfig | train | public static CloudBigtableTableConfiguration BuildImportConfig(ImportOptions opts) {
CloudBigtableTableConfiguration.Builder builder =
new CloudBigtableTableConfiguration.Builder()
.withProjectId(opts.getBigtableProject())
.withInstanceId(opts.getBigtableInstanceId())
.w... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.