func (this *ActivityStreamsUrlProperty) SetIRI(idx int, v *url.URL) {
	(this.properties)[idx].parent = nil
	(this.properties)[idx] = &ActivityStreamsUrlPropertyIterator{
		alias:                 this.alias,
		myIdx:                 idx,
		parent:                this,
		xmlschemaAnyURIMember: v,
	}
}
SetIRI sets an IRI value to be at the specified index for the property "url".
Panics if the index is out of bounds.
package propertyurl
import (
	"fmt"
	anyuri "github.com/go-fed/activity/streams/values/anyURI"
	vocab "github.com/go-fed/activity/streams/vocab"
	"net/url"
)
type ActivityStreamsUrlPropertyIterator struct {
	xmlschemaAnyURIMember        *url.URL
	activitystreamsLinkMember    vocab.ActivityStreamsLink
	activitystreamsMentionMember vocab.ActivityStreamsMention
	unknown                      interface{}
	alias                        string
	myIdx                        int
	parent                       vocab.ActivityStreamsUrlProperty
}
func NewActivityStreamsUrlPropertyIterator() *ActivityStreamsUrlPropertyIterator {
	return &ActivityStreamsUrlPropertyIterator{alias: ""}
}
func deserializeActivityStreamsUrlPropertyIterator(i interface{}, aliasMap map[string]string) (*ActivityStreamsUrlPropertyIterator, error) {
	alias := ""
	if a, ok := aliasMap["https://www.w3.org/ns/activitystreams"]; ok {
		alias = a
	}
	if m, ok := i.(map[string]interface{}); ok {
		if v, err := mgr.DeserializeLinkActivityStreams()(m, aliasMap); err == nil {
			this := &ActivityStreamsUrlPropertyIterator{
				activitystreamsLinkMember: v,
				alias:                     alias,
			}
			return this, nil
		} else if v, err := mgr.DeserializeMentionActivityStreams()(m, aliasMap); err == nil {
			this := &ActivityStreamsUrlPropertyIterator{
				activitystreamsMentionMember: v,
				alias:                        alias,
			}
			return this, nil
		}
	}
	if v, err := anyuri.DeserializeAnyURI(i); err == nil {
		this := &ActivityStreamsUrlPropertyIterator{
			alias:                 alias,
			xmlschemaAnyURIMember: v,
		}
		return this, nil
	}
	this := &ActivityStreamsUrlPropertyIterator{
		alias:   alias,
		unknown: i,
	}
	return this, nil
}
func (this ActivityStreamsUrlPropertyIterator) GetActivityStreamsLink() vocab.ActivityStreamsLink {
	return this.activitystreamsLinkMember
}
func (this ActivityStreamsUrlPropertyIterator) GetActivityStreamsMention() vocab.ActivityStreamsMention {
	return this.activitystreamsMentionMember
}
func (this ActivityStreamsUrlPropertyIterator) GetIRI() *url.URL {
	return this.xmlschemaAnyURIMember
}
func (this ActivityStreamsUrlPropertyIterator) GetType() vocab.Type {
	if this.IsActivityStreamsLink() {
		return this.GetActivityStreamsLink()
	}
	if this.IsActivityStreamsMention() {
		return this.GetActivityStreamsMention()
	}
	return nil
}
func (this ActivityStreamsUrlPropertyIterator) GetXMLSchemaAnyURI() *url.URL {
	return this.xmlschemaAnyURIMember
}
func (this ActivityStreamsUrlPropertyIterator) HasAny() bool {
	return this.IsXMLSchemaAnyURI() ||
		this.IsActivityStreamsLink() ||
		this.IsActivityStreamsMention()
}
func (this ActivityStreamsUrlPropertyIterator) IsActivityStreamsLink() bool {
	return this.activitystreamsLinkMember != nil
}
func (this ActivityStreamsUrlPropertyIterator) IsActivityStreamsMention() bool {
	return this.activitystreamsMentionMember != nil
}
func (this ActivityStreamsUrlPropertyIterator) IsIRI() bool {
	return this.xmlschemaAnyURIMember != nil
}
func (this ActivityStreamsUrlPropertyIterator) IsXMLSchemaAnyURI() bool {
	return this.xmlschemaAnyURIMember != nil
}
func (this ActivityStreamsUrlPropertyIterator) JSONLDContext() map[string]string {
	m := map[string]string{"https://www.w3.org/ns/activitystreams": this.alias}
	var child map[string]string
	if this.IsActivityStreamsLink() {
		child = this.GetActivityStreamsLink().JSONLDContext()
	} else if this.IsActivityStreamsMention() {
		child = this.GetActivityStreamsMention().JSONLDContext()
	}
	for k, v := range child {
		m[k] = v
	}
	return m
}
func (this ActivityStreamsUrlPropertyIterator) KindIndex() int {
	if this.IsXMLSchemaAnyURI() {
		return 0
	}
	if this.IsActivityStreamsLink() {
		return 1
	}
	if this.IsActivityStreamsMention() {
		return 2
	}
	if this.IsIRI() {
		return -2
	}
	return -1
}
func (this ActivityStreamsUrlPropertyIterator) LessThan(o vocab.ActivityStreamsUrlPropertyIterator) bool {
	idx1 := this.KindIndex()
	idx2 := o.KindIndex()
	if idx1 < idx2 {
		return true
	} else if idx1 > idx2 {
		return false
	} else if this.IsXMLSchemaAnyURI() {
		return anyuri.LessAnyURI(this.GetXMLSchemaAnyURI(), o.GetXMLSchemaAnyURI())
	} else if this.IsActivityStreamsLink() {
		return this.GetActivityStreamsLink().LessThan(o.GetActivityStreamsLink())
	} else if this.IsActivityStreamsMention() {
		return this.GetActivityStreamsMention().LessThan(o.GetActivityStreamsMention())
	}
	return false
}
func (this ActivityStreamsUrlPropertyIterator) Name() string {
	if len(this.alias) > 0 {
		return this.alias + ":" + "ActivityStreamsUrl"
	} else {
		return "ActivityStreamsUrl"
	}
}
func (this ActivityStreamsUrlPropertyIterator) Next() vocab.ActivityStreamsUrlPropertyIterator {
	if this.myIdx+1 >= this.parent.Len() {
		return nil
	} else {
		return this.parent.At(this.myIdx + 1)
	}
}
func (this ActivityStreamsUrlPropertyIterator) Prev() vocab.ActivityStreamsUrlPropertyIterator {
	if this.myIdx-1 < 0 {
		return nil
	} else {
		return this.parent.At(this.myIdx - 1)
	}
}
func (this *ActivityStreamsUrlPropertyIterator) SetActivityStreamsLink(v vocab.ActivityStreamsLink) {
	this.clear()
	this.activitystreamsLinkMember = v
}
func (this *ActivityStreamsUrlPropertyIterator) SetActivityStreamsMention(v vocab.ActivityStreamsMention) {
	this.clear()
	this.activitystreamsMentionMember = v
}
func (this *ActivityStreamsUrlPropertyIterator) SetIRI(v *url.URL) {
	this.clear()
	this.SetXMLSchemaAnyURI(v)
}
func (this *ActivityStreamsUrlPropertyIterator) SetType(t vocab.Type) error {
	if v, ok := t.(vocab.ActivityStreamsLink); ok {
		this.SetActivityStreamsLink(v)
		return nil
	}
	if v, ok := t.(vocab.ActivityStreamsMention); ok {
		this.SetActivityStreamsMention(v)
		return nil
	}
	return fmt.Errorf("illegal type to set on ActivityStreamsUrl property: %T", t)
}
func (this *ActivityStreamsUrlPropertyIterator) SetXMLSchemaAnyURI(v *url.URL) {
	this.clear()
	this.xmlschemaAnyURIMember = v
}
func (this *ActivityStreamsUrlPropertyIterator) clear() {
	this.xmlschemaAnyURIMember = nil
	this.activitystreamsLinkMember = nil
	this.activitystreamsMentionMember = nil
	this.unknown = nil
}
func (this ActivityStreamsUrlPropertyIterator) serialize() (interface{}, error) {
	if this.IsXMLSchemaAnyURI() {
		return anyuri.SerializeAnyURI(this.GetXMLSchemaAnyURI())
	} else if this.IsActivityStreamsLink() {
		return this.GetActivityStreamsLink().Serialize()
	} else if this.IsActivityStreamsMention() {
		return this.GetActivityStreamsMention().Serialize()
	}
	return this.unknown, nil
}
type ActivityStreamsUrlProperty struct {
	properties []*ActivityStreamsUrlPropertyIterator
	alias      string
}
func DeserializeUrlProperty(m map[string]interface{}, aliasMap map[string]string) (vocab.ActivityStreamsUrlProperty, error) {
	alias := ""
	if a, ok := aliasMap["https://www.w3.org/ns/activitystreams"]; ok {
		alias = a
	}
	propName := "url"
	if len(alias) > 0 {
		propName = fmt.Sprintf("%s:%s", alias, "url")
	}
	i, ok := m[propName]
	if ok {
		this := &ActivityStreamsUrlProperty{
			alias:      alias,
			properties: []*ActivityStreamsUrlPropertyIterator{},
		}
		if list, ok := i.([]interface{}); ok {
			for _, iterator := range list {
				if p, err := deserializeActivityStreamsUrlPropertyIterator(iterator, aliasMap); err != nil {
					return this, err
				} else if p != nil {
					this.properties = append(this.properties, p)
				}
			}
		} else {
			if p, err := deserializeActivityStreamsUrlPropertyIterator(i, aliasMap); err != nil {
				return this, err
			} else if p != nil {
				this.properties = append(this.properties, p)
			}
		}
		for idx, ele := range this.properties {
			ele.parent = this
			ele.myIdx = idx
		}
		return this, nil
	}
	return nil, nil
}
func NewActivityStreamsUrlProperty() *ActivityStreamsUrlProperty {
	return &ActivityStreamsUrlProperty{alias: ""}
}
func (this *ActivityStreamsUrlProperty) AppendActivityStreamsLink(v vocab.ActivityStreamsLink) {
	this.properties = append(this.properties, &ActivityStreamsUrlPropertyIterator{
		activitystreamsLinkMember: v,
		alias:                     this.alias,
		myIdx:                     this.Len(),
		parent:                    this,
	})
}
func (this *ActivityStreamsUrlProperty) AppendActivityStreamsMention(v vocab.ActivityStreamsMention) {
	this.properties = append(this.properties, &ActivityStreamsUrlPropertyIterator{
		activitystreamsMentionMember: v,
		alias:                        this.alias,
		myIdx:                        this.Len(),
		parent:                       this,
	})
}
func (this *ActivityStreamsUrlProperty) AppendIRI(v *url.URL) {
	this.properties = append(this.properties, &ActivityStreamsUrlPropertyIterator{
		alias:                 this.alias,
		myIdx:                 this.Len(),
		parent:                this,
		xmlschemaAnyURIMember: v,
	})
}
func (this *ActivityStreamsUrlProperty) AppendType(t vocab.Type) error {
	n := &ActivityStreamsUrlPropertyIterator{
		alias:  this.alias,
		myIdx:  this.Len(),
		parent: this,
	}
	if err := n.SetType(t); err != nil {
		return err
	}
	this.properties = append(this.properties, n)
	return nil
}
func (this *ActivityStreamsUrlProperty) AppendXMLSchemaAnyURI(v *url.URL) {
	this.properties = append(this.properties, &ActivityStreamsUrlPropertyIterator{
		alias:                 this.alias,
		myIdx:                 this.Len(),
		parent:                this,
		xmlschemaAnyURIMember: v,
	})
}
func (this ActivityStreamsUrlProperty) At(index int) vocab.ActivityStreamsUrlPropertyIterator {
	return this.properties[index]
}
func (this ActivityStreamsUrlProperty) Begin() vocab.ActivityStreamsUrlPropertyIterator {
	if this.Empty() {
		return nil
	} else {
		return this.properties[0]
	}
}
func (this ActivityStreamsUrlProperty) Empty() bool {
	return this.Len() == 0
}
func (this ActivityStreamsUrlProperty) End() vocab.ActivityStreamsUrlPropertyIterator {
	return nil
}
func (this *ActivityStreamsUrlProperty) InsertActivityStreamsLink(idx int, v vocab.ActivityStreamsLink) {
	this.properties = append(this.properties, nil)
	copy(this.properties[idx+1:], this.properties[idx:])
	this.properties[idx] = &ActivityStreamsUrlPropertyIterator{
		activitystreamsLinkMember: v,
		alias:                     this.alias,
		myIdx:                     idx,
		parent:                    this,
	}
	for i := idx; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this *ActivityStreamsUrlProperty) InsertActivityStreamsMention(idx int, v vocab.ActivityStreamsMention) {
	this.properties = append(this.properties, nil)
	copy(this.properties[idx+1:], this.properties[idx:])
	this.properties[idx] = &ActivityStreamsUrlPropertyIterator{
		activitystreamsMentionMember: v,
		alias:                        this.alias,
		myIdx:                        idx,
		parent:                       this,
	}
	for i := idx; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this *ActivityStreamsUrlProperty) InsertIRI(idx int, v *url.URL) {
	this.properties = append(this.properties, nil)
	copy(this.properties[idx+1:], this.properties[idx:])
	this.properties[idx] = &ActivityStreamsUrlPropertyIterator{
		alias:                 this.alias,
		myIdx:                 idx,
		parent:                this,
		xmlschemaAnyURIMember: v,
	}
	for i := idx; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this *ActivityStreamsUrlProperty) InsertType(idx int, t vocab.Type) error {
	n := &ActivityStreamsUrlPropertyIterator{
		alias:  this.alias,
		myIdx:  idx,
		parent: this,
	}
	if err := n.SetType(t); err != nil {
		return err
	}
	this.properties = append(this.properties, nil)
	copy(this.properties[idx+1:], this.properties[idx:])
	this.properties[idx] = n
	for i := idx; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
	return nil
}
func (this *ActivityStreamsUrlProperty) InsertXMLSchemaAnyURI(idx int, v *url.URL) {
	this.properties = append(this.properties, nil)
	copy(this.properties[idx+1:], this.properties[idx:])
	this.properties[idx] = &ActivityStreamsUrlPropertyIterator{
		alias:                 this.alias,
		myIdx:                 idx,
		parent:                this,
		xmlschemaAnyURIMember: v,
	}
	for i := idx; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this ActivityStreamsUrlProperty) JSONLDContext() map[string]string {
	m := map[string]string{"https://www.w3.org/ns/activitystreams": this.alias}
	for _, elem := range this.properties {
		child := elem.JSONLDContext()
		for k, v := range child {
			m[k] = v
		}
	}
	return m
}
func (this ActivityStreamsUrlProperty) KindIndex(idx int) int {
	return this.properties[idx].KindIndex()
}
func (this ActivityStreamsUrlProperty) Len() (length int) {
	return len(this.properties)
}
func (this ActivityStreamsUrlProperty) Less(i, j int) bool {
	idx1 := this.KindIndex(i)
	idx2 := this.KindIndex(j)
	if idx1 < idx2 {
		return true
	} else if idx1 == idx2 {
		if idx1 == 0 {
			lhs := this.properties[i].GetXMLSchemaAnyURI()
			rhs := this.properties[j].GetXMLSchemaAnyURI()
			return anyuri.LessAnyURI(lhs, rhs)
		} else if idx1 == 1 {
			lhs := this.properties[i].GetActivityStreamsLink()
			rhs := this.properties[j].GetActivityStreamsLink()
			return lhs.LessThan(rhs)
		} else if idx1 == 2 {
			lhs := this.properties[i].GetActivityStreamsMention()
			rhs := this.properties[j].GetActivityStreamsMention()
			return lhs.LessThan(rhs)
		} else if idx1 == -2 {
			lhs := this.properties[i].GetIRI()
			rhs := this.properties[j].GetIRI()
			return lhs.String() < rhs.String()
		}
	}
	return false
}
func (this ActivityStreamsUrlProperty) LessThan(o vocab.ActivityStreamsUrlProperty) bool {
	l1 := this.Len()
	l2 := o.Len()
	l := l1
	if l2 < l1 {
		l = l2
	}
	for i := 0; i < l; i++ {
		if this.properties[i].LessThan(o.At(i)) {
			return true
		} else if o.At(i).LessThan(this.properties[i]) {
			return false
		}
	}
	return l1 < l2
}
func (this ActivityStreamsUrlProperty) Name() string {
	if len(this.alias) > 0 {
		return this.alias + ":" + "url"
	} else {
		return "url"
	}
}
func (this *ActivityStreamsUrlProperty) PrependActivityStreamsLink(v vocab.ActivityStreamsLink) {
	this.properties = append([]*ActivityStreamsUrlPropertyIterator{{
		activitystreamsLinkMember: v,
		alias:                     this.alias,
		myIdx:                     0,
		parent:                    this,
	}}, this.properties...)
	for i := 1; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this *ActivityStreamsUrlProperty) PrependActivityStreamsMention(v vocab.ActivityStreamsMention) {
	this.properties = append([]*ActivityStreamsUrlPropertyIterator{{
		activitystreamsMentionMember: v,
		alias:                        this.alias,
		myIdx:                        0,
		parent:                       this,
	}}, this.properties...)
	for i := 1; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this *ActivityStreamsUrlProperty) PrependIRI(v *url.URL) {
	this.properties = append([]*ActivityStreamsUrlPropertyIterator{{
		alias:                 this.alias,
		myIdx:                 0,
		parent:                this,
		xmlschemaAnyURIMember: v,
	}}, this.properties...)
	for i := 1; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this *ActivityStreamsUrlProperty) PrependType(t vocab.Type) error {
	n := &ActivityStreamsUrlPropertyIterator{
		alias:  this.alias,
		myIdx:  0,
		parent: this,
	}
	if err := n.SetType(t); err != nil {
		return err
	}
	this.properties = append([]*ActivityStreamsUrlPropertyIterator{n}, this.properties...)
	for i := 1; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
	return nil
}
func (this *ActivityStreamsUrlProperty) PrependXMLSchemaAnyURI(v *url.URL) {
	this.properties = append([]*ActivityStreamsUrlPropertyIterator{{
		alias:                 this.alias,
		myIdx:                 0,
		parent:                this,
		xmlschemaAnyURIMember: v,
	}}, this.properties...)
	for i := 1; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this *ActivityStreamsUrlProperty) Remove(idx int) {
	(this.properties)[idx].parent = nil
	copy((this.properties)[idx:], (this.properties)[idx+1:])
	(this.properties)[len(this.properties)-1] = &ActivityStreamsUrlPropertyIterator{}
	this.properties = (this.properties)[:len(this.properties)-1]
	for i := idx; i < this.Len(); i++ {
		(this.properties)[i].myIdx = i
	}
}
func (this ActivityStreamsUrlProperty) Serialize() (interface{}, error) {
	s := make([]interface{}, 0, len(this.properties))
	for _, iterator := range this.properties {
		if b, err := iterator.serialize(); err != nil {
			return s, err
		} else {
			s = append(s, b)
		}
	}
	if len(s) == 1 {
		return s[0], nil
	}
	return s, nil
}
func (this *ActivityStreamsUrlProperty) SetActivityStreamsLink(idx int, v vocab.ActivityStreamsLink) {
	(this.properties)[idx].parent = nil
	(this.properties)[idx] = &ActivityStreamsUrlPropertyIterator{
		activitystreamsLinkMember: v,
		alias:                     this.alias,
		myIdx:                     idx,
		parent:                    this,
	}
}
func (this *ActivityStreamsUrlProperty) SetActivityStreamsMention(idx int, v vocab.ActivityStreamsMention) {
	(this.properties)[idx].parent = nil
	(this.properties)[idx] = &ActivityStreamsUrlPropertyIterator{
		activitystreamsMentionMember: v,
		alias:                        this.alias,
		myIdx:                        idx,
		parent:                       this,
	}
}