home *** CD-ROM | disk | FTP | other *** search
- %
- % @(#)phoney_NodeList.X 1.1 3/16/88
- %
- import _NodeListElementObject from "Builtins"
- export _NodeListObject to "Builtins"
-
- const _NodeListObject == immutable object _NodeListObject
- export getSignature, create
-
- const NodeListType == type NodeListType
- function getElement [Integer] -> [_NodeListElementObject]
- operation setElement [Integer, _NodeListElementObject]
- function upperbound -> [Integer]
- function lowerbound -> [Integer]
- function getSlice [Integer, Integer] -> [NodeListType]
- operation setSlice [Integer, Integer, NodeListType]
- operation catenate [a : NodeListType] -> [r : NodeListType]
- end NodeListType
-
- function getSignature -> [result : Signature]
- result <- NodeListType
- end getSignature
-
- operation create[length : Integer] -> [result : NodeListType]
- result <-
- object aNodeList
- export getElement, setElement, upperbound, lowerbound,
- getSlice, setSlice, catenate
-
- function getElement [index : Integer] -> [result : _NodeListElementObject]
- % get the element indexed by index, failing if index
- % out of range.
- primitive 012 [result] <- [index]
- end getElement
- operation setElement [index : Integer, e : _NodeListElementObject]
- % set the element, failing if index out of range
- primitive 112 [] <- [index, e]
- end setElement
- function upperbound -> [r : Integer]
- % return the highest valid index, ub.
- primitive 212 [r] <- []
- end upperbound
- function lowerbound -> [r : Integer]
- % return the lowest valid index, always 1.
- primitive 312 [r] <- []
- end lowerbound
- function getSlice [i1 : Integer, length : Integer] -> [r : NodeListType]
- % return a new Vector, a, with lower bound 0, and
- % upper bound length-1, such that for 0 <= i < length:
- % self.getElement[i1+i] == a.getElement[i]
- % fail if i1 or i1+length is out of range.
- primitive 412 [r] <- [i1, length]
- end getSlice
- operation setSlice [i1 : Integer, length : Integer, e : NodeListType]
- % set the elements indexed by i for i1 <= i < i1+length, so
- % that for each such i:
- % self.getElement[i1+i] == a.getElement[i]
- % fail if i1 or i1+length is out of range.
- primitive 512 [] <- [i1, length, e]
- end setSlice
- operation catenate [a : NodeListType] -> [r : NodeListType]
- % return a new vector the result of catenating the
- % elements of a to self
- primitive 612 [r] <- [a]
- end catenate
- end aNodeList
- end create
- end _NodeListObject
-
-