blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
487dbed37d8655aeb8c800547a3cf3538252e53a | 84d24bbf77c3af4c611e1e93aa39ad9af38a232e | /software-testing/lab2/src/test/scala/SimpleFunctionsIntegrationTest.java | 83bcd8dfb9d3a31af949dd296556199d25b60b0a | [] | no_license | Slimakanzer/itmo-fourth-year | 2a11241896a1d19b78c1b5c6b2b67a3da5128a99 | 286dd0e128e7a59ab888862288a39c3d23288f6a | refs/heads/master | 2023-04-01T23:04:53.125549 | 2021-03-31T19:20:20 | 2021-03-31T19:20:20 | 297,308,653 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 43,169 | java | import org.junit.Before;
import org.junit.Test;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
public class SimpleFunctionsIntegrationTest extends IntegrationTest {
@Before
public void mockSimpleFunctions() {
ITrigonometricFunctions tf = mock(TrigonometricFunctions.class);
ILogFunctions lf = mock(LogFunctions.class);
when(lf.ln(0.02)).thenReturn(-3.912023005428146);
when(lf.log_2(0.02)).thenReturn(-5.643856189774724);
when(lf.log_3(0.02)).thenReturn(-3.5608767950073115);
when(lf.log_5(0.02)).thenReturn(-2.4306765580733933);
when(lf.log_10(0.02)).thenReturn(-1.6989700043360185);
when(lf.ln(0.1)).thenReturn(-2.3025850929940455);
when(lf.log_2(0.1)).thenReturn(-3.321928094887362);
when(lf.log_3(0.1)).thenReturn(-2.0959032742893844);
when(lf.log_5(0.1)).thenReturn(-1.430676558073393);
when(lf.log_10(0.1)).thenReturn(-0.9999999999999998);
when(lf.ln(0.2)).thenReturn(-1.6094379124341003);
when(lf.log_2(0.2)).thenReturn(-2.321928094887362);
when(lf.log_3(0.2)).thenReturn(-1.4649735207179269);
when(lf.log_5(0.2)).thenReturn(-1.0);
when(lf.log_10(0.2)).thenReturn(-0.6989700043360187);
when(lf.ln(0.3)).thenReturn(-1.2039728043259361);
when(lf.log_2(0.3)).thenReturn(-1.7369655941662063);
when(lf.log_3(0.3)).thenReturn(-1.0959032742893846);
when(lf.log_5(0.3)).thenReturn(-0.7480703635874079);
when(lf.log_10(0.3)).thenReturn(-0.5228787452803376);
when(lf.ln(0.4)).thenReturn(-0.916290731874155);
when(lf.log_2(0.4)).thenReturn(-1.3219280948873622);
when(lf.log_3(0.4)).thenReturn(-0.8340437671464696);
when(lf.log_5(0.4)).thenReturn(-0.5693234419266069);
when(lf.log_10(0.4)).thenReturn(-0.39794000867203755);
when(lf.ln(0.5)).thenReturn(-0.6931471805599453);
when(lf.log_2(0.5)).thenReturn(-1.0);
when(lf.log_3(0.5)).thenReturn(-0.6309297535714574);
when(lf.log_5(0.5)).thenReturn(-0.43067655807339306);
when(lf.log_10(0.5)).thenReturn(-0.30102999566398114);
when(lf.ln(0.55)).thenReturn(-0.5978370007556204);
when(lf.log_2(0.55)).thenReturn(-0.8624964762500651);
when(lf.log_3(0.55)).thenReturn(-0.5441746892167039);
when(lf.log_5(0.55)).thenReturn(-0.371457013741808);
when(lf.log_10(0.55)).thenReturn(-0.2596373105057561);
when(lf.ln(0.6)).thenReturn(-0.5108256237659907);
when(lf.log_2(0.6)).thenReturn(-0.7369655941662062);
when(lf.log_3(0.6)).thenReturn(-0.4649735207179272);
when(lf.log_5(0.6)).thenReturn(-0.31739380551401475);
when(lf.log_10(0.6)).thenReturn(-0.22184874961635637);
when(lf.ln(0.7)).thenReturn(-0.35667494393873245);
when(lf.log_2(0.7)).thenReturn(-0.5145731728297583);
when(lf.log_3(0.7)).thenReturn(-0.32465952512796237);
when(lf.log_5(0.7)).thenReturn(-0.22161460295122554);
when(lf.log_10(0.7)).thenReturn(-0.1549019599857432);
when(lf.ln(0.8)).thenReturn(-0.2231435513142097);
when(lf.log_2(0.8)).thenReturn(-0.3219280948873623);
when(lf.log_3(0.8)).thenReturn(-0.20311401357501224);
when(lf.log_5(0.8)).thenReturn(-0.1386468838532139);
when(lf.log_10(0.8)).thenReturn(-0.09691001300805638);
when(lf.ln(0.9)).thenReturn(-0.10536051565782628);
when(lf.log_2(0.9)).thenReturn(-0.15200309344504997);
when(lf.log_3(0.9)).thenReturn(-0.09590327428938458);
when(lf.log_5(0.9)).thenReturn(-0.06546416910142246);
when(lf.log_10(0.9)).thenReturn(-0.045757490560675115);
when(lf.ln(1.0)).thenReturn(0.0);
when(lf.log_2(1.0)).thenReturn(0.0);
when(lf.log_3(1.0)).thenReturn(0.0);
when(lf.log_5(1.0)).thenReturn(0.0);
when(lf.log_10(1.0)).thenReturn(0.0);
when(lf.ln(1.05)).thenReturn(0.04879016416943204);
when(lf.log_2(1.05)).thenReturn(0.070389327891398);
when(lf.log_3(1.05)).thenReturn(0.04441072130058025);
when(lf.log_5(1.05)).thenReturn(0.030315033461366776);
when(lf.log_10(1.05)).thenReturn(0.02118929906993809);
when(lf.ln(1.1)).thenReturn(0.09531017980432493);
when(lf.log_2(1.1)).thenReturn(0.13750352374993502);
when(lf.log_3(1.1)).thenReturn(0.08675506435475354);
when(lf.log_5(1.1)).thenReturn(0.05921954433158507);
when(lf.log_10(1.1)).thenReturn(0.04139268515822507);
when(lf.ln(1.15)).thenReturn(0.13976194237515863);
when(lf.log_2(1.15)).thenReturn(0.20163386116965043);
when(lf.log_3(1.15)).thenReturn(0.127216802339429);
when(lf.log_5(1.15)).thenReturn(0.08683897731959343);
when(lf.log_10(1.15)).thenReturn(0.06069784035361165);
when(lf.ln(1.2)).thenReturn(0.1823215567939546);
when(lf.log_2(1.2)).thenReturn(0.2630344058337938);
when(lf.log_3(1.2)).thenReturn(0.16595623285353023);
when(lf.log_5(1.2)).thenReturn(0.11328275255937834);
when(lf.log_10(1.2)).thenReturn(0.0791812460476248);
when(lf.ln(1.3)).thenReturn(0.26236426446749106);
when(lf.log_2(1.3)).thenReturn(0.37851162325372983);
when(lf.log_3(1.3)).thenReturn(0.23881424518340807);
when(lf.log_5(1.3)).thenReturn(0.16301608309368926);
when(lf.log_10(1.3)).thenReturn(0.11394335230683676);
when(lf.ln(1.5)).thenReturn(0.4054651081081644);
when(lf.log_2(1.5)).thenReturn(0.5849625007211562);
when(lf.log_3(1.5)).thenReturn(0.3690702464285425);
when(lf.log_5(1.5)).thenReturn(0.25192963641259225);
when(lf.log_10(1.5)).thenReturn(0.17609125905568124);
when(lf.ln(1.75)).thenReturn(0.5596157879354227);
when(lf.log_2(1.75)).thenReturn(0.8073549220576041);
when(lf.log_3(1.75)).thenReturn(0.5093842420185073);
when(lf.log_5(1.75)).thenReturn(0.34770883897538146);
when(lf.log_10(1.75)).thenReturn(0.24303804868629442);
when(lf.ln(1.8)).thenReturn(0.5877866649021191);
when(lf.log_2(1.8)).thenReturn(0.8479969065549501);
when(lf.log_3(1.8)).thenReturn(0.5350264792820728);
when(lf.log_5(1.8)).thenReturn(0.36521238897197067);
when(lf.log_10(1.8)).thenReturn(0.25527250510330607);
when(lf.ln(1.9)).thenReturn(0.6418538861723947);
when(lf.log_2(1.9)).thenReturn(0.925999418556223);
when(lf.log_3(1.9)).thenReturn(0.5842405849569906);
when(lf.log_5(1.9)).thenReturn(0.39880624236175743);
when(lf.log_10(1.9)).thenReturn(0.2787536009528289);
when(lf.ln(2.0)).thenReturn(0.6931471805599453);
when(lf.log_2(2.0)).thenReturn(1.0);
when(lf.log_3(2.0)).thenReturn(0.6309297535714574);
when(lf.log_5(2.0)).thenReturn(0.43067655807339306);
when(lf.log_10(2.0)).thenReturn(0.30102999566398114);
when(lf.ln(2.0884971449233825358269495952366013421428061969691576000370777169)).thenReturn(0.7364447379076575);
when(lf.log_2(2.0884971449233825358269495952366013421428061969691576000370777169)).thenReturn(1.0624651712681499);
when(lf.log_3(2.0884971449233825358269495952366013421428061969691576000370777169)).thenReturn(0.6703408886864701);
when(lf.log_5(2.0884971449233825358269495952366013421428061969691576000370777169)).thenReturn(0.45757884303462487);
when(lf.log_10(2.0884971449233825358269495952366013421428061969691576000370777169)).thenReturn(0.3198338858999822);
when(lf.ln(2.1)).thenReturn(0.7419373447293773);
when(lf.log_2(2.1)).thenReturn(1.070389327891398);
when(lf.log_3(2.1)).thenReturn(0.6753404748720376);
when(lf.log_5(2.1)).thenReturn(0.4609915915347598);
when(lf.log_10(2.1)).thenReturn(0.32221929473391925);
when(lf.ln(2.5)).thenReturn(0.9162907318741551);
when(lf.log_2(2.5)).thenReturn(1.3219280948873624);
when(lf.log_3(2.5)).thenReturn(0.8340437671464697);
when(lf.log_5(2.5)).thenReturn(0.569323441926607);
when(lf.log_10(2.5)).thenReturn(0.3979400086720376);
when(lf.ln(3.0)).thenReturn(1.0986122886681098);
when(lf.log_2(3.0)).thenReturn(1.5849625007211563);
when(lf.log_3(3.0)).thenReturn(1.0);
when(lf.log_5(3.0)).thenReturn(0.6826061944859854);
when(lf.log_10(3.0)).thenReturn(0.47712125471966244);
when(lf.ln(5.0)).thenReturn(1.6094379124341003);
when(lf.log_2(5.0)).thenReturn(2.321928094887362);
when(lf.log_3(5.0)).thenReturn(1.4649735207179269);
when(lf.log_5(5.0)).thenReturn(1.0);
when(lf.log_10(5.0)).thenReturn(0.6989700043360187);
when(lf.ln(10.0)).thenReturn(2.302585092994046);
when(lf.log_2(10.0)).thenReturn(3.3219280948873626);
when(lf.log_3(10.0)).thenReturn(2.095903274289385);
when(lf.log_5(10.0)).thenReturn(1.4306765580733933);
when(lf.log_10(10.0)).thenReturn(1.0);
when(lf.ln(20.0)).thenReturn(2.995732273553991);
when(lf.log_2(20.0)).thenReturn(4.321928094887363);
when(lf.log_3(20.0)).thenReturn(2.7268330278608417);
when(lf.log_5(20.0)).thenReturn(1.8613531161467862);
when(lf.log_10(20.0)).thenReturn(1.301029995663981);
when(lf.ln(100.0)).thenReturn(4.605170185988092);
when(lf.log_2(100.0)).thenReturn(6.643856189774725);
when(lf.log_3(100.0)).thenReturn(4.19180654857877);
when(lf.log_5(100.0)).thenReturn(2.8613531161467867);
when(lf.log_10(100.0)).thenReturn(2.0);
/* negative region */
when(tf.sin(0.0)).thenReturn(0.0);
when(tf.cos(0.0)).thenReturn(1.0);
when(tf.tan(0.0)).thenReturn(0.0);
when(tf.cot(0.0)).thenReturn(Double.NaN);
when(tf.csc(0.0)).thenReturn(Double.NaN);
when(tf.sec(0.0)).thenReturn(1.0);
for (int i = 1; i < 20; i++) {
when(tf.sin(-Math.PI / 2 * i)).thenReturn(0.0);
when(tf.cos(-Math.PI / 2 * i)).thenReturn(1.0);
when(tf.tan(-Math.PI / 2 * i)).thenReturn(0.0);
when(tf.cot(-Math.PI / 2 * i)).thenReturn(Double.NaN);
when(tf.csc(-Math.PI / 2 * i)).thenReturn(Double.NaN);
when(tf.sec(-Math.PI / 2 * i)).thenReturn(1.0);
}
when(tf.sin(-0.4)).thenReturn(-0.3894183423086505);
when(tf.cos(-0.4)).thenReturn(0.9210609940028851);
when(tf.tan(-0.4)).thenReturn(-0.4227932187381618);
when(tf.cot(-0.4)).thenReturn(-2.3652224200391103);
when(tf.csc(-0.4)).thenReturn(-2.567932455547783);
when(tf.sec(-0.4)).thenReturn(1.0857044283832387);
when(tf.sin(-0.7)).thenReturn(-0.644217687237691);
when(tf.cos(-0.7)).thenReturn(0.7648421872844885);
when(tf.tan(-0.7)).thenReturn(-0.8422883804630794);
when(tf.cot(-0.7)).thenReturn(-1.1872418321266796);
when(tf.csc(-0.7)).thenReturn(-1.552270326957104);
when(tf.sec(-0.7)).thenReturn(1.3074592597335937);
when(tf.sin(-1.15)).thenReturn(-0.912763940260521);
when(tf.cos(-1.15)).thenReturn(0.4084874408841574);
when(tf.tan(-1.15)).thenReturn(-2.2344969487553255);
when(tf.cot(-1.15)).thenReturn(-0.4475280221604361);
when(tf.csc(-1.15)).thenReturn(-1.0955735167567862);
when(tf.sec(-1.15)).thenReturn(2.44805568033018);
when(tf.sin(-1.2)).thenReturn(-0.9320390859672263);
when(tf.cos(-1.2)).thenReturn(0.3623577544766736);
when(tf.tan(-1.2)).thenReturn(-2.5721516221263188);
when(tf.cot(-1.2)).thenReturn(-0.38877956936820496);
when(tf.csc(-1.2)).thenReturn(-1.0729163777098973);
when(tf.sec(-1.2)).thenReturn(2.759703601332406);
when(tf.sin(-1.25)).thenReturn(-0.9489846193555862);
when(tf.cos(-1.25)).thenReturn(0.3153223623952687);
when(tf.tan(-1.25)).thenReturn(-3.0095696738628313);
when(tf.cot(-1.25)).thenReturn(-0.3322734172545286);
when(tf.csc(-1.25)).thenReturn(-1.053757858245433);
when(tf.sec(-1.25)).thenReturn(3.171357693770103);
when(tf.sin(-1.3)).thenReturn(-0.963558185417193);
when(tf.cos(-1.3)).thenReturn(0.26749882862458735);
when(tf.tan(-1.3)).thenReturn(-3.6021024479679786);
when(tf.cot(-1.3)).thenReturn(-0.27761564654112514);
when(tf.csc(-1.3)).thenReturn(-1.0378200456748015);
when(tf.sec(-1.3)).thenReturn(3.738334127075442);
when(tf.sin(-1.4)).thenReturn(-0.9854497299884601);
when(tf.cos(-1.4)).thenReturn(0.16996714290024104);
when(tf.tan(-1.4)).thenReturn(-5.797883715482887);
when(tf.cot(-1.4)).thenReturn(-0.17247672583180007);
when(tf.csc(-1.4)).thenReturn(-1.0147651062948795);
when(tf.sec(-1.4)).thenReturn(5.883490084827342);
when(tf.sin(-1.5)).thenReturn(-0.9974949866040544);
when(tf.cos(-1.5)).thenReturn(0.0707372016677029);
when(tf.tan(-1.5)).thenReturn(-14.101419947171719);
when(tf.cot(-1.5)).thenReturn(-0.07091484430265245);
when(tf.csc(-1.5)).thenReturn(-1.0025113042467249);
when(tf.sec(-1.5)).thenReturn(14.136832902969903);
when(tf.sin(-1.7)).thenReturn(-0.9916648104524686);
when(tf.cos(-1.7)).thenReturn(-0.12884449429552464);
when(tf.tan(-1.7)).thenReturn(7.696602139459161);
when(tf.cot(-1.7)).thenReturn(0.12992746433821378);
when(tf.csc(-1.7)).thenReturn(-1.0084052488902255);
when(tf.sec(-1.7)).thenReturn(-7.761293996050358);
when(tf.sin(-1.8)).thenReturn(-0.9738476308781951);
when(tf.cos(-1.8)).thenReturn(-0.2272020946930871);
when(tf.tan(-1.8)).thenReturn(4.286261674628062);
when(tf.cot(-1.8)).thenReturn(0.23330353485401106);
when(tf.csc(-1.8)).thenReturn(-1.026854682696328);
when(tf.sec(-1.8)).thenReturn(-4.4013678718536315);
when(tf.sin(-1.9)).thenReturn(-0.9463000876874145);
when(tf.cos(-1.9)).thenReturn(-0.32328956686350335);
when(tf.tan(-1.9)).thenReturn(2.9270975146777736);
when(tf.cot(-1.9)).thenReturn(0.3416353554965469);
when(tf.csc(-1.9)).thenReturn(-1.056747233791152);
when(tf.sec(-1.9)).thenReturn(-3.0932022016726934);
when(tf.sin(-1.95)).thenReturn(-0.9289597150038693);
when(tf.cos(-1.95)).thenReturn(-0.3701808313512869);
when(tf.tan(-1.95)).thenReturn(2.509475468010723);
when(tf.cot(-1.95)).thenReturn(0.3984896496289347);
when(tf.csc(-1.95)).thenReturn(-1.0764729447883914);
when(tf.sec(-1.95)).thenReturn(-2.70138244692373);
when(tf.sin(-2.1)).thenReturn(-0.8632093666488737);
when(tf.cos(-2.1)).thenReturn(-0.5048461045998576);
when(tf.tan(-2.1)).thenReturn(1.7098465429045075);
when(tf.cot(-2.1)).thenReturn(0.5848478064594647);
when(tf.csc(-2.1)).thenReturn(-1.1584675035237058);
when(tf.sec(-2.1)).thenReturn(-1.9808016559672235);
when(tf.sin(-2.2)).thenReturn(-0.8084964038195901);
when(tf.cos(-2.2)).thenReturn(-0.5885011172553458);
when(tf.tan(-2.2)).thenReturn(1.3738230567687948);
when(tf.cot(-2.2)).thenReturn(0.7278957760047939);
when(tf.csc(-2.2)).thenReturn(-1.2368638812438584);
when(tf.sec(-2.2)).thenReturn(-1.6992321181373529);
when(tf.sin(-2.5)).thenReturn(-0.5984721441039564);
when(tf.cos(-2.5)).thenReturn(-0.8011436155469337);
when(tf.tan(-2.5)).thenReturn(0.7470222972386602);
when(tf.cot(-2.5)).thenReturn(1.3386481283041514);
when(tf.csc(-2.5)).thenReturn(-1.67092154555868);
when(tf.sec(-2.5)).thenReturn(-1.2482156514688179);
when(tf.sin(-2.8)).thenReturn(-0.3349881501559051);
when(tf.cos(-2.8)).thenReturn(-0.9422223406686581);
when(tf.tan(-2.8)).thenReturn(0.3555298316511761);
when(tf.cot(-2.8)).thenReturn(2.812703494825543);
when(tf.csc(-2.8)).thenReturn(-2.9851802206573432);
when(tf.sec(-2.8)).thenReturn(-1.061320621298726);
when(tf.sin(-3.1)).thenReturn(-0.04158066243329049);
when(tf.cos(-3.1)).thenReturn(-0.9991351502732795);
when(tf.tan(-3.1)).thenReturn(0.041616654585635904);
when(tf.cot(-3.1)).thenReturn(24.0288415769285);
when(tf.csc(-3.1)).thenReturn(-24.049640902290573);
when(tf.sec(-3.1)).thenReturn(-1.0008655983392076);
when(tf.sin(-3.2)).thenReturn(0.058374143427580086);
when(tf.cos(-3.2)).thenReturn(-0.9982947757947531);
when(tf.tan(-3.2)).thenReturn(-0.058473854459578645);
when(tf.cot(-3.2)).thenReturn(-17.101660378678684);
when(tf.csc(-3.2)).thenReturn(17.13087235687863);
when(tf.sec(-3.2)).thenReturn(-1.00170813696174);
when(tf.sin(-3.5)).thenReturn(0.35078322768961984);
when(tf.cos(-3.5)).thenReturn(-0.9364566872907963);
when(tf.tan(-3.5)).thenReturn(-0.3745856401585947);
when(tf.cot(-3.5)).thenReturn(-2.669616484968866);
when(tf.csc(-3.5)).thenReturn(2.850763437540464);
when(tf.sec(-3.5)).thenReturn(-1.0678550471918107);
when(tf.sin(-3.8)).thenReturn(0.6118578909427189);
when(tf.cos(-3.8)).thenReturn(-0.7909677119144168);
when(tf.tan(-3.8)).thenReturn(-0.7735560905031258);
when(tf.cot(-3.8)).thenReturn(-1.2927310795906135);
when(tf.csc(-3.8)).thenReturn(1.6343664350871603);
when(tf.sec(-3.8)).thenReturn(-1.2642741099755543);
when(tf.sin(-4.2)).thenReturn(0.8715757724135882);
when(tf.cos(-4.2)).thenReturn(-0.4902608213406994);
when(tf.tan(-4.2)).thenReturn(-1.7777797745088417);
when(tf.cot(-4.2)).thenReturn(-0.5624993682225213);
when(tf.csc(-4.2)).thenReturn(1.1473471746819859);
when(tf.sec(-4.2)).thenReturn(-2.039730601489498);
when(tf.sin(-4.25)).thenReturn(0.8949893582285835);
when(tf.cos(-4.25)).thenReturn(-0.4460874899137928);
when(tf.tan(-4.25)).thenReturn(-2.0063090278580593);
when(tf.cot(-4.25)).thenReturn(-0.4984277028686865);
when(tf.csc(-4.25)).thenReturn(1.1173317211047737);
when(tf.sec(-4.25)).thenReturn(-2.2417127191646906);
when(tf.sin(-4.3)).thenReturn(0.9161659367494549);
when(tf.cos(-4.3)).thenReturn(-0.40079917207997545);
when(tf.tan(-4.3)).thenReturn(-2.28584787736698);
when(tf.cot(-4.3)).thenReturn(-0.4374744312171284);
when(tf.csc(-4.3)).thenReturn(1.0915053265874382);
when(tf.sec(-4.3)).thenReturn(-2.495015133914648);
when(tf.sin(-4.4)).thenReturn(0.9516020738895161);
when(tf.cos(-4.4)).thenReturn(-0.30733286997841935);
when(tf.tan(-4.4)).thenReturn(-3.0963237806497457);
when(tf.cot(-4.4)).thenReturn(-0.3229636403820003);
when(tf.csc(-4.4)).thenReturn(1.0508594163867944);
when(tf.sec(-4.4)).thenReturn(-3.253801001078144);
when(tf.sin(-4.5)).thenReturn(0.977530117665097);
when(tf.cos(-4.5)).thenReturn(-0.2107957994307797);
when(tf.tan(-4.5)).thenReturn(-4.637332054551185);
when(tf.cot(-4.5)).thenReturn(-0.21564123255279444);
when(tf.csc(-4.5)).thenReturn(1.022986383671302);
when(tf.sec(-4.5)).thenReturn(-4.743927548368325);
when(tf.sin(-4.6)).thenReturn(0.9936910036334644);
when(tf.cos(-4.6)).thenReturn(-0.11215252693505487);
when(tf.tan(-4.6)).thenReturn(-8.860174895648045);
when(tf.cot(-4.6)).thenReturn(-0.11286458921834393);
when(tf.csc(-4.6)).thenReturn(1.0063490525157885);
when(tf.sec(-4.6)).thenReturn(-8.916428611359587);
when(tf.sin(-4.8)).thenReturn(0.9961646088358407);
when(tf.cos(-4.8)).thenReturn(0.0874989834394464);
when(tf.tan(-4.8)).thenReturn(11.384870654242922);
when(tf.cot(-4.8)).thenReturn(0.08783586835282307);
when(tf.csc(-4.8)).thenReturn(1.0038501580262338);
when(tf.sec(-4.8)).thenReturn(11.428704205369987);
when(tf.sin(-4.9)).thenReturn(0.9824526126243325);
when(tf.cos(-4.9)).thenReturn(0.18651236942257576);
when(tf.tan(-4.9)).thenReturn(5.267493065826737);
when(tf.cot(-4.9)).thenReturn(0.1898436291236103);
when(tf.csc(-4.9)).thenReturn(1.0178607977119576);
when(tf.sec(-4.9)).thenReturn(5.361574693924608);
when(tf.sin(-5.0)).thenReturn(0.9589242746631385);
when(tf.cos(-5.0)).thenReturn(0.28366218546322625);
when(tf.tan(-5.0)).thenReturn(3.380515006246586);
when(tf.cot(-5.0)).thenReturn(0.2958129155327455);
when(tf.csc(-5.0)).thenReturn(1.0428352127714058);
when(tf.sec(-5.0)).thenReturn(3.5253200858160887);
when(tf.sin(-5.1)).thenReturn(0.9258146823277325);
when(tf.cos(-5.1)).thenReturn(0.37797774271298024);
when(tf.tan(-5.1)).thenReturn(2.4493894155845988);
when(tf.cot(-5.1)).thenReturn(0.408265012348528);
when(tf.csc(-5.1)).thenReturn(1.080129770123916);
when(tf.sec(-5.1)).thenReturn(2.6456584263993457);
when(tf.sin(-5.15)).thenReturn(0.9057666414687044);
when(tf.cos(-5.15)).thenReturn(0.4237768176794282);
when(tf.tan(-5.15)).thenReturn(2.1373671321348304);
when(tf.cot(-5.15)).thenReturn(0.46786534000884855);
when(tf.csc(-5.15)).thenReturn(1.104037126360158);
when(tf.sec(-5.15)).thenReturn(2.3597326665387905);
when(tf.sin(-5.2)).thenReturn(0.8834546557201531);
when(tf.cos(-5.2)).thenReturn(0.4685166713003771);
when(tf.tan(-5.2)).thenReturn(1.8856418775197639);
when(tf.cot(-5.2)).thenReturn(0.5303233938118341);
when(tf.csc(-5.2)).thenReturn(1.1319200069015927);
when(tf.sec(-5.2)).thenReturn(2.1343957670161036);
when(tf.sin(-5.3)).thenReturn(0.8322674422239013);
when(tf.cos(-5.3)).thenReturn(0.5543743361791608);
when(tf.tan(-5.3)).thenReturn(1.50127339580693);
when(tf.cot(-5.3)).thenReturn(0.6661011930225427);
when(tf.csc(-5.3)).thenReturn(1.2015368489339204);
when(tf.sec(-5.3)).thenReturn(1.8038353053861849);
when(tf.sin(-5.4)).thenReturn(0.7727644875559871);
when(tf.cos(-5.4)).thenReturn(0.6346928759426347);
when(tf.tan(-5.4)).thenReturn(1.2175408246205552);
when(tf.cot(-5.4)).thenReturn(0.8213276957769762);
when(tf.csc(-5.4)).thenReturn(1.2940553248800133);
when(tf.sec(-5.4)).thenReturn(1.575565187359032);
when(tf.sin(-5.5)).thenReturn(0.7055403255703919);
when(tf.cos(-5.5)).thenReturn(0.70866977429126);
when(tf.tan(-5.5)).thenReturn(0.995584052213885);
when(tf.cot(-5.5)).thenReturn(1.0044355348765333);
when(tf.csc(-5.5)).thenReturn(1.4173534293614658);
when(tf.sec(-5.5)).thenReturn(1.4110944706229345);
when(tf.sin(-5.6)).thenReturn(0.6312666378723216);
when(tf.cos(-5.6)).thenReturn(0.7755658785102496);
when(tf.tan(-5.6)).thenReturn(0.8139432836897027);
when(tf.cot(-5.6)).thenReturn(1.2285868315871835);
when(tf.csc(-5.6)).thenReturn(1.5841166632383596);
when(tf.sec(-5.6)).thenReturn(1.2893811186238053);
when(tf.sin(-5.65)).thenReturn(0.5917155806310094);
when(tf.cos(-5.65)).thenReturn(0.8061468052647157);
when(tf.tan(-5.65)).thenReturn(0.7340047454963328);
when(tf.cot(-5.65)).thenReturn(1.3623890119726703);
when(tf.csc(-5.65)).thenReturn(1.69000113016053);
when(tf.sec(-5.65)).thenReturn(1.2404688494319944);
when(tf.sin(-5.7)).thenReturn(0.5506855425976376);
when(tf.cos(-5.7)).thenReturn(0.8347127848391598);
when(tf.tan(-5.7)).thenReturn(0.6597305715207762);
when(tf.cot(-5.7)).thenReturn(1.5157702904306112);
when(tf.csc(-5.7)).thenReturn(1.815918382899435);
when(tf.sec(-5.7)).thenReturn(1.198016872585328);
when(tf.sin(-5.8)).thenReturn(0.46460217941375737);
when(tf.cos(-5.8)).thenReturn(0.8855195169413189);
when(tf.tan(-5.8)).thenReturn(0.5246662219468002);
when(tf.cot(-5.8)).thenReturn(1.9059736612916494);
when(tf.csc(-5.8)).thenReturn(2.1523790552636157);
when(tf.sec(-5.8)).thenReturn(1.1292805871225844);
when(tf.sin(-6.0)).thenReturn(0.27941549819892586);
when(tf.cos(-6.0)).thenReturn(0.960170286650366);
when(tf.tan(-6.0)).thenReturn(0.29100619138474915);
when(tf.cot(-6.0)).thenReturn(3.436353004180128);
when(tf.csc(-6.0)).thenReturn(3.5788995472544056);
when(tf.sec(-6.0)).thenReturn(1.0414819265951076);
when(tf.sin(-6.2)).thenReturn(0.0830894028174964);
when(tf.cos(-6.2)).thenReturn(0.9965420970232175);
when(tf.tan(-6.2)).thenReturn(0.08337771486592861);
when(tf.cot(-6.2)).thenReturn(11.993612461171432);
when(tf.csc(-6.2)).thenReturn(12.035229115757067);
when(tf.sec(-6.2)).thenReturn(1.003469901559715);
IComplexFunctions complexFunctions = new ComplexFunctions(tf, lf);
systemFunctions = new SystemFunctions(complexFunctions);
}
/*
* Test Positive Values
*/
/**
* x = (0.0; 0.55]
*/
@Test
public void testFirstPositiveRegionFromZeroX(){
precisionAssertEquals(
"Test [x = 0.02]: first positive region from zero X",
-26465.8,
systemFunctions.calculate(0.02)
);
precisionAssertEquals(
"Test [x = 0.1]: first positive region from zero X",
-675.99,
systemFunctions.calculate(0.1)
);
precisionAssertEquals(
"Test [x = 0.2]: first positive region from zero Xt",
-60.0068,
systemFunctions.calculate(0.2)
);
precisionAssertEquals(
"Test [x = 0.3]: first positive region from zero Xt",
-8.64993,
systemFunctions.calculate(0.3)
);
precisionAssertEquals(
"Test [x = 0.4]: first positive region from zero Xt",
-0.999078,
systemFunctions.calculate(0.4)
);
precisionAssertEquals(
"Test [x = 0.5]: first positive region from zero Xt",
0.487504,
systemFunctions.calculate(0.5)
);
precisionAssertEquals(
"Test [x = 0.55]: first positive region from zero Xt",
0.714449,
systemFunctions.calculate(0.55)
);
}
/**
* x = (0.55; 1.0)
*/
@Test
public void testSecondPositiveRegionToPuncturePoint() {
precisionAssertEquals(
"Test [x = 0.6]: second positive region to first puncture point",
0.826229,
systemFunctions.calculate(0.6)
);
precisionAssertEquals(
"Test [x = 0.7]: second positive region to first puncture point",
0.909484,
systemFunctions.calculate(0.7)
);
precisionAssertEquals(
"Test [x = 0.8]: second positive region to first puncture point",
0.928675,
systemFunctions.calculate(0.8)
);
precisionAssertEquals(
"Test [x = 0.9]: second positive region to first puncture point",
0.931799,
systemFunctions.calculate(0.9)
);
}
/**
* x = 1.0
*/
@Test
public void testFirstPositivePuncturePoint() {
assertTrue(
"Test [x = 1.0]: first positive puncture point",
Double.isNaN(systemFunctions.calculate(1d))
);
}
/**
* x = (1.0; 1.2]
*/
@Test
public void testThirdPositiveRegion(){
precisionAssertEquals(
"Test [x = 1.05]: third positive region",
0.931952,
systemFunctions.calculate(1.05)
);
precisionAssertEquals(
"Test [x = 1.1]: third positive region",
0.931852,
systemFunctions.calculate(1.1)
);
precisionAssertEquals(
"Test [x = 1.15]: third positive region",
0.931464,
systemFunctions.calculate(1.15)
);
precisionAssertEquals(
"Test [x = 1.2]: third positive region",
0.930531,
systemFunctions.calculate(1.2)
);
}
/**
* x = (1.2; 1.75]
*/
@Test
public void testFourthPositiveRegion(){
precisionAssertEquals(
"Test [x = 1.3]: fourth positive region",
0.92594,
systemFunctions.calculate(1.3)
);
precisionAssertEquals(
"Test [x = 1.5]: fourth positive region",
0.900074,
systemFunctions.calculate(1.5)
);
precisionAssertEquals(
"Test [x = 1.75]: fourth positive region",
0.836129,
systemFunctions.calculate(1.75)
);
}
/**
* x = (1.75; e^(2^(2/3) (log(5)/(7 log(10)))^(1/3)))
*/
@Test
public void testFifthPositiveRegionToFirstExtreme(){
precisionAssertEquals(
"Test [x = 1.8]: fifth positive region",
0.821522,
systemFunctions.calculate(1.8)
);
precisionAssertEquals(
"Test [x = 1.9]: fifth positive region",
0.794358,
systemFunctions.calculate(1.9)
);
precisionAssertEquals(
"Test [x = 2.0]: fifth positive region",
0.774356,
systemFunctions.calculate(2.0)
);
}
/**
* x = e^(2^(2/3) (log(5)/(7 log(10)))^(1/3))
*/
@Test
public void testFirstPositiveExtreme(){
double extremeX = 2.0884971449233825358269495952366013421428061969691576000370777169;
double extremeY = 0.76756354102375411049030346684527510737400057387717261292998154511104;
precisionAssertEquals(
"Test [x = e^(2^(2/3) (log(5)/(7 log(10)))^(1/3))]: first positive extreme",
extremeY,
systemFunctions.calculate(extremeX)
);
assertTrue(
"Test [x = 2.0]: extreme value Y less than left neighborhood value",
systemFunctions.calculate(2.0) > extremeY
);
assertTrue(
"Test [x = 2.1]: extreme value Y less than right neighborhood value",
systemFunctions.calculate(2.1) > extremeY
);
}
/**
* x = ( e^(2^(2/3) (log(5)/(7 log(10)))^(1/3)); +inf)
*/
@Test
public void testSixthPositiveRegion() {
precisionAssertEquals(
"Test [x = 2.1]: sixth positive region",
0.767694,
systemFunctions.calculate(2.1)
);
precisionAssertEquals(
"Test [x = 2.5]: fifth positive region",
1.02447,
systemFunctions.calculate(2.5)
);
precisionAssertEquals(
"Test [x = 3.0]: fifth positive region",
2.63606,
systemFunctions.calculate(3.0)
);
precisionAssertEquals(
"Test [x = 5.0]: fifth positive region",
44.3698,
systemFunctions.calculate(5.0)
);
precisionAssertEquals(
"Test [x = 10.0]: fifth positive region",
604.538,
systemFunctions.calculate(10.0)
);
precisionAssertEquals(
"Test [x = 20.0]: fifth positive region",
3935.8,
systemFunctions.calculate(20.0)
);
precisionAssertEquals(
"Test [x = 100.0]: fifth positive region",
81368.217,
systemFunctions.calculate(100.0)
);
}
/*
* Test Negative/Zero Values
*/
/**
* x = 0
*/
@Test
public void testZeroPuncturePoint(){
assertTrue(
"Test [x = 0.0]: zero value puncture point",
Double.isNaN(systemFunctions.calculate(0))
);
}
/**
* x = (-1.2; 0.0)
*/
@Test
public void testFirstNegativeRegionToExtremePoint(){
precisionAssertEquals(
"Test [x = -0.4]: first negative region",
50.2412,
systemFunctions.calculate(-0.4)
);
precisionAssertEquals(
"Test [x = 0.7]: first negative region",
10.964,
systemFunctions.calculate(-0.7)
);
precisionAssertEquals(
"Test [x = -1.15]: first negative region",
3.65397,
systemFunctions.calculate(-1.15)
);
}
/**
* x = -1.2
*/
@Test
public void testFirstNegativeExtremePoint() {
double extremeY = 3.60465;
precisionAssertEquals(
"Test [x = -1.2]: first negative extreme point",
extremeY,
systemFunctions.calculate(-1.2)
);
assertTrue(
"Test [x = -1.2]: extreme value Y less than left neighborhood",
systemFunctions.calculate(-1.25) > extremeY
);
assertTrue(
"Test [x = -1.2]: extreme value Y high less right neighborhood",
systemFunctions.calculate(-1.15) > extremeY
);
}
/**
* x = (-pi/2; -1.2)
*/
@Test
public void testSecondNegativeRegionToPuncturePoint(){
precisionAssertEquals(
"Test [x = -1.3]: second negative region",
3.97437,
systemFunctions.calculate(-1.3)
);
precisionAssertEquals(
"Test [x = -1.4]: second negative region",
5.61428,
systemFunctions.calculate(-1.4)
);
precisionAssertEquals(
"Test [x = -1.5]: second negative region",
13.4263,
systemFunctions.calculate(-1.5)
);
}
/**
* x = -pi/2
*/
@Test
public void testFirstNegativePuncturePoint(){
var result = systemFunctions.calculate(-Math.PI / 2);
assertTrue(
"Test [x = -pi/2]: puncture point",
Double.isNaN(result) || Math.abs(result) > PuncturePointLimit
);
}
/**
* x = (-1.95; -pi/2)
*/
@Test
public void testThirdNegativeRegionToExtremePoint(){
precisionAssertEquals(
"Test [x = -1.7]: third negative region",
-9.26823,
systemFunctions.calculate(-1.7)
);
precisionAssertEquals(
"Test [x = -1.8]: third negative region",
-6.30266,
systemFunctions.calculate(-1.8)
);
precisionAssertEquals(
"Test [x = -1.9]: third negative region",
-5.40983,
systemFunctions.calculate(-1.9)
);
}
/**
* x = -1.95
*/
@Test
public void testSecondNegativeExtremePoint() {
double extremeY = -5.23951;
precisionAssertEquals(
"Test [x = -1.95]: second negative extreme point",
extremeY,
systemFunctions.calculate(-1.95)
);
assertTrue(
"Test [x = -1.9]: extreme value Y greater than left neighborhood",
systemFunctions.calculate(-1.9) < extremeY
);
assertTrue(
"Test [x = -2.1]: extreme value Y greater right neighborhood",
systemFunctions.calculate(-2.1) < extremeY
);
}
/**
* x = (-pi; -1.95)
*/
@Test
public void testFourthNegativeRegionToPuncturePoint(){
precisionAssertEquals(
"Test [x = -2.2]: fourth negative region",
-5.61752,
systemFunctions.calculate(-2.2)
);
precisionAssertEquals(
"Test [x = -2.5]: fourth negative region",
-8.44473,
systemFunctions.calculate(-2.5)
);
precisionAssertEquals(
"Test [x = -2.8]: fourth negative region",
-21.5672,
systemFunctions.calculate(-2.8)
);
precisionAssertEquals(
"Test [x = -3.1]: fourth negative region",
-1171.27,
systemFunctions.calculate(-3.1)
);
}
/**
* x = -pi
*/
@Test
public void testSecondNegativePuncturePoint() {
double result = systemFunctions.calculate(-Math.PI);
assertTrue(
"Test [x = -pi]: puncture point",
Double.isNaN(result) || Math.abs(result) > PuncturePointLimit
);
}
/**
* x = (-4.25; -pi)
*/
@Test
public void testFifthNegativeRegionToExtremePoint(){
precisionAssertEquals(
"Test [x = -3.2]: fifth negative region",
-580.903,
systemFunctions.calculate(-3.2)
);
precisionAssertEquals(
"Test [x = -3.5]: fifth negative region",
-17.4998,
systemFunctions.calculate(-3.5)
);
precisionAssertEquals(
"Test [x = -3.8]: fifth negative region",
-7.27089,
systemFunctions.calculate(-3.8)
);
precisionAssertEquals(
"Test [x = -4.2]: fifth negative region",
-5.05901,
systemFunctions.calculate(-4.2)
);
}
/**
* x = -4.25
*/
@Test
public void testThirdNegativeExtremePoint() {
double extremeY = -5.04151;
precisionAssertEquals(
"Test [x = -4.25]: third negative extreme point",
extremeY,
systemFunctions.calculate(-4.25)
);
assertTrue(
"Test [x = -4.2]: extreme value Y greater than left neighborhood",
systemFunctions.calculate(-4.2) < extremeY
);
assertTrue(
"Test [x = -4.3]: extreme value Y greater right neighborhood",
systemFunctions.calculate(-4.3) < extremeY
);
}
/**
* x = (-3pi/2; -4.25)
*/
@Test
public void testSixthNegativeRegionToPuncturePoint(){
precisionAssertEquals(
"Test [x = -4.3]: sixth negative region",
-5.08678,
systemFunctions.calculate(-4.3)
);
precisionAssertEquals(
"Test [x = -4.4]: sixth negative region",
-5.45166,
systemFunctions.calculate(-4.4)
);
precisionAssertEquals(
"Test [x = -4.5]: sixth negative region",
-6.5621,
systemFunctions.calculate(-4.5)
);
precisionAssertEquals(
"Test [x = -4.6]: sixth negative region",
-10.3553,
systemFunctions.calculate(-4.6)
);
}
/**
* x = -3pi/2
*/
@Test
public void testThirdNegativePuncturePoint(){
double result = systemFunctions.calculate(-3 * Math.PI / 2);
assertTrue(
"Test [x = -3pi/2]: puncture point",
Double.isNaN(result) || Math.abs(result) > PuncturePointLimit
);
}
/**
* x = (-5.15; -3pi/2)
*/
@Test
public void testSeventhNegativeRegionToExtremePoint(){
precisionAssertEquals(
"Test [x = -4.8]: seventh negative region",
10.7877,
systemFunctions.calculate(-4.8)
);
precisionAssertEquals(
"Test [x = -4.9]: seventh negative region",
5.15571,
systemFunctions.calculate(-4.9)
);
precisionAssertEquals(
"Test [x = -5.0]: seventh negative region",
3.78871,
systemFunctions.calculate(-5.0)
);
precisionAssertEquals(
"Test [x = -5.1]: seventh negative region",
3.41948,
systemFunctions.calculate(-5.1)
);
}
/**
* x = -5.15
*/
@Test
public void testFourthNegativeExtremePoint() {
double extremeY = 3.40621;
precisionAssertEquals(
"Test [x = -5.15]: fourth negative extreme point",
extremeY,
systemFunctions.calculate(-5.15)
);
assertTrue(
"Test [x = -5.1]: extreme value Y less than left neighborhood",
systemFunctions.calculate(-5.1) > extremeY
);
assertTrue(
"Test [x = -5.2]: extreme value Y less right neighborhood",
systemFunctions.calculate(-5.2) > extremeY
);
}
/**
* x = (-5.7; -5.15)
*/
@Test
public void testEightNegativeRegionToExtremePoint(){
precisionAssertEquals(
"Test [x = -5.3]: eight negative region",
3.74355,
systemFunctions.calculate(-5.3)
);
precisionAssertEquals(
"Test [x = -5.4]: eight negative region",
4.16767,
systemFunctions.calculate(-5.4)
);
precisionAssertEquals(
"Test [x = -5.5]: eight negative region",
4.66807,
systemFunctions.calculate(-5.5)
);
precisionAssertEquals(
"Test [x = -5.6]: eight negative region",
5.12033,
systemFunctions.calculate(-5.6)
);
}
/**
* x = -5.65
*/
@Test
public void tesFifthNegativeExtremePoint() {
double extremeY = 5.24277;
precisionAssertEquals(
"Test [x = -5.65]: fourth negative extreme point",
extremeY,
systemFunctions.calculate(-5.65)
);
assertTrue(
"Test [x = -5.6]: extreme value Y greater than left neighborhood",
systemFunctions.calculate(-5.6) < extremeY
);
assertTrue(
"Test [x = -5.7]: extreme value Y greater right neighborhood",
systemFunctions.calculate(-5.7) < extremeY
);
}
/**
* x = (-2pi; -5.65)
*/
@Test
public void testNineNegativeRegionToPuncturePoint(){
precisionAssertEquals(
"Test [x = -5.8]: nine negative region",
3.89952,
systemFunctions.calculate(-5.8)
);
precisionAssertEquals(
"Test [x = -6.0]: nine negative region",
-29.835,
systemFunctions.calculate(-6.0)
);
precisionAssertEquals(
"Test [x = -6.2]: nine negative region",
-2866.63,
systemFunctions.calculate(-6.2)
);
}
}
| [
"[email protected]"
] | |
3c9cb9c5f98e1b42b0185e7ff7c4bf53e1e74f7d | 8e1bcc14a9d8f5be0527695918bc7809e2c06b4d | /reportng/src/test/java/org/uncommons/reportng/sample/SuccessfulTests.java | 3f805dfc9d2dff9b66be0ac3886df00ab03c68ee | [] | no_license | douzi0128/reportng_zym | 9d44a10a17c03ca578309e39b14877fc136edaad | a71761508710ad4aeb60db5d99d5fcc95ee7c9a4 | refs/heads/master | 2023-03-12T22:19:26.918296 | 2021-03-02T02:09:15 | 2021-03-02T02:09:15 | 328,678,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,149 | java | //=============================================================================
// Copyright 2006-2010 Daniel W. Dyer
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//=============================================================================
package org.uncommons.reportng.sample;
import org.testng.Reporter;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.Test;
/**
* Some successful tests to be included in the sample output.
* @author Daniel Dyer
*/
@Test(groups = "should-pass")
public class SuccessfulTests
{
@Test
public void test()
{
assert true;
}
@Test(description = "This is a test description")
public void testWithDescription()
{
assert true;
}
@Test
public void testWithOutput()
{
Reporter.log("Here is some output from a successful test.");
assert true;
}
@Test
public void testWithMultiLineOutput()
{
Reporter.log("This is the first line of 3.");
Reporter.log("This is a second line.");
Reporter.log("This is the third.");
assert true;
}
@AfterMethod
public void afterMethod()
{
// This is here to detect any problems processing config
// methods.
}
@AfterClass
public void afterClass()
{
// This is here to detect any problems processing config
// methods.
}
@AfterSuite
public void afterSuite()
{
// This is here to detect any problems processing config
// methods.
}
}
| [
"[email protected]"
] | |
c330eb12458955919ffb3513d6b1572abf1f76fb | 2583848876d84d2d75e2dc6ce95fe2ce5f018e39 | /RMI_Example/src/src/client/chatModel/ChatModelManager.java | 01ad57e5e172ca659e5452ec602e225c4e121cbe | [] | no_license | gosiadrygala/Exercise_Examples | 4b15005ca8b0d8d098da7e7046613a936d24f193 | 63165e5584fce9ce354b57951c03577ec763aab3 | refs/heads/master | 2023-03-05T00:52:32.905389 | 2021-02-13T20:28:17 | 2021-02-13T20:28:17 | 338,663,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,806 | java | package src.client.chatModel;
import src.client.networking.Client;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.List;
public class ChatModelManager implements ChatModel
{
private Client client;
private PropertyChangeSupport support = new PropertyChangeSupport(this);
public ChatModelManager(Client client)
{
this.client = client;
client.addListener("NewLogin", this::onNewLogin);
client.addListener("NewMessage", this::onNewMessage);
client.addListener("LogOut", this::onLogOut);
}
private void onLogOut(PropertyChangeEvent propertyChangeEvent)
{
support.firePropertyChange(propertyChangeEvent);
}
private void onNewMessage(PropertyChangeEvent propertyChangeEvent)
{
support.firePropertyChange(propertyChangeEvent);
}
private void onNewLogin(PropertyChangeEvent propertyChangeEvent)
{
support.firePropertyChange(propertyChangeEvent);
}
@Override public String loggedInAs()
{
return client.loggedInAs();
}
@Override public List<String> getUserList()
{
return client.getUserList();
}
@Override public void sendMessageToAll(String text)
{
client.sendMessageToAll(text);
}
@Override public void sendPM(String message, String userToSendMessageTo)
{
client.sendPM(message, userToSendMessageTo);
}
@Override public void logOut(String userToLogOut)
{
client.logOut(userToLogOut);
}
@Override
public void addListener(String eventName, PropertyChangeListener listener) {
support.addPropertyChangeListener(eventName, listener);
}
@Override
public void removeListener(String eventName, PropertyChangeListener listener) {
support.removePropertyChangeListener(eventName, listener);
}
}
| [
"[email protected]"
] | |
59a1103ee5a115b575478d587005da77c177e78f | 3892a26c0251dec336ac12513def7be711f5f9d2 | /quanyingapp/src/main/java/com/qyw/newdemo/app/entity/MessageEntity.java | b30d0b00b8ace53b000865b82f08d61bec0b22c7 | [] | no_license | RedWolfChao/lihong | 104a9b880fd1172735591067dbc2c223b42d83ba | b8529b6603b4a14970c2fdf863f5d4f28b2274b9 | refs/heads/master | 2020-04-27T15:18:04.885281 | 2019-03-08T00:18:12 | 2019-03-08T00:18:12 | 174,440,509 | 0 | 0 | null | 2019-03-08T00:19:53 | 2019-03-08T00:19:52 | null | UTF-8 | Java | false | false | 1,120 | java | package com.qyw.newdemo.app.entity;
/**
* Created by Administrator on 2017/8/19 0019.
*/
public class MessageEntity {
private String user_name;
private String content_text;
private String time_text;
private String Usericon_url;
private String mesId;
public MessageEntity() {
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getContent_text() {
return content_text;
}
public void setContent_text(String content_text) {
this.content_text = content_text;
}
public String getTime_text() {
return time_text;
}
public void setTime_text(String time_text) {
this.time_text = time_text;
}
public String getUsericon_url() {
return Usericon_url;
}
public void setUsericon_url(String usericon_url) {
Usericon_url = usericon_url;
}
public String getMesId() {
return mesId;
}
public void setMesId(String mesId) {
this.mesId = mesId;
}
}
| [
"[email protected]"
] | |
e40f4317cdbaa93b6ec807d5cf7b45447bb5f4cc | c586d1a682b409a7ca550f668bd9fedaa4df0611 | /src/main/java/ryzner/adviceservice/model/Question.java | e022b7e991ba2fc16438b09bc96fc2978311d212 | [] | no_license | agnieszkaryzner/Advice-Service | ad439f8726c925944059a91014efbbf15e7136bc | 3c0eb18bf5d70eafe11b8c2c26b71b5cf2280bd8 | refs/heads/master | 2020-09-22T09:27:33.235752 | 2019-12-01T13:50:26 | 2019-12-01T13:50:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,435 | java | package ryzner.adviceservice.model;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@Entity
public class Question {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@NotNull
@ManyToOne
private User user;
@Size(min = 10, max = 500)
@NotEmpty
@NotNull
private String title;
@NotEmpty
@NotNull
@Size(min = 10, max = 5000)
private String content;
@OrderBy("createdOn")
@OneToMany(mappedBy = "question")
private List<Answer> answers = new ArrayList<>();
@CreationTimestamp
private LocalDateTime createdOn;
public List<Answer> getAnswers() {
return answers;
}
public void addAnswers(Answer answer){
this.answers.add(answer);
answer.setQuestion(this);
}
public long getId() {
return id;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public LocalDateTime getCreatedOn() {
return createdOn;
}
@Override
public String toString() {
return "Question{" +
"id=" + id +
", title='" + title + '\'' +
", createdOn='" + createdOn + '\'' +
", content='" + content +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Question question = (Question) o;
return id == question.id &&
Objects.equals(title, question.title) &&
Objects.equals(createdOn, question.createdOn) &&
Objects.equals(content, question.content);
}
@Override
public int hashCode() {
return Objects.hash(id, title, content, createdOn);
}
}
| [
"[email protected]"
] | |
785f0e00a0fdbd491e3472145663ec5cd8a87813 | ed801c3025a2d3ab8a971ceff200fcdf19929019 | /org.xtext.example.mydsl/src-gen/org/xtext/example/mydsl/myDsl/NTiersConnections.java | 8b8a1d60726b7c3fb58307288e9e37ecddcb84ad | [
"MIT"
] | permissive | mdsd-team-1/photos-xtext | 549b639573ac9d37b8d1aebda1ed0983cab562ae | 3d3d85d6c4ecaf5c20de1f8219fa0a3c9b487b6e | refs/heads/master | 2020-06-06T03:23:42.438678 | 2019-06-25T17:41:33 | 2019-06-25T17:41:33 | 192,624,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,086 | java | /**
* generated by Xtext 2.18.0
*/
package org.xtext.example.mydsl.myDsl;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>NTiers Connections</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.xtext.example.mydsl.myDsl.NTiersConnections#getNtierconnection <em>Ntierconnection</em>}</li>
* <li>{@link org.xtext.example.mydsl.myDsl.NTiersConnections#getName <em>Name</em>}</li>
* <li>{@link org.xtext.example.mydsl.myDsl.NTiersConnections#getNtierorigin <em>Ntierorigin</em>}</li>
* <li>{@link org.xtext.example.mydsl.myDsl.NTiersConnections#getNtiertarget <em>Ntiertarget</em>}</li>
* </ul>
*
* @see org.xtext.example.mydsl.myDsl.MyDslPackage#getNTiersConnections()
* @model
* @generated
*/
public interface NTiersConnections extends EObject
{
/**
* Returns the value of the '<em><b>Ntierconnection</b></em>' attribute list.
* The list contents are of type {@link java.lang.String}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Ntierconnection</em>' attribute list.
* @see org.xtext.example.mydsl.myDsl.MyDslPackage#getNTiersConnections_Ntierconnection()
* @model unique="false"
* @generated
*/
EList<String> getNtierconnection();
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see org.xtext.example.mydsl.myDsl.MyDslPackage#getNTiersConnections_Name()
* @model
* @generated
*/
String getName();
/**
* Sets the value of the '{@link org.xtext.example.mydsl.myDsl.NTiersConnections#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
void setName(String value);
/**
* Returns the value of the '<em><b>Ntierorigin</b></em>' containment reference list.
* The list contents are of type {@link org.xtext.example.mydsl.myDsl.NTierSource}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Ntierorigin</em>' containment reference list.
* @see org.xtext.example.mydsl.myDsl.MyDslPackage#getNTiersConnections_Ntierorigin()
* @model containment="true"
* @generated
*/
EList<NTierSource> getNtierorigin();
/**
* Returns the value of the '<em><b>Ntiertarget</b></em>' containment reference list.
* The list contents are of type {@link org.xtext.example.mydsl.myDsl.NTierTarget}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Ntiertarget</em>' containment reference list.
* @see org.xtext.example.mydsl.myDsl.MyDslPackage#getNTiersConnections_Ntiertarget()
* @model containment="true"
* @generated
*/
EList<NTierTarget> getNtiertarget();
} // NTiersConnections
| [
"[email protected]"
] | |
fadb53a73b2d8a7b28d55538b55844df32e0361f | 6e954b23bd08209a65a9be1908aca6a77712a7b9 | /web-test/server20/src/com/clrserver/container/packagings/EventObject.java | 1c7dbf9ed8d73d7fc2067ec5b465d56564c02387 | [] | no_license | chengliangran/clrserver | 003315315abaa44179e2be030f5a692408a8c742 | 5fa9fd1be4fbc62f76e6482521acb6daca859a13 | refs/heads/master | 2021-01-13T05:24:09.067957 | 2017-04-19T09:59:13 | 2017-04-19T09:59:13 | 81,401,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java | package com.clrserver.container.packagings;
/**
* Created by Administrator on 2017-04-19.
*/
public class EventObject {
}
| [
"[email protected]"
] | |
12b52d8e076ebe095fddcbde6e0897b6fed52af7 | 5f403ba0568e327cb9e6f3a7cfa4aff801cc4d4c | /src/main/java/com/tuneit/data/Poem.java | 000764229610586f9a606f41f6176e2dd1f55289 | [] | no_license | Fin99/gitgen | fb0d39e962ca6c8985fb08237c38a123279468b7 | 6fa6b6860d7bc3c74ddcfee63f50740c7113e18a | refs/heads/master | 2022-03-13T22:31:15.234032 | 2019-09-16T15:48:43 | 2019-09-16T15:48:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 459 | java | package com.tuneit.data;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlAccessorType(XmlAccessType.FIELD)
@Data
public class Poem {
@XmlElement(name = "quatrain1")
private String quatrain1;
@XmlElement(name = "quatrain2")
private String quatrain2;
@XmlElement(name = "quatrain3")
private String quatrain3;
}
| [
"[email protected]"
] | |
31cb052e0eb5da72e74fb2b011552543ac7b49eb | f7e1635d3437c0f42301793d361055c5aa825610 | /src/main/java/hu/akarnokd/rxjava2flow/internal/operators/PublisherAmb.java | acf3f2c7cc8d36fb064335a335b070e54b86b124 | [
"Apache-2.0"
] | permissive | akarnokd/RxJavaUtilConcurrentFlow | b614241dce271b379201aa167f52a4f3eaa8a9be | 3b80aabea8c8f732cb08fa97f2666ebf11b4752e | refs/heads/master | 2021-01-10T14:22:55.478270 | 2015-11-13T00:47:48 | 2015-11-13T00:47:48 | 46,087,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,534 | java | /**
* Copyright 2015 David Karnok and Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
package hu.akarnokd.rxjava2flow.internal.operators;
import java.util.concurrent.atomic.*;
import hu.akarnokd.rxjava2flow.internal.subscriptions.*;
import hu.akarnokd.rxjava2flow.internal.util.BackpressureHelper;
import hu.akarnokd.rxjava2flow.plugins.RxJavaPlugins;
import java.util.concurrent.Flow.*;
public final class PublisherAmb<T> implements Publisher<T> {
final Publisher<? extends T>[] sources;
final Iterable<? extends Publisher<? extends T>> sourcesIterable;
public PublisherAmb(Publisher<? extends T>[] sources, Iterable<? extends Publisher<? extends T>> sourcesIterable) {
this.sources = sources;
this.sourcesIterable = sourcesIterable;
}
@Override
@SuppressWarnings("unchecked")
public void subscribe(Subscriber<? super T> s) {
Publisher<? extends T>[] sources = this.sources;
int count = 0;
if (sources == null) {
sources = new Publisher[8];
for (Publisher<? extends T> p : sourcesIterable) {
if (count == sources.length) {
Publisher<? extends T>[] b = new Publisher[count + (count >> 2)];
System.arraycopy(sources, 0, b, 0, count);
sources = b;
}
sources[count++] = p;
}
} else {
count = sources.length;
}
if (count == 0) {
EmptySubscription.complete(s);
return;
} else
if (count == 1) {
sources[0].subscribe(s);
return;
}
AmbCoordinator<T> ac = new AmbCoordinator<>(s, count);
ac.subscribe(sources);
}
static final class AmbCoordinator<T> implements Subscription {
final Subscriber<? super T> actual;
final AmbInnerSubscriber<T>[] subscribers;
volatile int winner;
@SuppressWarnings("rawtypes")
static final AtomicIntegerFieldUpdater<AmbCoordinator> WINNER =
AtomicIntegerFieldUpdater.newUpdater(AmbCoordinator.class, "winner");
@SuppressWarnings("unchecked")
public AmbCoordinator(Subscriber<? super T> actual, int count) {
this.actual = actual;
this.subscribers = new AmbInnerSubscriber[count];
}
public void subscribe(Publisher<? extends T>[] sources) {
AmbInnerSubscriber<T>[] as = subscribers;
int len = as.length;
for (int i = 0; i < len; i++) {
as[i] = new AmbInnerSubscriber<>(this, i + 1, actual);
}
WINNER.lazySet(this, 0); // release the contents of 'as'
actual.onSubscribe(this);
for (int i = 0; i < len; i++) {
if (winner != 0) {
return;
}
sources[i].subscribe(as[i]);
}
}
@Override
public void request(long n) {
if (SubscriptionHelper.validateRequest(n)) {
return;
}
int w = winner;
if (w > 0) {
subscribers[w - 1].request(n);
} else
if (w == 0) {
for (AmbInnerSubscriber<T> a : subscribers) {
a.request(n);
}
}
}
public boolean win(int index) {
int w = winner;
if (w == 0) {
if (WINNER.compareAndSet(this, 0, index)) {
AmbInnerSubscriber<T>[] a = subscribers;
int n = a.length;
for (int i = 0; i < n; i++) {
if (i + 1 != index) {
a[i].cancel();
}
}
return true;
}
return false;
}
return w == index;
}
@Override
public void cancel() {
if (winner != -1) {
WINNER.lazySet(this, -1);
for (AmbInnerSubscriber<T> a : subscribers) {
a.cancel();
}
}
}
}
static final class AmbInnerSubscriber<T> extends AtomicReference<Subscription> implements Subscriber<T>, Subscription {
/** */
private static final long serialVersionUID = -1185974347409665484L;
final AmbCoordinator<T> parent;
final int index;
final Subscriber<? super T> actual;
boolean won;
volatile long missedRequested;
@SuppressWarnings("rawtypes")
static final AtomicLongFieldUpdater<AmbInnerSubscriber> MISSED_REQUESTED =
AtomicLongFieldUpdater.newUpdater(AmbInnerSubscriber.class, "missedRequested");
static final Subscription CANCELLED = new Subscription() {
@Override
public void request(long n) {
}
@Override
public void cancel() {
}
};
public AmbInnerSubscriber(AmbCoordinator<T> parent, int index, Subscriber<? super T> actual) {
this.parent = parent;
this.index = index;
this.actual = actual;
}
@Override
public void onSubscribe(Subscription s) {
if (!compareAndSet(null, s)) {
s.cancel();
if (get() != CANCELLED) {
SubscriptionHelper.reportSubscriptionSet();
}
return;
}
long r = MISSED_REQUESTED.getAndSet(this, 0L);
if (r != 0L) {
s.request(r);
}
}
@Override
public void request(long n) {
Subscription s = get();
if (s != null) {
s.request(n);
} else {
if (SubscriptionHelper.validateRequest(n)) {
return;
}
BackpressureHelper.add(MISSED_REQUESTED, this, n);
s = get();
if (s != null && s != CANCELLED) {
long r = MISSED_REQUESTED.getAndSet(this, 0L);
if (r != 0L) {
s.request(r);
}
}
}
}
@Override
public void onNext(T t) {
if (won) {
actual.onNext(t);
} else {
if (parent.win(index)) {
won = true;
actual.onNext(t);
} else {
get().cancel();
}
}
}
@Override
public void onError(Throwable t) {
if (won) {
actual.onError(t);
} else {
if (parent.win(index)) {
won = true;
actual.onError(t);
} else {
get().cancel();
RxJavaPlugins.onError(t);
}
}
}
@Override
public void onComplete() {
if (won) {
actual.onComplete();
} else {
if (parent.win(index)) {
won = true;
actual.onComplete();
} else {
get().cancel();
}
}
}
@Override
public void cancel() {
Subscription s = get();
if (s != CANCELLED) {
s = getAndSet(CANCELLED);
if (s != CANCELLED && s != null) {
s.cancel();
}
}
}
}
}
| [
"[email protected]"
] | |
8f956c460a2c7abd42e7334dab8d44464bb286e1 | ef9a0fa62abac6f5a0aa8095c01af5d5a597df5c | /app/src/main/java/com/chatsdk/org/jivesoftware/smackx/bookmark/BookmarkedURL.java | 0a90a640112ffe927e7c0d4b15d3db4ff6e08faa | [] | no_license | Citrus-Platform/AndroidStudio-SC | d76cae092f6ce435378dbc3c6a97d72d5bbcd3ad | 91e4452b54f98f5fa6d9393402d59ee747a86b75 | refs/heads/master | 2020-05-21T20:36:26.709174 | 2017-03-21T05:21:38 | 2017-03-21T05:21:38 | 64,597,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,573 | java | /**
* $Revision$
* $Date$
*
* Copyright 2003-2007 Jive Software.
*
* All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.chatsdk.org.jivesoftware.smackx.bookmark;
/**
* Respresents one instance of a URL defined using JEP-0048 Bookmark Storage JEP.
*
* @author Derek DeMoro
*/
public class BookmarkedURL implements SharedBookmark {
private String name;
private final String URL;
private boolean isRss;
private boolean isShared;
protected BookmarkedURL(String URL) {
this.URL = URL;
}
protected BookmarkedURL(String URL, String name, boolean isRss) {
this.URL = URL;
this.name = name;
this.isRss = isRss;
}
/**
* Returns the name representing the URL (eg. Jive Software). This can be used in as a label, or
* identifer in applications.
*
* @return the name reprenting the URL.
*/
public String getName() {
return name;
}
/**
* Sets the name representing the URL.
*
* @param name the name.
*/
protected void setName(String name) {
this.name = name;
}
/**
* Returns the URL.
*
* @return the url.
*/
public String getURL() {
return URL;
}
/**
* Set to true if this URL is an RSS or news feed.
*
* @param isRss True if the URL is a news feed and false if it is not.
*/
protected void setRss(boolean isRss) {
this.isRss = isRss;
}
/**
* Returns true if this URL is a news feed.
*
* @return Returns true if this URL is a news feed.
*/
public boolean isRss() {
return isRss;
}
public boolean equals(Object obj) {
if(!(obj instanceof BookmarkedURL)) {
return false;
}
BookmarkedURL url = (BookmarkedURL)obj;
return url.getURL().equalsIgnoreCase(URL);
}
protected void setShared(boolean shared) {
this.isShared = shared;
}
public boolean isShared() {
return isShared;
}
}
| [
"[email protected]"
] | |
5fd8e4556a136d80825d62ec4b5cd97ed18d9e99 | d53145df70f135dd23a164239dc93cd187ef8fbe | /My Spring Class_2019/src/Assignments/replit145.java | e9165f4cee17463af243e4f2f1f35930032aa7b7 | [] | no_license | Batyrjany/JavaClass | cc28990a1f8f4aa5b1689a04081b128b8bb7bb52 | 02491d8576ff9165af4dbda98b2bcffa861ba225 | refs/heads/master | 2020-07-31T00:28:59.989337 | 2019-09-23T18:58:47 | 2019-09-23T18:58:47 | 210,416,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 838 | java | package Assignments;
import java.util.*;
public class replit145 {
public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
String s = inp.next();
person(s) ;
// System.out.println(Arrays.toString(arr));
}
public static void person(String info)
{
//your code here
String[] arr = info.split(",");
String name = "";
String lastname = "";
String age = "";
for (int i = 0; i < arr.length; i++) {
name = arr[0];
lastname = arr[1];
age = arr[2];
}
System.out.println("person name: "+name+ " last name: "+lastname+ " age: "+age);
}
}//end person
| [
"[email protected]"
] | |
c2113792c88c66b7e56b7b7fb893c000aa848083 | c6352f6a45bc3ddfc82ffbba063b0c8939613ac7 | /src/client/net/sf/saxon/ce/trans/KeyDefinitionSet.java | 0aeaf86eef72104e488ff38a4ca065befc9c90fb | [] | no_license | bitfabrikken/Saxon-CE | 33a4e2d05965d87a2bb9c0bca13b4a1ac3efcfce | b7a0ecf542f177c0669ac225741b4773d9066312 | refs/heads/master | 2023-04-13T05:08:22.237748 | 2021-04-09T18:04:32 | 2021-04-09T18:04:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,810 | java | package client.net.sf.saxon.ce.trans;
import client.net.sf.saxon.ce.om.StructuredQName;
import java.util.ArrayList;
import java.util.List;
/**
* A set of xsl:key definitions in a stylesheet that share the same name
*/
public class KeyDefinitionSet {
StructuredQName keyName;
int keySetNumber; // unique among the KeyDefinitionSets within a KeyManager
List<KeyDefinition> keyDefinitions;
String collationName;
boolean backwardsCompatible; // true if any of the keys is backwards compatible
/**
* Create a key definition set for keys sharing a given name
* @param keyName the name of the key definitions in this set
* @param keySetNumber a unique number identifying this key definition set
*/
public KeyDefinitionSet(StructuredQName keyName, int keySetNumber) {
this.keyName = keyName;
this.keySetNumber = keySetNumber;
keyDefinitions = new ArrayList(3);
}
/**
* Add a key definition to this set of key definitions. The caller is responsible for ensuring that
* all key definitions in a key definition set have the same name
* @param keyDef the key definition to be added
* @throws XPathException if the key definition uses a different collation from others in the set
*/
public void addKeyDefinition(KeyDefinition keyDef) throws XPathException {
if (keyDefinitions.isEmpty()) {
collationName = keyDef.getCollationName();
} else {
if ((collationName == null && keyDef.getCollationName() != null) ||
(collationName != null && !collationName.equals(keyDef.getCollationName()))) {
XPathException err = new XPathException("All keys with the same name must use the same collation");
err.setErrorCode("XTSE1220");
throw err;
}
// ignore this key definition if it is a duplicate of another already present
List v = getKeyDefinitions();
for (int i=0; i<v.size(); i++) {
KeyDefinition other = (KeyDefinition)v.get(i);
if (keyDef.getMatch().equals(other.getMatch()) &&
keyDef.getBody().equals(other.getBody())) {
return;
}
}
}
if (keyDef.isBackwardsCompatible()) {
backwardsCompatible = true;
}
keyDefinitions.add(keyDef);
}
/**
* Get the name of the key definitions in this set (they all share the same name)
* @return the name of these key definitions
*/
public StructuredQName getKeyName() {
return keyName;
}
/**
* Get the KeySet number. This uniquely identifies the KeyDefinitionSet within a KeyManager
* @return the unique number
*/
public int getKeySetNumber() {
return keySetNumber;
}
/**
* Get the key definitions in this set
* @return the key definitions in this set
*/
public List<KeyDefinition> getKeyDefinitions() {
return keyDefinitions;
}
/**
* Determine if the keys are to be evaluated in backwards compatible mode
* @return true if backwards compatibility is in force for at least one of the keys in the set
*/
public boolean isBackwardsCompatible() {
return backwardsCompatible;
}
}
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.
| [
"[email protected]"
] | |
832212b20ed4a1c741ec3bb80ddf7cd45e913059 | 9c2b23a2d6da1e762400ae963c1f787c3121eb89 | /cres/com.hundsun.ares.studio.logic.compiler/src/com/hundsun/ares/studio/logic/compiler/util/LogicCompilerUtil.java | 3ac49728ad0c0b86347817f6c5bfea66c1d161c7 | [
"MIT"
] | permissive | zhuyf03516/ares-studio | 5d67757283a52e51100666c9ce35227a63656f0e | 5648b0f606cb061d06c39ac25b7b206f3307882f | refs/heads/master | 2021-01-11T11:31:51.436304 | 2016-08-11T10:56:31 | 2016-08-11T10:56:31 | 65,444,199 | 0 | 0 | null | 2016-08-11T06:24:33 | 2016-08-11T06:24:32 | null | GB18030 | Java | false | false | 2,766 | java | /**
* <p>Copyright: Copyright (c) 2013</p>
* <p>Company: 恒生电子股份有限公司</p>
*/
package com.hundsun.ares.studio.logic.compiler.util;
import java.util.ArrayList;
import java.util.List;
import com.hundsun.ares.studio.atom.AtomFunction;
import com.hundsun.ares.studio.biz.Parameter;
import com.hundsun.ares.studio.biz.util.BizInterfaceParameterUtil;
import com.hundsun.ares.studio.core.IARESProject;
/**
* 业务逻辑编译帮助类
* @author liaogc
*
*/
public class LogicCompilerUtil {
/**
* 判断给定的参数名是否在业务逻辑的输入变量中
* @param logicResource 业务逻辑
* @param parameterName 参数名
* @return
*/
public static boolean isParameterINInputParameterByName(AtomFunction logicResource, String parameterName,IARESProject project) {
return BizInterfaceParameterUtil.isInputParameter(logicResource, parameterName,project);
}
/**
* 判断给定的参数名是否在业务逻辑的输出变量中
* @param logicResource 业务逻辑
* @param parameterName 参数名
* @return
*/
public static boolean isParameterINOutputParameterByName(AtomFunction logicResource, String parameterName,IARESProject project) {
return BizInterfaceParameterUtil.isOutputParameter(logicResource, parameterName,project);
}
/**
* 判断给定的参数名是否在业务逻辑的输入输出变量中
* @param procedure 业务逻辑
* @param parameterName 参数名
* @return
*/
public static boolean isParameterINInputAndOutputParameterByName(AtomFunction logicResource, String parameterName,IARESProject project) {
return isParameterINInputParameterByName(logicResource, parameterName,project) ||
isParameterINOutputParameterByName(logicResource, parameterName,project);
}
/**
* 判断给定的参数名是否在业务逻辑的内部变量中
* @param procedure 业务逻辑
* @param parameterName 参数名
* @return
*/
public static boolean isParameterINInternalVariablesByName(AtomFunction logicResource, String parameterName) {
List<String> names = new ArrayList<String>();
for (Parameter para : logicResource.getInternalVariables()) {
names.add(para.getId());
}
return names.contains(parameterName);
}
/**
* 判断给定的参数名是否在业务逻辑的输入输出以及内部变量中
* @param procedure 业务逻辑
* @param parameterName 参数名
* @return
*/
public static boolean isParameterINLogicParameterByName(AtomFunction logicResource, String parameterName,IARESProject project) {
return isParameterINInputParameterByName(logicResource, parameterName,project) ||
isParameterINOutputParameterByName(logicResource, parameterName,project) ||
isParameterINInternalVariablesByName(logicResource, parameterName);
}
}
| [
"[email protected]"
] | |
05fa97f4d05f959cd6cec752e19069c6320bb598 | 4f4114c04c75f595c0137f2c397f1d012000f701 | /src/org/usfirst/frc/team1100/robot/commands/drive/DriveCommand.java | 021a5180bcf500df55555fcf8ef9503f45e7e541 | [] | no_license | Team1100/FRCStronghold | 13f957411db78b5e12447f2381db1d54f4d91259 | c65e9f340a4691d0f9e2a761f14ba196b6665bea | refs/heads/master | 2021-01-18T21:34:00.849180 | 2016-01-23T16:25:58 | 2016-01-23T16:25:58 | 49,339,747 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,364 | java |
package org.usfirst.frc.team1100.robot.commands.drive;
import org.usfirst.frc.team1100.robot.subsystems.Drive;
import edu.wpi.first.wpilibj.command.Command;
/**
*
*/
public class DriveCommand extends Command {
private double left, right, time;
/**
* Moves the robot with its wheels
* @param left - speed of left motor
* @param right - speed of right motor
* @param time - duration of movement in seconds
*/
public DriveCommand(double left, double right, double time) {
requires(Drive.getInstance());
this.left = left;
this.right = right;
this.time = time;
}
// Called just before this Command runs the first time
protected void initialize() {
setTimeout(time);
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
Drive.getInstance().driveTank(left, right);
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return isTimedOut();
}
// Called once after isFinished returns true
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
edu.wpi.first.wpilibj.DriverStation.reportError("Drive Interrupted", false);
}
}
| [
"[email protected]"
] | |
a49e0ea770490f18f662d35c72bf1892bb62cef0 | 7564a023126f25adb5d3f4431c4bd1ceb123630a | /.metadata/.plugins/org.eclipse.core.resources/.history/56/30720265fba3001b1ffecd5956739993 | b181a84c141c515b4d0ac32947676ecf7a9bbad6 | [] | no_license | dwankhede70/Collection-Project | 7012ed04fba4cb14b446b379a374b16fb74159d6 | e4f135957f12490d5b13871e67c3a657aaab80b0 | refs/heads/main | 2023-04-15T01:16:49.020299 | 2021-04-23T06:30:10 | 2021-04-23T06:30:10 | 360,785,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,028 | package com.braindatawire.collegemanagement.client;
import java.util.*;
import com.braindatawire.collegemanagement.serviceImpl.karvenagar;
public class Test {
public static void main(String[] args) {
karvenagar k=new karvenagar();
Scanner sc=new Scanner(System.in);
while(true)
{
System.out.println("-----------------Choice--------------");
System.out.println("1.Add course\n"+
"2.View Course\n"+
"3.add Faculty\n"+
"4.View Faculty\n"+
"5.Add Batch\n"+
"6.View Batch\n"+
"7.Add Student\n"+
"8.view Student");
System.out.println("Enter the Choice ");
int ch=sc.nextInt();
{
{
switch (ch) {
case 1:k.addCourse();
break;
case 2:k.viewCourse();;
break;
case 3:k.addFaculty();
break;
case 4:k.viewFaculty();
break;
case 5:k.addBatch();
break;
case 6:k.viewBatch();
break;
case 7:k.addStudent();
break;
case 8:k.viewStudent();
break;
default:{
System.out.println("Please Enter a valid choice");
}
break;
}
}
}
}
}
}
| [
"[email protected]"
] | ||
3fc61a59819ba108d4c84de6e76d776bd47afa26 | 845054602edb3b60f2479886d59a91ae77cf3e8f | /Refactoring/src/interval/v16/IntervalBuilderState.java | 3d64de4b9c02401fb9de1c55ae348d9540651ffc | [] | no_license | parqueNaturalSantaTecla/refactoring | 313708abc558ef5609bae41bd71d11d83aa256f9 | fc855c886630aa72e46cd833fcdca32fcc9250e9 | refs/heads/master | 2020-05-25T23:07:48.504899 | 2019-05-22T12:07:11 | 2019-05-22T12:07:11 | 188,029,041 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 100 | java | package interval.v16;
public enum IntervalBuilderState {
MINIMUM_SETTED,
MAXIMUM_SETTED;
}
| [
"setil@DESKTOP-PEHM5QR"
] | setil@DESKTOP-PEHM5QR |
1563df36d3286ab124d9c7308ac1c68c23679d4d | 69a8ad5c71826bd927a4cf65436cf6787a6df974 | /src/test/java/com/avanty/dds/DdsApplicationTests.java | 9b08d5eb35483a70a01fbb56e3b8f7f2912bfdae | [] | no_license | 15386009251/SpringBoot-Mybatis-DynamicDataSource | 5845347901a09446ae2f11169165da062ddd737b | 718c429b6737f9cfd6c12db0ec90a67e9635a08d | refs/heads/master | 2020-03-31T15:41:39.017492 | 2018-10-10T02:42:04 | 2018-10-10T02:42:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.avanty.dds;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class DdsApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
b886e14793617a5190ffbbd7da077a063898d94a | 9d564a1717ce123a4a9c71e23049be2f2b42ae40 | /src/JDBCcodes/Rail_Hod_accepted.java | 9ff631c0f3b16590ff0ae56ba0047ce48a57c3b3 | [] | no_license | KVRajil/InstaRMS | 6a9f3dd0e5a39f2432f5badfa143d6cbfbf025b5 | 42eed852ff6d3505fba30ea16b7e475700733561 | refs/heads/master | 2016-09-05T18:39:40.323275 | 2014-10-19T05:33:22 | 2014-10-19T05:33:22 | 25,404,407 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,088 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package JDBCcodes;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import javax.swing.JOptionPane;
import request.Railway_Hod_Accept;
/**
*
* @author RAJIL KV
*/
public class Rail_Hod_accepted {
public Rail_Hod_accepted()
{
String host="jdbc:mysql://localhost:3306/requestdb?zeroDateTimeBehavior=convertToNull";
String uName="root";
String uPass="";
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(host,uName,uPass);
String query="insert into railhodacceptdb(ID,NAME,SEX,AGE,DATE1,RFROM,RTO,BRANCH,SEMESTER) values(?,?,?,?,?,?,?,?,?)";
PreparedStatement ps=con.prepareStatement(query);
ps.setInt(1,Railway_Hod_Accept.id_num);
ps.setString(2,Railway_Hod_Accept.name_text);
ps.setString(3,Railway_Hod_Accept.gender_text);
ps.setInt(4,Railway_Hod_Accept.age_num);
java.sql.Date date1 = new java.sql.Date(Railway_Hod_Accept.date.getTime());
ps.setDate(5,date1);
ps.setString(6,Railway_Hod_Accept.from_text);
ps.setString(7,Railway_Hod_Accept.to_text);
ps.setString(8,Railway_Hod_Accept.branch_text);
ps.setString(9,Railway_Hod_Accept.semester_text);
ps.executeUpdate();
con.close();
JOptionPane.showMessageDialog(null, "Success");
}
catch (Exception er ) {
er.printStackTrace();
JOptionPane.showMessageDialog(null, "Error");
}
}
}
| [
"[email protected]"
] | |
a73dd6e868ea343dad303393474672b75a1d3cac | 63933471c23155627bbcd2f84e5e51d2f141d716 | /Calculatrice/src/fonctions/DivListener.java | 15d337317a57d6821b5b89232ba21732e0423ded | [] | no_license | Tonow/m2isc-ci-tests | b37376fb5ce874f2e49dec6eaeb001ba469fd84d | 93ad23a019060d0e074f6d3e35750e02579946f5 | refs/heads/master | 2021-08-30T01:13:56.294866 | 2017-12-15T13:14:15 | 2017-12-15T13:14:15 | 113,958,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package fonctions;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by thomas on 15/12/17.
* Listener affecté au bouton /
*/
public class DivListener implements ActionListener {
public void actionPerformed(ActionEvent arg0){
if(clicOperateur){
calcul();
ecran.setText(String.valueOf(chiffre1));
}
else{
chiffre1 = Double.valueOf(ecran.getText()).doubleValue();
clicOperateur = true;
}
operateur = "/";
update = true;
}
}
| [
"[email protected]"
] | |
4d150bb54b5e98d6be6bf44d4d4bd99de4da4fe4 | 1adb08801c6e2efcf3d0f858143f655525c99d74 | /SSVAPP/app/src/main/java/com/soft/ssvapp/Fragment_Menu/All_specificProject/RapportArticleParLigne/RapportArticleParLigneRepository.java | 0c60a53c8e8112f8909b1772da4cfab6cdcd1e4b | [] | no_license | yanjulio/SSVProject | 5651e007058dd8d065b0151b74132ea890400469 | 3cce9cb4ddd726856d2b3f079a4355d0c219e1ad | refs/heads/master | 2023-03-26T05:05:37.193982 | 2021-03-22T14:37:41 | 2021-03-22T14:37:41 | 348,252,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,074 | java | package com.soft.ssvapp.Fragment_Menu.All_specificProject.RapportArticleParLigne;
import android.app.Application;
import android.widget.Toast;
import androidx.lifecycle.MutableLiveData;
import com.soft.ssvapp.DataRetrofit.RapportParProjet.RapportArticleParLigneResponse;
import com.soft.ssvapp.DataRetrofit.RapportParProjet.RapportParprojetRetrofitRepository;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class RapportArticleParLigneRepository {
private Application application;
private RapportParprojetRetrofitRepository rapportParprojetRetrofitRepository;
private MutableLiveData<List<RapportArticleParLigneResponse>> rapportArticleParLigne;
private MutableLiveData<Boolean> isLoading;
public RapportArticleParLigneRepository(Application application)
{
this.application = application;
rapportParprojetRetrofitRepository = RapportParprojetRetrofitRepository.getInstance();
this.rapportArticleParLigne = new MutableLiveData<>();
this.isLoading = new MutableLiveData<>();
}
public MutableLiveData<Boolean> getIsLoading()
{
return isLoading;
}
public MutableLiveData<List<RapportArticleParLigneResponse>> getRapportArticleParLigne(String codeProjet, String codeLigne)
{
setRapportArticleParLigne(codeProjet, codeLigne);
return rapportArticleParLigne;
}
void setRapportArticleParLigne(String codeProjet, String codeLigne)
{
Call<List<RapportArticleParLigneResponse>> call_article_parligne =
rapportParprojetRetrofitRepository.rapportParProjetConnexion().rapportArticleParLigne(codeProjet, codeLigne);
isLoading.postValue(true);
call_article_parligne.enqueue(new Callback<List<RapportArticleParLigneResponse>>() {
@Override
public void onResponse(Call<List<RapportArticleParLigneResponse>> call, Response<List<RapportArticleParLigneResponse>> response) {
if (response.isSuccessful())
{
isLoading.postValue(false);
rapportArticleParLigne.postValue(response.body());
}
else
{
Erreur(response.code());
}
}
@Override
public void onFailure(Call<List<RapportArticleParLigneResponse>> call, Throwable t) {
isLoading.postValue(false);
Toast.makeText(application, "Problème de connexion", Toast.LENGTH_LONG);
}
});
}
void Erreur(int code)
{
switch (code)
{
case 404:
Toast.makeText(application, "Serveur introuvable", Toast.LENGTH_LONG);
break;
case 500:
Toast.makeText(application, "Erreur Serveur", Toast.LENGTH_LONG);
break;
default:
Toast.makeText(application, "Erreur Inconnue", Toast.LENGTH_LONG);
break;
}
}
}
| [
"[email protected]"
] | |
8774195e18182d9b77aa4229c5ddacc07a3e5d17 | 67d7f5208bfeca7b9eccfcc724328f54309a1680 | /src/main/java/pl/kojonek2/forumEE/servlets/sections/SectionLoginServlet.java | 754496a23b31a4eb6dd12a823ab8fe4e7b7194d1 | [] | no_license | kojonek2/forumEE | 80070d2edd17b395741b6b0efe83f3b71264c83c | 3cb6da7a8759aee560eeb6f00e8e12411cb3d04e | refs/heads/master | 2022-09-25T15:51:40.643805 | 2020-02-24T15:24:55 | 2020-02-24T15:24:55 | 242,765,615 | 0 | 0 | null | 2022-02-02T01:01:58 | 2020-02-24T15:02:42 | Java | UTF-8 | Java | false | false | 753 | java | package pl.kojonek2.forumEE.servlets.sections;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/sectionLogin")
public class SectionLoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (request.getParameter("id") == null) {
response.sendError(400, "Id parameter not found!");
return;
}
response.sendRedirect("/section?id=" + request.getParameter("id"));
}
}
| [
"[email protected]"
] | |
465d582ea2b48381b0767376f5358435c16c458a | f446cf0302d7d1e27e090a493cb685eb4466ec1f | /nextkala-api/src/main/java/com/nextiva/scheduling/api/RemoteProperties.java | 5fa0a571c3bfc7ff5acd7fefe03dd890edc57f8f | [
"Apache-2.0"
] | permissive | nextiva/nextkala-java-agent | 74b87973622591abc856feb64f9565a5fce929fd | b426f278c9f51a68804484600464426afaecffcc | refs/heads/master | 2023-05-24T23:44:19.670495 | 2021-01-18T20:40:24 | 2021-01-18T20:40:24 | 328,793,299 | 1 | 1 | Apache-2.0 | 2023-05-20T12:23:56 | 2021-01-11T21:15:19 | Java | UTF-8 | Java | false | false | 2,064 | java | /*
* Licensed to Nextiva under one or more contributor license agreements. See
* the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
* Nextiva licenses this file to You under the Apache license, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the license for the specific language governing permissions and
* limitations under the license.
*/
package com.nextiva.scheduling.api;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Properties for remote job.
*/
public class RemoteProperties {
private String url;
private String method;
// The object to attach to the HttpRequest.
private String body;
// Timeout value for the HTTP request in seconds.
private Integer timeout;
// A list of expected response code (e.g. [200, 201])
@JsonProperty("expected_response_codes")
private int []expectedResponseCodes;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public Integer getTimeout() {
return timeout;
}
public void setTimeout(Integer timeout) {
this.timeout = timeout;
}
public int[] getExpectedResponseCodes() {
return expectedResponseCodes;
}
public void setExpectedResponseCodes(int[] expectedResponseCodes) {
this.expectedResponseCodes = expectedResponseCodes;
}
}
| [
"[email protected]"
] | |
e0355915b033f2f9344436d9505e4982846384b3 | e0aab51c35458097cb03a5831e432e7f160ad552 | /Group2-ChatApplication/app/src/main/java/edu/uw/tcss450/team2/register/RegisterViewModel.java | 3736e863d9ecbd9a7bb326c1079ffca91813d993 | [] | no_license | Sambath77/Team-2-TCSS-450 | 0a7b1ec9aee31bb6bbd169cb0a9a74cf70027aa4 | 395402aea07a6148f2959e3a14833d399fe064f1 | refs/heads/master | 2023-01-30T01:00:10.527604 | 2020-12-14T07:20:53 | 2020-12-14T07:20:53 | 302,981,884 | 1 | 1 | null | 2020-12-13T07:48:54 | 2020-10-10T20:11:48 | Java | UTF-8 | Java | false | false | 3,414 | java | package edu.uw.tcss450.team2.register;
import android.app.Application;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
import java.nio.charset.Charset;
import java.util.Objects;
public class RegisterViewModel extends AndroidViewModel {
private MutableLiveData<JSONObject> mResponse;
/*
* constructor method
*/
public RegisterViewModel(@NonNull Application application) {
super(application);
mResponse = new MutableLiveData<>();
mResponse.setValue(new JSONObject());
}
/*
* A method to call when the server was updated
*
* @param: LifecycleOwner
* @param: Observer
*/
public void addResponseObserver(@NonNull LifecycleOwner owner,
@NonNull Observer<? super JSONObject> observer) {
mResponse.observe(owner, observer);
}
/*
* helper method to handle the error
*/
private void handleError(final VolleyError error) {
if (Objects.isNull(error.networkResponse)) {
try {
mResponse.setValue(new JSONObject("{" +
"error:\"" + error.getMessage() +
"\"}"));
} catch (JSONException e) {
Log.e("JSON PARSE", "JSON Parse Error in handleError");
}
}
else {
String data = new String(error.networkResponse.data, Charset.defaultCharset())
.replace('\"', '\'');
try {
JSONObject response = new JSONObject();
response.put("code", error.networkResponse.statusCode);
response.put("data", new JSONObject(data));
mResponse.setValue(response);
} catch (JSONException e) {
Log.e("JSON PARSE", "JSON Parse Error in handleError");
}
}
}
/*
* method to send the information to the end point
*
* @param: String first: user first name
* @param: String lasy: user last name
* @param: String email: user email
* @param: String password: user password
*/
public void connect(final String first, final String last, final String email, final String password) {
String url = "https://team-2-tcss-450-webservices.herokuapp.com/auth";
JSONObject body = new JSONObject();
try {
body.put("first", first);
body.put("last", last);
body.put("email", email);
body.put("password", password);
} catch (JSONException e) {
e.printStackTrace();
}
Request request = new JsonObjectRequest(Request.Method.POST, url, body, mResponse::setValue, this::handleError);
request.setRetryPolicy(new DefaultRetryPolicy(10_000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
Volley.newRequestQueue(getApplication().getApplicationContext()).add(request);
}
}
| [
"[email protected]"
] | |
559e59fcbf5aa8baec2ad1f02db7e1fc44e1a19c | 4edb40f27e679ca57451c580559d018c576f5caa | /src/main/java/com/assaign/app/controller/LoginController.java | ff3db2b412eb4f0863145c56e0642e1c959f1abf | [] | no_license | Sushma94G/projectsush | 4a9d3d15d935c37647d0fe019a33c0c6f82245a7 | ac825427067d054501410f433abbad6791ace350 | refs/heads/master | 2023-01-01T05:41:03.391241 | 2019-09-04T13:37:39 | 2019-09-04T13:37:39 | 206,326,140 | 0 | 0 | null | 2022-12-16T08:06:29 | 2019-09-04T13:29:42 | Java | UTF-8 | Java | false | false | 2,907 | java | package com.assaign.app.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.assaign.app.dto.LoginDTO;
import com.assaign.app.dto.UserDTO;
import com.assaign.app.service.LoginService;
import com.assaign.util.EncryptionDecryption;
@Controller
@RequestMapping("/")
public class LoginController {
private final static Logger log = LoggerFactory.getLogger(LoginController.class);
@Autowired
private LoginService loginService;
public LoginController() {
System.out.println("Created \t"+this.getClass().getSimpleName());
}
@RequestMapping(value="/signin.ams", method=RequestMethod.POST)
public ModelAndView loginController(LoginDTO loginDTO,HttpServletRequest request){
log.info("LoginController is started");
log.info(loginDTO.toString());
UserDTO dtoFromDb= loginService.loginService(loginDTO);
log.info("dtoFromDb-->"+dtoFromDb);
if(dtoFromDb != null){
String passFromLogin=loginDTO.getPassword();
String decryptedPass=EncryptionDecryption.decrypt(dtoFromDb.getPassword());
System.err.println("passFromLogin" + passFromLogin);
System.err.println("decryptedPass" + decryptedPass);
if(passFromLogin.equals(decryptedPass))
{
if(dtoFromDb.isNewUser())
{
return new ModelAndView("changePassword.jsp");
}
else{
log.info("Login successful");
HttpSession session= request.getSession(true);
session.setMaxInactiveInterval(10);
session.setAttribute("dtoFromDb", dtoFromDb);
loginService.updateLastLoginAndFailCountService(dtoFromDb);
return new ModelAndView("home.jsp", "msg", "login successful").addObject("user", dtoFromDb);
}
}
else{
log.info("Incorrect Password");
int failCount = dtoFromDb.getFailCount();
dtoFromDb.setFailCount(failCount+1);
loginService.failedLoginService(dtoFromDb);
return new ModelAndView("signin", "msg", "Incorrect password");
}
}else{
log.info("wrong email id");
return new ModelAndView("signin", "msg", "wrong email id");
}
}
@RequestMapping(value="logout.ams", method=RequestMethod.GET)
public ModelAndView logoutController(HttpServletRequest request)
{
HttpSession session= request.getSession(false);
session.invalidate();
System.out.println("logout sucessful, session closed");
return new ModelAndView("signin", "msg", "user is loggedout");
}
}
| [
"[email protected]"
] | |
5abc0f9db381b933dcdc76bed8553a52cfc17a44 | 56c33fd0c0aa236470d6f60e0179d589d9c3b2e8 | /Unit -IV/Programs/SingleInheritance.java | fdc7db212ec1fa2da81f71b95cd9f9f6eb0b8283 | [] | no_license | miraaj/JavaProgramming | 2e85593b2bcf8fa7dc405edefa97c2f70861a036 | 696a256487654ac277c7098a86e2eafed21e277a | refs/heads/master | 2020-03-25T16:58:27.888028 | 2018-07-31T16:56:22 | 2018-07-31T16:56:22 | 143,956,934 | 1 | 0 | null | 2018-08-08T03:35:59 | 2018-08-08T03:35:58 | null | UTF-8 | Java | false | false | 348 | java | /*
* This example is from javatpoint.com
*/
class Animal{
void eat(){
System.out.println("eating...");
}
}
class Dog extends Animal{
void bark(){
System.out.println("barking...");
}
}
class SingleInheritance{
public static void main(String args[]){
Dog d=new Dog();
d.bark();
d.eat();
}
} | [
"[email protected]"
] | |
5d520b9eb563a60ded2fc84f389a30788739e354 | 6bfe51127ae5ad09c80fb60004e292895ccd6330 | /src/main/java/com/capinfo/omp/controller/OldForController.java | ae640f19c2a02efeb556e7c2bc3c133d88f97bfc | [] | no_license | Zivex/omp | 2a80f5ba06e74de8ba5fd952e4ae910059590c98 | 70cf9deb952a0b5bf2a9d018881d9703464cec42 | refs/heads/master | 2021-01-13T05:16:49.647736 | 2017-04-11T13:52:51 | 2017-04-11T13:52:51 | 81,308,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,660 | java | package com.capinfo.omp.controller;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.capinfo.common.model.SystemUser;
import com.capinfo.framework.model.BaseEntity;
import com.capinfo.framework.service.GeneralService;
import com.capinfo.framework.util.DateUtils;
import com.capinfo.omp.model.Omp_Old_Info;
import com.capinfo.omp.parameter.CompositionParameter;
import com.capinfo.omp.parameter.OldParameter;
import com.capinfo.omp.service.OldService;
import com.capinfo.omp.utils.JsonUtil;
import com.capinfo.omp.utils.Page;
import com.capinfo.omp.utils.excel.ExcelBuilder;
import com.capinfo.omp.utils.excel.ExportUtils;
import com.capinfo.omp.ws.client.ClientGetLandNumberService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
*
* 展示主页面
*
* @author Administrator
*
*/
@Controller
@RequestMapping("/old")
@SessionAttributes("eccomm_admin")
public class OldForController {
@Autowired
private OldService oldService;
@Autowired
private GeneralService generalService;
@RequestMapping("/oldMatch/list.shtml")
public ModelAndView list(@ModelAttribute("eccomm_admin") SystemUser user,String pageSize,
String current, String name, String idCard, String zjNumber,
String county, String street, String community,
String isGenerationOrder, String isindividuation,
String creationTime, HttpServletRequest request) {
ModelAndView mv = new ModelAndView("/omp/old/initial");
getList(mv, current, name, idCard, zjNumber, county, street, community,
isGenerationOrder, isindividuation, creationTime, user,pageSize);
// oldService.saveLogger("2", "老人信息表", "lixing", "1");
return mv;
}
/**
* 老人列表查询
*
* @param current
* @param name
* @param idCard
* @param zjNumber
* @param county
* @param street
* @param community
* @param isGenerationOrder
* @param isindividuation
* @param creationTime
* @return
*/
@RequestMapping("/oldMatch/listtoo.shtml")
public ModelAndView listtoo(String current,String pageSize, String name, String idCard,
String zjNumber, String county, String street, String community,
String isGenerationOrder, String isindividuation,
String creationTime, Integer call_id,
@ModelAttribute("eccomm_admin") SystemUser user) {
ModelAndView mv = new ModelAndView("/omp/old/list");
getList(mv, current, name, idCard, zjNumber, county, street, community,
isGenerationOrder, isindividuation, creationTime, user,pageSize);
// LogRecord.logger("2", "", "", "", "2");
return mv;
}
public void getList(ModelAndView mv, String current, String name,
String idCard, String zjNumber, String county, String street,
String community, String isGenerationOrder, String isindividuation,
String creationTime, SystemUser user,String pageSize) {
if (StringUtils.isEmpty(current)) {
current = "1";
}
if (StringUtils.isEmpty(isindividuation)) {
isindividuation = "";
}
if (StringUtils.isEmpty(pageSize)) {
pageSize = "10";
}
int count = oldService.getCount(name, idCard, zjNumber, county, street,
community, isGenerationOrder, isindividuation, user);
// count = count == 0 ? 1 : count;
Page page = new Page<>(current, count, pageSize);
List<Omp_Old_Info> entities = oldService.getOldContextList(page, name,
idCard, zjNumber, county, street, community, isGenerationOrder,
isindividuation, user);
mv.addObject("dataList", entities);
mv.addObject("DataTotalCount", count);
mv.addObject("CurrentPieceNum", page.getCurrentPage());
mv.addObject("PerPieceSize", pageSize);
mv.addObject("name", name);
mv.addObject("idCard", idCard);
mv.addObject("zjNumber", zjNumber);
mv.addObject("county", county);
mv.addObject("street", street);
mv.addObject("community", community);
mv.addObject("isGenerationOrder", isGenerationOrder);
mv.addObject("isindividuation", isindividuation);
}
/**
* 导入老人Excel
*
* @param request
* @param excelFile
* @return
* @throws Exception
*/
@RequestMapping("/oldMatch/importInformation.shtml")
@ResponseBody
public String importInformation(HttpServletRequest request,
@RequestParam("excelFile") MultipartFile excelFile,
@ModelAttribute("eccomm_admin") SystemUser user) throws Exception {
System.out.println(excelFile);
String errorstr = "错误行数为: \n";
String linkNbr = "";
String num = "";
if (excelFile != null && !"".equals(excelFile)) {
InputStream fis = excelFile.getInputStream();
Map<String, Object> map = importEmployeeByPoi(fis,user.getAccount_type());
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 设置日期格式
String format = df.format(new Date());// new Date()为获取当前系统时间
String zjNumber = "{'landLineNumber':'";// 导入成功后将座机号码同步到中航
int nb = 10;
int enb = 0;
List<Omp_Old_Info> list = (List<Omp_Old_Info>) map.get("infos");
for (Omp_Old_Info ompOldInfo : list) {
// 判断是否以010开头
CharSequence subSequence = ompOldInfo.getZjnumber()
.subSequence(0, 1);
if (!subSequence.equals("0")) {
nb++;
errorstr = errorstr + "第" + nb + "行:大座机缺少区号 \n";
enb++;
} else {
nb++;
// 通过座机号,身份证号判断是否存在老人 1大座机号已存在 2身份证号已存在 0不存在
int t = oldService.checkOldIsHave(ompOldInfo.getZjnumber(),
ompOldInfo.getCertificates_number());
if (t == 3) {
errorstr = errorstr + "第" + nb + "行:身份证号和大座机号重复 \n";
enb++;
} else if (t == 1) {
errorstr = errorstr + "第" + nb + "行:大座机号重复 \n ";
enb++;
} else if (t == 2) {
errorstr = errorstr + "第" + nb + "行:身份证号重复 \n";
enb++;
}
if (enb == 0) {
linkNbr = ompOldInfo.getZjnumber();
// 判断
num = linkNbr.substring(0, 3);
if ("010".equals(num)) {
ompOldInfo.setZjnumber(linkNbr.substring(3));
}
zjNumber = zjNumber + linkNbr.substring(3) + ",";
oldService.addOld(ompOldInfo, user);
}
}
}
zjNumber = zjNumber.substring(0, zjNumber.length() - 1) + "'}";
System.out.println("获得的座机号码:" + zjNumber);
// 调用webService接口发送信息
ClientGetLandNumberService.getZjnumber(zjNumber);
fis.close();
if (enb > 0) {
errorstr = errorstr + " 总共导入失败:" + enb + "个";
} else {
return "1";
}
// mv.addObject("failure", map.get("failure"));
System.out.println(errorstr);
// mv.addObject("errorstr", errorstr);
}
return errorstr;
}
/**
* POI:解析Excel文件中的数据并把每行数据封装成一个实体
*
* @param fis
* 文件输入流
* @param string
* @param flunk
* @param success
* @param map
* @return List<OmpOldInfo> Excel中数据封装实体的集合
* @throws Exception
*/
public Map<String, Object> importEmployeeByPoi(InputStream fis, String acc)
throws Exception {
List<Omp_Old_Info> infos = new ArrayList<Omp_Old_Info>();
List<Omp_Old_Info> failure = new ArrayList<Omp_Old_Info>();
Workbook workbook = WorkbookFactory.create(fis);
Sheet sheetAt0 = workbook.getSheetAt(0);
Row row3 = sheetAt0.getRow(3);
// 工作人员姓名
String workername = getCellValue(row3.getCell(1));
String workertel = row3.getCell(7).getStringCellValue();
int rowNum = sheetAt0.getLastRowNum();
for (int i = 7; i < rowNum + 1; i++) {
Row row = sheetAt0.getRow(i);
String call_id = getCellValue(row.getCell(12));
String area = getCellValue(row.getCell(1));
String street = getCellValue(row.getCell(2));
String community = getCellValue(row.getCell(3));
String tel_type = getCellValue(row.getCell(10));
//根据市区名称查询市区ID
String countyId = oldService.getIdByName(area, 3);
// 根据街道名称查询街道ID
String streetId = oldService.getIdByName(street, 4);
// 根据社区名称查询社区ID
String communityId = oldService.getIdByName(community, 5);
//查询社区编码
String comNUm = oldService.getIdByComCod(community, 5);
int tel_num = oldService.getTel_type(tel_type);
Long callId = 0l;
if ("是".equals(call_id)) {
callId = 1l;
}
Omp_Old_Info old_info = new Omp_Old_Info();
old_info.setHousehold_county_id(countyId);
old_info.setHousehold_street_id(streetId);
old_info.setHousehold_community_id(communityId);
old_info.setWorkername(workername);
old_info.setWorkertel(workertel);
old_info.setName(getCellValue(row.getCell(4)));
old_info.setCertificates_number(getCellValue(row.getCell(5)));
old_info.setZjnumber(getCellValue(row.getCell(6)));
old_info.setPhone(getCellValue(row.getCell(7)));
old_info.setEmergencycontact(getCellValue(row.getCell(8)));
old_info.setEmergencycontacttle(getCellValue(row.getCell(9)));
//话机类型
old_info.setTeltype(String.valueOf(tel_num));
old_info.setAddress(getCellValue(row.getCell(11)));
old_info.setCall_id(callId);
old_info.setAccount_type(acc+comNUm);
infos.add(old_info);
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("infos", infos);
map.put("failure", failure);
return map;
}
// 判断从Excel文件中解析出来数据的格式
public static String getCellValue(Cell cell) {
String value = null;
// 简单的查检列类型
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_STRING:// 字符串
value = cell.getRichStringCellValue().getString();
break;
case HSSFCell.CELL_TYPE_NUMERIC:// 数字
long dd = (long) cell.getNumericCellValue();
value = dd + "";
break;
case HSSFCell.CELL_TYPE_BLANK:
value = "";
break;
case HSSFCell.CELL_TYPE_FORMULA:
value = String.valueOf(cell.getCellFormula());
break;
case HSSFCell.CELL_TYPE_BOOLEAN:// boolean型值
value = String.valueOf(cell.getBooleanCellValue());
break;
case HSSFCell.CELL_TYPE_ERROR:
value = String.valueOf(cell.getErrorCellValue());
break;
default:
break;
}
return value;
}
/**
* 去修改老人数据
*
* @param id
* @return
*/
@RequestMapping("/oldMatch/upd.shtml")
@ResponseBody
public ModelAndView upd(String id) {
ModelAndView mv = new ModelAndView("/omp/old/upd");
List<Map<String, Object>> list = oldService.getOldById(id);
Map<String, Object> map = list.get(0);
Map Region = oldService.getRegionList(map);
mv.addObject("detaMap", map);
mv.addObject("Region", Region);
return mv;
}
/**
* 查看老人数据
*
* @param id
* @return
*/
@RequestMapping("/oldMatch/see.shtml")
@ResponseBody
public ModelAndView seePerson(String id, String cardId) {
ModelAndView mv = new ModelAndView("/omp/old/see");
Omp_Old_Info old = generalService.getObjectById(Omp_Old_Info.class, Long.parseLong(id));
List<Map<String, Object>> person = oldService.getPerson(cardId);
if (person.size() != 0) {
Map<String, Object> mapPreson = person.get(0);
mv.addObject("mapPreson", mapPreson);
}
//
//
//
// List<Map<String, Object>> list = oldService.getOldById(id);
// Map<String, Object> map = list.get(0);
// List<Map<String, Object>> person = oldService.getPerson(cardId);
// if (person.size() != 0) {
// Map<String, Object> mapPreson = person.get(0);
// mv.addObject("mapPreson", mapPreson);
// }
// Map Region = oldService.getRegionList(map);
// mv.addObject("Region", Region);
mv.addObject("detaMap", old);
return mv;
}
/**
* 去查看老人数据
*
* @param id
* @return
*/
@SuppressWarnings("rawtypes")
@RequestMapping("/oldMatch/oldinfo.shtml")
@ResponseBody
public ModelAndView oldinfo(String id) {
ModelAndView mv = new ModelAndView("/omp/old/oldInfo");
ArrayList arrayList = new ArrayList<>();
List<Map<String, Object>> list = oldService.getOldById(id);
List<Map<String, Object>> list1 = oldService.getOldById1(id);
// 判断是否老人已经设置指令了
if (list.size() > 0 && list.get(0).get("Kp") != null) {
Map<String, Object> map = list.get(0);
Map Region = oldService.getRegionList(map);
String kpLiString = (String) map.get("Kp");
if (kpLiString != null && !"".equals(kpLiString)) {
JSONObject jsonObject = JsonUtil.getJson(kpLiString);
JSONArray json1 = JsonUtil.getJson1(jsonObject);
if (json1.size() > 0) {
for (int i = 0; i < json1.size(); i++) {
JSONObject job = json1.getJSONObject(i); // 遍历 jsonarray 数组,把每一个对象转成json 对象
arrayList.add(job);
}
}
}
mv.addObject("arrayList", arrayList);
mv.addObject("detaMap", map);
mv.addObject("Region", Region);
} else {
Map<String, Object> map = list1.get(0);
Map Region = oldService.getRegionList(map);
mv.addObject("arrayList", arrayList);
mv.addObject("detaMap", map);
mv.addObject("Region", Region);
}
return mv;
}
/**
* 去修改老人话机数据
*
* @param id
* @return
*/
@RequestMapping("/oldMatch/ompKeyModify.shtml")
@ResponseBody
public ModelAndView ompKeyModify(String id, String typeid) {
ModelAndView mv = new ModelAndView("/omp/old/ompKeyModify");
ArrayList arrayList = new ArrayList<>();
// List<Map<String,Object>> Region = oldService.getOldById(id);
List<Map<String, Object>> Infolist = oldService
.getOldKeyPointMessage(id);
List<Map<String, Object>> list = oldService.getOldById(id);
// 判断是否老人已经设置指令了
if (list.size() > 0 && list.get(0).get("Kp") != null) {
Map<String, Object> map = list.get(0);
Map Region = oldService.getRegionList(map);
String kpLiString = (String) map.get("Kp");
if (kpLiString != null && !"".equals(kpLiString)) {
JSONObject jsonObject = JsonUtil.getJson(kpLiString);
JSONArray json1 = JsonUtil.getJson1(jsonObject);
if (json1.size() > 0) {
for (int i = 0; i < json1.size(); i++) {
JSONObject job = json1.getJSONObject(i); // 遍历 jsonarray// 数组,把每一个对象转成// json 对象
arrayList.add(job);
}
}
}
mv.addObject("detaMap", arrayList);
mv.addObject("hxUserID", id);
}
mv.addObject("detaMap", arrayList);
mv.addObject("hxUserID", id);
return mv;
}
/**
* 老人个性化数据修改
*
* @param id
* @return
*/
@RequestMapping("/oldMatch/uploadOldIndividuation.shtml")
@ResponseBody
public String uploadOldIndividuation(String id, String json) {
Boolean isUpdateBoolean = oldService.uploadOldIndividuation(id, json);
if (isUpdateBoolean) {
return "修改成功!";
}
boolean newBl = oldService.addOmpOldOrderInfo(id, json);
if (newBl) {
return "添加成功!";
}
return "修改失败,请稍后尝试!";
}
/**
* 修改老人数据
*
* @param id
* @return
*/
@RequestMapping("/oldMatch/updete.shtml")
public String updete(HttpServletRequest request) {
Map<String, Object> map = new HashMap<String, Object>();
String id = request.getParameter("id");
map.put("id", id);
String name = request.getParameter("name");
map.put("name", name);
String county = request.getParameter("county");
map.put("county", county);
String street = request.getParameter("street");
map.put("street", street);
String community = request.getParameter("community");
map.put("community", community);
String zjnumber = request.getParameter("zjnumber");
map.put("zjnumber", zjnumber);
String phone = request.getParameter("phone");
map.put("phone", phone);
String address = request.getParameter("address");
map.put("address", address);
String emergencycontact = request.getParameter("emergencycontact");
map.put("emergencycontact", emergencycontact);
String emergencycontacttle = request
.getParameter("emergencycontacttle");
map.put("emergencycontacttle", emergencycontacttle);
String teltype = request.getParameter("teltype");
map.put("teltype", teltype);
oldService.updOldById(map);
return "redirect:/old/oldMatch/list.shtml?name=&idCard=&zjNumber=&county=&street=&community=&isGenerationOrder=&creationTime=";
}
/**
* 省市街区三级联动
*
* @param id
* @return
*/
@RequestMapping("/oldMatch/getRegionById.shtml")
@ResponseBody
public List<Map<String, Object>> getRegionById(String id) {
if (StringUtils.isEmpty(id)) {
id = "2";
}
List<Map<String, Object>> list = oldService.getRegionById(id);
return list;
}
/**
* 停用老人信息
*
* @param id
* @return
*/
@RequestMapping("/oldMatch/delete.shtml")
public String oldMatchDelete(String id) {
int flg = oldService.delOldById(id);
return "redirect:/old/oldMatch/list.shtml?name=&idCard=&zjNumber=&county=&street=&community=&isGenerationOrder=&creationTime=";
}
/**
* 老人导入
*
* @return
*/
@RequestMapping("/Import/toImport.shtml")
public ModelAndView toImport() {
ModelAndView mv = new ModelAndView("/omp/old/Import");
return mv;
}
/**
* 生成指令
*
* @param ids
* @return
*/
@RequestMapping("/oldMatch/createOrder.shtml")
@ResponseBody
public String createOrder(String ids) {
if (checkId(ids)) {
return "您当前所选的老人中已经有部分生成了指令,请仔细核对!!!";
} else {
return toCreate(ids);
}
}
public boolean checkId(String ids) {
String[] id = ids.split(",");
for (String string : id) {
if (!oldService.checkId(string)) {
return false;
}
}
return true;
}
public String toCreate(String ids) {
int i = 0;
String[] id = ids.split(",");
for (String string : id) {
if (toCreateOrder(string)) {
i++;
}
}
if (i == id.length) {
return "指令生成成功";
}
return "指令生成失败,请检查该社区该类型是否以添加";
}
// 生成指令
private boolean toCreateOrder(String id) {
List<Map<String, Object>> list = oldService.queryCommunityOrder(id);
String keyPointMessage = "[{";
for (Map<String, Object> map : list) {
String key = map.get("key").toString();
String number = map.get("number").toString();
keyPointMessage += "\"" + key + "\":\"" + number + "\",";
}
keyPointMessage = keyPointMessage.substring(0,
keyPointMessage.length() - 1);
keyPointMessage += "}]";
String pname = list.get(0).get("pname").toString();
String comId = list.get(0).get("comId").toString();
boolean saveOrder = oldService.saveOrder(id, pname, comId,
keyPointMessage);
if (saveOrder) {
oldService.updOldState(id);
}
return saveOrder;
}
@RequestMapping("/oldMatch/getOldKeyPointMessage.shtml")
@ResponseBody
public List<Map<String, Object>> getOldKeyPointMessage(String oid) {
List<Map<String, Object>> list = oldService.getOldKeyPointMessage(oid);
return list;
}
@RequestMapping("/oldMatch/batchSendInstructions.shtml")
public void batchSendInstructions() throws Exception {
if (oldService.getcountid()) {
System.out.println("batchSendInstructions:定时器自动执行发送指令程序,间隔时间1分钟");
String id = oldService.checkDeBatchSendInstructions();
oldService.saveolInfo(id);
}
}
/*
* 老人信息导出
*/
@RequestMapping("/oldMatch/exportExcel.shtml")
public void exportExcel(NativeWebRequest request,
HttpServletResponse response, OldParameter parameter,@ModelAttribute("eccomm_admin") SystemUser user) {
try {
OutputStream stream = response.getOutputStream();
response.setContentType("application/msexcel;charset=UTF-8");
response.setHeader(
"Content-Disposition",
"attachment;filename=\""
+ ExportUtils.getExportFileName(request, "老人信息"
+ DateUtils.currentDateTime()) + ".xlsx");
ExcelBuilder exportExcel = oldService.exportExcel(parameter,user);
exportExcel.writeToStream(stream);
stream.close();
} catch (Exception e) {
e.printStackTrace();
}
;
}
}
| [
"[email protected]"
] | |
087f1909b7d10a9610a3c7a9824ac0e2b52ce550 | a4642709a131054a656bb3ecb831ac6041db022a | /xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConfirmingCheckBoxPreference.java | 514f11c4af5728c08c8b8afe84665f92d2d39638 | [] | no_license | eehouse/xwords | cf40afd9a5bde589353f9ad5b7f0f7903e4f600c | 892edc098b58fbcbeaf408390a28e5563e6a35ec | refs/heads/android_branch | 2023-08-18T02:58:21.999975 | 2023-08-14T18:33:09 | 2023-08-14T18:34:43 | 5,944,632 | 4 | 6 | null | 2023-02-19T19:28:32 | 2012-09-25T03:44:01 | C | UTF-8 | Java | false | false | 1,836 | java | /* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2009 - 2016 by Eric House ([email protected]). All
* rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
import android.content.Context;
import androidx.preference.CheckBoxPreference;
import android.util.AttributeSet;
public abstract class ConfirmingCheckBoxPreference extends CheckBoxPreference {
private boolean m_attached = false;
public ConfirmingCheckBoxPreference( Context context, AttributeSet attrs )
{
super( context, attrs );
}
@Override
public void onAttached()
{
super.onAttached();
m_attached = true;
}
abstract void checkIfConfirmed();
@Override
public void setChecked( boolean checked )
{
if ( checked && m_attached && getContext() instanceof PrefsActivity ) {
checkIfConfirmed();
} else {
super.setChecked( checked );
}
}
// Because s_this.super.setChecked() isn't allowed...
protected void super_setChecked( boolean checked )
{
super.setChecked( checked );
}
}
| [
"[email protected]"
] | |
ce46c4b9bb347052762d41f9b383e21c92abbf10 | ff1491108785b892ccdedf898bba6f8959defb87 | /src/main/java/com/andromedarp/realphone/api/realphone/rest/controller/ContactsController.java | 8b96207730c16e0d53e4834e91285c0f69dff2ce | [] | no_license | VictorSanMa/RealPhone | 197d1586be188282e9e34a66018de0eb530e1950 | c83aafb107f642906b4ed063c79d9b659575df75 | refs/heads/master | 2023-02-04T06:01:20.938610 | 2020-12-17T18:28:20 | 2020-12-17T18:28:20 | 322,378,039 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 975 | java | package com.andromedarp.realphone.api.realphone.rest.controller;
import com.andromedarp.realphone.api.realphone.enity.PhoneUserContact;
import com.andromedarp.realphone.api.realphone.service.PhoneUserContactService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@Slf4j
@RequestMapping("contacts")
public class ContactsController {
@Autowired
private PhoneUserContactService phoneUserContactService;
@GetMapping("/{id}")
public List<PhoneUserContact> getUserContacts(@PathVariable String id) {
log.info("Getting contacts of identifier: {}", id);
return phoneUserContactService.getContacts(id);
}
}
| [
"[email protected]"
] | |
fbd45ad365aa1a51ad75109ef091c5e569a07d51 | 421f0a75a6b62c5af62f89595be61f406328113b | /generated_tests/model_seeding/6_jnfe-br.com.jnfe.base.TpObsNFe-0.5-8/br/com/jnfe/base/TpObsNFe_ESTest_scaffolding.java | 35c4ecc7432495dfd663480b8bac4c0c8fe6cca9 | [] | no_license | tigerqiu712/evosuite-model-seeding-empirical-evaluation | c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6 | 11a920b8213d9855082d3946233731c843baf7bc | refs/heads/master | 2020-12-23T21:04:12.152289 | 2019-10-30T08:02:29 | 2019-10-30T08:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Tue Oct 29 15:57:27 GMT 2019
*/
package br.com.jnfe.base;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class TpObsNFe_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
] | |
cfdd91a99bdc08b3e3d843e30412d6d3ad1b98b3 | a7881024fb69ffdb430c426b53cb65194dab301c | /Ilearning0123/src/hpecl/uclass/Bean/QuestionAnswer.java | 76762213100ba4dbcfd5adc0c62e185a58fed7d7 | [] | no_license | huyuyu/ilearning0318 | a0b62b0a044850e135222cf7ab61727be699a510 | c062562e1030984f03dbd4a169353096556a12a7 | refs/heads/master | 2021-01-10T10:14:13.837564 | 2016-03-27T02:33:41 | 2016-03-27T02:33:41 | 54,808,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,341 | java | /*
* Copyright ©2015 by HPEC Lab,School of Software and Microelectronics,Peking University, All rights reserved.
* 版权所有 ©2015 北京大学软件与微电子学院 高性能嵌入式计算实验室
* filename:QuestionAnswer.java
* Author:郭靖东
* Version:1.1
* Date:2015/08/12
* Description:This java file is the object class, include four private params.
* Modify history:
* 郭靖东,create file,2015/08/12
*/
package hpecl.uclass.Bean;
public class QuestionAnswer {
private String question;
private String asker;
private String questionContent;
private String url;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public QuestionAnswer(String question, String asker, String questionContent, String url) {
super();
this.question = question;
this.asker = asker;
this.questionContent = questionContent;
this.url = url;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getAsker() {
return asker;
}
public void setAsker(String asker) {
this.asker = asker;
}
public String getQuestionContent() {
return questionContent;
}
public void setQuestionContent(String questionContent) {
this.questionContent = questionContent;
}
}
| [
"[email protected]"
] | |
455e468474852a5a0b2df110298d681d7ed080b1 | 214782bc02d4abf0c0bcbe6100cccfa1877fcea9 | /Bai13_NgocVy/Bai13_Vidu4/src/com/example/bai13_vidu4/EmployeePartTime.java | 9a6f670e15f87713e137aa35f068c58e50acf72d | [] | no_license | ngocvy1181/Android | e4e73a64145bc38a971602776af51e2e29bf626d | ad2f76946dc34bf315c9f9e9aabd3d410a8eda22 | refs/heads/master | 2021-01-20T09:46:01.046779 | 2017-05-18T02:39:46 | 2017-05-18T02:39:46 | 89,069,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package com.example.bai13_vidu4;
public class EmployeePartTime extends Employee {
@Override
public double TinhLuong() {
// TODO Auto-generated method stub
return 150;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return super.toString() +" -->PartTime="+TinhLuong();
}
}
| [
"[email protected]"
] | |
5d3f8714892f0babd8dcd2a5400cd8f22a96a4b7 | a80762a7d948029ce544ce9c3a50f2952a4634b6 | /src/kata4/MailListReader.java | 67cefc272eba03cc7666d564b2f4ee30398245d3 | [] | no_license | Barreto95/Kata4 | 86495f4097952b9a59c597ca9b58041eb2179c98 | 8dc81a67f052d49eb69e6676446ffb358293ba2b | refs/heads/master | 2021-01-11T05:57:47.963419 | 2016-10-27T10:46:41 | 2016-10-27T10:46:41 | 72,098,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 706 | java | package kata4;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class MailListReader {
public static ArrayList<String> read(String name) throws FileNotFoundException, IOException{
ArrayList<String> mailList = new ArrayList<>();
BufferedReader reader = new BufferedReader(new FileReader(name));
String mail;
while((mail = reader.readLine()) != null){
if(!mail.contains("@")) continue;
mailList.add(mail);
}
reader.close();
return mailList;
}
}
| [
"[email protected]"
] | |
914a6b72ca62bdadbfd0a9a66690448dd32ad827 | 493a8065cf8ec4a4ccdf136170d505248ac03399 | /net.sf.ictalive.services/src/net/sf/ictalive/service/ServiceConsumer.java | f30856fddc65cf789c5d3ade58e8ede0adf12da8 | [] | no_license | ignasi-gomez/aliveclipse | 593611b2d471ee313650faeefbed591c17beaa50 | 9dd2353c886f60012b4ee4fe8b678d56972dff97 | refs/heads/master | 2021-01-14T09:08:24.839952 | 2014-10-09T14:21:01 | 2014-10-09T14:21:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,394 | java | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package net.sf.ictalive.service;
import net.sf.ictalive.coordination.agents.Agent;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Consumer</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link net.sf.ictalive.service.ServiceConsumer#getInvokes <em>Invokes</em>}</li>
* <li>{@link net.sf.ictalive.service.ServiceConsumer#getIsType <em>Is Type</em>}</li>
* </ul>
* </p>
*
* @see net.sf.ictalive.service.ServicePackage#getServiceConsumer()
* @model
* @generated
*/
public interface ServiceConsumer extends Agent {
/**
* Returns the value of the '<em><b>Invokes</b></em>' reference list.
* The list contents are of type {@link net.sf.ictalive.service.Service}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Invokes</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Invokes</em>' reference list.
* @see net.sf.ictalive.service.ServicePackage#getServiceConsumer_Invokes()
* @model required="true"
* @generated
*/
EList<Service> getInvokes();
/**
* Returns the value of the '<em><b>Is Type</b></em>' attribute.
* The literals are from the enumeration {@link net.sf.ictalive.service.ServiceType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Is Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Is Type</em>' attribute.
* @see net.sf.ictalive.service.ServiceType
* @see #setIsType(ServiceType)
* @see net.sf.ictalive.service.ServicePackage#getServiceConsumer_IsType()
* @model required="true" derived="true"
* @generated
*/
ServiceType getIsType();
/**
* Sets the value of the '{@link net.sf.ictalive.service.ServiceConsumer#getIsType <em>Is Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Is Type</em>' attribute.
* @see net.sf.ictalive.service.ServiceType
* @see #getIsType()
* @generated
*/
void setIsType(ServiceType value);
} // ServiceConsumer
| [
"[email protected]"
] | |
a3853dae2179c2190c76d3f2dea3cfb483eae170 | c25a7d63834c361d62a47b97a56ca332365c68df | /src/main/java/com/hhseong/service/LoginService.java | ae50ce95d07c65d2426afbba584d3ff969b9f9e0 | [] | no_license | hhsung0120/security | 81bc5927bd21e8f3ecc3cef57dfbc7a5005a696f | ae362eb09e9f70b4d0d238f79eb5a5c1f1e4c1e4 | refs/heads/master | 2022-12-05T19:05:57.204426 | 2020-08-20T12:08:50 | 2020-08-20T12:08:50 | 288,176,424 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,272 | java | package com.hhseong.service;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class LoginService implements UserDetailsService {
@Override
public UserDetails loadUserByUsername(String userId) throws UsernameNotFoundException {
//userId 를 이용하여 DB를 조회한다.
//성공일경우 user 객체 반환
List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>();
if ("user".equals(userId)) {
roles.add(new SimpleGrantedAuthority("ROLE_USER"));
} else if ("admin".equals(userId)) {
roles.add(new SimpleGrantedAuthority("ROLE_USER"));
roles.add(new SimpleGrantedAuthority("ROLE_ADMIN"));
} else {
return null;
}
return new User(userId, userId, roles);
}
}
| [
"[email protected]"
] | |
b90470b02c9b568035b00bfc885ccd9d0d506eca | 236ebb7e4466a81f6ee04d2969b226132774fc28 | /lab/activiti_demo_01/src/main/java/com/turbo/demo/listener/MyTaskListener.java | f1de5442db400eedb3b4ad3a8fc057f38390c1ac | [] | no_license | turboYuu/activiti-7 | 93117ba6230510d385961ae1a920f107531f1333 | 7ca0958b7cddf95bd4472c5a1ce58afce6a263f0 | refs/heads/master | 2023-07-22T08:21:14.793167 | 2021-09-03T10:44:32 | 2021-09-03T10:44:32 | 402,035,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 608 | java | package com.turbo.demo.listener;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
/**
* 监听器
*/
public class MyTaskListener implements TaskListener {
/**
* 指定负责人
* @param delegateTask
*/
@Override
public void notify(DelegateTask delegateTask) {
// 判断当前的任务是创建申请,并且事件名字:create
if("创建申请".equals(delegateTask.getName()) &&
"create".equals(delegateTask.getEventName())){
delegateTask.setAssignee("张三");
}
}
}
| [
"[email protected]"
] | |
990c00cbb7cc5128e7920a9223c06be4e7421a63 | a83fc9bdc847da4b56b03ccece960bb5ebb79fa7 | /nx_shop/api/ec-mapi/src/main/java/com/tyiti/easycommerce/service/impl/FavoriteServiceImpl.java | d4823366a6c79ece8075709dff3d0561e490bdca | [] | no_license | wilsonpanmacau/LimSpace | 0849a84cfbe27abca05639f905d8fa995f7ccd8c | d49655985a43ff13293791b056bfdebaf69383aa | refs/heads/master | 2022-05-04T10:22:32.966412 | 2017-08-23T01:56:10 | 2017-08-23T01:56:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,401 | java | package com.tyiti.easycommerce.service.impl;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tyiti.easycommerce.base.SearchResult;
import com.tyiti.easycommerce.repository.FavoriteDao;
import com.tyiti.easycommerce.service.FavoriteService;
@Service("favoriteService")
public class FavoriteServiceImpl implements FavoriteService {
@Autowired
private FavoriteDao favoriteDao;
@Override
public SearchResult<Map<String, Object>> getAll(Map<String,Object> param) {
if(param.get("limit")!=null &¶m.get("limit")!=""){
param.put("limit", Integer.parseInt(String.valueOf(param.get("limit"))));
}
if(param.get("offset")!=null && param.get("offset")!=""){
param.put("offset", Integer.parseInt(String.valueOf(param.get("offset"))));
}
if(param.get("startTime")!=null && param.get("startTime")!=""){
String startTime = param.get("startTime") + " 00:00:00";
param.put("startTime",startTime);
}
if(param.get("endTime")!=null && param.get("endTime")!=""){
String endTime = param.get("endTime") + " 23:59:59";
param.put("endTime", endTime);
}
SearchResult<Map<String,Object>> searchResult = new SearchResult<Map<String,Object>>();
searchResult.setRows(this.favoriteDao.getAll(param));
searchResult.setTotal(this.favoriteDao.getCount(param));
return searchResult;
}
}
| [
"[email protected]"
] | |
7addaae5ba984d6021e04a9782da6339b30b961a | 22f435a1ce902011234cdb2dc5448cb3e94dae26 | /The newspaper Agency/Main.java | d6064871f6c79d132453e90f8a1416df76fb030f | [] | no_license | JonathSujan/Playground | ef7f14ae9155257afe30db940c87fce08b6d1ca1 | b1e34784d37cbdac52148ec61f3817edde585e6d | refs/heads/master | 2022-11-26T05:26:10.726254 | 2020-04-30T04:50:44 | 2020-04-30T04:50:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 141 | java | #include<iostream>
using namespace std;
int main()
{
int w,x,y, profit;
std::cin>>w>>x>>y;
profit = w*(x-y)-100;
std::cout<<profit;
} | [
"[email protected]"
] | |
0d4fb204ebf299073232ca3c8cc67c75851ca8bd | 47aa9c079f8bf5b33b4d719ec991710d4c993f49 | /src/main/java/cn/ac/iscas/service/events/EventRetrievalService.java | 5bcaa3eca2215e343cc3e17956ac92f012a7ef46 | [] | no_license | Zhihao-de/DailyConnect | c4f2c234da4e6c9163f2a7161e3fa10c58d59323 | 4b2d8fc03e099d2d7cc1ec16d5971806b014c4ed | refs/heads/master | 2022-12-22T03:08:04.716285 | 2020-05-05T20:30:27 | 2020-05-05T20:30:27 | 251,192,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,064 | java | package cn.ac.iscas.service.events;
import cn.ac.iscas.dao.EventsMapper;
import cn.ac.iscas.entity.Events;
import cn.ac.iscas.error.ErrCodes;
import cn.ac.iscas.service.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class EventRetrievalService {
@Autowired
private EventsMapper eventsMapper;
/**
* 3主页面作业列表
* 根据老师的Id查询其穿件的事件内容
*
* @param
* @return ok或<code>ErrCodes.EMPTY_RESULT_SET</code>或<code>ErrCodes.SERVICE_UNEXPECTED_ERROR</code>
*/
public ResponseResult getByTeacherId(int teacherId) {
assert 0 < teacherId;
try {
Events[] events = eventsMapper.selectEventsByTeacherId(teacherId);
if (null == events) {
return ResponseResult.error(ErrCodes.EMPTY_RESULT_SET, "non-existing event from the teacher");
}
return ResponseResult.ok().put("events", events);
} catch (Exception ex) {
return ResponseResult.error(ErrCodes.SERVICE_UNEXPECTED_ERROR, ex.getMessage());
}
}
/**
* 5. 根据event 的开始结束时间 和老师的ID 来查找事件
*
* @param
* @return ok或<code>ErrCodes.EMPTY_RESULT_SET</code>或<code>ErrCodes.SERVICE_UNEXPECTED_ERROR</code>
*/
public ResponseResult getByDate(Date date, int id) {
assert date != null;
try {
Events[] events = eventsMapper.selectEventsByTeacherId(id);
if (null == events) {
return ResponseResult.error(ErrCodes.EMPTY_RESULT_SET, "non-existing event from the teacher");
}
List<Events> ev = new ArrayList();
for (Events event : events) {
if (date.getTime() >= event.getStartTime().getTime() && date.getTime() <= event.getEndTime().getTime()) {
ev.add(event);
}
}
return ResponseResult.ok().put("events", ev.toArray(new Events[ev.size()]));
} catch (Exception ex) {
return ResponseResult.error(ErrCodes.SERVICE_UNEXPECTED_ERROR, ex.getMessage());
}
}
/**
* 6. 根据事件的Id查询其穿件的事件内容
* 11. 事件的详细页
*
* @param
* @return ok或<code>ErrCodes.EMPTY_RESULT_SET</code>或<code>ErrCodes.SERVICE_UNEXPECTED_ERROR</code>
*/
public ResponseResult get(int eventId) {
assert 0 < eventId;
try {
Events event = eventsMapper.selectEventById(eventId);
if (null == event) {
return ResponseResult.error(ErrCodes.EMPTY_RESULT_SET, "non-existing event from the teacher");
}
return ResponseResult.ok().put("event", event);
} catch (Exception ex) {
return ResponseResult.error(ErrCodes.SERVICE_UNEXPECTED_ERROR, ex.getMessage());
}
}
}
| [
"[email protected]"
] | |
5007094a2d1b3b78a4a804b01fbd31f9b8551139 | 3e74b3d9c6508b659e0ec9ec8322127e4390812c | /app/src/test/java/com/example/ujjwa/timestables/ExampleUnitTest.java | 74c1231fec339900d3ba87009c94fd46aafb64be | [] | no_license | ujjwalkumar12/Times-Tables | 2fb30cd1178171b7303e35fad69f12b2f0da14c9 | 37a5386d8932ee9642aa909f863039efa386c36c | refs/heads/master | 2020-04-14T13:35:27.411074 | 2019-01-02T18:04:06 | 2019-01-02T18:04:06 | 163,873,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package com.example.ujjwa.timestables;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
33e725bed66b359c7e17a4c13f5fcaa41e2d4777 | 3a92d98ba2ac492c1cb2bbafeff92a85e0c3e5d1 | /src/main/java/lsieun/bytecode/gen/opcode/DLOAD.java | 2d2cbbcf66b964d2651226b49ca75b0225c8ce6b | [
"MIT"
] | permissive | lsieun/lsieun-bytecode-gen | 7379f3ad57ed2d452f195aef2454ad10f4920055 | 16c5e2e361ebca4a076741402cd9f19f7e13b82d | refs/heads/master | 2021-07-08T00:39:31.019071 | 2019-08-18T02:20:46 | 2019-08-18T02:20:46 | 201,840,405 | 0 | 0 | MIT | 2020-10-13T15:24:06 | 2019-08-12T02:05:49 | Java | UTF-8 | Java | false | false | 726 | java | package lsieun.bytecode.gen.opcode;
import java.io.DataOutputStream;
import java.io.IOException;
import lsieun.bytecode.core.cst.OpcodeConst;
import lsieun.bytecode.gen.opcode.facet.LocalVariableInstruction;
/**
* DLOAD - Load double from local variable
* <PRE>Stack ... -> ..., result.word1, result.word2</PRE>
*/
public final class DLOAD extends LocalVariableInstruction {
public DLOAD(final int index) {
super(OpcodeConst.DLOAD, 2);
this.index = index;
}
@Override
public void dump(DataOutputStream out) throws IOException {
out.writeByte(opcode);
if (wide) {
out.writeShort(index);
} else {
out.writeByte(index);
}
}
}
| [
"[email protected]"
] | |
bdf14ba4a6795faf0b0aab3692628bfe93cc0fa1 | 2c319d505e8f6a21708be831e9b5426aaa86d61e | /base/agent/src/main/java/leap/agent/AgentPremain.java | cf2fd4fbfa482b5bdbba8fb7d3fa3576f53c9ee0 | [
"Apache-2.0"
] | permissive | leapframework/framework | ed0584a1468288b3a6af83c1923fad2fd228a952 | 0703acbc0e246519ee50aa9957f68d931fab10c5 | refs/heads/dev | 2023-08-17T02:14:02.236354 | 2023-08-01T09:39:07 | 2023-08-01T09:39:07 | 48,562,236 | 47 | 23 | Apache-2.0 | 2022-12-14T20:36:57 | 2015-12-25T01:54:52 | Java | UTF-8 | Java | false | false | 787 | java | /*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package leap.agent;
import java.lang.instrument.Instrumentation;
public interface AgentPremain {
void run(String args, Instrumentation inst) throws Exception;
}
| [
"[email protected]"
] | |
848cfac3545778cf74e57ae71110a8ea0ab38c5c | e41ca854fb41a11483c40c253f7c84ae855e1688 | /src/main/java/com/udemy/cursomc/domain/Produto.java | 367787cccbd2d0cac7dde3127b0136e0883199f0 | [] | no_license | PedroAlmy/cursomc | 0e18821b0c40f1e5fdd10088e14f282af89483d9 | 5d643a41b34dd5be845891744938d5aa92d99307 | refs/heads/master | 2020-05-15T19:43:19.463490 | 2019-05-05T00:07:39 | 2019-05-05T00:07:39 | 182,462,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,031 | java | package com.udemy.cursomc.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import com.fasterxml.jackson.annotation.JsonBackReference;
@Entity
public class Produto implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String nome;
private Double preco;
@JsonBackReference
@ManyToMany
@JoinTable(name = "PRODUTO_CATEGORIA", joinColumns = @JoinColumn(name = "produto_id"), inverseJoinColumns = @JoinColumn(name = "categoria_id"))
private List<Categoria> categorias = new ArrayList<>();
public Produto() {
}
public Produto(Integer id, String nome, Double preco) {
super();
this.id = id;
this.nome = nome;
this.preco = preco;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Double getPreco() {
return preco;
}
public void setPreco(Double preco) {
this.preco = preco;
}
public List<Categoria> getCategorias() {
return categorias;
}
public void setCategorias(List<Categoria> categorias) {
this.categorias = categorias;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Produto other = (Produto) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"[email protected]"
] | |
6b2fee7dfad09beded9528dfe7c358229d89eab6 | 197b7491ea6bf1a67af171e156b6acbc29a24f70 | /Backend-template/GetSampleDao.java | 5fac9f87ebd51a91557de808986e6541ea9a7e1a | [] | no_license | Xplorist/fox-knowledge-library | 3ecf7a4fa96cb94b1e1eade1bf1d943999d074dd | 5371ca8acad3bf200554d898bfec1b79e9a9aa60 | refs/heads/main | 2023-08-30T16:08:00.068397 | 2021-11-17T18:06:21 | 2021-11-17T18:06:21 | 429,147,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package com.partsMeasurePage.dao;
import java.util.List;
import com.partsMeasurePage.bean.ApplyBillBean;
import com.partsMeasurePage.bean.Get_sample_bean;
import com.partsMeasurePage.mapper.GetSampleMapper;
/**
* 送檢取料dao
* @author C3005579
* @date 2018年9月8日 下午3:36:31
*/
public class GetSampleDao extends BaseDao {
private GetSampleMapper mapper = sqlSession.getMapper(GetSampleMapper.class);
// 查詢申請單list
public List<ApplyBillBean> queryApplyBillList() {
List<ApplyBillBean> queryApplyBilList = mapper.queryApplyBilList();
closeResources();
return queryApplyBilList;
}
// 新增送檢取料
public String addGetSampleBill(Get_sample_bean bean) {
String flag = "1";// 1成功,0失敗
try {
mapper.addGetSampleBill(bean);
} catch (Exception e) {
flag = "0";
e.printStackTrace();
}
closeResources();
return flag;
}
// 查詢待取料和結案的所有申請單信息
public void queryAllBillInfo() {
}
}
| [
"[email protected]"
] | |
bb30280bc0093ab66a1f1097fafedc2629c9cc80 | 7e1dddd2b868a359ee5c3ce45429d841aa37309b | /app/src/test/java/com/dproject/alibi/ExampleUnitTest.java | 6a4e1e2934663a2695a9f056a606cc0f830130ba | [] | no_license | DainChoi/Alibi | d4ee24cb0f957b0142e416873c277ffa38d89eb6 | a3070a88a73aefedf042a67df4bfb7fbbd90ff97 | refs/heads/master | 2023-09-01T20:49:13.456726 | 2021-10-22T14:33:57 | 2021-10-22T14:33:57 | 363,545,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package com.dproject.alibi;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
20ba891703fe3915e13b58dead0766696b7e6e1a | d646f39ed2b43f810f9bf719b1e61c30ff66e538 | /Code-fu/src/Entropija.java | fd634c0a7f802885493ba417195c9f17c2ac7fef | [] | no_license | gajduk/ag-algorithm-competitions | ee663227e0e51363d89ce08c2e28e613b6ff60ad | db5a03524622fca0619ffbc7c7e32591788143fe | refs/heads/main | 2023-06-02T03:21:18.950423 | 2021-06-07T14:22:51 | 2021-06-07T14:22:51 | 374,693,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | import java.util.Arrays;
public class Entropija {
public static void main(String[] args) {
System.out.println(log2(3));
double p[] = {0.25,0.11,0.3,0.08,0.07,0.05,0.07,0.03,0.02,0.02};
double res = 0;
String s = "";
for ( int i = 0 ; i < p.length ; ++i ) {
System.out.print(log2(1.0/p[i])+" , ");
double pr = log2(1.0/p[i])*p[i];
res += pr;
s +=pr +" ";
}
System.out.println();
System.out.println(s);
System.out.println(res);
System.out.println();
Arrays.sort(p);
System.out.println(Arrays.toString(p));
double q = p[0]+p[1];
p = Arrays.copyOfRange(p, 1, p.length);
p[0] = q;
Arrays.sort(p);
System.out.println(Arrays.toString(p));
while ( p.length > 3 ) {
double qw = p[0]+p[1]+p[2];
p = Arrays.copyOfRange(p, 2, p.length);
p[0] = qw;
Arrays.sort(p);
System.out.println(Arrays.toString(p));
}
}
public static double log2( double a ) {
return Math.log(a)/Math.log(2);
}
}
| [
"[email protected]"
] | |
4c0231960352c680453c46ca783086881a5f00e1 | a17dd1e9f5db1c06e960099c13a5b70474d90683 | /core/src/main/java/jp/co/sint/webshop/service/data/csv/GiftCardLogExportCondition.java | 49fe3f1ee4270a9a193badd73319e8aa19b41eac | [] | no_license | giagiigi/ec_ps | 4e404afc0fc149c9614d0abf63ec2ed31d10bebb | 6eb19f4d14b6f3a08bfc2c68c33392015f344cdd | refs/heads/master | 2020-12-14T07:20:24.784195 | 2015-02-09T10:00:44 | 2015-02-09T10:00:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java | package jp.co.sint.webshop.service.data.csv;
import jp.co.sint.webshop.service.analysis.GiftCardLogSearchCondition;
import jp.co.sint.webshop.service.data.CsvConditionImpl;
public class GiftCardLogExportCondition extends CsvConditionImpl<GiftCardLogCsvSchema>{
/** serial version UID */
private static final long serialVersionUID = 1L;
private GiftCardLogSearchCondition searchCondition;
/**
* @return the searchCondition
*/
public GiftCardLogSearchCondition getSearchCondition() {
return searchCondition;
}
/**
* @param searchCondition the searchCondition to set
*/
public void setSearchCondition(GiftCardLogSearchCondition searchCondition) {
this.searchCondition = searchCondition;
}
}
| [
"[email protected]"
] | |
82ff314c7e55c3e238e2742ed352564ecee67e92 | 08ad44d1e94cf1677f3e27fefffb9f59500962cc | /Echanneling/specialized-area/src/main/java/com/specializedAarea/SpecializedAreaApplication.java | 47bbae1c9ecb4b6b5fc1b9cd594734da409489f7 | [] | no_license | ShaleelAbhishek/Spring-boot-basics | 29023bcf6db60218c894a78ae4f4fb6f660202c2 | 3a54af5f2a53f5582777de80610a1f257703dcc2 | refs/heads/master | 2023-08-03T04:37:05.234314 | 2020-04-29T14:15:15 | 2020-04-29T14:15:15 | 244,447,633 | 0 | 0 | null | 2023-07-23T07:31:25 | 2020-03-02T18:43:02 | Java | UTF-8 | Java | false | false | 419 | java | package com.specializedAarea;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableEurekaClient
public class SpecializedAreaApplication {
public static void main(String[] args) {
SpringApplication.run(SpecializedAreaApplication.class, args);
}
}
| [
"[email protected]"
] | |
484a8dd4cd88846d4c0b488dae54c5ce5d8a93f5 | ccb80fd76f16884ab6c3b28998a3526ac38ec321 | /ctakes-ytex/src/main/java/org/apache/ctakes/jdl/AppMain.java | 5c487fda7cfd198d218cfcd06da058dccabc541c | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | apache/ctakes | 5d5c35a7c8c906e21d52488396adeb40ebd7034e | def3dea5602945dfbec260d4faaabfbc0a2a2ad4 | refs/heads/main | 2023-07-02T18:28:53.754174 | 2023-05-18T00:00:51 | 2023-05-18T00:00:51 | 26,951,043 | 97 | 77 | Apache-2.0 | 2022-10-18T23:28:24 | 2014-11-21T08:00:09 | Java | UTF-8 | Java | false | false | 2,956 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ctakes.jdl;
import org.apache.commons.cli.*;
/**
* Java data loader Main.
*
* @author mas
*/
public final class AppMain {
private static final String OPT_XDL_CONN_LONG = "conn";
private static final String OPT_XDL_DATA_LONG = "data";
private static final String OPT_XDL_LOAD_LONG = "load";
private static final String OPT_XDL_CONN_DESCR = "conn file";
private static final String OPT_XDL_DATA_DESCR = "data file";
private static final String OPT_XDL_LOAD_DESCR = "load file";
public static final String OPT_XDL_CONN = "c";
public static final String OPT_XDL_DATA = "d";
public static final String OPT_XDL_LOAD = "l";
private AppMain() {
}
/**
* @return the options of the commandLine
*/
public static Options getOprions() {
Option optXdlConn = new Option(OPT_XDL_CONN, OPT_XDL_CONN_LONG, true, OPT_XDL_CONN_DESCR);
optXdlConn.setRequired(true);
Option optXdlData = new Option(OPT_XDL_DATA, OPT_XDL_DATA_LONG, true, OPT_XDL_DATA_DESCR);
optXdlData.setRequired(true);
Options options = new Options();
options.addOption(optXdlConn);
options.addOption(optXdlData);
options.addOption(OPT_XDL_LOAD, OPT_XDL_LOAD_LONG, true, OPT_XDL_LOAD_DESCR);
return options;
}
/**
* @param arguments
* the arguments to parse
* @return the commandLine
* @throws ParseException
* exception
*/
public static CommandLine parsingCLI(String[] arguments) throws ParseException {
Options options = getOprions();
PosixParser posix = new PosixParser();
return posix.parse(options, arguments);
}
/**
* @param args
* input string
*/
public static void main(String[] args) {
String cmdLineSyntax = "java [-options] -jar jarfile";
String header = "Java Data Loader";
try {
CommandLine cl = parsingCLI(args);
String srcConn = cl.getOptionValue(OPT_XDL_CONN);
String srcData = cl.getOptionValue(OPT_XDL_DATA);
String srcLoad = cl.getOptionValue(OPT_XDL_LOAD);
new AppJdl(srcConn, srcData, srcLoad).execute();
} catch (ParseException e) {
new HelpFormatter().printHelp(cmdLineSyntax, header, getOprions(), null, true);
}
}
}
| [
"[email protected]"
] | |
fcf3e6fa0a0f2be75a5cb75f098f0357180ccdb9 | b8ce67a9fb6835148858679e86177cf96f7c9021 | /framework.cots2/src/main/java/com/cots/mvc/controller/access/AccessControl.java | 59091e3de5f923bc01c32067c7744dbec8f46119 | [] | no_license | redtroy/product | 283c72856142274cf6cfcd630a2d3164267eb161 | 8d00d58f9f73016d48ca7f8ea3e4ca85084eeaef | refs/heads/master | 2020-06-08T12:10:18.681012 | 2012-11-15T02:56:14 | 2012-11-15T02:56:14 | 5,503,854 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,509 | java | /**
*all rights reserved,@copyright 2003
*/
package com.cots.mvc.controller.access;
import com.cots.blc.BLContext;
/**
* Description:
* <p/>
* User: chuguanghua
* Date: 2004-11-16
* Time: 9:18:10
*/
public interface AccessControl {
/**
* initialize the access control data that is shared by different users;
*
* @param context
*/
void init(BLContext context);
/**
* check if a user can do an action;
*
* @param userID the userID;
* @param action the target action the user is trying to do;
*/
boolean canDo(String userID,String action);
/**
* check if a Login can access a specified action;
*
* @param user the Login object;
* @param action the action that the user is trying to acess;
* @return true if the user can access this action,false otherwise;
*/
boolean canDo(Login user,String action);
/**
* every one include those have not logined in can access a action.
*
* @param action
* @return true if everyone including those have not logined can access the action.
*/
boolean isFreeAction(String action);
/**
* every logined user can access the action.
*
* @param action the displayName of the action;
* @return true if all logined user can access this action
*/
boolean isAllUserAction(String action);
/**
* close this object;
*/
void close();
} | [
"[email protected]"
] | |
6af927f07ee697efb9703703bd02cbc4f2d744ac | cc1d007f52ba8ab7b8221f3a1b8dfd0e2e9d1f0c | /Lab05/src/lab5part4/Part4.java | e7b6eec1b14aa38c3e081e42ac9ab829b2c3ac4c | [] | no_license | WowSuchRicky/CS235 | 3b7907931795fea7c570cf8d2ca093affa1780cd | 180617db68e6c8a1a2a9c0c096dee06665ba785a | refs/heads/master | 2021-05-28T01:57:45.780442 | 2013-09-08T01:36:51 | 2013-09-08T01:36:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,502 | java | package lab5part4;
/**
* Title: Part4 class for CSIS 235 Lab #5
* Description: CS 235 Lab #5 - Part 4
* This class has a main method that is used to
* try out the Account, CheckingAccount, and
* SavingsAccount classes.
* @author Ricky Mutschlechner & Tim Olmstead
* @email [email protected] & [email protected]
* @date October 5th 2012
*/
public class Part4 {
/**
* @param args
*/
public static void main(String[] args) {
final int NUMBER_OF_ACCOUNTS = 6;
Account[] accounts = new Account[ NUMBER_OF_ACCOUNTS ];
accounts[0] = new CheckingAccount("John Hunchar" , 500 );
accounts[1] = new SavingsAccount ("Shirin Asadi" , 750 );
accounts[2] = new CheckingAccount("Eric Brown" , 325 );
accounts[3] = new SavingsAccount ("Noah Muth" , 600 );
accounts[4] = new CheckingAccount("Jessica Wilson", 242 );
accounts[5] = new SavingsAccount ("Dylan Robey", 521 );
System.out.println("Starting balances");
for (Account x : accounts)
System.out.println( " Account - " + x );
float transfer1 = 50;
accounts[1].withdraw( transfer1 );
accounts[0].deposit( transfer1);
float transfer2 = 100;
accounts[2].withdraw( transfer2 );
accounts[3].deposit( transfer2 );
float transfer3 = 42;
accounts[4].withdraw( transfer3 );
accounts[5].deposit( transfer3 );
System.out.println("Ending balances");
for (Account x : accounts)
System.out.println( " Account - " + x );
}
}
| [
"[email protected]"
] | |
49cbfa1b7cf0b7363997968d98a395da510c74bf | 410f4eb7c64d30cd3551eb3a2cba8a7aee490bd2 | /05-ms-dashboard-5555/src/test/java/com/roro/msdashboard5555/ApplicationTests.java | 160f0c0d078561d6302eb505e06d7fc8d28f06a6 | [] | no_license | RoroLi/learning-springcloud | 53ad0c6d024c9645f60da304f79d437e9b0d41b1 | 2155a5e40b28033c08172af60483c4ad3d1743b0 | refs/heads/master | 2020-05-19T16:41:06.827038 | 2019-05-10T11:15:47 | 2019-05-10T11:15:47 | 185,116,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.roro.msdashboard5555;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
ee59f8fcd46276cc2f96338c63c3a052d2299153 | 9f8198d4c157f4e9c6b6b524bdb91e95c4e06e5f | /docroot/WEB-INF/service/com/kencana/lms/service/persistence/CircTransHistoryPersistence.java | 179992a6f1467da1e085375809048436a5566d43 | [] | no_license | MrNet86/kencana-lms | f2fe82629f56780bc651c0b69020f53760288064 | 5750117ff2d41cdf7eb4905e7a424131f26ac767 | refs/heads/master | 2020-12-25T22:58:45.211014 | 2015-11-11T17:18:28 | 2015-11-11T17:18:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 43,716 | java | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.kencana.lms.service.persistence;
import com.kencana.lms.model.CircTransHistory;
import com.liferay.portal.service.persistence.BasePersistence;
/**
* The persistence interface for the circ trans history service.
*
* <p>
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author Mazlan Mat
* @see CircTransHistoryPersistenceImpl
* @see CircTransHistoryUtil
* @generated
*/
public interface CircTransHistoryPersistence extends BasePersistence<CircTransHistory> {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this interface directly. Always use {@link CircTransHistoryUtil} to access the circ trans history persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this interface.
*/
/**
* Returns all the circ trans histories where companyId = ? and groupId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @return the matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByCompanyGroup(
long companyId, long groupId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns a range of all the circ trans histories where companyId = ? and groupId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param companyId the company ID
* @param groupId the group ID
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @return the range of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByCompanyGroup(
long companyId, long groupId, int start, int end)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns an ordered range of all the circ trans histories where companyId = ? and groupId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param companyId the company ID
* @param groupId the group ID
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByCompanyGroup(
long companyId, long groupId, int start, int end,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the first circ trans history in the ordered set where companyId = ? and groupId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory findByCompanyGroup_First(
long companyId, long groupId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the first circ trans history in the ordered set where companyId = ? and groupId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching circ trans history, or <code>null</code> if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory fetchByCompanyGroup_First(
long companyId, long groupId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the last circ trans history in the ordered set where companyId = ? and groupId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory findByCompanyGroup_Last(
long companyId, long groupId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the last circ trans history in the ordered set where companyId = ? and groupId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching circ trans history, or <code>null</code> if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory fetchByCompanyGroup_Last(
long companyId, long groupId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the circ trans histories before and after the current circ trans history in the ordered set where companyId = ? and groupId = ?.
*
* @param transId the primary key of the current circ trans history
* @param companyId the company ID
* @param groupId the group ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a circ trans history with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory[] findByCompanyGroup_PrevAndNext(
long transId, long companyId, long groupId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Removes all the circ trans histories where companyId = ? and groupId = ? from the database.
*
* @param companyId the company ID
* @param groupId the group ID
* @throws SystemException if a system exception occurred
*/
public void removeByCompanyGroup(long companyId, long groupId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the number of circ trans histories where companyId = ? and groupId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @return the number of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public int countByCompanyGroup(long companyId, long groupId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns all the circ trans histories where companyId = ? and groupId = ? and libraryId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @return the matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByCompanyGroupLibrary(
long companyId, long groupId, long libraryId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns a range of all the circ trans histories where companyId = ? and groupId = ? and libraryId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @return the range of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByCompanyGroupLibrary(
long companyId, long groupId, long libraryId, int start, int end)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns an ordered range of all the circ trans histories where companyId = ? and groupId = ? and libraryId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByCompanyGroupLibrary(
long companyId, long groupId, long libraryId, int start, int end,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the first circ trans history in the ordered set where companyId = ? and groupId = ? and libraryId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory findByCompanyGroupLibrary_First(
long companyId, long groupId, long libraryId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the first circ trans history in the ordered set where companyId = ? and groupId = ? and libraryId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching circ trans history, or <code>null</code> if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory fetchByCompanyGroupLibrary_First(
long companyId, long groupId, long libraryId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the last circ trans history in the ordered set where companyId = ? and groupId = ? and libraryId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory findByCompanyGroupLibrary_Last(
long companyId, long groupId, long libraryId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the last circ trans history in the ordered set where companyId = ? and groupId = ? and libraryId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching circ trans history, or <code>null</code> if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory fetchByCompanyGroupLibrary_Last(
long companyId, long groupId, long libraryId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the circ trans histories before and after the current circ trans history in the ordered set where companyId = ? and groupId = ? and libraryId = ?.
*
* @param transId the primary key of the current circ trans history
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a circ trans history with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory[] findByCompanyGroupLibrary_PrevAndNext(
long transId, long companyId, long groupId, long libraryId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Removes all the circ trans histories where companyId = ? and groupId = ? and libraryId = ? from the database.
*
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @throws SystemException if a system exception occurred
*/
public void removeByCompanyGroupLibrary(long companyId, long groupId,
long libraryId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the number of circ trans histories where companyId = ? and groupId = ? and libraryId = ?.
*
* @param companyId the company ID
* @param groupId the group ID
* @param libraryId the library ID
* @return the number of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public int countByCompanyGroupLibrary(long companyId, long groupId,
long libraryId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns all the circ trans histories where companyId = ? and patronId = ?.
*
* @param companyId the company ID
* @param patronId the patron ID
* @return the matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByPatron(
long companyId, long patronId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns a range of all the circ trans histories where companyId = ? and patronId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param companyId the company ID
* @param patronId the patron ID
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @return the range of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByPatron(
long companyId, long patronId, int start, int end)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns an ordered range of all the circ trans histories where companyId = ? and patronId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param companyId the company ID
* @param patronId the patron ID
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByPatron(
long companyId, long patronId, int start, int end,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the first circ trans history in the ordered set where companyId = ? and patronId = ?.
*
* @param companyId the company ID
* @param patronId the patron ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory findByPatron_First(
long companyId, long patronId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the first circ trans history in the ordered set where companyId = ? and patronId = ?.
*
* @param companyId the company ID
* @param patronId the patron ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching circ trans history, or <code>null</code> if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory fetchByPatron_First(
long companyId, long patronId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the last circ trans history in the ordered set where companyId = ? and patronId = ?.
*
* @param companyId the company ID
* @param patronId the patron ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory findByPatron_Last(
long companyId, long patronId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the last circ trans history in the ordered set where companyId = ? and patronId = ?.
*
* @param companyId the company ID
* @param patronId the patron ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching circ trans history, or <code>null</code> if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory fetchByPatron_Last(
long companyId, long patronId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the circ trans histories before and after the current circ trans history in the ordered set where companyId = ? and patronId = ?.
*
* @param transId the primary key of the current circ trans history
* @param companyId the company ID
* @param patronId the patron ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a circ trans history with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory[] findByPatron_PrevAndNext(
long transId, long companyId, long patronId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Removes all the circ trans histories where companyId = ? and patronId = ? from the database.
*
* @param companyId the company ID
* @param patronId the patron ID
* @throws SystemException if a system exception occurred
*/
public void removeByPatron(long companyId, long patronId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the number of circ trans histories where companyId = ? and patronId = ?.
*
* @param companyId the company ID
* @param patronId the patron ID
* @return the number of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public int countByPatron(long companyId, long patronId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns all the circ trans histories where companyId = ? and catalogItemId = ?.
*
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @return the matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByCatalogItem(
long companyId, long catalogItemId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns a range of all the circ trans histories where companyId = ? and catalogItemId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @return the range of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByCatalogItem(
long companyId, long catalogItemId, int start, int end)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns an ordered range of all the circ trans histories where companyId = ? and catalogItemId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findByCatalogItem(
long companyId, long catalogItemId, int start, int end,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the first circ trans history in the ordered set where companyId = ? and catalogItemId = ?.
*
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory findByCatalogItem_First(
long companyId, long catalogItemId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the first circ trans history in the ordered set where companyId = ? and catalogItemId = ?.
*
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching circ trans history, or <code>null</code> if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory fetchByCatalogItem_First(
long companyId, long catalogItemId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the last circ trans history in the ordered set where companyId = ? and catalogItemId = ?.
*
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory findByCatalogItem_Last(
long companyId, long catalogItemId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the last circ trans history in the ordered set where companyId = ? and catalogItemId = ?.
*
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching circ trans history, or <code>null</code> if a matching circ trans history could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory fetchByCatalogItem_Last(
long companyId, long catalogItemId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the circ trans histories before and after the current circ trans history in the ordered set where companyId = ? and catalogItemId = ?.
*
* @param transId the primary key of the current circ trans history
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a circ trans history with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory[] findByCatalogItem_PrevAndNext(
long transId, long companyId, long catalogItemId,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Removes all the circ trans histories where companyId = ? and catalogItemId = ? from the database.
*
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @throws SystemException if a system exception occurred
*/
public void removeByCatalogItem(long companyId, long catalogItemId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the number of circ trans histories where companyId = ? and catalogItemId = ?.
*
* @param companyId the company ID
* @param catalogItemId the catalog item ID
* @return the number of matching circ trans histories
* @throws SystemException if a system exception occurred
*/
public int countByCatalogItem(long companyId, long catalogItemId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Caches the circ trans history in the entity cache if it is enabled.
*
* @param circTransHistory the circ trans history
*/
public void cacheResult(
com.kencana.lms.model.CircTransHistory circTransHistory);
/**
* Caches the circ trans histories in the entity cache if it is enabled.
*
* @param circTransHistories the circ trans histories
*/
public void cacheResult(
java.util.List<com.kencana.lms.model.CircTransHistory> circTransHistories);
/**
* Creates a new circ trans history with the primary key. Does not add the circ trans history to the database.
*
* @param transId the primary key for the new circ trans history
* @return the new circ trans history
*/
public com.kencana.lms.model.CircTransHistory create(long transId);
/**
* Removes the circ trans history with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param transId the primary key of the circ trans history
* @return the circ trans history that was removed
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a circ trans history with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory remove(long transId)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
public com.kencana.lms.model.CircTransHistory updateImpl(
com.kencana.lms.model.CircTransHistory circTransHistory)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the circ trans history with the primary key or throws a {@link com.kencana.lms.NoSuchCircTransHistoryException} if it could not be found.
*
* @param transId the primary key of the circ trans history
* @return the circ trans history
* @throws com.kencana.lms.NoSuchCircTransHistoryException if a circ trans history with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory findByPrimaryKey(long transId)
throws com.kencana.lms.NoSuchCircTransHistoryException,
com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the circ trans history with the primary key or returns <code>null</code> if it could not be found.
*
* @param transId the primary key of the circ trans history
* @return the circ trans history, or <code>null</code> if a circ trans history with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public com.kencana.lms.model.CircTransHistory fetchByPrimaryKey(
long transId)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns all the circ trans histories.
*
* @return the circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findAll()
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns a range of all the circ trans histories.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @return the range of circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findAll(
int start, int end)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns an ordered range of all the circ trans histories.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.kencana.lms.model.impl.CircTransHistoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param start the lower bound of the range of circ trans histories
* @param end the upper bound of the range of circ trans histories (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of circ trans histories
* @throws SystemException if a system exception occurred
*/
public java.util.List<com.kencana.lms.model.CircTransHistory> findAll(
int start, int end,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Removes all the circ trans histories from the database.
*
* @throws SystemException if a system exception occurred
*/
public void removeAll()
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the number of circ trans histories.
*
* @return the number of circ trans histories
* @throws SystemException if a system exception occurred
*/
public int countAll()
throws com.liferay.portal.kernel.exception.SystemException;
} | [
"[email protected]"
] | |
f828195ba9f1d42457424ccf8201c5d9b404d775 | 1197945d1eab9c698625d93b3f55f58843554b48 | /app/src/main/java/com/luteapp/todoagenda/widget/RecurringIndicatorScaled.java | 4ba84f3f22de8e1b14c9afe27270325f1bdc7bff | [
"Apache-2.0"
] | permissive | anfreelancer/todoagenda | e010a79dea52de6a7feacc5e6bc733cb811168b4 | 6b2c3315bd6b3b8690c767ed4c5282fba93a0ddb | refs/heads/main | 2023-08-10T20:25:00.249952 | 2021-09-17T04:57:40 | 2021-09-17T04:57:40 | 407,409,975 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | package com.luteapp.todoagenda.widget;
import androidx.annotation.LayoutRes;
import com.luteapp.todoagenda.R;
/**
* @author [email protected]
*/
public enum RecurringIndicatorScaled {
VERY_SMALL(R.id.event_entry_indicator_recurring_very_small),
SMALL(R.id.event_entry_indicator_recurring_small),
MEDIUM(R.id.event_entry_indicator_recurring);
@LayoutRes
public final int indicatorResId;
RecurringIndicatorScaled(int indicatorResId) {
this.indicatorResId = indicatorResId;
}
}
| [
"[email protected]"
] | |
d6ba0a43025cb09b50c81148543713184d77ab8a | a85c9b702f00aa3e3461a9f62666873895ea4e1a | /src/com/oop/lab6/Technical_Staff.java | 6e2831f200520ac4d1e30e58db7e72e31ff0025c | [] | no_license | DanielaMazur/oop | c158c1a7bd6309c3de1c40fc60833471fee6c9e8 | 3cc3df127c543b42622d1d6f13a82fae3b489120 | refs/heads/master | 2023-01-27T22:26:31.313237 | 2020-12-11T19:20:29 | 2020-12-11T19:20:29 | 296,544,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 73 | java | package com.oop.lab6;
public class Technical_Staff extends Staff{
}
| [
"[email protected]"
] | |
6fff5654a9f3a664b9aa113666bbd2e7d00ca61e | 2f4a21bb3e04bb0e2bfe7b60e1345f8ebbd99eca | /src/main/java/com/bluedream/pdf/exception/ImageArgsException.java | a3e67abeec62cd6027b998bc030b5c13d96e73c1 | [] | no_license | draem0507/pdf-export | ea14f234104a1de4729cf8881d3785aa36a2ce2e | 613860a3eaf1acfcd650b5fab0e20025ddb284c9 | refs/heads/master | 2020-09-07T00:03:29.818468 | 2020-01-04T13:18:07 | 2020-01-04T13:18:07 | 220,596,629 | 0 | 0 | null | 2019-11-09T05:35:19 | 2019-11-09T05:35:19 | null | UTF-8 | Java | false | false | 281 | java | package com.bluedream.pdf.exception;
/**
* @author: 刘文鑫(liuwenxin03)
* @date: 2019-11-09 17:19
* @desc: 图片参数异常类
*/
public class ImageArgsException extends ImageException {
public ImageArgsException(String message) {
super(message);
}
}
| [
"[email protected]"
] | |
43bcdeefbd62a7a25d192383cd4a716f60e227ce | cf13a405b49f97e9164581b9ba3a370164557030 | /core/src/main/java/io/ceph/rgw/client/model/admin/SetBucketQuotaRequest.java | ea7b44bb82a26dc4568cbed47d4c1ec2d5b47b83 | [
"Apache-2.0"
] | permissive | sosozhuang/rgw-client | 7a1bd9017cd903b940658524cb96159a92a0e7ae | a4da40ba8463fb398d8e54b0df5fe4343d3f74e6 | refs/heads/master | 2023-01-13T07:04:46.896549 | 2020-11-11T11:29:04 | 2020-11-11T11:29:04 | 291,294,172 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,962 | java | package io.ceph.rgw.client.model.admin;
import io.ceph.rgw.client.AdminClient;
import io.ceph.rgw.client.action.ActionFuture;
import io.ceph.rgw.client.action.ActionListener;
import org.apache.commons.lang3.Validate;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.Function;
/**
* Created by zhuangshuo on 2020/7/28.
*/
public class SetBucketQuotaRequest extends AdminRequest {
private static final SdkField<String> UID_FIELD = SdkField
.builder(MarshallingType.STRING)
.getter(getter(SetBucketQuotaRequest::getUid))
.setter(setter(Builder::withUid))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("uid")
.unmarshallLocationName("uid").build()).build();
private static final SdkField<Quota> QUOTA_FIELD = SdkField
.<Quota>builder(MarshallingType.SDK_POJO)
.getter(getter(SetBucketQuotaRequest::getQuota))
.setter(setter(Builder::withQuota))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("bucket_quota")
.unmarshallLocationName("bucket_quota").build()).build();
private static final List<SdkField<?>> SDK_FIELDS = Collections.unmodifiableList(Collections.singletonList(UID_FIELD));
private final String uid;
private final Quota quota;
public SetBucketQuotaRequest(Builder builder) {
super(builder);
this.uid = Validate.notBlank(builder.uid, "uid cannot be empty string");
this.quota = Objects.requireNonNull(builder.quota);
}
private static <T> Function<Object, T> getter(Function<SetBucketQuotaRequest, T> g) {
return obj -> g.apply((SetBucketQuotaRequest) obj);
}
private static <T> BiConsumer<Object, T> setter(BiConsumer<Builder, T> s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public String getUid() {
return uid;
}
public Quota getQuota() {
return quota;
}
@Override
public Builder toBuilder() {
return new Builder(this);
}
@Override
public List<SdkField<?>> sdkFields() {
return SDK_FIELDS;
}
@Override
public String toString() {
return "SetBucketQuotaRequest{" +
"uid='" + uid + '\'' +
"quota='" + quota + '\'' +
"} " + super.toString();
}
public static class Builder extends AdminRequestBuilder<Builder, SetBucketQuotaRequest, SetBucketQuotaResponse> {
private String uid;
private Quota quota;
public Builder(AdminClient client) {
super(client);
this.quota = new Quota();
}
private Builder(SetBucketQuotaRequest request) {
this.quota = new Quota();
withUid(request.uid);
withEnabled(request.quota.isEnabled());
withCheckOnRaw(request.quota.isCheckOnRaw());
withMaxSize(request.quota.getMaxSize());
withMaxSizeKb(request.quota.getMaxSizeKb());
withMaxObjects(request.quota.getMaxObjects());
}
public Builder withUid(String uid) {
this.uid = uid;
return self();
}
private Builder withQuota(Quota quota) {
this.quota = quota;
return self();
}
public Builder withEnabled(Boolean enabled) {
this.quota.setEnabled(enabled);
return self();
}
public Builder withCheckOnRaw(Boolean checkOnRaw) {
this.quota.setCheckOnRaw(checkOnRaw);
return self();
}
public Builder withMaxSize(Integer maxSize) {
this.quota.setMaxSize(maxSize);
return self();
}
public Builder withMaxSizeKb(Integer maxSizeKb) {
this.quota.setMaxSizeKb(maxSizeKb);
return self();
}
public Builder withMaxObjects(Integer maxObjects) {
this.quota.setMaxObjects(maxObjects);
return self();
}
@Override
public SetBucketQuotaRequest build() {
return new SetBucketQuotaRequest(this);
}
@Override
public SetBucketQuotaResponse run() {
return client.setBucketQuota(build());
}
@Override
public ActionFuture<SetBucketQuotaResponse> execute() {
return client.setBucketQuotaAsync(build());
}
@Override
public void execute(ActionListener<SetBucketQuotaResponse> listener) {
client.setBucketQuotaAsync(build(), listener);
}
}
}
| [
"[email protected]"
] | |
0ed9ec247b28d1f3087fa53a50691cd3b56ced3a | c4aef1f58f484d34176db468c1ac918014a8ef21 | /ConferenceBasic_NCCPS/src/com/android/incongress/cd/conference/receiver/JPushReceiver.java | 77331f7030088cdaadac07c35fea29f1fe7f13f6 | [] | no_license | Jacky-Chen-Pro/CIT | 783d928909707b9a91f0118f19ec20559461bb62 | cf681387ecb6c685b04273a0cf3e7f6d5aa00967 | refs/heads/master | 2016-08-12T20:37:39.413433 | 2016-03-23T09:18:53 | 2016-03-23T09:18:53 | 54,545,483 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,472 | java | package com.android.incongress.cd.conference.receiver;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.WindowManager;
import com.android.incongress.cd.conference.HomeActivity;
import com.android.incongress.cd.conference.SplashActivity;
import com.android.incongress.cd.conference.WebViewContainerActivity;
import com.android.incongress.cd.conference.base.AppApplication;
import com.android.incongress.cd.conference.base.BaseActivity;
import com.android.incongress.cd.conference.base.Constants;
import com.android.incongress.cd.conference.fragments.meeting_schedule.SessionDetailPageFragment;
import com.android.incongress.cd.conference.services.AdService;
import com.android.incongress.cd.conference.utils.ExampleUtil;
import com.android.incongress.cd.conference.utils.MyLogger;
import com.android.incongress.cd.conference.utils.StringUtils;
import com.mobile.incongress.cd.conference.basic.csccm.R;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.data.JPushLocalNotification;
/**
* 自定义接收器
*
* 如果不定义这个 Receiver,则:
* 1) 默认用户会打开主界面
* 2) 接收不到自定义消息
*/
public class JPushReceiver extends BroadcastReceiver {
private static final String TAG = "JPush";
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
Log.d(TAG, "[JPushReceiver] 接收Registration Id : " + regId);
} else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
if(HomeActivity.isForeground) {
processCustomMessage(context, bundle);
}else {
String urlJson = bundle.getString(JPushInterface.EXTRA_EXTRA);
//String title = bundle.getString(JPushInterface.EXTRA_TITLE);
String content = bundle.getString(JPushInterface.EXTRA_MESSAGE);
JSONObject url = null;
try {
url = new JSONObject(urlJson);
if(!StringUtils.isEmpty(urlJson)) {
JPushLocalNotification ln = new JPushLocalNotification();
ln.setContent(content);
//需要标题,简介,dataId,
long notificationid = System.currentTimeMillis();
ln.setNotificationId(notificationid);
ln.setBuilderId(2);
String trueUrlJson = url.getString("key").replace("\\\\","");
String finalUrl = "";
try{
JSONObject obj = new JSONObject(trueUrlJson);
finalUrl = obj.getString("url");
}catch (Exception e) {
e.printStackTrace();
}
Map<String , Object> map = new HashMap<String, Object>() ;
map.put("finalUrl", finalUrl) ;
map.put("title", content);
map.put("notificationId", notificationid);
JSONObject json = new JSONObject(map) ;
ln.setExtras(json.toString()) ;
JPushInterface.addLocalNotification(AppApplication.getContext(), ln);
}else {
}
} catch (JSONException e) {
e.printStackTrace();
}
}
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 接收到推送下来的通知");
int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
Log.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
//打开自定义的Activity
//这里可以根据具体的消息打开需要的Activity
String info = bundle.getString(JPushInterface.EXTRA_EXTRA).replace("\\","");
MyLogger.jLog().i("info===" + info);
String url = "";
String title = "";
long notificationId;
try{
JSONObject obj = new JSONObject(info);
url = obj.getString("finalUrl");
title = obj.getString("title");
notificationId = obj.getLong("notificationId");
bundle.putString("url", url);
bundle.putString("title", title);
bundle.putLong("notificationId", notificationId);
Intent i = new Intent(context, HomeActivity.class);
i.putExtras(bundle);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(i);
}catch (Exception e){
e.printStackTrace();
}
} else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
} else if(JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
Log.w(TAG, "[MyReceiver]" + intent.getAction() +" connected state change to "+connected);
} else {
Log.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
}
}
// 打印所有的 intent extra 数据
private static String printBundle(Bundle bundle) {
StringBuilder sb = new StringBuilder();
for (String key : bundle.keySet()) {
if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
}else if(key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)){
sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
}
else {
sb.append("\nkey:" + key + ", value:" + bundle.getString(key));
}
}
return sb.toString();
}
//send msg to HomeActivity
private void processCustomMessage(Context context, Bundle bundle) {
if (HomeActivity.isForeground) {
String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
Intent msgIntent = new Intent(HomeActivity.MESSAGE_RECEIVED_ACTION);
msgIntent.putExtra(HomeActivity.KEY_MESSAGE, message);
if (!ExampleUtil.isEmpty(extras)) {
try {
JSONObject extraJson = new JSONObject(extras);
if (null != extraJson && extraJson.length() > 0) {
msgIntent.putExtra(HomeActivity.KEY_EXTRAS, extras);
}
} catch (JSONException e) {
}
}
context.sendBroadcast(msgIntent);
}
}
}
| [
"[email protected]"
] | |
ccde5b6105799cf9eef06083b2949694e08d2726 | 9a6ea6087367965359d644665b8d244982d1b8b6 | /src/main/java/androidx/room/IMultiInstanceInvalidationCallback.java | 94ca436b62b9528e3a5fd8355dea80db322abffa | [] | no_license | technocode/com.wa_2.21.2 | a3dd842758ff54f207f1640531374d3da132b1d2 | 3c4b6f3c7bdef7c1523c06d5bd9a90b83acc80f9 | refs/heads/master | 2023-02-12T11:20:28.666116 | 2021-01-14T10:22:21 | 2021-01-14T10:22:21 | 329,578,591 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package androidx.room;
import android.os.IInterface;
public interface IMultiInstanceInvalidationCallback extends IInterface {
void AGp(String[] strArr);
}
| [
"[email protected]"
] | |
6cb2921dbad7c04bfa69eab27fb5dea448570bf4 | abf3fd4741bc73a79dbe3b4047f1d40cb5a4e989 | /src/全排列/Solution.java | cf05dd5fdc1ae6fb1811377a5ff344d37eab97b4 | [] | no_license | IBM2017/Algorithm | 759892d70f5751a25e4d68674d52abe239c1be30 | 5a6e7b55d0650a3326742e24908a8f1a26d4f56f | refs/heads/master | 2023-06-16T14:36:20.946531 | 2021-07-06T14:11:53 | 2021-07-06T14:11:53 | 349,729,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,249 | java | package 全排列;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
class Solution {
public void backtrack(int n,
ArrayList<Integer> nums,
List<List<Integer>> output,
int first) {
// if all integers are used up
if (first == n)
output.add(new ArrayList<Integer>(nums));
for (int i = first; i < n; i++) {
// place i-th integer first
// in the current permutation
Collections.swap(nums, first, i);
// use next integers to complete the permutations
backtrack(n, nums, output, first + 1);
// backtrack
Collections.swap(nums, first, i);
}
}
public List<List<Integer>> permute(int[] nums) {
// init output list
List<List<Integer>> output = new LinkedList();
// convert nums into list since the output is a list of lists
ArrayList<Integer> nums_lst = new ArrayList<Integer>();
for (int num : nums)
nums_lst.add(num);
int n = nums.length;
backtrack(n, nums_lst, output, 0);
return output;
}
}
| [
"[email protected]"
] | |
1f4e74eabcd707dbc601904c543984fa6ead6eed | 87b1991350a839fb650511a61f449bf5af4bb5a4 | /app/src/test/java/app/ubk/mychat/ExampleUnitTest.java | 6d3efc712820e6ce9dfe32631b0c814fcb48efa6 | [] | no_license | joenathan92/myChat | f6b75c357b5e0f28af612d32efee487be077e9c4 | fa7476345f5753f2f40c80e7fa3e31dd732cf309 | refs/heads/master | 2021-05-14T03:45:19.607604 | 2018-01-08T08:25:35 | 2018-01-08T08:25:35 | 116,622,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package app.ubk.mychat;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals( 4, 2 + 2 );
}
} | [
"[email protected]"
] | |
4b63851dd1d738ee7052643fe2f153b94828c0b9 | 08f51f152619a2bea5493c699dcb9e2087d53837 | /src/test/java/com/thoughtworks/cruise/artifacts/ArtifactRepository.java | 8db083319aa5ca84a6536bd84c15965af98c6743 | [] | no_license | hw-gocd/gocd-functional-tests | 84afa9e144df44da94ebdd03994ed7823881b306 | a2088fdce9a3779ddc592bb471c9cf36580f60b3 | refs/heads/master | 2020-04-10T06:47:12.322369 | 2015-09-14T15:15:32 | 2015-09-14T15:15:32 | 42,503,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,146 | java | package com.thoughtworks.cruise.artifacts;
// JUnit Assert framework can be used for verification
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import net.sf.sahi.client.Browser;
import org.apache.commons.collections.map.SingletonMap;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import com.thoughtworks.cruise.RuntimePath;
import com.thoughtworks.cruise.context.Configuration;
import com.thoughtworks.cruise.preconditions.NewStreamPumper;
import com.thoughtworks.cruise.state.ArtifactFilesystem;
import com.thoughtworks.cruise.utils.Assertions;
import com.thoughtworks.cruise.utils.Assertions.Predicate;
import com.thoughtworks.cruise.utils.Timeout;
import com.thoughtworks.twist.core.utils.OsUtils;
public class ArtifactRepository {
private final ArtifactFilesystem artifactFilesystem;
private final Configuration configuration;
public ArtifactRepository(Browser browser, ArtifactFilesystem artifactFilesystem, Configuration configuration) {
this.artifactFilesystem = artifactFilesystem;
this.configuration = configuration;
}
public static void fileWithSize(int sizeOfArtifactInMB, File artifact) throws FileNotFoundException, IOException {
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(artifact));
byte[] block = block();
for (int i = 0; i < sizeOfArtifactInMB * 1024 / 4; i++) {
out.write(block);
out.flush();
}
out.close();
}
private static byte[] block() {
byte [] bytes = new byte[4 * 1024];
for (int i=0; i < 4 * 1024; i++) bytes[i] = 0;
return bytes;
}
@SuppressWarnings("unchecked")
public void pointTheArtifactRepositoryToAPartitionOfSizeMB(int sizeInMB) throws Exception {
if (OsUtils.isLinux()) {
File file = artifactFilesystem.fileSystem.getAbsoluteFile();
fileWithSize(sizeInMB, file);
run(new ByteArrayInputStream("y".getBytes()), "mkfs.ext3", file.getAbsolutePath(), "-m", "0");
run(new SingletonMap("SUDO_ASKPASS", new File(RuntimePath.pathFor("../manual-testing/twist/echo_password.sh")).getAbsolutePath()), new ByteArrayInputStream("".getBytes()),
"sudo", "-A", "/bin/mount", "-t", "ext3", "-o", "loop", file.getAbsolutePath(), RuntimePath.getArtifactPath(configuration.provideDom().getArtifactsDir()));
} else {
throw new UnsupportedOperationException("Not supported on non GNU/Linux environments yet");
}
}
public static void run(InputStream processInput, String...commandAndArgs) throws IOException, InterruptedException {
run(new HashMap<String, String>(), processInput, commandAndArgs);
}
public static void run(Map<String, String> envVars, InputStream processInput, String...commandAndArgs) throws IOException, InterruptedException {
ProcessBuilder processBuilder = new ProcessBuilder(commandAndArgs);
for(Entry<String, String> envVar : envVars.entrySet()) {
processBuilder.environment().put(envVar.getKey(), envVar.getValue());
}
processBuilder.redirectErrorStream(true);
Process process = processBuilder.start();
NewStreamPumper.pump(process.getInputStream(), "out", System.out);
OutputStream outputStream = process.getOutputStream();
IOUtils.copy(processInput, outputStream);
outputStream.close();
int returnCode = process.waitFor();
assertThat(String.format("Failed executing commad: %s", StringUtils.join(commandAndArgs, " ")), returnCode, is(0));
}
public static void run(String... commandAndArgs) throws IOException, InterruptedException {
run(new ByteArrayInputStream("".getBytes()), commandAndArgs);
}
public void waitTillTheFreeSpaceIsMoreThanMB(final int freeSpaceInMB) throws Exception {
Assertions.waitUntil(Timeout.THREE_MINUTES, new Predicate() {
@Override
public boolean call() throws Exception {
return artifactRepoFreeSpace() > (freeSpaceInMB * 1024 * 1024L);
}
public long artifactRepoFreeSpace() {
return new File(RuntimePath.getArtifactPath(configuration.provideDom().getArtifactsDir())).getFreeSpace();
}
public double artifactRepoFreeSpaceInMB() {
return artifactRepoFreeSpace() / 1024 / 1024;
}
public String toString() {
return String.format("Expected the free space on the artifact repo to increase beyond '%s' MB. Actually, it was: %s", freeSpaceInMB, artifactRepoFreeSpaceInMB());
};
});
}
}
| [
"[email protected]"
] | |
845c0c501377126e727e1b68157bc44a4c3c0282 | fe51b89ed8e0b0d62c8b8450afdf62a63dc6aa2e | /pw04-web/src/main/java/yncrea/pw04/web/controller/StudentController.java | d42488e8c356181a8abb355fe69378694352434d | [] | no_license | SebastienGeorge/yncrea_2018_pw04 | f7f0276214e7c0400462a8182c3cdae8d839df15 | 4fa0d0166e589019d2dfc72dbb236202bedf9afa | refs/heads/master | 2021-03-30T02:35:15.558277 | 2018-02-06T10:52:49 | 2018-02-06T10:52:49 | 120,424,103 | 0 | 0 | null | 2018-02-06T08:26:18 | 2018-02-06T08:26:17 | null | UTF-8 | Java | false | false | 1,444 | java | package yncrea.pw04.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import yncrea.pw04.entity.Student;
import yncrea.pw04.service.StudentService;
import javax.inject.Inject;
import java.util.List;
@Controller
public class StudentController {
@Inject
private StudentService studentService;
public List<Student> studentsList;
public Long id;
@RequestMapping("/list")
public String getListOfStudents(ModelMap modelMap){
studentsList=studentService.findAllWithCourses();
modelMap.put("students",studentsList);
return "studentsList";
}
@RequestMapping("/form")
public String getForm(ModelMap modelMap2){
Student student=new Student();
modelMap2.put("student",student);
return "studentForm";
}
@RequestMapping(value="/form",method = RequestMethod.POST)
public String submitForm(@ModelAttribute("student") Student student){
studentService.saveStudent(student);
return "redirect:list";
}
@RequestMapping(value="/delete" ,method = RequestMethod.POST)
public String delete(Student student){
studentService.deleteStudent(student);
return "redirect:list";
}
}
| [
"[email protected]"
] | |
20c622dd7a5f5fb30c1b178ed311a72dc1f22858 | e62c95371c466cc7f03a15868c003d2d87f62fc6 | /src/com/universitymangementsystem/AboutUs.java | f87372af67ab93893c320a76ce7370ac373e44bf | [] | no_license | patra72/universitymanagementsystem | 527b42cd8531e60aa78967c27aff906e4906092c | 1a3e6d0585bd7b7b1f74bdcad974794ef9ba3b89 | refs/heads/master | 2023-06-24T12:04:23.354116 | 2021-07-31T06:21:18 | 2021-07-31T06:21:18 | 391,271,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,513 | java | package com.universitymangementsystem;
import java.awt.*;
import javax.swing.*;
public class AboutUs extends JFrame{
private JPanel contentPane;
public static void main(String[] args) {
new AboutUs().setVisible(true);
}
public AboutUs() {
super("About Us - KG University");
setBackground(new Color(173, 216, 230));
setBounds(500, 250, 700, 500);
contentPane = new JPanel();
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel l1 = new JLabel("New label");
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("com/universitymangementsystem/icons/logo.jpg"));
Image i2 = i1.getImage().getScaledInstance(130, 100,Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
l1 = new JLabel(i3);
l1.setBounds(400, 40, 250, 100);
contentPane.add(l1);
JLabel l3 = new JLabel("University");
l3.setForeground(new Color(0, 250, 154));
l3.setFont(new Font("Trebuchet MS", Font.BOLD | Font.ITALIC, 34));
l3.setBounds(140, 40, 200, 55);
contentPane.add(l3);
JLabel l4 = new JLabel("Mangement System");
l4.setForeground(new Color(127, 255, 0));
l4.setFont(new Font("Trebuchet MS", Font.BOLD | Font.ITALIC, 34));
l4.setBounds(70, 90, 405, 40);
contentPane.add(l4);
JLabel l6 = new JLabel("Developed By : sachin kumar patra");
l6.setFont(new Font("Trebuchet MS", Font.BOLD, 30));
l6.setBounds(70, 198, 600, 35);
contentPane.add(l6);
JLabel l7 = new JLabel("Contact Number: +917606936900");
l7.setFont(new Font("Trebuchet MS", Font.BOLD, 20));
l7.setBounds(70, 260, 600, 34);
contentPane.add(l7);
JLabel l8 = new JLabel("Contact : [email protected]");
l8.setFont(new Font("Trebuchet MS", Font.BOLD, 20));
l8.setBounds(70, 290, 600, 34);
contentPane.add(l8);
JLabel l9 = new JLabel("Education - B.Tech (Computer Science)");
l9.setFont(new Font("Trebuchet MS", Font.BOLD , 20));
l9.setBounds(70, 320, 600, 34);
contentPane.add(l9);
JLabel l10 = new JLabel("Phone - +91 7606836900");
l10.setForeground(new Color(47, 79, 79));
l10.setFont(new Font("Trebuchet MS", Font.BOLD | Font.ITALIC, 18));
l10.setBounds(70, 400, 600, 34);
contentPane.add(l10);
contentPane.setBackground(Color.WHITE);
}
}
| [
"[email protected]"
] | |
34a0cebdfbae38bb367837ccd75b8f51a1af4b41 | 19c237ac919bfacae87ec6ca6759ae9dca6bb9c6 | /MeanNormalization.java | 90d911d68a4d649aa96ad2b1e2b4ea560a91523b | [] | no_license | MoncefYabi/timeseries-signal-processing | c36262c783078797491597a3cb05ac5702fb47ba | 1d28dca1cf1c0f2575eabc901130182dd16ec140 | refs/heads/master | 2022-01-25T03:16:26.825997 | 2015-04-14T23:31:27 | 2015-04-14T23:31:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java |
/**
* This class is responsible for removing mean value from the
* acceleration time series. It is used in all of our gait papers.
* It tested and working absolutly fine.
* @version 1.0
* @author Muhammad Muaaz
*
*/
public class MeanNormalization {
public static double[] zeroMeanNormalization(double [] x) throws IllegalArgumentException
{
if ( x.length <=1 ){
throw new IllegalArgumentException("X must have more than one value");
}
// find the mean value of Array.
double mean = ArrayManupulation.mean(x);
double [] y = new double [x.length];
for (int i = 0 ; i < x.length ; i++){
y[i] = x[i] - mean;
}
return y;
}
}
| [
"[email protected]"
] | |
44bfda5943edf63a499a0813245f0edd8aa0f255 | 6a322a03853f5f49fbd30f22e1ccd186999d190f | /aula079ex01/src/application/Program.java | 7f5a2d1deedc4fd61c8973d31edb1636e1a043ba | [] | no_license | kaiopomini/Java | f985fd9dae22c85d3cb394df4653a71699a76093 | d60c2ee7139476ef0007d6ec72b00a17c1fedf43 | refs/heads/master | 2020-06-01T06:05:58.956537 | 2019-07-24T02:11:44 | 2019-07-24T02:11:44 | 190,671,314 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,328 | java | package application;
import java.util.Locale;
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
System.out.print("Lines: ");
int m = sc.nextInt();
System.out.print("columns: ");
int n = sc.nextInt();
System.out.println();
int[][] mat = new int[m][n];
for (int i=0; i<mat.length; i++) {
for (int j=0; j<mat[i].length; j++) {
System.out.printf("set position %d, %d: ", i, j);
mat[i][j] = sc.nextInt();
}
}
for (int i=0; i<mat.length; i++) {
System.out.println();
for (int j=0; j<mat[i].length; j++) {
System.out.printf(" [%d] ", mat[i][j]);
}
}
System.out.println();
System.out.print("Find: ");
int x = sc.nextInt();
for (int i=0; i<mat.length; i++) {
for (int j=0; j<mat[i].length; j++) {
if (mat[i][j] == x) {
System.out.println("Position " + i + "," + j + ":");
if (j > 0) {
System.out.println("Left: " + mat[i][j-1]);
}
if (i > 0) {
System.out.println("Up: " + mat[i-1][j]);
}
if (j < mat[i].length-1) {
System.out.println("Right: " + mat[i][j+1]);
}
if (i < mat.length-1) {
System.out.println("Down: " + mat[i+1][j]);
}
}
}
}
sc.close();
}
}
| [
"[email protected]"
] | |
b5e84d63f1f7021a93bb563c269d9794a7737430 | a40ac37ee0803aa96afe8708e2bbe185c436a515 | /120/Labs/L05_1 - Bank Account Exceptions/InsufficientFundsException.java | e5044e9cf1341d909c8bab982c51208524223698 | [] | no_license | life8899/Computer_Science | f0c224ea8a0bd6148c9592616201d64b94a74309 | a88960b8f31bf982c0d47566120aeb35f49d48eb | refs/heads/master | 2021-01-19T13:44:00.786884 | 2015-10-27T02:17:41 | 2015-10-27T02:17:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 350 | java |
/**
* Declares a New Exception Type Relating to Insufficient Funds in a Bank Account
*
* @author Nick Alexander
* @version 9/30/13
*/
public class InsufficientFundsException extends RuntimeException
{
public InsufficientFundsException()
{}
public InsufficientFundsException(String msg)
{
super(msg);
}
}
| [
"[email protected]"
] | |
78a43194777ab14d3d5c3ed23d4186cbe981088d | 121a1c413e4db6230a1cbdf03704914a31451a5a | /app/src/androidTest/java/com/example/tishna/ExampleInstrumentedTest.java | fd748ad1706884630eb44a3a9e75a907b6d774e5 | [] | no_license | kumarajay0412/TRSHNA-APP | 353437e15839d8bd7ef39ffcc00551c14a380515 | c1c628f2ff9c6f2aa73d355630ff34c46ed2aabd | refs/heads/master | 2022-11-29T04:39:43.268480 | 2020-07-24T12:44:16 | 2020-07-24T12:44:16 | 282,216,456 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package com.example.tishna;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.tishna", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
f22adb45e212cc985e8107fe2d11c79848c3c85f | 9e2ec95d8c619191c46f34a82a4e962d3a7dc67e | /app/src/main/java/com/trung/karaokeapp/libffmpeg/CpuArchHelper.java | 4b08161440afa9beb0f78aec5fbb2f3d769971aa | [] | no_license | zhenjun85/AndroidKaraokeApp | 8e56d21d765edcd050c823d106310fed25243c27 | 8bdd841cc55b80c9389e8a52a9d321e45d4ca1c2 | refs/heads/master | 2020-05-17T22:51:25.520592 | 2018-01-07T19:22:46 | 2018-01-07T19:22:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,366 | java | package com.trung.karaokeapp.libffmpeg;
import android.os.Build;
class CpuArchHelper {
static CpuArch getCpuArch() {
Log.d("Build.CPU_ABI : " + Build.CPU_ABI);
// check if device is x86 or x86_64
if (Build.CPU_ABI.equals(getx86CpuAbi()) || Build.CPU_ABI.equals(getx86_64CpuAbi())) {
return CpuArch.x86;
} else {
// check if device is armeabi
if (Build.CPU_ABI.equals(getArmeabiv7CpuAbi())) {
ArmArchHelper cpuNativeArchHelper = new ArmArchHelper();
String archInfo = cpuNativeArchHelper.cpuArchFromJNI();
// check if device is arm v7
if (cpuNativeArchHelper.isARM_v7_CPU(archInfo)) {
// check if device is neon
return CpuArch.ARMv7;
}
// check if device is arm64 which is supported by ARMV7
} else if (Build.CPU_ABI.equals(getArm64CpuAbi())) {
return CpuArch.ARMv7;
}
}
return CpuArch.NONE;
}
static String getx86CpuAbi() {
return "x86";
}
static String getx86_64CpuAbi() {
return "x86_64";
}
static String getArm64CpuAbi() {
return "arm64-v8a";
}
static String getArmeabiv7CpuAbi() {
return "armeabi-v7a";
}
}
| [
"[email protected]"
] | |
98f74dba9d41de7ee99c4ee156bff726d2c5bab9 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_1006124.java | 8df48d6f29ccc9a4a95148482d3849fdf656f129 | [] | no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 586 | java | @Override public TextFieldTableCell<S,T> call(TableColumn<S,T> param){
return new TextFieldTableCell<S,T>(stringConverter){
@Override public void updateItem( T item, boolean empty){
super.updateItem(item,empty);
if (!empty && (getTableRow() != null)) {
Object rowItem=getTableRow().getItem();
if (rowItem != null) {
S vm=(S)rowItem;
if ((visualizer != null) && (validationStatusProperty != null)) {
visualizer.initVisualization(validationStatusProperty.apply(vm),this);
}
}
}
}
}
;
}
| [
"[email protected]"
] | |
9bbb95908595aaa64fd23cd193271ebc7f68e00d | 6621f394401abc1a3580fca6981c3825046b969c | /src/main/java/eu/scram/actionfp/web/rest/AccountResource.java | b0ccf7e2816af3277aee3cc3105438b4ebd681ab | [] | no_license | bonobothehappyape/actionfp | 1508bf532cea3c41a96c9a093b02f65a7521436e | 4a19a72c2ab91f7d5db6dfdca0e8ae7c53376f78 | refs/heads/main | 2023-05-10T12:49:23.892251 | 2021-06-23T20:41:52 | 2021-06-23T20:41:52 | 377,945,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,888 | java | package eu.scram.actionfp.web.rest;
import eu.scram.actionfp.service.UserService;
import eu.scram.actionfp.service.dto.AdminUserDTO;
import eu.scram.actionfp.service.dto.UserDTO;
import java.security.Principal;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* REST controller for managing the current user's account.
*/
@RestController
@RequestMapping("/api")
public class AccountResource {
private static class AccountResourceException extends RuntimeException {
private static final long serialVersionUID = 1L;
private AccountResourceException(String message) {
super(message);
}
}
private final Logger log = LoggerFactory.getLogger(AccountResource.class);
private final UserService userService;
public AccountResource(UserService userService) {
this.userService = userService;
}
/**
* {@code GET /account} : get the current user.
*
* @param principal the current user; resolves to {@code null} if not authenticated.
* @return the current user.
* @throws AccountResourceException {@code 500 (Internal Server Error)} if the user couldn't be returned.
*/
@GetMapping("/account")
@SuppressWarnings("unchecked")
public AdminUserDTO getAccount(Principal principal) {
if (principal instanceof AbstractAuthenticationToken) {
return userService.getUserFromAuthentication((AbstractAuthenticationToken) principal);
} else {
throw new AccountResourceException("User could not be found");
}
}
}
| [
"[email protected]"
] | |
7ef71939446ff3df99a01abe1fec842129da8598 | 239ca3236d61fabbe58fb63fa537af83d7fbf618 | /CoreJava/src/com/roy/_16generics/GenericDemo3.java | b13c18f60d1d6912e247828ab9ce7f815b69055b | [] | no_license | santyroy/Core-Java | 9ed4b30772878016cdb91208564c1cab37bb3d8b | 8b44e5a035be9b90df41579afdfe58fef483a1c4 | refs/heads/master | 2021-12-02T12:44:33.050269 | 2021-11-28T09:33:32 | 2021-11-28T09:33:32 | 195,350,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package com.roy._16generics;
public class GenericDemo3<T> {
private T t;
public T getT() {
return t;
}
public void setT(T t) {
this.t = t;
}
public static void main(String[] args) {
GenericDemo3<Integer> integerBox = new GenericDemo3<>();
GenericDemo3<String> stringBox = new GenericDemo3<>();
integerBox.setT(10);
// integerBox.setT("ten"); // compilation error
stringBox.setT("hello world");
// stringBox.setT(10); // compilation error
Integer integer = integerBox.getT();
String string = stringBox.getT();
System.out.printf("Integer value: %d\n\n", integer);
System.out.printf("String value: %s\n\n", string);
}
}
| [
"[email protected]"
] | |
db677d69517c4f63d3600ed33aeca8b211e3320c | 06f774b0237daaf7d40244e11c09b4aa3eb23e93 | /04-JDBC Y JPA/02- JPA/JPAModeloAdri/src/com/redsocial/dominio/mascota/Mascota.java | dfe621f28344200ca2d6b73a563b849d4eb5efa8 | [] | no_license | nachoscocco/Curso_Fullstack_EGG | fc46dd23c27c0c730875d86e397c71c645df0dda | 57866ad13c0d0d5934ca56212f12c0ae82414196 | refs/heads/master | 2023-08-22T22:13:30.537168 | 2021-10-14T19:09:26 | 2021-10-14T19:09:26 | 377,610,020 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package com.redsocial.dominio.mascota;
import com.redsocial.dominio.usuario.Usuario;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@Entity // Anotacion para decir que es una Entidad, es decir una tabla
public class Mascota {
@Id // Declaro que el siguiente atributo sera el ID
@GeneratedValue
private String id;
private String apodo;
private String raza;
@ManyToOne // La relacion si fue declarada onetomany en la otra, debo declararla aca
@JoinColumn(name = "duenio_id")
private Usuario duenio;
public Mascota() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getApodo() {
return apodo;
}
public void setApodo(String apodo) {
this.apodo = apodo;
}
public String getRaza() {
return raza;
}
public void setRaza(String raza) {
this.raza = raza;
}
public Usuario getDuenio() {
return duenio;
}
public void setDuenio(Usuario duenio) {
this.duenio = duenio;
}
@Override
public String toString() {
return "Mascota{" + "id=" + id + ", apodo=" + apodo + ", raza=" + raza + '}';
}
}
| [
"[email protected]"
] | |
02e6c869be673fabda2a1c422dc93794fa3e4c25 | fb7bb6c59f0448f0101b735361e8af34e8247458 | /src/main/java/dev/service/TextService.java | b85971952ce8d82ecf470c9dd1815f3b742c92c8 | [] | no_license | SumithraC/test_dev1 | dec09b71f4c6b0c6bb4457b392bf63dadaebe0c7 | b374c5c224848b91e83ceb87080c12ef645c33e7 | refs/heads/master | 2020-09-12T20:10:35.129780 | 2014-05-26T21:00:18 | 2014-05-26T21:00:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | package dev.service;
import java.util.List;
import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import dev.bean.TextBean;
import dev.dao.TextDao;
@Service
@Transactional
public class TextService {
protected static Logger logger = Logger.getLogger("TextService");
@Autowired
private TextDao textDao;
public List<TextBean> getAllGreetings() {
System.out.println(textDao.getAllTexts());
List<TextBean> values = textDao.getAllTexts();
return values;
}
public void addGreeting(TextBean text) {
textDao.addText(text);
}
}
| [
"[email protected]"
] | |
a157a92c2281bbfcf2b526e63174cecd3ea54a6a | 982e62110d15c7782172630cc991ad7f5a0e8104 | /mall-mbg/src/main/java/com/djmanong/mall/cms/service/impl/SubjectServiceImpl.java | f536abda39698fa4a9bf9b156c51144972f8dadc | [] | no_license | djmanong/mall | f205d601b9dff095c71b6f33de1247405a8a4d5d | f5cf8beb9f1e13799c4f6625f21fbe4df5af62e8 | refs/heads/master | 2023-04-19T07:46:43.498703 | 2021-05-05T16:00:17 | 2021-05-05T16:00:17 | 355,555,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package com.djmanong.mall.cms.service.impl;
import com.djmanong.mall.cms.entity.Subject;
import com.djmanong.mall.cms.mapper.SubjectMapper;
import com.djmanong.mall.cms.service.SubjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 专题表 服务实现类
* </p>
*
* @author djmanong
* @since 2021-04-07
*/
@Service
public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> implements SubjectService {
}
| [
"[email protected]"
] | |
0a1f1877ec2ad95f76c43172e95806e1987cad27 | 0ba553f4e84ffed0077e24f172c9426305c299be | /spring_aop1_demo/src/main/java/cn/config/SpringConfig.java | 87f11f22aa4cb2d3d11d3aac3d93fc43fe3d5366 | [] | no_license | zhengchaoz/spring_ioc_demo | ef4ba5c5882c04179c8e3d5a02b6501ccf17078b | e4bfae16dccb14f9e7a464294e5c1753e38e8134 | refs/heads/master | 2023-04-29T04:35:02.821477 | 2021-05-25T07:42:47 | 2021-05-25T07:42:47 | 361,299,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package cn.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
/**
* @user 郑超
* @date 2021/4/26
*/
@Configuration
@ComponentScan("cn")
@EnableAspectJAutoProxy// 启动AOP注解,创建代理对象(默认使用JDK动态代理)
//@EnableAspectJAutoProxy(proxyTargetClass = true)// 强制启用cglib动态代理
public class SpringConfig {
}
| [
"[email protected]"
] | |
7518c284d9820d3b27a880567e1548c758049bb3 | c69b229ec04d52e56beaaa8680e74a36157fc944 | /app/src/main/java/com/example/farmshop/util/DateUtil.java | 9a92ada4ed9bb2f39c6686ddbda4fb12fef1a0e7 | [] | no_license | huangxian1215/farmshop | b34cc47eff911aead44c62055df176ec6cd44ebb | 36adcdb8e40a4aee38e13b655244029105ff4436 | refs/heads/master | 2020-05-30T19:05:55.127463 | 2019-08-23T01:54:26 | 2019-08-23T01:54:26 | 189,917,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,400 | java | package com.example.farmshop.util;
import android.annotation.SuppressLint;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by ouyangshen on 2016/9/24.
*/
public class DateUtil {
@SuppressLint("SimpleDateFormat")
public static String getNowDateTime(String formatStr) {
String format = formatStr;
if (format==null || format.length()<=0) {
format = "yyyyMMddHHmmss";
}
SimpleDateFormat s_format = new SimpleDateFormat(format);
return s_format.format(new Date());
}
@SuppressLint("SimpleDateFormat")
public static String getNowTime() {
SimpleDateFormat s_format = new SimpleDateFormat("HH:mm:ss");
return s_format.format(new Date());
}
@SuppressLint("SimpleDateFormat")
public static String getNowTimeDetail() {
SimpleDateFormat s_format = new SimpleDateFormat("HH:mm:ss.SSS");
return s_format.format(new Date());
}
public static String formatTime(String src) {
String dest = src;
SimpleDateFormat old_sdf = new SimpleDateFormat("yyyyMMddHHmmss");
SimpleDateFormat new_sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date = old_sdf.parse(src);
dest = new_sdf.format(date);
} catch (Exception e) {
e.printStackTrace();
}
return dest;
}
}
| [
"[email protected]"
] | |
b325a20f5e1548759c47ec01c2046b9beacd9385 | 4381633253a1c3f5efd6f1e70520435c01bc46db | /src/main/java/com/apap/tugas1806269581/models/PustakawanModel.java | 52cec70a6e7c2451fd354bdd3c404a550df0156d | [] | no_license | ahmad-baehaqi/tugas1-1806269581 | f9c6739ed08086f258bf7b7d67a2919a3b7c39dd | e175e3e3a035ed1d9364c6edb6f5d68fb8164974 | refs/heads/master | 2021-04-23T22:48:53.152474 | 2020-03-25T16:01:58 | 2020-03-25T16:01:58 | 250,024,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,626 | java | package com.apap.tugas1806269581.models;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;
import java.util.HashSet;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.format.annotation.DateTimeFormat;
/**
* PustakawanModel
*/
@Entity
@Table(name = "pustakawan")
public class PustakawanModel implements Serializable {
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
@NotNull
@Size(max = 50)
@Column(name = "nama", nullable = false)
private String nama;
public String getNama() {
return this.nama;
}
public void setNama(String nama) {
this.nama = nama;
}
@NotNull
@Size(max = 20)
@Column(name = "nip", nullable = false, unique = true)
private String nip;
public String getNip() {
return this.nip;
}
public void setNip(String nip) {
this.nip = nip;
}
@Size(max = 100)
@Column(name = "tempat_lahir")
private String tempatLahir;
public String getTempatLahir() {
return this.tempatLahir;
}
public void setTempatLahir(String tempatLahir) {
this.tempatLahir = tempatLahir;
}
@NotNull
@Column(name = "tanggal_lahir", nullable = false)
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date tanggalLahir;
public Date getTanggalLahir() {
return this.tanggalLahir;
}
public void setTanggalLahir(Date tanggalLahir) {
this.tanggalLahir = tanggalLahir;
}
@NotNull
@Column(name = "jenis_kelamin", nullable = false)
private int jenisKelamin;
public int getJenisKelamin() {
return this.jenisKelamin;
}
public void setJenisKelamin(int jenisKelamin) {
this.jenisKelamin = jenisKelamin;
}
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "spesialisasi_pustakawan", joinColumns = {
@JoinColumn(name = "pustakawan_id") }, inverseJoinColumns = { @JoinColumn(name = "spesialisasi_id") })
private Set<SpesialisasiModel> setSpesialisasi = new HashSet<>();
public Set<SpesialisasiModel> getSetSpesialisasi() {
return this.setSpesialisasi;
}
public void setSetSpesialisasi(Set<SpesialisasiModel> setSpesialisasi) {
this.setSpesialisasi = setSpesialisasi;
}
@OneToMany(mappedBy = "pustakawan", cascade = CascadeType.ALL, orphanRemoval = true)
private Set<JadwalPustakawanModel> setJadwal;
public Set<JadwalPustakawanModel> getSetJadwal() {
return this.setJadwal;
}
public void setSetJadwal(Set<JadwalPustakawanModel> setJadwal) {
this.setJadwal = setJadwal;
}
@Override
public int hashCode() {
Objects.hash(id);
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PustakawanModel other = (PustakawanModel) obj;
if (id != other.id)
return false;
return true;
}
public String generateNip() {
String rndm = getTwoCharRandom();
return LocalDate.now().getYear() + new SimpleDateFormat("ddMMyy").format(getTanggalLahir())
+ this.getJenisKelamin() + rndm;
}
protected String getTwoCharRandom() {
String SALTCHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
StringBuilder salt = new StringBuilder();
Random rnd = new Random();
while (salt.length() < 2) { // length of the random string.
int index = (int) (rnd.nextFloat() * SALTCHARS.length());
salt.append(SALTCHARS.charAt(index));
}
String saltStr = salt.toString();
return saltStr;
}
} | [
"[email protected]"
] | |
f94d4a379815637c66b46e96e6a0433fb233b603 | 61c11900a62c697cbf5fa95637dda129c51d99ff | /workspace/servidor/src/main/java/ec/com/codesoft/codefaclite/servidor/facade/ActualizarSistemaFacade.java | 10e21f85bb59b8a4c558ac02d5e21ccf58d975a7 | [] | no_license | carlosmast23/codefac-lite | 078507508512ee14d1b1bc81e639e4085dcfb60b | 7ba071bc4ff483a6035d5773363ac9a3ee957aae | refs/heads/master | 2023-08-07T15:20:20.229328 | 2021-10-25T01:57:04 | 2021-10-25T01:57:04 | 108,033,774 | 0 | 0 | null | 2023-01-07T07:33:07 | 2017-10-23T20:09:27 | Java | UTF-8 | Java | false | false | 525 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ec.com.codesoft.codefaclite.servidor.facade;
import ec.com.codesoft.codefaclite.servidorinterfaz.entity.ActualizarSistema;
/**
*
* @author Carlos
*/
public class ActualizarSistemaFacade extends AbstractFacade<ActualizarSistema> {
public ActualizarSistemaFacade() {
super(ActualizarSistema.class);
}
}
| [
"[email protected]"
] | |
29aa7e422191a6a98c85fcc2e056482010e60945 | 3b33331f8169bcec170770fe04c4e0fd88d19606 | /Flu Epidemic/src/simulation/Chicken.java | b4b581315db9a168eaf58ae577a5ac13b7512f79 | [] | no_license | iFlame/FluEpidemic | 5e9d62e7c6d7af9b28dbd949412f82525082a8a8 | ed7d87302e9c633ddc84b5b18e00580e8990b422 | refs/heads/master | 2021-01-10T22:01:19.365802 | 2013-11-16T16:06:32 | 2013-11-16T16:06:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package simulation;
public class Chicken extends LivingBeing {
public Chicken() {
super();
this.type = Type.CHICKEN;
}
}
| [
"[email protected]"
] | |
58a87cc50683155f898992d82e21e11c6183fed2 | 63bb0fbd92ca9d6b74d6999edd187cb69dba86c2 | /src/grid/controller/GridController.java | cb62dedc257c2ae5e1720426dd926440216ae2cd | [] | no_license | thesuperssss/Grid_Project | dcd49ebf0cd39cbb4ad7ad315fc5a8077b3485ce | a51e5c16534422e8ae264da631d4f9e1db001950 | refs/heads/master | 2021-01-10T20:18:52.289126 | 2014-01-21T20:26:59 | 2014-01-21T20:26:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,584 | java | package grid.controller;
import grid.model.MarshmallowCreature;
import grid.view.GridView;
public class GridController
{
private int[][] myFamilyAges;
private String[][] friendName;
private GridView consoleView;
private MarshmallowCreature[][] marshMan;
private MarshmallowCreature type;
public GridController()
{
myFamilyAges = new int[3][3];
friendName = new String[2][2];
consoleView = new GridView();
marshMan = new MarshmallowCreature[2][2];
type = new MarshmallowCreature();
}
public void start()
{
fillAges();
fillName();
fillMarshMen();
consoleView.printIntInformation(myFamilyAges);
consoleView.printStringInformation(friendName);
consoleView.printMarshInformation(marshMan);
}
private void fillName()
{
friendName[0][0] = "Grayson";
friendName[0][1] = "Branden";
friendName[1][0] = "Hyrum";
friendName[1][1] = "Nathan";
}
private void fillAges()
{
for (int row = 0; row < myFamilyAges.length; row++)
{
for (int col = 0; col < myFamilyAges[0].length; col++)
{
myFamilyAges[row][col] = (int) (Math.random() * 50 + 1);
}
}
}
private void fillMarshMen()
{
int yesNo;
Boolean noYes;
for (int row = 0; row < marshMan.length; row++)
{
for (int col = 0; col < marshMan[0].length; col++)
{
yesNo = (int) (Math.random() * 10 + 1);
if (yesNo > 5)
noYes = true;
else
noYes = false;
marshMan[row][col] = new MarshmallowCreature(friendName[row][col], noYes, (int) (Math.random() * 10 + 1), (int) (Math.random() * 30 + 1), (int) (Math.random() * 10 + 1));
}
}
}
}
| [
"[email protected]"
] | |
97447cc429a1a860234fd2a835a12a5e1a40b06e | d0ec346b35b5d346365341ab9d7fc69e90bd8b72 | /app/src/main/java/com/system/intellignetcable/fragment/AnalyzeFragment.java | d005de269f41890c6a2d242d42f5cf92a981aec4 | [] | no_license | adugmcool/IntellignetCableSystem | 87047dfb2dbd7c76089547f83cbd7aae8bb4fa82 | 24cb59cd979a0b093a458dea8632e17d2df0b1b1 | refs/heads/master | 2020-04-08T10:24:56.502764 | 2019-02-15T07:26:42 | 2019-02-15T07:26:42 | 159,267,886 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,723 | java | package com.system.intellignetcable.fragment;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import com.system.intellignetcable.R;
import com.system.intellignetcable.activity.IntelligentAnalysisActivity;
import com.system.intellignetcable.activity.MainActivity;
import com.system.intellignetcable.adapter.AnalyzeAdapter;
import com.system.intellignetcable.util.ParamUtil;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnItemClick;
import butterknife.Unbinder;
/**
* Created by zydu on 2018/11/21.
*/
public class AnalyzeFragment extends BaseFragment implements AdapterView.OnItemClickListener{
private static AnalyzeFragment analyzeFragment;
@BindView(R.id.search_iv)
ImageView searchIv;
@BindView(R.id.search_et)
EditText searchEt;
@BindView(R.id.search_rl)
RelativeLayout searchRl;
@BindView(R.id.analyze_lv)
ListView analyzeLv;
@BindView(R.id.analyze_btn)
Button analyzeBtn;
Unbinder unbinder;
// @BindView(R.id.refresh_layout)
// SmartRefreshLayout refreshLayout;
private MainActivity mainActivity;
private AnalyzeAdapter analyzeAdapter;
private List<String> list;
public static AnalyzeFragment getInstance() {
if (analyzeFragment == null) {
analyzeFragment = new AnalyzeFragment();
}
return analyzeFragment;
}
@Override
public void onAttach(Activity activity) {
this.mainActivity = (MainActivity) activity;
super.onAttach(activity);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_analyze, container, false);
unbinder = ButterKnife.bind(this, view);
setListener();
initData();
return view;
}
private void initData() {
list= new ArrayList<>();
list.add("东三环中路9号");
list.add("朝阳北路");
analyzeAdapter = new AnalyzeAdapter(getActivity(), list);
analyzeLv.setAdapter(analyzeAdapter);
}
private void setListener() {
// refreshLayout.setOnRefreshListener(new OnRefreshListener() {
// @Override
// public void onRefresh(@NonNull RefreshLayout refreshLayout) {
//
// }
// });
// refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
// @Override
// public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
//
// }
// });
analyzeLv.setOnItemClickListener(this);
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}
@OnClick(R.id.search_iv)
public void onSearchIvClicked() {
}
@OnClick(R.id.analyze_btn)
public void onAnalyzeBtnClicked() {
startActivity(new Intent(mainActivity, IntelligentAnalysisActivity.class));
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
startActivity(new Intent(mainActivity, IntelligentAnalysisActivity.class));
}
}
| [
"[email protected]"
] | |
357e167421c01f1bbc2d7d672d8385f58d1189c8 | 4bac9ad5c4045b193db2983003870ebc795c9315 | /app/src/main/java/sg/edu/rp/c346/taskmanager/NotificationReceiver.java | 25993fcba129f01360df80c95949d09627ba872f | [] | no_license | 16046544/TaskManager | ca1c5e22847466761c568ac24eeb8a577aed6542 | ba7e35032e89ce32d7b5b86a04a242ee55037643 | refs/heads/master | 2020-03-18T06:11:43.785376 | 2018-05-22T11:16:07 | 2018-05-22T11:16:07 | 134,380,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,658 | java | package sg.edu.rp.c346.taskmanager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
public class NotificationReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
int reqCode = 12345;
NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
NotificationChannel channel = new NotificationChannel("default", "Default Channel", NotificationManager.IMPORTANCE_DEFAULT);
channel.setDescription("This is for default notification");
notificationManager.createNotificationChannel(channel);
}
Intent i = new Intent(context, MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(context, reqCode, i, PendingIntent.FLAG_CANCEL_CURRENT);
//Build notification
NotificationCompat.Builder builder = new NotificationCompat.Builder(context,"default");
builder.setContentTitle("Task Manager Reminder");
builder.setContentText("Post letters");
builder.setSmallIcon(android.R.drawable.ic_dialog_info);
builder.setContentIntent(pIntent);
builder.setAutoCancel(true);
Notification n = builder.build();
notificationManager.notify(123, n);
}
}
| [
"[email protected]"
] | |
3febca68aab6143cdbe859dc115205e85246b2db | 1a760c6975236199211f3d54f0c759c828213d28 | /spring-security-oauth2/src/main/java/com/springsecurityoauth2/model/tables/pojos/OauthCode.java | 46945cb6d4c58cf16a7fb540c3cfffa467fa3174 | [] | no_license | PrakashMuth/spring-security-oauth | 60e676c0d220a089ffc8e63c85a8b2e3395f50a4 | 1f1d6c80e5d5103ca2fd8131d2b7d222459e2293 | refs/heads/master | 2020-12-09T06:50:47.031259 | 2020-02-03T10:49:42 | 2020-02-03T10:49:42 | 233,228,012 | 0 | 1 | null | 2020-01-12T06:17:34 | 2020-01-11T12:26:34 | null | UTF-8 | Java | false | true | 1,483 | java | /*
* This file is generated by jOOQ.
*/
package com.springsecurityoauth2.model.tables.pojos;
import java.io.Serializable;
import javax.annotation.processing.Generated;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.12.3"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class OauthCode implements Serializable {
private static final long serialVersionUID = -1991927765;
private String code;
private byte[] authentication;
public OauthCode() {}
public OauthCode(OauthCode value) {
this.code = value.code;
this.authentication = value.authentication;
}
public OauthCode(
String code,
byte[] authentication
) {
this.code = code;
this.authentication = authentication;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public byte[] getAuthentication() {
return this.authentication;
}
public void setAuthentication(byte... authentication) {
this.authentication = authentication;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("OauthCode (");
sb.append(code);
sb.append(", ").append("[binary...]");
sb.append(")");
return sb.toString();
}
}
| [
"[email protected]"
] | |
b142a9b8111ab12b6eb3ae669820de2e8be4ca06 | 0965bae21b14fc56ad72abe0a6b91dc87d26c0a1 | /src/main/java/nic/vahan5/reg/impl/FasTagImpl.java | a5548bce1d4c46d35f3ca6fce63b756aa9393ed6 | [] | no_license | buchibabuk/regsb | 2e4d6bd631f711eb5532c54ff0f59387faf63ad1 | 89766085b889ea597573e7a300016a9a83d67167 | refs/heads/main | 2023-02-11T01:39:31.605910 | 2021-01-06T10:54:13 | 2021-01-06T10:54:13 | 327,282,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,034 | java | package nic.vahan5.reg.impl;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.sql.RowSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.codehaus.jackson.map.ObjectMapper;
import nic.vahan5.reg.common.VahanException.VahanException;
import nic.vahan5.reg.db.TableList;
import nic.vahan5.reg.db.connection.TransactionManagerOne;
import nic.vahan5.reg.db.connection.TransactionManagerReadOnly;
import nic.vahan5.reg.form.dobj.FasTagDetailsDobj;
import nic.vahan5.reg.form.dobj.FasTagRequestDobj;
import nic.vahan5.reg.form.dobj.FasTagResponseDobj;
import nic.vahan5.reg.form.dobj.Owner_dobj;
import nic.vahan5.reg.server.CommonUtils;
import nic.vahan5.reg.server.ServerUtil;
import nic.vahan5.reg.server.TableConstants;
@Service
public class FasTagImpl {
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger.getLogger(FasTagImpl.class);
@Autowired
TransactionManagerReadOnly tmgr;
@Autowired
ServerUtil serverUtil;
public FasTagDetailsDobj getFasTagDetails(String chasiNo, String regn_no, String regnType) {
PreparedStatement ps = null;
String sql = null;
FasTagDetailsDobj dobj = null;
// TransactionManagerReadOnly tmgr = null;
try {
// tmgr = new TransactionManagerReadOnly("getFasTagDetails");
if (!TableConstants.VM_REGN_TYPE_NEW.equals(regnType) && !TableConstants.VM_REGN_TYPE_TEMPORARY.equals(regnType)
&& !TableConstants.VM_REGN_TYPE_EXARMY.equals(regnType) && !CommonUtils.isNullOrBlank(regn_no) && !"NEW".equals(regn_no)) {
sql = "SELECT tagid, chasi_no, eng_no, regn_no FROM " + TableList.VT_FASTAG + " where chasi_no = ? and regn_no = ?";
ps = tmgr.prepareStatement(sql);
ps.setString(1, chasiNo);
ps.setString(2, regn_no);
} else {
sql = "SELECT tagid, chasi_no, eng_no, regn_no FROM " + TableList.VT_FASTAG + " where chasi_no = ?";
ps = tmgr.prepareStatement(sql);
ps.setString(1, chasiNo);
}
RowSet rs = tmgr.fetchDetachedRowSet();
if (rs.next()) {
dobj = new FasTagDetailsDobj();
dobj.setTagid(rs.getString("tagid"));
dobj.setVin(rs.getString("chasi_no"));
dobj.setEngineno(rs.getString("eng_no"));
dobj.setRegnumber(rs.getString("regn_no"));
}
} catch (SQLException e) {
LOGGER.error(e.toString() + " " + e.getStackTrace()[0]);
} finally {
try {
if (tmgr != null) {
tmgr.release();
}
} catch (Exception e) {
LOGGER.error(e.toString() + " " + e.getStackTrace()[0]);
}
}
return dobj;
}
public FasTagDetailsDobj getFasTagDetailsByService(String chasiNo, String engineNo) throws VahanException {
HttpURLConnection connection = null;
OutputStream outputStream = null;
BufferedReader bufferReader = null;
try {
ObjectMapper objectMapper = new ObjectMapper();
FasTagRequestDobj requestDobj = new FasTagRequestDobj();
requestDobj.setVin(chasiNo);
requestDobj.setEngineno(engineNo);
String requestData = objectMapper.writeValueAsString(requestDobj);
final String fasTagURL = serverUtil.getVahanPgiUrl(TableConstants.FASTAG_URL);
if (!CommonUtils.isNullOrBlank(fasTagURL)) {
URL url = new URL(fasTagURL);
connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(3000);
connection.setReadTimeout(5000);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
connection.setRequestProperty("Accept", "application/json");
connection.setDoOutput(true);
outputStream = connection.getOutputStream();
outputStream.write(requestData.getBytes("UTF-8"));
outputStream.flush();
outputStream.close();
int responseCode = connection.getResponseCode();
if (responseCode == 200) {
bufferReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder responseData = new StringBuilder();
while ((inputLine = bufferReader.readLine()) != null) {
responseData.append(inputLine);
}
//Gson gson = new Gson();
Gson gson=new GsonBuilder().create();
FasTagResponseDobj respose = gson.fromJson(responseData.toString(), FasTagResponseDobj.class);
if (respose != null) {
if (Integer.parseInt(respose.getStatus()) == 0) {
return objectMapper.readValue(new StringReader(respose.getData()), FasTagDetailsDobj.class);
} else {
throw new VahanException("No records found for provided Chassis (" + chasiNo + ") and Engine (" + engineNo + ") Number combination at NETC service.");
}
} else {
throw new VahanException("No records found for provided Chassis (" + chasiNo + ") and Engine (" + engineNo + ") Number combination at NETC service.");
}
} else {
throw new VahanException("Unable to get response from service !!!");
}
} else {
throw new VahanException("FASTag service URL not found.");
}
} catch (VahanException ve) {
throw ve;
} catch (SocketTimeoutException se) {
LOGGER.error(se.toString() + " " + se.getStackTrace()[0]);
throw new VahanException("Unable to get response from the FASTag service. Please try again.");
} catch (Exception e) {
LOGGER.error(e.toString() + " " + e.getStackTrace()[0]);
throw new VahanException("Problem in getting FASTag details through service.");
} finally {
try {
if (connection != null) {
connection.disconnect();
}
if (bufferReader != null) {
bufferReader.close();
}
} catch (Exception e) {
LOGGER.error(e.toString() + " " + e.getStackTrace()[0]);
}
}
}
public static void insertFasTagDetails(TransactionManagerOne tmgr, Owner_dobj ownerDobj, String empCD, FasTagDetailsDobj fasTagDobj) throws VahanException {
try {
String sql = "INSERT INTO " + TableList.VT_FASTAG + "(state_cd, off_cd, regn_no, chasi_no, eng_no, tagid, tid, op_dt, inserted_by) "
+ " VALUES (?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP, ?);";
PreparedStatement ps = tmgr.prepareStatement(sql);
ps.setString(1, ownerDobj.getState_cd());
ps.setInt(2, ownerDobj.getOff_cd());
ps.setString(3, ownerDobj.getRegn_no());
ps.setString(4, ownerDobj.getChasi_no());
ps.setString(5, ownerDobj.getEng_no());
ps.setString(6, fasTagDobj.getTagid());
ps.setString(7, fasTagDobj.getTid());
ps.setString(8, empCD);
ServerUtil.validateQueryResult(tmgr, ps.executeUpdate(), ps);
} catch (VahanException ve) {
throw ve;
} catch (Exception e) {
LOGGER.error(e.toString() + " " + e.getStackTrace()[0]);
throw new VahanException("Problem in saving FASTag details.");
}
}
public void moveToHistory(TransactionManagerOne tmgr, Owner_dobj dobj, String empCd) throws VahanException {
PreparedStatement psInsert = null;
String conditionVar = "";
PreparedStatement psUpdate = null;
try {
if (!"NEW".equals(dobj.getRegn_no()) && !"TEMPREG".equals(dobj.getRegn_no())) {
conditionVar = " and regn_no = ? ";
}
String sql = "INSERT INTO " + TableList.VH_FASTAG + "(moved_on, moved_by, state_cd, off_cd, regn_no, chasi_no, eng_no, "
+ " tagid, tid, op_dt, inserted_by)"
+ " SELECT current_timestamp, ?, state_cd, off_cd, regn_no, chasi_no, eng_no, tagid, tid, op_dt, inserted_by"
+ " FROM " + TableList.VT_FASTAG + " where chasi_no= ? " + conditionVar;
psInsert = tmgr.prepareStatement(sql);
psInsert.setString(1, empCd);
psInsert.setString(2, dobj.getChasi_no());
if (!CommonUtils.isNullOrBlank(conditionVar)) {
psInsert.setString(3, dobj.getRegn_no());
}
psInsert.executeUpdate();
if (!CommonUtils.isNullOrBlank(conditionVar)) {
sql = "update " + TableList.VT_FASTAG + " set state_cd = ? , off_cd = ? where chasi_no = ? " + conditionVar;
psUpdate = tmgr.prepareStatement(sql);
psUpdate.setString(1, dobj.getState_cd());
psUpdate.setInt(2, dobj.getOff_cd());
psUpdate.setString(3, dobj.getChasi_no());
psUpdate.setString(4, dobj.getRegn_no());
} else {
sql = "update " + TableList.VT_FASTAG + " set regn_no = ?, state_cd = ? , off_cd = ? where chasi_no = ? ";
psUpdate = tmgr.prepareStatement(sql);
psUpdate = tmgr.prepareStatement(sql);
psUpdate.setString(1, dobj.getRegn_no());
psUpdate.setString(2, dobj.getState_cd());
psUpdate.setInt(3, dobj.getOff_cd());
psUpdate.setString(4, dobj.getChasi_no());
}
psUpdate.executeUpdate();
} catch (Exception e) {
LOGGER.error(e.toString() + " " + e.getStackTrace()[0]);
throw new VahanException("Exception occured during maintaining history of FASTag details.");
} finally {
if (psUpdate != null) {
psUpdate = null;
}
if (psInsert != null) {
psInsert = null;
}
}
}
}
| [
"[email protected]"
] | |
4b5338844b074e99c00ce68da09ef20c1414396e | a099f59131d004d059005fb8475730cf59a39667 | /src/main/java/com/algaworks/algalog/api/model/input/EntregaInput.java | 291b921c03e2b2f08e5696e4555e5ab024ac2ced | [] | no_license | rodrigsmor/Mergulho-Spring-Rest | 686d07dda54d7f5849e980be3c7b2bc6b91c3fd0 | 57865d49016e2aaa01feaec6d3685ac33a10098c | refs/heads/main | 2023-07-06T18:01:26.110321 | 2021-08-15T17:40:07 | 2021-08-15T17:40:07 | 396,414,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.algaworks.algalog.api.model.input;
import java.math.BigDecimal;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class EntregaInput {
@Valid
@NotNull
private ClienteIdInput cliente;
@Valid
@NotNull
private DestinatarioInput destinatario;
@NotNull
private BigDecimal taxa;
} | [
"[email protected]"
] | |
2d34b0c8a90554b9803a24d516f86278262379f0 | 46ad3e428a537ac2995596ea713bba55f89e4ea3 | /src/main/java/DrRAJ/Controller/RemediesUpdateServlet.java | b39643a4a4f988a464ca01fa5a03043ebbf7a735 | [] | no_license | avnish14/Dr.Raj | 23b737718517253e6b8da412fae96bc22ab70961 | df88d59cc6200e88b46abcf5bae6c4489eca25e4 | refs/heads/master | 2020-03-13T07:29:54.630617 | 2018-05-08T14:31:16 | 2018-05-08T14:31:16 | 131,026,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,540 | java | package DrRAJ.Controller;
import java.io.IOException;
import java.util.HashMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import DrRAJ.Bean.RemediesBean;
import DrRAJ.DAO.RemediesDAO;
import DrRAJ.Utils.ValidationUtils;
public class RemediesUpdateServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String name = request.getParameter("txtRemediesName");
String photoLink = request.getParameter("txtPhotoLink");
String remediesId = request.getParameter("remediesId");
String forwardLink = request.getParameter("txtForwardLink");
RemediesBean remediesBean = new RemediesBean();
remediesBean.setRemediesId(remediesId);
boolean isError = false;
if (ValidationUtils.isEmpty(name)) {
isError = true;
request.setAttribute("name", "<font color=red>* Name is Required</font>");
} else {
request.setAttribute("txtRemediesName", name);
remediesBean.setName(name);
}
if (ValidationUtils.isEmpty(photoLink)) {
isError = true;
request.setAttribute("photoLink", "<font color=red>* Photo Link is Required</font>");
} else {
request.setAttribute("txtPhotoLink", photoLink);
remediesBean.setPhotolink(photoLink);
}
if (ValidationUtils.isEmpty(forwardLink)) {
isError = true;
request.setAttribute("forwardLink", "<font color=red>* Forward Link is Required</font>");
} else {
request.setAttribute("txtForwardLink", forwardLink);
remediesBean.setForwardLink(forwardLink);
}
if (isError) {
request.setAttribute("remediesBean", remediesBean);
request.getRequestDispatcher("RemediesEdit.jsp").forward(request, response);
} else {
if (new RemediesDAO().update(remediesBean)) {
request.getServletContext().removeAttribute("remediesMap");
HashMap<String, RemediesBean> remediesMap = new RemediesDAO().getRemediesListHashmap();
request.getServletContext().setAttribute("remediesMap", remediesMap);
response.sendRedirect("RemediesListServlet");
} else {
request.getRequestDispatcher("RemediesEdit.jsp").forward(request, response);
}
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
| [
"[email protected]"
] | |
499292017b434b5458e5aca7bad91f6f62733cd2 | aaf7a0742f598340f13c5858628c904e5ac9686f | /30/app/src/main/java/com/example/samuray/myapplication/Footer.java | f343b6b9662f6884b5c16e70a38116d99ee48157 | [] | no_license | brynpryl0426/kungfu_blog_step_by_step | 226d7868f2c70652864bdab922dddae7bb1a1df8 | e60b2c123ae957c290b15a0fce39dfd53d787dbb | refs/heads/master | 2022-03-31T04:04:08.811410 | 2019-10-02T08:23:53 | 2019-10-02T08:23:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,876 | java | package com.example.samuray.myapplication;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
public class Footer extends Fragment implements View.OnClickListener {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.footer, container, false);
LinearLayout lbuttonHome = (LinearLayout) v.findViewById(R.id.lbuttonHome);
LinearLayout lbuttonCategory = (LinearLayout) v.findViewById(R.id.lbuttonCategory);
LinearLayout lbuttonPlus = (LinearLayout) v.findViewById(R.id.lbuttonPlus);
LinearLayout lbuttonProfile = (LinearLayout) v.findViewById(R.id.lbuttonProfile);
lbuttonHome.setOnClickListener(this);
lbuttonCategory.setOnClickListener(this);
lbuttonPlus.setOnClickListener(this);
lbuttonProfile.setOnClickListener(this);
return v;
}
@Override
public void onClick(View v) {
Fragment fragment = null;
switch (v.getId()) {
case R.id.lbuttonHome:
fragment = new Home();
replaceFragment(fragment);
break;
case R.id.lbuttonCategory:
fragment = new CategoryList();
replaceFragment(fragment);
break;
case R.id.lbuttonPlus:
if (CheckLogin()) {
fragment = new PostAdd();
}else {
fragment = new ProfileLogin();
}
replaceFragment(fragment);
break;
case R.id.lbuttonProfile:
if (CheckLogin()) {
fragment = new ProfileList();
}else {
fragment = new ProfileLogin();
}
replaceFragment(fragment);
break;
}
}
public void replaceFragment(Fragment someFragment) {
FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_container, someFragment);
transaction.addToBackStack(null);
transaction.commit();
}
public Boolean CheckLogin() {
SharedPreferences preferences = getActivity().getSharedPreferences("myPrefs", Context.MODE_PRIVATE);
Boolean shered_category_id = preferences.getBoolean("loggedin", false);
if (shered_category_id) {
return true;
}
else {
return false;
}
}
} | [
"[email protected]"
] | |
4ccd98e94d7fd32ccdd7ad50df5a32475f7a405b | 71afab8d5b80b6ca65372fd051ee56ecac9d7767 | /app/src/main/java/com/example/spotter_workoutlog/database/dao/WorkoutSessionDao.java | 92929ae4c7ee6223a95901bf633bc474ec8cf4d5 | [] | no_license | trifunovicd/Spotter-WorkoutLog | 31d62a01275fa43efc4d9b59abc04b5b80e212b2 | 58f4667f9575a6e2a55f31bad3053ab4e24c526e | refs/heads/master | 2020-12-11T21:34:24.597691 | 2020-02-11T22:30:53 | 2020-02-11T22:30:53 | 233,964,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 886 | java | package com.example.spotter_workoutlog.database.dao;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import com.example.spotter_workoutlog.database.models.WorkoutSession;
import java.util.Date;
import java.util.List;
@Dao
public interface WorkoutSessionDao {
@Insert
long insertWorkoutSession(WorkoutSession workoutSession);
@Delete
void deleteWorkoutSession(WorkoutSession workoutSession);
@Query("DELETE FROM workout_sessions WHERE id = :workout_session_id")
void deleteWorkoutSessionById(int workout_session_id);
@Query("SELECT * FROM workout_sessions ORDER BY date")
LiveData<List<WorkoutSession>> getAllWorkoutSessions();
@Query("SELECT * FROM workout_sessions ORDER BY date DESC LIMIT 1")
WorkoutSession getLastWorkoutSession();
}
| [
"[email protected]"
] | |
48cecb4f852d23b2004f4d76cef09ed93b903392 | 31a2449aabb26f9ef3a8ffe7497ca916a37a4e4f | /thread/src/thread/notify/DrawTarget.java | e86ec7171b2761788891b386369f4707456b840b | [] | no_license | simplewz/JavaSE | 3e9b93a57194b6ee51cb444536196f5996086930 | 0e117de7e1de0e562bb9dca2b0b289b0bcbabd8f | refs/heads/master | 2021-12-21T04:58:14.811974 | 2021-12-15T08:49:13 | 2021-12-15T08:49:13 | 183,245,933 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 514 | java | package thread.notify;
/**
* @author simple
* @email [email protected]
* @date 2021Äê3ÔÂ30ÈÕ
*/
public class DrawTarget implements Runnable{
private Account account;
private double drawAmount;
public DrawTarget(Account account,double drawAmount) {
super();
this.account = account;
this.drawAmount=drawAmount;
}
@Override
public void run() {
for(int i=0;i<10;i++) {
try {
account.draw(drawAmount);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
71c747b56059b8e08491176478e3b867550a4976 | 4987c9402f8c687437adcc0ca0a565020a1ac2fd | /php2/src/main/java/php2/php2/Greeting.java | 6af5bf6192474bddfa518891007f83a58b18da0a | [] | no_license | rajithasr/crossbrowserproj | fd989de457a8d9ae7271bda2aa6fbb86f73d9dfd | 09a8a74f8d01db5e54f7b88f89c1a50abfddc585 | refs/heads/master | 2023-03-04T09:36:53.722094 | 2021-02-09T09:48:50 | 2021-02-09T09:48:50 | 337,356,642 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package php2.php2;
public class Greeting {
private final long id;
private final String content;
public Greeting(long id, String content) {
this.id = id;
this.content = content;
}
public long getId() {
return id;
}
public String getContent() {
return content;
}
}
| [
"[email protected]"
] | |
f28552eb1c33ce5da299ea6005c53cac84befb0a | 1a1f3a79bf8bf29d8fc41997a3569992cf547927 | /TrackingNumber/src/main/java/mx/com/api/trknbr/carrier/Estafeta.java | 61fd5e140568fff6ac525d3fd8bdf8ce54203bb9 | [] | no_license | nesrob91/nesrob | bda624a7a9b0e13bfa54cc2601fca666d3d7f3af | b84cba3ec7870608dce3a184a614ff36dd948d46 | refs/heads/main | 2023-03-28T16:39:16.857896 | 2021-04-04T05:11:11 | 2021-04-04T05:11:11 | 303,464,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,340 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mx.com.api.trknbr.carrier;
import mx.com.api.trknbr.beans.CredencialesEstafeta;
import mx.com.api.trknbr.beans.GuiaResponse;
import estafeta.EstafetaLabel;
import estafeta.EstafetaLabelService;
import estafeta.EstafetaLabelServiceLocator;
import estafeta.beans.DestinationInfoVol;
import estafeta.beans.EstafetaLabelRequestVol;
import estafeta.beans.EstafetaLabelResponseVol;
import estafeta.beans.LabelDescriptionListVol;
import estafeta.beans.OriginInfoVol;
import java.util.Base64;
import mx.com.api.trknbr.dao.CredencialesDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
* @author nroblerol
*/
@Component("estafeta")
public class Estafeta extends GuiasCarriers {
@Autowired
private CredencialesDao credencialesEstafeta;
@Override
protected Object getCredenciales() throws Exception {
return credencialesEstafeta.getCredenciales(guiaRequest.getIdCarrier(),CredencialesDao.ID_SERVICIO_GUIAS,guiaRequest.getIdTipoPedido());
}
@Override
protected Object generaPeticion() throws Exception {
CredencialesEstafeta credencialesEstafeta = (CredencialesEstafeta) credenciales;
EstafetaLabelRequestVol request = new EstafetaLabelRequestVol();
LabelDescriptionListVol[] ldl = new LabelDescriptionListVol[1];
LabelDescriptionListVol label = new LabelDescriptionListVol();
DestinationInfoVol destinationInfo = new DestinationInfoVol();
OriginInfoVol originInfo = new OriginInfoVol();
//PROD
request.setCustomerNumber(credencialesEstafeta.getNumcte());
request.setLogin(credencialesEstafeta.getUsuario());
request.setPassword(credencialesEstafeta.getContrasenia());
switch(guiaRequest.getIdTipoPedido()){
case 4: case 5 :
break;
default:
request.setSecType("normalTipo7ZebraOri");
break;
}
//QA
/*request.setCustomerNumber("0000000");
request.setLogin("prueba1");
request.setPassword("lAbeL_K_11");
*/
//Contenido
label.setAditionalInfo(guiaRequest.getPedido());
label.setContent("PAQUETE ELEKTRA");
label.setContentDescription("PAQUETE ELEKTRA");
label.setCostCenter("0");
label.setDeliveryToEstafetaOffice(false);
label.setDestinationCountryId(guiaRequest.getPais3());//MX
//Destino
destinationInfo.setAddress1(guiaRequest.getDestino().getDireccion().toUpperCase());
//modify - check for num int - ext
destinationInfo.setAddress2((guiaRequest.getDestino().getnExt().equals("0")?"SN":" Ext."+guiaRequest.getDestino().getnExt()) + (guiaRequest.getDestino().getnInt().equals("0")?"":" Int." + guiaRequest.getDestino().getnInt()));
destinationInfo.setNeighborhood(guiaRequest.getDestino().getColonia());
destinationInfo.setCellPhone(guiaRequest.getDestino().getTelefono());
destinationInfo.setCity(guiaRequest.getDestino().getCiudad());
destinationInfo.setContactName(guiaRequest.getDestino().getContacto().toUpperCase());
destinationInfo.setCorporateName(guiaRequest.getDestino().getContacto().toUpperCase());
destinationInfo.setCustomerNumber(credencialesEstafeta.getNumcte());
//destinationInfo.setNeighborhood(guiaRequest.getDestino().DeleagacionDestino());
destinationInfo.setPhoneNumber(guiaRequest.getDestino().getTelefono());
destinationInfo.setState(guiaRequest.getDestino().getEstado());
destinationInfo.setValid(true);
destinationInfo.setZipCode(guiaRequest.getDestino().getCp());
label.setDestinationInfo(destinationInfo);
//Origin
originInfo.setAddress1(guiaRequest.getOrigen().getDireccion());
originInfo.setAddress2(" ");
originInfo.setCellPhone(" - - ");
originInfo.setCity(guiaRequest.getOrigen().getColonia());//DF
originInfo.setContactName(utils.substr(guiaRequest.getOrigen().getRazonSocial(), 0, 29));
originInfo.setCorporateName(guiaRequest.getOrigen().getRazonSocial());
originInfo.setCustomerNumber(credencialesEstafeta.getNumcte());
originInfo.setNeighborhood(guiaRequest.getOrigen().getColonia());
originInfo.setPhoneNumber(guiaRequest.getOrigen().getTelefono());
originInfo.setState(guiaRequest.getOrigen().getEstado());
originInfo.setValid(true);
originInfo.setZipCode(guiaRequest.getOrigen().getCp());
label.setOriginInfo(originInfo);
label.setOriginZipCodeForRouting(guiaRequest.getOrigen().getCp());
label.setParcelTypeId(4);
label.setReference(guiaRequest.getPedido());
label.setReturnDocument(false);
label.setServiceTypeId("70");
label.setServiceTypeIdDocRet("50");
label.setValid(true);
label.setWeight(15);
label.setEffectiveDate(credencialesEstafeta.getEffectiveDate());
label.setNumberOfLabels(1);
label.setOfficeNum(credencialesEstafeta.getNumOfi());
//Informacion Adicional
/*alternativeInfo.setAddress1(direccion[1]+" "+direccion[2]);
alternativeInfo.setAddress2(direccion[0]);
alternativeInfo.setCellPhone(guiaRequest.getTelefonoDestino());
alternativeInfo.setCity(guiaRequest.getCiudadDestino());
alternativeInfo.setContactName(guiaRequest.getContactoDestino());
alternativeInfo.setCorporateName(guiaRequest.getContactoDestino());
alternativeInfo.setCustomerNumber(credencialesEstafeta.getNumcte());
alternativeInfo.setNeighborhood(guiaRequest.getColoniaDestino());
alternativeInfo.setPhoneNumber(guiaRequest.getTelefonoDestino());
alternativeInfo.setState(guiaRequest.getEstadoDestino());
alternativeInfo.setValid(true);
alternativeInfo.setZipCode(guiaRequest.getCpDestino());
label.setDRAlternativeInfo(alternativeInfo);*/
ldl[0] = label;
request.setLabelDescriptionList(ldl);
request.setLabelDescriptionListCount(ldl.length);
request.setPaperType(Integer.parseInt(credencialesEstafeta.getPaperType()));//1 Laser 2 Zebra
request.setQuadrant(0);
request.setSuscriberId(credencialesEstafeta.getIdSuscriptor());
request.setValid(true);
return request;
}
@Override
protected Object consumeWs() throws Exception {
EstafetaLabelService service = new EstafetaLabelServiceLocator();
EstafetaLabel port;
port = service.getEstafetaLabelWS();
return port.createLabelVol((EstafetaLabelRequestVol) peticion);
}
@Override
protected GuiaResponse procesaRespuesta() throws Exception {
EstafetaLabelResponseVol response = (EstafetaLabelResponseVol) respuesta;
GuiaResponse guiasResponse = new GuiaResponse();
guiasResponse.setInput(xmlUtil.getXmlByObject(peticion));
guiasResponse.setOutput(xmlUtil.getXmlByObject(response));
if (response.getGlobalResult().getResultCode() != 0) {
guiasResponse.setNumGuia(null);
guiasResponse.setEtiqueta("GWSC"+guiaRequest.getIdCarrier()+"R"+response.getGlobalResult().getResultCode());
guiasResponse.setMensaje(response.getGlobalResult().getResultSpanishDescription());
guiasResponse.setIdEstatusGuia(-1);
} else {
guiasResponse.setNumGuia(response.getLabelResultList()[0].getResultSpanishDescription());
switch(guiaRequest.getIdTipoPedido()){
case 4: case 5 :
guiasResponse.setEtiqueta(Base64.getEncoder().encodeToString(response.getLabelPDF()));
break;
default:
guiasResponse.setEtiqueta(new String(response.getSecEsc()));
break;
}
guiasResponse.setMensaje(null);
guiasResponse.setIdEstatusGuia(10);
guiasResponse.setCarrier(guiaRequest.getIdCarrier());
guiasResponse.setEncrypt(0);
}
return guiasResponse;
}
}
| [
"[email protected]"
] | |
aac2907d41a0f45b79c67441820eb171f7c48852 | c0f91cbeec74a25e50e67e540d0991874bfcfe02 | /core/shared/src/main/java/com/mammutgroup/workshop/core/shared/domain/model/WorkshopEntity.java | d412e288abca5f07bf3a3a099cc06b86a628fb58 | [] | no_license | mushtu/Workshop | 3187f5f6357fe6d9a946231cf9ac42d10dc31976 | 61efc08ee184d6a5830d5e23916d13a28e98bb08 | refs/heads/master | 2019-01-19T18:40:48.189111 | 2016-04-19T12:47:06 | 2016-04-19T12:47:06 | 56,227,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,938 | java | package com.mammutgroup.workshop.core.shared.domain.model;
import ir.amv.os.vaseline.base.architecture.impl.hibernate.server.ent.BaseEntityImpl;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
/**
* @author mushtu
* @since 3/28/16.
*/
@Entity
@Table(name = "workshop")
public class WorkshopEntity extends BaseEntityImpl<Long> {
private String name;
private String address;
private StockEntity stock;
private Set<WorkshopServiceEntity> services = new HashSet<WorkshopServiceEntity>(0);
private Set<LineEntity> lines = new HashSet<LineEntity>(0);
private Set<WorkshopOffice> employeeOffices = new HashSet<WorkshopOffice>(0);
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
public StockEntity getStock() {
return stock;
}
public void setStock(StockEntity stock) {
this.stock = stock;
}
@ManyToMany(fetch = FetchType.EAGER)
public Set<WorkshopServiceEntity> getServices() {
return services;
}
public void setServices(Set<WorkshopServiceEntity> services) {
this.services = services;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "workshop", cascade = CascadeType.ALL)
public Set<LineEntity> getLines() {
return lines;
}
public void setLines(Set<LineEntity> lines) {
this.lines = lines;
}
@OneToMany(mappedBy = "workshop",cascade = CascadeType.ALL)
public Set<WorkshopOffice> getEmployeeOffices() {
return employeeOffices;
}
public void setEmployeeOffices(Set<WorkshopOffice> employeeOffices) {
this.employeeOffices = employeeOffices;
}
}
| [
"[email protected]"
] | |
74235bd157f642470f48ddb6aa03194477f9847d | d85ad30b768862664bc77248e4742b2dafeca22b | /Lintcode/Algorithm/ImplementQueueByStacks/Solution.java | 19c9db92f165f503bbaad7c762e3200a0f9f0b75 | [] | no_license | wcy1984123/Interviews | 4dcbbf5ce6d442e55b36f9275a17df05967927c8 | 026f13dad5f2dee1988b0fcfa737fd17b9f8ccf5 | refs/heads/master | 2021-01-13T02:02:26.384967 | 2019-11-12T05:29:06 | 2019-11-12T05:29:06 | 32,403,923 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,661 | java | package ImplementQueueByStacks;
import java.util.Stack;
/**
* Project: Interviews
* Package: ImplementQueueByStacks
* Date: 18/Mar/2015
* Time: 19:32
* System Time: 7:32 PM
*/
/*
As the title described, you should only use two stacks to implement a queue's actions.
The queue should support push(element), pop() and top() where pop is pop the first(a.k.a front) element in the queue.
Both pop and top methods should return the value of first element.
Example
For push(1), pop(), push(2), push(3), top(), pop(), you should return 1, 2 and 2
Challenge
implement it by two stacks, do not use any other data structure and push, pop and top should be O(1) by AVERAGE.
*/
public class Solution {
private Stack<Integer> stack1;
private Stack<Integer> stack2;
public Solution() {
// do initialization if necessary
// push stack
stack1 = new Stack<Integer>();
// pop stack
stack2 = new Stack<Integer>();
}
public void push(int element) {
// write your code here
stack1.push(element);
}
public int pop() {
// write your code here
if (!stack2.isEmpty()) {
return stack2.pop();
} else {
this.populate();
return stack2.pop();
}
}
private void populate() {
while (!stack1.isEmpty()) {
stack2.push(stack1.pop());
}
}
public int top() {
// write your code here
if (!stack2.isEmpty()) {
return stack2.peek();
} else {
this.populate();
return stack2.peek();
}
}
} | [
"[email protected]"
] | |
cc86180efa1201d88c1f37dfd2553469646d46ff | 771e785c31a16f57f9e20502add706c597fdeb18 | /app/src/main/java/com/cz/live/rtmp/encoder/AudioRecorder.java | ae5b1ee1bfc2902031ff64c7f93b10956e2af137 | [] | no_license | yuecheng01/CamerScreenRtmpPush | d282437e96a3a1fafb77cdb6b5d17592119f3964 | 686633389d2050d0aae79f2c7cee94277b4b2ac7 | refs/heads/main | 2023-02-27T22:05:19.591789 | 2021-02-03T08:13:03 | 2021-02-03T08:13:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,935 | java | package com.cz.live.rtmp.encoder;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
public class AudioRecorder {
private AudioRecord audioRecord;
private int bufferSizeInBytes;
private boolean start = false;
private int readSize = 0;
private OnRecordLisener onRecordLisener;
public AudioRecorder() {
bufferSizeInBytes = AudioRecord.getMinBufferSize(
44100,
AudioFormat.CHANNEL_IN_STEREO,
AudioFormat.ENCODING_PCM_16BIT);
audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
44100,
AudioFormat.CHANNEL_IN_STEREO,
AudioFormat.ENCODING_PCM_16BIT,
bufferSizeInBytes
);
}
public void setOnRecordLisener(OnRecordLisener onRecordLisener) {
this.onRecordLisener = onRecordLisener;
}
public void startRecord() {
new Thread(){
@Override
public void run() {
super.run();
start = true;
audioRecord.startRecording();
byte[] audiodata = new byte[bufferSizeInBytes];
while (start) {
readSize = audioRecord.read(audiodata, 0, bufferSizeInBytes);
if(onRecordLisener != null) {
onRecordLisener.recordByte(audiodata, readSize);
}
}
if(audioRecord != null) {
audioRecord.stop();
audioRecord.release();
audioRecord = null;
}
}
}.start();
}
public void stopRecord() {
start = false;
}
public interface OnRecordLisener{
void recordByte(byte[] audioData, int readSize);
}
public boolean isStart() {
return start;
}
}
| [
"[email protected]"
] | |
a101da080217deecc3a49ab946190f3ad2b801b3 | 94cb0894acc5a87c7aa7bc1ded7fd249fbf32597 | /java-1/src/test/java/net/m14m/ardecha/application/Rot13ApplicationTest.java | 31962f3332bfecc530e8ae2e0dc4c75a0b72a927 | [] | no_license | moss/architectural-design-challenge | 52ff479e16063e57939a645c123e83286997a159 | dbfc0e5be89fe9f2cdf843c904f7103df29d6f1d | refs/heads/master | 2021-01-19T10:42:20.312473 | 2012-12-22T17:43:29 | 2012-12-22T17:43:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,733 | java | package net.m14m.ardecha.application;
import org.junit.*;
import org.mockito.*;
import java.io.*;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;
@SuppressWarnings({"ThrowableInstanceNeverThrown", "ThrowableResultOfMethodCallIgnored"})
public class Rot13ApplicationTest {
@Mock private ErrorLogger errorLogger;
@Mock private Flushable systemOutput;
@Mock private TranslationIoCoordinator ioCoordinator;
private Rot13Application application;
@Before public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
application = new Rot13Application(ioCoordinator, errorLogger, systemOutput);
}
@Test public void shouldTranslateTheSpecifiedFileToTheSpecifiedOutput() throws IOException {
application.run("input-filename", "output-filename");
verify(ioCoordinator).translate("input-filename", "output-filename");
}
@Test public void shouldCatchAndLogExceptions() throws IOException {
givenAnErrorInTheApplication(new FileNotFoundException());
application.run("", "");
verify(errorLogger).log(isA(FileNotFoundException.class));
}
@Test public void shouldFlushSystemOutputWhenItFinishesRunning() throws IOException {
application.run("", "");
verify(systemOutput).flush();
}
@Test public void shouldFlushOutputEvenIfThereIsAnError() throws IOException {
givenAnErrorInTheApplication(new RuntimeException());
application.run("", "");
verify(systemOutput).flush();
}
private void givenAnErrorInTheApplication(Exception error) throws IOException {
doThrow(error).when(ioCoordinator).translate(anyString(), anyString());
}
}
| [
"[email protected]"
] | |
61bb7af576eec56fc4240126dbbc26a9fb9f7a26 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/test/com/google/protobuf/UnknownFieldSetTest.java | e6da588594ad5050c0ee47d09abd059a47b6cbf0 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 13,367 | java | /**
* Protocol Buffers - Google's data interchange format
*/
/**
* Copyright 2008 Google Inc. All rights reserved.
*/
/**
* https://developers.google.com/protocol-buffers/
*/
/**
*
*/
/**
* Redistribution and use in source and binary forms, with or without
*/
/**
* modification, are permitted provided that the following conditions are
*/
/**
* met:
*/
/**
*
*/
/**
* * Redistributions of source code must retain the above copyright
*/
/**
* notice, this list of conditions and the following disclaimer.
*/
/**
* * Redistributions in binary form must reproduce the above
*/
/**
* copyright notice, this list of conditions and the following disclaimer
*/
/**
* in the documentation and/or other materials provided with the
*/
/**
* distribution.
*/
/**
* * Neither the name of Google Inc. nor the names of its
*/
/**
* contributors may be used to endorse or promote products derived from
*/
/**
* this software without specific prior written permission.
*/
/**
*
*/
/**
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
*/
/**
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
*/
/**
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
*/
/**
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
*/
/**
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
*/
/**
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
*/
/**
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
*/
/**
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
*/
/**
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
*/
/**
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
*/
/**
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.google.protobuf;
import ByteString.EMPTY;
import Descriptors.Descriptor;
import Descriptors.FieldDescriptor;
import TestAllTypes.NestedEnum.BAR;
import TestAllTypes.NestedEnum.BAZ;
import TestAllTypes.NestedEnum.FOO;
import TestAllTypes.OptionalGroup;
import UnittestProto.optionalNestedEnumExtension;
import UnittestProto.repeatedNestedEnumExtension;
import UnknownFieldSet.Field;
import java.util.Arrays;
import junit.framework.TestCase;
import protobuf_unittest.UnittestProto.TestAllExtensions;
import protobuf_unittest.UnittestProto.TestAllTypes;
import protobuf_unittest.UnittestProto.TestEmptyMessage;
import protobuf_unittest.UnittestProto.TestEmptyMessageWithExtensions;
/**
* Tests related to unknown field handling.
*
* @author [email protected] (Kenton Varda)
*/
// =================================================================
public class UnknownFieldSetTest extends TestCase {
Descriptor descriptor;
TestAllTypes allFields;
ByteString allFieldsData;
// An empty message that has been parsed from allFieldsData. So, it has
// unknown fields of every type.
TestEmptyMessage emptyMessage;
UnknownFieldSet unknownFields;
// =================================================================
public void testVarint() throws Exception {
UnknownFieldSet.Field field = getField("optional_int32");
TestCase.assertEquals(1, field.getVarintList().size());
TestCase.assertEquals(allFields.getOptionalInt32(), ((long) (field.getVarintList().get(0))));
}
public void testFixed32() throws Exception {
UnknownFieldSet.Field field = getField("optional_fixed32");
TestCase.assertEquals(1, field.getFixed32List().size());
TestCase.assertEquals(allFields.getOptionalFixed32(), ((int) (field.getFixed32List().get(0))));
}
public void testFixed64() throws Exception {
UnknownFieldSet.Field field = getField("optional_fixed64");
TestCase.assertEquals(1, field.getFixed64List().size());
TestCase.assertEquals(allFields.getOptionalFixed64(), ((long) (field.getFixed64List().get(0))));
}
public void testLengthDelimited() throws Exception {
UnknownFieldSet.Field field = getField("optional_bytes");
TestCase.assertEquals(1, field.getLengthDelimitedList().size());
TestCase.assertEquals(allFields.getOptionalBytes(), field.getLengthDelimitedList().get(0));
}
public void testGroup() throws Exception {
Descriptors.FieldDescriptor nestedFieldDescriptor = OptionalGroup.getDescriptor().findFieldByName("a");
TestCase.assertNotNull(nestedFieldDescriptor);
UnknownFieldSet.Field field = getField("optionalgroup");
TestCase.assertEquals(1, field.getGroupList().size());
UnknownFieldSet group = field.getGroupList().get(0);
TestCase.assertEquals(1, group.asMap().size());
TestCase.assertTrue(group.hasField(nestedFieldDescriptor.getNumber()));
UnknownFieldSet.Field nestedField = group.getField(nestedFieldDescriptor.getNumber());
TestCase.assertEquals(1, nestedField.getVarintList().size());
TestCase.assertEquals(allFields.getOptionalGroup().getA(), ((long) (nestedField.getVarintList().get(0))));
}
public void testSerialize() throws Exception {
// Check that serializing the UnknownFieldSet produces the original data
// again.
ByteString data = emptyMessage.toByteString();
TestCase.assertEquals(allFieldsData, data);
}
public void testCopyFrom() throws Exception {
TestEmptyMessage message = TestEmptyMessage.newBuilder().mergeFrom(emptyMessage).build();
TestCase.assertEquals(emptyMessage.toString(), message.toString());
}
public void testMergeFrom() throws Exception {
TestEmptyMessage source = TestEmptyMessage.newBuilder().setUnknownFields(UnknownFieldSet.newBuilder().addField(2, Field.newBuilder().addVarint(2).build()).addField(3, Field.newBuilder().addVarint(4).build()).build()).build();
TestEmptyMessage destination = TestEmptyMessage.newBuilder().setUnknownFields(UnknownFieldSet.newBuilder().addField(1, Field.newBuilder().addVarint(1).build()).addField(3, Field.newBuilder().addVarint(3).build()).build()).mergeFrom(source).build();
TestCase.assertEquals(("1: 1\n" + (("2: 2\n" + "3: 3\n") + "3: 4\n")), destination.toString());
}
public void testClear() throws Exception {
UnknownFieldSet fields = UnknownFieldSet.newBuilder().mergeFrom(unknownFields).clear().build();
TestCase.assertTrue(fields.asMap().isEmpty());
}
public void testClearMessage() throws Exception {
TestEmptyMessage message = TestEmptyMessage.newBuilder().mergeFrom(emptyMessage).clear().build();
TestCase.assertEquals(0, message.getSerializedSize());
}
public void testClearField() throws Exception {
int fieldNumber = unknownFields.asMap().keySet().iterator().next();
UnknownFieldSet fields = UnknownFieldSet.newBuilder().mergeFrom(unknownFields).clearField(fieldNumber).build();
TestCase.assertFalse(fields.hasField(fieldNumber));
}
public void testParseKnownAndUnknown() throws Exception {
// Test mixing known and unknown fields when parsing.
UnknownFieldSet fields = UnknownFieldSet.newBuilder(unknownFields).addField(123456, Field.newBuilder().addVarint(654321).build()).build();
ByteString data = fields.toByteString();
TestAllTypes destination = TestAllTypes.parseFrom(data);
TestUtil.assertAllFieldsSet(destination);
TestCase.assertEquals(1, destination.getUnknownFields().asMap().size());
UnknownFieldSet.Field field = destination.getUnknownFields().getField(123456);
TestCase.assertEquals(1, field.getVarintList().size());
TestCase.assertEquals(654321, ((long) (field.getVarintList().get(0))));
}
public void testWrongTypeTreatedAsUnknown() throws Exception {
// Test that fields of the wrong wire type are treated like unknown fields
// when parsing.
ByteString bizarroData = getBizarroData();
TestAllTypes allTypesMessage = TestAllTypes.parseFrom(bizarroData);
TestEmptyMessage emptyMessage = TestEmptyMessage.parseFrom(bizarroData);
// All fields should have been interpreted as unknown, so the debug strings
// should be the same.
TestCase.assertEquals(emptyMessage.toString(), allTypesMessage.toString());
}
public void testUnknownExtensions() throws Exception {
// Make sure fields are properly parsed to the UnknownFieldSet even when
// they are declared as extension numbers.
TestEmptyMessageWithExtensions message = TestEmptyMessageWithExtensions.parseFrom(allFieldsData);
TestCase.assertEquals(unknownFields.asMap().size(), message.getUnknownFields().asMap().size());
TestCase.assertEquals(allFieldsData, message.toByteString());
}
public void testWrongExtensionTypeTreatedAsUnknown() throws Exception {
// Test that fields of the wrong wire type are treated like unknown fields
// when parsing extensions.
ByteString bizarroData = getBizarroData();
TestAllExtensions allExtensionsMessage = TestAllExtensions.parseFrom(bizarroData);
TestEmptyMessage emptyMessage = TestEmptyMessage.parseFrom(bizarroData);
// All fields should have been interpreted as unknown, so the debug strings
// should be the same.
TestCase.assertEquals(emptyMessage.toString(), allExtensionsMessage.toString());
}
public void testParseUnknownEnumValue() throws Exception {
Descriptors.FieldDescriptor singularField = TestAllTypes.getDescriptor().findFieldByName("optional_nested_enum");
Descriptors.FieldDescriptor repeatedField = TestAllTypes.getDescriptor().findFieldByName("repeated_nested_enum");
TestCase.assertNotNull(singularField);
TestCase.assertNotNull(repeatedField);
ByteString data = UnknownFieldSet.newBuilder().addField(singularField.getNumber(), // not valid
Field.newBuilder().addVarint(BAR.getNumber()).addVarint(5).build()).addField(repeatedField.getNumber(), // not valid
// not valid
Field.newBuilder().addVarint(FOO.getNumber()).addVarint(4).addVarint(BAZ.getNumber()).addVarint(6).build()).build().toByteString();
{
TestAllTypes message = TestAllTypes.parseFrom(data);
TestCase.assertEquals(BAR, message.getOptionalNestedEnum());
TestCase.assertEquals(Arrays.asList(FOO, BAZ), message.getRepeatedNestedEnumList());
TestCase.assertEquals(Arrays.asList(5L), message.getUnknownFields().getField(singularField.getNumber()).getVarintList());
TestCase.assertEquals(Arrays.asList(4L, 6L), message.getUnknownFields().getField(repeatedField.getNumber()).getVarintList());
}
{
TestAllExtensions message = TestAllExtensions.parseFrom(data, TestUtil.getExtensionRegistry());
TestCase.assertEquals(BAR, message.getExtension(optionalNestedEnumExtension));
TestCase.assertEquals(Arrays.asList(FOO, BAZ), message.getExtension(repeatedNestedEnumExtension));
TestCase.assertEquals(Arrays.asList(5L), message.getUnknownFields().getField(singularField.getNumber()).getVarintList());
TestCase.assertEquals(Arrays.asList(4L, 6L), message.getUnknownFields().getField(repeatedField.getNumber()).getVarintList());
}
}
public void testLargeVarint() throws Exception {
ByteString data = UnknownFieldSet.newBuilder().addField(1, Field.newBuilder().addVarint(9223372036854775807L).build()).build().toByteString();
UnknownFieldSet parsed = UnknownFieldSet.parseFrom(data);
UnknownFieldSet.Field field = parsed.getField(1);
TestCase.assertEquals(1, field.getVarintList().size());
TestCase.assertEquals(9223372036854775807L, ((long) (field.getVarintList().get(0))));
}
public void testEqualsAndHashCode() {
UnknownFieldSet.Field fixed32Field = Field.newBuilder().addFixed32(1).build();
UnknownFieldSet.Field fixed64Field = Field.newBuilder().addFixed64(1).build();
UnknownFieldSet.Field varIntField = Field.newBuilder().addVarint(1).build();
UnknownFieldSet.Field lengthDelimitedField = Field.newBuilder().addLengthDelimited(EMPTY).build();
UnknownFieldSet.Field groupField = Field.newBuilder().addGroup(unknownFields).build();
UnknownFieldSet a = UnknownFieldSet.newBuilder().addField(1, fixed32Field).build();
UnknownFieldSet b = UnknownFieldSet.newBuilder().addField(1, fixed64Field).build();
UnknownFieldSet c = UnknownFieldSet.newBuilder().addField(1, varIntField).build();
UnknownFieldSet d = UnknownFieldSet.newBuilder().addField(1, lengthDelimitedField).build();
UnknownFieldSet e = UnknownFieldSet.newBuilder().addField(1, groupField).build();
checkEqualsIsConsistent(a);
checkEqualsIsConsistent(b);
checkEqualsIsConsistent(c);
checkEqualsIsConsistent(d);
checkEqualsIsConsistent(e);
checkNotEqual(a, b);
checkNotEqual(a, c);
checkNotEqual(a, d);
checkNotEqual(a, e);
checkNotEqual(b, c);
checkNotEqual(b, d);
checkNotEqual(b, e);
checkNotEqual(c, d);
checkNotEqual(c, e);
checkNotEqual(d, e);
}
}
| [
"[email protected]"
] | |
e1e37a458958306479855ce1aef5ba218b4aa66d | 65e5dd0bd32e40aba013e2140c73b93112e89c42 | /api/ebayAPI/src/main/java/com/ebay/soap/eBLBaseComponents/SetSellingManagerItemAutomationRuleRequestType.java | cb63f8c30b17c1e93c018b4bd483f57babaf6df0 | [] | no_license | vancezhao/mocha | 732fb271da41ae3d897f9edba99f09f54924f93f | 1192a768509ba82eadfaaffc4e91df5ebac375b4 | refs/heads/master | 2016-09-05T17:19:03.251590 | 2013-12-08T11:47:36 | 2013-12-08T11:47:36 | 15,303,645 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,901 | java |
package com.ebay.soap.eBLBaseComponents;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* Revises, or adds to, the set of Selling Manager automation
* rules associated with an item.
* <br>
* <br>
* This call is subject to change without notice; the
* deprecation process is inapplicable to this call.
* <br>
* <br>
* Using this call, you can add an autolist rule.
* You also can add a second chance offer
* rule (restricted to auction items and auction templates).
* Note that autorelist rules can only be set on templates.
* An autorelist rule for an item is inherited from a template.
* <br>
* <br>
* This call also enables you to specify particular information about automation
* rules.
* <br>
* <br>
* If a node is not passed in the call, the setting for the corresponding
* automation rule remains unchanged.
* <br>
* <br>
* Although this call can revise (overwrite) an existing rule,
* this call cannot delete an automation rule.
* (Instead, use DeleteSellingManagerItemAutomationRule.)
*
*
* <p>Java class for SetSellingManagerItemAutomationRuleRequestType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="SetSellingManagerItemAutomationRuleRequestType">
* <complexContent>
* <extension base="{urn:ebay:apis:eBLBaseComponents}AbstractRequestType">
* <sequence>
* <element name="ItemID" type="{urn:ebay:apis:eBLBaseComponents}ItemIDType" minOccurs="0"/>
* <element name="AutomatedRelistingRule" type="{urn:ebay:apis:eBLBaseComponents}SellingManagerAutoRelistType" minOccurs="0"/>
* <element name="AutomatedSecondChanceOfferRule" type="{urn:ebay:apis:eBLBaseComponents}SellingManagerAutoSecondChanceOfferType" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SetSellingManagerItemAutomationRuleRequestType", propOrder = {
"itemID",
"automatedRelistingRule",
"automatedSecondChanceOfferRule"
})
public class SetSellingManagerItemAutomationRuleRequestType
extends AbstractRequestType
implements Serializable
{
private final static long serialVersionUID = 12343L;
@XmlElement(name = "ItemID")
protected String itemID;
@XmlElement(name = "AutomatedRelistingRule")
protected SellingManagerAutoRelistType automatedRelistingRule;
@XmlElement(name = "AutomatedSecondChanceOfferRule")
protected SellingManagerAutoSecondChanceOfferType automatedSecondChanceOfferRule;
/**
* Gets the value of the itemID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getItemID() {
return itemID;
}
/**
* Sets the value of the itemID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setItemID(String value) {
this.itemID = value;
}
/**
* Gets the value of the automatedRelistingRule property.
*
* @return
* possible object is
* {@link SellingManagerAutoRelistType }
*
*/
public SellingManagerAutoRelistType getAutomatedRelistingRule() {
return automatedRelistingRule;
}
/**
* Sets the value of the automatedRelistingRule property.
*
* @param value
* allowed object is
* {@link SellingManagerAutoRelistType }
*
*/
public void setAutomatedRelistingRule(SellingManagerAutoRelistType value) {
this.automatedRelistingRule = value;
}
/**
* Gets the value of the automatedSecondChanceOfferRule property.
*
* @return
* possible object is
* {@link SellingManagerAutoSecondChanceOfferType }
*
*/
public SellingManagerAutoSecondChanceOfferType getAutomatedSecondChanceOfferRule() {
return automatedSecondChanceOfferRule;
}
/**
* Sets the value of the automatedSecondChanceOfferRule property.
*
* @param value
* allowed object is
* {@link SellingManagerAutoSecondChanceOfferType }
*
*/
public void setAutomatedSecondChanceOfferRule(SellingManagerAutoSecondChanceOfferType value) {
this.automatedSecondChanceOfferRule = value;
}
}
| [
"[email protected]"
] | |
21f8b25c2ab77012ddbabed2f8bb5f8705dfae28 | e8ed57ce21a3de11159a46caa7a1810bf67c7f87 | /mybatisproject2/src/test/java/com/atguigu/test.java | 19235f85d6f9be5f9db3ff2ae1b59db8ed419aed | [] | no_license | chenhuagithub/IdeaProjects | 019d68ee1c196ecf9ab3107dc86c45aae097bd82 | ded676200c5304a803956ee19494a5565aba509d | refs/heads/master | 2022-12-21T03:55:25.464394 | 2019-10-15T12:26:24 | 2019-10-15T12:26:24 | 215,286,684 | 0 | 0 | null | 2022-12-16T09:00:01 | 2019-10-15T11:54:49 | Java | UTF-8 | Java | false | false | 15,162 | java | package com.atguigu;
import com.atguigu.bean.Department;
import com.atguigu.bean.Employee;
import com.atguigu.dao.DepartmentMapper;
import com.atguigu.dao.EmployeeMapper;
import com.atguigu.dao.EmployeeMapperAnnotation;
import com.atguigu.dao.EmployeeMapperPlus;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class test {
@Test
public void test01() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
Employee employee = sqlSession.selectOne("EmpById", 1);
System.out.println(employee.getEmail());
System.out.println(employee.getLastName());
}finally {
sqlSession.close();
}
}
@Test
public void test02() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
EmployeeMapper mapper = sqlSession.getMapper(EmployeeMapper.class);
Employee employee = mapper.EmpById(1,"huazai");
System.out.println(employee.getId());
System.out.println(employee.getLastName());
System.out.println(employee.getGender());
System.out.println(employee.getEmail());
System.out.println(employee.toString());
}
@Test
public void test03() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
EmployeeMapperAnnotation mapper = sqlSession.getMapper(EmployeeMapperAnnotation.class);
Employee empById = mapper.getEmpById(1);
System.out.println(empById.getLastName());
}
@Test
public void test04() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapper mapper = sqlSession.getMapper(EmployeeMapper.class);
Employee employee = new Employee(null, "jerry", "n", "[email protected]");
mapper.addEmp(employee);
System.out.println(employee.getId());
//提交数据
sqlSession.commit();
}finally {
sqlSession.close();
}
}
@Test
public void delete_demo() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapper mapper = sqlSession.getMapper(EmployeeMapper.class);
mapper.deleteEmpById(4);
sqlSession.commit();
}finally {
sqlSession.close();
}
}
@Test
public void update_demo() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapper mapper = sqlSession.getMapper(EmployeeMapper.class);
Employee employee = new Employee(1, "huazai", "nv", "[email protected]");
mapper.updateEmp(employee);
sqlSession.commit();
}finally {
sqlSession.close();
}
}
@Test
public void selectByMap() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapper mapper = sqlSession.getMapper(EmployeeMapper.class);
Map<String, Object> map = new HashMap<>();
map.put("id", 1);
map.put("lastName", "huazai");
map.put("tablename","tbl_employee");
Employee employee = mapper.EmpByMap(map);
System.out.println(employee.getId());
System.out.println(employee.getLastName());
System.out.println(employee.getGender());
System.out.println(employee.getEmail());
}finally {
sqlSession.close();
}
}
// 查询结果返回集合
@Test
public void returnList() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
EmployeeMapper mapper = sqlSession.getMapper(EmployeeMapper.class);
List<Employee> je = mapper.selectByLastName("%e%");
System.out.println(je.getClass());
for(Employee em : je){
System.out.println(em.getId()+" "+em.getLastName()+" "+em.getGender()+" "+em.getEmail());
}
}finally {
sqlSession.close();
}
}
@Test
public void selectByIdReturnMap() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapper mapper = sqlSession.getMapper(EmployeeMapper.class);
Map<String, Object> stringObjectMap = mapper.selectByIdReturnMap(1);
System.out.println(stringObjectMap);
}finally {
sqlSession.close();
}
}
@Test
public void selectByIdReturnMoreMap() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapper mapper = sqlSession.getMapper(EmployeeMapper.class);
Map<String, Employee> integerEmployeeMap = mapper.selectByIdReturnMoreMap("%e%");
System.out.println(integerEmployeeMap);
Collection<Employee> values = integerEmployeeMap.values();
System.out.println(values);
for(Employee e : values){
System.out.println(e.getId()+" "+e.getLastName()+" "+e.getGender()+" "+e.getEmail());
}
}finally {
sqlSession.close();
}
}
@Test
public void selectByIdResutlMap() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapperPlus mapper = sqlSession.getMapper(EmployeeMapperPlus.class);
Employee empByIdMapResult = mapper.getEmpByIdMapResult(1);
System.out.println(empByIdMapResult.getLastName()+" "+empByIdMapResult.getGender()+" "+empByIdMapResult.getEmail());
}finally {
sqlSession.close();
}
}
@Test
public void SelectByIdOnetoManyResultMap() throws IOException{
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapperPlus mapper = sqlSession.getMapper(EmployeeMapperPlus.class);
Map<String, Object> empByIdOneToManyMapResult = mapper.getEmpByIdOneToManyMapResult(1);
System.out.println("empByIdOneToManyMapResult = " + empByIdOneToManyMapResult);
}finally {
sqlSession.close();
}
}
@Test
public void SelectByIdOnetoManyResultMap2() throws IOException{
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapperPlus mapper = sqlSession.getMapper(EmployeeMapperPlus.class);
Employee empByIdOneToManyMapResult2 = mapper.getEmpByIdOneToManyMapResult2(3 );
System.out.println("empByIdOneToManyMapResult2 = " + empByIdOneToManyMapResult2);
}finally {
sqlSession.close();
}
}
@Test
public void test10() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapperPlus mapper = sqlSession.getMapper(EmployeeMapperPlus.class);
Employee byId = mapper.getById(1);
// System.out.println(byId.getLastName());
System.out.println("byId = " + byId);
}finally {
sqlSession.close();
}
}
@Test
public void test11() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapperPlus mapper = sqlSession.getMapper(EmployeeMapperPlus.class);
Employee byId = mapper.getById(3);
System.out.println(byId.getLastName());
System.out.println(byId.getDepartment().getDepartmentName());
// System.out.println("byId = " + byId);
}finally {
sqlSession.close();
}
}
@Test
public void test12() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapperPlus mapper = sqlSession.getMapper(EmployeeMapperPlus.class);
Employee byId2 = mapper.getById2(1);
System.out.println("byId2 = " + byId2);
}finally {
sqlSession.close();
}
}
@Test
public void test13() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
DepartmentMapper mapper = sqlSession.getMapper(DepartmentMapper.class);
Department byId3 = mapper.getById3(2);
System.out.println("byId3 = " + byId3);
}finally {
sqlSession.close();
}
}
@Test
public void oneToMany() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
DepartmentMapper mapper = sqlSession.getMapper(DepartmentMapper.class);
Department byIdPlus = mapper.getByIdPlus(1);
System.out.println("byIdPlus = " + byIdPlus);
}finally {
sqlSession.close();
}
}
@Test
public void OneToManyStep() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
DepartmentMapper mapper = sqlSession.getMapper(DepartmentMapper.class);
Department byIdStep = mapper.getByIdStep(1);
// System.out.println("byIdStep = " + byIdStep);
System.out.println(byIdStep.getDepartmentName());
System.out.println(byIdStep.getEmployees());
}finally {
sqlSession.close();
}
}
@Test
public void test15() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
EmployeeMapper mapper = sqlSession.getMapper(EmployeeMapper.class);
Employee byIdDis = mapper.getByIdDis(1);
System.out.println("byIdDis = " + byIdDis);
}finally {
sqlSession.close();
}
}
@Test
public void test16() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
DepartmentMapper mapper = sqlSession.getMapper(DepartmentMapper.class);
Department byId = mapper.getById(1);
System.out.println("byId = " + byId);
}finally {
sqlSession.close();
}
}
}
| [
"[email protected]"
] | |
9e33fd7cdd67db4e85742442e00d046474af43c8 | 87f52fe7c7d214944d2cd7a3d6967a7e88843ed8 | /2/src/main/java/com/serhii/dao/CustomerDAO.java | 24bb0bc6f5e68e4a43fbaeeba9cbe5de22fcd866 | [] | no_license | SergiiCini/Spring | 5640cad3aefdbfdb14807c8be64e43a4d51c9d0f | ac34986fa8da0fa52b8b00bf15d752b5fc24704d | refs/heads/master | 2023-06-04T17:41:07.595347 | 2021-06-29T20:21:34 | 2021-06-29T20:21:34 | 367,393,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 830 | java | package com.serhii.dao;
import com.serhii.entity.Account;
import com.serhii.entity.Customer;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.List;
public interface CustomerDAO {
public long generateId();
public Customer save(Customer customer);
public Customer delete(Customer customer);
public void deleteAll(List<Customer> entities);
public void saveAll(List<Customer> entities);
public List<Customer> findAll();
public Customer deleteById(long id);
public Customer getOne(long id);
public Customer modify (long id, Customer customer);
public Customer addAccount(long customerId, long accountId);
public List<Long> deleteAccount(Account account);
public Customer getCustomerByAccountId(long id);
}
| [
"[email protected]"
] | |
d469915bcca55d2c7ef9ee0d6b1ee765e4a942b2 | a654618dffa7031f2f16dd8da85f11c9a4f389a4 | /Java-Games/minecraft-project-aww_man-master/src/main/java/com/aww_man/Teleportation/blocks/MythrilBlock.java | 1c0268a146e1712a3ec8750430df0c058f664bd7 | [] | no_license | SoftWal/Projects | 0453471cc2259b8b9a8c4c2b8df865207d01abcd | a04f4469a138059cd0319581420a31e3f0d530c5 | refs/heads/master | 2023-01-14T14:31:40.722467 | 2020-11-29T10:54:51 | 2020-11-29T10:54:51 | 298,826,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.aww_man.Teleportation.blocks;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
public class MythrilBlock extends BlockBase{
public MythrilBlock(String name, Material material) {
super(name, material);
setSoundType(SoundType.METAL);
setHardness(5.0f);
setResistance(15.0f);
setHarvestLevel("pickaxe",3);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.