Exemplo n.º 1
0
func clearAll(D *day.Imp) {
	//
	switch period {
	case day.Monthly, day.Weekly:
		if D.Empty() {
			return
		}
	default:
		return
	}
	D1 := day.New()
	D1.Copy(D)
	D1.SetBeginning(period)
	cal.SetFormat(period)
	for D.Equiv(D1, period) {
		l, c := pos(D1)
		errh.Error("Tag Nr.", D1.OrdDay())
		cal.ClearDay(D1, l0+l, c0+c)
		D1.Inc(day.Daily)
	}
}
Exemplo n.º 2
0
func writeAll(D *day.Imp) {
	//
	switch period {
	case day.Monthly, day.Weekly:
		if D.Empty() {
			return
		}
	default:
		return
	}
	D1 := day.New()
	D1.Copy(D)
	D1.SetBeginning(period)
	cal.SetFormat(period)
	for D.Equiv(D1, period) {
		l, c := pos(D1)
		cal.Seek(D1)
		cal.SetFormat(period) // weil Seek über Define <- Clone das Format mitkopiert
		cal.WriteDay(l0+l, c0+c)
		D1.Inc(day.Daily)
	}
}
Exemplo n.º 3
0
func pos(D *day.Imp) (uint, uint) {
	//
	switch period {
	case day.Yearly:
		return D.PosInYear()
	case day.Monthly:
		return D.PosInMonth(true, 1, 3, dc)
	case day.Weekly:
		return D.PosInWeek(false, dc)
	}
	return 0, 0
}
Exemplo n.º 4
0
func (x *Imp) monday (d *day.Imp, n uint) {
//
  w:= x.numWeeks ()
  if n == 0 || n > w {
    d.Clr()
    return
  }
  x.lectures (d, tmp)
  for i:= uint(0); i + 1 < n; i++ {
    d.Inc (day.Weekly)
  }
  if ! x.summer () && n > 10 { // Akademische Ferien
    d.Inc (day.Weekly)
    d.Inc (day.Weekly)
  }
}
Exemplo n.º 5
0
func (x *Imp) lectureDay (d *day.Imp) bool {
//
  summer:= x.summer ()
  x.lectures (tmp1, tmp2)
  if d.Less (tmp1) || tmp2.Less (d) || d.IsHoliday () {
    return false
  }
  if ! summer {
    tmp.Copy (tmp1) // Beginn Akademische Ferien:
    for i:= uint(0); i < 10; i++ { tmp.Inc (day.Weekly) }
// tmp.Write (10, 0)
    tmp2.Copy (tmp) // Vorlesungsbeginn Januar:
    for i:= uint(0); i < 2; i++ { tmp2.Inc (day.Weekly) }
// tmp2.Write (10, 0)
    if tmp.Eq(d) || tmp.Less (d) && d.Less (tmp2) {
      return false
    }
  }
  return true
}
Exemplo n.º 6
0
func (x *Imp) lectures (b, e *day.Imp) {
//
  x.semester (b, e)
  y:= x.Year () % 100
  w:= uint(14)
  if x.summer () {
    b.Set (14, 4, y)
  } else {
    b.Set (18, 10, y)
    w += 2 + 2 // Weihnachtsferien
  }
  for ! b.IsBeginning (day.Weekly) {
    b.Dec (day.Daily)
  }
  e.Copy (b)
  for i:= uint(0); i < w; i++ {
    e.Inc (day.Weekly)
  }
  e.Dec (day.Daily)
  e.Dec (day.Daily) // Saturday
}
Exemplo n.º 7
0
func (x *Imp) semester (b, e *day.Imp) {
//
  y:= x.Year () % 100
  tmp.Set (1, 4, y)
  if x.Imp.Less (tmp) {
    b.Set (1, 10, y); b.Dec (day.Yearly)
    e.Set (1,  4, y)
  } else {
    tmp.Set (1, 10, y)
    if x.Imp.Less (tmp) {
      b.Set (1,  4, y)
      e.Set (1, 10, y)
    } else {
      b.Set (1, 10, y)
      e.Set (1,  4, y); e.Inc (day.Yearly)
    }
  }
  e.Dec (day.Daily)
}
Exemplo n.º 8
0
func (x *Imp) Set(d *day.Imp, t *clk.Imp) {
	//
	x.day = d.Clone().(*day.Imp)
	x.time = t.Clone().(*clk.Imp)
}
Exemplo n.º 9
0
func (x *Imp) Set(d *day.Imp) {
	//
	x.Imp = d.Clone().(*day.Imp)
	x.list.Clr()
}