/rlglue/types.go
https://code.google.com/p/go-glue/ · Go · 71 lines · 37 code · 13 blank · 21 comment · 0 complexity · 9687c3ed9fb8c19d92b66501e03b9c25 MD5 · raw file
- /*
- * Copyright (C) 2010, John Asmuth
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- *
- * $Revision$
- * $Date$
- * $Author$
- * $HeadURL$
- *
- */
- package rlglue
- import (
- "fmt"
- )
- type absType struct {
- ints []int32
- doubles []float64
- chars []byte
- }
- func (at *absType) String() string {
- return fmt.Sprintf("{%v %v %v}", at.Ints(), at.Doubles(), at.Chars())
- }
- func (at *absType) Ints() []int32 {
- return at.ints
- }
- func (at *absType) Doubles() []float64 {
- return at.doubles
- }
- func (at *absType) Chars() []byte {
- return at.chars
- }
- type AbstractType interface {
- Ints() []int32
- Doubles() []float64
- Chars() []byte
- }
- func newAT(ints []int32, doubles []float64, chars []byte) AbstractType {
- return &absType{ints, doubles, chars}
- }
- type Observation AbstractType
- func NewObservation(ints []int32, doubles []float64, chars []byte) Observation {
- return newAT(ints, doubles, chars)
- }
- type Action AbstractType
- func NewAction(ints []int32, doubles []float64, chars []byte) Action {
- return newAT(ints, doubles, chars)
- }