class
2017-03-25 20:21:04 0 举报
class是面向对象编程中的一个重要概念,它用于定义一个对象的结构和行为。在Python中,我们可以通过关键字“class”来创建一个类,然后通过类名加实例名的方式来创建对象。类中可以包含属性和方法,属性用于描述对象的状态,方法用于描述对象的行为。类还可以继承其他类的属性和方法,从而实现代码的复用和扩展。使用class可以提高代码的可读性和可维护性,使程序更加模块化和易于扩展。
作者其他创作
大纲/内容
IPAggregate
- ip:ArrayList
+createIterator():Iterator-getIPList():ArrayList
ClassStrategy
- attackerList:ArrayList
+ addAttacker(String ip):void+ isAttacker(String ip):boolean
DetectStrategy
+rule:FIPRule
+ detectAttack(HttpRequest):boolean+getRule():FIPRule
ClassDetectStrategy
-timesMap:HashMap-firstDateMap:HashMap
Detect
- detect:Detect- isAttack:boolean
+ detectAttack(HttpRequest):boolean+ setNextDetect(Detect):void
FIPRule1
AttackManager
- strategy:Strategy
- setStrategy(Strategy):void+ handle(String ip):void+ isAttacker(String ip):boolean
FrequentIPDetect
-strategy:DetectStrategy
+ detectAttack(HttpRequest):boolean+ setStrategy(Stratety):void
FileStrategy
Iterator
+ first():Object+ next():Object+ hasNext():boolean+ currentItem():Object
FireWall
- request:HttpRequest- reponse:HttpResponse- detects:List- manager:AttackManager
+ response(HttpRequest):HttpResponse+ forward(HttpRequest):HttpRequest- detectAttack(HttpRequest):boolean- isAttacker(String ip):boolean- handleAttacker(String ip):void
FIPRule2
DatabaseStrategy
Aggregate
+createIterator():Iterator
SpecificIPDetect
+ detectAttack(HttpRequest):boolean
IPIterator
-aggregate:IPAggrate
+ first():String+ next():String+ hasNext():String+ currentItem():String
DatabaseDetectStrategy
FIPRuleFactory
+createFIPRule():FIPRule
FIPRule1Factory
FIPRule
+times:int+time:int
+getTimes():int+setTimes():int+getTime():int+setTime():int
FIPRule2Factory
Strategy
FileDetectStrategy
0 条评论
回复 删除
下一页