当前位置: 首页>>代码示例>>Python>>正文


Python Interval.start方法代码示例

本文整理汇总了Python中Interval.Interval.start方法的典型用法代码示例。如果您正苦于以下问题:Python Interval.start方法的具体用法?Python Interval.start怎么用?Python Interval.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Interval.Interval的用法示例。


在下文中一共展示了Interval.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: insert

# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import start [as 别名]
 def insert(self, intervals, newInterval):
     
     if len(intervals) == 0:
         return [newInterval]
     
     r = []
     overlapWithNewInterval = Interval(newInterval.start, newInterval.end)
     didAddNewInterval = False
     
     for i in intervals:
         if (i.start < overlapWithNewInterval.start
               and i.end < overlapWithNewInterval.start):
             r.append(i)
         elif (i.start < overlapWithNewInterval.start
               and i.end >= overlapWithNewInterval.start
               and i.end <= overlapWithNewInterval.end):
             overlapWithNewInterval.start = i.start 
         elif (i.start < overlapWithNewInterval.start
               and i.end > overlapWithNewInterval.end):
             return intervals
         elif (i.start >= overlapWithNewInterval.start
               and i.end <= overlapWithNewInterval.end):
             pass
         elif (i.start >= overlapWithNewInterval.start
               and i.start <= overlapWithNewInterval.end
               and i.end >= overlapWithNewInterval.end):
             overlapWithNewInterval.end = i.end
         else:   # hxl: i is after overlapWithNewInterval
             if didAddNewInterval == False:
                 r.append(overlapWithNewInterval)
                 didAddNewInterval = True
             r.append(i)
     
     # hxl: It's possible that the new interval is not added yet!
     if didAddNewInterval == False:
         r.append(overlapWithNewInterval)
         didAddNewInterval = True
     return r
开发者ID:54lihaoxin,项目名称:leetcode_python,代码行数:40,代码来源:solution.py

示例2: start

# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import start [as 别名]
 def start(self,*args,**kwargs):
     self.particleEffect.clearToInitial()
     self.currT = 0
     Interval.start(self,*args,**kwargs)
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:6,代码来源:TestInterval.py


注:本文中的Interval.Interval.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。