示例#1
0
文件: main.go 项目: CaptainSoOmA/Uni
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)
	}
}
示例#2
0
文件: main.go 项目: CaptainSoOmA/Uni
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)
	}
}
示例#3
0
文件: main.go 项目: CaptainSoOmA/Uni
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
}
示例#4
0
文件: imp.go 项目: CaptainSoOmA/Uni
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)
  }
}
示例#5
0
文件: imp.go 项目: CaptainSoOmA/Uni
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
}
示例#6
0
文件: imp.go 项目: CaptainSoOmA/Uni
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
}
示例#7
0
文件: imp.go 项目: CaptainSoOmA/Uni
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)
}
示例#8
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (x *Imp) Set(d *day.Imp, t *clk.Imp) {
	//
	x.day = d.Clone().(*day.Imp)
	x.time = t.Clone().(*clk.Imp)
}
示例#9
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (x *Imp) Set(d *day.Imp) {
	//
	x.Imp = d.Clone().(*day.Imp)
	x.list.Clr()
}