예제 #1
0
// Validate ... validate the value against standard Section 9.1
func (number Number) Validate() bool {
	// See standard Section 7.4
	ret := true

	if number.value == "" {
		ret = false
	} else {
		// divide into whole numbers and tenths
		n := strings.Split(number.value, ".")

		if len(n) > 3 || len(n) < 0 {
			ret = false
		} else {
			if validation.ValidateInt(n[0]) &&
				validation.CheckRange(n[0], 0, 9999) {
				if len(n) == 2 && (!validation.ValidateInt(n[1]) ||
					!validation.CheckRange(n[1], 0, 9)) {
					ret = false
				}
			} else {
				ret = false
			}
		}
	}

	if ret != true {
		log.Println("Failed to validate cue '" + number.value + "'")
	}
	return ret
}
예제 #2
0
// Validate ... validate this element
func (minutes Minutes) Validate() bool {
	ret := true
	if !validation.ValidateInt(minutes.value) ||
		!validation.CheckRange(minutes.value, 0, 99) {
		ret = false
	}
	return ret
}
예제 #3
0
// Validate ... validate this element
func (hours Hours) Validate() bool {
	ret := true
	if !validation.ValidateInt(hours.value) ||
		!validation.CheckRange(hours.value, 0, 99) {
		ret = false
	}
	return ret
}
예제 #4
0
// Validate ... validate this element
func (seconds Seconds) Validate() bool {
	ret := true
	value := seconds.value
	if strings.Contains(value, ".") {
		s := strings.Split(value, ".")
		value = s[0]

		if !validation.ValidateInt(s[1]) || !validation.CheckRange(s[1], 0, 9) {
			ret = false
		}
	}

	if !validation.ValidateInt(value) ||
		!validation.CheckRange(value, 0, 99) {
		ret = false
	}
	return ret
}
예제 #5
0
// Validate ... validate the value against standard Section 10.5
func (part Part) Validate() bool {
	ret := true

	if !validation.ValidateInt(part.value) ||
		!validation.CheckRange(part.value, 0, 99) {
		ret = false
	}

	if ret != true {
		log.Println("Failed to validate part '" + part.value + "'")
	}
	return ret
}
예제 #6
0
// Validate ... validate this element
func (link Link) Validate() bool {
	ret := true

	if !validation.ValidateInt(link.value) ||
		!validation.CheckRange(link.value, 0, 9) {
		ret = false
	}

	if ret != true {
		log.Println("Failed to validate link '" + link.value + "'")
	}
	return ret
}