// depends: baja; program; bacnet; control import javax.baja.nre.util.*; import javax.baja.sys.*; import javax.baja.status.*; import javax.baja.util.*; import javax.baja.job.*; import javax.baja.naming.*; import javax.baja.space.*; import javax.baja.collection.*; import javax.baja.bacnet.*; import javax.baja.control.*; import javax.baja.bacnet.enums.*; import javax.baja.bacnet.point.*; import javax.baja.bacnet.datatypes.*; import com.tridium.program.*; import java.util.*; import java.util.InputMismatchException; public class RobotImpl extends Robot { public void run() throws Exception { //update this ord to the starting location in your station //when run this will iterate through children from this location //down to all leaf nodes BOrd startOrd = BOrd.make("station:|slot:/Drivers/BacnetNetwork/AHUs/AHU1/AHU1Test"); BComponent startComp = (BComponent)startOrd.resolve().get(); process(startComp); } public void process(BComponent c) throws Exception { BComponent[] kids = c.getChildComponents(); //probably don"t want to rearrange all sub components from the starting ord //this checks for standard BFolder components and only arranges components under the folders //should possibly change this for a specific driver folder type or remove the if statement. int len = kids.length; int left_y = 1; int center_y = 1; int right_y = 1; int far_right_y = 1; //starting x,y coordinates int x = 0; int y = 1; //configures x and y spacing between glyphs int ySpacing = 1; if(c.getType().is(BBacnetPointDeviceExt.TYPE)){ //configure default horizontal column spacing int left_x = 3; int center_x = 83; int right_x = 113; int far_right_x = 153; BLink[] links; int lenlinks; BWsAnnotation last = null; BWsAnnotation update = null; //sort the array of components using the inner class NameComparator, which sorts components alphabetically by names try{ } for(int i=0; i<len; i++) { int ordinal = 0; try{ BValue point = kids[i].get("proxyExt"); BComponent ext = point.asComponent(); BSimple simpleId = ext.get("objectId").asSimple(); if(simpleId.toString().contains("analogInput")) { ordinal = 1; update = BWsAnnotation.make(left_x, left_y); } if(simpleId.toString().contains("analogOutput")) { ordinal = 2; update = BWsAnnotation.make(right_x, right_y); } if(simpleId.toString().contains("analogValue")) { ordinal = 3; update = BWsAnnotation.make(center_x, center_y); } if(simpleId.toString().contains("binaryInput")){ ordinal = 4; update = BWsAnnotation.make(left_x, left_y); } if(simpleId.toString().contains("binaryOutput")){ ordinal = 5; update = BWsAnnotation.make(far_right_x, far_right_y); } if(simpleId.toString().contains("binaryValue")){ ordinal = 6; update = BWsAnnotation.make(center_x, center_y); } if(ordinal == 0){ update = BWsAnnotation.make(center_x, center_y); } } update = BWsAnnotation.make(center_x, center_y); } //3 handles title and bottom section of glyph int pinnedSlots = 3; if(kids[i].get("wsAnnotation")!=null) { //there is currently some wsAnnotation BWsAnnotation current = (BWsAnnotation)kids[i].get("wsAnnotation"); current = BWsAnnotation.merge(current, update); kids[i].set("wsAnnotation", current); last = current; } else { //no current wsAnnotation so just apply kids[i].add("wsAnnotation", update); last = update; } Slot[] slots = kids[i].getSlotsArray(); for(int k=0; k<slots.length; k++){ //account for each pinned slot because it adds to the height of the glyph if((kids[i].getFlags(slots[k]) & Flags.SUMMARY)!=0) pinnedSlots = pinnedSlots+1; if((kids[i].getFlags(slots[k]) & Flags.COMPOSITE)!=0) pinnedSlots = pinnedSlots+1; } //update x,y coordinates for next component switch(ordinal){ case 1: x = left_x; y = left_y + ySpacing + pinnedSlots; left_y = y; break; case 2: x = right_x; y = right_y + ySpacing + pinnedSlots; right_y = y; break; case 3: links = kids[i].getLinks(); lenlinks = links.length; if(lenlinks == 0) { x = center_x; y = center_y + ySpacing + pinnedSlots; center_y = y; } break; case 4: x = left_x; y = left_y + ySpacing + pinnedSlots; left_y = y; break; case 5: x = far_right_x; y = far_right_y + ySpacing + pinnedSlots; far_right_y = y; break; case 6: links = kids[i].getLinks(); lenlinks = links.length; if(lenlinks == 0){ x = center_x; y = center_y + ySpacing + pinnedSlots; center_y = y; } break; default: x = center_x; y = center_y + ySpacing + pinnedSlots; center_y = y; } } for(int i=0; i<len; i++) { // Figure out resorting for knobs try{ int temp_y = 0; int temp_x = 11; int recurse_knobs = 0; int depth = 0; int kc = kids[i].getKnobCount(); if(kc > 0){ //log.println(kids[i].getName()); //log.println(kc); //log.println(); for(int kk=0; kk<kc; kk++){ Knob knob = kids[i].getKnobs()[kk]; BComponent ksource = knob.getSourceComponent(); BComponent kdest = knob.getTargetComponent(); BWsAnnotation bw_dest = (BWsAnnotation)kdest.get("wsAnnotation"); BWsAnnotation bw_source = (BWsAnnotation)ksource.get("wsAnnotation"); //account for each pinned slot because it adds to the height of the glyph int temp_pinnedSlots = 3; Slot[] kslots = kdest.getSlotsArray(); for(int k1=0; k1<kslots.length; k1++){ if((kdest.getFlags(kslots[k1]) & Flags.SUMMARY)!=0) temp_pinnedSlots = temp_pinnedSlots+1; if((kdest.getFlags(kslots[k1]) & Flags.COMPOSITE)!=0) temp_pinnedSlots = temp_pinnedSlots+1; } temp_y = temp_y + ySpacing + temp_pinnedSlots; depth = recurseLinks(ksource, 0); log.println(depth); temp_x = temp_x + 10*depth; BWsAnnotation bw_new = BWsAnnotation.make(temp_x+3,temp_y); BWsAnnotation bw_current = (BWsAnnotation)ksource.get("wsAnnotation"); bw_current = BWsAnnotation.merge(bw_current, bw_new); kdest.set("wsAnnotation",bw_current); } } } } } log.println("Rearranged wiresheet: " + c.getSlotPathOrd()); } // recurse for(int j=0; j<len; j++){ process(kids[j]); } } ///////////////////////////// // inner classes ///////////////////////////// private static int recurseLinks(BComponent clink, int n_link) { BLink[] clinks = clink.getLinks(); int maxD = 0; if(clinks.length > 0){ for(int tab = 0; tab < n_link; tab++){ tabString = tabString + "\t"; } for(int cL = 0; cL < clinks.length; cL++){ //log.println("\t\t"+clinks[cL].getSourceComponent().getName()); if(n_link < 5){ maxD = recurseLinks(clinks[cL].getSourceComponent(), n_link); } if(maxD > n_link){ n_link = maxD; } } } return n_link+1; } { { return a1Name.compareToIgnoreCase(a2Name); } } { { try{ BComponent[] a1ca = ((BComponent)a1).getChildComponents(); int a1c = a1ca.length; BComponent[] a2ca = ((BComponent)a2).getChildComponents(); int a2c = a2ca.length; if(a1c > 0 && a2c > 0){ // Sort By Number BComponent a1_ext = ((BComponent)a1).getChildComponents()[0]; BSimple a1Simple = a1_ext.get("objectId").asSimple(); BComponent a2_ext = ((BComponent)a2).getChildComponents()[0]; BSimple a2Simple = a2_ext.get("objectId").asSimple(); return a1int - a2int; } else { // Sort By Name return a1Name.compareTo(a2Name); } } return 0; } } } } // Rev 0: initial // Rev 1: Far Right Added // Rev 2: Number Sort replaced Name Sort; Far Left Added
Standard input is empty
Main.java:19: error: class RobotImpl is public, should be declared in a file named RobotImpl.java
public class RobotImpl
^
Main.java:2: error: package javax.baja.nre.util does not exist
import javax.baja.nre.util.*;
^
Main.java:3: error: package javax.baja.sys does not exist
import javax.baja.sys.*;
^
Main.java:4: error: package javax.baja.status does not exist
import javax.baja.status.*;
^
Main.java:5: error: package javax.baja.util does not exist
import javax.baja.util.*;
^
Main.java:6: error: package javax.baja.job does not exist
import javax.baja.job.*;
^
Main.java:7: error: package javax.baja.naming does not exist
import javax.baja.naming.*;
^
Main.java:8: error: package javax.baja.space does not exist
import javax.baja.space.*;
^
Main.java:9: error: package javax.baja.collection does not exist
import javax.baja.collection.*;
^
Main.java:10: error: package javax.baja.bacnet does not exist
import javax.baja.bacnet.*;
^
Main.java:11: error: package javax.baja.control does not exist
import javax.baja.control.*;
^
Main.java:12: error: package javax.baja.bacnet.enums does not exist
import javax.baja.bacnet.enums.*;
^
Main.java:13: error: package javax.baja.bacnet.point does not exist
import javax.baja.bacnet.point.*;
^
Main.java:14: error: package javax.baja.bacnet.datatypes does not exist
import javax.baja.bacnet.datatypes.*;
^
Main.java:15: error: package com.tridium.program does not exist
import com.tridium.program.*;
^
Main.java:20: error: cannot find symbol
extends Robot
^
symbol: class Robot
Main.java:32: error: cannot find symbol
public void process(BComponent c)
^
symbol: class BComponent
location: class RobotImpl
Main.java:245: error: cannot find symbol
private static int recurseLinks(BComponent clink, int n_link)
^
symbol: class BComponent
location: class RobotImpl
Main.java:28: error: cannot find symbol
BOrd startOrd = BOrd.make("station:|slot:/Drivers/BacnetNetwork/AHUs/AHU1/AHU1Test");
^
symbol: class BOrd
location: class RobotImpl
Main.java:28: error: cannot find symbol
BOrd startOrd = BOrd.make("station:|slot:/Drivers/BacnetNetwork/AHUs/AHU1/AHU1Test");
^
symbol: variable BOrd
location: class RobotImpl
Main.java:29: error: cannot find symbol
BComponent startComp = (BComponent)startOrd.resolve().get();
^
symbol: class BComponent
location: class RobotImpl
Main.java:29: error: cannot find symbol
BComponent startComp = (BComponent)startOrd.resolve().get();
^
symbol: class BComponent
location: class RobotImpl
Main.java:35: error: cannot find symbol
BComponent[] kids = c.getChildComponents();
^
symbol: class BComponent
location: class RobotImpl
Main.java:52: error: cannot find symbol
if(c.getType().is(BBacnetPointDeviceExt.TYPE)){
^
symbol: variable BBacnetPointDeviceExt
location: class RobotImpl
Main.java:60: error: cannot find symbol
BLink[] links;
^
symbol: class BLink
location: class RobotImpl
Main.java:63: error: cannot find symbol
BWsAnnotation last = null;
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:64: error: cannot find symbol
BWsAnnotation update = null;
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:75: error: cannot find symbol
BValue point = kids[i].get("proxyExt");
^
symbol: class BValue
location: class RobotImpl
Main.java:76: error: cannot find symbol
BComponent ext = point.asComponent();
^
symbol: class BComponent
location: class RobotImpl
Main.java:77: error: cannot find symbol
BSimple simpleId = ext.get("objectId").asSimple();
^
symbol: class BSimple
location: class RobotImpl
Main.java:81: error: cannot find symbol
update = BWsAnnotation.make(left_x, left_y);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:85: error: cannot find symbol
update = BWsAnnotation.make(right_x, right_y);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:89: error: cannot find symbol
update = BWsAnnotation.make(center_x, center_y);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:93: error: cannot find symbol
update = BWsAnnotation.make(left_x, left_y);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:97: error: cannot find symbol
update = BWsAnnotation.make(far_right_x, far_right_y);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:101: error: cannot find symbol
update = BWsAnnotation.make(center_x, center_y);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:104: error: cannot find symbol
update = BWsAnnotation.make(center_x, center_y);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:108: error: cannot find symbol
update = BWsAnnotation.make(center_x, center_y);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:116: error: cannot find symbol
BWsAnnotation current = (BWsAnnotation)kids[i].get("wsAnnotation");
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:116: error: cannot find symbol
BWsAnnotation current = (BWsAnnotation)kids[i].get("wsAnnotation");
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:117: error: cannot find symbol
current = BWsAnnotation.merge(current, update);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:128: error: cannot find symbol
Slot[] slots = kids[i].getSlotsArray();
^
symbol: class Slot
location: class RobotImpl
Main.java:131: error: cannot find symbol
if((kids[i].getFlags(slots[k]) & Flags.SUMMARY)!=0) pinnedSlots = pinnedSlots+1;
^
symbol: variable Flags
location: class RobotImpl
Main.java:132: error: cannot find symbol
if((kids[i].getFlags(slots[k]) & Flags.COMPOSITE)!=0) pinnedSlots = pinnedSlots+1;
^
symbol: variable Flags
location: class RobotImpl
Main.java:204: error: cannot find symbol
Knob knob = kids[i].getKnobs()[kk];
^
symbol: class Knob
location: class RobotImpl
Main.java:205: error: cannot find symbol
BComponent ksource = knob.getSourceComponent();
^
symbol: class BComponent
location: class RobotImpl
Main.java:206: error: cannot find symbol
BComponent kdest = knob.getTargetComponent();
^
symbol: class BComponent
location: class RobotImpl
Main.java:207: error: cannot find symbol
BWsAnnotation bw_dest = (BWsAnnotation)kdest.get("wsAnnotation");
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:207: error: cannot find symbol
BWsAnnotation bw_dest = (BWsAnnotation)kdest.get("wsAnnotation");
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:208: error: cannot find symbol
BWsAnnotation bw_source = (BWsAnnotation)ksource.get("wsAnnotation");
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:208: error: cannot find symbol
BWsAnnotation bw_source = (BWsAnnotation)ksource.get("wsAnnotation");
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:212: error: cannot find symbol
Slot[] kslots = kdest.getSlotsArray();
^
symbol: class Slot
location: class RobotImpl
Main.java:214: error: cannot find symbol
if((kdest.getFlags(kslots[k1]) & Flags.SUMMARY)!=0) temp_pinnedSlots = temp_pinnedSlots+1;
^
symbol: variable Flags
location: class RobotImpl
Main.java:215: error: cannot find symbol
if((kdest.getFlags(kslots[k1]) & Flags.COMPOSITE)!=0) temp_pinnedSlots = temp_pinnedSlots+1;
^
symbol: variable Flags
location: class RobotImpl
Main.java:221: error: cannot find symbol
log.println(depth);
^
symbol: variable log
location: class RobotImpl
Main.java:224: error: cannot find symbol
BWsAnnotation bw_new = BWsAnnotation.make(temp_x+3,temp_y);
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:224: error: cannot find symbol
BWsAnnotation bw_new = BWsAnnotation.make(temp_x+3,temp_y);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:225: error: cannot find symbol
BWsAnnotation bw_current = (BWsAnnotation)ksource.get("wsAnnotation");
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:225: error: cannot find symbol
BWsAnnotation bw_current = (BWsAnnotation)ksource.get("wsAnnotation");
^
symbol: class BWsAnnotation
location: class RobotImpl
Main.java:227: error: cannot find symbol
bw_current = BWsAnnotation.merge(bw_current, bw_new);
^
symbol: variable BWsAnnotation
location: class RobotImpl
Main.java:235: error: cannot find symbol
log.println("Rearranged wiresheet: " + c.getSlotPathOrd());
^
symbol: variable log
location: class RobotImpl
Main.java:247: error: cannot find symbol
BLink[] clinks = clink.getLinks();
^
symbol: class BLink
location: class RobotImpl
Main.java:275: error: cannot find symbol
String a1Name = ((BComponent)a1).getName();
^
symbol: class BComponent
location: class RobotImpl.NameComparator
Main.java:276: error: cannot find symbol
String a2Name = ((BComponent)a2).getName();
^
symbol: class BComponent
location: class RobotImpl.NameComparator
Main.java:286: error: cannot find symbol
BComponent[] a1ca = ((BComponent)a1).getChildComponents();
^
symbol: class BComponent
location: class RobotImpl.IdComparator
Main.java:286: error: cannot find symbol
BComponent[] a1ca = ((BComponent)a1).getChildComponents();
^
symbol: class BComponent
location: class RobotImpl.IdComparator
Main.java:288: error: cannot find symbol
BComponent[] a2ca = ((BComponent)a2).getChildComponents();
^
symbol: class BComponent
location: class RobotImpl.IdComparator
Main.java:288: error: cannot find symbol
BComponent[] a2ca = ((BComponent)a2).getChildComponents();
^
symbol: class BComponent
location: class RobotImpl.IdComparator
Main.java:293: error: cannot find symbol
BComponent a1_ext = ((BComponent)a1).getChildComponents()[0];
^
symbol: class BComponent
location: class RobotImpl.IdComparator
Main.java:293: error: cannot find symbol
BComponent a1_ext = ((BComponent)a1).getChildComponents()[0];
^
symbol: class BComponent
location: class RobotImpl.IdComparator
Main.java:294: error: cannot find symbol
BSimple a1Simple = a1_ext.get("objectId").asSimple();
^
symbol: class BSimple
location: class RobotImpl.IdComparator
Main.java:299: error: cannot find symbol
BComponent a2_ext = ((BComponent)a2).getChildComponents()[0];
^
symbol: class BComponent
location: class RobotImpl.IdComparator
Main.java:299: error: cannot find symbol
BComponent a2_ext = ((BComponent)a2).getChildComponents()[0];
^
symbol: class BComponent
location: class RobotImpl.IdComparator
Main.java:300: error: cannot find symbol
BSimple a2Simple = a2_ext.get("objectId").asSimple();
^
symbol: class BSimple
location: class RobotImpl.IdComparator
Main.java:308: error: cannot find symbol
String a1Name = ((BComponent)a1).getName();
^
symbol: class BComponent
location: class RobotImpl.IdComparator
Main.java:309: error: cannot find symbol
String a2Name = ((BComponent)a2).getName();
^
symbol: class BComponent
location: class RobotImpl.IdComparator
76 errors
Standard output is empty