Package pyjamas :: Package Canvas :: Module JSOStack
[hide private]
[frames] | no frames]

Source Code for Module pyjamas.Canvas.JSOStack

 1  """ 
 2  * Copyright 2008 Google Inc. 
 3  * 
 4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 5  * use self file except in compliance with the License. You may obtain a copy of 
 6  * the License at 
 7  * 
 8  * http:#www.apache.org/licenses/LICENSE-2.0 
 9  * 
10  * Unless required by applicable law or agreed to in writing, software 
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
13  * License for the specific language governing permissions and limitations under 
14  * the License. 
15  """ 
16   
17   
18   
19   
20 -class JSOStack:
21
22 - def __init__(self):
23 self.clear()
24
25 - def clear(self):
26 self.scratch = [] 27 self._minX = None 28 self._minY = None 29 self._maxX = None 30 self._maxY = None
31
32 - def getMaxCoordX(self):
33 return self._maxX
34
35 - def getMaxCoordY(self):
36 return self._maxY
37
38 - def getMinCoordX(self):
39 return self._minX
40
41 - def getMinCoordY(self):
42 return self._minY
43
44 - def join(self):
45 return "".join(self.scratch)
46
47 - def logCoordX(self, coordX):
48 if self._minX is None : 49 self._minX = coordX 50 self._maxX = coordX 51 else: 52 if (self._minX > coordX): 53 self._minX = coordX 54 else: 55 if (self._maxX < coordX): 56 self._maxX = coordX
57
58 - def logCoordY(self,coordY):
59 if self._minY is None : 60 self._minY = coordY 61 self._maxY = coordY 62 else: 63 if (self._minY > coordY): 64 self._minY = coordY 65 else: 66 if (self._maxY < coordY): 67 self._maxY = coordY
68
69 - def pop(self):
70 return self.scratch.pop()
71
72 - def append(self, pathStr):
73 self.scratch.append(pathStr)
74
75 - def __len__(self):
76 return len(self.scratch)
77