.


:




:

































 

 

 

 


( )




( ') '.

(Flyweight) ' (flyweight, ), . ' , , , , . ' 볺 , .

  • ', .
  • '.

:

  • '.
  • '.
  • ' .
  • ' ', .
  • '. '- , "" ("true") '.

 

ij UML

 

 

4.7. (Facade) / /

5.

(. behavioral patterns) , ' ' '. ' , 䳿. , . , ' '.

.

' . , ' , . , ' . '- , ' . ' ' . .

 

5.1. ³. .

( )

(. Interpreter) , .

, .

, , . , , .

, . .

, , . :

  • . . , , , ', ;
  • . , . , . .

UML ,

  • AbstractExpression :
    • Interpret, ;
  • TerminalExpression :
    • Interpret ;
    • ;
  • NonterminalExpression :
    • ;
    • AbstractExpression ;
    • Interpret . , ;
  • Context :
    • , ;
  • Client 볺:
    • ( ) , . NonterminalExpression TerminalExpression;
    • Interpret.

³

  • 볺 ( ) , ' NonterminalExpression TerminalExpression. 볺 Interpret;
  • NonterminalExpression Interpret Interpret . TerminalExpression Interpret ;
  • Interpret .

(. Iterator) , .

', .

', , , . , -, , . , . , , .

. , , '-. . ' , 䳺 , .

:

  • ', ;
  • ';
  • ( ).

UML ,

  • Iterator
  • ConcreteIterator
    • Iterator;
    • ;
  • Aggregate
    • '-;
  • ConcreteAggregate
    • ConcreteIterator

³

ConcreteIterator ' .

C#

C# , foreach, , IEnumerable.

:

string[] strings = new string[] { "one", "two", "three" };foreach (string str in strings){ Console.WriteLine(str);}

-, :

string[] strings = new string[] { "one", "two", "three" };IEnumerator enumerator = strings.GetEnumerator();while (enumerator.MoveNext()){ Console.WriteLine((string)enumerator.Current);}

 





:


: 2016-11-18; !; : 558 |


:

:

, .
==> ...

768 - | 677 -


© 2015-2024 lektsii.org - -

: 0.015 .