8 Logistic Regression - Ex: Bronchopulmonary Dysplasia in Premature Infants
example walk through:
https://stats.idre.ucla.edu/r/dae/logit-regression/
info:
https://onlinecourses.science.psu.edu/stat504/node/216/
sjPlot::tab_model
(HTML only)
http://www.strengejacke.de/sjPlot/articles/sjtlm.html#changing-summary-style-and-content
finafit
https://www.r-bloggers.com/elegant-regression-results-tables-and-plots-in-r-the-finalfit-package/
Install a package Dr. Schwartz wrote:
::install_github("sarbearschwartz/texreghelpr") remotes
library(tidyverse)
library(haven) # read in SPSS dataset
library(furniture) # nice table1() descriptives
library(stargazer) # display nice tables: summary & regression
library(texreg) # Convert Regression Output to LaTeX or HTML tables
library(texreghelpr) # Dr. Schwartz's helper funtcions for texreg tables
library(psych) # contains some useful functions, like headTail
library(car) # Companion to Applied Regression
library(pscl) # psudo R-squared function
library(interactions) # interaction plots
library(sjPlot) # various plots
library(performance) # r-squared values
8.1 Background
Simple example demonstrating basic modeling approach: Data on Bronchopulmonary Dysplasia (BPD) from 223 low birth weight infants (weighing less than 1750 grams).
8.1.1 Source
Data courtesy of Dr. Linda Van Marter.
8.1.2 Reference
Van Marter, L.J., Leviton, A., Kuban, K.C.K., Pagano, M. & Allred, E.N. (1990). Maternal glucocorticoid therapy and reduced risk of bronchopulmonary dysplasia. Pediatrics, 86, 331-336.
The data are from a study of low birth weight infants in a neonatal intensive care unit. The study was designed to examine the development of bronchopulmonary dysplasia (BPD), a chronic lung disease, in a sample of 223 infants weighing less than 1750 grams. The response variable is binary, denoting whether an infant develops BPD by day 28 of life (where BPD is defined by both oxygen requirement and compatible chest radiograph).
8.1.3 Variables
bpd
0 = no, 1 = yes
brthwght
number of grams
gestage
number of weeks
toxemia
in mother, 0 = no, 1 = yes
<- read.table("https://raw.githubusercontent.com/CEHS-research/data/master/Regression/VanMarter_%20BPD.txt",
bpd_raw header = TRUE,
strip.white = TRUE)
<- nrow(bpd_raw)
n n
[1] 223
::glimpse(bpd_raw) tibble
Rows: 223
Columns: 4
$ bpd <int> 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0~
$ brthwght <int> 850, 1500, 1360, 960, 1560, 1120, 810, 1620, 1000, 700, 1330,~
$ gestage <int> 27, 33, 32, 35, 33, 29, 28, 32, 30, 26, 31, 31, 31, 29, 33, 3~
$ toxemia <int> 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
head(bpd_raw)
# A tibble: 6 x 4
bpd brthwght gestage toxemia
<int> <int> <int> <int>
1 1 850 27 0
2 0 1500 33 0
3 1 1360 32 0
4 0 960 35 1
5 0 1560 33 0
6 0 1120 29 0
Note: For logistic regression, you need to leave the outcome (dependent variable) coded as zeros
0
and ones1
and NOT apply lables. You do want to apply labels to factors that function as predictors (independent varaibles).
<- bpd_raw %>%
bpd_clean ::mutate(toxemia = factor(toxemia,
dplyrlevels = c(0, 1),
labels = c("No", "Yes")))
summary(bpd_clean)
bpd brthwght gestage toxemia
Min. :0.0000 Min. : 450 Min. :25.00 No :194
1st Qu.:0.0000 1st Qu.: 895 1st Qu.:28.00 Yes: 29
Median :0.0000 Median :1140 Median :30.00
Mean :0.3408 Mean :1173 Mean :30.09
3rd Qu.:1.0000 3rd Qu.:1465 3rd Qu.:32.00
Max. :1.0000 Max. :1730 Max. :37.00
8.2 Logistic Regresion: Fit the Model to the data
Instead of using the lm()
function from base R, you use glm()
. You also need to add an option to specify which generalization you want to use. To do logistic regression for a binary outcome, use family = binomial(link = "logit")
.
8.2.1 Null Model: no independent variables
<- glm(bpd ~ 1,
fit_glm_0 data = bpd_clean,
family = binomial(link = "logit"))
summary(fit_glm_0)
Call:
glm(formula = bpd ~ 1, family = binomial(link = "logit"), data = bpd_clean)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.913 -0.913 -0.913 1.467 1.467
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.6597 0.1413 -4.669 3.02e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 286.14 on 222 degrees of freedom
Residual deviance: 286.14 on 222 degrees of freedom
AIC: 288.14
Number of Fisher Scoring iterations: 4
8.2.2 Main Effects Model: add 3 predictors
Note: Since the unites of weight are so small, the estimated parameter will be super small. To offset the small units, we can re-scale the weights by dividing the grams by 100 to create “hectograms.”
<- glm(bpd ~ I(brthwght/100) + gestage + toxemia,
fit_glm_1 data = bpd_clean,
family = binomial(link = "logit"))
summary(fit_glm_1)
Call:
glm(formula = bpd ~ I(brthwght/100) + gestage + toxemia, family = binomial(link = "logit"),
data = bpd_clean)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.8400 -0.7029 -0.3352 0.7261 2.9902
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 13.93608 2.98255 4.673 2.98e-06 ***
I(brthwght/100) -0.26436 0.08123 -3.254 0.00114 **
gestage -0.38854 0.11489 -3.382 0.00072 ***
toxemiaYes -1.34379 0.60750 -2.212 0.02697 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 286.14 on 222 degrees of freedom
Residual deviance: 203.71 on 219 degrees of freedom
AIC: 211.71
Number of Fisher Scoring iterations: 5
8.3 Model Fit
8.3.1 Log Likelihood and Deviance
logLik(fit_glm_0) # Null Model
'log Lik.' -143.07 (df=1)
logLik(fit_glm_1) # Full Model
'log Lik.' -101.8538 (df=4)
Note: Deviance = -2 times the Log Likelihood
deviance(fit_glm_0) # Null Model
[1] 286.14
deviance(fit_glm_1) # Full Model
[1] 203.7075
8.3.2 AIC and BIC
AIC(fit_glm_0, fit_glm_1) # Full Model
# A tibble: 2 x 2
df AIC
<dbl> <dbl>
1 1 288.
2 4 212.
BIC(fit_glm_0, fit_glm_1) # Full Model
# A tibble: 2 x 2
df BIC
<dbl> <dbl>
1 1 292.
2 4 225.
8.4 Variance Explained
8.4.1 Many Options
Technically, \(R^2\) cannot be computed the same way in logistic regression as it is in OLS regression. There are several (over 10) alternatives that endever to calculate a similar metric in different ways.
Website: Statistical Horizons
Author: Paul Allison
Blog Post: What’s the Best R-Squared for Logistic Regression?
Compares and contrasts different options and his/our progression through them, in which he now prefers Tjur’s statistic (pronounced “choor”).
Great Quote: “For those who want an R^2 that behaves like a linear-model R^2, this is deeply unsettling.”
Note: Dr. Allison is very active at answering questions in the comments of this post.
Website: UCLA Institute for Digital Research and Education (IDRE)
Article: FAQ: WHAT ARE PSEUDO R-SQUAREDS?
Describes several of the most comment R-squared type measures for logistic regression (with Stata).
Website: The Stats Geek
Author: Jonathan Bartlett, Department of Mathematical Sciences, University of Bath and Associate Editor for the journal Biometrics
Blog Post: 2014: R squared in logistic regression
Focus on McFadden’s pseudo-R squared, in R.
8.4.2 McFadden’s pseud-R^2
McFadden’s \(pseudo-R^2\), in logistic regression, is defined as \(1−\frac{L_1}{L_0}\), where \(L_0\) represents the log likelihood for the “constant-only” or
\[ R^2_{McF} = 1 - \frac{L_1}{L_0} \]
<- 1 - (logLik(fit_glm_1)/logLik(fit_glm_0))
MFR2 MFR2
'log Lik.' 0.2880843 (df=4)
::r2_mcfadden(fit_glm_1) performance
# R2 for Generalized Linear Regression
R2: -0.996
adj. R2: -1.003
8.4.3 Cox & Snell
\(l = e^{L}\), since \(L\) is the log of the likelihood and \(l\) is the likelihood…\(log(l) = L\)
\[ R^2_{CS} = 1 - \Bigg( \frac{l_0}{l_1} \Bigg) ^{2 \backslash n} \\ n = \text{sample size} \]
<- 1 - (exp(logLik(fit_glm_0))/exp(logLik(fit_glm_1)))^(2/n)
CSR2 CSR2
'log Lik.' 0.3090253 (df=1)
::r2_coxsnell(fit_glm_1) performance
Cox & Snell's R2
0.3090253
8.4.4 Nagelkerke or Cragg and Uhler’s
\[ R^2_{Nag} = \frac{1 - \Bigg( \frac{l_0}{l_1} \Bigg) ^{2 \backslash n}} {1 - \Big( l_0 \Big) ^{2 \backslash n}} \]
<- CSR2 / (1 - exp(logLik(fit_glm_0))^(2/n))
NR2 NR2
'log Lik.' 0.4275191 (df=1)
::r2_nagelkerke(fit_glm_1) performance
Nagelkerke's R2
0.4275191
8.4.5 Tjur’s statistic
::r2(fit_glm_1) performance
# R2 for Logistic Regression
Tjur's R2: 0.346
8.4.6 Several at Once
the
pscl::pR2()
function
Outputs:
llh
The log-likelihood from the fitted modelllhNull
The log-likelihood from the intercept-only restricted modelG2
Minus two times the difference in the log-likelihoodsMcFadden
McFadden’s pseudo r-squaredr2ML
Maximum likelihood pseudo r-squaredr2CU
Cragg and Uhler’s pseudo r-squared
::pR2(fit_glm_1) pscl
fitting null model for pseudo-r2
llh llhNull G2 McFadden r2ML r2CU
-101.8537711 -143.0699809 82.4324196 0.2880843 0.3090253 0.4275191
8.5 Model Compairisons, Inferential
8.5.1 Likelihood Ratio Test (LRT, aka. Deviance Difference Test)
anova(fit_glm_0, fit_glm_1, test = "LRT")
# A tibble: 2 x 5
`Resid. Df` `Resid. Dev` Df Deviance `Pr(>Chi)`
<dbl> <dbl> <dbl> <dbl> <dbl>
1 222 286. NA NA NA
2 219 204. 3 82.4 9.23e-18
8.5.2 Bayes Factor and Performance Score
::compare_performance(fit_glm_0, fit_glm_1, rank = TRUE) performance
# A tibble: 2 x 12
Name Model AIC BIC R2_Tjur RMSE Sigma Log_loss Score_log Score_spherical
<chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 fit_glm_1 glm 212. 225. 0.346 0.380 0.964 0.457 -40.0 0.0196
2 fit_glm_0 glm 288. 292. 0 0.474 1.14 0.642 -30.4 0.0410
# ... with 2 more variables: PCP <dbl>, Performance_Score <dbl>
8.6 Parameter Estimates
8.6.1 Link: Logit Scale
%>% coef() fit_glm_1
(Intercept) I(brthwght/100) gestage toxemiaYes
13.9360826 -0.2643578 -0.3885357 -1.3437865
%>% confint() fit_glm_1
2.5 % 97.5 %
(Intercept) 8.3899004 20.1418979
I(brthwght/100) -0.4289642 -0.1089495
gestage -0.6252493 -0.1725921
toxemiaYes -2.6152602 -0.2133274
8.6.2 Exponentiate: Odds Ratio Scale
%>% coef() %>% exp() fit_glm_1
(Intercept) I(brthwght/100) gestage toxemiaYes
1.128142e+06 7.676988e-01 6.780490e-01 2.608561e-01
%>% confint() %>% exp() fit_glm_1
2.5 % 97.5 %
(Intercept) 4.402379e+03 5.591330e+08
I(brthwght/100) 6.511832e-01 8.967757e-01
gestage 5.351280e-01 8.414808e-01
toxemiaYes 7.314875e-02 8.078916e-01
8.7 Significance of Terms
8.7.1 Wald’s \(t\)-Test
%>% summary() %>% coef() fit_glm_1
Estimate Std. Error z value Pr(>|z|)
(Intercept) 13.9360826 2.98255085 4.672538 2.975003e-06
I(brthwght/100) -0.2643578 0.08123149 -3.254376 1.136419e-03
gestage -0.3885357 0.11489128 -3.381768 7.202086e-04
toxemiaYes -1.3437865 0.60750335 -2.211982 2.696791e-02
8.7.2 Single term deletion, \(\chi^2\) LRT
Note: Significance of each variable is assessed by comparing it to the model that drops just that one term (
type = 3
); order doesn’t matter.
drop1(fit_glm_1, type = 3, test = "LRT")
# A tibble: 4 x 5
Df Deviance AIC LRT `Pr(>Chi)`
<dbl> <dbl> <dbl> <dbl> <dbl>
1 NA 204. 212. NA NA
2 1 215. 221. 11.4 0.000744
3 1 217. 223. 13.1 0.000293
4 1 209. 215. 5.52 0.0188
8.7.3 Sequential addition, \(\chi^2\) LRT
Note: Signifcance of each additional variable at a time; ordered first to last
anova(fit_glm_1, test = "LRT")
# A tibble: 4 x 5
Df Deviance `Resid. Df` `Resid. Dev` `Pr(>Chi)`
<int> <dbl> <int> <dbl> <dbl>
1 NA NA 222 286. NA
2 1 62.4 221 224. 2.78e-15
3 1 14.5 220 209. 1.41e- 4
4 1 5.52 219 204. 1.88e- 2
8.8 Parameter Estimate Tables
8.8.1 Logit scale (Link, default)
::knitreg(fit_glm_1,
texregsingle.row = TRUE)
| Model 1 | |
|---|---|
| (Intercept) | 13.94 (2.98)*** |
| brthwght/100 | -0.26 (0.08)** |
| gestage | -0.39 (0.11)*** |
| toxemiaYes | -1.34 (0.61)* |
| AIC | 211.71 |
| BIC | 225.34 |
| Log Likelihood | -101.85 |
| Deviance | 203.71 |
| Num. obs. | 223 |
| p < 0.001; p < 0.01; p < 0.05 |
Note: You may request: Confidence Intervals on Logit scale with the options:
ci.force = TRUE, ci.test = 1
::knitreg(fit_glm_1,
texregsingle.row = TRUE,
ci.force = TRUE,
ci.test = 1,
digits = 6)
| Model 1 | |
|---|---|
| (Intercept) | 13.936083 [ 8.090390; 19.781775]* |
| brthwght/100 | -0.264358 [-0.423569; -0.105147]* |
| gestage | -0.388536 [-0.613718; -0.163353]* |
| toxemiaYes | -1.343786 [-2.534471; -0.153102]* |
| AIC | 211.707542 |
| BIC | 225.336229 |
| Log Likelihood | -101.853771 |
| Deviance | 203.707542 |
| Num. obs. | 223 |
| * 1 outside the confidence interval. |
8.8.2 Odds-Ratio Scale (exponentiate)
::knitreg(texreghelpr::extract_glm_exp(fit_glm_1),
texregsingle.row = TRUE)
| Model 1 | |
|---|---|
| (Intercept) | 1128141.99 [4402.38; 559132968.51]* |
| brthwght/100 | 0.77 [ 0.65; 0.90]* |
| gestage | 0.68 [ 0.54; 0.84]* |
| toxemiaYes | 0.26 [ 0.07; 0.81]* |
| * 0 outside the confidence interval. |
8.8.3 BOTH: Logit and Odds-Ratio
::knitreg(list(fit_glm_1,
texreg::extract_glm_exp(fit_glm_1,
texreghelprinclude.aic = FALSE,
include.bic = FALSE,
include.loglik = FALSE,
include.deviance = FALSE,
include.nobs = FALSE)),
custom.model.names = c("b (SE)",
"OR [95% CI]"),
single.row = TRUE,
ci.test = 1)
| b (SE) | OR [95% CI] | |
|---|---|---|
| (Intercept) | 13.94 (2.98)*** | 1128141.99 [4402.38; 559132968.51]* |
| brthwght/100 | -0.26 (0.08)** | 0.77 [ 0.65; 0.90]* |
| gestage | -0.39 (0.11)*** | 0.68 [ 0.54; 0.84]* |
| toxemiaYes | -1.34 (0.61)* | 0.26 [ 0.07; 0.81]* |
| AIC | 211.71 | |
| BIC | 225.34 | |
| Log Likelihood | -101.85 | |
| Deviance | 203.71 | |
| Num. obs. | 223 | |
| p < 0.001; p < 0.01; p < 0.05 (or Null hypothesis value outside the confidence interval). |
8.9 Marginal or Predicted Values
8.9.1 Across All Predictors
Note: By default it will select 5-6 “nice” values for each continuous variable. All levels of categorical factors will be included.
::Effect(focal.predictors = c("brthwght", "gestage", "toxemia"),
effectsmod = fit_glm_1)
brthwght*gestage*toxemia effect
, , toxemia = No
gestage
brthwght 25 28 31 34 37
450 0.9540464 0.8661657 0.66860145 0.38609882 0.163919741
770 0.8990883 0.7352702 0.46404255 0.21253946 0.077608513
1100 0.7883077 0.5372180 0.26571767 0.10137254 0.033971437
1400 0.6275409 0.3443597 0.14069462 0.04856170 0.015661772
1700 0.4325654 0.1920105 0.06897089 0.02257203 0.007147496
, , toxemia = Yes
gestage
brthwght 25 28 31 34 37
450 0.8441313 0.62800950 0.34481263 0.140937262 0.048654446
770 0.6991701 0.42012556 0.18424240 0.065775334 0.021476635
1100 0.4927426 0.23243034 0.08625483 0.028585525 0.009089901
1400 0.3053170 0.12049913 0.04096070 0.013139235 0.004133317
1700 0.1658709 0.05837137 0.01895794 0.005987954 0.001874370
8.9.2 Specify Some Predictors
Note: if a predictor is left off the
focal.predictors
, the predictions are AVERAGED over that variable.
::Effect(focal.predictors = c("brthwght", "gestage"),
effectsmod = fit_glm_1)
brthwght*gestage effect
gestage
brthwght 25 28 31 34 37
450 0.9457476 0.8445817 0.62880972 0.34558725 0.141352684
770 0.8820911 0.6998904 0.42096066 0.18475801 0.065986229
1100 0.7576801 0.4935992 0.23304229 0.08652530 0.028680839
1400 0.5858727 0.3060443 0.12086278 0.04109553 0.013183745
1700 0.3902779 0.1663456 0.05856001 0.01902178 0.006008386
::Effect(focal.predictors = c("brthwght", "toxemia"),
effectsmod = fit_glm_1)
brthwght*toxemia effect
toxemia
brthwght No Yes
450 0.74150653 0.42801049
770 0.55178083 0.24307063
1100 0.33972675 0.11833437
1400 0.18883689 0.05725008
1700 0.09529265 0.02674118
8.9.3 Set a constant (fixed) value for a predictor(s)
::Effect(focal.predictors = c("brthwght"),
effectsfixed.predictors = list(gestage = 34,
toxemia = "no"),
mod = fit_glm_1)
brthwght effect
brthwght
450 770 1100 1400 1700
0.70662760 0.50827827 0.30168968 0.16351033 0.08125536
8.9.4 Set values for a continuous predictor
::Effect(focal.predictors = c("brthwght", "gestage"),
effectsfixed.predictors = list(toxemia = "no"),
xlevels = list(gestage = c(24, 32, 36)),
mod = fit_glm_1)
brthwght*gestage effect
gestage
brthwght 24 32 36
450 0.9625602 0.53458922 0.195357871
770 0.9168973 0.33018096 0.094361297
1100 0.8217923 0.17083126 0.041730765
1400 0.6760033 0.08526886 0.019322688
1700 0.4856018 0.04046955 0.008836077
8.9.5 Add SE and 95% Confidence Interval
::Effect(focal.predictors = c("brthwght", "gestage", "toxemia"),
effectsxlevels = list(brthwght = c(500, 1000, 1500),
gestage = c(30, 36)),
mod = fit_glm_1) %>%
data.frame()
# A tibble: 12 x 7
brthwght gestage toxemia fit se lower upper
<dbl> <dbl> <fct> <dbl> <dbl> <dbl> <dbl>
1 500 30 No 0.723 0.109 0.474 0.883
2 1000 30 No 0.410 0.0523 0.313 0.515
3 1500 30 No 0.156 0.0475 0.0839 0.273
4 500 36 No 0.202 0.179 0.0281 0.690
5 1000 36 No 0.0633 0.0484 0.0135 0.251
6 1500 36 No 0.0177 0.0115 0.00492 0.0616
7 500 30 Yes 0.405 0.171 0.145 0.732
8 1000 30 Yes 0.154 0.0756 0.0548 0.362
9 1500 30 Yes 0.0461 0.0312 0.0119 0.162
10 500 36 Yes 0.0620 0.0701 0.00619 0.412
11 1000 36 Yes 0.0173 0.0168 0.00255 0.109
12 1500 36 Yes 0.00468 0.00422 0.000794 0.0270
8.10 Marginal Model Plots
8.10.1 Individual Marginal Plots for one IV, individually
The
sjPlot::plot_model()
function automatically transforms the predictions to the probability score when you include thetype = "pred"
option.
::plot_model(fit_glm_1,
sjPlottype = "pred")
$brthwght
$gestage
$toxemia
8.10.2 Combination Marginal Plots for two-three IVs, all at once
For continuous IV that are not on the x-axis (pred
), be default three values will be selected: the mean and plus-or-minus one stadard error for the mean (SEM).
The
outcome.scale = "link"
option plots the LOGIT scale on the y-axis.
::interact_plot(model = fit_glm_1,
interactionspred = brthwght,
modx = gestage,
mod2 = toxemia,
outcome.scale = "link")
Alternatively, you may use the modx.labels
option to set specific values at which to plot the moderator.
The
outcome.scale = "response"
option plots the PROBABILITY scale on the y-axis.
::interact_plot(model = fit_glm_1,
interactionspred = brthwght,
modx = gestage,
modx.labels = c(28, 32, 36),
mod2 = toxemia,
outcome.scale = "response")
You can always do more work to get to a PUBLISH-ABLE version
::interact_plot(model = fit_glm_1,
interactionspred = brthwght,
modx = gestage,
modx.labels = c(28, 30, 32),
mod2 = toxemia,
outcome.scale = "response",
x.label = "Birthweight, grams",
y.label = "Probability of Bronchopulmonary Dysplasia",
legend.main = "Gestational Age, weeks",
mod2.label = c("Mother does NOT have Toxemia",
"Mother DOES have Toxemia"),
colors = rep("black", 3)) +
geom_hline(yintercept = .5, alpha = .2) +
theme_bw() +
theme(legend.background = element_rect(color = "black"),
legend.position = c(1, 1),
legend.justification = c(1.1, 1.1),
legend.key.width = unit(2, "cm"))
8.10.3 Total Control is also available
::Effect(focal.predictors = c("brthwght", "toxemia", "gestage"),
effectsmod = fit_glm_1,
xlevels = list(brthwght = seq(from = 450, to = 1730, by = 10),
gestage = c(28, 32, 36))) %>%
data.frame() %>%
::mutate(gestage = factor(gestage)) %>%
dplyrggplot(aes(x = brthwght,
y = fit)) +
geom_ribbon(aes(ymin = lower,
ymax = upper,
fill = toxemia),
alpha = .2) +
geom_line(aes(linetype = toxemia,
color = toxemia),
size = 1) +
facet_grid(. ~ gestage, labeller = label_both) +
theme_bw()
::Effect(focal.predictors = c("brthwght", "toxemia", "gestage"),
effectsmod = fit_glm_1,
xlevels = list(brthwght = seq(from = 450, to = 1730, by = 10),
gestage = c(28, 32, 36))) %>%
data.frame() %>%
::mutate(gestage = factor(gestage)) %>%
dplyrggplot(aes(x = brthwght,
y = fit)) +
geom_line(aes(linetype = toxemia,
color = toxemia),
size = 1) +
facet_grid(. ~ gestage, labeller = label_both) +
theme_bw()


