//-------------------------------------------------------------------------- // // Predefined Variables // //-------------------------------------------------------------------------- CPUXA cpuxa; Time time; // Always contains the current time Number month; // Always contains the current month Number dayOfMonth; // Always contains the current day of the month Number dayOfWeek; // Always contains the current day of the week Number year; // Always contains the current year Date date; // Always contains the current date //-------------------------------------------------------------------------- // // Predefined Constants // //-------------------------------------------------------------------------- Number IsOff = new Number(0); Number IsOn = new Number(1); Number TurnsOff = new Number(2); Number TurnsOn = new Number(3); Number OnCmdPair = new Number(4); Number OffCmdPair = new Number(5); Number Unset = new Number(0); Number True = new Number(1); Number False = new Number(2); Number On = new Number(1); Number Off = new Number(2); Number January = new Number(1); Number February = new Number(2); Number March = new Number(3); Number April = new Number(4); Number May = new Number(5); Number June = new Number(6); Number July = new Number(7); Number August = new Number(8); Number September = new Number(9); Number October = new Number(10); Number November = new Number(11); Number December = new Number(12); Number Sunday = new Number(0); Number Monday = new Number(1); Number Tuesday = new Number(2); Number Wednesday = new Number(3); Number Thursday = new Number(4); Number Friday = new Number(5); Number Saturday = new Number(6); //-------------------------------------------------------------------------- // // Predefined Classes // //-------------------------------------------------------------------------- class CPUXA { // Constructor: This is private. There is a predefined variable named // cpuxa of this type for clients to access. private CPUXA(); // // Conditionals // boolean receiveIR(Number irCode); // ir code must be 1-1024 boolean recvX10(X10Code code); boolean x10State(X10Code code, Number state); // state: 0-5 boolean ioError(); // // Commands // void xmitIR(Number irCode); // ir code must be 1-1024 void xmitX10(X10Code code); void xmitX10Rpt(X10Code code, Number repeat); // repeat: 1-5 void x10QuickOn(X10Code code); void x10QuickOff(X10Code code); void pcsPreset(X10Code code, Number level); // level: 0-31 void pcsPresetPct(X10Code code, Number pct); // pct: 0-100 void levPreset(X10Code code, Number level); // level: 0-63 void levPresetPct(X10Code code, Number pct); // pct: 0-100 void levGrpOff(X10Code code); void levGrpPreset(X10Code code, Number level); // level: 0-63 void sendAscii(Number asciiMsgNum); // msgNum 0-127 void sendPage(Number pageMsgNum); // pageMsgNum 1-15 } class Date { // Constructor: Accepts a number of different date formats Date(String date); // A Date can be compared to the built-in 'date' variable. Internally // that turns into a call on the private compare() method. // Date has no other methods defined on it. // private boolean compare(String comparisonOp, Date otherDate); } class Module { // Constructor Module(Number moduleNum); // moduleNum: 0-127 void xmitIR(Number zone, extIRCode code); // zone: 0-15, extIRCode: 1-65535 void xmitSpeakEasy(Number msgNum); // msgNum: 0-31 } class Number { // Constructor Number(short num); // num: 0-65535 /** Numbers can be compared to other numbers and can have there values set. Internally these operations turn into calls on the private methods compare and set. */ private boolean compare(String comparisonOp, Number otherNum); private boolean set(String AssignmentOp, Number value); } class X10Code { /** Constructor takes a string of the form "[A-P]/Number" or "Number/Number". For example: "K/12" or "13/12". */ X10Code(String code); } class Time { /** Constructor takes a string which is either an absolute time or an offset srom sunrise or sunset. Absolute times are of the form HH:MM and use 24 hour notation. For example: "9:45", "06:37", "15:43". Relative times are offsets of -30..+30 minutes from sunrise or sunset and are of the form (S|R)(+|-)N. Use 'S' for sunSet and 'R' for sunRise. For example, 20 minutes before sunrise would be "R-20" and 15 minutes after sunset would be "S+15". */ Time(String time); /** A Time can be compared to the built-in 'time' variable. Internally that turns into a call on the private compare() method. Time has no other methods defined on it. */ private boolean compare(String comparisonOp, Time otherTime); } class Timer { /** Constructor takes an initial value for the timer. If no initial value is given, the timer starts at 0 (it's disabled). */ Timer(short num); // num: 0-65535 /** Timers can be compared to numbers and can have there values set. Internally these operations turn into calls on the private methods compare and set. */ private boolean compare(String comparisonOp, Number num); private boolean set(String AssignmentOp, Number value); } class Point { /** Constructor takes a string indicating the module number and the point on that module : "M/P". The module number must be between 0 and 127 and the point number must be between 0 and 15. For example, module 3, point 7 would be "3/7". */ Point(String pointSpec); /** Returns true if the Point is in the given state. */ boolean isOff(); boolean isOn(); boolean turnsOff(); boolean turnsOn(); /** Turns on or off this point. */ void turnOn(); void turnOff(); } class Param { /** Constructor takes a string indicating the module number and the param number : "M/P". The module number must be between 0 and 127 and the param number must be between 0 and 15. For example, module 3, param 7 would be "3/7". */ Param(String pointSpec); /** Params can be compared to numbers. Internally this operation turns into calls on the private method compare. */ private boolean compare(String comparisonOp, Number num); }