MCPcopy Create free account
hub / github.com/cogentcore/core / fromMetaMap

Method fromMetaMap

plot/plotcore/options.go:231–290  ·  view source on GitHub ↗

fromMetaMap sets column options from meta data map.

(meta map[string]string)

Source from the content-addressed store, hash-verified

229
230// fromMetaMap sets column options from meta data map.
231func (co *ColumnOptions) fromMetaMap(meta map[string]string) {
232 if op, has := metaMapLower(meta, co.Column+":On"); has {
233 if op == "+" || op == "true" || op == "" {
234 co.On = true
235 } else {
236 co.On = false
237 }
238 }
239 if op, has := metaMapLower(meta, co.Column+":Off"); has {
240 if op == "+" || op == "true" || op == "" {
241 co.On = false
242 } else {
243 co.On = true
244 }
245 }
246 if op, has := metaMapLower(meta, co.Column+":FixMin"); has {
247 if op == "+" || op == "true" {
248 co.Range.FixMin = true
249 } else {
250 co.Range.FixMin = false
251 }
252 }
253 if op, has := metaMapLower(meta, co.Column+":FixMax"); has {
254 if op == "+" || op == "true" {
255 co.Range.FixMax = true
256 } else {
257 co.Range.FixMax = false
258 }
259 }
260 if op, has := metaMapLower(meta, co.Column+":FloatMin"); has {
261 if op == "+" || op == "true" {
262 co.Range.FixMin = false
263 } else {
264 co.Range.FixMin = true
265 }
266 }
267 if op, has := metaMapLower(meta, co.Column+":FloatMax"); has {
268 if op == "+" || op == "true" {
269 co.Range.FixMax = false
270 } else {
271 co.Range.FixMax = true
272 }
273 }
274 if vl, has := metaMapLower(meta, co.Column+":Max"); has {
275 co.Range.Max, _ = reflectx.ToFloat32(vl)
276 }
277 if vl, has := metaMapLower(meta, co.Column+":Min"); has {
278 co.Range.Min, _ = reflectx.ToFloat32(vl)
279 }
280 if lb, has := metaMapLower(meta, co.Column+":Label"); has {
281 co.Label = lb
282 }
283 if lb, has := metaMapLower(meta, co.Column+":ErrColumn"); has {
284 co.ErrColumn = lb
285 }
286 if vl, has := metaMapLower(meta, co.Column+":TensorIndex"); has {
287 iv, _ := reflectx.ToInt(vl)
288 co.TensorIndex = int(iv)

Callers 2

columnsListUpdateMethod · 0.95
ColumnsFromMetaMapMethod · 0.80

Calls 3

ToFloat32Function · 0.92
ToIntFunction · 0.92
metaMapLowerFunction · 0.85

Tested by

no test coverage detected