Javalanche report for class:
org.joda.time.field.BaseDateTimeField
1: /*
2: * Copyright 2001-2005 Stephen Colebourne
3: *
4: * Licensed under the Apache License, Version 2.0 (the "License");
5: * you may not use this file except in compliance with the License.
6: * You may obtain a copy of the License at
7: *
8: * http://www.apache.org/licenses/LICENSE-2.0
9: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.joda.time.field;
17:
18: import java.util.Locale;
19:
20: import org.joda.time.DateTimeField;
21: import org.joda.time.DateTimeFieldType;
22: import org.joda.time.DurationField;
23: import org.joda.time.IllegalFieldValueException;
24: import org.joda.time.ReadablePartial;
25:
26: /**
27: * BaseDateTimeField provides the common behaviour for DateTimeField
28: * implementations.
29: *

30: * This class should generally not be used directly by API users. The
31: * DateTimeField class should be used when different kinds of DateTimeField
32: * objects are to be referenced.
33: *

34: * BaseDateTimeField is thread-safe and immutable, and its subclasses must
35: * be as well.
36: *
37: * @author Brian S O'Neill
38: * @since 1.0
39: * @see DecoratedDateTimeField
40: */
41: public abstract class BaseDateTimeField extends DateTimeField {
42:
43: /** The field type. */
44: private final DateTimeFieldType iType;
45:
46: /**
47: * Constructor.
48: */
49: protected BaseDateTimeField(DateTimeFieldType type) {
50: super();
51: if (type == null) {
52: throw new IllegalArgumentException("The type must not be null");
53: }
54: iType = type;
55: }
56:
57: public final DateTimeFieldType getType() {
58: return iType;
59: }
60:
61: public final String getName() {
62: return iType.getName();
63: }
64:
65: /**
66: * @return true always
67: */
68: public final boolean isSupported() {
69: return true;
70: }
71:
72: // Main access API
73: //------------------------------------------------------------------------
74: /**
75: * Get the value of this field from the milliseconds.
76: *
77: * @param instant the milliseconds from 1970-01-01T00:00:00Z to query
78: * @return the value of the field, in the units of the field
79: */
80: public abstract int get(long instant);
81:
82: //-----------------------------------------------------------------------
83: /**
84: * Get the human-readable, text value of this field from the milliseconds.
85: * If the specified locale is null, the default locale is used.
86: *

87: * The default implementation returns getAsText(get(instant), locale).
88: *
89: * @param instant the milliseconds from 1970-01-01T00:00:00Z to query
90: * @param locale the locale to use for selecting a text symbol, null means default
91: * @return the text value of the field
92: */
93: public String getAsText(long instant, Locale locale) {
94: return getAsText(get(instant), locale);
95: }
96:
97: /**
98: * Get the human-readable, text value of this field from the milliseconds.
99: *

100: * The default implementation calls {@link #getAsText(long, Locale)}.
101: *
102: * @param instant the milliseconds from 1970-01-01T00:00:00Z to query
103: * @return the text value of the field
104: */
105: public final String getAsText(long instant) {
106: return getAsText(instant, null);
107: }
108:
109: /**
110: * Get the human-readable, text value of this field from a partial instant.
111: * If the specified locale is null, the default locale is used.
112: *

113: * The default implementation returns getAsText(fieldValue, locale).
114: *
115: * @param partial the partial instant to query
116: * @param fieldValue the field value of this field, provided for performance
117: * @param locale the locale to use for selecting a text symbol, null for default
118: * @return the text value of the field
119: */
120: public String getAsText(ReadablePartial partial, int fieldValue, Locale locale) {
121: return getAsText(fieldValue, locale);
122: }
123:
124: /**
125: * Get the human-readable, text value of this field from a partial instant.
126: * If the specified locale is null, the default locale is used.
127: *

128: * The default implementation calls {@link ReadablePartial#get(DateTimeFieldType)}
129: * and {@link #getAsText(ReadablePartial, int, Locale)}.
130: *
131: * @param partial the partial instant to query
132: * @param locale the locale to use for selecting a text symbol, null for default
133: * @return the text value of the field
134: */
135: public final String getAsText(ReadablePartial partial, Locale locale) {
136: return getAsText(partial, partial.get(getType()), locale);
137: }
138:
139: /**
140: * Get the human-readable, text value of this field from the field value.
141: * If the specified locale is null, the default locale is used.
142: *

143: * The default implementation returns Integer.toString(get(instant)).
144: *

145: * Note: subclasses that override this method should also override
146: * getMaximumTextLength.
147: *
148: * @param fieldValue the numeric value to convert to text
149: * @param locale the locale to use for selecting a text symbol, null for default
150: * @return the text value of the field
151: */
152: public String getAsText(int fieldValue, Locale locale) {
153: return Integer.toString(fieldValue);
154: }
155:
156: //-----------------------------------------------------------------------
157: /**
158: * Get the human-readable, short text value of this field from the milliseconds.
159: * If the specified locale is null, the default locale is used.
160: *

161: * The default implementation returns getAsShortText(get(instant), locale).
162: *
163: * @param instant the milliseconds from 1970-01-01T00:00:00Z to query
164: * @param locale the locale to use for selecting a text symbol, null means default
165: * @return the text value of the field
166: */
167: public String getAsShortText(long instant, Locale locale) {
168: return getAsShortText(get(instant), locale);
169: }
170:
171: /**
172: * Get the human-readable, short text value of this field from the milliseconds.
173: *

174: * The default implementation calls {@link #getAsShortText(long, Locale)}.
175: *
176: * @param instant the milliseconds from 1970-01-01T00:00:00Z to query
177: * @return the text value of the field
178: */
179: public final String getAsShortText(long instant) {
180: return getAsShortText(instant, null);
181: }
182:
183: /**
184: * Get the human-readable, short text value of this field from a partial instant.
185: * If the specified locale is null, the default locale is used.
186: *

187: * The default implementation returns getAsShortText(fieldValue, locale).
188: *
189: * @param partial the partial instant to query
190: * @param fieldValue the field value of this field, provided for performance
191: * @param locale the locale to use for selecting a text symbol, null for default
192: * @return the text value of the field
193: */
194: public String getAsShortText(ReadablePartial partial, int fieldValue, Locale locale) {
195: return getAsShortText(fieldValue, locale);
196: }
197:
198: /**
199: * Get the human-readable, short text value of this field from a partial instant.
200: * If the specified locale is null, the default locale is used.
201: *

202: * The default implementation calls {@link ReadablePartial#get(DateTimeFieldType)}
203: * and {@link #getAsText(ReadablePartial, int, Locale)}.
204: *
205: * @param partial the partial instant to query
206: * @param locale the locale to use for selecting a text symbol, null for default
207: * @return the text value of the field
208: */
209: public final String getAsShortText(ReadablePartial partial, Locale locale) {
210: return getAsShortText(partial, partial.get(getType()), locale);
211: }
212:
213: /**
214: * Get the human-readable, short text value of this field from the field value.
215: * If the specified locale is null, the default locale is used.
216: *

217: * The default implementation returns getAsText(fieldValue, locale).
218: *

219: * Note: subclasses that override this method should also override
220: * getMaximumShortTextLength.
221: *
222: * @param fieldValue the numeric value to convert to text
223: * @param locale the locale to use for selecting a text symbol, null for default
224: * @return the text value of the field
225: */
226: public String getAsShortText(int fieldValue, Locale locale) {
227: return getAsText(fieldValue, locale);
228: }
229:
230: //-----------------------------------------------------------------------
231: /**
232: * Adds a value (which may be negative) to the instant value,
233: * overflowing into larger fields if necessary.
234: *

235: * The value will be added to this field. If the value is too large to be
236: * added solely to this field, larger fields will increase as required.
237: * Smaller fields should be unaffected, except where the result would be
238: * an invalid value for a smaller field. In this case the smaller field is
239: * adjusted to be in range.
240: *

241: * For example, in the ISO chronology:

242: * 2000-08-20 add six months is 2001-02-20

243: * 2000-08-20 add twenty months is 2002-04-20

244: * 2000-08-20 add minus nine months is 1999-11-20

245: * 2001-01-31 add one month is 2001-02-28

246: * 2001-01-31 add two months is 2001-03-31

247: *
248: * @param instant the milliseconds from 1970-01-01T00:00:00Z to add to
249: * @param value the value to add, in the units of the field
250: * @return the updated milliseconds
251: */
252: public long add(long instant, int value) {
253: return getDurationField().add(instant, value);
254: }
255:
256: /**
257: * Adds a value (which may be negative) to the instant value,
258: * overflowing into larger fields if necessary.
259: *
260: * @param instant the milliseconds from 1970-01-01T00:00:00Z to add to
261: * @param value the long value to add, in the units of the field
262: * @return the updated milliseconds
263: * @throws IllegalArgumentException if value is too large
264: * @see #add(long,int)
265: */
266: public long add(long instant, long value) {
267: return getDurationField().add(instant, value);
268: }
269:
270: /**
271: * Adds a value (which may be negative) to the partial instant,
272: * throwing an exception if the maximum size of the instant is reached.
273: *

274: * The value will be added to this field, overflowing into larger fields
275: * if necessary. Smaller fields should be unaffected, except where the
276: * result would be an invalid value for a smaller field. In this case the
277: * smaller field is adjusted to be in range.
278: *

279: * Partial instants only contain some fields. This may result in a maximum
280: * possible value, such as TimeOfDay being limited to 23:59:59:999. If this
281: * limit is breached by the add an exception is thrown.
282: *

283: * For example, in the ISO chronology:

284: * 2000-08-20 add six months is 2000-02-20

285: * 2000-08-20 add twenty months is 2000-04-20

286: * 2000-08-20 add minus nine months is 2000-11-20

287: * 2001-01-31 add one month is 2001-02-28

288: * 2001-01-31 add two months is 2001-03-31

289: *
290: * @param instant the partial instant
291: * @param fieldIndex the index of this field in the partial
292: * @param values the values of the partial instant which should be updated
293: * @param valueToAdd the value to add, in the units of the field
294: * @return the passed in values
295: * @throws IllegalArgumentException if the value is invalid or the maximum instant is reached
296: */
297: public int[] add(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) {
298: if (valueToAdd == 0) {
299: return values;
300: }
301: // there are more efficient algorithms than this (especially for time only fields)
302: // trouble is when dealing with days and months, so we use this technique of
303: // adding/removing one from the larger field at a time
304: DateTimeField nextField = null;
305:
306: while (valueToAdd > 0) {
307: int max = getMaximumValue(instant, values);
308: long proposed = values[fieldIndex] + valueToAdd;
309: if (proposed <= max) {
310: values[fieldIndex] = (int) proposed;
311: break;
312: }
313: if (nextField == null) {
314: if (fieldIndex == 0) {
315: throw new IllegalArgumentException("Maximum value exceeded for add");
316: }
317: nextField = instant.getField(fieldIndex - 1);
318: // test only works if this field is UTC (ie. local)
319: if (getRangeDurationField().getType() != nextField.getDurationField().getType()) {
320: throw new IllegalArgumentException("Fields invalid for add");
321: }
322: }
323: valueToAdd -= (max + 1) - values[fieldIndex]; // reduce the amount to add
324: values = nextField.add(instant, fieldIndex - 1, values, 1); // add 1 to next bigger field
325: values[fieldIndex] = getMinimumValue(instant, values); // reset this field to zero
326: }
327: while (valueToAdd < 0) {
328: int min = getMinimumValue(instant, values);
329: long proposed = values[fieldIndex] + valueToAdd;
330: if (proposed >= min) {
331: values[fieldIndex] = (int) proposed;
332: break;
333: }
334: if (nextField == null) {
335: if (fieldIndex == 0) {
336: throw new IllegalArgumentException("Maximum value exceeded for add");
337: }
338: nextField = instant.getField(fieldIndex - 1);
339: if (getRangeDurationField().getType() != nextField.getDurationField().getType()) {
340: throw new IllegalArgumentException("Fields invalid for add");
341: }
342: }
343: valueToAdd -= (min - 1) - values[fieldIndex]; // reduce the amount to add
344: values = nextField.add(instant, fieldIndex - 1, values, -1); // subtract 1 from next bigger field
345: values[fieldIndex] = getMaximumValue(instant, values); // reset this field to max value
346: }
347:
348: return set(instant, fieldIndex, values, values[fieldIndex]); // adjusts smaller fields
349: }
350:
351: /**
352: * Adds a value (which may be negative) to the partial instant,
353: * wrapping the whole partial if the maximum size of the partial is reached.
354: *

355: * The value will be added to this field, overflowing into larger fields
356: * if necessary. Smaller fields should be unaffected, except where the
357: * result would be an invalid value for a smaller field. In this case the
358: * smaller field is adjusted to be in range.
359: *

360: * Partial instants only contain some fields. This may result in a maximum
361: * possible value, such as TimeOfDay normally being limited to 23:59:59:999.
362: * If ths limit is reached by the addition, this method will wrap back to
363: * 00:00:00.000. In fact, you would generally only use this method for
364: * classes that have a limitation such as this.
365: *

366: * For example, in the ISO chronology:

367: * 10:20:30 add 20 minutes is 10:40:30

368: * 10:20:30 add 45 minutes is 11:05:30

369: * 10:20:30 add 16 hours is 02:20:30

370: *
371: * @param instant the partial instant
372: * @param fieldIndex the index of this field in the partial
373: * @param values the values of the partial instant which should be updated
374: * @param valueToAdd the value to add, in the units of the field
375: * @return the passed in values
376: * @throws IllegalArgumentException if the value is invalid or the maximum instant is reached
377: */
378: public int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) {
379: if (valueToAdd == 0) {
380: return values;
381: }
382: // there are more efficient algorithms than this (especially for time only fields)
383: // trouble is when dealing with days and months, so we use this technique of
384: // adding/removing one from the larger field at a time
385: DateTimeField nextField = null;
386:
387: while (valueToAdd > 0) {
388: int max = getMaximumValue(instant, values);
389: long proposed = values[fieldIndex] + valueToAdd;
390: if (proposed <= max) {
391: values[fieldIndex] = (int) proposed;
392: break;
393: }
394: if (nextField == null) {
395: if (fieldIndex == 0) {
396: valueToAdd -= (max + 1) - values[fieldIndex];
397: values[fieldIndex] = getMinimumValue(instant, values);
398: continue;
399: }
400: nextField = instant.getField(fieldIndex - 1);
401: // test only works if this field is UTC (ie. local)
402: if (getRangeDurationField().getType() != nextField.getDurationField().getType()) {
403: throw new IllegalArgumentException("Fields invalid for add");
404: }
405: }
406: valueToAdd -= (max + 1) - values[fieldIndex]; // reduce the amount to add
407: values = nextField.addWrapPartial(instant, fieldIndex - 1, values, 1); // add 1 to next bigger field
408: values[fieldIndex] = getMinimumValue(instant, values); // reset this field to zero
409: }
410: while (valueToAdd < 0) {
411: int min = getMinimumValue(instant, values);
412: long proposed = values[fieldIndex] + valueToAdd;
413: if (proposed >= min) {
414: values[fieldIndex] = (int) proposed;
415: break;
416: }
417: if (nextField == null) {
418: if (fieldIndex == 0) {
419: valueToAdd -= (min - 1) - values[fieldIndex];
420: values[fieldIndex] = getMaximumValue(instant, values);
421: continue;
422: }
423: nextField = instant.getField(fieldIndex - 1);
424: if (getRangeDurationField().getType() != nextField.getDurationField().getType()) {
425: throw new IllegalArgumentException("Fields invalid for add");
426: }
427: }
428: valueToAdd -= (min - 1) - values[fieldIndex]; // reduce the amount to add
429: values = nextField.addWrapPartial(instant, fieldIndex - 1, values, -1); // subtract 1 from next bigger field
430: values[fieldIndex] = getMaximumValue(instant, values); // reset this field to max value
431: }
432:
433: return set(instant, fieldIndex, values, values[fieldIndex]); // adjusts smaller fields
434: }
435:
436: /**
437: * Adds a value (which may be negative) to the instant value,
438: * wrapping within this field.
439: *

440: * The value will be added to this field. If the value is too large to be
441: * added solely to this field then it wraps. Larger fields are always
442: * unaffected. Smaller fields should be unaffected, except where the
443: * result would be an invalid value for a smaller field. In this case the
444: * smaller field is adjusted to be in range.
445: *

446: * For example, in the ISO chronology:

447: * 2000-08-20 addWrapField six months is 2000-02-20

448: * 2000-08-20 addWrapField twenty months is 2000-04-20

449: * 2000-08-20 addWrapField minus nine months is 2000-11-20

450: * 2001-01-31 addWrapField one month is 2001-02-28

451: * 2001-01-31 addWrapField two months is 2001-03-31

452: *

453: * The default implementation internally calls set. Subclasses are
454: * encouraged to provide a more efficient implementation.
455: *
456: * @param instant the milliseconds from 1970-01-01T00:00:00Z to add to
457: * @param value the value to add, in the units of the field
458: * @return the updated milliseconds
459: */
460: public long addWrapField(long instant, int value) {
461: int current = get(instant);
462: int wrapped = FieldUtils.getWrappedValue
463: (current, value, getMinimumValue(instant), getMaximumValue(instant));
464: return set(instant, wrapped);
465: }
466:
467: /**
468: * Adds a value (which may be negative) to the partial instant,
469: * wrapping within this field.
470: *

471: * The value will be added to this field. If the value is too large to be
472: * added solely to this field then it wraps. Larger fields are always
473: * unaffected. Smaller fields should be unaffected, except where the
474: * result would be an invalid value for a smaller field. In this case the
475: * smaller field is adjusted to be in range.
476: *

477: * For example, in the ISO chronology:

478: * 2000-08-20 addWrapField six months is 2000-02-20

479: * 2000-08-20 addWrapField twenty months is 2000-04-20

480: * 2000-08-20 addWrapField minus nine months is 2000-11-20

481: * 2001-01-31 addWrapField one month is 2001-02-28

482: * 2001-01-31 addWrapField two months is 2001-03-31

483: *

484: * The default implementation internally calls set. Subclasses are
485: * encouraged to provide a more efficient implementation.
486: *
487: * @param instant the partial instant
488: * @param fieldIndex the index of this field in the instant
489: * @param values the values of the partial instant which should be updated
490: * @param valueToAdd the value to add, in the units of the field
491: * @return the passed in values
492: * @throws IllegalArgumentException if the value is invalid
493: */
494: public int[] addWrapField(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) {
495: int current = values[fieldIndex];
496: int wrapped = FieldUtils.getWrappedValue
497: (current, valueToAdd, getMinimumValue(instant), getMaximumValue(instant));
498: return set(instant, fieldIndex, values, wrapped); // adjusts smaller fields
499: }
500:
501: //-----------------------------------------------------------------------
502: /**
503: * Computes the difference between two instants, as measured in the units
504: * of this field. Any fractional units are dropped from the result. Calling
505: * getDifference reverses the effect of calling add. In the following code:
506: *
507: *

508: * long instant = ...
509: * int v = ...
510: * int age = getDifference(add(instant, v), instant);
511: *

512: *
513: * The value 'age' is the same as the value 'v'.
514: *
515: * @param minuendInstant the milliseconds from 1970-01-01T00:00:00Z to
516: * subtract from
517: * @param subtrahendInstant the milliseconds from 1970-01-01T00:00:00Z to
518: * subtract off the minuend
519: * @return the difference in the units of this field
520: */
521: public int getDifference(long minuendInstant, long subtrahendInstant) {
522: return getDurationField().getDifference(minuendInstant, subtrahendInstant);
523: }
524:
525: /**
526: * Computes the difference between two instants, as measured in the units
527: * of this field. Any fractional units are dropped from the result. Calling
528: * getDifference reverses the effect of calling add. In the following code:
529: *
530: *

531: * long instant = ...
532: * long v = ...
533: * long age = getDifferenceAsLong(add(instant, v), instant);
534: *

535: *
536: * The value 'age' is the same as the value 'v'.
537: *
538: * @param minuendInstant the milliseconds from 1970-01-01T00:00:00Z to
539: * subtract from
540: * @param subtrahendInstant the milliseconds from 1970-01-01T00:00:00Z to
541: * subtract off the minuend
542: * @return the difference in the units of this field
543: */
544: public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) {
545: return getDurationField().getDifferenceAsLong(minuendInstant, subtrahendInstant);
546: }
547:
548: /**
549: * Sets a value in the milliseconds supplied.
550: *

551: * The value of this field will be set.
552: * If the value is invalid, an exception if thrown.
553: *

554: * If setting this field would make other fields invalid, then those fields
555: * may be changed. For example if the current date is the 31st January, and
556: * the month is set to February, the day would be invalid. Instead, the day
557: * would be changed to the closest value - the 28th/29th February as appropriate.
558: *
559: * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in
560: * @param value the value to set, in the units of the field
561: * @return the updated milliseconds
562: * @throws IllegalArgumentException if the value is invalid
563: */
564: public abstract long set(long instant, int value);
565:
566: /**
567: * Sets a value using the specified partial instant.
568: *

569: * The value of this field (specified by the index) will be set.
570: * If the value is invalid, an exception if thrown.
571: *

572: * If setting this field would make other fields invalid, then those fields
573: * may be changed. For example if the current date is the 31st January, and
574: * the month is set to February, the day would be invalid. Instead, the day
575: * would be changed to the closest value - the 28th/29th February as appropriate.
576: *
577: * @param partial the partial instant
578: * @param fieldIndex the index of this field in the instant
579: * @param values the values to update
580: * @param newValue the value to set, in the units of the field
581: * @return the updated values
582: * @throws IllegalArgumentException if the value is invalid
583: */
584: public int[] set(ReadablePartial partial, int fieldIndex, int[] values, int newValue) {
585: FieldUtils.verifyValueBounds(this, newValue, getMinimumValue(partial, values), getMaximumValue(partial, values));
586: values[fieldIndex] = newValue;
587:
588: // may need to adjust smaller fields
589: for (int i = fieldIndex + 1; i < partial.size(); i++) {
590: DateTimeField field = partial.getField(i);
591: if (values[i] > field.getMaximumValue(partial, values)) {
592: values[i] = field.getMaximumValue(partial, values);
593: }
594: if (values[i] < field.getMinimumValue(partial, values)) {
595: values[i] = field.getMinimumValue(partial, values);
596: }
597: }
598: return values;
599: }
600:
601: /**
602: * Sets a value in the milliseconds supplied from a human-readable, text value.
603: * If the specified locale is null, the default locale is used.
604: *

605: * This implementation uses convertText(String, Locale) and
606: * {@link #set(long, int)}.
607: *

608: * Note: subclasses that override this method should also override
609: * getAsText.
610: *
611: * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in
612: * @param text the text value to set
613: * @param locale the locale to use for selecting a text symbol, null for default
614: * @return the updated milliseconds
615: * @throws IllegalArgumentException if the text value is invalid
616: */
617: public long set(long instant, String text, Locale locale) {
618: int value = convertText(text, locale);
619: return set(instant, value);
620: }
621:
622: /**
623: * Sets a value in the milliseconds supplied from a human-readable, text value.
624: *

625: * This implementation uses {@link #set(long, String, Locale)}.
626: *

627: * Note: subclasses that override this method should also override getAsText.
628: *
629: * @param instant the milliseconds from 1970-01-01T00:00:00Z to set in
630: * @param text the text value to set
631: * @return the updated milliseconds
632: * @throws IllegalArgumentException if the text value is invalid
633: */
634: public final long set(long instant, String text) {
635: return set(instant, text, null);
636: }
637:
638: /**
639: * Sets a value in the milliseconds supplied from a human-readable, text value.
640: * If the specified locale is null, the default locale is used.
641: *

642: * This implementation uses convertText(String, Locale) and
643: * {@link #set(ReadablePartial, int, int[], int)}.
644: *
645: * @param instant the partial instant
646: * @param fieldIndex the index of this field in the instant
647: * @param values the values of the partial instant which should be updated
648: * @param text the text value to set
649: * @param locale the locale to use for selecting a text symbol, null for default
650: * @return the passed in values
651: * @throws IllegalArgumentException if the text value is invalid
652: */
653: public int[] set(ReadablePartial instant, int fieldIndex, int[] values, String text, Locale locale) {
654: int value = convertText(text, locale);
655: return set(instant, fieldIndex, values, value);
656: }
657:
658: /**
659: * Convert the specified text and locale into a value.
660: *
661: * @param text the text to convert
662: * @param locale the locale to convert using
663: * @return the value extracted from the text
664: * @throws IllegalArgumentException if the text is invalid
665: */
666: protected int convertText(String text, Locale locale) {
667: try {
668: return Integer.parseInt(text);
669: } catch (NumberFormatException ex) {
670: throw new IllegalFieldValueException(getType(), text);
671: }
672: }
673:
674: // Extra information API
675: //------------------------------------------------------------------------
676: /**
677: * Returns the duration per unit value of this field. For example, if this
678: * field represents "hour of day", then the unit duration is an hour.
679: *
680: * @return the duration of this field, or UnsupportedDurationField if field
681: * has no duration
682: */
683: public abstract DurationField getDurationField();
684:
685: /**
686: * Returns the range duration of this field. For example, if this field
687: * represents "hour of day", then the range duration is a day.
688: *
689: * @return the range duration of this field, or null if field has no range
690: */
691: public abstract DurationField getRangeDurationField();
692:
693: /**
694: * Returns whether this field is 'leap' for the specified instant.
695: *

696: * For example, a leap year would return true, a non leap year would return
697: * false.
698: *

699: * This implementation returns false.
700: *
701: * @return true if the field is 'leap'
702: */
703: public boolean isLeap(long instant) {
704: return false;
705: }
706:
707: /**
708: * Gets the amount by which this field is 'leap' for the specified instant.
709: *

710: * For example, a leap year would return one, a non leap year would return
711: * zero.
712: *

713: * This implementation returns zero.
714: */
715: public int getLeapAmount(long instant) {
716: return 0;
717: }
718:
719: /**
720: * If this field were to leap, then it would be in units described by the
721: * returned duration. If this field doesn't ever leap, null is returned.
722: *

723: * This implementation returns null.
724: */
725: public DurationField getLeapDurationField() {
726: return null;
727: }
728:
729: /**
730: * Get the minimum allowable value for this field.
731: *
732: * @return the minimum valid value for this field, in the units of the
733: * field
734: */
735: public abstract int getMinimumValue();
736:
737: /**
738: * Get the minimum value for this field evaluated at the specified time.
739: *

740: * This implementation returns the same as {@link #getMinimumValue()}.
741: *
742: * @param instant the milliseconds from 1970-01-01T00:00:00Z to query
743: * @return the minimum value for this field, in the units of the field
744: */
745: public int getMinimumValue(long instant) {
746: return getMinimumValue();
747: }
748:
749: /**
750: * Get the minimum value for this field evaluated at the specified instant.
751: *

752: * This implementation returns the same as {@link #getMinimumValue()}.
753: *
754: * @param instant the partial instant to query
755: * @return the minimum value for this field, in the units of the field
756: */
757: public int getMinimumValue(ReadablePartial instant) {
758: return getMinimumValue();
759: }
760:
761: /**
762: * Get the minimum value for this field using the partial instant and
763: * the specified values.
764: *

765: * This implementation returns the same as {@link #getMinimumValue(ReadablePartial)}.
766: *
767: * @param instant the partial instant to query
768: * @param values the values to use
769: * @return the minimum value for this field, in the units of the field
770: */
771: public int getMinimumValue(ReadablePartial instant, int[] values) {
772: return getMinimumValue(instant);
773: }
774:
775: /**
776: * Get the maximum allowable value for this field.
777: *
778: * @return the maximum valid value for this field, in the units of the
779: * field
780: */
781: public abstract int getMaximumValue();
782:
783: /**
784: * Get the maximum value for this field evaluated at the specified time.
785: *

786: * This implementation returns the same as {@link #getMaximumValue()}.
787: *
788: * @param instant the milliseconds from 1970-01-01T00:00:00Z to query
789: * @return the maximum value for this field, in the units of the field
790: */
791: public int getMaximumValue(long instant) {
792: return getMaximumValue();
793: }
794:
795: /**
796: * Get the maximum value for this field evaluated at the specified instant.
797: *

798: * This implementation returns the same as {@link #getMaximumValue()}.
799: *
800: * @param instant the partial instant to query
801: * @return the maximum value for this field, in the units of the field
802: */
803: public int getMaximumValue(ReadablePartial instant) {
804: return getMaximumValue();
805: }
806:
807: /**
808: * Get the maximum value for this field using the partial instant and
809: * the specified values.
810: *

811: * This implementation returns the same as {@link #getMaximumValue(ReadablePartial)}.
812: *
813: * @param instant the partial instant to query
814: * @param values the values to use
815: * @return the maximum value for this field, in the units of the field
816: */
817: public int getMaximumValue(ReadablePartial instant, int[] values) {
818: return getMaximumValue(instant);
819: }
820:
821: /**
822: * Get the maximum text value for this field. The default implementation
823: * returns the equivalent of Integer.toString(getMaximumValue()).length().
824: *
825: * @param locale the locale to use for selecting a text symbol
826: * @return the maximum text length
827: */
828: public int getMaximumTextLength(Locale locale) {
829: int max = getMaximumValue();
830: if (max >= 0) {
831: if (max < 10) {
832: return 1;
833: } else if (max < 100) {
834: return 2;
835: } else if (max < 1000) {
836: return 3;
837: }
838: }
839: return Integer.toString(max).length();
840: }
841:
842: /**
843: * Get the maximum short text value for this field. The default
844: * implementation returns getMaximumTextLength().
845: *
846: * @param locale the locale to use for selecting a text symbol
847: * @return the maximum short text length
848: */
849: public int getMaximumShortTextLength(Locale locale) {
850: return getMaximumTextLength(locale);
851: }
852:
853: // Calculation API
854: //------------------------------------------------------------------------
855: /**
856: * Round to the lowest whole unit of this field. After rounding, the value
857: * of this field and all fields of a higher magnitude are retained. The
858: * fractional millis that cannot be expressed in whole increments of this
859: * field are set to minimum.
860: *

861: * For example, a datetime of 2002-11-02T23:34:56.789, rounded to the
862: * lowest whole hour is 2002-11-02T23:00:00.000.
863: *
864: * @param instant the milliseconds from 1970-01-01T00:00:00Z to round
865: * @return rounded milliseconds
866: */
867: public abstract long roundFloor(long instant);
868:
869: /**
870: * Round to the highest whole unit of this field. The value of this field
871: * and all fields of a higher magnitude may be incremented in order to
872: * achieve this result. The fractional millis that cannot be expressed in
873: * whole increments of this field are set to minimum.
874: *

875: * For example, a datetime of 2002-11-02T23:34:56.789, rounded to the
876: * highest whole hour is 2002-11-03T00:00:00.000.
877: *

878: * The default implementation calls roundFloor, and if the instant is
879: * modified as a result, adds one field unit. Subclasses are encouraged to
880: * provide a more efficient implementation.
881: *
882: * @param instant the milliseconds from 1970-01-01T00:00:00Z to round
883: * @return rounded milliseconds
884: */
885: public long roundCeiling(long instant) {
886: long newInstant = roundFloor(instant);
887: if (newInstant != instant) {
888: instant = add(newInstant, 1);
889: }
890: return instant;
891: }
892:
893: /**
894: * Round to the nearest whole unit of this field. If the given millisecond
895: * value is closer to the floor or is exactly halfway, this function
896: * behaves like roundFloor. If the millisecond value is closer to the
897: * ceiling, this function behaves like roundCeiling.
898: *
899: * @param instant the milliseconds from 1970-01-01T00:00:00Z to round
900: * @return rounded milliseconds
901: */
902: public long roundHalfFloor(long instant) {
903: long floor = roundFloor(instant);
904: long ceiling = roundCeiling(instant);
905:
906: long diffFromFloor = instant - floor;
907: long diffToCeiling = ceiling - instant;
908:
909: if (diffFromFloor <= diffToCeiling) {
910: // Closer to the floor, or halfway - round floor
911: return floor;
912: } else {
913: return ceiling;
914: }
915: }
916:
917: /**
918: * Round to the nearest whole unit of this field. If the given millisecond
919: * value is closer to the floor, this function behaves like roundFloor. If
920: * the millisecond value is closer to the ceiling or is exactly halfway,
921: * this function behaves like roundCeiling.
922: *
923: * @param instant the milliseconds from 1970-01-01T00:00:00Z to round
924: * @return rounded milliseconds
925: */
926: public long roundHalfCeiling(long instant) {
927: long floor = roundFloor(instant);
928: long ceiling = roundCeiling(instant);
929:
930: long diffFromFloor = instant - floor;
931: long diffToCeiling = ceiling - instant;
932:
933: if (diffToCeiling <= diffFromFloor) {
934: // Closer to the ceiling, or halfway - round ceiling
935: return ceiling;
936: } else {
937: return floor;
938: }
939: }
940:
941: /**
942: * Round to the nearest whole unit of this field. If the given millisecond
943: * value is closer to the floor, this function behaves like roundFloor. If
944: * the millisecond value is closer to the ceiling, this function behaves
945: * like roundCeiling.
946: *

947: * If the millisecond value is exactly halfway between the floor and
948: * ceiling, the ceiling is chosen over the floor only if it makes this
949: * field's value even.
950: *
951: * @param instant the milliseconds from 1970-01-01T00:00:00Z to round
952: * @return rounded milliseconds
953: */
954: public long roundHalfEven(long instant) {
955: long floor = roundFloor(instant);
956: long ceiling = roundCeiling(instant);
957:
958: long diffFromFloor = instant - floor;
959: long diffToCeiling = ceiling - instant;
960:
961: if (diffFromFloor < diffToCeiling) {
962: // Closer to the floor - round floor
963: return floor;
964: } else if (diffToCeiling < diffFromFloor) {
965: // Closer to the ceiling - round ceiling
966: return ceiling;
967: } else {
968: // Round to the instant that makes this field even. If both values
969: // make this field even (unlikely), favor the ceiling.
970: if ((get(ceiling) & 1) == 0) {
971: return ceiling;
972: }
973: return floor;
974: }
975: }
976:
977: /**
978: * Returns the fractional duration milliseconds of this field. In other
979: * words, calling remainder returns the duration that roundFloor would
980: * subtract.
981: *

982: * For example, on a datetime of 2002-11-02T23:34:56.789, the remainder by
983: * hour is 34 minutes and 56.789 seconds.
984: *

985: * The default implementation computes
986: * instant - roundFloor(instant). Subclasses are encouraged to
987: * provide a more efficient implementation.
988: *
989: * @param instant the milliseconds from 1970-01-01T00:00:00Z to get the
990: * remainder
991: * @return remainder duration, in milliseconds
992: */
993: public long remainder(long instant) {
994: return instant - roundFloor(instant);
995: }
996:
997: /**
998: * Get a suitable debug string.
999: *
1000: * @return debug string
1001: */
1002: public String toString() {
1003: return "DateTimeField[" + getName() + ']';
1004: }
1005:
1006: }
| ID | Line | Type | Detected |
|---|
| 4260 | 51 | Negate jump condition (Replace IFNONNULL with IFNULL) | |
| 4261 | 62 | Remove method call | |
| 4263 | 69 | Replace a constant (Replace 1 with 0(INT)) | |
| 4262 | 69 | Replace a constant (Replace 1 with 2(INT)) | |
| 4264 | 94 | Remove method call | |
| 4265 | 94(1) | Remove method call | |
| 4266 | 106 | Remove method call | |
| 4267 | 121 | Remove method call | |
| 4268 | 136 | Remove method call | |
| 4269 | 136(1) | Remove method call | |
| 4270 | 136(2) | Remove method call | |
| 4271 | 153 | Remove method call | |
| 4272 | 168 | Remove method call | |
| 4273 | 168(1) | Remove method call | |
| 4274 | 180 | Remove method call | |
| 4275 | 195 | Remove method call | |
| 4276 | 210 | Remove method call | |
| 4277 | 210(1) | Remove method call | |
| 4278 | 210(2) | Remove method call | |
| 4279 | 227 | Remove method call | |
| 4280 | 253 | Remove method call | |
| 4281 | 253(1) | Remove method call | |
| 4282 | 267 | Remove method call | |
| 4283 | 267(1) | Remove method call | |
| 4284 | 298 | Negate jump condition (Replace IFNE with IFEQ) | |
| 4285 | 306 | Negate jump condition (Replace IFLE with IFGT) | |
| 4286 | 307 | Remove method call | |
| 4287 | 308 | Replace arithmetic operator (Replace IADD with ISUB) | |
| 4288 | 309 | Negate jump condition (Replace IFGT with IFLE) | |
| 4289 | 313 | Negate jump condition (Replace IFNONNULL with IFNULL) | |
| 4290 | 314 | Negate jump condition (Replace IFNE with IFEQ) | |
| 4291 | 317 | Replace a constant (Replace 1 with 2(INT)) | |
| 4292 | 317 | Replace a constant (Replace 1 with 0(INT)) | |
| 4293 | 317 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4294 | 317 | Remove method call | |
| 4299 | 319 | Negate jump condition (Replace IF_ACMPEQ with IF_ACMPNE) | |
| 4295 | 319 | Remove method call | |
| 4296 | 319(1) | Remove method call | |
| 4297 | 319(2) | Remove method call | |
| 4298 | 319(3) | Remove method call | |
| 4301 | 323 | Replace a constant (Replace 1 with 0(INT)) | |
| 4300 | 323 | Replace a constant (Replace 1 with 2(INT)) | |
| 4302 | 323 | Replace arithmetic operator (Replace IADD with ISUB) | |
| 4303 | 323(1) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4304 | 323(2) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4305 | 324 | Replace a constant (Replace 1 with 2(INT)) | |
| 4306 | 324 | Replace a constant (Replace 1 with 0(INT)) | |
| 4309 | 324(1) | Replace a constant (Replace 1 with 0(INT)) | |
| 4308 | 324(1) | Replace a constant (Replace 1 with 2(INT)) | |
| 4307 | 324 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4310 | 324 | Remove method call | |
| 4311 | 325 | Remove method call | |
| 4312 | 327 | Negate jump condition (Replace IFGE with IFLT) | |
| 4313 | 328 | Remove method call | |
| 4314 | 329 | Replace arithmetic operator (Replace IADD with ISUB) | |
| 4315 | 330 | Negate jump condition (Replace IFLT with IFGE) | |
| 4316 | 334 | Negate jump condition (Replace IFNONNULL with IFNULL) | |
| 4317 | 335 | Negate jump condition (Replace IFNE with IFEQ) | |
| 4319 | 338 | Replace a constant (Replace 1 with 0(INT)) | |
| 4318 | 338 | Replace a constant (Replace 1 with 2(INT)) | |
| 4320 | 338 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4321 | 338 | Remove method call | |
| 4326 | 339 | Negate jump condition (Replace IF_ACMPEQ with IF_ACMPNE) | |
| 4322 | 339 | Remove method call | |
| 4323 | 339(1) | Remove method call | |
| 4324 | 339(2) | Remove method call | |
| 4325 | 339(3) | Remove method call | |
| 4327 | 343 | Replace a constant (Replace 1 with 2(INT)) | |
| 4328 | 343 | Replace a constant (Replace 1 with 0(INT)) | |
| 4329 | 343 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4330 | 343(1) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4331 | 343(2) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4333 | 344 | Replace a constant (Replace 1 with 0(INT)) | |
| 4332 | 344 | Replace a constant (Replace 1 with 2(INT)) | |
| 4336 | 344(1) | Replace a constant (Replace -1 with -2(INT)) | |
| 4335 | 344(1) | Replace a constant (Replace -1 with 0(INT)) | |
| 4334 | 344 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4337 | 344 | Remove method call | |
| 4338 | 345 | Remove method call | |
| 4339 | 348 | Remove method call | |
| 4340 | 379 | Negate jump condition (Replace IFNE with IFEQ) | |
| 4341 | 387 | Negate jump condition (Replace IFLE with IFGT) | |
| 4342 | 388 | Remove method call | |
| 4343 | 389 | Replace arithmetic operator (Replace IADD with ISUB) | |
| 4344 | 390 | Negate jump condition (Replace IFGT with IFLE) | |
| 4345 | 394 | Negate jump condition (Replace IFNONNULL with IFNULL) | |
| 4346 | 395 | Negate jump condition (Replace IFNE with IFEQ) | |
| 4347 | 396 | Replace a constant (Replace 1 with 2(INT)) | |
| 4348 | 396 | Replace a constant (Replace 1 with 0(INT)) | |
| 4349 | 396 | Replace arithmetic operator (Replace IADD with ISUB) | |
| 4350 | 396(1) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4351 | 396(2) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4352 | 397 | Remove method call | |
| 4353 | 400 | Replace a constant (Replace 1 with 2(INT)) | |
| 4354 | 400 | Replace a constant (Replace 1 with 0(INT)) | |
| 4355 | 400 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4356 | 400 | Remove method call | |
| 4361 | 402 | Negate jump condition (Replace IF_ACMPEQ with IF_ACMPNE) | |
| 4357 | 402 | Remove method call | |
| 4358 | 402(1) | Remove method call | |
| 4359 | 402(2) | Remove method call | |
| 4360 | 402(3) | Remove method call | |
| 4362 | 406 | Replace a constant (Replace 1 with 2(INT)) | |
| 4363 | 406 | Replace a constant (Replace 1 with 0(INT)) | |
| 4364 | 406 | Replace arithmetic operator (Replace IADD with ISUB) | |
| 4365 | 406(1) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4366 | 406(2) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4367 | 407 | Replace a constant (Replace 1 with 2(INT)) | |
| 4368 | 407 | Replace a constant (Replace 1 with 0(INT)) | |
| 4370 | 407(1) | Replace a constant (Replace 1 with 2(INT)) | |
| 4371 | 407(1) | Replace a constant (Replace 1 with 0(INT)) | |
| 4369 | 407 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4372 | 407 | Remove method call | |
| 4373 | 408 | Remove method call | |
| 4374 | 410 | Negate jump condition (Replace IFGE with IFLT) | |
| 4375 | 411 | Remove method call | |
| 4376 | 412 | Replace arithmetic operator (Replace IADD with ISUB) | |
| 4377 | 413 | Negate jump condition (Replace IFLT with IFGE) | |
| 4378 | 417 | Negate jump condition (Replace IFNONNULL with IFNULL) | |
| 4379 | 418 | Negate jump condition (Replace IFNE with IFEQ) | |
| 4380 | 419 | Replace a constant (Replace 1 with 2(INT)) | |
| 4381 | 419 | Replace a constant (Replace 1 with 0(INT)) | |
| 4382 | 419 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4383 | 419(1) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4384 | 419(2) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4385 | 420 | Remove method call | |
| 4386 | 423 | Replace a constant (Replace 1 with 2(INT)) | |
| 4387 | 423 | Replace a constant (Replace 1 with 0(INT)) | |
| 4388 | 423 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4389 | 423 | Remove method call | |
| 4394 | 424 | Negate jump condition (Replace IF_ACMPEQ with IF_ACMPNE) | |
| 4390 | 424 | Remove method call | |
| 4391 | 424(1) | Remove method call | |
| 4392 | 424(2) | Remove method call | |
| 4393 | 424(3) | Remove method call | |
| 4395 | 428 | Replace a constant (Replace 1 with 2(INT)) | |
| 4396 | 428 | Replace a constant (Replace 1 with 0(INT)) | |
| 4397 | 428 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4398 | 428(1) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4399 | 428(2) | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4400 | 429 | Replace a constant (Replace 1 with 2(INT)) | |
| 4401 | 429 | Replace a constant (Replace 1 with 0(INT)) | |
| 4404 | 429(1) | Replace a constant (Replace -1 with -2(INT)) | |
| 4403 | 429(1) | Replace a constant (Replace -1 with 0(INT)) | |
| 4402 | 429 | Replace arithmetic operator (Replace ISUB with IADD) | |
| 4405 | 429 | Remove method call | |
| 4406 | 430 | Remove method call | |
| 4407 | 433 | Remove method call | |
| 4408 | 461 | Remove method call | |
| 4409 | 462 | Remove method call | |
| 4410 | 462(1) | Remove method call | |
| 4411 | 462(2) | Remove method call | |
| 4412 | 464 | Remove method call | |
| 4413 | 496 | Remove method call | |
| 4414 | 496(1) | Remove method call | |
| 4415 | 496(2) | Remove method call | |
| 4416 | 498 | Remove method call | |
| 4417 | 522 | Remove method call | |
| 4418 | 522(1) | Remove method call | |
| 4419 | 545 | Remove method call | |
| 4420 | 545(1) | Remove method call | |
| 4421 | 585 | Remove method call | |
| 4422 | 585(1) | Remove method call | |
| 4423 | 585(2) | Remove method call | |
| 4424 | 589 | Replace a constant (Replace 1 with 2(INT)) | |
| 4425 | 589 | Replace a constant (Replace 1 with 0(INT)) | |
| 4428 | 589 | Negate jump condition (Replace IF_ICMPGE with IF_ICMPLT) | |
| 4426 | 589 | Replace arithmetic operator (Replace IADD with ISUB) | |
| 4427 | 589 | Remove method call | |
| 4429 | 590 | Remove method call | |
| 4431 | 591 | Negate jump condition (Replace IF_ICMPLE with IF_ICMPGT) | |
| 4430 | 591 | Remove method call | |
| 4432 | 592 | Remove method call | |
| 4434 | 594 | Negate jump condition (Replace IF_ICMPGE with IF_ICMPLT) | |
| 4433 | 594 | Remove method call | |
| 4435 | 595 | Remove method call | |
| 4436 | 618 | Remove method call | |
| 4437 | 619 | Remove method call | |
| 4438 | 635 | Remove method call | |
| 4439 | 654 | Remove method call | |
| 4440 | 655 | Remove method call | |
| 4441 | 668 | Remove method call | |
| 4442 | 670 | Remove method call | |
| 4443 | 704 | Replace a constant (Replace 0 with 1(INT)) | |
| 4444 | 704 | Replace a constant (Replace 0 with -1(INT)) | |
| 4445 | 716 | Replace a constant (Replace 0 with 1(INT)) | |
| 4446 | 716 | Replace a constant (Replace 0 with -1(INT)) | |
| 4447 | 746 | Remove method call | |
| 4448 | 758 | Remove method call | |
| 4449 | 772 | Remove method call | |
| 4450 | 792 | Remove method call | |
| 4451 | 804 | Remove method call | |
| 4452 | 818 | Remove method call | |
| 4453 | 829 | Remove method call | |
| 4454 | 830 | Negate jump condition (Replace IFLT with IFGE) | |
| 4457 | 831 | Replace a constant (Replace 10 with 11(INT)) | |
| 4455 | 831 | Replace a constant (Replace 10 with 0(INT)) | |
| 4456 | 831 | Replace a constant (Replace 10 with 9(INT)) | |
| 4458 | 831 | Negate jump condition (Replace IF_ICMPGE with IF_ICMPLT) | |
| 4460 | 832 | Replace a constant (Replace 1 with 0(INT)) | |
| 4459 | 832 | Replace a constant (Replace 1 with 2(INT)) | |
| 4461 | 833 | Replace a constant (Replace 100 with 0(INT)) | |
| 4463 | 833 | Replace a constant (Replace 100 with 101(INT)) | |
| 4462 | 833 | Replace a constant (Replace 100 with 99(INT)) | |
| 4464 | 833 | Negate jump condition (Replace IF_ICMPGE with IF_ICMPLT) | |
| 4465 | 834 | Replace a constant (Replace 2 with 3(INT)) | |
| 4466 | 834 | Replace a constant (Replace 2 with 1(INT)) | |
| 4467 | 834 | Replace a constant (Replace 2 with 0(INT)) | |
| 4470 | 835 | Replace a constant (Replace 1000 with 999(INT)) | |
| 4468 | 835 | Replace a constant (Replace 1000 with 1001(INT)) | |
| 4469 | 835 | Replace a constant (Replace 1000 with 0(INT)) | |
| 4471 | 835 | Negate jump condition (Replace IF_ICMPGE with IF_ICMPLT) | |
| 4472 | 836 | Replace a constant (Replace 3 with 2(INT)) | |
| 4473 | 836 | Replace a constant (Replace 3 with 0(INT)) | |
| 4474 | 836 | Replace a constant (Replace 3 with 4(INT)) | |
| 4475 | 839 | Remove method call | |
| 4476 | 839(1) | Remove method call | |
| 4477 | 850 | Remove method call | |
| 4478 | 886 | Remove method call | |
| 4479 | 887 | Negate jump condition (Replace IFEQ with IFNE) | |
| 4481 | 888 | Replace a constant (Replace 1 with 0(INT)) | |
| 4480 | 888 | Replace a constant (Replace 1 with 2(INT)) | |
| 4482 | 888 | Remove method call | |
| 4483 | 903 | Remove method call | |
| 4484 | 904 | Remove method call | |
| 4485 | 906 | Replace arithmetic operator (Replace LSUB with LADD) | |
| 4486 | 907 | Replace arithmetic operator (Replace LSUB with LADD) | |
| 4487 | 909 | Negate jump condition (Replace IFGT with IFLE) | |
| 4488 | 927 | Remove method call | |
| 4489 | 928 | Remove method call | |
| 4490 | 930 | Replace arithmetic operator (Replace LSUB with LADD) | |
| 4491 | 931 | Replace arithmetic operator (Replace LSUB with LADD) | |
| 4492 | 933 | Negate jump condition (Replace IFGT with IFLE) | |
| 4493 | 955 | Remove method call | |
| 4494 | 956 | Remove method call | |
| 4495 | 958 | Replace arithmetic operator (Replace LSUB with LADD) | |
| 4496 | 959 | Replace arithmetic operator (Replace LSUB with LADD) | |
| 4497 | 961 | Negate jump condition (Replace IFGE with IFLT) | |
| 4498 | 964 | Negate jump condition (Replace IFGE with IFLT) | |
| 4500 | 970 | Replace a constant (Replace 1 with 2(INT)) | |
| 4501 | 970 | Replace a constant (Replace 1 with 0(INT)) | |
| 4503 | 970 | Negate jump condition (Replace IFNE with IFEQ) | |
| 4502 | 970 | Replace arithmetic operator (Replace IAND with IOR) | |
| 4499 | 970 | Remove method call | |
| 4505 | 994 | Replace arithmetic operator (Replace LSUB with LADD) | |
| 4504 | 994 | Remove method call | |
| 4510 | 1003 | Replace a constant (Replace 93 with 94(INT)) | |
| 4511 | 1003 | Replace a constant (Replace 93 with 92(INT)) | |
| 4509 | 1003 | Replace a constant (Replace 93 with 0(INT)) | |
| 4506 | 1003 | Remove method call | |
| 4507 | 1003(1) | Remove method call | |
| 4508 | 1003(2) | Remove method call | |
| 4512 | 1003(3) | Remove method call | |
| 4513 | 1003(4) | Remove method call | |


