Java Forum / General / July 2007
Is There a Java Class for this Kind of Data Structure?
Hal Vaughan - 12 Jul 2007 10:34 GMT I think if I weren't self taught, I'd know the terms to describe what I'm trying to do and might even know what kind of class to look for in the Java API. I'm hoping there's a Java class that will do what I need to do. I think it's some kind of tree structure, but I've only heard the term used and what I found (like TreeMap) doesn't seem to do what I need. Any info I find on Trees, though, seems to go back to JTree and I don't need a GUI for this.
I have a number of data tables and many of them have dependent tables based on matching certain criteria. These dependent tables often have other dependent tables. There is no limit to the levels of dependents and to the number of dependents for each table, but in reality, I doubt any would go deeper than 5-6 levels.
I have a list of the main tables and each table has its own list of its immediate dependents (isn't the correct term children?) and, of course, each child has a list of its own children and so on.
This has worked fine so far, but if a main table is modified, I need to update all the tables that depend on it, no matter how many levels removed. There are more details I don't want to go into, but what I'd like to do is have one structure that a main table has access to that is a list of all the dependent tables. I can't use a regular list for this because I need for all the tables at one level to be listed at that level. I was thinking of something like a LinkedList of LinkedLists.
For instance, the main table would be the first item in the main LinkedList. The 2nd item would be a LinkedList of all it's children and the 3rd item would be a another LinkedList of all the grandchilren and so on.
Yes, I can do this with lists of lists, but isn't here some kind of tree or other kind of branching list that will do this?
Thanks for suggestions!
Hal
Jeff Higgins - 12 Jul 2007 12:22 GMT > Yes, I can do this with lists of lists, but isn't here some kind of tree > or > other kind of branching list that will do this? Have you looked at DefaultTreeModel? Even though it's in the Swing package it can be used nicely standalone.
Hal Vaughan - 12 Jul 2007 12:54 GMT >> Yes, I can do this with lists of lists, but isn't here some kind of tree >> or [quoted text clipped - 3 lines] > Even though it's in the Swing package > it can be used nicely standalone. Okay. I either missed that or excluded it because it cam up as connected to Swing. There are two problems that I can see:
1) The root has to be a TreeNode so I'm not clear if I can set a root object and then add my object as its own root.
2) I don't see a way to add Objects to the tree.
Hal
Bent C Dalager - 12 Jul 2007 13:21 GMT >> Have you looked at DefaultTreeModel? > [quoted text clipped - 3 lines] >1) The root has to be a TreeNode so I'm not clear if I can set a root object >and then add my object as its own root. I'm not exactly sure what you are saying, but one generally has two alternatives:
1) Write your own "MyTreeNodeType implements TreeNode" which can, of course, do whatever you need it to do.
2) Use DefaultMutableTreeNode for the root and put your own object for that node into the node as a user object (see DefaultMutableTreeNode.setUserObject).
>2) I don't see a way to add Objects to the tree. You don't add objects to the tree as such. You set a root object in the tree model's constructor and then you add child objects to this root object.
Typically, you may use a DefaultMutableTreeNode as the root and also for all other nodes in the tree. DefaultMutableTreeNode has add(), children(), etc.
Note that in a TreeModel, there can only be one root object so if you want multiple roots you will have to make your roots children of the "real" root and just ignore the real root as much as possible.
Cheers Bent D
 Signature Bent Dalager - bcd@pvv.org - http://www.pvv.org/~bcd powered by emacs
