OrdColl.st
changeset 3095 cdb753308f6e
parent 2549 9ca8a3fcdaa7
child 3107 ce4b0a4b3b3a
equal deleted inserted replaced
3094:647219dc860b 3095:cdb753308f6e
  1541     "return the number of elements in the collection"
  1541     "return the number of elements in the collection"
  1542 
  1542 
  1543     ^ lastIndex - firstIndex + 1
  1543     ^ lastIndex - firstIndex + 1
  1544 ! !
  1544 ! !
  1545 
  1545 
  1546 !OrderedCollection methodsFor:'testing'!
  1546 !OrderedCollection methodsFor:'searching'!
  1547 
  1547 
  1548 identityIndexOf:anObject
  1548 identityIndexOf:anObject
  1549     "return the index of anObject or 0 if not found. Compare using =="
  1549     "return the index of anObject or 0 if not found. Compare using =="
  1550 
  1550 
  1551     |index|
  1551     |index|
  1574     ^ index - firstIndex + 1
  1574     ^ index - firstIndex + 1
  1575 
  1575 
  1576     "Modified: 12.4.1996 / 17:58:19 / cg"
  1576     "Modified: 12.4.1996 / 17:58:19 / cg"
  1577 !
  1577 !
  1578 
  1578 
  1579 includes:anObject
       
  1580     "return true if anObject is in the collection. Compare using ="
       
  1581 
       
  1582     ^ (contentsArray 
       
  1583                 indexOf:anObject 
       
  1584                 startingAt:firstIndex
       
  1585                 endingAt:lastIndex) ~~ 0
       
  1586 
       
  1587     "Modified: 12.4.1996 / 17:57:27 / cg"
       
  1588 !
       
  1589 
       
  1590 includesIdentical:anObject
       
  1591     "return true if anObject is in the collection. Compare using =="
       
  1592 
       
  1593     ^ (contentsArray 
       
  1594                 identityIndexOf:anObject 
       
  1595                 startingAt:firstIndex
       
  1596                 endingAt:lastIndex) ~~ 0
       
  1597 
       
  1598     "Modified: 12.4.1996 / 17:57:09 / cg"
       
  1599 !
       
  1600 
       
  1601 indexOf:anObject
  1579 indexOf:anObject
  1602     "return the index of anObject or 0 if not found in the collection.
  1580     "return the index of anObject or 0 if not found in the collection.
  1603      Compare using ="
  1581      Compare using ="
  1604 
  1582 
  1605     |index|
  1583     |index|
  1644     "
  1622     "
  1645 
  1623 
  1646     "Modified: 12.4.1996 / 17:58:53 / cg"
  1624     "Modified: 12.4.1996 / 17:58:53 / cg"
  1647 ! !
  1625 ! !
  1648 
  1626 
       
  1627 !OrderedCollection methodsFor:'testing'!
       
  1628 
       
  1629 includes:anObject
       
  1630     "return true if anObject is in the collection. Compare using ="
       
  1631 
       
  1632     ^ (contentsArray 
       
  1633                 indexOf:anObject 
       
  1634                 startingAt:firstIndex
       
  1635                 endingAt:lastIndex) ~~ 0
       
  1636 
       
  1637     "Modified: 12.4.1996 / 17:57:27 / cg"
       
  1638 !
       
  1639 
       
  1640 includesIdentical:anObject
       
  1641     "return true if anObject is in the collection. Compare using =="
       
  1642 
       
  1643     ^ (contentsArray 
       
  1644                 identityIndexOf:anObject 
       
  1645                 startingAt:firstIndex
       
  1646                 endingAt:lastIndex) ~~ 0
       
  1647 
       
  1648     "Modified: 12.4.1996 / 17:57:09 / cg"
       
  1649 ! !
       
  1650 
  1649 !OrderedCollection class methodsFor:'documentation'!
  1651 !OrderedCollection class methodsFor:'documentation'!
  1650 
  1652 
  1651 version
  1653 version
  1652     ^ '$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.62 1997-04-15 11:05:18 cg Exp $'
  1654     ^ '$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.63 1997-11-03 15:35:38 cg Exp $'
  1653 ! !
  1655 ! !