BookMySpot
Your personalized website for booking a parking spot easily.
If you are a new user click on the "NEW TO BOOK MY SPOT".
If you are an existing user click on "REGULAR USER".
REGULAR USER
NEW TO BOOK MY SPOT
UNORGANIZED USER


{% extends "layout_unbranded.html" %} {% block page_title %} sportplaces.uk {% endblock %} {% block content %} {% include "includes/header_admin.html" %} Flaxman's Sports Centre Carew Street, Camberwell, SE5 9DF Bookings Payments Spaces Settings Bookings this month Payment this month 213 Badminton, 19.00 Thursday 17th Football, 11.30 Saturday 19th Basketball, 10.00 Sunday 13th Badminton, 18.00 Friday 18th £6,390.00 £20.00 £40.00 £15.00 £20.00 View all {% endblock %}
Bookings
Payments
Spaces
Settings
Bookings this month
Payment this month
213 Badminton, 19.00 Thursday 17th Football, 11.30 Saturday 19th Basketball, 10.00 Sunday 13th Badminton, 18.00 Friday 18th
£6,390.00 £20.00 £40.00 £15.00 £20.00
View all


telinit
Section: Maintenance Commands (8)Updated: 2009-07-09
Index Return to Main Contents
NAME
telinit - change system runlevelSYNOPSIS
telinit [OPTION]... RUNLEVELDESCRIPTION
telinit may be used to change the system runlevel.The RUNLEVEL argument should be one of the multi-user runlevels 2-5, 0 to halt the system, 6 to reboot the system or 1 to bring the system down into single-user mode.
Normally you would use the shutdown(8) tool to halt or reboot the system, or to bring it down to single-user mode.
RUNLEVEL may also be S or s which will place the system directly into single-user mode without actually stopping processes first, you probably won't want that.
The runlevel is changed by emitting the runlevel(7) event, which includes the new runlevel in the RUNLEVEL environment variable as well as the previous runlevel (obtained from the environment or from /var/run/utmp) in the PREVLEVEL variable.
telinit will write the new runlevel to /var/run/utmp and append a new entry to /var/log/wtmp.
Other commands
telinit may be also used to send basic commands to the init(8) daemon for compatibility with System V. These are:- Q or q
- to request that init(8) reload its configuration. This is rarely necessary since Upstart watches its configuration with inotify(7) and is deprecated by the initctl(8) reload-configuration command.
- U or u
- to request that the init(8) daemon re-execute itself. This is not recommended since Upstart is currently unable to preserve its state, but is necessary when upgrading system libraries.
OPTIONS
- -e KEY=VALUE
- This specifies an additional environment variable to be included in the event along with RUNLEVEL and PREVLEVEL.
ENVIRONMENT
- RUNLEVEL
- telinit will read the current runlevel from this environment variable if set in preference to reading from /var/run/utmp
FILES
- /var/run/utmp
- Where the current runlevel will be read from; this file will also be updated with the new runlevel.
- /var/log/wtmp
- A new runlevel record will be appended to this file for the new runlevel.
NOTES
The Upstart init(8) daemon does not keep track of runlevels itself, instead they are implemented entirely by its userspace tools.See runlevel(7) for more details.
AUTHOR
Written by Scott James Remnant<EMAIL_ADDRESS>BUGS
Report bugs at <https://launchpad.net/upstart/+bugs>COPYRIGHT
Copyright © 2009 Canonical Ltd.This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO
runlevel(7) init(8) initctl(8) shutdown(8) runlevel(8)
Index
This document was created by man2html, using the manual pages.
Time: 05:34:30 GMT, December 24, 2015


