/** * Compute a logical, reasonably efficient join on the specified tables. See project description * for hints on how this should be implemented. * * @param stats Statistics for each table involved in the join, referenced by base table names, * not alias * @param filterSelectivities Selectivities of the filter predicates on each table in the join, * referenced by table alias (if no alias, the base table name) * @param explain Indicates whether your code should explain its query plan or simply execute it * @return A Vector<LogicalJoinNode> that stores joins in the left-deep order in which they should * be executed. * @throws ParsingException when stats or filter selectivities is missing a table in the join, or * or when another internal error occurs */ public Vector<LogicalJoinNode> orderJoins( HashMap<String, TableStats> stats, HashMap<String, Double> filterSelectivities, boolean explain) throws ParsingException { // See the project writeup for some hints as to how this function // should work. // some code goes here PlanCache pc = new PlanCache(); for (int i = 1; i <= joins.size(); i++) { Set<Set<LogicalJoinNode>> subsets = enumerateSubsets(joins, i); for (Set<LogicalJoinNode> subset : subsets) { CostCard best = new CostCard(); best.cost = Double.MAX_VALUE; for (LogicalJoinNode node : subset) { CostCard subCard = computeCostAndCardOfSubplan(stats, filterSelectivities, node, subset, best.cost, pc); if (subCard != null) { if (subCard.cost < best.cost) best = subCard; pc.addPlan(subset, best.cost, best.card, best.plan); } } } } if (explain) printJoins(joins, pc, stats, filterSelectivities); HashSet<LogicalJoinNode> joinSet = new HashSet<LogicalJoinNode>(); for (int i = 0; i < joins.size(); i++) { joinSet.add(joins.get(i)); } Vector<LogicalJoinNode> order = pc.getOrder(joinSet); if (order != null) return order; return joins; }
private JPanel getClickableTagsPanel() { JPanel pnl = new JPanel(); pnl.setLayout(new GridLayout(0, 3)); ArrayList<Commontags> listTags = new ArrayList<>(mapAllTags.values()); Collections.sort(listTags); for (final Commontags ctag : listTags) { JCheckBox cb = new JCheckBox(ctag.getText()); cb.setForeground(GUITools.getColor(ctag.getColor())); cb.setFont(ctag.getType() == 0 ? SYSConst.ARIAL12 : SYSConst.ARIAL12BOLD); cb.setSelected(listSelectedTags.contains(ctag)); cb.addItemListener( e -> { if (e.getStateChange() == ItemEvent.SELECTED) { listSelectedTags.add(ctag); add(createButton(ctag)); } else { listSelectedTags.remove(ctag); mapButtons.remove(ctag); } notifyListeners(ctag); }); pnl.add(cb); } return pnl; }
public InspectionTree(final Project project) { super(new InspectionRootNode(project)); setCellRenderer(new CellRenderer()); // project)); setShowsRootHandles(true); UIUtil.setLineStyleAngled(this); addTreeWillExpandListener(new ExpandListener()); myExpandedUserObjects = new HashSet<Object>(); myExpandedUserObjects.add(project); TreeUtil.installActions(this); new TreeSpeedSearch( this, new Convertor<TreePath, String>() { @Override public String convert(TreePath o) { return InspectionsConfigTreeComparator.getDisplayTextToSort( o.getLastPathComponent().toString()); } }); addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { TreePath newSelection = e.getNewLeadSelectionPath(); if (newSelection != null) { mySelectionPath = new SelectionPath(newSelection); } } }); }
private void handleBranchingInstruction( ProblemsHolder holder, StandardInstructionVisitor visitor, Set<Instruction> trueSet, Set<Instruction> falseSet, HashSet<PsiElement> reportedAnchors, BranchingInstruction instruction, final boolean onTheFly) { PsiElement psiAnchor = instruction.getPsiAnchor(); boolean underBinary = isAtRHSOfBooleanAnd(psiAnchor); if (instruction instanceof InstanceofInstruction && visitor.isInstanceofRedundant((InstanceofInstruction) instruction)) { if (visitor.canBeNull((BinopInstruction) instruction)) { holder.registerProblem( psiAnchor, InspectionsBundle.message("dataflow.message.redundant.instanceof"), new RedundantInstanceofFix()); } else { final LocalQuickFix localQuickFix = createSimplifyBooleanExpressionFix(psiAnchor, true); holder.registerProblem( psiAnchor, InspectionsBundle.message( underBinary ? "dataflow.message.constant.condition.when.reached" : "dataflow.message.constant.condition", Boolean.toString(true)), localQuickFix == null ? null : new LocalQuickFix[] {localQuickFix}); } } else if (psiAnchor instanceof PsiSwitchLabelStatement) { if (falseSet.contains(instruction)) { holder.registerProblem( psiAnchor, InspectionsBundle.message("dataflow.message.unreachable.switch.label")); } } else if (psiAnchor != null && !reportedAnchors.contains(psiAnchor) && !isFlagCheck(psiAnchor)) { boolean evaluatesToTrue = trueSet.contains(instruction); final PsiElement parent = psiAnchor.getParent(); if (parent instanceof PsiAssignmentExpression && ((PsiAssignmentExpression) parent).getLExpression() == psiAnchor) { holder.registerProblem( psiAnchor, InspectionsBundle.message( "dataflow.message.pointless.assignment.expression", Boolean.toString(evaluatesToTrue)), createConditionalAssignmentFixes( evaluatesToTrue, (PsiAssignmentExpression) parent, onTheFly)); } else if (!skipReportingConstantCondition(visitor, psiAnchor, evaluatesToTrue)) { final LocalQuickFix fix = createSimplifyBooleanExpressionFix(psiAnchor, evaluatesToTrue); String message = InspectionsBundle.message( underBinary ? "dataflow.message.constant.condition.when.reached" : "dataflow.message.constant.condition", Boolean.toString(evaluatesToTrue)); holder.registerProblem(psiAnchor, message, fix == null ? null : new LocalQuickFix[] {fix}); } reportedAnchors.add(psiAnchor); } }
protected void createOWLVizTabUI() { setLayout(new BorderLayout()); // Create the tabbed pane tabbedPane = new JTabbedPane(); add(tabbedPane); // ///////////////////////////////////////////////////////////////////// // // Build the asserted subclass hierarchy tabs // // //////////////////////////////////////////////////////////////////// assertedGraphModel = new OWLClassGraphAssertedModel(getOWLModelManager()); OWLVizGraphPanel assertedPanel = new OWLVizGraphPanel("Asserted hierarchy", this, getOWLEditorKit(), assertedGraphModel); assertedGraphComponent = assertedPanel.getGraphComponent(); setupListeners(assertedGraphComponent); tabbedPane.add(assertedPanel.getName(), assertedPanel); graphComponents.add(assertedGraphComponent); // ///////////////////////////////////////////////////////////////////// // // Build the inferred subclass hierarchy tabs // // //////////////////////////////////////////////////////////////////// inferredGraphModel = new OWLClassGraphInferredModel(getOWLModelManager()); OWLVizGraphPanel inferredPanel = new OWLVizGraphPanel("Inferred hierarchy", this, getOWLEditorKit(), inferredGraphModel); inferredGraphComponent = inferredPanel.getGraphComponent(); tabbedPane.add(inferredPanel.getName(), inferredPanel); graphComponents.add(inferredGraphComponent); // Group the asserted and inferred hierarchy tabs, so that operations // such as showing subclasses etc. are applied to both tabs. ArrayList<GraphComponent> list = new ArrayList<GraphComponent>(); list.add(assertedGraphComponent); list.add(inferredGraphComponent); componentGroupMap.put(assertedPanel, list); componentGroupMap.put(inferredPanel, list); // Create the toolbar createToolBar(assertedGraphComponent.getController(), assertedGraphComponent.getController()); }
public Profile(Element el) { name = el.getAttribute("name"); ids = new HashSet<String>(); Node child = el.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { ids.add(((Element) child).getAttribute("id")); } child = child.getNextSibling(); } }
private Set<String> getLoadedPaths() { if (!IGV.hasInstance()) return new HashSet<String>(); Collection<ResourceLocator> locators = IGV.getInstance().getDataResourceLocators(); HashSet<String> loadedPaths = new HashSet<String>(locators.size()); for (ResourceLocator locator : locators) { loadedPaths.add(locator.getPath()); } return loadedPaths; }
private Collection getLayerManagers() { // Multiple windows may point to the same LayerManager, so use // a Set. [Jon Aquino] HashSet layerManagers = new HashSet(); JInternalFrame[] internalFrames = getInternalFrames(); for (int i = 0; i < internalFrames.length; i++) { if (internalFrames[i] instanceof LayerManagerProxy) { layerManagers.add(((LayerManagerProxy) internalFrames[i]).getLayerManager()); } } return layerManagers; }
@NotNull private static Set<String> resolveModuleDeps( @NotNull ModifiableRootModel rootModel, @NotNull ImportedOtpApp importedOtpApp, @Nullable Sdk projectSdk, @NotNull Set<String> allImportedAppNames) { HashSet<String> unresolvedAppNames = ContainerUtil.newHashSet(); for (String depAppName : importedOtpApp.getDeps()) { if (allImportedAppNames.contains(depAppName)) { rootModel.addInvalidModuleEntry(depAppName); } else if (projectSdk != null && isSdkOtpApp(depAppName, projectSdk)) { // SDK is already a dependency } else { rootModel.addInvalidModuleEntry(depAppName); unresolvedAppNames.add(depAppName); } } return unresolvedAppNames; }
private void cmbTagsActionPerformed(ActionEvent e) { if (!editmode) return; if (txtTags.getText().isEmpty()) return; if (txtTags.getText().length() > 100) return; final String enteredText = SYSTools.tidy(txtTags.getText()).toLowerCase(); if (!addNewTags && !mapAllTags.containsKey(enteredText)) return; if (!mapAllTags.containsKey(enteredText)) { Commontags myNewCommontag = new Commontags(SYSTools.tidy(enteredText)); mapAllTags.put(enteredText, myNewCommontag); ac.uninstallListeners(); ac = new AutoCompletion(txtTags, mapAllTags.keySet().toArray(new String[] {})); ac.setStrict(false); ac.setStrictCompletion(false); } if (!listSelectedTags.contains(mapAllTags.get(enteredText))) { listSelectedTags.add(mapAllTags.get(enteredText)); SwingUtilities.invokeLater( () -> { if (listSelectedTags.size() % MAXLINE == 0) { add(createButton(mapAllTags.get(enteredText)), RiverLayout.LINE_BREAK); } else { add(createButton(mapAllTags.get(enteredText)), RiverLayout.LEFT); } txtTags.setText(""); revalidate(); repaint(); notifyListeners(mapAllTags.get(enteredText)); }); } }
/** * No-arg constructor. Initializes randomListOfPoints and listOfPointsToBeConnected. For * initialization of the randomListOfPoints is using HashSet<MyPoint> randomSetOfPoints, so we can * be sure, that there won't be equal points. randomListOfPoints will store from 30 to 50 unique * random points with coordinates in range of 100<=X<=700 and 100<=Y<=500. */ PointsConnector() { random = new Random(); listOfPointsToBeConnected = new ArrayList<MyPoint>(); HashSet<MyPoint> randomSetOfPoints = new HashSet<MyPoint>(); int initialCapacity = random.nextInt(21) + 30; int x, y; while (randomSetOfPoints.size() != initialCapacity) { x = random.nextInt(601) + 100; y = random.nextInt(401) + 100; randomSetOfPoints.add(new MyPoint(x, y)); } randomListOfPoints = new ArrayList<MyPoint>(randomSetOfPoints); Collections.sort( randomListOfPoints, new YcoordSorterComparator()); // sorting randomListOfPoints by Y. System.out.println("Sorted by Y input list of points:\n" + randomListOfPoints); }
public void add(String id) { ids.add(id); }
/** * Preform a merge commit * * @param project a project * @param root a vcs root * @param added added files * @param removed removed files * @param messageFile a message file for commit * @param author an author * @param exceptions the list of exceptions to report * @param partialOperation * @return true if merge commit was successful */ private static boolean mergeCommit( final Project project, final VirtualFile root, final Set<FilePath> added, final Set<FilePath> removed, final File messageFile, final String author, List<VcsException> exceptions, @NotNull final PartialOperation partialOperation) { HashSet<FilePath> realAdded = new HashSet<FilePath>(); HashSet<FilePath> realRemoved = new HashSet<FilePath>(); // perform diff GitSimpleHandler diff = new GitSimpleHandler(project, root, GitCommand.DIFF); diff.setSilent(true); diff.setStdoutSuppressed(true); diff.addParameters("--diff-filter=ADMRUX", "--name-status", "HEAD"); diff.endOptions(); String output; try { output = diff.run(); } catch (VcsException ex) { exceptions.add(ex); return false; } String rootPath = root.getPath(); for (StringTokenizer lines = new StringTokenizer(output, "\n", false); lines.hasMoreTokens(); ) { String line = lines.nextToken().trim(); if (line.length() == 0) { continue; } String[] tk = line.split("\t"); switch (tk[0].charAt(0)) { case 'M': case 'A': realAdded.add(VcsUtil.getFilePath(rootPath + "/" + tk[1])); break; case 'D': realRemoved.add(VcsUtil.getFilePathForDeletedFile(rootPath + "/" + tk[1], false)); break; default: throw new IllegalStateException("Unexpected status: " + line); } } realAdded.removeAll(added); realRemoved.removeAll(removed); if (realAdded.size() != 0 || realRemoved.size() != 0) { final List<FilePath> files = new ArrayList<FilePath>(); files.addAll(realAdded); files.addAll(realRemoved); final Ref<Boolean> mergeAll = new Ref<Boolean>(); try { GuiUtils.runOrInvokeAndWait( new Runnable() { public void run() { String message = GitBundle.message("commit.partial.merge.message", partialOperation.getName()); SelectFilePathsDialog dialog = new SelectFilePathsDialog( project, files, message, null, "Commit All Files", CommonBundle.getCancelButtonText(), false); dialog.setTitle(GitBundle.getString("commit.partial.merge.title")); dialog.show(); mergeAll.set(dialog.isOK()); } }); } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { throw new RuntimeException("Unable to invoke a message box on AWT thread", ex); } if (!mergeAll.get()) { return false; } // update non-indexed files if (!updateIndex(project, root, realAdded, realRemoved, exceptions)) { return false; } for (FilePath f : realAdded) { VcsDirtyScopeManager.getInstance(project).fileDirty(f); } for (FilePath f : realRemoved) { VcsDirtyScopeManager.getInstance(project).fileDirty(f); } } // perform merge commit try { GitSimpleHandler handler = new GitSimpleHandler(project, root, GitCommand.COMMIT); handler.setStdoutSuppressed(false); handler.addParameters("-F", messageFile.getAbsolutePath()); if (author != null) { handler.addParameters("--author=" + author); } handler.endOptions(); handler.run(); GitRepositoryManager manager = GitUtil.getRepositoryManager(project); manager.updateRepository(root); } catch (VcsException ex) { exceptions.add(ex); return false; } return true; }
private void createDescription( StandardDataFlowRunner runner, ProblemsHolder holder, DataFlowInstructionVisitor visitor) { Pair<Set<Instruction>, Set<Instruction>> constConditions = runner.getConstConditionalExpressions(); Set<Instruction> trueSet = constConditions.getFirst(); Set<Instruction> falseSet = constConditions.getSecond(); ArrayList<Instruction> allProblems = new ArrayList<Instruction>(); allProblems.addAll(trueSet); allProblems.addAll(falseSet); allProblems.addAll(runner.getCCEInstructions()); allProblems.addAll(StandardDataFlowRunner.getRedundantInstanceofs(runner, visitor)); HashSet<PsiElement> reportedAnchors = new HashSet<PsiElement>(); for (PsiElement element : visitor.getProblems(NullabilityProblem.callNPE)) { if (reportedAnchors.add(element)) { reportCallMayProduceNpe(holder, (PsiMethodCallExpression) element, holder.isOnTheFly()); } } for (PsiElement element : visitor.getProblems(NullabilityProblem.fieldAccessNPE)) { if (reportedAnchors.add(element)) { PsiElement parent = element.getParent(); PsiElement fieldAccess = parent instanceof PsiArrayAccessExpression || parent instanceof PsiReferenceExpression ? parent : element; reportFieldAccessMayProduceNpe(holder, element, (PsiExpression) fieldAccess); } } for (Instruction instruction : allProblems) { if (instruction instanceof TypeCastInstruction && reportedAnchors.add( ((TypeCastInstruction) instruction).getCastExpression().getCastType())) { reportCastMayFail(holder, (TypeCastInstruction) instruction); } else if (instruction instanceof BranchingInstruction) { handleBranchingInstruction( holder, visitor, trueSet, falseSet, reportedAnchors, (BranchingInstruction) instruction); } } reportNullableArguments(visitor, holder, reportedAnchors); reportNullableAssignments(visitor, holder, reportedAnchors); reportUnboxedNullables(visitor, holder, reportedAnchors); if (!runner.isInNullableMethod() && runner.isInMethod() && (runner.isInNotNullMethod() || SUGGEST_NULLABLE_ANNOTATIONS)) { reportNullableReturns(runner, visitor, holder, reportedAnchors); } if (SUGGEST_NULLABLE_ANNOTATIONS) { reportNullableArgumentsPassedToNonAnnotated(visitor, holder, reportedAnchors); } if (REPORT_CONSTANT_REFERENCE_VALUES) { reportConstantReferenceValues(holder, visitor, reportedAnchors); } }
/* * Specify a tab with an exception to the focus policy rule */ public void addException(int index) { if (exceptions == null) exceptions = new HashSet<Component>(); Component key = tabbedPane.getComponentAt(index); exceptions.add(key); }
/** * Helper function to display a Swing window with a tree representation of the specified list of * joins. See {@link #orderJoins}, which may want to call this when the analyze flag is true. * * @param js the join plan to visualize * @param pc the PlanCache accumulated whild building the optimal plan * @param stats table statistics for base tables * @param selectivities the selectivities of the filters over each of the tables (where tables are * indentified by their alias or name if no alias is given) */ private void printJoins( Vector<LogicalJoinNode> js, PlanCache pc, HashMap<String, TableStats> stats, HashMap<String, Double> selectivities) { JFrame f = new JFrame("Join Plan for " + p.getQuery()); // Set the default close operation for the window, // or else the program won't exit when clicking close button f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); f.setVisible(true); f.setSize(300, 500); HashMap<String, DefaultMutableTreeNode> m = new HashMap<String, DefaultMutableTreeNode>(); // int numTabs = 0; // int k; DefaultMutableTreeNode root = null, treetop = null; HashSet<LogicalJoinNode> pathSoFar = new HashSet<LogicalJoinNode>(); boolean neither; System.out.println(js); for (LogicalJoinNode j : js) { pathSoFar.add(j); System.out.println("PATH SO FAR = " + pathSoFar); String table1Name = Database.getCatalog().getTableName(this.p.getTableId(j.t1Alias)); String table2Name = Database.getCatalog().getTableName(this.p.getTableId(j.t2Alias)); // Double c = pc.getCost(pathSoFar); neither = true; root = new DefaultMutableTreeNode( "Join " + j + " (Cost =" + pc.getCost(pathSoFar) + ", card = " + pc.getCard(pathSoFar) + ")"); DefaultMutableTreeNode n = m.get(j.t1Alias); if (n == null) { // never seen this table before n = new DefaultMutableTreeNode( j.t1Alias + " (Cost = " + stats.get(table1Name).estimateScanCost() + ", card = " + stats.get(table1Name).estimateTableCardinality(selectivities.get(j.t1Alias)) + ")"); root.add(n); } else { // make left child root n root.add(n); neither = false; } m.put(j.t1Alias, root); n = m.get(j.t2Alias); if (n == null) { // never seen this table before n = new DefaultMutableTreeNode( j.t2Alias == null ? "Subplan" : (j.t2Alias + " (Cost = " + stats.get(table2Name).estimateScanCost() + ", card = " + stats .get(table2Name) .estimateTableCardinality(selectivities.get(j.t2Alias)) + ")")); root.add(n); } else { // make right child root n root.add(n); neither = false; } m.put(j.t2Alias, root); // unless this table doesn't join with other tables, // all tables are accessed from root if (!neither) { for (String key : m.keySet()) { m.put(key, root); } } treetop = root; } JTree tree = new JTree(treetop); JScrollPane treeView = new JScrollPane(tree); tree.setShowsRootHandles(true); // Set the icon for leaf nodes. ImageIcon leafIcon = new ImageIcon("join.jpg"); DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); renderer.setOpenIcon(leafIcon); renderer.setClosedIcon(leafIcon); tree.setCellRenderer(renderer); f.setSize(300, 500); f.add(treeView); for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i); } if (js.size() == 0) { f.add(new JLabel("No joins in plan.")); } f.pack(); }
/** * Analyze class fields and fill in "voSetterMethods","voGetterMethods","indexes",reverseIndexes" * attributes. * * @param prefix e.g. "attrx.attry." * @param parentMethods getter methods of parent v.o. * @param classType class to analyze */ private void analyzeClassFields(String prefix, Method[] parentMethods, Class classType) { try { if (prefix.split("\\.").length > ClientSettings.MAX_NR_OF_LOOPS_IN_ANALYZE_VO) return; // retrieve all getter and setter methods defined in the specified value object... String attributeName = null; Method[] methods = classType.getMethods(); String aName = null; for (int i = 0; i < methods.length; i++) { attributeName = methods[i].getName(); if (attributeName.startsWith("get") && methods[i].getParameterTypes().length == 0 && ValueObject.class.isAssignableFrom(methods[i].getReturnType())) { aName = getAttributeName(attributeName, classType); Method[] newparentMethods = new Method[parentMethods.length + 1]; System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length); newparentMethods[parentMethods.length] = methods[i]; analyzeClassFields(prefix + aName + ".", newparentMethods, methods[i].getReturnType()); } if (attributeName.startsWith("get") && methods[i].getParameterTypes().length == 0 && (methods[i].getReturnType().equals(String.class) || methods[i].getReturnType().equals(Long.class) || methods[i].getReturnType().equals(Long.TYPE) || methods[i].getReturnType().equals(Float.class) || methods[i].getReturnType().equals(Float.TYPE) || methods[i].getReturnType().equals(Short.class) || methods[i].getReturnType().equals(Short.TYPE) || methods[i].getReturnType().equals(Double.class) || methods[i].getReturnType().equals(Double.TYPE) || methods[i].getReturnType().equals(BigDecimal.class) || methods[i].getReturnType().equals(java.util.Date.class) || methods[i].getReturnType().equals(java.sql.Date.class) || methods[i].getReturnType().equals(java.sql.Timestamp.class) || methods[i].getReturnType().equals(Integer.class) || methods[i].getReturnType().equals(Integer.TYPE) || methods[i].getReturnType().equals(Character.class) || methods[i].getReturnType().equals(Boolean.class) || methods[i].getReturnType().equals(boolean.class) || methods[i].getReturnType().equals(ImageIcon.class) || methods[i].getReturnType().equals(Icon.class) || methods[i].getReturnType().equals(byte[].class) || methods[i].getReturnType().equals(Object.class) || ValueObject.class.isAssignableFrom(methods[i].getReturnType()))) { attributeName = getAttributeName(attributeName, classType); // try { // if // (classType.getMethod("set"+attributeName.substring(0,1).toUpperCase()+attributeName.substring(1),new Class[]{methods[i].getReturnType()})!=null) Method[] newparentMethods = new Method[parentMethods.length + 1]; System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length); newparentMethods[parentMethods.length] = methods[i]; voGetterMethods.put(prefix + attributeName, newparentMethods); // } catch (NoSuchMethodException ex) { // } } else if (attributeName.startsWith("is") && methods[i].getParameterTypes().length == 0 && (methods[i].getReturnType().equals(Boolean.class) || methods[i].getReturnType().equals(boolean.class))) { attributeName = getAttributeName(attributeName, classType); Method[] newparentMethods = new Method[parentMethods.length + 1]; System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length); newparentMethods[parentMethods.length] = methods[i]; voGetterMethods.put(prefix + attributeName, newparentMethods); } else if (attributeName.startsWith("set") && methods[i].getParameterTypes().length == 1) { attributeName = getAttributeName(attributeName, classType); try { if (classType.getMethod( "get" + attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1), new Class[0]) != null) { Method[] newparentMethods = new Method[parentMethods.length + 1]; System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length); newparentMethods[parentMethods.length] = methods[i]; voSetterMethods.put(prefix + attributeName, newparentMethods); } } catch (NoSuchMethodException ex) { try { if (classType.getMethod( "is" + attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1), new Class[0]) != null) { Method[] newparentMethods = new Method[parentMethods.length + 1]; System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length); newparentMethods[parentMethods.length] = methods[i]; voSetterMethods.put(prefix + attributeName, newparentMethods); } } catch (NoSuchMethodException exx) { } } } } // fill in indexes with the colProperties indexes first; after them, it will be added the // other indexes (of attributes not mapped with grid column...) HashSet alreadyAdded = new HashSet(); int i = 0; for (i = 0; i < colProperties.length; i++) { indexes.put(new Integer(i), colProperties[i].getColumnName()); reverseIndexes.put(colProperties[i].getColumnName(), new Integer(i)); alreadyAdded.add(colProperties[i].getColumnName()); } Enumeration en = voGetterMethods.keys(); while (en.hasMoreElements()) { attributeName = en.nextElement().toString(); if (!alreadyAdded.contains(attributeName)) { indexes.put(new Integer(i), attributeName); reverseIndexes.put(attributeName, new Integer(i)); i++; } } } catch (Exception ex) { ex.printStackTrace(); } }