Jeff Higgins - 12 Jul 2007 13:29 GMT > 1) The root has to be a TreeNode so I'm not clear if I can set a root > object > and then add my object as its own root. > > 2) I don't see a way to add Objects to the tree. All nodes in DefaultTreeModel are TreeNodes. DefaultMutableTreeNode wraps an userObject. You can construct DefaultMutableTreeNode(Object userObject). Your userObject might be an object that wraps a Table reference and a Table id or name for example. Node.getUserObject, Node.setUserObject(), Node.getUserObjectPath() etc.
Jeff Higgins - 12 Jul 2007 14:06 GMT As an addition to what Bent said, You can also extend DefaultMutableTreeNode. An example that I liked is located here: <http://www.java2s.com/Code/Java/Swing-JFC/AtreemodelusingtheSortTreeModelwithaFi lehierarchyasinput.htm>
Oliver Wong - 12 Jul 2007 22:03 GMT >I think if I weren't self taught, I'd know the terms to describe what I'm > trying to do and might even know what kind of class to look for in the [quoted text clipped - 20 lines] > immediate dependents (isn't the correct term children?) and, of course, > each child has a list of its own children and so on. Yes, children is the correct term.
> This has worked fine so far, but if a main table is modified, I need to > update all the tables that depend on it, no matter how many levels [quoted text clipped - 7 lines] > thinking > of something like a LinkedList of LinkedLists. In Java, there's an interface called "List", and from the program-behaviour point of view, it doesn't really matter whether the List interface is implemented via an ArrayList or a LinkedList or some other type of List. The term "regular list" is ambiguous and it's unclear what you are referring to by it (an easy way to clear ambiguity is to post your source code, since the meaning of the Java language is very precisely defined -- see http://www.physci.org/codes/sscce.html)
In other words, a LinkedList does not do anything above and beyond what a plain List can do, so replacing whatever you've got now iwth a LinkedList is almost guaranteed to not solve your problem.
> For instance, the main table would be the first item in the main > LinkedList. > The 2nd item would be a LinkedList of all it's children and the 3rd item > would be a another LinkedList of all the grandchilren and so on. If the first element of your list is of type "MainTable", and the second element of your list is of type "LinkedList", then you've got a heterogenous list, and they're a big pain to work with.
> Yes, I can do this with lists of lists, but isn't here some kind of tree > or > other kind of branching list that will do this? When you wrote...
> I have a list of the main tables and each table has its own list of its > immediate dependents (isn't the correct term children?) and, of course, > each child has a list of its own children and so on. ... you demonstrated that you already have a tree implemented. So I don't think your problem is "how do I add a tree data structure somewhere in my program?" because you've already done so. I think your problem is more that you haven't actually identified what your problem is.
You write that you want to "update all the tables that depend on it, no matter how many levels removed", so why don't you go ahead and do that? What is it about your current data structure that is preventing you from being able to write code which does exactly what you want?
- Oliver
Hal Vaughan - 12 Jul 2007 22:49 GMT ...
> When you wrote... > [quoted text clipped - 11 lines] > What is it about your current data structure that is preventing you from > being able to write code which does exactly what you want? First, thanks (to you and everyone else) for a lot of good information.
I did have a method I could call in one table that would step through all the dependent tables and update them and the Swing components that used them for setting data, the problem was it was easiest to go through the list of all dependent tables and for each one call the update, which would go to that table and do the same. In essence the update would start at the trunk and follow one branch, then take one fork and so on through to the end of one branch, then it would back up and go through the next branch.
That worked, or mostly worked, but I found the problem was that tables several levels down would be updated before some tables only 1 level down were updated and that would effect what was displayed on the Swing components. The reason I want to store the tables in a tree is so I can get more easily make sure I update all tables 1 level down then move to 2 levels down and so on. That way I update all the tables in each level before moving on to the next level.
From what I can see, there is no way to get all the objects from a tree at one level. I was considering using the DefaultTreeModel, but that one issue kept me back. At this point, because I want to go level by level, I'm thinking of using one list and each item is a list of all the tables at that level.
Hal
Jeff Higgins - 12 Jul 2007 22:56 GMT > At this point, because I want to go level by > level, > I'm thinking of using one list and each item is a list of all the tables > at > that level. This online book was an big help to me in understanding tree traversals. <http://www.brpreiss.com/books/opus5/html/book.html>
Oliver Wong - 12 Jul 2007 23:57 GMT > I did have a method I could call in one table that would step through > all [quoted text clipped - 16 lines] > levels down and so on. That way I update all the tables in each level > before moving on to the next level. If "ordering" is an issue, see http://en.wikipedia.org/wiki/Tree_traversal
Note that the problem may also be that your data objects are correctly being updated, but your GUI is not being updated to reflect the new values stored in memory.
> From what I can see, there is no way to get all the objects from a tree > at [quoted text clipped - 3 lines] > at > that level. You can do that, but this particular configuration of having a list of list of elements at a given level doesn't sound like it would be conducive to writing a recursive algorithm. The usual way to go about it is to take care of a single node, and then to take care of all of its children. So rather than working with lists, you'd be working with trees. See http://en.wikipedia.org/wiki/Recursion
- Oliver
Hal Vaughan - 13 Jul 2007 03:03 GMT >> I did have a method I could call in one table that would step through >> all [quoted text clipped - 23 lines] > being updated, but your GUI is not being updated to reflect the new values > stored in memory. That was a problem I think I fixed earlier today. It was tied in to the fact that my old update would go all the way through one branch and update the tables, THEN update the components and sometimes the values in the components were used to figure out the contents of some of the tables.
>> From what I can see, there is no way to get all the objects from a tree >> at [quoted text clipped - 8 lines] > to writing a recursive algorithm. The usual way to go about it is to take > care of a single node, and then to take care of all of its children. That's what I was doing, but then I'd have one branch updated and when updating the next branch, it would change tables that could effect components that effected the first branch.
> So > rather than working with lists, you'd be working with trees. See > http://en.wikipedia.org/wiki/Recursion I've got recursion. Actually, I think it's kind of fun!
Hal
Oliver Wong - 13 Jul 2007 16:14 GMT [context is working with trees]
>> The usual way to go about it is to take >> care of a single node, and then to take care of all of its children. > > That's what I was doing, but then I'd have one branch updated and when > updating the next branch, it would change tables that could effect > components that effected the first branch. Just to clarify, let's say your tree structure looks like:
A
|- B |- C `- D
So "B", "C" and "D" are children of A. Changes to "A" may affect "B", "C" and "D", so when you update "A", you must also update "B", "C" and "D".
Are you saying that in addition to this, changes to "B" affect "C" and "D", so that when you update "B", you must also update "C" and "D" and vice versa?
- Oliver
Hal Vaughan - 13 Jul 2007 17:44 GMT > [context is working with trees] > [quoted text clipped - 11 lines] > |- C > `- D More like (and I hate to do diagrams because I know spacing is different on different fonts):
A
|-+-+ B C D
E F
> So "B", "C" and "D" are children of A. Changes to "A" may affect "B", > "C" and "D", so when you update "A", you must also update "B", "C" and [quoted text clipped - 3 lines] > "D", so that when you update "B", you must also update "C" and "D" and > vice versa? It's more like D might provide prompt data to a Swing component that might effect F just like C does so I have to update C and D at the same time before E and F are updated. It may just be a different way of drawing the table, so we may be saying the same thing, but I'm just trying to make sure we're all saying the same thing. In other words, a table 3 or 4 levels down could be effected by not 1 but 2 tables at level 2. Theoretically it's possible it could be effected by more than 2 tables at level 2, but in practice I would doubt it.
Hal
Oliver Wong - 13 Jul 2007 18:19 GMT >> Just to clarify, let's say your tree structure looks like: >> [quoted text clipped - 12 lines] > | | > E F Who are the children of who in this notation?
[...]
>> Are you saying that in addition to this, changes to "B" affect "C" >> and [quoted text clipped - 13 lines] > in > practice I would doubt it. I don't have the information I'm looking for, so let me rephrase my question:
Are tables only affected by their parents, grandparents, great-grand-parents, etc., or is it possible that they are affected by uncles/aunts, siblings, etc.
Or to phrase it another way, if you draw a line between a node, and every node that might affect it, does the line always go towards the root (which I think is drawn at the top in both our diagrams), or does it sometimes go up, and then back down?
- Oliver
Hal Vaughan - 13 Jul 2007 19:10 GMT >>> Just to clarify, let's say your tree structure looks like: >>> [quoted text clipped - 14 lines] > > Who are the children of who in this notation? B, C, and D. The grandchildren are E & F.
> [...] >>> [quoted text clipped - 22 lines] > great-grand-parents, etc., or is it possible that they are affected by > uncles/aunts, siblings, etc. They can be affected by uncles/aunts, but NOT by siblings.
> Or to phrase it another way, if you draw a line between a node, and > every node that might affect it, does the line always go towards the root > (which I think is drawn at the top in both our diagrams), or does it > sometimes go up, and then back down? Always goes up, but could go diagonally up.
This is beginning to remind me of early spreadsheets where there were times you'd need a value in a column way to the right to be used for something back towards the left and if you had it set for manual recalc, you'd have to recalc twice to keep it all in sync.
Hal
Oliver Wong - 13 Jul 2007 19:46 GMT [talking about trees where the nodes are tables]
>> Are tables only affected by their parents, grandparents, >> great-grand-parents, etc., or is it possible that they are affected by [quoted text clipped - 16 lines] > have > to recalc twice to keep it all in sync. That is essentially the situation you've got right now. Trees typically don't lend themselves well to modeling things where uncle/aunt relationships are important. Are you using the tree structure for other reasons than this updating-algorithm? If not, you might instead want to look into using a directed acyclic graph, where each edge in the graph represents a dependency. That way, when a change in one table occurs, it can notify all of its dependents (which may be children, nephew/nieces) who in turn notify their dependents and so on.
Otherwise, if the tree structure is important, you could modify your updating-algorithm so that it uses a breadth-first traversal instead of a depth-first traversal. Usually this means making your method non-recursive, and instead having a queue with a list of nodes that need to be updated, and you iterate over the queue until it's empty (meaning all your work is done). A breadth-first traversal means that all the nodes at level N will be updated before all the nodes at level N+1.
- Oliver
Hal Vaughan - 13 Jul 2007 20:25 GMT > [talking about trees where the nodes are tables] > [quoted text clipped - 23 lines] > relationships are important. Are you using the tree structure for other > reasons than this updating-algorithm? I was looking into a tree because I thought that would be the easiest way to list all the tables by level or generation and step through them. Remember, I'm self taught. There have been references in this thread (and in others when I've asked a question) that have been a huge help to me in not only answering a question, but in giving me more information about data structures and algorithms that I did not know. I had a few classes back in the '70s and '80s in high school and college, but I was not a programming major and was mostly using Assembler on my Apple //e so a lot of the concepts in OOP are fairly new to me and I've basically had to learn what I needed at any particular point in the process. It's a big help when someone points out what they know are good online resources in this field. While I find some on my own in Google, often something I think explains a point well can leave out a lot of info I should know but am unaware of.
> If not, you might instead want to > look into using a directed acyclic graph, where each edge in the graph > represents a dependency. That way, when a change in one table occurs, it > can notify all of its dependents (which may be children, nephew/nieces) > who in turn notify their dependents and so on. Actually, that's part of how I was thinking of using the tree. Whenever the table data was changed, update() was called and would step through all the dependent tables. The problem, as I've said, is I didn't have them listed by level, but just by following a branch.
> Otherwise, if the tree structure is important, you could modify your > updating-algorithm so that it uses a breadth-first traversal instead of a [quoted text clipped - 3 lines] > all your work is done). A breadth-first traversal means that all the nodes > at level N will be updated before all the nodes at level N+1. Right now I'm experimenting with a loop that I wouldn't actually label as recursive but is close. It starts with a table, makes that table the first node in the list, then the loop starts. It gets the children of that table and makes a list with them as nodes and that new sublist becomes the next node in the main list. Then it looks at all the grandchild tables and makes another sublist of them and that becomes the 3rd node on the main list. I end up with a main list and each node is a sublist. The first sublist is only 1 item long, containing the initial table. The 2nd node/sublist is all the children, the 3rd node/sublist is the grandchildren and so on.
I looked into it several ways since I don't like writing a loop to gather data, then another to go through that same data, but found if I tried one loop to process, there were times I'd have to step back one level, so I decided to list it all. The only actual recursion at this point is getting a list of tables from one table, then doing the same from each table in the list.
Hal
Oliver Wong - 13 Jul 2007 21:44 GMT >> Trees >> typically don't lend themselves well to modeling things where [quoted text clipped - 6 lines] > list all the tables by level or generation and step through them. > Remember, I'm self taught. Picking the right data structure for a given problem is one of those things you just acquire through experience, I think. It's difficult for me to say for sure, because I don't know what you're doing with your tables, but based on what I heard so far, an acyclic directed graph sounds like the the data structure I'd used to model the dependencies between your tables.
Presumably, your program is trying to "do something": model global warming, schedule airplane flights, track inventory in a warehouse, etc. This "thing" that it is trying to do exists independently of your program; that is, you could do it manually if you needed to, but it might be painful, boring, repetitive, etc. This "thing" that is independent of your program is your "problem domain".
So what I'm wondering is whether the entities in your problem domain naturally have a tree-like structure to them. If so, then it might be worth it to stick with trees in your program that reflect the structure of the problem domain, and use the queue-based algorithm mentioned below. Otherwise, it might be worth chucking the trees in favour of the acyclic directed graph (http://en.wikipedia.org/wiki/Acyclic_directed_graph).
A "directed graph" basically means that edges between nodes have directions associated with them. Here's a non-directed graph:
a---b----c
| | | | +--------+
And here's a directed graph:
a-->b<-->c
| ^ | | +--------+
An acyclic directed graph is simply a direct graph in which there are no cycles. Or to put it another way, it's a graph in which when you follow the directions of the arrows, no matter where you start, it's impossible to end up in the same location you've been to previously.
The above directed graph is not acyclic, because you can start at C, then go to B, then go to C again. If you make this minor change, the graph becomes an acyclic one:
a-->b<---c
| ^ | | +--------+
From A, you can go to B or C. At B, you're stuck. And C, you can only go to B. There's no way for you to visit a node twice while following the edges.
>> If not, you might instead want to >> look into using a directed acyclic graph, where each edge in the graph [quoted text clipped - 10 lines] > listed > by level, but just by following a branch. Dependencies are usually best modelled as an acyclic graph. To take your earlier example, with nodes A, B, C, D, E, F, G, the graph would look like:
,-<-B<-. E<-\ / \ *-<-*---<-C<---*-<-A F<-/ \ / `-<-D<-'
That is, A has 3 edges, one pointing to B, one pointing to C and one pointing to D. B, C and D each have 2 edges, one pointing to E, and one pointing to F.
When you do your updates, you just follow all possible paths along the graph. So if you update B, you know you also need to update E and F. When you update A, you know you need to update the whole graph.
The reason the graph needs to be acyclic is to avoid infinite update looks. Let's say you had the following cyclic graph:
A<-->B
And you wanted to update A. This would trigger an update in B, which would then trigger an update in A, and so on back and forth forever.
An easy way to implement this is to have each node (or table) keep a list of all of the other nodes it needs to notify when it gets updated. So A would keep B, C and D in its list. B would keep E and F in its list, and so on.
>> Otherwise, if the tree structure is important, you could modify >> your [quoted text clipped - 34 lines] > the > list. What you've written is essentially what I described as being a breadth-first traversal using a queue (except you need not make these sublists). I think generally, it would not be considered a form of recursion. I think (but am not sure) that the technical definition of recursion requires a method to call itself either directly or indirectly.
To clarify a potential confusion: when you're using this breadth-first traversal algorithm you need to be working with the tree data structure, and not the acyclic directed graph data structure.
Recall that the tree was:
A | +-+-+ B C D | | E F
with A as the root, B, C, D as its children, and E the child of B, F the child of C.
If you wanted to update A, for example, you'd add A to the queue. Now, you take the first element out of the queue (which is "A", leaving the queue now empty), and then you do whatever updates you need to do on "A", and then add all of its children in the queue (B, C and D). If the queue is empty, you're done. But it's not empty, so you repeat: Take the first element out of the queue (which is "B", leaving the queue as {C,D}), update it, and add all of B's children to the queue (the queue is now {C,D,E}). You keep repeating this until the queue is completely empty, which should result in your processing each node exactly once.
The drawback of this algorithm is that you must always process the entire tree. That is, you cannot, for example, only update B and its dependents, because adding B to the queue will eventually trigger the processing of E, but you'll miss the processing of F.
Having the dependency list as an acyclic graph allows you to only process the parts of the trees that need to be processed.
- Oliver
Hal Vaughan - 14 Jul 2007 08:24 GMT > "Hal Vaughan" <hal@thresholddigital.com> wrote in message ...
> Picking the right data structure for a given problem is one of those > things you just acquire through experience, I think. It's difficult for me > to say for sure, because I don't know what you're doing with your tables, > but based on what I heard so far, an acyclic directed graph sounds like > the the data structure I'd used to model the dependencies between your > tables. I checked out the Wikipedia article on acyclic directed graphs. In some ways that is close to what I was doing. Each table contained a list of its dependent tables and, of course, they had lists of their dependent tables too. I made sure they always went to the next level so no path would go to a table on the same or a previous level.
> Presumably, your program is trying to "do something": model global > warming, schedule airplane flights, track inventory in a warehouse, etc. > This "thing" that it is trying to do exists independently of your program; > that is, you could do it manually if you needed to, but it might be > painful, boring, repetitive, etc. This "thing" that is independent of your > program is your "problem domain". It's a setting editor for another system (which is mostly in Perl, since it handles a LOT of text). For various reasons, I don't want this program interacting directly with the database, in part because this would be accessible from the web and nothing else is. The settings data from the database is converted to text in what is almost XML, but is something I set up that made it easy to read and write the data easily and quickly from Java and Perl, saved in files on the server, and this reads them in and creates the tables. Basically, this program is a GUI that lets me edit the settings quickly with point-and-click which, for me, is much faster than dealing with all the SQL commands and the interrelations of the different settings.
> So what I'm wondering is whether the entities in your problem domain > naturally have a tree-like structure to them. If so, then it might be > worth it to stick with trees in your program that reflect the structure of > the problem domain, and use the queue-based algorithm mentioned below. > Otherwise, it might be worth chucking the trees in favour of the acyclic > directed graph (http://en.wikipedia.org/wiki/Acyclic_directed_graph). After what you're saying, I'd say it's more in the acyclic directed graph. I had never heard of a data structure like that before, but it fits better than a tree.
Side note here: on some forums when I ask questions like the one I started with, I get treated like I'm an idiot because I don't know what a lot of people think is something basic. On this group, I've noticed that it may happen once in a while, so I usually include that I'm self taught in my first post. I've found that once people see that I have taught myself, they understand why there are holes in what I know and people here often give me a lot of info that goes way beyond answering my current question and helps me later.
[A good explanation of acyclic directed graphs snipped for brevity.] ...
> What you've written is essentially what I described as being a > breadth-first traversal using a queue (except you need not make these > sublists). I think generally, it would not be considered a form of > recursion. I think (but am not sure) that the technical definition of > recursion requires a method to call itself either directly or indirectly. I didn't really know what recursion was until after I had created several recursive subroutines on my own. Then I found that "recursion" described what I had been doing. All the examples I saw were routines calling themselves, but when I thought about it, and what I did here amounted to something like this:
while (!isDone) { //All sorts of stuff to be done if (no more tables) isDone = true; }
It doesn't call itself, but it keeps going and repeating itself until it's done. It does essentially the same thing as a recursive subroutine. I did something slightly different. I used a LinkedList and each node is another LinkedList of all the tables on a particular level that need updating, so I did this:
private void updateTables(MyTable firstTable) { int iLevel = 0; LinkedList updateTables = new LinkedList(), oneLevel = new LinkedList(); oneLevel.add(firstTable); updateTables.add(oneLevel); while (intLevel < updateTables.size() { //Go through all the tables in oneLevel and get a list of all their child // child tables. Put them in a new LinkedList and add it to updateTables as // the next node. If there are none, we don't add a node to updateTables so // it doesn't increase in length, but intLevel will increase and be the // same as the size of updateTables. That is the flag that we're out of // dependent or child tables intLevel++; } // code to go through updateTables and update all tables we've found. return; }
[More of explanation snipped for brevity] ...
> The drawback of this algorithm is that you must always process the > entire tree. That is, you cannot, for example, only update B and its > dependents, because adding B to the queue will eventually trigger the > processing of E, but you'll miss the processing of F. What I've ended up with is a routine that will start at any table, start reading all the dependent ones from it, then get their dependents and so on. It tracks which level each one is on and update them by going through each level and updating each table in that level before moving on to the next. I can start on the root table or on any other tables after it and still do the same thing.
> Having the dependency list as an acyclic graph allows you to only > process the parts of the trees that need to be processed. At this point, I've got something that does close to that. Maybe I figured it out without the actual terms?!
Thank you for all the time and effort I know it took to write up a clear explanation. It was a help!
Hal
Stefan Ram - 14 Jul 2007 09:37 GMT >I checked out the Wikipedia article on acyclic directed graphs. >In some ways that is close to what I was doing. I have not fully understood your text about those tables yet.
But since you mention graphs: I have a package in ram.jar that is intended to store arbitrary graphs. It is intended for knowledge representation. It still lacks a serialization format.
A small introduction into this package:
http://www.purl.org/stefan_ram/pub/de.dclj.ram.system.space
The ram.jar
http://www.purl.org/stefan_ram/pub/ram-jar
A special property of this system is that any arrow can also be used as an anchor point for another arrow. So there might be an arrow from an arrow to another arrow, or from an arrow to a point.
Picture: A Graph with five string points A, B, C, D, and E, two point-to-point arrows b and d, an arrow-to-arrow arrow cd, and an arrow-to-point arrow E.
A C | | | cd | e |----------->|---------->E | | |b |d v V B D
The rightmost arrow »e«, for example, might be used to label the arrow »d« to the left of it as »E«.
This might also be used to implement relations with an arity other than 2 by curryfication.
I still do not know, how such a graph (were arrows might start or end at other arrows) is called.
The system is intended to support lookup by having each point know about all its inarrows and it outarrows, so one can easily enumerate them.
Twisted - 14 Jul 2007 22:17 GMT > Basically, this program is a GUI that lets me edit the > settings quickly with point-and-click which, for me, is much faster than > dealing with all the SQL commands and the interrelations of the different > settings. Aha! Another victory of the GUI over the command line.
Hal Vaughan - 14 Jul 2007 23:38 GMT >> Basically, this program is a GUI that lets me edit the >> settings quickly with point-and-click which, for me, is much faster than >> dealing with all the SQL commands and the interrelations of the different >> settings. > > Aha! Another victory of the GUI over the command line. It's more complex than that. I've been building a data mining system for over 5 years. When I started, I hadn't written a line of code for over a decade. When I had been coding, I knew BASIC, AppleSoft, VAX 11/780 Assembler (from a class in college) and 6502 Assembler (on my Apple //e). When I started this, I had to learn TCL (hated it!), Perl, JavaScript (hated it!), Java, SQL and a few other languages for smaller tasks that I can't remember right off.
By passion, I'm a script writer. When I have to make changes in MySQL to change settings or add a client it can take hours or days because I have to make sure when I change a setting, I change all the associated settings and that everything is done in sync. With this Setting Editor, I can make most of those changes in, literally, 2 minutes or less. Setting up a new client will take less than 10 minutes and the server will automatically prepare their software, upload it to the web site, and send them email notifying them everything is ready.
It's been years since I had time for writing but when the Setting Editor is done, I'm hoping I can handle all the management tasks for business in less than one business day a week so I have the rest of the time for writing.
The command line is much more powerful and there's just no way I could make the Setting Editor do everything with the settings or data that I can do with just simple SELECT, DELETE and other basic SQL commands, but by now I know what needs to be done and what doesn't, so I've set up ways to do most of those tasks with commands and switches. The Setting Editor will not only edit settings, but let me queue commands by task so I don't have to spend time focused on the nitty gritty of the database when I'm done.
If I ever write the next Star Wars (okay, a bit of facetiousness here), then I could honestly say that everyone who has helped me with advice about programming has helped any movie I write or make get done. Oh, and after years of this, I also know enough to understand that real science and math can be exciting in a well done script and there's no need to ignore basic physics or to trash science to make a story exciting.
Hal
blmblm@myrealbox.com - 14 Jul 2007 23:45 GMT > >> Basically, this program is a GUI that lets me edit the > >> settings quickly with point-and-click which, for me, is much faster than [quoted text clipped - 4 lines] > > It's more complex than that. [ snip ]
> By passion, I'm a script writer. [ snip ]
So of course you understand ....
> The command line is much more powerful [ snip ]
> If I ever write the next Star Wars Oh!! *That* kind of script writer!
> (okay, a bit of facetiousness here), then > I could honestly say that everyone who has helped me with advice about > programming has helped any movie I write or make get done. Oh, and after > years of this, I also know enough to understand that real science and math > can be exciting in a well done script and there's no need to ignore basic > physics or to trash science to make a story exciting. Cool -- good luck with it.
 Signature Decline To State (But the e-mail address in the header should work.)
Lew - 15 Jul 2007 00:37 GMT Hal Vaughan wrote:
>> By passion, I'm a script writer. > [ snip ] >> The command line is much more powerful > [ snip ] >> If I ever write the next Star Wars
> Oh!! *That* kind of script writer! Yeah - I kept thinking "Bash? TCL (he hates it)? Ruby?"
Hey, Hal, just remember - there's no sound in space.
 Signature Lew
Twisted - 15 Jul 2007 01:03 GMT > Hey, Hal, just remember - there's no sound in space. Sure there is -- well, sort of. First, very long low-amplitude density waves may propagate in the very rarefied matter of outer space. Second, gravitational waves are longitudinal waves (much like sound waves; contrast the transverse waves involved in light and radio) and can in theory induce sound-like waves in matter (by stretching and compressing it).
Lew - 15 Jul 2007 02:48 GMT >> Hey, Hal, just remember - there's no sound in space. > [quoted text clipped - 4 lines] > can in theory induce sound-like waves in matter (by stretching and > compressing it). From the point of view of a script writer, only audible frequencies are of interest.
"Sound" in a popular sense refers to audible sound waves; as in the Bishop Berkeley conundrum, if there is no one to hear it, there is no sound.
You are correct, of course, if the context is the specialized scientific use of the term "sound". Sound in that sense wouldn't influence a script or its eventual special effects in any event.
 Signature Lew
Hal Vaughan - 15 Jul 2007 01:26 GMT > Hal Vaughan wrote: >>> By passion, I'm a script writer. [quoted text clipped - 6 lines] > > Yeah - I kept thinking "Bash? TCL (he hates it)? Ruby?" Yep. My bad. I keep the two associated differently. When I hear "script," I think film script first unless I'm specifically talking about Bash or something like that.
> Hey, Hal, just remember - there's no sound in space. Is that why "In space, no one can hear you scream?"
Have you read what Joe Straczynski has said about that? When they started work on Babylon 5, they sent out questionnaires to a number of scientists about many points in FX and related topics to get their feedback on a lot of similar issues. A number of scientists said that the "no sound in space" was not that absolute. One point was that if one was close enough to the explosion, sound would be carried with the expanding oxygen envelope of an exploding ship.
Personally, I want to find a way to do them without the sound and still make them effective. A lot can depend on the context.
Hal
Lew - 15 Jul 2007 02:53 GMT Lew wrote:
>> Hey, Hal, just remember - there's no sound in space.
> Is that why "In space, no one can hear you scream?" > [quoted text clipped - 5 lines] > to the explosion, sound would be carried with the expanding oxygen envelope > of an exploding ship. Which means you wouldn't hear it until that envelope reached you, unlike the usual special effect of hearing it right away.
> Personally, I want to find a way to do them without the sound and still make > them effective. A lot can depend on the context. Ironically, Straczynski is about the only one to respect the silence of space, in what I call the "Rosencrantz and Guildenstern" episode from the fifth season of B5. They show explosions (far enough away from the space station to be silent) but you can't hear them.
Anyway, absolute or not, mere consideration of the dictum "there is no sound in space" (or the "can't hear you scream" variant) is enough to keep you honest. Then you consider the exceptions, which are at best tertiary order, and code for them accordingly. (Like waiting for the explosion to reach you before hearing it.)
I had a cousin sell a movie script once. He advised me that one always takes the cash, never points.
 Signature Lew
Hal Vaughan - 15 Jul 2007 03:17 GMT > Lew wrote: >>> Hey, Hal, just remember - there's no sound in space. [quoted text clipped - 12 lines] > Which means you wouldn't hear it until that envelope reached you, unlike > the usual special effect of hearing it right away. Actually, yes, and that might make for a rather cool effect as it comes on strong with the first wave, would include a wind like sound, and it would taper off as the expanding cloud of air thinned.
>> Personally, I want to find a way to do them without the sound and still >> make [quoted text clipped - 5 lines] > season of B5. They show explosions (far enough away from the space > station to be silent) but you can't hear them. They also had space ships that actually followed the laws of physics in their movement.
> Anyway, absolute or not, mere consideration of the dictum "there is no > sound in space" (or the "can't hear you scream" variant) is enough to keep [quoted text clipped - 6 lines] > I had a cousin sell a movie script once. He advised me that one always > takes the cash, never points. I won't be selling scripts. I'm starting with direct to DVD. I take into account what I can do with a computer when I write. I'll be using Blender for a lot of effects. The computer business will pay enough to let me hire a cast and crew and build sets. Some of the first ideas I have work with an alternate universe that's in a comic book like setting. That way I can do FX that don't have to look real while I learn and practice, before I (or people I get to work with me) get good enough to make it realistic.
Hal
Martin Gregorie - 15 Jul 2007 10:39 GMT > Hal Vaughan wrote: >>> By passion, I'm a script writer. [quoted text clipped - 8 lines] > > Hey, Hal, just remember - there's no sound in space. Maybe not in real space, but there is in Space Opera space: you can always hear the mighty intergalactic space cruiser rumble past. In Space Opera space the fighters can dogfight like WW1 planes too.
IMO realizing that there's this difference between space and Space Opera is what made the first Star Wars movie so great.
 Signature martin@ | Martin Gregorie gregorie. | Essex, UK org |
Hal Vaughan - 15 Jul 2007 18:23 GMT >> Hal Vaughan wrote: >>>> By passion, I'm a script writer. [quoted text clipped - 15 lines] > IMO realizing that there's this difference between space and Space Opera > is what made the first Star Wars movie so great. That's one thing I was thinking about along the way. I would classify Star Wars as fantasy, not science fiction and can forgive them for a few points like sound in space, but I don't think the same rule would apply to Star Trek or other shows that claim to be more accurate.
Hal
Martin Gregorie - 15 Jul 2007 21:33 GMT >>> Hal Vaughan wrote: >>>>> By passion, I'm a script writer. [quoted text clipped - 18 lines] > like sound in space, but I don't think the same rule would apply to Star > Trek or other shows that claim to be more accurate. I never thought of it as fantasy. To me that involves magic and swords. Space Opera is, or should be, very close to SF but it does have its own, often tongue in cheek, rules and conventions. It can bend but not break physics and biology, but it MUST be set in a self-consistent universe. I think fantasy all too often breaks the last rule. Middle Earth and the world of Barbarella share one major feature: both universes are just a backdrop for the action. If you want to read first rate, self-consistent fantasy you can't find better than Ursula LeGuin's Earthsea Trilogy.
But back to Space Opera. In the past I read more of it than was good for me, so to me Star Wars fits right into the worlds of van Vogt (World of Null-A, Weapon Shops of Esther, etc) and a lot of Harry Harrison (The Stainless Steel Rat) and, of course, much Asimov (esp. the Foundation series). I think Lucas also read a lot of it because there's no space opera cliche left unturned in the first film. It was all the better for that. Mind you, both Space and Horse Opera do have some fantasy elements, witness the white-hat cowboy's deadly accurate, never reloaded six-shooter. Not much different from a blaster or a light sword, really! Similarly, Chewbacca and Tonto have a lot in common.
Good Space Opera isn't a past genre either. If you haven't read them, I can recommend Ian M Bank's Culture novels, especially "Consider Phlebas" and "Use of Weapons" as really enjoyable examples of the genre.
 Signature martin@ | Martin Gregorie gregorie. | Essex, UK org |
Hal Vaughan - 16 Jul 2007 00:10 GMT >>>> Hal Vaughan wrote: >>>>>> By passion, I'm a script writer. [quoted text clipped - 27 lines] > backdrop for the action. If you want to read first rate, self-consistent > fantasy you can't find better than Ursula LeGuin's Earthsea Trilogy. It could also be a matter of semantics. I actually classify SF as a subcategory of fantasy, but that's because, when I was working through what I liked to write and what "rules" I wanted to follow, I had to come up with very careful rules about what was acceptable and when. I decided fantasy included almost any events and abilities that were not present in the current world. By that definition, I would include "Ghost" and "Dead Again" as fantasy of some type. If someone were to prove life after death and reincarnation, then either of those would, by my definitions, move out of the category. These are my definitions, made for my use and working, though, so I don't expect everyone to agree with them. I'm just saying that's how I worked it out in my head.
I think most fantasy tries to stay self consistent. Not even all SF does. If it did, then Tom Paris from Voyager could never have visited San Francisco around the year 2000 without there having been a reference to the Eugenics Wars. It's just that in most fantasy, the rules aren't consistent with reality.
I'd also agree with your comment about bending but not breaking the rules. Like I said in another post, if, in Star Wars, the exploding planet makes a sound, that's bending, but if the characters don't know about it until they hear it, or the sound has some importance in the plot, that's breaking the rule.
> But back to Space Opera. In the past I read more of it than was good for > me, so to me Star Wars fits right into the worlds of van Vogt (World of > Null-A, Weapon Shops of Esther, etc) and a lot of Harry Harrison (The > Stainless Steel Rat) I read a lot of van Vogt as a teen but haven't seen any of his works in years. I'd love to find a few to read again. I love the Stainless Steel Rat books. When I'm under stress and need relief, I tend to re-read SSR, or Edgar Rice Burrough's Martian Tales (which inspired so many of the great SF writers), or watch Red Dwarf DVDs.
> and, of course, much Asimov (esp. the Foundation > series). I think Lucas also read a lot of it because there's no space > opera cliche left unturned in the first film. Lucas has openly admitted many times that comic books were a major influence. I hate to admit it as a film lover, but I've never seen much of Kurosawa, but I understand a number of his movies borrow from him heavily. The scene in Star Wars where Luke comes home to find his Aunt and Uncle dead and the homestead smoking is a direct ripoff from John Ford's "The Searchers." (Which also spawned the line Buddy Holly made into a song, "That'll be the Day.")
> It was all the better for > that. Mind you, both Space and Horse Opera do have some fantasy > elements, witness the white-hat cowboy's deadly accurate, never reloaded > six-shooter. Not much different from a blaster or a light sword, really! > Similarly, Chewbacca and Tonto have a lot in common. And both Chewbacca and Tonto keep replying to their leader with a language we don't understand. Perhaps Kemo Sabe and Chewie's grunts could both mean, "selfish, egotistical hotshot!" Didn't Mythbusters take on the accuracy of old western guns at one point?
Hal
Martin Gregorie - 16 Jul 2007 10:01 GMT > And both Chewbacca and Tonto keep replying to their leader with a language > we don't understand. Perhaps Kemo Sabe and Chewie's grunts could both > mean, "selfish, egotistical hotshot!" Well put!
> Didn't Mythbusters take on the accuracy of old western guns at one point? Pass - I don't have TV. However, I think I've known that ever since hearing about the famous Colt Peacemaker with its 13 inch barrel. The smart lawmen accepted the slow draw because they knew that they could plug the varmint from a couple of buildings away while he'd likely miss them with his 3 inch barrel. The dumber ones cut the barrel off for a fast draw and were back to backshooting or outdrawing the baddie at 4 feet range.
Of course, a rifle beat all pistols - it just wasn't handy in a barroom shootout.
 Signature martin@ | Martin Gregorie gregorie. | Essex, UK org |
Oliver Wong - 16 Jul 2007 17:41 GMT [On the topic of Star Wars]
> I never thought of it as fantasy. To me that involves magic and swords. See: "The Force" and lightsabers.
- Oliver
Twisted - 15 Jul 2007 22:30 GMT > That's one thing I was thinking about along the way. I would classify Star > Wars as fantasy, not science fiction and can forgive them for a few points > like sound in space, but I don't think the same rule would apply to Star > Trek or other shows that claim to be more accurate. If you've got warp drive, what's a little sound in space by comparison? You can explain it as a form of subspace radiation that induces audible sound frequencies in commonplace materials, or even the universe isn't quite ours and physics is a bit different; the interstellar medium is considerably denser than in our neck of the woods.
The thing that really bakes my noodle is: What the hell was transmitting the view of the V'Ger cloud from Epsilon-9 even after the latter was completely destroyed? A tiny little free-floating camera WITH LONG RANGE SUBSPACE CAPABILITY DESPITE HAVING AN ANTENNA THE SIZE OF A COCKROACH?? Or maybe the same implied cloaked spy-probe that was near the Klingon battlecruisers earlier, tasked subsequently to follow the cloud? Yeah, but without Epsilon-9 around anymore to relay its signal any real distance ... urgh!
Hal Vaughan - 15 Jul 2007 23:56 GMT >> That's one thing I was thinking about along the way. I would classify >> Star Wars as fantasy, not science fiction and can forgive them for a few [quoted text clipped - 7 lines] > interstellar medium is considerably denser than in our neck of the > woods. I guess if a movie is more in the comic book or space opera genre, I don't expect it to play by every rule. If the explosions in space make sounds, I figure that's just enhancement for the movie, but if characters react to the sound or it's the sound that alerts them to it, then I see that as a flaw, just as it really bothered me that the huge asteroid the Millenium Falcon swerved to slip by changed course while on screen. This was in one of the important shots in that sequence and was even part of the preview reels. It was a large asteroid that, I think, came from the upper right of the screen and changed course as the Falcon went by it.
If it's space opera and the sound is just some kind of movie enhancement, that's one thing, but if something that breaks the laws of physics plays an important point in the plot, that's a problem. Both Arthur C. Clarke and Carl Sagan have proven one can tell a tale within the boundaries of science and make it better by following those rules.
> The thing that really bakes my noodle is: What the hell was > transmitting the view of the V'Ger cloud from Epsilon-9 even after the [quoted text clipped - 4 lines] > the cloud? Yeah, but without Epsilon-9 around anymore to relay its > signal any real distance ... urgh! That's an overall pet peeve: the all present recording camera that records actions from a number of different angles and picks up details that, if it had stayed in its one place and were sending data under real conditions, could never have recorded.
It's a movie convention, though, and will always be there, along with the bartenders who are always polishing a glass when the main characters walk in. ;-)
Hal
Oliver Wong - 16 Jul 2007 17:45 GMT [On the topic of Star Wars]
> If you've got warp drive, what's a little sound in space by > comparison? You can explain it as a form of subspace radiation that > induces audible sound frequencies in commonplace materials, or even > the universe isn't quite ours and physics is a bit different; the > interstellar medium is considerably denser than in our neck of the > woods. I've heard from a Star Wars fan that the "official, cannon" explanation is that the story of Star Wars takes place in "a galaxy far, far away", for which it is plausible that there may actually be a medium (e.g. a very thin gas) for which sound to propagate through in that particular galaxy.
Contrast this with Star Trek, where the ships travel through the Milky way, and sometimes our very own solar system, where it is known that there is no such medium.
This was my friend's argument for the superiority of Star Wars vs Star Trek.
- Oliver
Hal Vaughan - 16 Jul 2007 19:23 GMT > [On the topic of Star Wars] >> [quoted text clipped - 10 lines] > (e.g. a very thin gas) for which sound to propagate through in that > particular galaxy. I'm no astronomer, but I do know the laws of physics are the same across the Universe. If there were any thin medium in that other galaxy, it would seriously impede the flight of spaceships, especially ones like the Deathstar or the Star Destroyers. But it would explain the space slug and how it could live on an airless asteroid. On the other hand, anything like that would cause friction, which would slow down asteroids over time so the asteroid field would become static and they wouldn't move. It would also slow down planets in their orbit until they eventually fall into their sun after a few million years.
> Contrast this with Star Trek, where the ships travel through the Milky > way, and sometimes our very own solar system, where it is known that there > is no such medium. > > This was my friend's argument for the superiority of Star Wars vs Star > Trek. As him why he has the need to prove one is better than the other and can't just enjoy both -- unless he's got too much time on his hands...
Hal
Bent C Dalager - 16 Jul 2007 19:27 GMT >If you've got warp drive, what's a little sound in space by >comparison? You can explain it as a form of subspace radiation that >induces audible sound frequencies in commonplace materials, or even >the universe isn't quite ours and physics is a bit different; the >interstellar medium is considerably denser than in our neck of the >woods. Or, more likely IMO, the spacecraft is synthesizing the sound in order to provide its pilot with better situational awareness.
Cheers Bent D
 Signature Bent Dalager - bcd@pvv.org - http://www.pvv.org/~bcd powered by emacs
Hal Vaughan - 16 Jul 2007 19:45 GMT >>If you've got warp drive, what's a little sound in space by >>comparison? You can explain it as a form of subspace radiation that [quoted text clipped - 5 lines] > Or, more likely IMO, the spacecraft is synthesizing the sound in order > to provide its pilot with better situational awareness. That's an interesting point!
Hal
Twisted - 17 Jul 2007 05:27 GMT > Or, more likely IMO, the spacecraft is synthesizing the sound in order > to provide its pilot with better situational awareness. I've read sci-fi in which a starship bridge synthesized smells. E.g. burning insulation smells when there was burning insulation in the engine core at the far end of the ship.
What would be the standard thing to do? A yellow "check engine" light on the dashboard? It might go unnoticed, although the very large explosion a short time later won't. A loud alarm? That would be typical, but how the hell are the officers supposed to discuss and work on solving the problem with that kind of a racket drowning them out? A smell can directly talk to the hindbrain and produce a visceral awareness of danger, something wrong, or something off, or just information. A rotten smell to indicate a biohazard detection; smoke when there's fire; vague sea-breeze air-freshener type smells might indicate the outside environment is pressurized and safe to breathe; and so forth. And these don't obstruct communication even though they don't risk going unnoticed -- aside from the relatively innocuous ones, where their not being noticed doesn't mean not being alerted to a hazard, but instead perhaps assuming more hazard than is there, which is the safe way to err. Of course, it would take some creativity to think of appropriate alarm smells for "too steep gravitational field" and "magnetic containment dangerously weak" and the like. "We've been shot at!" is easy though -- gunsmoke odor. Ambient sounds, not too loud, can accompany as well. As for "hull breach", try a whistling sound and a temperature drop, rather than an odor. The temperature drop may, if shipwide, actually slow the loss of air as well as provide an alerting sensation. Smells and low sounds like these also provide a good continuing reminder of an unfixed problem, which a loud braying alarm would certainly not. An "attention" tone like aircraft play when the "no smoking" and "wear seatbelts" signs come on might also be used at the onset of such a condition; it can be a quiet bell tone instead of a noisy alarm sound. Of course, there's also lighting cues -- a blue tint can accompany loss of pressure on board, for example, or green toxic contamination, red flickering if there's a fire somewhere, etc.; the closest we've seen to this in movies is the lights dimming and reddening during red alerts on Star Trek ships. A steady red tint for battle stations does seem appropriate, with bangs and smells when damage is detected.
Bent C Dalager - 17 Jul 2007 09:18 GMT >> Or, more likely IMO, the spacecraft is synthesizing the sound in order >> to provide its pilot with better situational awareness. [quoted text clipped - 9 lines] >work on solving the problem with that kind of a racket drowning them >out? There are multiple considerations to take into account here, and I believe the number of crewmembers is crucial to selecting the correct feedback mechanisms. Some thoughts:
- You don't want to overwhelm any one single sense, so you want to distribute your feedback (if there's a lot of it) throughout the various senses of the operator. You would use all of sight, hearing, feeling (e.g. force feedback) and even, as you suggest, smell. I don't quite see taste being used, but the balance sense is a definite maybe.
- You probably do not want to use loud, audible alarms on a bridge with two or more crewmen when those crewmen depend upon vocal communication to work the problem.
- The more crewmembers you have, the less you will have to use additional senses, since each crewman can be given a very focused task and each will independently be able to assess when a situation is grave enough to have to alert their superior. The lone crewman, however, will have to process all incoming information himself and so you want to use as many of his senses as possible. The lone crewman example is therefore, I believe, the most interesting one in this regard since it poses the biggest challenge in categorizing information and synthesizing useful feeback.
- It is important that the computer is able to correctly categorize various pieces of information and assign each a suitably subtle or obvious sensory feedback mechanism. (I should add that I could see a similar development happening for the modern infantryman: modern battlefield technologies make available to him a staggering amount of information but he can't possibly process it all on his own. I imagine a team of 1-5 people dedicated to each infantryman, processing information and presenting the salient bits to him through various pieces of non-intrusive feedback apparatus.)
> A smell can directly talk to the hindbrain and produce a visceral >awareness of danger, something wrong, or something off, or just >information. A rotten smell to indicate a biohazard detection; smoke >when there's fire; vague sea-breeze air-freshener type smells might >indicate the outside environment is pressurized and safe to breathe; >and so forth. I expect that some of these will tend to be at the forefront of the crew's mind at the time when they become relevant. That is, if you intend to leave the starship you're going to manually inspect the environment readouts first anyway and even if you don't, the ship is likely to give you a warning if you try to operate the airlock when it has detected adverse conditions outside.
Smells are probably best used for low-key, lasting conditions that aren't particularly critical but which you will eventually want to get around to addressing. A low but measurable pressure loss perhaps, or some small anomalous drift that thrusters can easily compensate for.
It seems dangerous to overload smells that might otherwise be natural to the surroundings though. For instance, if smoke smell is synthesized to warn of a fire elsewhere in the ship, then this might conflict with the natural smell of smoke that would develop when there's a fire on the bridge.
> And these don't obstruct communication even though they >don't risk going unnoticed -- aside from the relatively innocuous >ones, where their not being noticed doesn't mean not being alerted to >a hazard, but instead perhaps assuming more hazard than is there, >which is the safe way to err. There would need to be logic in place so as to escalate the feedback level of the more hazardous events. So a pressure loss smell might be promoted to an audible alarm if you're in danger of losing all your atmosphere within an hour. (That being said - I can't imagine what might motivate anyone to enter space combat with a fully pressurized starship anyway, but this /is/ fiction we're talking here.)
A few additional things to keep in mind:
1) Smells don't necessarily mix well, so you might be limited to one at a time.
2) You'll want to have a fairly effecient ventilation system so as to be able to get rid of a smell quickly once its cause has been dealt with or a new, more important, smell needs to be substituted.
3) You want to avoid unpleasant smells since they may negatively affect the performance of the crew.
Cheers Bent D
 Signature Bent Dalager - bcd@pvv.org - http://www.pvv.org/~bcd powered by emacs
Twisted - 15 Jul 2007 01:01 GMT > The command line is much more powerful and there's just no way I could make > the Setting Editor do everything with the settings or data that I can do [quoted text clipped - 3 lines] > only edit settings, but let me queue commands by task so I don't have to > spend time focused on the nitty gritty of the database when I'm done. I rest my case -- the CLI is useful for the odd corner case but for the most common cases having and using a GUI tool massively speeds things up and simplifies them ergonomically.
Hal Vaughan - 15 Jul 2007 01:30 GMT >> The command line is much more powerful and there's just no way I could >> make the Setting Editor do everything with the settings or data that I [quoted text clipped - 8 lines] > the most common cases having and using a GUI tool massively speeds > things up and simplifies them ergonomically. I used to teach Special Ed. I've found I can work well with a CLI or GUI and tend to prefer one over the other depending on the task. If I had my choice, I'd probably use a GUI whenever possible, since I'm a visual thinker, but for some people, their style of learning and thinking lends it much more to using a command line. It depends on their learning styles, how they process data and if they think more with words or images. I had to adapt lessons to how students perceived and learned to target words at some students and visual lessons at others for just those reasons.
All that said, I look forward to when my system can be run entirely with a GUI. Then when I'm programming, it's for fun stuff I want to do.
Hal
Jeff Higgins - 14 Jul 2007 17:32 GMT > Having the dependency list as an acyclic graph allows you to only > process the parts of the trees that need to be processed. Oliver, Thanks for eye-opening(for me) explanation. After reading your post I have been able to overcome a stumbling block in one of my own back-burner projects, a Java impl of rmutt.
Googling on dag produced for me a package buried deep in Apache Excalibur project with just the right dag impl for my purpose.
Very appreciative, Jeff Higgins
public class DependancyTest { public static void main(String[] args) { DependancyModel model = new DependancyModel();
// ,-<-B<-. // E<-\ / \ // *-<-*---<-C<---*-<-A // F<-/ \ / // `-<-D<-'
model.addDependant(new Dependant("A"), "root"); model.addDependant(new Dependant("B"), "A"); model.addDependant(new Dependant("C"), "A"); model.addDependant(new Dependant("D"), "A"); model.addDependant(new Dependant("E"), new String[]{"A","B","C","D"}); model.addDependant(new Dependant("F"), new String[] {"A","B","C","D"}); for(Dependant t : model.getDependancies("D")) { System.out.print(t.getName() + " "); } } }
class Dependant { private String name;
public Dependant(String name) { this.name = name; }
public String getName() { return name; } }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;
import org.apache.avalon.fortress.util.dag.Vertex;
public class DependancyModel { Map<String, Vertex> nameMap; Vertex root;
public DependancyModel() { nameMap = new HashMap<String, Vertex>(); root = new Vertex(null, "root"); nameMap.put("root", root); }
public void addDependant(Dependant dept, String anc) { Vertex vertex = new Vertex(dept.getName(), dept); nameMap.get(anc).addDependency(vertex); nameMap.put(dept.getName(), vertex); }
public void addDependant(Dependant dept, String[] anc) { Vertex vertex = new Vertex(dept.getName(), dept); for (String s : anc) { nameMap.get(s).addDependency(vertex); nameMap.put(dept.getName(), vertex); } }
public List<Dependant> getDependancies(String deptName) { List<Vertex> vertices = nameMap.get(deptName).getDependencies(); List<Dependant> tables = new ArrayList<Dependant>(); for (Vertex v : vertices) { tables.add((Dependant) v.getNode()); } return tables; } }
Lew - 14 Jul 2007 18:56 GMT > public class DependancyTest > DependancyModel model = new DependancyModel(); etc.
These would probably best be spelled with the name part "Dependancy" the same as the corresponding English word, "dependency".
> class Dependant A parochial American would regard this as a misspelling; not so in the U.K.
<http://en.wiktionary.org/wiki/dependant>
if intended as a noun.
 Signature Lew
