|
|
/home/brennan/Software/sensix/source/C^4/corba/gov/lanl/isr/sensix/FunctorImpl.javaGo to the documentation of this file.00001 00010 /* 00011 * Copyright 2008. Los Alamos National Security, LLC. This material 00012 * was produced under U.S. Government contract DE-AC52-06NA25396 for 00013 * Los Alamos National Laboratory (LANL), which is operated by Los 00014 * Alamos National Security, LLC, for the Department of Energy. The 00015 * U.S. Government has rights to use, reproduce, and distribute this 00016 * software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, 00017 * LLC, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL 00018 * LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to 00019 * produce derivative works, such modified software should be clearly 00020 * marked, so as not to confuse it with the version available from LANL. 00021 * 00022 * Additionally, this program is free software; you can redistribute 00023 * it and/or modify it under the terms of the GNU General Public 00024 * License as published by the Free Software Foundation; version 2 of 00025 * the License. Accordingly, this program is distributed in the hope 00026 * it will be useful, but WITHOUT ANY WARRANTY; without even the 00027 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00028 * PURPOSE. See the GNU General Public License for more details. 00029 * 00030 * You should have received a copy of the GNU General Public License 00031 * along with this program; if not, write to the Free Software 00032 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00033 */ 00034 00035 package gov.lanl.isr.sensix; 00036 00037 00038 public class FunctorImpl extends FunctorPOA 00039 { 00040 public static int SEQUENCE = 0; 00041 public static final int MAX = 16777215; 00042 00043 protected byte id; 00044 protected int seq_num; 00045 protected byte importance; 00046 protected Functor[] subs; 00047 protected Data[] data_set; 00048 protected FunctorError[] errs; 00049 00050 00051 public FunctorImpl(Functor[] subfs) { 00052 id = SenseCorba.INVALID; 00053 subs = subfs; 00054 data_set = new Data[0]; 00055 errs = new FunctorError[0]; 00056 synchronized(this) { 00057 seq_num = SEQUENCE; 00058 if (++SEQUENCE == MAX) 00059 SEQUENCE = 0; 00060 } 00061 } 00062 00063 public FunctorImpl() { 00064 id = SenseCorba.INVALID; 00065 subs = new Functor[0]; 00066 data_set = new Data[0]; 00067 errs = new FunctorError[0]; 00068 synchronized(this) { 00069 seq_num = SEQUENCE; 00070 if (++SEQUENCE == MAX) 00071 SEQUENCE = 0; 00072 } 00073 } 00074 00075 public FunctorImpl(Functor[] subfs, int seq) { 00076 id = SenseCorba.INVALID; 00077 subs = subfs; 00078 data_set = new Data[0]; 00079 errs = new FunctorError[0]; 00080 seq_num = seq; 00081 } 00082 00083 public FunctorImpl(int seq) { 00084 id = SenseCorba.INVALID; 00085 subs = new Functor[0]; 00086 data_set = new Data[0]; 00087 errs = new FunctorError[0]; 00088 seq_num = seq; 00089 } 00090 00091 00092 public byte identifier() { 00093 return id; 00094 } 00095 00096 public int sequencer() { 00097 return seq_num; 00098 } 00099 00100 public Data[] results() { 00101 return data_set; 00102 } 00103 00104 public void results(Data[] data) { 00105 data_set = data; 00106 } 00107 00108 00109 public FunctorError[] errors() { 00110 return errs; 00111 } 00112 00113 public void errors(FunctorError[] e) { 00114 errs = e; 00115 } 00116 00117 00118 public byte priority() { 00119 return importance; 00120 } 00121 00122 public void priority(byte p) { 00123 importance = p; 00124 } 00125 00126 00127 public Functor[] subfunctors() { 00128 return subs; 00129 } 00130 00131 public void subfunctors(Functor[] fs) { 00132 subs = fs; 00133 } 00134 00135 00136 public String asString() { 00137 return "functor(invalid)"; 00138 } 00139 } |