Package erjang

Examples of erjang.ETuple3


    }

  }

  static MatchFunction parse_MatchFunction(EObject fspec) {
    ETuple3 tup = ETuple3.cast(fspec);
    if (tup == null)
      throw ERT.badarg(fspec);

    ParseContext ctx = new ParseContext();
View Full Code Here


    long now = erjang.m.erlang.ErlBif.now_raw_micros();
    int micros = (int)(now % 1000000); now /= 1000000;
    int secs   = (int)(now % 1000000); now /= 1000000;
    int megas  = (int)now;

    ETuple3 res = new ETuple3();

    res.elem1 = ERT.box(megas);
    res.elem2 = ERT.box(secs);
    res.elem3 = ERT.box(micros);
View Full Code Here

    }
  }

  public void setopt(EObject head) {
   
    ETuple3 tup = ETuple3.cast(head);
    if (tup != null) {

      EInternalPID pid;
      if (tup.elem1 == Native.am_heir
          && (pid=tup.elem2.testInternalPID()) != null)
View Full Code Here

    long now = now_unique_micros();
    int micros = (int)(now % 1000000); now /= 1000000;
    int secs   = (int)(now % 1000000); now /= 1000000;
    int megas  = (int)now;

    ETuple3 res = new ETuple3();

    res.elem1 = ERT.box(megas);
    res.elem2 = ERT.box(secs);
    res.elem3 = ERT.box(micros);
View Full Code Here

  @BIF
  public static ETuple2 localtime()
  {
    Calendar c = GregorianCalendar.getInstance();
   
    ETuple3 date = new ETuple3();
    date.set(1, ERT.box(c.get(Calendar.YEAR)));
    date.set(2, ERT.box(c.get(Calendar.MONTH)-Calendar.JANUARY+1));
    date.set(3, ERT.box(c.get(Calendar.DAY_OF_MONTH)));
   
    ETuple3 time = new ETuple3();
    time.set(1, ERT.box(c.get(Calendar.HOUR_OF_DAY)));
    time.set(2, ERT.box(c.get(Calendar.MINUTE)));
    time.set(3, ERT.box(c.get(Calendar.SECOND)));
   
    return new ETuple2(date, time);
  }
View Full Code Here

  @BIF
  public static ETuple2 universaltime()
  {
    Calendar c = GregorianCalendar.getInstance(UTC_TIME_ZONE);
   
    ETuple3 date = new ETuple3();
    date.set(1, ERT.box(c.get(Calendar.YEAR)));
    date.set(2, ERT.box(c.get(Calendar.MONTH)-Calendar.JANUARY+1));
    date.set(3, ERT.box(c.get(Calendar.DAY_OF_MONTH)));
   
    ETuple3 time = new ETuple3();
    time.set(1, ERT.box(c.get(Calendar.HOUR_OF_DAY)));
    time.set(2, ERT.box(c.get(Calendar.MINUTE)));
    time.set(3, ERT.box(c.get(Calendar.SECOND)));
   
    return new ETuple2(date, time);
  }
View Full Code Here

  @BIF
  static public EObject localtime_to_universaltime(EObject a1, EObject a2)
  {
    ETuple2 dt;
    if ((dt=ETuple2.cast(a1)) != null) {
      ETuple3 date;
      ETuple3 time;
      ESmall year;
      ESmall month;
      ESmall day;
      ESmall hour;
      ESmall minute;
      ESmall sec;
      if (   (date=ETuple3.cast( dt.elem1 )) != null
        && (year = date.elem1.testSmall()) != null
        && (month = date.elem2.testSmall()) != null
        && (day = date.elem3.testSmall()) != null
       
        && (time=ETuple3.cast( dt.elem2 )) != null
        && (hour = time.elem1.testSmall()) != null
        && (minute = time.elem2.testSmall()) != null
        && (sec = time.elem3.testSmall()) != null
       
      ) {

        Calendar in_date = GregorianCalendar.getInstance();
        in_date.set(Calendar.YEAR, year.value);
        in_date.set(Calendar.MONTH, month.value-1+Calendar.JANUARY);
        in_date.set(Calendar.DAY_OF_MONTH, day.value);
       
        in_date.set(Calendar.HOUR_OF_DAY, hour.value);
        in_date.set(Calendar.MINUTE, minute.value);
        in_date.set(Calendar.SECOND, sec.value);
       
        Calendar out_date = GregorianCalendar.getInstance(UTC_TIME_ZONE);
        out_date.setTimeInMillis(in_date.getTimeInMillis());
       
        ETuple3 date2 = new ETuple3();
        date2.set(1, ERT.box(out_date.get(Calendar.YEAR)));
        date2.set(2, ERT.box(out_date.get(Calendar.MONTH)-Calendar.JANUARY+1));
        date2.set(3, ERT.box(out_date.get(Calendar.DAY_OF_MONTH)));
       
        ETuple3 time2 = new ETuple3();
        time2.set(1, ERT.box(out_date.get(Calendar.HOUR_OF_DAY)));
        time2.set(2, ERT.box(out_date.get(Calendar.MINUTE)));
        time2.set(3, ERT.box(out_date.get(Calendar.SECOND)));
       
        return new ETuple2(date2, time2);   
      }
    }
View Full Code Here

  @BIF
  static public EObject universaltime_to_localtime(EObject a1)
  {
    ETuple2 dt;
    if ((dt=ETuple2.cast(a1)) != null) {
      ETuple3 date;
      ETuple3 time;
      ESmall year;
      ESmall month;
      ESmall day;
      ESmall hour;
      ESmall minute;
      ESmall sec;
      if (   (date=ETuple3.cast( dt.elem1 )) != null
        && (year = date.elem1.testSmall()) != null
        && (month = date.elem2.testSmall()) != null
        && (day = date.elem3.testSmall()) != null
       
        && (time=ETuple3.cast( dt.elem2 )) != null
        && (hour = time.elem1.testSmall()) != null
        && (minute = time.elem2.testSmall()) != null
        && (sec = time.elem3.testSmall()) != null
       
      ) {

        Calendar in_date = GregorianCalendar.getInstance(UTC_TIME_ZONE);
        in_date.set(Calendar.YEAR, year.value);
        in_date.set(Calendar.MONTH, month.value-1+Calendar.JANUARY);
        in_date.set(Calendar.DAY_OF_MONTH, day.value);
       
        in_date.set(Calendar.HOUR_OF_DAY, hour.value);
        in_date.set(Calendar.MINUTE, minute.value);
        in_date.set(Calendar.SECOND, sec.value);
       
        Calendar out_date = GregorianCalendar.getInstance();
        out_date.setTimeInMillis(in_date.getTimeInMillis());
       
        ETuple3 date2 = new ETuple3();
        date2.set(1, ERT.box(out_date.get(Calendar.YEAR)));
        date2.set(2, ERT.box(out_date.get(Calendar.MONTH)-Calendar.JANUARY+1));
        date2.set(3, ERT.box(out_date.get(Calendar.DAY_OF_MONTH)));
       
        ETuple3 time2 = new ETuple3();
        time2.set(1, ERT.box(out_date.get(Calendar.HOUR_OF_DAY)));
        time2.set(2, ERT.box(out_date.get(Calendar.MINUTE)));
        time2.set(3, ERT.box(out_date.get(Calendar.SECOND)));
       
        return new ETuple2(date2, time2);   
      }
    }
View Full Code Here

    if (num == null) throw ERT.badarg(a1);
   
    Calendar out_date = GregorianCalendar.getInstance(UTC_TIME_ZONE);
    out_date.setTimeInMillis(num.longValue() * 1000L);
   
    ETuple3 date2 = new ETuple3();
    date2.set(1, ERT.box(out_date.get(Calendar.YEAR)));
    date2.set(2, ERT.box(out_date.get(Calendar.MONTH)-Calendar.JANUARY+1));
    date2.set(3, ERT.box(out_date.get(Calendar.DAY_OF_MONTH)));
   
    ETuple3 time2 = new ETuple3();
    time2.set(1, ERT.box(out_date.get(Calendar.HOUR_OF_DAY)));
    time2.set(2, ERT.box(out_date.get(Calendar.MINUTE)));
    time2.set(3, ERT.box(out_date.get(Calendar.SECOND)));
   
    return new ETuple2(date2, time2);   
  }
View Full Code Here

  @BIF
  static public EObject universaltime_to_posixtime(EObject a1)
  {
    ETuple2 dt;
    if ((dt=ETuple2.cast(a1)) != null) {
      ETuple3 date;
      ETuple3 time;
      ESmall year;
      ESmall month;
      ESmall day;
      ESmall hour;
      ESmall minute;
View Full Code Here

TOP

Related Classes of erjang.ETuple3

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.