Search in sources :

Example 21 with Date

use of com.google.api.ads.admanager.axis.v202111.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)

Example 22 with Date

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

the class Exercise16 method main.

public static void main(String[] args) {
    String dateFilePath = args[0];
    Date[] dates = readAllDates(dateFilePath);
    for (Date date : dates) {
        StdOut.println(date);
    }
}
Also used : Date(edu.princeton.cs.algs4.Date)

Example 23 with Date

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

the class Exercise16 method readAllDates.

private static Date[] readAllDates(String fileName) {
    In in = new In(fileName);
    Queue<Date> queue = new Queue<>();
    while (!in.isEmpty()) {
        queue.enqueue(new Date(in.readString()));
    }
    int n = queue.size();
    Date[] dates = new Date[n];
    for (int i = 0; i < n; i++) {
        dates[i] = queue.dequeue();
    }
    return dates;
}
Also used : In(edu.princeton.cs.algs4.In) Queue(edu.princeton.cs.algs4.Queue) Date(edu.princeton.cs.algs4.Date)

Example 24 with Date

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

the class Exercise19_2_Parsing method main.

public static void main(String[] args) {
    Date date = new Date(8, 5, 2016);
    Exercise19_2_Parsing transaction = new Exercise19_2_Parsing("Turing", date, 22.10);
    StdOut.println(transaction);
    StdOut.println("Expected: Turing spent 22.1 on 8/5/2016");
}
Also used : Date(edu.princeton.cs.algs4.Date)

Example 25 with Date

use of com.google.api.ads.admanager.axis.v202111.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();
    // MyDate1 dateOfHire = new MyDate1("19710917");
    dateOfHire.value = new String("19710917").getBytes();
    dateOfHire.encode(berOS, true);
    MyInt2 myInt2Encode = new MyInt2(2);
    berOS.reset();
    myInt2Encode.encode(berOS, true);
    MyInt2 myInt2Decode = new MyInt2();
    byte[] code = HexConverter.fromShortHexString("a303020102");
    InputStream is = new ByteArrayInputStream(code);
    myInt2Decode.decode(is, true);
    Assert.assertEquals(myInt2Decode.value.intValue(), 2);
    PersonnelRecord pr = new PersonnelRecord();
    Name name = new Name();
    name.setGivenName(new BerVisibleString("givenName".getBytes()));
    name.setFamilyName(new BerVisibleString("familyName".getBytes()));
    name.setInitial(new BerVisibleString("initial".getBytes()));
    pr.setName(name);
    pr.setTitle(new BerVisibleString("title".getBytes()));
    pr.setNumber(new EmployeeNumberZ(1));
    pr.setDateOfHire(new Date("23121981".getBytes()));
    pr.setNameOfSpouse(name);
    ChildInformation child = new ChildInformation();
    child.setName(new Name("child name".getBytes()));
    child.setDateOfBirth(new Date("12121912".getBytes()));
    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);
    TestSequenceOf2 testSequenceOf2 = new TestSequenceOf2();
    List<SEQUENCE> sequences = testSequenceOf2.getSEQUENCE();
    for (int i = 0; i < 10; i++) {
        SEQUENCE sequence = new SEQUENCE();
        sequence.setTest1(new BerInteger(i++));
        sequence.setTest2(new BerInteger(i));
        sequences.add(sequence);
    }
    pr.setTestSequenceOf2(testSequenceOf2);
    BerEmbeddedPdv berEmbeddedPdv = new BerEmbeddedPdv();
    pr.setEmbeddedPdv(berEmbeddedPdv);
    System.out.println("PersonnelRecord.toString():\n" + pr);
}
Also used : BerVisibleString(org.openmuc.jasn1.ber.types.string.BerVisibleString) MyBitString(org.openmuc.jasn1.compiler.modules.module1.MyBitString) PersonnelRecord(org.openmuc.jasn1.compiler.modules.module1.PersonnelRecord) EmployeeNumberZ(org.openmuc.jasn1.compiler.modules.module2.EmployeeNumberZ) ReverseByteArrayOutputStream(org.openmuc.jasn1.ber.ReverseByteArrayOutputStream) Name(org.openmuc.jasn1.compiler.modules.module1.Name) BerEmbeddedPdv(org.openmuc.jasn1.ber.types.BerEmbeddedPdv) SEQUENCE(org.openmuc.jasn1.compiler.modules.module1.PersonnelRecord.TestSequenceOf2.SEQUENCE) BerVisibleString(org.openmuc.jasn1.ber.types.string.BerVisibleString) MyBitString(org.openmuc.jasn1.compiler.modules.module1.MyBitString) ChildInformation(org.openmuc.jasn1.compiler.modules.module1.ChildInformation) TestSequenceOf(org.openmuc.jasn1.compiler.modules.module1.TestSequenceOf) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) TestChoice(org.openmuc.jasn1.compiler.modules.module1.TestChoice) BerInteger(org.openmuc.jasn1.ber.types.BerInteger) TestSequenceOf2(org.openmuc.jasn1.compiler.modules.module1.PersonnelRecord.TestSequenceOf2) Date(org.openmuc.jasn1.compiler.modules.module1.Date) MyDate1(org.openmuc.jasn1.compiler.modules.module1.MyDate1) ByteArrayInputStream(java.io.ByteArrayInputStream) MyInt(org.openmuc.jasn1.compiler.modules.module1.MyInt) MyInt2(org.openmuc.jasn1.compiler.modules.module1.MyInt2) Test(org.junit.Test)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)16 Set (java.util.Set)8 Before (org.junit.Before)8 Test (org.junit.Test)8 ReportDownloader (com.google.api.ads.admanager.axis.utils.v202111.ReportDownloader)7 ReportDownloadOptions (com.google.api.ads.admanager.axis.v202111.ReportDownloadOptions)7 ReportJob (com.google.api.ads.admanager.axis.v202111.ReportJob)7 ReportQuery (com.google.api.ads.admanager.axis.v202111.ReportQuery)7 ReportServiceInterface (com.google.api.ads.admanager.axis.v202111.ReportServiceInterface)7 Date (edu.princeton.cs.algs4.Date)7 File (java.io.File)7 URL (java.net.URL)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 BooleanValue (com.google.api.ads.admanager.axis.v202108.BooleanValue)3 DateTimeValue (com.google.api.ads.admanager.axis.v202108.DateTimeValue)3 DateValue (com.google.api.ads.admanager.axis.v202108.DateValue)3 NumberValue (com.google.api.ads.admanager.axis.v202108.NumberValue)3 SetValue (com.google.api.ads.admanager.axis.v202108.SetValue)3