Search in sources :

Example 26 with ComponentStateDefinition

use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.

the class ReactionRuleEditorPropertiesPanel method manageComponentPatternFromShape.

public void manageComponentPatternFromShape(final Object selectedObject, PointLocationInShapeContext locationContext, final ReactionRulePropertiesTreeModel treeModel, ShowWhat showWhat, boolean bIsReactant) {
    popupFromShapeMenu.removeAll();
    final MolecularComponentPattern mcp = (MolecularComponentPattern) selectedObject;
    final MolecularComponent mc = mcp.getMolecularComponent();
    boolean anyStateProhibited = false;
    boolean explicitStateProhibited = false;
    boolean existBondProhibited = false;
    boolean noneBondProhibited = false;
    boolean possibleBondProhibited = false;
    boolean specifiedBondProhibited = false;
    if (!bIsReactant) {
        // product has restrictions for states and bonds, depending on reactant
        BondType reactantComponentBondType = reactionRule.getReactantComponentBondType(mcp);
        if (reactantComponentBondType != null && reactantComponentBondType == BondType.Exists) {
            // has external		+
            // existBondProhibited = true;
            noneBondProhibited = true;
            possibleBondProhibited = true;
            specifiedBondProhibited = true;
        } else if (reactantComponentBondType != null && reactantComponentBondType == BondType.None) {
            // is unbound		-
            existBondProhibited = true;
            // noneBondProhibited = true;
            possibleBondProhibited = true;
        // specifiedBondProhibited = true;
        } else if (reactantComponentBondType != null && reactantComponentBondType == BondType.Possible) {
            // may be bound		?
            existBondProhibited = true;
            noneBondProhibited = true;
            // possibleBondProhibited = true;
            specifiedBondProhibited = true;
        } else if (reactantComponentBondType != null && reactantComponentBondType == BondType.Specified) {
            existBondProhibited = true;
            // noneBondProhibited = true;
            possibleBondProhibited = true;
        // specifiedBondProhibited = true;
        }
        // if it's null nothing is prohibited
        ComponentStatePattern reactantComponentStatePattern = reactionRule.getReactantComponentState(mcp);
        if (reactantComponentStatePattern != null && reactantComponentStatePattern.isAny()) {
            explicitStateProhibited = true;
        } else if (reactantComponentStatePattern != null && !reactantComponentStatePattern.isAny()) {
            anyStateProhibited = true;
        }
    // if reactantComponentStatePattern is null nothing is prohibited, we may not have a matching reactant for this product
    }
    // ------------------------------------------------------------------- State
    if (showWhat == ShowWhat.ShowState && mc.getComponentStateDefinitions().size() != 0) {
        String prefix = "State:  ";
        String csdCurrentName = "";
        final Map<String, String> itemMap = new LinkedHashMap<String, String>();
        if (mcp.getComponentStatePattern() == null || mcp.getComponentStatePattern().isAny()) {
            csdCurrentName = "<html>" + prefix + "<b>" + ComponentStatePattern.strAny + "</b></html>";
        } else {
            csdCurrentName = "<html>" + prefix + ComponentStatePattern.strAny + "</html>";
        }
        itemMap.put(csdCurrentName, ComponentStatePattern.strAny);
        for (final ComponentStateDefinition csd : mc.getComponentStateDefinitions()) {
            csdCurrentName = "";
            if (mcp.getComponentStatePattern() != null && !mcp.getComponentStatePattern().isAny()) {
                ComponentStateDefinition csdCurrent = mcp.getComponentStatePattern().getComponentStateDefinition();
                csdCurrentName = csdCurrent.getName();
            }
            String name = csd.getName();
            if (name.equals(csdCurrentName)) {
                // currently selected menu item is shown in bold
                name = "<html>" + prefix + "<b>" + name + "</b></html>";
            } else {
                name = "<html>" + prefix + name + "</html>";
            }
            itemMap.put(name, csd.getName());
        }
        for (String key : itemMap.keySet()) {
            JMenuItem menuItem = new JMenuItem(key);
            if (!bIsReactant) {
                String name = itemMap.get(key);
                if (name.equals(ComponentStatePattern.strAny) && anyStateProhibited) {
                    menuItem.setEnabled(false);
                } else if (!name.equals(ComponentStatePattern.strAny) && explicitStateProhibited) {
                    menuItem.setEnabled(false);
                }
            }
            popupFromShapeMenu.add(menuItem);
            menuItem.setIcon(VCellIcons.rbmComponentStateIcon);
            menuItem.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    String key = e.getActionCommand();
                    String name = itemMap.get(key);
                    ComponentStatePattern csp = new ComponentStatePattern();
                    if (!name.equals(ComponentStatePattern.strAny)) {
                        ComponentStateDefinition csd = mcp.getMolecularComponent().getComponentStateDefinition(name);
                        if (csd == null) {
                            throw new RuntimeException("Missing ComponentStateDefinition " + name + " for Component " + mcp.getMolecularComponent().getName());
                        }
                        csp = new ComponentStatePattern(csd);
                    }
                    mcp.setComponentStatePattern(csp);
                    if (bIsReactant) {
                        reflectStateToProduct(mcp, csp);
                        productTreeModel.populateTree();
                    }
                    treeModel.populateTree();
                    shapePanel.repaint();
                }
            });
        }
    }
    if (showWhat == ShowWhat.ShowState) {
        return;
    }
    // ------------------------------------------------------------------------------------------- Bonds
    final MolecularTypePattern mtp = locationContext.getMolecularTypePattern();
    final SpeciesPattern sp = locationContext.getSpeciesPattern();
    JMenu editBondMenu = new JMenu();
    final String specifiedString = mcp.getBondType() == BondType.Specified ? "<html><b>" + "Site bond specified" + "</b></html>" : "<html>" + "Site bond specified" + "</html>";
    editBondMenu.setText(specifiedString);
    editBondMenu.setToolTipText("Specified");
    editBondMenu.removeAll();
    editBondMenu.setEnabled(!specifiedBondProhibited);
    final Map<String, Bond> itemMap = new LinkedHashMap<String, Bond>();
    String noneString = mcp.getBondType() == BondType.None ? "<html><b>" + "Site is unbound" + "</b></html>" : "<html>" + "Site is unbound" + "</html>";
    // Site is bound
    String existsString = mcp.getBondType() == BondType.Exists ? "<html><b>" + "Site has external bond" + "</b></html>" : "<html>" + "Site has external bond" + "</html>";
    String possibleString = mcp.getBondType() == BondType.Possible ? "<html><b>" + "Site may be bound" + "</b></html>" : "<html>" + "Site may be bound" + "</html>";
    itemMap.put(noneString, null);
    itemMap.put(existsString, null);
    itemMap.put(possibleString, null);
    if (mtp != null && sp != null && !specifiedBondProhibited) {
        List<Bond> bondPartnerChoices = sp.getAllBondPartnerChoices(mtp, mc);
        for (Bond b : bondPartnerChoices) {
            // if(b.equals(mcp.getBond())) {
            // continue;	// if the mcp has a bond already we don't offer it
            // }
            int index = 0;
            if (mcp.getBondType() == BondType.Specified) {
                index = mcp.getBondId();
            } else {
                index = sp.nextBondId();
            }
            itemMap.put(b.toHtmlStringLong(sp, mtp, mc, index), b);
        // itemMap.put(b.toHtmlStringLong(sp, index), b);
        }
    }
    int index = 0;
    Graphics gc = shapePanel.getGraphics();
    for (String name : itemMap.keySet()) {
        JMenuItem menuItem = new JMenuItem(name);
        if (!bIsReactant) {
            if (name.equals(noneString) && noneBondProhibited) {
                menuItem.setEnabled(false);
            } else if (name.equals(existsString) && existBondProhibited) {
                menuItem.setEnabled(false);
            } else if (name.equals(possibleString) && possibleBondProhibited) {
                menuItem.setEnabled(false);
            } else if (!name.equals(noneString) && !name.equals(existsString) && !name.equals(possibleString) && specifiedBondProhibited) {
                menuItem.setEnabled(false);
            }
        }
        if (index == 0) {
            menuItem.setIcon(VCellIcons.rbmBondNoneIcon);
            menuItem.setToolTipText("None");
            popupFromShapeMenu.add(menuItem);
        } else if (index == 1) {
            menuItem.setIcon(VCellIcons.rbmBondExistsIcon);
            menuItem.setToolTipText("Exists");
            popupFromShapeMenu.add(menuItem);
        } else if (index == 2) {
            menuItem.setIcon(VCellIcons.rbmBondPossibleIcon);
            menuItem.setToolTipText("Possible");
            popupFromShapeMenu.add(menuItem);
        } else if (index > 2) {
            // we skip None, Exists, Possible
            Bond b = itemMap.get(name);
            // clone of the sp, with only the bond of interest
            SpeciesPattern spBond = new SpeciesPattern(bioModel.getModel(), sp);
            spBond.resetBonds();
            spBond.resetStates();
            MolecularTypePattern mtpFrom = spBond.getMolecularTypePattern(mtp.getMolecularType().getName(), mtp.getIndex());
            MolecularComponentPattern mcpFrom = mtpFrom.getMolecularComponentPattern(mc);
            MolecularTypePattern mtpTo = spBond.getMolecularTypePattern(b.molecularTypePattern.getMolecularType().getName(), b.molecularTypePattern.getIndex());
            MolecularComponentPattern mcpTo = mtpTo.getMolecularComponentPattern(b.molecularComponentPattern.getMolecularComponent());
            spBond.setBond(mtpTo, mcpTo, mtpFrom, mcpFrom);
            Icon icon = new SpeciesPatternSmallShape(3, 4, spBond, gc, reactionRule, false, issueManager);
            ((SpeciesPatternSmallShape) icon).setDisplayRequirements(DisplayRequirements.highlightBonds);
            menuItem.setIcon(icon);
            editBondMenu.add(menuItem);
        }
        menuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                String name = e.getActionCommand();
                BondType btBefore = mcp.getBondType();
                if (name.equals(noneString)) {
                    if (btBefore == BondType.Specified) {
                        // specified -> not specified
                        // change the partner to possible
                        mcp.getBond().molecularComponentPattern.setBondType(BondType.Possible);
                        mcp.getBond().molecularComponentPattern.setBond(null);
                    }
                    mcp.setBondType(BondType.None);
                    mcp.setBond(null);
                } else if (name.equals(existsString)) {
                    if (btBefore == BondType.Specified) {
                        // specified -> exists
                        // change the partner to possible
                        mcp.getBond().molecularComponentPattern.setBondType(BondType.Possible);
                        mcp.getBond().molecularComponentPattern.setBond(null);
                    }
                    mcp.setBondType(BondType.Exists);
                    mcp.setBond(null);
                } else if (name.equals(possibleString)) {
                    if (btBefore == BondType.Specified) {
                        // specified -> possible
                        // change the partner to possible
                        mcp.getBond().molecularComponentPattern.setBondType(BondType.Possible);
                        mcp.getBond().molecularComponentPattern.setBond(null);
                    }
                    mcp.setBondType(BondType.Possible);
                    mcp.setBond(null);
                } else {
                    if (btBefore != BondType.Specified) {
                        // if we go from a non-specified to a specified we need to find the next available
                        // bond id, so that we can choose the color for displaying the bond
                        // a bad bond id, like -1, will crash badly when trying to choose the color
                        int bondId = sp.nextBondId();
                        mcp.setBondId(bondId);
                    } else {
                        // specified -> specified
                        // change the old partner to possible, continue using the bond id
                        mcp.getBond().molecularComponentPattern.setBondType(BondType.Possible);
                        mcp.getBond().molecularComponentPattern.setBond(null);
                    }
                    mcp.setBondType(BondType.Specified);
                    Bond b = itemMap.get(name);
                    mcp.setBond(b);
                    mcp.getBond().molecularComponentPattern.setBondId(mcp.getBondId());
                    sp.resolveBonds();
                }
                // when the tree will be gone
                if (bIsReactant) {
                    reflectBondToProduct(mcp);
                    productTreeModel.populateTree();
                }
                treeModel.populateTree();
                shapePanel.repaint();
            }
        });
        index++;
    }
    popupFromShapeMenu.add(editBondMenu);
}
Also used : BondType(org.vcell.model.rbm.MolecularComponentPattern.BondType) MolecularComponentPattern(org.vcell.model.rbm.MolecularComponentPattern) SpeciesPatternSmallShape(cbit.vcell.graph.SpeciesPatternSmallShape) ActionEvent(java.awt.event.ActionEvent) ComponentStatePattern(org.vcell.model.rbm.ComponentStatePattern) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) Point(java.awt.Point) LinkedHashMap(java.util.LinkedHashMap) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition) Graphics(java.awt.Graphics) ActionListener(java.awt.event.ActionListener) MolecularComponent(org.vcell.model.rbm.MolecularComponent) Icon(javax.swing.Icon) ZoomShapeIcon(cbit.vcell.graph.gui.ZoomShapeIcon) JMenuItem(javax.swing.JMenuItem) MolecularTypePattern(org.vcell.model.rbm.MolecularTypePattern) Bond(org.vcell.model.rbm.SpeciesPattern.Bond) JMenu(javax.swing.JMenu)

