<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ~~~ /* Flyweight 享元模式: 運用共享技術有效地支持大量細粒度的對象 個人想法:主要思想是共享,將可以共享的部分放在對象內部, 不可以共享的部分放在外邊,享元工廠創建幾個享元對象就可以了, 這樣不同的外部狀態,可以針對同一個對象,給人感覺是操作多個對象, 通過參數的形式對同一個對象的操作,像是對多個對象的操作 作者: HCLAC 日期: 20170311 */ package flyweight import ( "fmt" ) // 享元對象接口 type IFlyweight interface { Operation(int) //來自外部的狀態 } // 共享對象 type ConcreteFlyweight struct { name string } func (c *ConcreteFlyweight) Operation(outState int) { if c == nil { return } fmt.Println("共享對象響應外部狀態", outState) } // 不共享對象 type UnsharedConcreteFlyweight struct { name string } func (c *UnsharedConcreteFlyweight) Operation(outState int) { if c == nil { return } fmt.Println("不共享對象響應外部狀態", outState) } // 享元工廠對象 type FlyweightFactory struct { flyweights map[string]IFlyweight } func (f *FlyweightFactory) Flyweight(name string) IFlyweight { if f == nil { return nil } if name == "u" { return &UnsharedConcreteFlyweight{"u"} } else if _, ok := f.flyweights[name]; !ok { f.flyweights[name] = &ConcreteFlyweight{name} } return f.flyweights[name] } func NewFlyweightFactory() *FlyweightFactory { ff := FlyweightFactory{make(map[string]IFlyweight)} ff.flyweights["a"] = &ConcreteFlyweight{"a"} ff.flyweights["b"] = &ConcreteFlyweight{"b"} return &ff } ~~~
                  <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>

                              哎呀哎呀视频在线观看