code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
String expandIri(String value, boolean relative, boolean vocab, Map<String, Object> context,
Map<String, Boolean> defined) throws JsonLdError {
// 1)
if (value == null || JsonLdUtils.isKeyword(value)) {
return value;
}
// 2)
if (context != null && context.... | java |
public String getContainer(String property) {
if (property == null) {
return null;
}
if (JsonLdConsts.GRAPH.equals(property)) {
return JsonLdConsts.SET;
}
if (!property.equals(JsonLdConsts.TYPE) && JsonLdUtils.isKeyword(property)) {
return prop... | java |
private static String hashQuads(String id, Map<String, Object> bnodes, UniqueNamer namer) {
// return cached hash
if (((Map<String, Object>) bnodes.get(id)).containsKey("hash")) {
return (String) ((Map<String, Object>) bnodes.get(id)).get("hash");
}
// serialize all of bnode... | java |
private static String sha1hash(Collection<String> nquads) {
try {
// create SHA-1 digest
final MessageDigest md = MessageDigest.getInstance("SHA-1");
for (final String nquad : nquads) {
md.update(nquad.getBytes("UTF-8"));
}
return encod... | java |
public JsonLdOptions copy() {
final JsonLdOptions copy = new JsonLdOptions(base);
copy.setCompactArrays(compactArrays);
copy.setExpandContext(expandContext);
copy.setProcessingMode(processingMode);
copy.setDocumentLoader(documentLoader);
copy.setEmbed(embed);
cop... | java |
private static void removeEmbed(FramingContext state, String id) {
// get existing embed
final Map<String, EmbedNode> links = state.uniqueEmbeds;
final EmbedNode embed = links.get(id);
final Object parent = embed.parent;
final String property = embed.property;
// create ... | java |
private static void addFrameOutput(FramingContext state, Object parent, String property,
Object output) {
if (parent instanceof Map) {
List<Object> prop = (List<Object>) ((Map<String, Object>) parent).get(property);
if (prop == null) {
prop = new ArrayList<Obj... | java |
public RDFDataset toRDF() throws JsonLdError {
// TODO: make the default generateNodeMap call (i.e. without a
// graphName) create and return the nodeMap
final Map<String, Object> nodeMap = newMap();
nodeMap.put(JsonLdConsts.DEFAULT, newMap());
generateNodeMap(this.value, nodeMap... | java |
public Object normalize(Map<String, Object> dataset) throws JsonLdError {
// create quads and map bnodes to their associated quads
final List<Object> quads = new ArrayList<Object>();
final Map<String, Object> bnodes = newMap();
for (String graphName : dataset.keySet()) {
fina... | java |
public static CallStackElement create(CallStackElement parent, String signature, long startTimestamp) {
CallStackElement cse;
if (useObjectPooling) {
cse = objectPool.poll();
if (cse == null) {
cse = new CallStackElement();
}
} else {
cse = new CallStackElement();
}
cse.executionTime = startT... | java |
public void beforeTransformation(TypeDescription typeDescription, ClassLoader classLoader) {
if (isPreventDuplicateTransformation()) {
Dispatcher.put(getClassAlreadyTransformedKey(typeDescription, classLoader), Boolean.TRUE);
}
if (DEBUG_INSTRUMENTATION && logger.isDebugEnabled()) {
logger.debug("TRANSFORM... | java |
public static String getCallerSignature() {
if (Stagemonitor.getPlugin(CorePlugin.class).getIncludePackages().isEmpty()) {
return null;
}
if (javaLangAccessObject != null) {
return getCallerSignatureSharedSecrets();
} else {
return getCallerSignatureGetStackTrace();
}
} | java |
@Deprecated
public static void reset(MeasurementSession measurementSession) {
started = false;
disabled = false;
if (configuration == null) {
reloadPluginsAndConfiguration();
}
if (measurementSession == null) {
CorePlugin corePlugin = getPlugin(CorePlugin.class);
measurementSession = new Measurement... | java |
public boolean isPasswordCorrect(String password) {
final String actualPassword = configurationRegistry.getString(updateConfigPasswordKey);
return "".equals(actualPassword) || actualPassword != null && actualPassword.equals(password);
} | java |
@Override
public T convert(String name) throws IllegalArgumentException {
if (name == null) {
throw new IllegalArgumentException("Cant convert 'null' to " + enumClass.getSimpleName());
}
try {
return Enum.valueOf(enumClass, name);
} catch (IllegalArgumentException e) {
// ignore
}
try {
return ... | java |
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (alertingPlugin.getAlertSender() != null) {
JsonUtils.writeJsonToOutputStream(alertingPlugin.getAlertSender().getAvailableAlerters(),
resp.getOutputStream());
} else {
JsonUtils.wri... | java |
private void addRemotePropertiesConfigurationSources(ConfigurationRegistry configuration, CorePlugin corePlugin) {
final List<URL> configurationUrls = corePlugin.getRemotePropertiesConfigUrls();
if (corePlugin.isDeactivateStagemonitorIfRemotePropertyServerIsDown()) {
assertRemotePropertiesServerIsAvailable(confi... | java |
private void assertRemotePropertiesServerIsAvailable(final URL configUrl) {
new HttpClient().send(
"HEAD",
configUrl.toExternalForm(),
new HashMap<String, String>(),
null,
new HttpClient.ResponseHandler<Void>() {
@Override
public Void handleResponse(HttpRequest<?> httpRequest, InputStrea... | java |
private CounterMetricFamily fromCounter(List<Map.Entry<MetricName, Counter>> countersWithSameName) {
final Map.Entry<MetricName, Counter> first = countersWithSameName.get(0);
final MetricName firstName = first.getKey();
final CounterMetricFamily metricFamily = new CounterMetricFamily(firstName.getName(), getHelpM... | java |
private MetricFamilySamples fromTimer(List<Map.Entry<MetricName, Timer>> histogramsWithSameName) {
final SummaryMetricFamily summaryMetricFamily = getSummaryMetricFamily(histogramsWithSameName, "_seconds");
for (Map.Entry<MetricName, Timer> entry : histogramsWithSameName) {
addSummaryMetric(summaryMetricFamily, ... | java |
@SuppressWarnings("unchecked")
public static <T> T get(String key, Class<T> valueClass) {
return (T) values.get(key);
} | java |
public static synchronized Runnable performRuntimeAttachment() {
if (runtimeAttached || !corePlugin.isStagemonitorActive() || !corePlugin.isAttachAgentAtRuntime()) {
return NOOP_ON_SHUTDOWN_ACTION;
}
runtimeAttached = true;
final List<ClassFileTransformer> classFileTransformers = new ArrayList<ClassFileTran... | java |
public static void registerMBean(final ObjectInstance objectInstance, final String mBeanAttributeName, MetricName metricName, Metric2Registry metricRegistry) {
metricRegistry.register(metricName, new Gauge<Object>() {
@Override
public Object getValue() {
return getValueFromMBean(objectInstance, mBeanAttribu... | java |
public void registerAll(Metric2Set metrics) throws IllegalArgumentException {
for (Map.Entry<MetricName, Metric> entry : metrics.getMetrics().entrySet()) {
register(entry.getKey(), entry.getValue());
}
} | java |
public void registerAny(Metric2Set metrics) {
for (Map.Entry<MetricName, Metric> entry : metrics.getMetrics().entrySet()) {
registerNewMetrics(entry.getKey(), entry.getValue());
}
} | java |
public void registerNewMetrics(MetricName name, Metric metric) {
final Set<MetricName> registeredNames = getNames();
if (!registeredNames.contains(name)) {
try {
register(name, metric);
} catch (IllegalArgumentException e){/* exception due to race condition*/}
}
} | java |
public MimeMessage createMimeMessage(Session session) throws MessagingException {
if (isEmpty(htmlPart) && isEmpty(textPart)) {
throw new IllegalArgumentException("Missing email content");
}
final MimeMessage msg = new MimeMessage(session);
msg.setSubject(subject);
msg.setFrom(new InternetAddress(from));
... | java |
private Multipart createMultiPart() throws MessagingException {
Multipart multipart = new MimeMultipart("alternative");
if (textPart != null) {
// add text first, to give priority to html
multipart.addBodyPart((BodyPart) createTextMimePart());
}
if (htmlPart != null) {
multipart.addBodyPart((BodyPart) ... | java |
private MimePart createHtmlMimePart() throws MessagingException {
MimePart bodyPart = new MimeBodyPart();
bodyPart.setContent(htmlPart, "text/html; charset=utf-8");
return bodyPart;
} | java |
private MimePart createTextMimePart() throws MessagingException {
MimePart bodyPart = new MimeBodyPart();
bodyPart.setText(textPart);
return bodyPart;
} | java |
public PreExecutionInterceptorContext mustCollectCallTree(String reason) {
logger.debug("Must collect call tree because {}", reason);
mustCollectCallTree = true;
collectCallTree = true;
return this;
} | java |
public PreExecutionInterceptorContext shouldNotCollectCallTree(String reason) {
if (!mustCollectCallTree) {
logger.debug("Should not collect call tree because {}", reason);
collectCallTree = false;
}
return this;
} | java |
public List<CheckResult> check(MetricName actualTarget, Map<String, Number> currentValuesByMetric) {
SortedMap<CheckResult.Status, List<Threshold>> sortedThresholds = new TreeMap<CheckResult.Status, List<Threshold>>(thresholds);
for (Map.Entry<CheckResult.Status, List<Threshold>> entry : sortedThresholds.entrySet()... | java |
public Map<String, Boolean> getNamesOfConfigurationSources() {
final Map<String, Boolean> result = new LinkedHashMap<String, Boolean>();
for (ConfigurationSource configurationSource : configurationSources) {
result.put(configurationSource.getName(), configurationSource.isSavingPossible());
}
return result;
... | java |
public void reload(String key) {
if (configurationOptionsByKey.containsKey(key)) {
configurationOptionsByKey.get(key).reload(false);
}
} | java |
public String getString(String key) {
if (key == null || key.isEmpty()) {
return null;
}
String property = null;
for (ConfigurationSource configurationSource : configurationSources) {
property = configurationSource.getValue(key);
if (property != null) {
break;
}
}
return property;
} | java |
public URL getElasticsearchUrl() {
final List<URL> urls = elasticsearchUrls.getValue();
if (urls.isEmpty()) {
return null;
}
final int index = accessesToElasticsearchUrl.getAndIncrement() % urls.size();
URL elasticsearchURL = urls.get(index);
final String defaultUsernameValue = elasticsearchDefaultUsern... | java |
public void update(T newValue, String configurationSourceName) throws IOException {
final String newValueAsString = valueConverter.toString(newValue);
configuration.save(key, newValueAsString, configurationSourceName);
} | java |
public boolean isDefault() {
return (valueAsString != null && valueAsString.equals(defaultValueAsString)) ||
(valueAsString == null && defaultValueAsString == null);
} | java |
public String toGraphiteName() {
StringBuilder sb = new StringBuilder(GraphiteSanitizer.sanitizeGraphiteMetricSegment(name));
for (String value : tags.values()) {
sb.append('.').append(GraphiteSanitizer.sanitizeGraphiteMetricSegment(value));
}
return sb.toString();
} | java |
@NonNull
public final List<Router> getChildRouters() {
List<Router> routers = new ArrayList<>(childRouters.size());
routers.addAll(childRouters);
return routers;
} | java |
public boolean handleBack() {
List<RouterTransaction> childTransactions = new ArrayList<>();
for (ControllerHostedRouter childRouter : childRouters) {
childTransactions.addAll(childRouter.getBackstack());
}
Collections.sort(childTransactions, new Comparator<RouterTransactio... | java |
@NonNull
public List<RouterTransaction> getBackstack() {
List<RouterTransaction> list = new ArrayList<>(backstack.size());
Iterator<RouterTransaction> backstackIterator = backstack.reverseIterator();
while (backstackIterator.hasNext()) {
list.add(backstackIterator.next());
... | java |
@UiThread
public void rebindIfNeeded() {
ThreadUtils.ensureMainThread();
Iterator<RouterTransaction> backstackIterator = backstack.reverseIterator();
while (backstackIterator.hasNext()) {
RouterTransaction transaction = backstackIterator.next();
if (transaction.cont... | java |
private void ensureOrderedTransactionIndices(List<RouterTransaction> backstack) {
List<Integer> indices = new ArrayList<>(backstack.size());
for (RouterTransaction transaction : backstack) {
transaction.ensureValidIndex(getTransactionIndexer());
indices.add(transaction.transactio... | java |
@NonNull
public Bundle saveInstanceState() {
Bundle bundle = new Bundle();
bundle.putBundle(KEY_VIEW_CONTROLLER_BUNDLE, controller.saveInstanceState());
if (pushControllerChangeHandler != null) {
bundle.putBundle(KEY_PUSH_TRANSITION, pushControllerChangeHandler.toBundle());
... | java |
protected ActionBar getActionBar() {
ActionBarProvider actionBarProvider = ((ActionBarProvider)getActivity());
return actionBarProvider != null ? actionBarProvider.getSupportActionBar() : null;
} | java |
private static String driverVersion()
{
// "Session" is arbitrary - the only thing that matters is that the class we use here is in the
// 'org.neo4j.driver' package, because that is where the jar manifest specifies the version.
// This is done as part of the build, adding a MANIFEST.MF file... | java |
private StatementResult addCompany( final Transaction tx, final String name )
{
return tx.run( "CREATE (:Company {name: $name})", parameters( "name", name ) );
} | java |
private StatementResult addPerson( final Transaction tx, final String name )
{
return tx.run( "CREATE (:Person {name: $name})", parameters( "name", name ) );
} | java |
private StatementResult employ( final Transaction tx, final String person, final String company )
{
return tx.run( "MATCH (person:Person {name: $person_name}) " +
"MATCH (company:Company {name: $company_name}) " +
"CREATE (person)-[:WORKS_FOR]->(company)",
... | java |
private StatementResult makeFriends( final Transaction tx, final String person1, final String person2 )
{
return tx.run( "MATCH (a:Person {name: $person_1}) " +
"MATCH (b:Person {name: $person_2}) " +
"MERGE (a)-[:KNOWS]->(b)",
parameters( "per... | java |
private StatementResult printFriends( final Transaction tx )
{
StatementResult result = tx.run( "MATCH (a)-[:KNOWS]->(b) RETURN a.name, b.name" );
while ( result.hasNext() )
{
Record record = result.next();
System.out.println( String.format( "%s knows %s", record.get(... | java |
public static void checkArgument( Object argument, Class<?> expectedClass )
{
if ( !expectedClass.isInstance( argument ) )
{
throw new IllegalArgumentException( "Argument expected to be of type: " + expectedClass.getName() + " but was: " + argument );
}
} | java |
public static AuthToken kerberos( String base64EncodedTicket )
{
Objects.requireNonNull( base64EncodedTicket, "Ticket can't be null" );
Map<String,Value> map = newHashMapWithSize( 3 );
map.put( SCHEME_KEY, value( "kerberos" ) );
map.put( PRINCIPAL_KEY, value( "" ) ); // This empty s... | java |
public static <T> Publisher<T> createEmptyPublisher( Supplier<CompletionStage<Void>> supplier )
{
return Mono.create( sink -> supplier.get().whenComplete( ( ignore, completionError ) -> {
Throwable error = Futures.completionExceptionCause( completionError );
if ( error != null )
... | java |
private void load() throws IOException
{
if ( !knownHosts.exists() )
{
return;
}
assertKnownHostFileReadable();
try ( BufferedReader reader = new BufferedReader( new FileReader( knownHosts ) ) )
{
String line;
while ( (line = read... | java |
public static String fingerprint( X509Certificate cert ) throws CertificateException
{
try
{
MessageDigest md = MessageDigest.getInstance( "SHA-512" );
md.update( cert.getEncoded() );
return ByteBufUtil.hexDump( md.digest() );
}
catch( NoSuchAlgori... | java |
public CompletionStage<ClusterComposition> lookupClusterComposition( RoutingTable routingTable,
ConnectionPool connectionPool )
{
CompletableFuture<ClusterComposition> result = new CompletableFuture<>();
lookupClusterComposition( routingTable, connectionPool, 0, 0, result );
retu... | java |
public static void saveX509Cert( String certStr, File certFile ) throws IOException
{
try ( BufferedWriter writer = new BufferedWriter( new FileWriter( certFile ) ) )
{
writer.write( BEGIN_CERT );
writer.newLine();
writer.write( certStr );
writer.newL... | java |
public static void saveX509Cert( Certificate cert, File certFile ) throws GeneralSecurityException, IOException
{
saveX509Cert( new Certificate[]{cert}, certFile );
} | java |
public static void saveX509Cert( Certificate[] certs, File certFile ) throws GeneralSecurityException, IOException
{
try ( BufferedWriter writer = new BufferedWriter( new FileWriter( certFile ) ) )
{
for ( Certificate cert : certs )
{
String certStr = Base64.g... | java |
public static void loadX509Cert( File certFile, KeyStore keyStore ) throws GeneralSecurityException, IOException
{
try ( BufferedInputStream inputStream = new BufferedInputStream( new FileInputStream( certFile ) ) )
{
CertificateFactory certFactory = CertificateFactory.getInstance( "X.50... | java |
public static void loadX509Cert( Certificate cert, String certAlias, KeyStore keyStore ) throws KeyStoreException
{
keyStore.setCertificateEntry( certAlias, cert );
} | java |
public static String X509CertToString( String cert )
{
String cert64CharPerLine = cert.replaceAll( "(.{64})", "$1\n" );
return BEGIN_CERT + "\n" + cert64CharPerLine + "\n"+ END_CERT + "\n";
} | java |
public Statement withUpdatedParameters( Value updates )
{
if ( updates == null || updates.isEmpty() )
{
return this;
}
else
{
Map<String,Value> newParameters = newHashMapWithSize( Math.max( parameters.size(), updates.size() ) );
newParamete... | java |
public BoltServerAddress resolve() throws UnknownHostException
{
String ipAddress = InetAddress.getByName( host ).getHostAddress();
if ( ipAddress.equals( host ) )
{
return this;
}
else
{
return new BoltServerAddress( host, ipAddress, port );
... | java |
public static GoogleConnector getInstance() {
if (instance == null) {
try {
instance = new GoogleConnector();
} catch (Exception e) {
throw new RuntimeException("The GoogleConnector could not be instanced!", e);
}
}
return insta... | java |
synchronized void removeCredential(String accountId) throws IOException {
DataStore<StoredCredential> sc = StoredCredential.getDefaultDataStore(dataStoreFactory);
sc.delete(accountId);
calendarService = null;
geoService = null;
} | java |
boolean isAuthorized(String accountId) {
try {
DataStore<StoredCredential> sc = StoredCredential.getDefaultDataStore(dataStoreFactory);
return sc.containsKey(accountId);
} catch (IOException e) {
return false;
}
} | java |
public synchronized GoogleCalendarService getCalendarService(String accountId) throws IOException {
if (calendarService == null) {
Credential credential = impl_getStoredCredential(accountId);
if (credential == null) {
throw new UnsupportedOperationException("The account h... | java |
GoogleAccount getAccountInfo(String accountId) throws IOException {
Credential credential = impl_getStoredCredential(accountId);
if (credential == null) {
throw new UnsupportedOperationException("The account has not been authorized yet!");
}
Userinfoplus info = impl_requestUs... | java |
public final ObjectProperty<Insets> extraPaddingProperty() {
if (extraPadding == null) {
extraPadding = new StyleableObjectProperty<Insets>(new Insets(2, 0,
9, 0)) {
@Override
public CssMetaData<AllDayView, Insets> getCssMetaData() {
... | java |
public final DoubleProperty rowHeightProperty() {
if (rowHeight == null) {
rowHeight = new StyleableDoubleProperty(20) {
@Override
public CssMetaData<AllDayView, Number> getCssMetaData() {
return StyleableProperties.ROW_HEIGHT;
}
... | java |
public final DoubleProperty rowSpacingProperty() {
if (rowSpacing == null) {
rowSpacing = new StyleableDoubleProperty(2) {
@Override
public CssMetaData<AllDayView, Number> getCssMetaData() {
return StyleableProperties.ROW_SPACING;
... | java |
public final DoubleProperty columnSpacingProperty() {
if (columnSpacing == null) {
columnSpacing = new StyleableDoubleProperty(2) {
@Override
public CssMetaData<AllDayView, Number> getCssMetaData() {
return StyleableProperties.COLUMN_SPACING;
... | java |
public void show(Window owner) {
InvalidationListener viewTypeListener = obs -> loadDropDownValues(getDate());
if (dialog != null) {
dialog.show();
} else {
TimeRangeView timeRange = getSettingsView().getTimeRangeView();
Scene scene = new Scene(this);... | java |
public int approximateIntervalInDays() {
int freqLengthDays;
int nPerPeriod = 0;
switch (this.freq) {
case DAILY:
freqLengthDays = 1;
break;
case WEEKLY:
freqLengthDays = 7;
if (!this.byDay.isEmpty()) {
... | java |
public String toIcal() {
StringBuilder buf = new StringBuilder();
buf.append(this.getName().toUpperCase());
buf.append(";TZID=\"").append(tzid.getID()).append('"');
buf.append(";VALUE=").append(valueType.toIcal());
if (hasExtParams()) {
for (Map.Entry<String, String> ... | java |
static Predicate<DateValue> byDayFilter(
final WeekdayNum[] days, final boolean weeksInYear, final Weekday wkst) {
return new Predicate<DateValue>() {
public boolean apply(DateValue date) {
Weekday dow = Weekday.valueOf(date);
int nDays;
/... | java |
static Predicate<DateValue> weekIntervalFilter(
final int interval, final Weekday wkst, final DateValue dtStart) {
return new Predicate<DateValue>() {
DateValue wkStart;
{
// the latest day with day of week wkst on or before dtStart
DTBuilder ... | java |
static Predicate<DateValue> byMinuteFilter(int[] minutes) {
long minutesByBit = 0;
for (int minute : minutes) {
minutesByBit |= 1L << minute;
}
if ((minutesByBit & LOW_60_BITS) == LOW_60_BITS) {
return Predicates.alwaysTrue();
}
final long bitField... | java |
static Predicate<DateValue> bySecondFilter(int[] seconds) {
long secondsByBit = 0;
for (int second : seconds) {
secondsByBit |= 1L << second;
}
if ((secondsByBit & LOW_60_BITS) == LOW_60_BITS) {
return Predicates.alwaysTrue();
}
final long bitField... | java |
public final boolean isExtendedMonth(YearMonth month) {
if (month != null) {
YearMonth extendedStart = getExtendedStartMonth();
if ((month.equals(extendedStart) || month.isAfter(extendedStart)) && month.isBefore(getStartMonth())) {
return true;
}
... | java |
public final boolean isVisibleDate(LocalDate date) {
if (date != null) {
YearMonth extendedStart = getExtendedStartMonth();
YearMonth extendedEnd = getExtendedEndMonth();
LocalDate startDate = extendedStart.atDay(1);
LocalDate endDate = extendedEnd.atEndOfMonth()... | java |
public static long secsSinceEpoch(DateValue date) {
long result = fixedFromGregorian(date) *
SECS_PER_DAY;
if (date instanceof TimeValue) {
TimeValue time = (TimeValue) date;
result +=
time.second() +
60 * (time.minu... | java |
public static DateValue toDateValue(DateValue dv) {
return (!(dv instanceof TimeValue) ? dv
: new DateValueImpl(dv.year(), dv.month(), dv.day()));
} | java |
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
} | java |
protected void updateStyles() {
DayEntryView view = getSkinnable();
Entry<?> entry = getEntry();
Calendar calendar = entry.getCalendar();
if (entry instanceof DraggedEntry) {
calendar = ((DraggedEntry) entry).getOriginalCalendar();
}
// when the entry gets r... | java |
protected Label createTitleLabel() {
Label label = new Label();
label.setWrapText(true);
label.setMinSize(0, 0);
return label;
} | java |
protected void updateLabels() {
Entry<?> entry = getEntry();
startTimeLabel.setText(formatTime(entry.getStartTime()));
titleLabel.setText(formatTitle(entry.getTitle()));
} | java |
static void rollToNextWeekStart(DTBuilder builder, Weekday wkst) {
DateValue bd = builder.toDate();
builder.day += (7 - ((7 + (Weekday.valueOf(bd).javaDayNum
- wkst.javaDayNum))
% 7)) % 7;
builder.normalize();
} | java |
static DateValue nextWeekStart(DateValue d, Weekday wkst) {
DTBuilder builder = new DTBuilder(d);
builder.day += (7 - ((7 + (Weekday.valueOf(d).javaDayNum
- wkst.javaDayNum)) % 7))
% 7;
return builder.toDate();
} | java |
static int[] uniquify(int[] ints, int start, int end) {
IntSet iset = new IntSet();
for (int i = end; --i >= start; ) {
iset.add(ints[i]);
}
return iset.toIntArray();
} | java |
static int dayNumToDate(Weekday dow0, int nDays, int weekNum,
Weekday dow, int d0, int nDaysInMonth) {
// if dow is wednesday, then this is the date of the first wednesday
int firstDateOfGivenDow = 1 + ((7 + dow.javaDayNum - dow0.javaDayNum) % 7);
int date;
i... | java |
static int invertWeekdayNum(
WeekdayNum weekdayNum, Weekday dow0, int nDays) {
assert weekdayNum.num < 0;
// how many are there of that week?
return countInPeriod(weekdayNum.wday, dow0, nDays) + weekdayNum.num + 1;
} | java |
static int countInPeriod(Weekday dow, Weekday dow0, int nDays) {
// Two cases
// (1a) dow >= dow0: count === (nDays - (dow - dow0)) / 7
// (1b) dow < dow0: count === (nDays - (7 - dow0 - dow)) / 7
if (dow.javaDayNum >= dow0.javaDayNum) {
return 1 + ((nDays - (dow.javaD... | java |
public List<Slice> getUnloadedSlices(List<Slice> slices) {
List<Slice> unloadedSlices = new ArrayList<>(slices);
unloadedSlices.removeAll(loadedSlices);
unloadedSlices.removeAll(inProgressSlices);
return unloadedSlices;
} | java |
public static RecurrenceIterator createRecurrenceIterator(
String rdata, DateValue dtStart, TimeZone tzid, boolean strict)
throws ParseException {
return createRecurrenceIterable(rdata, dtStart, tzid, strict).iterator();
} | java |
public static RecurrenceIterator createRecurrenceIterator(RDateList rdates) {
DateValue[] dates = rdates.getDatesUtc();
Arrays.sort(dates);
int k = 0;
for (int i = 1; i < dates.length; ++i) {
if (!dates[i].equals(dates[k])) {
dates[++k] = dates[i];
... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.