Example 27 with ComponentStateDefinition

use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.

the class RbmTreeCellEditor method getTreeCellEditorComponent.

@Override
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) {
    Component component = null;
    realEditor = defaultCellEditor;
    if (value instanceof BioModelNode) {
        BioModelNode node = (BioModelNode) value;
        Object userObject = node.getUserObject();
        String text = null;
        Icon icon = null;
        if (userObject instanceof MolecularType) {
            text = ((MolecularType) userObject).getName();
            icon = VCellIcons.rbmMolecularTypeIcon;
        } else if (userObject instanceof MolecularTypePattern) {
            text = ((MolecularTypePattern) userObject).getMolecularType().getName();
            icon = VCellIcons.rbmMolecularTypeIcon;
        } else if (userObject instanceof MolecularComponent) {
            BioModelNode parentNode = (BioModelNode) node.getParent();
            Object parentObject = parentNode == null ? null : parentNode.getUserObject();
            // TODO: look for the proper icon
            icon = VCellIcons.rbmComponentErrorIcon;
            if (parentObject instanceof MolecularType) {
                text = ((MolecularComponent) userObject).getName();
            } else if (parentObject instanceof MolecularTypePattern) {
                realEditor = getMolecularComponentPatternCellEditor();
                getMolecularComponentPatternCellEditor().molecularTypePattern = ((MolecularTypePattern) parentObject);
                // find SpeciesPattern
                while (true) {
                    parentNode = (BioModelNode) parentNode.getParent();
                    if (parentNode == null) {
                        break;
                    }
                    if (parentNode.getUserObject() instanceof RbmObservable) {
                        ((MolecularComponentPatternCellEditor) realEditor).owner = MolecularComponentPatternCellEditor.observable;
                        getMolecularComponentPatternCellEditor().speciesPattern = ((RbmObservable) parentNode.getUserObject()).getSpeciesPattern(0);
                        break;
                    }
                    if (parentNode.getUserObject() instanceof ReactionRule) {
                        ((MolecularComponentPatternCellEditor) realEditor).owner = MolecularComponentPatternCellEditor.reaction;
                        ReactionRulePropertiesTreeModel tm = (ReactionRulePropertiesTreeModel) tree.getModel();
                        switch(tm.getParticipantType()) {
                            case Reactant:
                                getMolecularComponentPatternCellEditor().speciesPattern = ((ReactionRule) parentNode.getUserObject()).getReactantPattern(0).getSpeciesPattern();
                                break;
                            case Product:
                                getMolecularComponentPatternCellEditor().speciesPattern = ((ReactionRule) parentNode.getUserObject()).getProductPattern(0).getSpeciesPattern();
                                break;
                        }
                    }
                    if (parentNode.getUserObject() instanceof SpeciesContext) {
                        ((MolecularComponentPatternCellEditor) realEditor).owner = MolecularComponentPatternCellEditor.species;
                        getMolecularComponentPatternCellEditor().speciesPattern = ((SpeciesContext) parentNode.getUserObject()).getSpeciesPattern();
                        break;
                    }
                }
            }
        } else if (userObject instanceof ComponentStateDefinition) {
            text = ((ComponentStateDefinition) userObject).getName();
            icon = VCellIcons.rbmComponentStateIcon;
        } else if (userObject instanceof RbmObservable) {
            text = ((RbmObservable) userObject).getName();
            icon = VCellIcons.rbmObservableIcon;
        }
        renderer.setOpenIcon(icon);
        renderer.setClosedIcon(icon);
        renderer.setLeafIcon(icon);
        component = super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
        if (editingComponent instanceof JTextField) {
            JTextField textField = (JTextField) editingComponent;
            textField.setText(text);
        }
    }
    return component;
}
Also used : ReactionRule(cbit.vcell.model.ReactionRule) RbmObservable(cbit.vcell.model.RbmObservable) BioModelNode(cbit.vcell.desktop.BioModelNode) SpeciesContext(cbit.vcell.model.SpeciesContext) JTextField(javax.swing.JTextField) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition) MolecularType(org.vcell.model.rbm.MolecularType) MolecularComponent(org.vcell.model.rbm.MolecularComponent) Icon(javax.swing.Icon) Component(java.awt.Component) MolecularComponent(org.vcell.model.rbm.MolecularComponent) MolecularTypePattern(org.vcell.model.rbm.MolecularTypePattern)

