<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ~~~ /* Visitor 訪問者模式: 表示一個作用于某對象結構中的各元素的操作, 它使你可以在不改變各元素的類的前提下定義作用于這些元素的新操作 個人想法: 作者: HCLAC 日期: 20170309 */ package visitor import ( "fmt" ) // 訪問接口 type IVisitor interface { VisitConcreteElementA(ConcreteElementA) VisitConcreteElementB(ConcreteElementB) } // 具體訪問者A type ConcreteVisitorA struct { name string } func (c *ConcreteVisitorA) VisitConcreteElementA(ce ConcreteElementA) { if c == nil { return } fmt.Println(ce.name, c.name) ce.OperatorA() } func (c *ConcreteVisitorA) VisitConcreteElementB(ce ConcreteElementB) { if c == nil { return } fmt.Println(ce.name, c.name) ce.OperatorB() } // 具體訪問者B type ConcreteVisitorB struct { name string } func (c *ConcreteVisitorB) VisitConcreteElementA(ce ConcreteElementA) { if c == nil { return } fmt.Println(ce.name, c.name) ce.OperatorA() } func (c *ConcreteVisitorB) VisitConcreteElementB(ce ConcreteElementB) { if c == nil { return } fmt.Println(ce.name, c.name) ce.OperatorB() } // 元素接口 type IElement interface { Accept(IVisitor) } // 具體元素A type ConcreteElementA struct { name string } func (c *ConcreteElementA) Accept(visitor IVisitor) { if c == nil { return } visitor.VisitConcreteElementA(*c) } func (c *ConcreteElementA) OperatorA() { if c == nil { return } fmt.Println("OperatorA") } // 具體元素B type ConcreteElementB struct { name string } func (c *ConcreteElementB) Accept(visitor IVisitor) { if c == nil { return } visitor.VisitConcreteElementB(*c) } func (c *ConcreteElementB) OperatorB() { if c == nil { return } fmt.Println("OperatorB") } // 維護元素集合 type ObjectStructure struct { list []IElement } func (o *ObjectStructure) Attach(e IElement) { if o == nil || e == nil { return } o.list = append(o.list, e) } func (o *ObjectStructure) Detach(e IElement) { if o == nil || e == nil { return } for i, val := range o.list { if val == e { o.list = append(o.list[:i], o.list[i+1:]...) break } } } func (o *ObjectStructure) Accept(v IVisitor) { if o == nil { return } for _, val := range o.list { val.Accept(v) } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看