Search in sources :

Example 6 with SchedulerStatus

use of cbit.vcell.server.SimulationJobStatus.SchedulerStatus in project vcell by virtualcell.

the class SimulationJobsTableModel method getComparator.

public Comparator<SimpleJobStatus> getComparator(final int col, final boolean ascending) {
    final int scale = ascending ? 1 : -1;
    return new Comparator<SimpleJobStatus>() {

        public int compare(SimpleJobStatus o1, SimpleJobStatus o2) {
            String s1 = "";
            String s2 = "";
            switch(col) {
                case iColModelApp:
                    if (o1.simulationDocumentLink instanceof BioModelLink) {
                        BioModelLink bml = (BioModelLink) o1.simulationDocumentLink;
                        s1 = "(BM) " + bml.bioModelName + ",(App) " + bml.simContextName;
                    } else if (o1.simulationDocumentLink instanceof MathModelLink) {
                        MathModelLink mml = (MathModelLink) o1.simulationDocumentLink;
                        s1 = "(MM) " + mml.mathModelName;
                    }
                    if (o2.simulationDocumentLink instanceof BioModelLink) {
                        BioModelLink bml = (BioModelLink) o2.simulationDocumentLink;
                        s2 = "(BM) " + bml.bioModelName + ",(App) " + bml.simContextName;
                    } else if (o2.simulationDocumentLink instanceof MathModelLink) {
                        MathModelLink mml = (MathModelLink) o2.simulationDocumentLink;
                        s2 = "(MM) " + mml.mathModelName;
                    }
                    return scale * s1.compareToIgnoreCase(s2);
                case iColSimulation:
                    s1 = o1.simulationMetadata.simname;
                    s2 = o2.simulationMetadata.simname;
                    if (!s1.equalsIgnoreCase(s2)) {
                        return scale * s1.compareToIgnoreCase(s2);
                    } else {
                        // if same simulation, sort by date
                        Date d1 = o1.jobStatus.getStartDate();
                        Date d2 = o2.jobStatus.getStartDate();
                        return scale * d1.compareTo(d2);
                    }
                case iColSimId:
                    s1 = o1.simulationMetadata.vcSimID.getSimulationKey().toString() + "," + o1.jobStatus.getJobIndex() + "," + o1.jobStatus.getTaskID();
                    s2 = o2.simulationMetadata.vcSimID.getSimulationKey().toString() + "," + o2.jobStatus.getJobIndex() + "," + o2.jobStatus.getTaskID();
                    return scale * s1.compareToIgnoreCase(s2);
                case iColSolver:
                    if (o1.simulationMetadata.solverTaskDesc != null && o1.simulationMetadata.solverTaskDesc.getSolverDescription() != null) {
                        s1 = o1.simulationMetadata.solverTaskDesc.getSolverDescription().getDisplayLabel();
                    }
                    if (o2.simulationMetadata.solverTaskDesc != null && o2.simulationMetadata.solverTaskDesc.getSolverDescription() != null) {
                        s2 = o2.simulationMetadata.solverTaskDesc.getSolverDescription().getDisplayLabel();
                    }
                    return scale * s1.compareToIgnoreCase(s2);
                case iColSubmitDate:
                    Date d1 = o1.jobStatus.getSubmitDate();
                    Date d2 = o2.jobStatus.getSubmitDate();
                    return scale * d1.compareTo(d2);
                case iColHasData:
                    Boolean b1 = o1.jobStatus.hasData();
                    Boolean b2 = o2.jobStatus.hasData();
                    return scale * b1.compareTo(b2);
                case iColStatus:
                    SchedulerStatus ss1 = o1.jobStatus.getSchedulerStatus();
                    SchedulerStatus ss2 = o2.jobStatus.getSchedulerStatus();
                    return scale * ss1.compareTo(ss2);
                case iColMessage:
                    if (o1.jobStatus != null && o1.jobStatus.getSimulationMessage() != null) {
                        s1 = o1.jobStatus.getSimulationMessage().getDisplayMessage();
                    }
                    if (o2.jobStatus != null && o2.jobStatus.getSimulationMessage() != null) {
                        s2 = o2.jobStatus.getSimulationMessage().getDisplayMessage();
                    }
                    return scale * s1.compareToIgnoreCase(s2);
                case iColSite:
                    s1 = o1.jobStatus.getServerID().toString();
                    s2 = o2.jobStatus.getServerID().toString();
                    return scale * s1.compareToIgnoreCase(s2);
                default:
                    return 0;
            }
        }
    };
}
Also used : BioModelLink(cbit.vcell.server.BioModelLink) SchedulerStatus(cbit.vcell.server.SimulationJobStatus.SchedulerStatus) MathModelLink(cbit.vcell.server.MathModelLink) Date(java.util.Date) Comparator(java.util.Comparator) SimpleJobStatus(cbit.vcell.server.SimpleJobStatus)

Aggregations

SchedulerStatus (cbit.vcell.server.SimulationJobStatus.SchedulerStatus)6 Date (java.util.Date)5 SimulationExecutionStatus (cbit.vcell.server.SimulationExecutionStatus)4 SimulationJobStatus (cbit.vcell.server.SimulationJobStatus)4 SimulationQueueEntryStatus (cbit.vcell.server.SimulationQueueEntryStatus)4 SimulationMessage (cbit.vcell.solver.server.SimulationMessage)3 VCellServerID (org.vcell.util.document.VCellServerID)3 StatusMessage (cbit.vcell.message.messages.StatusMessage)2 HtcJobID (cbit.vcell.server.HtcJobID)2 SimpleJobStatus (cbit.vcell.server.SimpleJobStatus)2 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)2 KeyValue (org.vcell.util.document.KeyValue)2 VCellSortTableModel (cbit.vcell.client.desktop.biomodel.VCellSortTableModel)1 VCMessage (cbit.vcell.message.VCMessage)1 WorkerEventMessage (cbit.vcell.message.messages.WorkerEventMessage)1 BioModelLink (cbit.vcell.server.BioModelLink)1 MathModelLink (cbit.vcell.server.MathModelLink)1 RunningStateInfo (cbit.vcell.server.RunningStateInfo)1 SimulationQueueID (cbit.vcell.server.SimulationJobStatus.SimulationQueueID)1 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)1