Package org.openquark.gems.client.IntellicutManager

Examples of org.openquark.gems.client.IntellicutManager.IntellicutInfo


     * @param listEntry the intellicut entry to get the icon for
     * @return the burning icon to use or a blank image for no burning icon
     */
    private Icon getBurnImageForEntry(IntellicutListEntry listEntry) {

        IntellicutInfo intellicutInfo = listEntry.getIntellicutInfo();
        AutoburnUnifyStatus burnStatus = intellicutInfo.getAutoburnUnifyStatus();

        if (burnStatus == AutoburnUnifyStatus.UNAMBIGUOUS) {
            return burnImageIcon;

        } else if (burnStatus == AutoburnUnifyStatus.NOT_NECESSARY) {
            return blankImageIcon;

        } else if (burnStatus == AutoburnUnifyStatus.AMBIGUOUS) {
            return burnQuestionIcon;

        } else if (burnStatus == AutoburnUnifyStatus.UNAMBIGUOUS_NOT_NECESSARY) {
            if (intellicutInfo.getBurnTypeCloseness() > intellicutInfo.getNoBurnTypeCloseness()) {
                return burnImageIcon;
            }

        } else if (burnStatus == AutoburnUnifyStatus.AMBIGUOUS_NOT_NECESSARY) {
            if (intellicutInfo.getBurnTypeCloseness() > intellicutInfo.getNoBurnTypeCloseness()) {
                return burnQuestionIcon;
            }
        }
        return blankImageIcon;
    }       
View Full Code Here


        /**
         * @see org.openquark.gems.client.IntellicutListModelAdapter#getIntellicutInfo(org.openquark.gems.client.IntellicutListModelAdapter.IntellicutListEntry)
         */
        @Override
        protected IntellicutInfo getIntellicutInfo(IntellicutListEntry listEntry) {
            return new IntellicutInfo(AutoburnUnifyStatus.NOT_NECESSARY, -1, 1);
        }
View Full Code Here

            // If only output type restrictions have been specified, then calculate type
            // type closeness of the results.
            if (inputExpr == null && outputExpr != null && outputExpr.length > 0) {
                return getIntellicutInfo(listEntry, outputExpr, typeCheckInfo, true, workspace.getSourceMetrics());
            } else {
                return new IntellicutInfo(AutoburnUnifyStatus.NOT_NECESSARY, -1, 1, false, getReferenceFrequency(workspace.getSourceMetrics(), listEntry));
            }
        }
View Full Code Here

               
            } else if (intellicutPart instanceof Gem.PartOutput) {
                return getIntellicutInfo(listEntry, intellicutPart.getType(), typeCheckInfo.getModuleTypeInfo(), perspective.getWorkspace().getSourceMetrics());
               
            } else {
                return new IntellicutInfo(AutoburnUnifyStatus.NOT_NECESSARY, -1, 1, false, getReferenceFrequency(perspective.getWorkspace().getSourceMetrics(), listEntry));
            }
        }