Example 28 with ComponentStateDefinition

use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.

the class SpeciesPropertiesTreeModel method propertyChange.

public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals(PropertyConstants.PROPERTY_NAME_NAME)) {
        nodeChanged(rootNode);
    // } else if (evt.getSource() == seedSpecies && evt.getPropertyName().equals(SeedSpecies.PROPERTY_NAME_TYPE)){
    // nodeChanged(rootNode);
    } else if (evt.getPropertyName().equals("entityChange")) {
        nodeChanged(rootNode);
    } else {
        populateTree();
        Object source = evt.getSource();
        if (source == speciesContext) {
            if (evt.getPropertyName().equals(SeedSpecies.PROPERTY_NAME_SPECIES_PATTERN)) {
                SpeciesPattern oldValue = (SpeciesPattern) evt.getOldValue();
                if (oldValue != null) {
                    RbmUtils.removePropertyChangeListener(oldValue, this);
                }
                SpeciesPattern newValue = (SpeciesPattern) evt.getNewValue();
                if (newValue != null) {
                    // TODO
                    RbmUtils.addPropertyChangeListener(newValue, this);
                }
            }
        } else if (source instanceof SpeciesPattern) {
            if (evt.getPropertyName().equals(SpeciesPattern.PROPERTY_NAME_MOLECULAR_TYPE_PATTERNS)) {
                List<MolecularTypePattern> oldValue = (List<MolecularTypePattern>) evt.getOldValue();
                if (oldValue != null) {
                    for (MolecularTypePattern mtp : oldValue) {
                        RbmUtils.removePropertyChangeListener(mtp, this);
                    }
                }
                List<MolecularTypePattern> newValue = (List<MolecularTypePattern>) evt.getNewValue();
                if (newValue != null) {
                    for (MolecularTypePattern mtp : newValue) {
                        RbmUtils.addPropertyChangeListener(mtp, this);
                    }
                }
            }
        } else if (source instanceof MolecularTypePattern) {
            if (evt.getPropertyName().equals(MolecularTypePattern.PROPERTY_NAME_COMPONENT_PATTERN_LIST)) {
                List<MolecularComponentPattern> oldValue = (List<MolecularComponentPattern>) evt.getOldValue();
                if (oldValue != null) {
                    for (MolecularComponentPattern mcp : oldValue) {
                        RbmUtils.removePropertyChangeListener(mcp, this);
                    }
                }
                List<MolecularComponentPattern> newValue = (List<MolecularComponentPattern>) evt.getNewValue();
                if (newValue != null) {
                    for (MolecularComponentPattern mcp : newValue) {
                        RbmUtils.addPropertyChangeListener(mcp, this);
                    }
                }
            }
        } else if (source instanceof MolecularComponentPattern) {
            if (evt.getSource().equals(MolecularComponentPattern.PROPERTY_NAME_COMPONENT_STATE)) {
                // it's componentStatePattern
                ComponentStateDefinition oldValue = (ComponentStateDefinition) evt.getOldValue();
                if (oldValue != null) {
                    oldValue.removePropertyChangeListener(this);
                }
                ComponentStateDefinition newValue = (ComponentStateDefinition) evt.getNewValue();
                if (newValue != null) {
                    newValue.addPropertyChangeListener(this);
                }
            }
        }
    }
}
Also used : MolecularComponentPattern(org.vcell.model.rbm.MolecularComponentPattern) List(java.util.List) MolecularTypePattern(org.vcell.model.rbm.MolecularTypePattern) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition)

