// The element has become invalid.
340542
func (e *Element) setInvalidated(invalid bool) {
	e.lock.Lock()
	e.invalidated = invalid
	e.lock.Unlock()
}
533900
func (a *NameIDPolicy) Element() *etree.Element {
	el := etree.NewElement("samlp:NameIDPolicy")
	if a.Format != nil {
		el.CreateAttr("Format", *a.Format)
	}
	if a.SPNameQualifier != nil {
		el.CreateAttr("SPNameQualifier", *a.SPNameQualifier)
	}
	if a.AllowCreate != nil {
		el.CreateAttr("AllowCreate", strconv.FormatBool(*a.AllowCreate))
	}
	return el
}
56790
func (ck *MaintenanceWindow) Valid() error {
	if ck.Description == "" {
		return fmt.Errorf("Invalid value for `Description`.  Must contain non-empty string")
	}

	if ck.From == 0 {
		return fmt.Errorf("Invalid value for `From`.  Must contain time")
	}

	if ck.To == 0 {
		return fmt.Errorf("Invalid value for `To`.  Must contain time")
	}

	return nil
}
420870
func InvalidType(name, in, typeName string, value interface{}) *Validation {
	var message string

	if in != "" {
		switch value.(type) {
		case string:
			message = fmt.Sprintf(typeFailWithData, name, in, typeName, value)
		case error:
			message = fmt.Sprintf(typeFailWithError, name, in, typeName, value)
		default:
			message = fmt.Sprintf(typeFail, name, in, typeName)
		}
	} else {
		switch value.(type) {
		case string:
			message = fmt.Sprintf(typeFailWithDataNoIn, name, typeName, value)
		case error:
			message = fmt.Sprintf(typeFailWithErrorNoIn, name, typeName, value)
		default:
			message = fmt.Sprintf(typeFailNoIn, name, typeName)
		}
	}

	return &Validation{
		code:    InvalidTypeCode,
		Name:    name,
		In:      in,
		Value:   value,
		message: message,
	}

}
551967
func (u CellUpdate) Valid() *Error {
	if u.H == nil && u.W == nil && u.Y == nil && u.X == nil {
		return &Error{
			Code: EInvalid,
			Msg:  "must update at least one attribute",
		}
	}

	return nil
}
1282055
func newElement(ln *line, parent element) (element, error) {
	var e element
	var err error

	switch {
	case ln.isComment():
		e = newComment(ln, parent)
	case ln.isAtRule():
		e = newAtRule(ln, parent)
	case ln.isMixinDeclaration():
		// error can be ignored becuase the line is checked beforehand
		// by calling `ln.isMixinDeclaration()`.
		e, _ = newMixinDeclaration(ln, parent)
	case ln.isMixinInvocation():
		// error can be ignored becuase the line is checked beforehand
		// by calling `ln.isMixinInvocation()`.
		e, _ = newMixinInvocation(ln, parent)
	case ln.isVariable():
		e, err = newVariable(ln, parent)
	case ln.isDeclaration():
		e, err = newDeclaration(ln, parent)
	default:
		e, err = newSelector(ln, parent)
	}

	return e, err
}
445083
func removeInvalidAtIndex(i int, runes []rune) []rune {
	valid := i
	for ; valid < len(runes) && !validIdentifier(runes[valid]); valid++ {
	}

	return append(runes[:i], runes[valid:]...)
}
686270
func (set *StringSet) Elements() []string {
	iter := []string{}
	for k := range set.set {
		iter = append(iter, k)
	}
	return iter
}
914637
func (e UnknownElementType) Error() string {
	return fmt.Sprintf("Unknown type in %s: %T", e.method, e.element)
}
230956
func ValidateRange(ch *Changeset, field string, min int, max int, opts ...Option) {
	val, exist := ch.changes[field]
	if !exist {
		return
	}

	options := Options{
		message: ValidateRangeErrorMessage,
	}
	options.apply(opts)

	invalid := false

	switch v := val.(type) {
	case string:
		invalid = len(v) < min || len(v) > max
	case []interface{}:
		invalid = len(v) < min || len(v) > max
	case int:
		invalid = v < min || v > max
	case int8:
		invalid = v < int8(min) || v > int8(max)
	case int16:
		invalid = v < int16(min) || v > int16(max)
	case int32:
		invalid = v < int32(min) || v > int32(max)
	case int64:
		invalid = v < int64(min) || v > int64(max)
	case uint:
		invalid = v < uint(min) || v > uint(max)
	case uint8:
		invalid = v < uint8(min) || v > uint8(max)
	case uint16:
		invalid = v < uint16(min) || v > uint16(max)
	case uint32:
		invalid = v < uint32(min) || v > uint32(max)
	case uint64:
		invalid = v < uint64(min) || v > uint64(max)
	case uintptr:
		invalid = v < uintptr(min) || v > uintptr(max)
	case float32:
		invalid = v < float32(min) || v > float32(max)
	case float64:
		invalid = v < float64(min) || v > float64(max)
	}

	if invalid {
		r := strings.NewReplacer("{field}", field, "{min}", strconv.Itoa(min), "{max}", strconv.Itoa(max))
		AddError(ch, field, r.Replace(options.message))
	}
}
752955
func (a *SubjectConfirmation) Element() *etree.Element {
	el := etree.NewElement("saml:SubjectConfirmation")
	el.CreateAttr("Method", a.Method)
	if a.NameID != nil {
		el.AddChild(a.NameID.Element())
	}
	if a.SubjectConfirmationData != nil {
		el.AddChild(a.SubjectConfirmationData.Element())
	}
	return el
}
1239912
func safeArrayPutElement(safearray *SafeArray, index int64, element uintptr) (err error) {
	err = convertHresultToError(
		procSafeArrayPutElement.Call(
			uintptr(unsafe.Pointer(safearray)),
			uintptr(unsafe.Pointer(&index)),
			uintptr(unsafe.Pointer(element))))
	return
}
1082560
func invalidValue(property string, value interface{}) error {
	return ErrInvalidValue{Property: property, Value: value}
}
158793
func (p *parser) addElement() {
	p.addChild(&Node{
		Type:     ElementNode,
		DataAtom: p.tok.DataAtom,
		Data:     p.tok.Data,
		Attr:     p.tok.Attr,
	})
}
359928
func (f *Form) Elements(elems ...FormElement) *Form {
	for _, e := range elems {
		t := reflect.TypeOf(e)
		switch {
		case t.Implements(reflect.TypeOf((*fields.FieldInterface)(nil)).Elem()):
			f.addField(e.(fields.FieldInterface))
		case reflect.ValueOf(e).Type().String() == "*forms.FieldSetType":
			f.addFieldSet(e.(*FieldSetType))
		}
	}
	return f
}
769859
func (e *InvalidValidationError) Error() string {

	if e.Type == nil {
		return "validator: (nil)"
	}

	return "validator: (nil " + e.Type.String() + ")"
}
368325
func (t *Tab) invalidateChildren(node *gcdapi.DOMNode) {
	// invalidate & remove ContentDocument node and children
	if node.ContentDocument != nil {
		ele, ok := t.getElement(node.ContentDocument.NodeId)
		if ok {
			t.invalidateRemove(ele)
			t.invalidateChildren(node.ContentDocument)
		}
	}

	if node.Children == nil {
		return
	}

	// invalidate node.Children
	for _, child := range node.Children {
		ele, ok := t.getElement(child.NodeId)
		if !ok {
			continue
		}
		t.invalidateRemove(ele)
		// recurse and remove children of this node
		t.invalidateChildren(ele.node)
	}
}