gitlab.com/evatix-go/core@v1.3.55/coredata/corestr/newCollectionsOfCollectionCreator.go (about) 1 package corestr 2 3 import ( 4 "gitlab.com/evatix-go/core/constants" 5 ) 6 7 type newCollectionsOfCollectionCreator struct{} 8 9 func (it *newCollectionsOfCollectionCreator) Cap( 10 capacity int, 11 ) *CollectionsOfCollection { 12 collection := make([]*Collection, constants.Zero, capacity) 13 14 return &CollectionsOfCollection{ 15 items: collection, 16 } 17 } 18 19 func (it *newCollectionsOfCollectionCreator) Empty() *CollectionsOfCollection { 20 collection := make([]*Collection, constants.Zero) 21 22 return &CollectionsOfCollection{ 23 items: collection, 24 } 25 } 26 27 func (it *newCollectionsOfCollectionCreator) StringsOfStrings( 28 isMakeClone bool, 29 stringItems ...*[]string, 30 ) *CollectionsOfCollection { 31 length := LengthOfStringsOfPointerStrings(&stringItems) 32 33 return it.LenCap( 34 constants.Zero, 35 length, 36 ).AddsStringsOfPointerStrings(isMakeClone, &stringItems) 37 } 38 39 func (it *newCollectionsOfCollectionCreator) StringsOfStringsPtrPtr( 40 isMakeClone bool, 41 stringItems *[]*[]string, 42 ) *CollectionsOfCollection { 43 length := LengthOfStringsOfPointerStrings( 44 stringItems) 45 46 return it.LenCap( 47 constants.Zero, 48 length, 49 ).AddsStringsOfPointerStrings( 50 isMakeClone, 51 stringItems) 52 } 53 54 func (it *newCollectionsOfCollectionCreator) SpreadStrings( 55 isMakeClone bool, 56 stringItems ...string, 57 ) *CollectionsOfCollection { 58 length := len( 59 stringItems) 60 61 return it.LenCap( 62 constants.Zero, 63 length, 64 ).AddStringsPtr( 65 isMakeClone, 66 &stringItems, 67 ) 68 } 69 70 func (it *newCollectionsOfCollectionCreator) CloneStrings( 71 stringItems []string, 72 ) *CollectionsOfCollection { 73 return it.StringsOption( 74 true, 75 0, 76 stringItems) 77 } 78 79 func (it *newCollectionsOfCollectionCreator) Strings( 80 stringItems []string, 81 ) *CollectionsOfCollection { 82 length := len( 83 stringItems) 84 collection := it.Cap( 85 length) 86 87 return collection.AddStringsPtr( 88 false, 89 &stringItems) 90 } 91 92 func (it *newCollectionsOfCollectionCreator) StringsOption( 93 isMakeClone bool, 94 capacity int, 95 stringItems []string, 96 ) *CollectionsOfCollection { 97 length := len( 98 stringItems) 99 collection := it.Cap( 100 length + capacity) 101 102 return collection.AddStringsPtr( 103 isMakeClone, 104 &stringItems) 105 } 106 107 func (it *newCollectionsOfCollectionCreator) StringsPtrOption( 108 isMakeClone bool, 109 capacity int, 110 stringItems *[]string, 111 ) *CollectionsOfCollection { 112 length := LengthOfStringsPtr( 113 stringItems) 114 collection := it.Cap( 115 length + capacity) 116 117 return collection.AddStringsPtr( 118 isMakeClone, 119 stringItems) 120 } 121 122 func (it *newCollectionsOfCollectionCreator) PointerStringsPtrOption( 123 capacity int, 124 stringItems *[]*string, 125 ) *CollectionsOfCollection { 126 length := LengthOfPointerStrings( 127 stringItems) 128 collection := it.Cap( 129 length + capacity) 130 131 return collection.AddPointerStringsPtr( 132 stringItems) 133 } 134 135 func (it *newCollectionsOfCollectionCreator) LenCap( 136 length, 137 capacity int, 138 ) *CollectionsOfCollection { 139 collection := make( 140 []*Collection, 141 length, 142 capacity) 143 144 return &CollectionsOfCollection{ 145 items: collection, 146 } 147 }