version 1.6, 2000/07/04 16:25:22
|
version 1.12, 2000/08/24 15:04:44
|
Line 9 Resource Assembly Tool
|
Line 9 Resource Assembly Tool
|
1/7,1/8,1/10,1/14,1/15,1/16,1/21,1/22,1/29,1/30,1/31, |
1/7,1/8,1/10,1/14,1/15,1/16,1/21,1/22,1/29,1/30,1/31, |
2/2,2/3,2/10,2/12,2/13,2/14,2/15,2/17,2/18,2/19,2/20,2/21,2/22, |
2/2,2/3,2/10,2/12,2/13,2/14,2/15,2/17,2/18,2/19,2/20,2/21,2/22, |
5/2,5/3,5/4,5/5,5/6,5/8,5/9,5/13,5/18,5/20,5/22,5/24,5/25, |
5/2,5/3,5/4,5/5,5/6,5/8,5/9,5/13,5/18,5/20,5/22,5/24,5/25, |
6/7,6/8,6/9,6/10,6/12,6/15,7/4 |
6/7,6/8,6/9,6/10,6/12,6/15,7/4,7/26,7/28,7/31,8/5,8/19,8/24 |
Gerd Kortemeyer with Scott Harrison |
Gerd Kortemeyer with Scott Harrison |
--> |
--> |
|
|
Line 56 var zscale=3;
|
Line 56 var zscale=3;
|
var disrows=0; |
var disrows=0; |
var discols=0; |
var discols=0; |
|
|
|
var finishdone=0; |
|
var tim=0; |
|
var funny='|'; |
|
var reqaction=''; |
|
var canceltim; |
|
|
|
var expense=0; |
|
|
var data1=new Array(1024); |
var data1=new Array(1024); |
var data2=new Array(1024); |
var data2=new Array(1024); |
var data3=new Array(1024); |
var data3=new Array(1024); |
Line 69 var inf;
|
Line 77 var inf;
|
function insertrow(j,ex1,ex2) { |
function insertrow(j,ex1,ex2) { |
var kj; |
var kj; |
stored=0; |
stored=0; |
|
expense++; expense++; |
objects1=''; |
objects1=''; |
objects2=''; |
objects2=''; |
for (kj=0;kj<=maxrow;kj++) { |
for (kj=0;kj<=maxrow;kj++) { |
Line 214 function insertcol(j) {
|
Line 223 function insertcol(j) {
|
if ( col[kj]>j ) { col[kj]++; } |
if ( col[kj]>j ) { col[kj]++; } |
} |
} |
maxcol++; |
maxcol++; |
|
expense++; expense++; |
col[maxcol]=j+1; |
col[maxcol]=j+1; |
} |
} |
|
|
Line 337 function comingthru (jid,kid,dkid) {
|
Line 347 function comingthru (jid,kid,dkid) {
|
|
|
function insertport (obj1,d,inout,linkobj) { |
function insertport (obj1,d,inout,linkobj) { |
|
|
|
|
var k; var port; var revport; |
var k; var port; var revport; |
stored=0; |
stored=0; |
data1=obj[obj1].split('&'); |
data1=obj[obj1].split('&'); |
Line 416 function insertport (obj1,d,inout,linkob
|
Line 425 function insertport (obj1,d,inout,linkob
|
|
|
function addobj(kjid,objs) { |
function addobj(kjid,objs) { |
stored=0; |
stored=0; |
|
expense++; |
if (rowcont[kjid]!='') { rowcont[kjid]+=':'; } |
if (rowcont[kjid]!='') { rowcont[kjid]+=':'; } |
rowcont[kjid]+=obj.length; |
rowcont[kjid]+=obj.length; |
obj[obj.length]=objs; |
obj[obj.length]=objs; |
Line 475 function delobj(obj1) {
|
Line 485 function delobj(obj1) {
|
} |
} |
} |
} |
} |
} |
|
obj[obj1]=''; |
} |
} |
|
|
// --------------------------------------------------------- Garbage collection |
// --------------------------------------------------------- Garbage collection |
Line 621 function dellink (linknr) {
|
Line 632 function dellink (linknr) {
|
// Links obj1 with obj2, creates new objlink, marks all elements with number |
// Links obj1 with obj2, creates new objlink, marks all elements with number |
|
|
function joinres (obj1,obj2,cond) { |
function joinres (obj1,obj2,cond) { |
var k; var kr; var outcol; var incol; var d; |
|
stored=0; |
stored=0; |
|
var minexpense; |
|
var best; |
|
|
|
expense=0; |
|
tryjoin(obj1,obj2,cond,1,1); |
|
minexpense=expense; |
|
best=0; |
|
finishload(); |
|
|
|
expense=0; |
|
tryjoin(obj1,obj2,cond,1,-1); |
|
if (expense<minexpense) { |
|
best=1; |
|
minexpense=expense; |
|
} |
|
finishload(); |
|
|
|
expense=0; |
|
tryjoin(obj1,obj2,cond,-1,1); |
|
if (expense<minexpense) { |
|
best=2; |
|
minexpense=expense; |
|
} |
|
finishload(); |
|
|
|
expense=0; |
|
tryjoin(obj1,obj2,cond,-1,-1); |
|
if (expense<minexpense) { |
|
best=3; |
|
minexpense=expense; |
|
} |
|
|
|
|
|
if (best==0) { |
|
finishload(); |
|
tryjoin(obj1,obj2,cond,1,1); |
|
} |
|
if (best==1) { |
|
finishload(); |
|
tryjoin(obj1,obj2,cond,1,-1); |
|
} |
|
if (best==2) { |
|
finishload(); |
|
tryjoin(obj1,obj2,cond,-1,1); |
|
} |
|
|
|
} |
|
|
|
|
|
function tryjoin(obj1,obj2,cond,d1,d2) { |
|
var k; var kr; var outcol; var incol; var d; var dest; |
|
|
dest=objlinks.length; |
dest=objlinks.length; |
objlinks[dest]=obj1+':'+obj2+':'+cond; |
objlinks[dest]=obj1+':'+obj2+':'+cond; |
data3=obj[obj1].split('&'); |
|
sum=0; |
outcol=insertport(obj1,d1,2,dest); |
for (k=2;k<data3.length;k++) { sum+=col[data3[k].split(':')[0]]; } |
|
outmiddle=sum/(data3.length-2); |
|
data3=obj[obj2].split('&'); |
|
sum=0; |
|
for (k=2;k<data3.length;k++) { sum+=col[data3[k].split(':')[0]]; } |
|
inmiddle=sum/(data3.length-2); |
|
d=inmiddle-outmiddle; |
|
outcol=insertport(obj1,d,2,dest); |
|
insertcond(obj1,outcol,cond); |
insertcond(obj1,outcol,cond); |
incol=insertport(obj2,-d,1,dest); |
incol=insertport(obj2,d2,1,dest); |
if (row[inrow]==(row[outrow]+1)) { |
if (row[inrow]==(row[outrow]+1)) { |
insertrow(row[outrow],-1,-1); |
insertrow(row[outrow],-1,-1); |
} |
} |
Line 829 function delres (obj1,recon) {
|
Line 883 function delres (obj1,recon) {
|
thiscond+='('+outobjscond[k2]+')'; |
thiscond+='('+outobjscond[k2]+')'; |
} |
} |
condnr=0; |
condnr=0; |
if (thiscond!='') { condnr=newcondition(thiscond,'normal'); } |
if (thiscond!='') { condnr=newcondition(thiscond,'normal'); } |
|
save(); |
joinres(inobjs[k],outobjs[k2],condnr); |
joinres(inobjs[k],outobjs[k2],condnr); |
} |
} |
} |
} |
Line 1153 function draw () {
|
Line 1208 function draw () {
|
parent.mapout.document.writeln( |
parent.mapout.document.writeln( |
'<table cellpadding=0 cellspacing=0 border=0 rows=' |
'<table cellpadding=0 cellspacing=0 border=0 rows=' |
+disrows+' cols='+discols+'>'); |
+disrows+' cols='+discols+'>'); |
for (kr=0;kr<=maxrow;kr++) { |
for (kr=0;kr<=maxrow;kr++) { |
message("Generating Output Row "+kr); |
message("Generating Output Row "+kr); |
drawrow(rrow[kr]); |
drawrow(rrow[kr]); |
} |
} |
Line 1353 function insertreslink(infostr) {
|
Line 1408 function insertreslink(infostr) {
|
dellink(lnr); |
dellink(lnr); |
newresource(rid,cid,'','','false','normal'); |
newresource(rid,cid,'','','false','normal'); |
nobj=obj.length-1; |
nobj=obj.length-1; |
|
save(); |
joinres(fobj,nobj,cobj); |
joinres(fobj,nobj,cobj); |
|
save(); |
joinres(nobj,tobj,0); |
joinres(nobj,tobj,0); |
} |
} |
|
|
Line 1373 function insertcondlink(cid,lnr) {
|
Line 1430 function insertcondlink(cid,lnr) {
|
dellink(lnr); |
dellink(lnr); |
newresource(maxrow,cid,'','','false','normal'); |
newresource(maxrow,cid,'','','false','normal'); |
nobj=obj.length-1; |
nobj=obj.length-1; |
|
save(); |
joinres(fobj,nobj,cobj); |
joinres(fobj,nobj,cobj); |
|
save(); |
joinres(nobj,tobj,0); |
joinres(nobj,tobj,0); |
} |
} |
|
|
Line 1689 function graphreset() {
|
Line 1748 function graphreset() {
|
insertcol(-1); |
insertcol(-1); |
|
|
objcont[0]=''; |
objcont[0]=''; |
objcont[1]='Start::false:start:res' |
|
objcont[2]='Finish::false:finish:res'; |
|
objlinks[0]=''; |
objlinks[0]=''; |
objlinks[1]='1:2:0'; |
if (((objcont[1]==undefined)&&(objcont[2]==undefined)) || |
|
((objcont[1]=='')&&(objcont[2]==''))) { |
|
objcont[1]='Start::false:start:res' |
|
objcont[2]='Finish::false:finish:res'; |
|
} |
graphdef='no'; |
graphdef='no'; |
|
|
} |
} |
Line 2003 function simpletabledraw() {
|
Line 2063 function simpletabledraw() {
|
// ---------------------------------- Sort objects to straighten graph or table |
// ---------------------------------- Sort objects to straighten graph or table |
|
|
function sortobjs() { |
function sortobjs() { |
message("Sorting Resources"); |
message("Sorting Resources: "+funny); |
var k; |
var k; |
var ij; |
var ij; |
var dol; |
var dol; |
Line 2021 function sortobjs() {
|
Line 2081 function sortobjs() {
|
} |
} |
if (objsort.length==0) { return ''; } |
if (objsort.length==0) { return ''; } |
for (k=1;k<objlinks.length;k++) { |
for (k=1;k<objlinks.length;k++) { |
|
wheelswitch(); |
|
message("Sorting Resources: "+funny); |
if (objlinks[k]!='') { |
if (objlinks[k]!='') { |
sortthis=1; |
sortthis=1; |
data1=objlinks[k].split(':'); |
data1=objlinks[k].split(':'); |
Line 2030 function sortobjs() {
|
Line 2092 function sortobjs() {
|
kj=j; |
kj=j; |
} |
} |
} |
} |
objsort[kj]+=':'+data1[1]; |
if (kj!=-1) { objsort[kj]+=':'+data1[1]; } |
} |
} |
} |
} |
if (sortthis!=0) { |
if (sortthis!=0) { |
for (k=0;k<objsort.length;k++) { |
for (k=0;k<objsort.length;k++) { |
|
wheelswitch(); |
|
message("Sorting Resources: "+funny); |
for (j=0;j<objsort.length;j++) { |
for (j=0;j<objsort.length;j++) { |
if (k!=j) { |
if (k!=j) { |
data1=objsort[k].split(':'); |
data1=objsort[k].split(':'); |
data2=objsort[j].split(':'); |
data2=objsort[j].split(':'); |
dol=data1.length; |
dol=data1.length; |
dtl=data2.length; |
dtl=data2.length; |
for (kj=1;kj<dol;kj++) { |
if (dol+dtl<200) { |
|
for (kj=1;kj<dol;kj++) { |
if (data1[kj]==data2[0]) { |
if (data1[kj]==data2[0]) { |
for (ij=1;ij<dtl;ij++) { |
for (ij=1;ij<dtl;ij++) { |
data1[data1.length]=data2[ij]; |
data1[data1.length]=data2[ij]; |
} |
} |
} |
} |
} |
} |
for (kj=1;kj<dtl;kj++) { |
for (kj=1;kj<dtl;kj++) { |
if (data2[kj]==data1[0]) { |
if (data2[kj]==data1[0]) { |
for (ij=1;ij<dol;ij++) { |
for (ij=1;ij<dol;ij++) { |
data2[data2.length]=data1[ij]; |
data2[data2.length]=data1[ij]; |
} |
} |
} |
} |
|
} |
|
objsort[k]=data1.join(':'); |
|
objsort[j]=data2.join(':'); |
} |
} |
objsort[k]=data1.join(':'); |
|
objsort[j]=data2.join(':'); |
|
} |
} |
} |
} |
} |
} |
|
message("Sorting Resources: finishing up."); |
return objsort.sort(rescompare).join('&'); |
return objsort.sort(rescompare).join('&'); |
} else { |
} else { |
return objsort.join('&'); |
return objsort.join('&'); |
Line 2105 function graphopt() {
|
Line 2172 function graphopt() {
|
row[k]=k; |
row[k]=k; |
} |
} |
maxrow=rowcont.length-1; |
maxrow=rowcont.length-1; |
|
|
var oldlinks=new Array(); |
var oldlinks=new Array(); |
for (k=0;k<objlinks.length;k++) { oldlinks[k]=objlinks[k]; } |
for (k=0;k<objlinks.length;k++) { |
|
oldlinks[k]=objlinks[k]; |
|
objlinks[k]=''; |
|
} |
objlinks.length=0; |
objlinks.length=0; |
objlinks[0]=''; |
objlinks[0]=''; |
|
graphdef='yes'; |
|
save(); |
|
|
for (k=0;k<objsorted.length;k++) { |
for (k=0;k<objsorted.length;k++) { |
kj=(objsorted[k].split(':'))[0]; |
wheelswitch(); |
|
message("Connecting Resources: "+funny); |
|
kj=(objsorted[k].split(':'))[0]; |
for (ij=1;ij<oldlinks.length;ij++) { |
for (ij=1;ij<oldlinks.length;ij++) { |
if (oldlinks[ij]) { |
if (oldlinks[ij]) { |
data1=oldlinks[ij].split(':'); |
data1=oldlinks[ij].split(':'); |
if (data1[0]==kj) { |
if (data1[0]==kj) { |
joinres(data1[0],data1[1],data1[2]); |
joinres(data1[0],data1[1],data1[2]); |
|
save(); |
} |
} |
} |
} |
} |
} |
} |
} |
graphdef='yes'; |
|
} |
} |
|
|
// ----------------------------------------------------------- Remove e-objects |
// ----------------------------------------------------------- Remove e-objects |
Line 2147 function condense() {
|
Line 2221 function condense() {
|
|
|
function load() { |
function load() { |
message("Loading"); |
message("Loading"); |
|
schedule('load'); |
|
checkdef(); |
|
} |
|
|
|
function finishload() { |
var k; |
var k; |
for (k=0;k<objcont.length;k++) { objcont[k]=''; } |
for (k=0;k<objcont.length;k++) { objcont[k]=''; } |
objcont.length=0; |
objcont.length=0; |
Line 2178 function load() {
|
Line 2257 function load() {
|
if (data2[0]=='zscale') { zscale=1*data2[1]; } |
if (data2[0]=='zscale') { zscale=1*data2[1]; } |
} |
} |
} |
} |
|
if (graphdef=='yes') { |
|
for (k=1;k<=maxrow;k++) { |
|
if (rowcont[k]==undefined) { rowcont[k]=''; } |
|
} |
|
} |
} |
} |
|
|
// -------------------------------------------------------------- Undo function |
// -------------------------------------------------------------- Undo function |
Line 2187 function undo() {
|
Line 2271 function undo() {
|
undopointer--; |
undopointer--; |
parent.server.document.forms.storage.output.value |
parent.server.document.forms.storage.output.value |
=undostack[undopointer]; |
=undostack[undopointer]; |
load(); |
finishload(); |
undopointer--; |
undopointer--; |
draw(); |
draw(); |
stored=0; |
stored=0; |
Line 2203 function redo() {
|
Line 2287 function redo() {
|
undopointer++; |
undopointer++; |
parent.server.document.forms.storage.output.value |
parent.server.document.forms.storage.output.value |
=undostack[undopointer]; |
=undostack[undopointer]; |
load(); |
finishload(); |
undopointer--; |
undopointer--; |
draw(); |
draw(); |
stored=0; |
stored=0; |
Line 2221 function revert() {
|
Line 2305 function revert() {
|
} |
} |
} |
} |
|
|
|
// ---------------------------------------------------------------- Wheelswitch |
|
|
|
function wheelswitch() { |
|
if (funny=='|') { |
|
funny='/'; |
|
} else { |
|
if (funny=='/') { |
|
funny='-'; |
|
} else { |
|
if (funny=='-') { |
|
funny='\\'; |
|
} else { |
|
if (funny=='\\') { funny='|'; } |
|
} |
|
} |
|
} |
|
} |
|
|
|
// --------------------------------------------- Checks if server frame defined |
|
|
|
function checkdef() { |
|
if (parent.server.document.forms.storage.output.value!=undefined) { |
|
srvloaded(); |
|
} |
|
if ((finishdone==0) && (tim==0)) { setTimeout('checkdef()',100); } |
|
} |
|
|
|
// ---------------------------------------------------------- The wait function |
|
|
|
function wait() { |
|
if ((finishdone==1) || (tim==1)) { |
|
if (tim==0) { |
|
clearTimeout(canceltim); |
|
if (reqaction=='save') { finishsave(); } |
|
if (reqaction=='load') { finishload(); draw(); } |
|
} else { |
|
alert("Server Communication Timed Out."); |
|
} |
|
} else { |
|
wheelswitch(); |
|
message('Waiting for server reply: '+funny); |
|
setTimeout('wait();',100); |
|
} |
|
} |
|
|
|
// ---------------------------------------------------------- Schedule function |
|
|
|
function schedule(action) { |
|
reqaction=action; |
|
tim=0; |
|
finishdone=0; |
|
canceltim=setTimeout('tim=1;',20000) |
|
wait(); |
|
} |
|
|
// -------------------------------------------------------------- Store changes |
// -------------------------------------------------------------- Store changes |
|
|
function storechange() { |
function storechange() { |
|
var k; |
parent.server.document.forms.storage.submit(); |
parent.server.document.forms.storage.submit(); |
|
schedule('save'); |
|
} |
|
|
|
function finishsave() { |
|
finishload(); |
|
draw(); |
stored=1; |
stored=1; |
} |
} |
|
|
|
// --------------------------------------- Gets called when submission finished |
|
|
|
function srvloaded() { |
|
finishdone=1; |
|
message("Server replied."); |
|
} |
|
|
// ---------------------------------------------------------------- Toggle Mode |
// ---------------------------------------------------------------- Toggle Mode |
|
|
function togglemode() { |
function togglemode() { |
Line 2253 function main() {
|
Line 2406 function main() {
|
infopen(); |
infopen(); |
infoclear(); |
infoclear(); |
load(); |
load(); |
draw(); |
|
stored=1; |
stored=1; |
mainrun=1; |
mainrun=1; |
} |
} |
Line 2266 function leave() {
|
Line 2418 function leave() {
|
if (!inf.closed) { |
if (!inf.closed) { |
inf.close(); |
inf.close(); |
} |
} |
if (stored==0) { |
|
if (confirm('Store changes?')) { |
|
storechange(); |
|
} |
|
} |
|
} |
} |
|
|
</script> |
</script> |