code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
static ThreadFactory createThreadFactoryBuilder(final String baseName, final String componentName) {
StringBuilder buf = new StringBuilder("ACP:");
if(!Strings.isNullOrEmpty(baseName)) {
buf.append(baseName).append(":").append(componentName);
} else {
buf.append(componentName);
... | java |
static final Set<String> uniquePrefixSet(final Config config) {
Set<String> prefixSet = Sets.newHashSet();
for(Map.Entry<String, ConfigValue> entry : config.entrySet()) {
String key = entry.getKey();
int index = key.indexOf('.');
if(index > 0) {
String prefix = key.su... | java |
static final ConnectionPoolSegment.Initializer segmentFromConfig(String poolName,
String segmentName,
final Config config,
... | java |
static Map<String, JDBConnection> connectionMapFromConfig(Config config) throws InitializationException {
final Config globalPropertyConfig;
if(config.hasPath("acp.property")) {
globalPropertyConfig = config.getObject("acp.property").toConfig();
} else if(config.hasPath("property")) {
... | java |
static JDBConnection createConnection(final String connectionName,
final Config baseConfig,
final Config globalPropertyConfig) throws InitializationException {
Config connectionRef = ConfigFactory.load().getObject("acp.defaults.con... | java |
static void initDrivers(final Config config) throws InitializationException {
for(String driverName : uniquePrefixSet(config)) {
Config driverConfig = config.getObject(driverName).toConfig();
if(driverConfig.hasPath("class")) {
String className = driverConfig.getString("class");
... | java |
private static String buildConnectionString(final String connectionString,
final Config config) {
if(config == null) {
return connectionString;
}
StringBuilder buf = new StringBuilder();
Iterator<Map.Entry<String, ConfigValue>> iter = con... | java |
final void logicalOpen() {
openTime = Clock.currTimeMillis;
transactionState = TransactionState.NONE;
if(debug) {
lastTrace = Util.getFilteredStack();
}
} | java |
final void logicalClose(final boolean withTest) throws SQLException {
openTime = 0L;
if(debug) {
lastTrace = null;
}
if(logicalCloseException != null) { //Set during close() & thrown here to cause segment to reopen.
Util.throwException(logicalCloseException);
}
... | java |
private boolean closeStatements() {
// JDBC API says...
// Calling the method close on a Statement object that is already closed has no effect.
// Note: When a Statement object is closed, its current ResultSet object, if one exists, is also closed.
boolean hasUnclosed = false;
if(openSt... | java |
private void setLogicalCloseException(final Throwable t) {
if(logicalCloseException == null) {
logicalCloseException = t;
} else if(!Util.isRuntimeError(logicalCloseException) && Util.isRuntimeError(t)) {
logicalCloseException = t;
}
} | java |
private void resolveIncompleteTransactions() throws SQLException {
switch(transactionState) {
case COMPLETED:
//All we know for certain is that at least one commit/rollback was called. Do nothing.
break;
case STARTED:
//At least one statement was created with... | java |
public final void closeUnmanagedConnection(final Connection conn) throws SQLException {
activeUnmanagedConnections.dec();
if(!conn.isClosed()) {
conn.close();
}
} | java |
final void signalActivateSegment() throws SQLException {
/*
Note that 'offer' does so only if it can be done
immediately without exceeding the queue capacity.
The queue capacity is '1', so this means that
signals may be ignored. Either way, this message
will never blo... | java |
public final void shutdownNow() {
if(isShuttingDown.compareAndSet(false, true)) {
logInfo("Shutting down...");
if(idleSegmentMonitorService != null) {
logInfo("Shutting down idle segment monitor service...");
idleSegmentMonitorService.shutdownNow();
}
... | java |
final String getConnectionDescription() {
if(datasource != null) {
return name;
}
String description = connectionString;
int index = connectionString != null ? connectionString.indexOf('?') : 0;
if(index > 0) {
description = connectionString.substring(0, index);
}... | java |
public static void doSetAscRecursively(ComparatorItem comparatorItem, boolean asc) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setAsc(asc);
tmp = tmp.getNextComparatorItem();
}
} | java |
public static void doSetIgnoreCaseRecursively(ComparatorItem comparatorItem, boolean ignoreCase) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setIgnoreCase(ignoreCase);
tmp = tmp.getNextComparatorItem();
}
} | java |
public static void doSetNullIsFirstRecursively(ComparatorItem comparatorItem,
boolean nullIsFirst) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setNullIsFirst(nullIsFirst);
tmp = tmp.getNextComparatorItem();
}
} | java |
public void addGlobalVarMaskRegex(VarMaskRegex varMaskRegex) {
// blank values are forbidden
if(StringUtils.isBlank(varMaskRegex.getRegex())) {
LOGGER.fine("addGlobalVarMaskRegex NOT adding null regex");
return;
}
getGlobalVarMaskRegexesList().add(varMaskRegex);
... | java |
@Restricted(NoExternalUse.class)
@VisibleForTesting
public final synchronized void reset() {
// Wipe the data
clear();
// default values for the first time the config is created
addMaskedPasswordParameterDefinition(hudson.model.PasswordParameterDefinition.class.getName()... | java |
public List<VarMaskRegex> getGlobalVarMaskRegexes() {
List<VarMaskRegex> r = new ArrayList<VarMaskRegex>(getGlobalVarMaskRegexesList().size());
// deep copy
for(VarMaskRegex varMaskRegex: getGlobalVarMaskRegexesList()) {
r.add((VarMaskRegex) varMaskRegex.clone());
}
... | java |
public boolean isMasked(final @CheckForNull ParameterValue value,
final @Nonnull String paramValueClassName) {
// We always mask sensitive variables, the configuration does not matter in such case
if (value != null && value.isSensitive()) {
return true;
}
... | java |
@Override
public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
URI uri = this.redirectStrategy.getLocationURI(request, response, context);
String resultingPageUrl = uri.toString();
DriverRequest driverRequest = ((OutgoingRequ... | java |
public boolean matches(String schemeParam, String hostParam, String uriParam) {
// If URI mapping enforce a host, ensure it is the one used.
if (this.host != null && !this.host.equalsIgnoreCase(schemeParam + "://" + hostParam)) {
return false;
}
if (this.extension != null &&... | java |
public void setAttribute(String id, Object obj, boolean save) {
if (save) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history == null) {
history = new LinkedList<>();
s... | java |
public Object removeAttribute(String id, boolean restore) {
Object value = removeAttribute(id);
if (restore) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history != null && !history.isEmpty()) ... | java |
public String rewriteReferer(String referer, String baseUrl, String visibleBaseUrl) {
URI uri = UriUtils.createURI(referer);
// Base url should end with /
if (!baseUrl.endsWith("/")) {
baseUrl = baseUrl + "/";
}
URI baseUri = UriUtils.createURI(baseUrl);
// ... | java |
public CharSequence rewriteHtml(CharSequence input, String requestUrl, String baseUrlParam, String visibleBaseUrl,
boolean absolute) {
StringBuffer result = new StringBuffer(input.length());
Matcher m = URL_PATTERN.matcher(input);
while (m.find()) {
String url = input.sub... | java |
public static String removeSimpleQuotes(String s) {
if (s.startsWith("'") && s.endsWith("'")) {
return s.substring(1, s.length() - 1);
}
return s;
} | java |
public static HttpHost getHost(HttpRequest request) {
HttpHost httpHost = UriUtils.extractHost(request.getRequestLine().getUri());
String scheme = httpHost.getSchemeName();
String host = httpHost.getHostName();
int port = httpHost.getPort();
Header[] headers = request.getHeaders(... | java |
private ClientExecChain addFetchEvent(final ClientExecChain wrapped) {
return new ClientExecChain() {
@Override
public CloseableHttpResponse execute(HttpRoute route, HttpRequestWrapper request,
HttpClientContext httpClientContext, HttpExecutionAware execAware) throws... | java |
@Override
public String getRemoteUser() {
String user = getHeader("X_REMOTE_USER");
if (user != null) {
return user;
} else {
return super.getRemoteUser();
}
} | java |
private void fixSurrogateMap(LinkedHashMap<String, List<String>> targetCapabilities, String currentSurrogate) {
boolean esiEnabledInEsigate = false;
// Check if Esigate will perform ESI.
for (String c : Esi.CAPABILITIES) {
if (targetCapabilities.get(currentSurrogate).contains(c)) {
... | java |
private void initSurrogateMap(Map<String, List<String>> targetCapabilities,
SurrogateCapabilitiesHeader surrogateCapabilitiesHeader) {
for (SurrogateCapabilities sc : surrogateCapabilitiesHeader.getSurrogates()) {
targetCapabilities.put(sc.getDeviceToken(), new ArrayList<String>());
... | java |
private String getFirstSurrogateFor(SurrogateCapabilitiesHeader surrogateCapabilitiesHeader, String capability) {
for (SurrogateCapabilities surrogate : surrogateCapabilitiesHeader.getSurrogates()) {
for (Capability sc : surrogate.getCapabilities()) {
if (capability.equals(sc.toStri... | java |
private static void processSurrogateControlContent(HttpResponse response, boolean keepHeader) {
if (!response.containsHeader(H_SURROGATE_CONTROL)) {
return;
}
if (!keepHeader) {
response.removeHeaders(H_SURROGATE_CONTROL);
return;
}
MoveRespo... | java |
private static Double getOperandAsNumeric(String op) {
Double d = null;
try {
d = Double.valueOf(op);
} catch (Exception e) {
// Null is returned if not numeric.
}
return d;
} | java |
public static Collection<String> getPropertyValue(Properties properties, String propertyName,
Collection<String> defaultValue) {
Collection<String> result = defaultValue;
String propertyValue = properties.getProperty(propertyName);
if (propertyValue != null) {
result = to... | java |
static Collection<String> toCollection(String list) {
Collection<String> result = new ArrayList<>();
if (list != null) {
String[] values = list.split(",");
for (String value : values) {
String trimmed = value.trim();
if (!trimmed.isEmpty()) {
... | java |
private static String cleanupStatusKey(String s) {
String result = s;
if (s.startsWith(PREFIX_CONTEXT)) {
result = s.substring(PREFIX_CONTEXT.length());
}
if (s.startsWith(PREFIX_THREAD_POOL)) {
result = s.substring(PREFIX_THREAD_POOL.length());
}
... | java |
private void stopServer() {
// Get current server
final Server targetServer = this.getServer();
// Start a new thread in order to escape the destruction of this Handler
// during the stop process.
new Thread() {
@Override
public void run() {
... | java |
private void instrument(String id, int port, MetricRegistry registry) {
this.setPort(port);
this.accepts = registry.meter(id + "-accepts");
this.connects = registry.meter(id + "-connects");
this.disconnects = registry.meter(id + "-disconnects");
this.connections = registry.counte... | java |
@Override
public CloseableHttpResponse execute(OutgoingRequest httpRequest) throws HttpErrorPage {
OutgoingRequestContext context = httpRequest.getContext();
IncomingRequest originalRequest = httpRequest.getOriginalRequest().getOriginalRequest();
if (cookieManager != null) {
Coo... | java |
public void init(Properties properties) {
staleIfError = Parameters.STALE_IF_ERROR.getValue(properties);
staleWhileRevalidate = Parameters.STALE_WHILE_REVALIDATE.getValue(properties);
int maxAsynchronousWorkers = Parameters.MAX_ASYNCHRONOUS_WORKERS.getValue(properties);
if (staleWhileRev... | java |
private static List<UriMapping> parseMappings(Properties props) {
List<UriMapping> mappings = new ArrayList<>();
Collection<String> mappingsParam = Parameters.MAPPINGS.getValue(props);
for (String mappingParam : mappingsParam) {
mappings.add(UriMapping.create(mappingParam));
... | java |
public static String encodeCookie(Cookie cookie) {
int maxAge = -1;
if (cookie.getExpiryDate() != null) {
maxAge = (int) ((cookie.getExpiryDate().getTime() - System.currentTimeMillis()) / ONE_SECOND);
// According to Cookie class specification, a negative value
// wou... | java |
public static <T extends Extension> T getExtension(Properties properties, Parameter<String> parameter, Driver d) {
T result;
String className = parameter.getValue(properties);
if (className == null) {
return null;
}
try {
if (LOG.isDebugEnabled()) {
... | java |
void characters(CharSequence csq, int start, int end) throws IOException {
getCurrent().characters(csq, start, end);
} | java |
private static int getProperty(String prefix, String name, int defaultValue) {
int result = defaultValue;
try {
result = Integer.parseInt(System.getProperty(prefix + name));
} catch (NumberFormatException e) {
LOG.warn("Value for " + prefix + name + " must be an integer.... | java |
private static String getProperty(String prefix, String name, String defaultValue) {
return System.getProperty(prefix + name, defaultValue);
} | java |
public static void init() {
// Get configuration
// Read from "server.properties" or custom file.
String configFile = null;
Properties serverProperties = new Properties();
try {
configFile = System.getProperty(PROPERTY_PREFIX + "config", "server.properties");
... | java |
public static void init(Properties configuration) {
for (Object prop : configuration.keySet()) {
String serverPropertyName = (String) prop;
System.setProperty(PROPERTY_PREFIX + serverPropertyName, configuration.getProperty(serverPropertyName));
}
// Read system properti... | java |
public static void main(String[] args) throws Exception {
if (args.length < 1) {
EsigateServer.usage();
return;
}
switch (args[0]) {
case "start":
EsigateServer.init();
EsigateServer.start();
break;
case "stop":
... | java |
public static void start() throws Exception {
MetricRegistry registry = new MetricRegistry();
QueuedThreadPool threadPool = new InstrumentedQueuedThreadPool(registry);
threadPool.setName("esigate");
threadPool.setMaxThreads(maxThreads);
threadPool.setMinThreads(minThreads);
... | java |
private static void usage() {
StringBuilder usageText = new StringBuilder();
usageText.append("Usage: java -D").append(PROPERTY_PREFIX)
.append("config=esigate.properties -jar esigate-server.jar [start|stop]\n\t");
usageText.append("start Start the server (default)\n\t");
... | java |
public static String encodeIllegalCharacters(String uri) {
StringBuilder result = new StringBuilder();
int length = uri.length();
for (int i = 0; i < length; i++) {
char character = uri.charAt(i);
if (character == '%') {
// Encode invalid escape sequences
... | java |
public static String createURI(final String scheme, final String host, int port, final String path,
final String query, final String fragment) {
StringBuilder buffer = new StringBuilder(Parameters.SMALL_BUFFER_SIZE);
if (host != null) {
if (scheme != null) {
buffe... | java |
public static String rewriteURI(String uri, HttpHost targetHost) {
try {
return URIUtils.rewriteURI(createURI(uri), targetHost).toString();
} catch (URISyntaxException e) {
throw new InvalidUriException(e);
}
} | java |
public static String removeSessionId(String sessionId, String page) {
String regexp = ";?jsessionid=" + Pattern.quote(sessionId);
return page.replaceAll(regexp, "");
} | java |
public static String removeQuerystring(String uriString) {
URI uri = createURI(uriString);
try {
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), null, null)
.toASCIIString();
} catch (URISyntaxException e) {
... | java |
public static String formatDate(Date date) {
return org.apache.http.client.utils.DateUtils.formatDate(date);
} | java |
static ElementAttributes createElementAttributes(String tag) {
// Parsing strings
// <!--$includetemplate$aggregated2$templatewithparams.jsp$-->
// or
// <!--$includeblock$aggregated2$$(block)$myblock$-->
// in order to retrieve driver, page and name attributes
Pattern pa... | java |
public boolean isTextContentType(HttpResponse httpResponse) {
String contentType = HttpResponseUtils.getFirstHeader(HttpHeaders.CONTENT_TYPE, httpResponse);
return isTextContentType(contentType);
} | java |
public boolean isTextContentType(String contentType) {
if (contentType != null) {
String lowerContentType = contentType.toLowerCase();
for (String textContentType : this.parsableContentTypes) {
if (lowerContentType.startsWith(textContentType)) {
return... | java |
public static void configure() {
InputStream inputStream = null;
try {
URL configUrl = getConfigUrl();
if (configUrl == null) {
throw new ConfigurationException("esigate.properties configuration file "
+ "was not found in the classpath");... | java |
public static void configure(Properties props) {
Properties defaultProperties = new Properties();
HashMap<String, Properties> driversProps = new HashMap<>();
for (Enumeration<?> enumeration = props.propertyNames(); enumeration.hasMoreElements();) {
String propertyName = (String) enu... | java |
static MatchedRequest selectProvider(IncomingRequest request) throws HttpErrorPage {
URI requestURI = UriUtils.createURI(request.getRequestLine().getUri());
String host = UriUtils.extractHost(requestURI).toHostString();
Header hostHeader = request.getFirstHeader(HttpHeaders.HOST);
if (ho... | java |
public static String replaceAllVariables(String strVars, DriverRequest request) {
String result = strVars;
if (VariablesResolver.containsVariable(strVars)) {
Matcher matcher = VAR_PATTERN.matcher(strVars);
while (matcher.find()) {
String group = matcher.group();
... | java |
public void register(EventDefinition eventDefinition, IEventListener listener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
register(listenersPost, eventDefinition, listener, true);
} else {
register(listeners, eventDefinition, listener, false);
}
} | java |
public void fire(EventDefinition eventDefinition, Event eventDetails) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
fire(listenersPost, eventDefinition, eventDetails);
} else {
fire(listeners, eventDefinition, eventDetails);
}
} | java |
public void unregister(EventDefinition eventDefinition, IEventListener eventListener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
unregister(listenersPost, eventDefinition, eventListener);
} else {
unregister(listeners, eventDefinition, eventListener);
... | java |
public static void moveHeader(HttpResponse response, String srcName, String targetName) {
if (response.containsHeader(srcName)) {
LOG.info("Moving header {} to {}", srcName, targetName);
Header[] headers = response.getHeaders(srcName);
response.removeHeaders(targetName);
... | java |
public CloseableHttpResponse render(String pageUrl, IncomingRequest incomingRequest, Renderer... renderers)
throws IOException, HttpErrorPage {
DriverRequest driverRequest = new DriverRequest(incomingRequest, this, pageUrl);
// Replace ESI variables in URL
// TODO: should be perform... | java |
public CloseableHttpResponse proxy(String relUrl, IncomingRequest incomingRequest, Renderer... renderers)
throws IOException, HttpErrorPage {
DriverRequest driverRequest = new DriverRequest(incomingRequest, this, relUrl);
driverRequest.setCharacterEncoding(this.config.getUriEncoding());
... | java |
public static String getFirstHeader(String headerName, HttpResponse httpResponse) {
Header header = httpResponse.getFirstHeader(headerName);
if (header != null) {
return header.getValue();
}
return null;
} | java |
public CloseableHttpResponse copyHeaders(OutgoingRequest outgoingRequest,
HttpEntityEnclosingRequest incomingRequest, HttpResponse httpClientResponse) {
HttpResponse result = new BasicHttpResponse(httpClientResponse.getStatusLine());
result.setEntity(httpClientResponse.getEntity());
... | java |
public void add(String toAdd) {
if (toAdd.contains("*")) {
set.clear();
defaultContains = true;
} else {
if (!defaultContains) {
set.add(toAdd);
} else {
set.remove(toAdd);
}
}
} | java |
public void remove(String toRemove) {
if (toRemove.contains("*")) {
set.clear();
defaultContains = false;
} else {
if (defaultContains) {
set.add(toRemove);
} else {
set.remove(toRemove);
}
}
} | java |
private void updateEndCountText() {
final String END_COUNT_MARKER = "%d";
String endString = mResources.getQuantityString(R.plurals.recurrence_end_count,
mModel.endCount);
int markerStart = endString.indexOf(END_COUNT_MARKER);
if (markerStart != -1) {
if (mar... | java |
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int itemIdx = -1;
for (int i = 0; i < 7; i++) {
if (itemIdx == -1 && buttonView == mWeekByDayButtons[i]) {
itemIdx = i;
mModel.weeklyByDayOfWeek[i] = isChecked;
... | java |
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.repeatMonthlyByNthDayOfMonth) {
mModel.monthlyRepeat = RecurrenceModel.MONTHLY_BY_DATE;
} else if (checkedId == R.id.repeatMonthlyByNthDayOfTheWeek) {
mModel.monthlyRepeat = Recurr... | java |
public static int calendarDay2Day(int day) {
switch (day) {
case Calendar.SUNDAY:
return SU;
case Calendar.MONDAY:
return MO;
case Calendar.TUESDAY:
return TU;
case Calendar.WEDNESDAY:
return WE;
... | java |
public void parse(String recur) {
/*
* From RFC 2445 section 4.3.10:
*
* recur = "FREQ"=freq *(
* ; either UNTIL or COUNT may appear in a 'recur',
* ; but UNTIL and COUNT MUST NOT occur in the same 'recur'
*
* ( ";" "UNTIL" "=" end... | java |
public static boolean compareCursors(Cursor c1, Cursor c2) {
if (c1 == null || c2 == null) {
return false;
}
int numColumns = c1.getColumnCount();
if (numColumns != c2.getColumnCount()) {
return false;
}
if (c1.getCount() != c2.getCount()) {
... | java |
public static int getFirstDayOfWeek(Context context) {
int startDay = Calendar.getInstance().getFirstDayOfWeek();
if (startDay == Calendar.SATURDAY) {
return Time.SATURDAY;
} else if (startDay == Calendar.MONDAY) {
return Time.MONDAY;
} else {
return ... | java |
public static int convertDayOfWeekFromTimeToCalendar(int timeDayOfWeek) {
switch (timeDayOfWeek) {
case Time.MONDAY:
return Calendar.MONDAY;
case Time.TUESDAY:
return Calendar.TUESDAY;
case Time.WEDNESDAY:
return Calendar.WEDNES... | java |
public static boolean isSaturday(int column, int firstDayOfWeek) {
return (firstDayOfWeek == Time.SUNDAY && column == 6)
|| (firstDayOfWeek == Time.MONDAY && column == 5)
|| (firstDayOfWeek == Time.SATURDAY && column == 0);
} | java |
public static boolean isSunday(int column, int firstDayOfWeek) {
return (firstDayOfWeek == Time.SUNDAY && column == 0)
|| (firstDayOfWeek == Time.MONDAY && column == 6)
|| (firstDayOfWeek == Time.SATURDAY && column == 1);
} | java |
public static long convertAlldayUtcToLocal(Time recycle, long utcTime, String tz) {
if (recycle == null) {
recycle = new Time();
}
recycle.timezone = Time.TIMEZONE_UTC;
recycle.set(utcTime);
recycle.timezone = tz;
return recycle.normalize(true);
} | java |
public static long getNextMidnight(Time recycle, long theTime, String tz) {
if (recycle == null) {
recycle = new Time();
}
recycle.timezone = tz;
recycle.set(theTime);
recycle.monthDay++;
recycle.hour = 0;
recycle.minute = 0;
recycle.second = 0... | java |
public static void checkForDuplicateNames(
Map<String, Boolean> isDuplicateName, Cursor cursor, int nameIndex) {
isDuplicateName.clear();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
String displayName = cursor.getString(nameIndex);
// Set it to tr... | java |
public static int getDisplayColorFromColor(int color) {
if (!isJellybeanOrLater()) {
return color;
}
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[1] = Math.min(hsv[1] * SATURATION_ADJUST, 1.0f);
hsv[2] = hsv[2] * INTENSITY_ADJUST;
ret... | java |
public static int getDeclinedColorFromColor(int color) {
int bg = 0xffffffff;
int a = DECLINED_EVENT_ALPHA;
int r = (((color & 0x00ff0000) * a) + ((bg & 0x00ff0000) * (0xff - a))) & 0xff000000;
int g = (((color & 0x0000ff00) * a) + ((bg & 0x0000ff00) * (0xff - a))) & 0x00ff0000;
... | java |
private static void weaveDNAStrands(LinkedList<DNASegment> segments, int firstJulianDay,
HashMap<Integer, DNAStrand> strands, int top, int bottom, int[] dayXs) {
// First, get rid of any colors that ended up with no segments
Iterator<DNAStrand> strandIterator = st... | java |
private static int getPixelOffsetFromMinutes(int minute, int workDayHeight,
int remainderHeight) {
int y;
if (minute < WORK_DAY_START_MINUTES) {
y = minute * remainderHeight / WORK_DAY_START_MINUTES;
} else if (minute < WORK_DAY_END_MI... | java |
private static DNAStrand getOrCreateStrand(HashMap<Integer, DNAStrand> strands, int color) {
DNAStrand strand = strands.get(color);
if (strand == null) {
strand = new DNAStrand();
strand.color = color;
strand.count = 0;
strands.put(strand.color, strand);
... | java |
public static void setUpSearchView(SearchView view, Activity act) {
SearchManager searchManager = (SearchManager) act.getSystemService(Context.SEARCH_SERVICE);
view.setSearchableInfo(searchManager.getSearchableInfo(act.getComponentName()));
view.setQueryRefinementEnabled(true);
} | java |
public static void setMidnightUpdater(Handler h, Runnable r, String timezone) {
if (h == null || r == null || timezone == null) {
return;
}
long now = System.currentTimeMillis();
Time time = new Time(timezone);
time.set(now);
long runInMillis = (24 * 3600 - ti... | java |
public static void resetMidnightUpdater(Handler h, Runnable r) {
if (h == null || r == null) {
return;
}
h.removeCallbacks(r);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.