2525import org .labkey .api .query .FieldKey ;
2626import org .labkey .api .query .QueryRowReference ;
2727import org .labkey .api .security .User ;
28+ import org .labkey .api .util .FileUtil ;
2829import org .labkey .api .view .ActionURL ;
2930import org .labkey .flow .FlowSettings ;
3031import org .labkey .flow .analysis .model .CompensationMatrix ;
3839import org .labkey .flow .query .FlowTableType ;
3940
4041import jakarta .servlet .http .HttpServletRequest ;
41- import java .io .File ;
4242import java .io .Serializable ;
43- import java .util .ArrayList ;
4443import java .util .HashMap ;
4544import java .util .List ;
4645import java .util .Map ;
@@ -89,7 +88,7 @@ static public FlowCompensationMatrix create(User user, Container container, Stri
8988 {
9089 data = svc .createData (container , FlowDataType .CompensationMatrix , name );
9190 }
92- data .setDataFileURI (new File (FlowSettings .getWorkingDirectory (), "compensation." + FlowDataHandler .EXT_DATA ).toURI ());
91+ data .setDataFileURI (FileUtil . appendName (FlowSettings .getWorkingDirectory (), "compensation." + FlowDataHandler .EXT_DATA ).toURI ());
9392 data .save (user );
9493 AttributeSetHelper .doSave (attrs , user , data , log );
9594 flowComp = (FlowCompensationMatrix ) FlowDataObject .fromData (data );
@@ -105,8 +104,8 @@ public CompensationMatrix getCompensationMatrix()
105104
106105 static public CompensationMatrix getCompensationMatrix (String name , AttributeSet attrs )
107106 {
108- TreeSet <String > channelNames = new TreeSet ();
109- Map <String , Double > values = new HashMap ();
107+ TreeSet <String > channelNames = new TreeSet <> ();
108+ Map <String , Double > values = new HashMap <> ();
110109 for (Map .Entry <StatisticSpec , Double > entry : attrs .getStatistics ().entrySet ())
111110 {
112111 StatisticSpec spec = entry .getKey ();
@@ -119,20 +118,20 @@ static public CompensationMatrix getCompensationMatrix(String name, AttributeSet
119118 channelNames .add (strChannel );
120119 values .put (spec .getParameter (), entry .getValue ());
121120 }
122- if (channelNames .size () == 0 )
121+ if (channelNames .isEmpty () )
123122 return null ;
124123 CompensationMatrix ret = new CompensationMatrix (name );
125- String [] arrChannelNames = channelNames .toArray (new String [channelNames . size () ]);
124+ String [] arrChannelNames = channelNames .toArray (new String [0 ]);
126125
127- for (int iChannel = 0 ; iChannel < arrChannelNames . length ; iChannel ++ )
126+ for (String arrChannelName : arrChannelNames )
128127 {
129- Map <String , Double > channelValues = new TreeMap ();
130- for (int iChannelValue = 0 ; iChannelValue < arrChannelNames . length ; iChannelValue ++ )
128+ Map <String , Double > channelValues = new TreeMap <> ();
129+ for (String channelName : arrChannelNames )
131130 {
132- String key = arrChannelNames [ iChannel ] + ":" + arrChannelNames [ iChannelValue ] ;
133- channelValues .put (arrChannelNames [ iChannelValue ] , values .get (key ));
131+ String key = arrChannelName + ":" + channelName ;
132+ channelValues .put (channelName , values .get (key ));
134133 }
135- ret .setChannel (arrChannelNames [ iChannel ] , channelValues );
134+ ret .setChannel (arrChannelName , channelValues );
136135 }
137136 return ret ;
138137 }
@@ -195,15 +194,17 @@ static public List<FlowCompensationMatrix> getCompensationMatrices(Container con
195194 {
196195 return (List ) FlowDataObject .fromDataType (container , FlowDataType .CompensationMatrix );
197196 }
198- static public List <FlowCompensationMatrix > getUploadedCompensationMatrices (Container container )
199- {
200- List <FlowCompensationMatrix > all = getCompensationMatrices (container );
201- List <FlowCompensationMatrix > ret = new ArrayList ();
202- for (FlowCompensationMatrix comp : all )
203- {
204- if (comp .getRun () == null )
205- ret .add (comp );
206- }
207- return ret ;
208- }
197+
198+ //TODO remove?
199+ // static public List<FlowCompensationMatrix> getUploadedCompensationMatrices(Container container)
200+ // {
201+ // List<FlowCompensationMatrix> all = getCompensationMatrices(container);
202+ // List<FlowCompensationMatrix> ret = new ArrayList<>();
203+ // for (FlowCompensationMatrix comp : all)
204+ // {
205+ // if (comp.getRun() == null)
206+ // ret.add(comp);
207+ // }
208+ // return ret;
209+ // }
209210}
0 commit comments