Пример #1
0
func (x *Imp) String() string {
	//
	s := ""
	if x.prefix > 0 {
		s = nat.String(uint(x.prefix))
		s = "0" + s
	}
	if x.number > 0 {
		t := nat.String(x.number)
		n := len(t)
		switch n {
		case 4, 5:
			t = t[0:n-2] + " " + t[n-2:]
		case 6, 7:
			t = t[0:n-4] + " " + t[n-4:n-2] + " " + t[n-2:]
		case 8, 9:
			t = t[0:n-5] + " " + t[n-5:n-3] + " " + t[n-3:]
		}
		if x.prefix == 0 {
			s = t
		} else {
			s = s + " " + t
		}
	}
	str.Norm(&s, width)
	return s
}
Пример #2
0
func error2Pos(s string, n uint, s1 string, n1 uint, l, c uint) {
	//
	str.Lat1(&s)
	str.Lat1(&s1)
	if n > 0 {
		s = s + " " + nat.String(n)
	}
	if n1 > 0 {
		s1 = s1 + " " + nat.String(n1)
	}
	errorPos(s+s1, 0, l, c)
}
Пример #3
0
func error2(s string, n uint, s1 string, n1 uint) {
	//
	str.Lat1(&s)
	str.Lat1(&s1)
	if n > 0 {
		s = s + " " + nat.String(n)
	}
	if n1 > 0 {
		s1 = s1 + " " + nat.String(n1)
	}
	error(s+" "+s1, 0)
}
Пример #4
0
func string_(z int) string {
	//
	s := ""
	if z < 0 {
		s = "-"
		z = -z
	}
	return s + nat.String(uint(z))
}
Пример #5
0
func suchen() {
	//
	/*
	   const
	     maxU = 8
	   var (
	     startlinie, ziellinie [maxU]Linie
	     startnummer, zielnummer [maxU]uint
	     n, imin, kmin uint
	   )
	   t1, t2:= netz.Get2 ()
	   bhf1, bhf2:= t1.(*bahnhof.Imp), t2.(*bahnhof.Imp)
	   startlinie [0], startnummer [0] = bhf1.Linie (), bhf1.Nummer ()
	   ziellinie [0], zielnummer [0] = bhf2.Linie (), bhf2.Nummer ()
	   ss, zz:= 1, 1
	   netz.Trav (func (a Any) {
	                bhf:= a.(*bahnhof.Imp)
	                if bhf.Equiv (bhf1) {
	                  startlinie [ss], startnummer [ss] = bhf.Linie (), bhf.Nummer ()
	                  ss ++
	                } else if bhf.Equiv (bhf2) {
	                  ziellinie [zz], zielnummer [zz] = bhf.Linie (), bhf.Nummer ()
	                  zz ++
	                }
	             })
	   nmin:= uint(ker.MaxNat)
	   for i:= 0; i < ss; i++ {
	     for k:= 0; k < zz; k++ {
	       l, n:= startlinie [i], startnummer [i]
	       l1, n1:= ziellinie [k], zielnummer [k]
	       if ! netz.ExPred2 (func (a Any) bool { b:= a.(*bahnhof.Imp); return b.Linie() == l && b.Nummer() == n },
	                          func (a Any) bool { b:= a.(*bahnhof.Imp); return b.Linie() == l1 && b.Nummer() == n1 }) {
	         ker.Stop (pack, 4)
	       }
	       netz.Actualize ()
	       n = netz.LenAct ()
	       if n < nmin {
	         nmin = n
	         imin, kmin = uint(i), uint(k)
	       }
	     }
	   }
	   l, n:= startlinie [imin], startnummer [imin]
	   l1, n1:= ziellinie [kmin], zielnummer [kmin]
	   if ! netz.ExPred2 (func (a Any) bool { b:= a.(*bahnhof.Imp); return b.Linie() == l && b.Nummer() == n },
	                      func (a Any) bool { b:= a.(*bahnhof.Imp); return b.Linie() == l1 && b.Nummer() == n1 }) {
	     ker.Stop (pack, 5)
	   }
	*/
	netz.Actualize()
	write(true)
	scr.Colours(col.HintF, col.HintB)
	scr.SwitchTransparence(false)
	na := netz.LenAct()
	scr.Write("kürzeste Verbindung "+nat.String(na)+" Minuten", 0, 0)
	scr.SwitchTransparence(true)
}
Пример #6
0
func error(s string, n uint) {
	//
	pre()
	if n > 0 {
		s += " " + nat.String(n) + " "
	}
	str.Lat1(&s)
	str.Center(&s, NColumns())
	l := NLines() - 1
	Save(l, 0, NColumns(), 1)
	errorbox.Wd(NColumns())
	errorbox.Write(s, l, 0)
	kbd.Wait(false)
	Restore(l, 0, NColumns(), 1)
	post()
}
Пример #7
0
func errorPos(s string, n, l, c uint) {
	//
	pre()
	str.Lat1(&s)
	if n > 0 {
		s = s + " " + nat.String(n)
	}
	if l >= NLines() {
		l = NLines() - 1
	}
	w := uint(len(s))
	if c+w >= NColumns() {
		c = NColumns() - w
	}
	Save(l, c, w, 1)
	errorbox.Wd(w)
	errorbox.Write(s, l, c)
	kbd.Wait(false)
	Restore(l, c, w, 1)
	post()
}
Пример #8
0
func (x *Imp) String() string {
	//
	x.Imp.SetFormat(x.Format)
	return x.Imp.String() + string(separator) + nat.String(uint(x.port))
}