Example 29 with ComponentStateDefinition

use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.

the class Xmlproducer method getXML.

private Element getXML(MolecularComponent param) {
    Element e = new Element(XMLTags.RbmMolecularComponentTag);
    e.setAttribute(XMLTags.NameAttrTag, mangle(param.getName()));
    String s = Integer.toString(param.getIndex());
    e.setAttribute(XMLTags.RbmIndexAttrTag, s);
    for (ComponentStateDefinition pp : param.getComponentStateDefinitions()) {
        e.addContent(getXML(pp));
    }
    return e;
}
Also used : Element(org.jdom.Element) ParticleComponentStateDefinition(cbit.vcell.math.ParticleComponentStateDefinition) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition)

Example 30 with ComponentStateDefinition

use of org.vcell.model.rbm.ComponentStateDefinition in project vcell by virtualcell.

the class IssueManagerContainer method hasErrorIssues.

public boolean hasErrorIssues(Displayable owner, MolecularComponent mc) {
    if (issueManager == null) {
        return false;
    }
    if (owner == null) {
        return false;
    }
    List<Issue> allIssueList = issueManager.getIssueList();
    for (Issue issue : allIssueList) {
        if (issue.getSeverity() != Issue.Severity.ERROR) {
            continue;
        }
        Object source = issue.getSource();
        Object detailedSource = issue.getDetailedSource();
        if (mc != null && source == owner && mc.getComponentStateDefinitions().size() > 0) {
            for (ComponentStateDefinition csd : mc.getComponentStateDefinitions()) {
                if (detailedSource == csd) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : Issue(org.vcell.util.Issue) ComponentStateDefinition(org.vcell.model.rbm.ComponentStateDefinition)

Aggregations

ComponentStateDefinition (org.vcell.model.rbm.ComponentStateDefinition)31 MolecularComponent (org.vcell.model.rbm.MolecularComponent)23 MolecularType (org.vcell.model.rbm.MolecularType)15 SpeciesPattern (org.vcell.model.rbm.SpeciesPattern)12 MolecularComponentPattern (org.vcell.model.rbm.MolecularComponentPattern)10 MolecularTypePattern (org.vcell.model.rbm.MolecularTypePattern)10 BioModelNode (cbit.vcell.desktop.BioModelNode)8 LinkedHashMap (java.util.LinkedHashMap)7 Icon (javax.swing.Icon)7 Point (java.awt.Point)6 ComponentStatePattern (org.vcell.model.rbm.ComponentStatePattern)6 ParticleComponentStateDefinition (cbit.vcell.math.ParticleComponentStateDefinition)5 List (java.util.List)5 Graphics (java.awt.Graphics)4 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4 JMenuItem (javax.swing.JMenuItem)4 BondType (org.vcell.model.rbm.MolecularComponentPattern.BondType)4 Bond (org.vcell.model.rbm.SpeciesPattern.Bond)4 BioPaxObject (org.vcell.pathway.BioPaxObject)4