Morphs and Players?

Ned Konz ned at bike-nomad.com
Sat Nov 2 15:17:31 UTC 2002


On Saturday 02 November 2002 07:04 am, David Faught wrote:

> I first defined subclasses of a basic morph and simple
> connector (don't remember the exact names of them
> right now) and then added in the instance variables
> and a few methods that I wanted.  I noticed that the
> simple connector has a "network" method (and a couple
> of others) that returns what its connected to, but the
> basic morph doesn't.

In the 1.2 version (which is on SqueakMap) you can ask any Morph 
(including connectors, of course, since they can be connected to by 
other connectors as well):

connectedMorphs
	"Answer all the morphs I am connected to (empty unless I'm a 
connector)"

connections
	"Answer the NCConnectorMorphs that are tied to me"
incomingConnections
outgoingConnections

and you can ask Connectors:

destinationMorph
	"Answer the morph connected to my first vertex, if any"
sourceMorph
	"Answer the morph connected to my first vertex, if any"

subNet
	"Answer a set of myself plus all of the connectors that are either 
connected directly to me or that I'm connected to (recursively)"

validConnections
	"Answer an Array with all of my valid connections. This will be from 
0 to 2 long."

>  I envision defining methods for
> the hosts like "host1 transferFileTo: host2 size:
> 6000" where host1 would then have to figure out the
> path to host2 and therefore first figure out what
> circuits are connected to it.  Where are the
> connections stored for the basic morph?

They're stored in a #connectedConstraints property in the morph's 
extension (indirectly, these are really the ends of the connectors 
but you can query them for their owners and get the connectors).

>  I know that's
> an unfair question since I haven't given you the
> proper name of the class, sorry about that.
>
> >I asked on the list what kind of scripting support
> >would be useful for
> >Connectors but didn't get any answers.

Well, some ideas I had for an additional scripting interface were:

connectStartTo <aMorph>
connectEndTo <aMorph>
connectTo <aMorph>
disconnect

startConnection
endConnection

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list