View Full Code Here

           
                GemEntity gemEntity = (GemEntity) ((GemTreeNode) value).getUserObject();
           
                if (browserTreeModel.isVisibleGem(gemEntity)) {
               
                    IntellicutInfo intellicutInfo = intellicutManager.getIntellicutInfo(gemEntity);
                    AutoburnUnifyStatus autoburnStatus = intellicutInfo.getAutoburnUnifyStatus();

                    if (autoburnStatus == AutoburnUnifyStatus.UNAMBIGUOUS) {
                        setIcon(BURN_ICON);
                        setForeground(BURN_COLOR);
                   
                    } else if (autoburnStatus == AutoburnUnifyStatus.AMBIGUOUS) {
                        setIcon(AMBIGUOUS_ICON);
                        setForeground(AMBIGUOUS_COLOR);
                   
                    } else if (autoburnStatus == AutoburnUnifyStatus.NOT_POSSIBLE) {
                        setIcon(CANNOT_CONNECT_ICON);
                        setForeground(CANNOT_CONNECT_COLOR);

                    } else if (autoburnStatus == AutoburnUnifyStatus.UNAMBIGUOUS_NOT_NECESSARY &&                   
                               intellicutInfo.getBurnTypeCloseness() > intellicutInfo.getNoBurnTypeCloseness()) {
                              
                        setIcon(BURN_ICON);
                        setForeground(BURN_COLOR);
               
                    } else if (autoburnStatus == AutoburnUnifyStatus.AMBIGUOUS_NOT_NECESSARY &&
                               intellicutInfo.getBurnTypeCloseness() > intellicutInfo.getNoBurnTypeCloseness()) {

                        setIcon(AMBIGUOUS_ICON);
                        setForeground(AMBIGUOUS_COLOR);
                    }
               
                } else {
                    setIcon(CANNOT_CONNECT_ICON);
                    setForeground(CANNOT_CONNECT_COLOR);               
                }
   
            } else {

                // This is a folder. Determine if and how it should pulse.

                // Assume we can't connect at all to start with.
                Color folderColor = CANNOT_CONNECT_COLOR;

                Enumeration<TreeNode> subTreeEnum = UnsafeCast.<Enumeration<TreeNode>>unsafeCast(((DefaultMutableTreeNode)value).breadthFirstEnumeration());
           
                while (subTreeEnum.hasMoreElements()) {

                    DefaultMutableTreeNode childTreeNode = (DefaultMutableTreeNode) subTreeEnum.nextElement();
               
                    if (childTreeNode instanceof GemTreeNode) {

                        GemEntity gemEntity = (GemEntity) childTreeNode.getUserObject();

                        if (browserTreeModel.isVisibleGem(gemEntity)) {

                            IntellicutInfo intellicutInfo = intellicutManager.getIntellicutInfo(gemEntity);
                            AutoburnUnifyStatus autoburnStatus = intellicutInfo.getAutoburnUnifyStatus();

                            if (autoburnStatus == AutoburnUnifyStatus.NOT_NECESSARY) {
                                // Connections take precedence. If we find a connection then stop.
                                folderColor = null;
                                break;
                           
                            } else if (autoburnStatus == AutoburnUnifyStatus.UNAMBIGUOUS ||
                                       autoburnStatus == AutoburnUnifyStatus.AMBIGUOUS) {

                                folderColor = BURN_COLOR;

                             } else if ((autoburnStatus == AutoburnUnifyStatus.UNAMBIGUOUS_NOT_NECESSARY ||
                                        autoburnStatus == AutoburnUnifyStatus.AMBIGUOUS_NOT_NECESSARY)) {
                                       
                                if (intellicutInfo.getBurnTypeCloseness() > intellicutInfo.getNoBurnTypeCloseness()) {
                                    folderColor = BURN_COLOR;
                                } else {
                                    folderColor = null;
                                    break;
                                }
View Full Code Here

                    Object obj = evt.getTriggeredObjects().get(0);

                    if (obj instanceof GemEntity) {

                        GemEntity gemEntity = (GemEntity) obj;
                        IntellicutInfo intellicutInfo = intellicutManager.getIntellicutInfo(gemEntity);
                        AutoburnUnifyStatus autoburnStatus = intellicutInfo.getAutoburnUnifyStatus();

                        if (autoburnStatus != AutoburnUnifyStatus.NOT_POSSIBLE) {

                            tableTop.getUndoableEditSupport().beginUpdate();
View Full Code Here

                if (intellicutManager.getIntellicutMode() == IntellicutManager.IntellicutMode.NOTHING) {
                    statusMessageDisplayer.clearMessage(this);

                } else if (((BrowserTreeModel) gemCutter.getBrowserTree().getModel()).isVisibleGem(gemEntity)) {

                    IntellicutInfo intellicutInfo = intellicutManager.getIntellicutInfo(gemEntity);
                    AutoburnUnifyStatus autoburnStatus = intellicutInfo.getAutoburnUnifyStatus();

                    if (autoburnStatus.isAutoConnectable()) {
                        statusMessageDisplayer.setMessageFromResource(this, "SM_IntellicutGemConnectable", StatusMessageDisplayer.MessageType.PERSISTENT);
                    } else {
                        statusMessageDisplayer.clearMessage(this);
View Full Code Here

        int numReferenceFrequencies = 0;
        int numSameNonpolymorphicType = 0;
   
        for (final Object dataObject : sourceDataSet) {
            IntellicutListEntry listEntry = getNewListEntry(dataObject);
            IntellicutInfo info = getIntellicutInfo(listEntry);
            if (info != null) {
                listEntry.setIntellicutInfo(info);
               
                additionalEntrySet.add(listEntry);
                additionalEntryMap.put(listEntry.getData(), listEntry);
               
                referenceFrequencies[numReferenceFrequencies] = info.getReferenceFrequency();
                numReferenceFrequencies++;
               
                if (info.isSameNonpolymorphicType()) {
                    sameNonpolymorphicTypeReferenceFrequencies[numSameNonpolymorphicType] = info.getReferenceFrequency();
                    numSameNonpolymorphicType++;
                }
            }
        }
       
View Full Code Here

                    noBurnTypeCloseness = closenessForType;
                }
            }           

            if (noBurnTypeCloseness != -1 && (allowFreeArguments || !outputListEntry.hasDisconnectedInputs())) {
                return new IntellicutInfo(AutoburnUnifyStatus.NOT_NECESSARY, -1, noBurnTypeCloseness, exactMatch, dependents);
            }
           
            return null;

        }
       
        // Try connecting with auto burning.
        // Find the autoburning for the type which provides the maximum closeness value.
        AutoburnLogic.AutoburnInfo autoburnInfo = null;
       
        int noBurnTypeCloseness = -1;

        for (int typeN = 0, nTypes = destTypeExprs.length; typeN < nTypes; ++typeN) {
            AutoburnLogic.AutoburnInfo autoburnInfoForType = AutoburnLogic.getAutoburnInfo(destTypeExprs[typeN], outputListEntry.getTypePiecesForBurning(), typeCheckInfo);
           
            noBurnTypeCloseness = Math.max(noBurnTypeCloseness, autoburnInfoForType.getNoBurnTypeCloseness());
           
            if (autoburnInfo == null || autoburnInfoForType.getMaxTypeCloseness() > autoburnInfo.getMaxTypeCloseness()) {
                autoburnInfo = autoburnInfoForType;
            }
        }

        if (autoburnInfo != null) {
            AutoburnUnifyStatus autoburnUnifyStatus = autoburnInfo.getAutoburnUnifyStatus();
           
            if (autoburnUnifyStatus != AutoburnUnifyStatus.NOT_POSSIBLE &&
                    (allowFreeArguments || canBurnAllArguments(outputListEntry, autoburnInfo))) {
               
                return new IntellicutInfo(autoburnInfo.getAutoburnUnifyStatus(), autoburnInfo.getMaxTypeCloseness(), noBurnTypeCloseness, exactMatch, dependents);
            }
        }       
       
        return null;
    }
View Full Code Here

                }
            }
        }              

        if (foundCandidate) {
            return new IntellicutInfo(AutoburnUnifyStatus.NOT_NECESSARY, -1, finalClosenessForType, finalExactMatch, references);
        } else {
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of org.openquark.gems.client.IntellicutManager.IntellicutInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.