forked from tliron/puccini
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalue.go
43 lines (34 loc) · 1.13 KB
/
value.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package normal
import (
"github.com/tliron/kutil/ard"
"github.com/tliron/puccini/tosca"
)
//
// Value
//
type Value struct {
Key Constrainable `json:"$key,omitempty" yaml:"$key,omitempty"`
Information *ValueInformation `json:"$information,omitempty" yaml:"$information,omitempty"`
Constraints FunctionCalls `json:"$constraints,omitempty" yaml:"$constraints,omitempty"`
Converter *FunctionCall `json:"$converter,omitempty" yaml:"$converter,omitempty"`
Value ard.Value `json:"$value" yaml:"$value"`
}
func NewValue(value ard.Value) *Value {
return &Value{Value: value}
}
// Constrainable interface
func (self *Value) SetKey(key Constrainable) {
self.Key = key
}
// Constrainable interface
func (self *Value) SetInformation(information *ValueInformation) {
self.Information = CopyValueInformation(information)
}
// Constrainable interface
func (self *Value) AddConstraint(constraint *tosca.FunctionCall) {
self.Constraints = append(self.Constraints, NewFunctionCall(constraint))
}
// Constrainable interface
func (self *Value) SetConverter(converter *tosca.FunctionCall) {
self.Converter = NewFunctionCall(converter)
}