Search in sources :

Example 21 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class IssueTableModel method getComparator.

@Override
protected Comparator<Issue> getComparator(final int col, final boolean ascending) {
    return new Comparator<Issue>() {

        public int compare(Issue o1, Issue o2) {
            VCDocument vcDocument = (issueManager != null) ? (issueManager.getVCDocument()) : null;
            int scale = ascending ? 1 : -1;
            switch(col) {
                case COLUMN_DESCRIPTION:
                    {
                        Severity s1 = o1.getSeverity();
                        Severity s2 = o2.getSeverity();
                        if (s1 == s2) {
                            return scale * o1.getMessage().compareTo(o2.getMessage());
                        } else {
                            return scale * s1.compareTo(s2);
                        }
                    }
                case COLUMN_URL:
                    {
                        String u1 = o1.getHyperlink();
                        String u2 = o2.getHyperlink();
                        return u1 != null ? u1.compareTo(u2) : -1;
                    }
                case COLUMN_SOURCE:
                    return scale * getSourceObjectDescription(vcDocument, o1).compareTo(getSourceObjectDescription(vcDocument, o2));
                case COLUMN_PATH:
                    return scale * getSourceObjectPathDescription(vcDocument, o1).compareTo(getSourceObjectPathDescription(vcDocument, o2));
            }
            return 0;
        }
    };
}
Also used : Issue(org.vcell.util.Issue) VCDocument(org.vcell.util.document.VCDocument) Severity(org.vcell.util.Issue.Severity) Comparator(java.util.Comparator)

Example 22 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class GeometrySpec method gatherIssues.

public void gatherIssues(IssueContext issueContext, Geometry geometry, List<Issue> issueVector) {
    // 
    if (getDimension() > 0) {
        VCImage argSampledImage = getSampledImage().getCurrentValue();
        if (argSampledImage == null) {
            return;
        }
        try {
            // 
            // make sure that each sample was assigned to a SubVolume
            // 
            int count = 0;
            byte[] samples = argSampledImage.getPixels();
            for (int i = 0; i < samples.length; i++) {
                if (samples[i] == -1) {
                    count++;
                }
            }
            if (count > 0) {
                String errorMessage = "Invalid Geometry - " + count + " of " + samples.length + " samples of geometry domain didn't map to any subdomain";
                Issue issue = new Issue(geometry, issueContext, IssueCategory.SubVolumeVerificationError, errorMessage, Issue.SEVERITY_ERROR);
                issueVector.add(issue);
            }
            // 
            // make sure that each subvolume is resolved in the geometry
            // 
            ArrayList<SubVolume> missingSubVolumeList = new ArrayList<SubVolume>();
            SubVolume[] subVolumes = getSubVolumes();
            for (int i = 0; i < subVolumes.length; i++) {
                if (argSampledImage.getPixelClassFromPixelValue(subVolumes[i].getHandle()) == null) {
                    missingSubVolumeList.add(subVolumes[i]);
                }
            }
            if (missingSubVolumeList.size() > 0) {
                for (int i = 0; i < missingSubVolumeList.size(); i++) {
                    String errorMessage = "Subdomain '" + missingSubVolumeList.get(i).getName() + "' is not resolved in geometry domain";
                    Issue issue = new Issue(geometry, issueContext, IssueCategory.SubVolumeVerificationError, errorMessage, Issue.SEVERITY_ERROR);
                    issueVector.add(issue);
                }
            }
        } catch (Exception ex) {
            Issue issue = new Issue(geometry, issueContext, IssueCategory.SubVolumeVerificationError, ex.getMessage(), Issue.SEVERITY_ERROR);
            issueVector.add(issue);
        }
    }
}
Also used : Issue(org.vcell.util.Issue) ArrayList(java.util.ArrayList) VCImage(cbit.image.VCImage) PropertyVetoException(java.beans.PropertyVetoException) ImageException(cbit.image.ImageException) ExpressionException(cbit.vcell.parser.ExpressionException)

Example 23 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class FeatureMapping method gatherIssues.

public void gatherIssues(IssueContext issueContext, List<Issue> issueVector) {
    super.gatherIssues(issueContext, issueVector);
    if (simulationContext.getGeometry().getDimension() == 0) {
        if (!simulationContext.getGeometryContext().isAllSizeSpecifiedPositive()) {
            String tooltip = "\nIn non-spatial application, size of structure '" + getStructure().getName() + "' must be assigned a positive value if referenced in the model.";
            String message = "In non-spatial application, size of structure '" + getStructure().getName() + "' must be assigned a positive value.";
            issueVector.add(new Issue(this, issueContext, IssueCategory.StructureMappingSizeParameterNotSet, message, Issue.SEVERITY_WARNING));
        }
    }
}
Also used : Issue(org.vcell.util.Issue)

Example 24 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class MembraneMapping method gatherIssues.

public void gatherIssues(IssueContext issueContext, List<Issue> issueVector) {
    super.gatherIssues(issueContext, issueVector);
    if (simulationContext.getGeometry().getDimension() == 0) {
        if (!simulationContext.getGeometryContext().isAllSizeSpecifiedPositive()) {
            String tooltip = "\nIn non-spatial application, size of structure '" + getStructure().getName() + "' must be assigned a positive value if referenced in the model.";
            String message = "In non-spatial application, size of structure '" + getStructure().getName() + "' must be assigned a positive value.";
            issueVector.add(new Issue(this, issueContext, IssueCategory.StructureMappingSizeParameterNotSet, message, Issue.SEVERITY_WARNING));
        }
    }
}
Also used : Issue(org.vcell.util.Issue)

Example 25 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class MicroscopeMeasurement method gatherIssues.

public void gatherIssues(IssueContext issueContext, List<Issue> issueVector) {
    issueContext = issueContext.newChildContext(ContextType.MicroscopyMeasurement, this);
    if (fluorescentSpecies.size() > 0) {
        if (getConvolutionKernel() instanceof ProjectionZKernel && simulationContext.getGeometry().getDimension() != 3) {
            Issue issue = new Issue(this, issueContext, IssueCategory.Microscope_Measurement_ProjectionZKernel_Geometry_3DWarning, "Z Projection is only supported in 3D spatial applications.", Issue.SEVERITY_ERROR);
            issueVector.add(issue);
        }
    }
}
Also used : Issue(org.vcell.util.Issue)

Aggregations

Issue (org.vcell.util.Issue)88 ArrayList (java.util.ArrayList)18 IssueContext (org.vcell.util.IssueContext)14 Expression (cbit.vcell.parser.Expression)13 ExpressionException (cbit.vcell.parser.ExpressionException)13 PropertyVetoException (java.beans.PropertyVetoException)9 MolecularType (org.vcell.model.rbm.MolecularType)9 Structure (cbit.vcell.model.Structure)8 VCUnitDefinition (cbit.vcell.units.VCUnitDefinition)8 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)7 MolecularComponentPattern (org.vcell.model.rbm.MolecularComponentPattern)7 Model (cbit.vcell.model.Model)6 ModelParameter (cbit.vcell.model.Model.ModelParameter)6 ExpressionBindingException (cbit.vcell.parser.ExpressionBindingException)6 BioModel (cbit.vcell.biomodel.BioModel)5 ModelException (cbit.vcell.model.ModelException)5 Product (cbit.vcell.model.Product)5 Reactant (cbit.vcell.model.Reactant)5 ReactionParticipant (cbit.vcell.model.ReactionParticipant)5 InteriorPoint (org.sbml.jsbml.ext.spatial.InteriorPoint)5