Search in sources :

Example 6 with Date

use of com.google.api.ads.admanager.jaxws.v202205.Date in project jasn1 by openmuc.

the class ModulesTest method encodingDecoding.

@Test
public void encodingDecoding() throws IOException {
    ReverseByteArrayOutputStream berOS = new ReverseByteArrayOutputStream(1000);
    MyDate1 dateOfHire = new MyDate1();
    dateOfHire.value = "19710917".getBytes(UTF_8);
    dateOfHire.encode(berOS, true);
    MyInt2 myInt2Encode = new MyInt2(2);
    berOS.reset();
    myInt2Encode.encode(berOS, true);
    MyInt2 myInt2Decode = new MyInt2();
    byte[] code = HexString.toBytes("a303020102");
    InputStream is = new ByteArrayInputStream(code);
    myInt2Decode.decode(is, true);
    assertEquals(myInt2Decode.value.intValue(), 2);
    PersonnelRecord pr = new PersonnelRecord();
    Name name = new Name();
    name.setGivenName(new BerVisibleString("givenName".getBytes(UTF_8)));
    name.setFamilyName(new BerVisibleString("familyName".getBytes(UTF_8)));
    name.setInitial(new BerVisibleString("initial".getBytes(UTF_8)));
    pr.setName(name);
    pr.setTitle(new BerVisibleString("title".getBytes(UTF_8)));
    pr.setNumber(new EmployeeNumberZ(1));
    pr.setDateOfHire(new Date("23121981".getBytes(UTF_8)));
    pr.setNameOfSpouse(name);
    ChildInformation child = new ChildInformation();
    child.setName(new Name("child name".getBytes(UTF_8)));
    child.setDateOfBirth(new Date("12121912".getBytes(UTF_8)));
    PersonnelRecord.Children children = new PersonnelRecord.Children();
    List<ChildInformation> childInformation = children.getChildInformation();
    childInformation.add(child);
    childInformation.add(child);
    pr.setTestBitString(new MyBitString(new byte[] { (byte) 0x80, (byte) 0xff }, 10));
    pr.setTest(new MyInt(3));
    TestChoice testChoice = new TestChoice();
    testChoice.setChoiceElement1(child);
    pr.setTest2(testChoice);
    pr.setTest3(testChoice);
    pr.setTest4(testChoice);
    pr.setTest5(testChoice);
    pr.setTest6(testChoice);
    TestSequenceOf testSequenceOf = new TestSequenceOf();
    List<BerInteger> berIntegers = testSequenceOf.getBerInteger();
    for (int i = 0; i < 10; i++) {
        berIntegers.add(new BerInteger(i));
    }
    pr.setTestSequenceOf(testSequenceOf);
    PersonnelRecord.TestSequenceOf2 testSequenceOf2 = new PersonnelRecord.TestSequenceOf2();
    List<PersonnelRecord.TestSequenceOf2.SEQUENCE> sequences = testSequenceOf2.getSEQUENCE();
    for (int i = 0; i < 10; i++) {
        PersonnelRecord.TestSequenceOf2.SEQUENCE sequence = new PersonnelRecord.TestSequenceOf2.SEQUENCE();
        sequence.setTest1(new BerInteger(i++));
        sequence.setTest2(new BerInteger(i));
        sequences.add(sequence);
    }
    pr.setTestSequenceOf2(testSequenceOf2);
    BerEmbeddedPdv berEmbeddedPdv = new BerEmbeddedPdv();
    pr.setEmbeddedPdv(berEmbeddedPdv);
}
Also used : PersonnelRecord(com.beanit.asn1bean.compiler.modules.module1.PersonnelRecord) EmployeeNumberZ(com.beanit.asn1bean.compiler.modules.module2.EmployeeNumberZ) ReverseByteArrayOutputStream(com.beanit.asn1bean.ber.ReverseByteArrayOutputStream) Name(com.beanit.asn1bean.compiler.modules.module1.Name) BerEmbeddedPdv(com.beanit.asn1bean.ber.types.BerEmbeddedPdv) BerVisibleString(com.beanit.asn1bean.ber.types.string.BerVisibleString) MyBitString(com.beanit.asn1bean.compiler.modules.module1.MyBitString) ChildInformation(com.beanit.asn1bean.compiler.modules.module1.ChildInformation) TestSequenceOf(com.beanit.asn1bean.compiler.modules.module1.TestSequenceOf) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) TestChoice(com.beanit.asn1bean.compiler.modules.module1.TestChoice) BerInteger(com.beanit.asn1bean.ber.types.BerInteger) Date(com.beanit.asn1bean.compiler.modules.module1.Date) MyDate1(com.beanit.asn1bean.compiler.modules.module1.MyDate1) ByteArrayInputStream(java.io.ByteArrayInputStream) MyInt(com.beanit.asn1bean.compiler.modules.module1.MyInt) MyInt2(com.beanit.asn1bean.compiler.modules.module1.MyInt2) Test(org.junit.jupiter.api.Test)