Jeff Higgins - 14 Jul 2007 19:33 GMT >> public class DependancyTest >> DependancyModel model = new DependancyModel(); [quoted text clipped - 11 lines] > > if intended as a noun. huh? You mean the global community considers my spelling, what, correct but stuck-up, or incorrect and pretentious, or ...
I had a co-worker several years ago who used the phrase anal-retentive exhaustivly, we're all still tired from it.
:0) JH
Oliver Wong - 16 Jul 2007 17:48 GMT > Oliver, > Thanks for eye-opening(for me) explanation. [quoted text clipped - 3 lines] > Googling on dag produced for me a package buried deep in Apache > Excalibur project with just the right dag impl for my purpose. Glad I could be of help. I know how frustrating it can be to have to "put down" a project for a while 'cause you're just plain stuck.
- Oliver
Roedy Green - 13 Jul 2007 20:42 GMT On Thu, 12 Jul 2007 05:34:12 -0400, Hal Vaughan <hal@thresholddigital.com> wrote, quoted or indirectly quoted someone who said :
>Thanks for suggestions! have a look at javax.swing.tree.DefaultTreeModel.
I have not looked closely, but it may be suitable for non-GUI use too.
To roll your own tree is not very difficult. Your Node class has a ArrayList of child Nodes.. You create the obvious methods to add a child, remove a child, create a node, chase depth first and breadth first with the Visitor pattern.
Then to use, you extend the Node Class with extra fields.
If you rarely have new children, you can use an array of children, and replace it whenever the number of children changes.
You also have a pointer from child to parent.
TreeModel defines a basic interface to a tree. -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Hal Vaughan - 14 Jul 2007 00:57 GMT > On Thu, 12 Jul 2007 05:34:12 -0400, Hal Vaughan > <hal@thresholddigital.com> wrote, quoted or indirectly quoted someone [quoted text clipped - 5 lines] > > I have not looked closely, but it may be suitable for non-GUI use too. That was one thing I considered, but was hoping to find one already existing. With my limited experience, I'm surprised to find that there are data types I know about that aren't easily implemented in Java. DefaultTreeModel was close, but I could not get all the nodes in one level easily.
Thanks for the idea!
Hal
Roedy Green - 15 Jul 2007 00:47 GMT On Fri, 13 Jul 2007 19:57:14 -0400, Hal Vaughan <hal@thresholddigital.com> wrote, quoted or indirectly quoted someone who said :
>That was one thing I considered, but was hoping to find one already >existing. With my limited experience, I'm surprised to find that there are >data types I know about that aren't easily implemented in Java. >DefaultTreeModel was close, but I could not get all the nodes in one level >easily. if all you need in a extra method or two, just extend DefaultTreeModel. You get a head start of all the rest well debugged.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|