Latest Entries »

A New Collection!

We have a new type of collection that’s available in both of our Cincom Smalltalk products— Cincom® ObjectStudio and Cincom® VisualWorks®.

The name of it is … (drum roll please) “Treap” …  What?!

I know, it doesn’t exactly roll off the tongue.

So what exactly is a “Treap”?

The name Treap is a contraction of the names “Tree” and “Heap” and is a type of balanced binary tree.  It is not new as a computer science data structure, but as a new addition to our products, you may want to know where and how it can be used effectively.

What is it, and how does it compare with more traditional Smalltalk collections?

Treap is more of a hybrid collection, which makes it very versatile and useful in the right context.

It has fast keyed lookup (like a dictionary).

It can use ordered access (like an Array or an OrderedCollection) with enumeration, but the objects are ordered or sorted based on the key.

It also allows bidirectional access to the ordered list.

Treap is structured as a balanced binary tree of nodes.  Each node holds the key and value objects and is linked as a bidirectional linked list.

In what circumstances might a Treap be useful?

If you are using a dictionary for lookup and also enumerate through the sorted keys of the dictionary, a Treap might be a better solution, since it already maintains a sorted order based on the keys.

Alternatively, if you are using a SortedCollection, but need faster random look-up speed, a Treap might just be the best choice.

Another use is if you have to find an object (quickly) and then access the objects just before or after it. In this scenario, you would look up the node and then get the prior or following node with #previous or #next respectively, to navigate the linked list forward and backward.

Are there any drawbacks?

Just like using any Collection or data structure, there are advantages and tradeoffs to using each one. For Treap, the main drawback is probably the space and overhead to have and maintain the nodes and their links.  My suggestion would be to consider using it only where you are getting the benefit of the order and look-up speed, and possibly navigation.

Finding Treap – Treap came into the products as a means for supporting the performance of Text2. You can use it as Text2.Treap for access.  In the future, Treap may move into the Collection hierarchy where you would expect to find it.

Performance – In some simple benchmarking, I find look-up speed using Treap comparable to a dictionary.  If you then have to enumerate through the elements based on the sorted dictionary keys, using a Treap is significantly faster, since it essentially skips the sort by already maintaining that order.

In the meantime, I have made some additions and tweaks for Treap that you may find useful and interesting. The methods add in some of the enumerators for a collection class (#do: #select: #collect: #keysDo:) that were either missing or could perform better. See the methods (for the instance side of Treap) below.

I look forward to any feedback, particularly if you have a good use for Treap in your applications!


Arden Thomas
Cincom Smalltalk Product Manager

do: aBlock
“Evaluate aBlock for each of the receiver’s values.”
| node |
node := self minimumNode.
[node isNil] whileFalse:[
aBlock value: node value.
node := node next].

keysDo: aBlock
“Evaluate aBlock for each of the receiver’s keys.
| node |
node := self minimumNode.
[node isNil] whileFalse:[
aBlock value: node key.
node := node next].

select: aBlock
“Evaluate aBlock with each of the receiver’s elements as the
Collect into a new collection like the receiver, only those
elements for which aBlock evaluates to true.  Answer the new
| newCollection |
newCollection := self species new.
self keysAndValuesDo: [:key :value | (aBlock value: value)
ifTrue: [newCollection at:key put: value]].

collect: aBlock
“Evaluate aBlock with each of the values of the receiver as the
argument.  Collect the resulting values into a collection that
is like the receiver.  Answer the new collection.”
| newCollection |
newCollection := self species new.
self keysAndValuesDo: [:key :value | newCollection at:key put:
(aBlock value: value) ].

The Cincom® ObjectStudio® GUI Files: Transparency

In all of the following cases, we use the same image and the same drawing code. The only change is in the window style and background.

For the image, we use a PNG file with a transparent color. We use our GDI+ library to draw this image on the window.

  1. Translucent Window with title barTransparency1This instance of UITransparentView uses a light-gray background, and the opacity is set to 180 (0 = invisible, 255 = full opaque). The window shows the usual title bar, including the minimize/maximize/close button, and the frame.All items are translucent; you can see the content below the entire window.
  2. Translucent window without title barTransparency2Here, we removeall of the styles from the window, but still set a light-gray background and the opacity to 180.  The window does not show a title bar or a frame, but the content is still translucent.The image below shows the window using a white background, rather than light gray.Transparency3
  3. Window invisible, image opaque
    In this case, we remove all style flags, do not set a background color and set the windowto be fully opaque. The result shows a solidimage, except for the transparent color parts of the image, which are fully transparent. Setting the frame window to full transparency would cause the imageto be invisible too.You can put any available control or define accelerator keys on UITransparentView as well.

    With the ObjectStudio NG UI, not only can you create a transparent window, you also have full control of what you want to display and how transparent/opaque you want it to be.

Contributed Components

A new feature of our website is the Contributed Components Directory.

Here you can find many of the contributed components that are available with our current product offerings.  Some components are fully presented on our distributed media and do not—or not yet—have pages here.  There are many utilities published in the Cincom Open Repository that are of interest, but have not yet been elevated to components for which we provide built distributions.  Although some of these may have active external maintainers, these contributed components are not supported by Cincom

This new Web directory has listings for both “components no longer on the distribution” and “components on the distribution.”  The “Components No Longer on the Distribution” section highlights components that are no longer found in the distributed product, as the name implies.  However, they can be downloaded and installed just like selectable distributed components.  The “Components on the Distribution” section highlights components that users can browse through, choosing to add them to the product without firing up the installer again.  With both sections, the individual pages for each component also give more information than the brief two lines of the installer.

Addition of more components, sometimes on the installation and more often on the web pages, which are free from the constraints of controlling overall installation size, is ongoing.  Just recently, we’ve added the PDF4Smalltalk and Values frameworks of Christian Haider to the installation. A web page with links pointing to Christian’s pages will be available shortly.

› To see the list of contributed components, click here.

Let Us Help You!

If you have developed an application and need help in promoting it, consider joining the Cincom Smalltalk Partner Program. This program offers our current users an opportunity to assist in marketing their applications or services to help partners and users grow their brands and increase the usage of their Cincom Smalltalk applications.  If you are interested in this program, click here.