Example 7 with Date

use of com.google.api.ads.admanager.jaxws.v202205.Date in project algorithms-sedgewick-wayne by reneargento.

the class Exercise13 method main.

public static void main(String[] args) {
    Date date = new Date(8, 3, 2016);
    Exercise13 transaction = new Exercise13("Rene", date, 500);
    StdOut.println(transaction);
    StdOut.println("Expected: Rene spent 500.0 on 8/3/2016");
}
Also used : Date(edu.princeton.cs.algs4.Date)

Example 8 with Date

use of com.google.api.ads.admanager.jaxws.v202205.Date in project algorithms-sedgewick-wayne by reneargento.

the class Exercise14 method main.

public static void main(String[] args) {
    Date date = new Date(8, 3, 2016);
    Exercise14 transaction1 = new Exercise14("Rene", date, 500);
    Exercise14 transaction2 = new Exercise14("Rene", date, 500);
    Exercise14 transaction3 = new Exercise14("Argento", date, 600);
    Exercise14 transaction4 = transaction3;
    StdOut.println("Equals 1: " + transaction1.equals(transaction2) + " Expected: true");
    StdOut.println("Equals 2: " + transaction2.equals(transaction1) + " Expected: true");
    StdOut.println("Equals 3: " + transaction1.equals(transaction3) + " Expected: false");
    StdOut.println("Equals 4: " + transaction3.equals(transaction4) + " Expected: true");
}
Also used : Date(edu.princeton.cs.algs4.Date)

Example 9 with Date

use of com.google.api.ads.admanager.jaxws.v202205.Date in project algorithms-sedgewick-wayne by reneargento.

the class Exercise33_RandomTransactions method generateRandomTransactions.

private Exercise21_ComparableTransactions[] generateRandomTransactions(int numberOfObjects) {
    Exercise21_ComparableTransactions[] transactions = new Exercise21_ComparableTransactions[numberOfObjects];
    for (int i = 0; i < numberOfObjects; i++) {
        String who = "Client " + (i + 1);
        int month = StdRandom.uniform(12) + 1;
        int maxDay = month == 2 ? 28 : 30;
        int day = StdRandom.uniform(maxDay) + 1;
        int year = StdRandom.uniform(1900, 2018);
        Date date = new Date(month, day, year);
        double amount = (double) Math.round(StdRandom.uniform(0.0, 1000000.0) * 100) / 100;
        Exercise21_ComparableTransactions transaction = new Exercise21_ComparableTransactions(who, date, amount);
        transactions[i] = transaction;
    }
    return transactions;
}
Also used : Date(edu.princeton.cs.algs4.Date) Exercise21_ComparableTransactions(chapter2.section1.Exercise21_ComparableTransactions)

Example 10 with Date

use of com.google.api.ads.admanager.jaxws.v202205.Date in project algorithms-sedgewick-wayne by reneargento.

the class Exercise25_HashCache method main.

public static void main(String[] args) {
    Exercise25_HashCache hashCache = new Exercise25_HashCache();
    Transaction transaction = hashCache.new Transaction("Person 1", new Date(1, 10, 5), 1000);
    StdOut.println(transaction.hashCode() + " Expected: Cache miss");
    StdOut.println(transaction.hashCode() + " Expected: Cache hit");
    StdOut.println(transaction.hashCode() + " Expected: Cache hit");
}
Also used : Date(edu.princeton.cs.algs4.Date)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)20 Set (java.util.Set)10 Before (org.junit.Before)10 Test (org.junit.Test)9 Date (edu.princeton.cs.algs4.Date)7 Date (com.google.api.ads.admanager.axis.v202108.Date)5 Date (com.google.api.ads.admanager.axis.v202111.Date)5 Date (com.google.api.ads.admanager.axis.v202202.Date)5 Date (com.google.api.ads.admanager.axis.v202205.Date)5 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Bigint (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Bigint)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Binary (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Binary)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Blob (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Blob)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Boolean (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Boolean)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Char (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Char)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Clob (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Clob)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Date (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Date)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Datetime (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Datetime)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Decimal (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Decimal)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Double (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Double)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Float (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Float)4