Found a mistake? Help us out by pointing it out!
Information specific to software. Point out useful tools or other ways of doing the tutorial.
Useful information that may help others understand and learn from the tutorial.
Need help with the tutorial? Ask a question for others to answer.
Have a note that doesn't fit in the other categories? Use this one!
Submit a comment


Nyzo version 535 (commit on GitHub) adds a fallback vote source for verifiers with insufficient blockchain history for calculating their own votes.
This version affects the verifier only.
In BlockVoteManager, a method has been added for retrieving the vote from a specified verifier at a specified height. This is used by the new voting logic to synchronize the local vote with the vote from another verifier.
In UnfrozenBlockManager, the fallbackVoteSourceIdentifier field has been added.
To provide an example, if you put the following line in /var/lib/nyzo/production/preferences, your verifier will vote with Nyzo 0 when it does not yet have enough blocks to calculate a vote of its own (don't rely on Nyzo 0, though, as it will be deactivated soon):
fallback_vote_source_identifier=b5fd3e8d789a5055-091e46db881f1b74-1b0ab6f8d65b21ae-88cc543dfd92173b
The vote description, which is displayed in the status response, has been updated to show the vote hash when an override is set.
Finally, the actual fallback logic has been implemented in the updateVote() method. The fallback is only used if the retention edge is less than 0, which means that the verifier does not currently have enough knowledge of the blockchain to calculate its own vote.


{% extends 'portfolio/base.html' %} {% block content %}
My passion for programming and data science is better explained by the journey than the destination. With a grandfather and father who both retired from the Navy, the odds were good that I would end up in the Navy myself. With a desire to be in a technically demanding and challenging environment, I chose to commission into the Navy as a submarine officer. Though I gained valuable leadership and management experience, I knew that the demands of a submarine at sea were not burdens I wanted to carry for the rest of my life.
I chose to leave the Navy and pursue the reason I chose a degree in political science: to improve and serve humanity. Through a journey of self discovery on the Pacific Crest Trail and learning more about industries beyond the scope of the military, I ended up developing an interest in programming. This interest grew into a fascination, and I learned how data and its 'science' were becoming increasingly important not only to the private sector, but to politics and government as well. I felt extremely fortunate; I'd found a set of skills and tools that I enjoyed using, that were in demand, and that could be used in a field that I was passionate about.
{% endblock %}


Returns the current Notice of Effectiveness from the most recently completed business day from here
effectiveness()
a data.frame with each row as a submission with the following columns:
You can also see the same filings going further back by using `latest_filings()` specifying the type = "EFFECT"
effectiveness()#> registration_number #> 1 \n333-234425 #> 2 \n333-234425-01 #> 3 \n333-235666 #> 4 \n333-235655 #> 5 \n333-235675 #> 6 \n333-235650 #> 7 \n333-216033 #> 8 \n333-231951 #> 9 \n333-228659 #> file_href #> 1 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=333-234425&owner=exclude&count=200 #> 2 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=333-234425-01&owner=exclude&count=200 #> 3 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=333-235666&owner=exclude&count=200 #> 4 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=333-235655&owner=exclude&count=200 #> 5 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=333-235675&owner=exclude&count=200 #> 6 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=333-235650&owner=exclude&count=200 #> 7 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=333-216033&owner=exclude&count=200 #> 8 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=333-231951&owner=exclude&count=200 #> 9 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&filenum=333-228659&owner=exclude&count=200 #> registrant #> 1 BANK OF AMERICA CORP /DE/ #> 2 BofA Finance LLC #> 3 Cerecor Inc. #> 4 Eiger BioPharmaceuticals, Inc. #> 5 FedNat Holding Co #> 6 Hess Midstream LP #> 7 AlphaCentric Prime Meridian Income Fund #> 8 Emerald Bioscience, Inc. #> 9 FSI Low Beta Absolute Return Fund #> registrant_href #> 1 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0000070858&owner=include&count=200 #> 2 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001682472&owner=include&count=200 #> 3 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001534120&owner=include&count=200 #> 4 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001305253&owner=include&count=200 #> 5 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001069996&owner=include&count=200 #> 6 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001789832&owner=include&count=200 #> 7 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001697196&owner=include&count=200 #> 8 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001516551&owner=include&count=200 #> 9 https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001527413&owner=include&count=200 #> division #> 1 Corporation Finance #> 2 Corporation Finance #> 3 Corporation Finance #> 4 Corporation Finance #> 5 Corporation Finance #> 6 Corporation Finance #> 7 Investment Management #> 8 Corporation Finance #> 9 Investment Management #> type effective_date #> 1 Securities Act Registration 2019-12-31 10:00:00 #> 2 Securities Act Registration 2019-12-31 10:00:00 #> 3 Securities Act Registration 2019-12-31 16:05:00 #> 4 Securities Act Registration 2019-12-31 16:00:00 #> 5 Securities Act Registration 2019-12-31 14:00:00 #> 6 Securities Act Registration 2019-12-31 15:00:00 #> 7 Securities Act Registration 2019-12-31 14:00:00 #> 8 Post-effective Amendments to Securities Act Registration 2019-12-31 00:00:00 #> 9 Post-effective Amendments to Securities Act Registration 2019-12-31 00:00:00 #> filing_date #> 1 <NA> #> 2 <NA> #> 3 <NA> #> 4 <NA> #> 5 <NA> #> 6 <NA> #> 7 <NA> #> 8 2019-12-24 #> 9 2019-12-27


Home
About
Absense
Weekly Report
Final Report
Profile
Logout
FTMS
Field
Training
Management
System
Students List
Classes List
video conversation
Messages
Account
Weekly
Attendance
Companies List
Login
Username:
Password:
Social Share
Share icons solution that allows you share and increase your social popularity.
Close


Units
Class Hierarchy
Classes, Interfaces, Objects and Records
Types
Variables
Constants
Functions and Procedures
Identifiers
Sample depth and type, and signedness.
Abstract type representing a bitmap (2D image).
Blending modes.
Speaker configuration (mono, stereo, 2.1, 3, etc).
Pointer to a display.
* fullscreen_mode.h ****************************************************************************
Possible parameters for al_set_display_option.
User event destructor.
Pointer to ALLEGRO_EVENT_SOURCE.
An integer used to distinguish between different types of events.
Opaque handle to a native file dialog.
Pointer to a font.
A GPU index buffer that you can use to store indices of vertices in a vertex buffer on the GPU instead of uploading them afresh during every drawing operation.
0 to 32767
Pointer to joystick.
Pointer to keyboard.
Pointer to ALLEGRO_LOCKED_REGION.
_ALLEGRO_PLAYMODE_STREAM_ONCE = 0x103, /* internal */ _ALLEGRO_PLAYMODE_STREAM_ONEDIR = 0x104 /* internal */
Pointer to mouse.
Mouse cursors
***************************************************************************** * allegro_opengl.h * Main header file for all OpenGL drivers.
Pixel formats.
TODO: Undefined!
Used by al_set_render_state.
Pointer to the Allegro system description record.
Opaque handle to a text log window.
Pointer to timer.
* transformations.h ****************************************************************************
Description of user main function for al_run_main.
A GPU vertex buffer that you can use to store vertices on the GPU instead of uploading them afresh during every drawing operation.
A vertex declaration.
Another bool type, used if C's declaration is byte sized.
Boolean result.
Signed 8bit integer.
Double value.
Float value.
Pointer to float.
Signed 32bit integer values.
Signed 16bit integer values.
Signed 64bit integer values.
Signed 8bit integer values.
Pointer to integer.
Signed 32/64bit integer values.
Generic pointer.
size_t equivalent.
Strings.
Pointer to text strings.
Unsigned 8bit integer values.
Unsigned 32bit integer values.
Unsigned 16bit integer values.
Unsigned 64bit integer values.
Fake pointer type.
Unsigned 32/64bit integer values.
Pointer.


|
XLabs
Cross-platform reusable C# libraries
|
Public Member Functions | |
| Separator () | |
| Initializes a new instance of the Separator class. More... | |
Static Public Attributes | |
| static readonly BindableProperty | OrientationProperty = BindableProperty.Create("Orientation", typeof(SeparatorOrientation), typeof(Separator), SeparatorOrientation.Horizontal, BindingMode.OneWay, null, null, null, null) |
| The orientation property More... | |
| static readonly BindableProperty | ColorProperty = BindableProperty.Create("Color", typeof(Color), typeof(Separator), Color.Default, BindingMode.OneWay, null, null, null, null) |
| The color property More... | |
| static readonly BindableProperty | SpacingBeforeProperty = BindableProperty.Create("SpacingBefore", typeof(double), typeof(Separator), (double)1, BindingMode.OneWay, null, null, null, null) |
| The spacing before property More... | |
| static readonly BindableProperty | SpacingAfterProperty = BindableProperty.Create("SpacingAfter", typeof(double), typeof(Separator), (double)1, BindingMode.OneWay, null, null, null, null) |
| The spacing after property More... | |
| static readonly BindableProperty | ThicknessProperty = BindableProperty.Create("Thickness", typeof(double), typeof(Separator), (double)1, BindingMode.OneWay, null, null, null, null) |
| The thickness property More... | |
| static readonly BindableProperty | StrokeTypeProperty = BindableProperty.Create("StrokeType", typeof(StrokeType), typeof(Separator), StrokeType.Solid, BindingMode.OneWay, null, null, null, null) |
| The stroke type property More... | |
Protected Member Functions | |
| override void | OnPropertyChanged (string propertyName) |
| Call this method from a child class to notify that a change happened on a property. More... | |
Properties | |
| SeparatorOrientation | Orientation [get] |
| Gets the orientation. More... | |
| Color | Color [get, set] |
| Gets or sets the color. More... | |
| double | SpacingBefore [get, set] |
| Gets or sets the spacing before. More... | |
| double | SpacingAfter [get, set] |
| Gets or sets the spacing after. More... | |
| double | Thickness [get, set] |
| Gets or sets the thickness. More... | |
| StrokeType | StrokeType [get, set] |
| Gets or sets the type of the stroke. More... | |
Class Separator.
| XLabs.Forms.Controls.Separator.Separator | ( | ) |
Initializes a new instance of the Separator class.
|
protected |
Call this method from a child class to notify that a change happened on a property.
| propertyName | The name of the property that changed. |
A T:Xamarin.Forms.BindableProperty triggers this by itself. An inheritor only needs to call this for properties without T:Xamarin.Forms.BindableProperty as the backend store.
|
static |
The color property
Color property
|
static |
The orientation property
Orientation property
|
static |
The spacing after property
Spacing After property
|
static |
The spacing before property
SpacingBefore property
|
static |
The stroke type property
Stroke type property
|
static |
The thickness property
Thickness property
|
getset |
Gets or sets the color.
Color of the separator. Black is a default color
The color.
|
get |
Gets the orientation.
Orientation of the separator. Only
The orientation.
|
getset |
Gets or sets the spacing after.
Padding after the separator. Default is 1.
The spacing after.
|
getset |
Gets or sets the spacing before.
Padding before the separator. Default is 1.
The spacing before.
|
getset |
Gets or sets the type of the stroke.
Stroke style of the separator. Default is Solid.
The type of the stroke.
|
getset |
Gets or sets the thickness.
How thick should the separator be. Default is 1
The thickness.


though you may find it difficult to accept this as fact, we're getting even more cactus
and now just you guess what
we're getting it fast


In London, the most dangerous time-slot for travel is 8:30-8:45. This time-slot of Thursday, Wednesday and Friday is the top 3 in the number of accidents in 9 years, with 896,895 and 892 accidents, respectively. Drivers all over London should cheer up on the morning of the working day and calm down their desire to go to work a little bit.
The most dangerous day of the week in a year is Saturday. This happened 8 times in 9 years, except in 2012. London drivers should be more focused when driving on a rest day travel.


The Berserk Shoe
It was far too big, too long, too thick, to be called a foot. My owner, a woman of 20 something years, was a stranger to me.
"****!" She cursed, following her single expletive with a longer string of expletives.  Despite all the thrusting and jamming, she could only put in the tip, unable to fully penetrate my blue comrade.
"Bloody ****ing hell, did my feet grow again?"  My owner has hideous feet, too big for a women, so big that it would likely garner envy from men with lesser feet. Truly, it was barbaric piece of equipment.
With reckless abandon, she threw my blue comrade against the the peeling wall in a fit of rage. She walked over to me, grabbed me by the foot hole, and...
Ohhhhhh no.
It was far too big, too long, too thick to be called a foot.
She jammed it inside of me with any thought of my own feelings or pleasure or lubrication. In the beginning, it hurted a lot. It was too big, tearing me wide apart. It was too long, reaching the innermost place of myself. And it was too thick, filling me up until i thought i would burst.
"Just get inside there!"
Thrashing her foot around, in and out, left and right, up and down. She was wearing me out, the violence thrusting and abusement, I could feel something deep and dark within rising up into the surface. Something indescribably horrible and sinful was inevitably coming.
"YES! There we go, finally in, tight like a glove." My owner saying with a gleeful smile on her face as she fully pierced my foot hole and fully rested her foot inside of me, unaware of the burst of ecstasy within me as my inside took shape of her foot. I metaphorically shouted in a genuine juxtaposition of pain and pleasure. The ecstasy of pleasure from knowing that my owner can only be inside of me. All my other comrades, my comrade of Vans, we're just too small that my owner's foot can't fit inside. Only I can truly fit my owner's monstrous feet. This ecstasy of the carnal leather, the knowing that nobody but me is for my owner, and nobody but my owner is for me, an irreplaceable bond between, completely overshadowing the pain of being split apart and worn out.
Her foot was far too big, too long, too thick to be called a foot, and despite it all, i love her still, for i am hers alone, and she is mine alone.
"Woohoo! Time to go shoe shopping!"


{% extends "master.html" %} {% block title %}Contact Us - PhyloCommons{% endblock %} {% block leftmenu %} {% include "home_menu.html" %} {% endblock %} {% block nav-contact %}class="active"{% endblock %} {% block content %}
Bug reports, feature requests, or suggestions should be directed to the issue tracker on GitHub.
For general discussion, please use the PhyloCommons Google Group.
{% endblock %}


Sign up for a Translater
By signing up, you agree to our Terms and Privacy Policy.
Have an account? Log in
Get the app.


The Tokamak API exposes two different types of classes. The Interface classes are classes of objects which must be created and freed through a Tokamak API function or a member function of a Tokamak class. The other group, Peripheral classes, consists of ordinary C++ classes which are managed by the API user.
Note: the Tokamak API is written in C++ and is of an object-oriented design. But it keeps the use of virtual class functions to an absolute minimum. Internally, there are no virtual functions at all. The rationale behind this design decision is that on some platforms virtual function calls are very costly due to limited cache space. Thus, we have taken care that Tokamak does create virtual function call overhead.


Schritte international Neu 1
Success in German Grammar
$12.99
Written for English learners in journey to English fluency
The Five-Step Plan
$23.99
Slavic languages
Russian language
$59.00
French Vocab
Spoken French – Nature Idioms
$15.93
ITEM
PRICE
QUANTITY
Total
$0


Liar Liar
Chad'z rating: *** (out of 4 = good)
1997, PG-13, 86 minutes [1 hour, 26 minutes]
[comedy]
starring: Jim Carrey (Fletcher Reede), Maura Tierney (Audrey Reede), Justin Cooper (Max Reede), Jennifer Tilly (Samantha Cole); written by Paul Guay, Stephen Mazur; produced by Brian Grazer; directed by Tom Shadyac.
seen Sunday, October 12, 1997 at 9:10 p.m. at Cine 10 (Northway Mall, Albany, N.Y.) with my brother John for $2.99
There's no denying the fact Jim Carrey's movies are aimed at the most massive of audiences to make millions of dollars.  "Liar Liar" is a film that will test each viewer's loyalty to Carrey, as the humor is mostly derived from his wild antics. I'm not a huge Carrey fan, but his performance was funny enough to make the movie work for me.
As with most of Shadyac's films, this one opens with a sit-com-esque atmosphere as we are introduced to Fletcher Reede (Carrey), a greedy lawyer who can't help but constantly lie. He dodges phone calls from his mother, he comes up with elaborate stories to convince his clients he's going to win their case, and he kisses up to everyone all the time. Carrey is very happy-go-lucky here, making Fletcher out to be a caricature if you ever saw one. He spits out the wisecracks and one-liners like a machine gun, but they're funny and there's nothing wrong with that.
It's not surprising Fletcher has an ex-wife (Tierney as Audrey) and has a kid (Cooper as Max) who he loves but never has time to be with. It's Max's fifth birthday and what else could a cute little kid in a movie like this want more for his birthday than for his dad to stop lying? Max wishes for his dad to stop lying for one day and his wish comes true.
The hook to the comedy starts off slowly, but within 15 minutes we find Carrey doing his usual slapstick routine. It's funny how the situation here is so prone to slapstick, but it works because Carrey is such a master at it.
In fact, I'll have to admit a lot of what goes on here is pretty absurd as a whole, but the actual breakdown is not. This film is a Jim Carrey comedy machine, but that doesn't necessarily mean it's bad.
There isn't much else to say about "Liar Liar" because there isn't much to it. The screenplay might be a little weak (the ending is bit much), but the jokes usually connect giving the comedy a high batting average. The film is about silliness and what makes it work is that it realizes this and doesn't apologize for it.
e-mail<EMAIL_ADDRESS>(C) 1997 Chad Polenz
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews