http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java index 210dee3..0059fba 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java @@ -144,12 +144,14 @@ public class GraphView extends DefaultTreeView { this.myGraphListener = new MyGraphListener(state); Rectangle visible = null; - if (jgraph != null) + if (jgraph != null) { visible = jgraph.getVisibleRect(); + } Cursor cursor = null; - if (jgraph != null) + if (jgraph != null) { cursor = jgraph.getCursor(); + } this.edgeMap = new HashMap<String, Pair>(); @@ -158,18 +160,22 @@ public class GraphView extends DefaultTreeView { m_jgAdapter = new JungJGraphModelAdapter(directedGraph); jgraph = new JGraph(m_jgAdapter); - for (MouseListener ml : jgraph.getMouseListeners()) + for (MouseListener ml : jgraph.getMouseListeners()) { jgraph.removeMouseListener(ml); - for (MouseMotionListener ml : jgraph.getMouseMotionListeners()) + } + for (MouseMotionListener ml : jgraph.getMouseMotionListeners()) { jgraph.removeMouseMotionListener(ml); - for (MouseWheelListener ml : jgraph.getMouseWheelListeners()) + } + for (MouseWheelListener ml : jgraph.getMouseWheelListeners()) { jgraph.removeMouseWheelListener(ml); + } jgraph.setBackground(Color.white); jgraph.setAntiAliased(true); jgraph.setMoveable(false); String scale = state.getFirstPropertyValue(SCALE); - if (scale == null) + if (scale == null) { state.setProperty(SCALE, scale = "1.0"); + } jgraph.setScale(Double.parseDouble(scale)); DragSource dragSource = DragSource.getDefaultDragSource(); @@ -193,18 +199,19 @@ public class GraphView extends DefaultTreeView { ((ModelNode) ((DefaultGraphCell) moveCell) .getUserObject()).getId()); - if (state.getMode() == View.Mode.MOVE) + if (state.getMode() == View.Mode.MOVE) { moveCell = GraphView.this.m_jgAdapter .getVertexCell((moveGraph = moveGraph.getRootParent()) .getModel()); - else if (GuiUtils.isDummyNode(moveGraph.getModel())) + } else if (GuiUtils.isDummyNode(moveGraph.getModel())) { moveCell = GraphView.this.m_jgAdapter .getVertexCell((moveGraph = moveGraph.getParent()) .getModel()); - else if (moveGraph.getModel().isRef()) { + } else if (moveGraph.getModel().isRef()) { while (moveGraph.getParent() != null - && moveGraph.getParent().getModel().isRef()) + && moveGraph.getParent().getModel().isRef()) { moveGraph = moveGraph.getParent(); + } moveCell = GraphView.this.m_jgAdapter .getVertexCell(moveGraph.getModel()); } @@ -229,10 +236,11 @@ public class GraphView extends DefaultTreeView { public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { if (flavor.getHumanPresentableName().equals( - DefaultGraphCell.class.getSimpleName())) + DefaultGraphCell.class.getSimpleName())) { return this; - else + } else { throw new UnsupportedFlavorException(flavor); + } } public DataFlavor[] getTransferDataFlavors() { @@ -253,8 +261,9 @@ public class GraphView extends DefaultTreeView { public void dragDropEnd(DragSourceDropEvent dsde) { System.out.println("DRAG END!!!!"); - if (moveCell == null) + if (moveCell == null) { return; + } Point dropPoint = new Point(dsde.getX() - jgraph.getLocationOnScreen().x, dsde.getY() - jgraph.getLocationOnScreen().y); @@ -265,13 +274,15 @@ public class GraphView extends DefaultTreeView { state.getGraphs(), ((ModelNode) endCell.getUserObject()).getId()); if (!endGraph.getModel().isParentType() - || GuiUtils.isSubGraph(moveGraph, endGraph)) + || GuiUtils.isSubGraph(moveGraph, endGraph)) { return; - if (moveGraph.getParent() == null) + } + if (moveGraph.getParent() == null) { state.removeGraph(moveGraph); - else + } else { GuiUtils.removeNode(state.getGraphs(), moveGraph.getModel()); + } GraphView.this.removeShift(state, moveGraph); GuiUtils.addChild(state.getGraphs(), endGraph .getModel().getId(), moveGraph); @@ -352,12 +363,13 @@ public class GraphView extends DefaultTreeView { - jgraph.getLocationOnScreen().x, dsde.getY() - jgraph.getLocationOnScreen().y); - if (mouseOverCell != null) + if (mouseOverCell != null) { mouseOverGraph = GuiUtils.find(state .getGraphs(), ((ModelNode) mouseOverCell .getUserObject()).getId()); - else + } else { mouseOverGraph = null; + } } if (mouseOverGraph != null) { if (GuiUtils.isDummyNode(mouseOverGraph @@ -365,14 +377,16 @@ public class GraphView extends DefaultTreeView { mouseOverGraph = mouseOverGraph.getParent(); } else { while (mouseOverGraph != null - && mouseOverGraph.getModel().isRef()) + && mouseOverGraph.getModel().isRef()) { mouseOverGraph = mouseOverGraph.getParent(); + } } - if (mouseOverGraph != null) + if (mouseOverGraph != null) { mouseOverCell = GraphView.this.m_jgAdapter .getVertexCell(mouseOverGraph.getModel()); - else + } else { mouseOverCell = null; + } } GraphView.this.jgraph .setSelectionCells(new Object[] { mouseOverCell }); @@ -393,12 +407,14 @@ public class GraphView extends DefaultTreeView { List<Line> lines = GuiUtils.findLines(state.getGraphs()); for (Line line : lines) { - if (!this.directedGraph.containsVertex(line.getFromModel())) + if (!this.directedGraph.containsVertex(line.getFromModel())) { this.directedGraph.addVertex(line.getFromModel()); + } if (line.getToModel() != null) { - if (!this.directedGraph.containsVertex(line.getToModel())) + if (!this.directedGraph.containsVertex(line.getToModel())) { this.directedGraph.addVertex(line.getToModel()); + } IdentifiableEdge edge = new IdentifiableEdge(line.getFromModel(), line.getToModel()); directedGraph.addEdge(edge, line.getFromModel(), line.getToModel()); this.edgeMap.put(edge.id, new Pair(line.getFromModel() != null ? line @@ -423,8 +439,9 @@ public class GraphView extends DefaultTreeView { } String edgeDisplayMode = state.getFirstPropertyValue(EDGE_DISPLAY_MODE); - if (edgeDisplayMode == null) + if (edgeDisplayMode == null) { state.setProperty(EDGE_DISPLAY_MODE, edgeDisplayMode = WORKFLOW_MODE); + } if (edgeDisplayMode.equals(WORKFLOW_MODE)) { this.edgeMap = new HashMap<String, Pair>(); removeAllEdges(this.directedGraph); @@ -443,12 +460,14 @@ public class GraphView extends DefaultTreeView { if (graph != null) { DefaultGraphCell cell = this.m_jgAdapter .getVertexCell(graph.getModel()); - if (cell != null) + if (cell != null) { this.jgraph.setSelectionCells(new Object[] { cell }); - else + } else { this.jgraph.setSelectionCells(new Object[] {}); - } else + } + } else { this.jgraph.setSelectionCells(new Object[] {}); + } } else { this.jgraph.setSelectionCells(new Object[] {}); } @@ -467,8 +486,9 @@ public class GraphView extends DefaultTreeView { this.jgraph.scrollRectToVisible(visible); } - if (cursor != null) + if (cursor != null) { this.jgraph.setCursor(cursor); + } this.revalidate(); } @@ -498,9 +518,10 @@ public class GraphView extends DefaultTreeView { ArrayList<Point2D.Double> newPoints = new ArrayList<Point2D.Double>(); Point shift = this.getShift(state, (DefaultGraphCell) entry.getKey(), nested); - for (Point2D.Double point : points) + for (Point2D.Double point : points) { newPoints .add(new Point2D.Double(point.x + shift.x, point.y + shift.y)); + } ((Map<Object, Object>) entry.getValue()).put("points", newPoints); } else if (entry.getKey() instanceof DefaultGraphCell) { DefaultGraphCell cell = (DefaultGraphCell) entry.getKey(); @@ -525,8 +546,9 @@ public class GraphView extends DefaultTreeView { changed = false; for (int i = 0; i < state.getGraphs().size(); i++) { ModelGraph currentGraph = state.getGraphs().get(i); - if (this.ensureNoInternalOverlap(currentGraph, nested)) + if (this.ensureNoInternalOverlap(currentGraph, nested)) { changed = true; + } DefaultGraphCell currentCell = this.m_jgAdapter .getVertexCell(currentGraph.getModel()); Rectangle2D currentBounds = (Rectangle2D) ((Map) nested @@ -537,8 +559,9 @@ public class GraphView extends DefaultTreeView { (int) (currentBounds.getY() + currentShift.getY()), (int) currentBounds.getWidth(), (int) currentBounds.getHeight()); for (int j = 0; j < state.getGraphs().size(); j++) { - if (i == j) + if (i == j) { continue; + } ModelGraph graph = state.getGraphs().get(j); DefaultGraphCell cell = this.m_jgAdapter.getVertexCell(graph .getModel()); @@ -617,11 +640,12 @@ public class GraphView extends DefaultTreeView { .get(child1Cell)).get(GraphConstants.BOUNDS); Rectangle2D child2Bounds = (Rectangle2D) ((Map) nested .get(child2Cell)).get(GraphConstants.BOUNDS); - if (graph.getModel().getExecutionType().equals("parallel")) + if (graph.getModel().getExecutionType().equals("parallel")) { return Double.compare(child1Bounds.getMaxY(), child2Bounds.getMaxY()); - else + } else { return Double.compare(child1Bounds.getX(), child2Bounds.getX()); + } } }); @@ -631,8 +655,9 @@ public class GraphView extends DefaultTreeView { .get(GraphConstants.BOUNDS); for (int i = 1; i < sortedChildren.size(); i++) { ModelGraph child2 = sortedChildren.get(i); - if (ensureNoInternalOverlap(child2, nested)) + if (ensureNoInternalOverlap(child2, nested)) { changed = true; + } DefaultGraphCell child2Cell = this.m_jgAdapter.getVertexCell(child2 .getModel()); for (int j = i - 1; j >= 0; j--) { @@ -690,8 +715,9 @@ public class GraphView extends DefaultTreeView { private void addGroups(List<ModelGraph> modelGraphs, Map nested, ViewState state) { - for (ModelGraph modelGraph : modelGraphs) + for (ModelGraph modelGraph : modelGraphs) { this.addGroups(modelGraph, nested, state); + } } private DefaultGraphCell addGroups(ModelGraph modelGraph, Map nested, @@ -709,25 +735,31 @@ public class GraphView extends DefaultTreeView { DefaultGraphCell curCell = addGroups(child, nested, state); Rectangle2D bounds = (Rectangle2D) ((Map<Object, Object>) nested .get(curCell)).get("bounds"); - if (bounds.getX() < top_x) + if (bounds.getX() < top_x) { top_x = bounds.getX(); - if (bounds.getY() < top_y) + } + if (bounds.getY() < top_y) { top_y = bounds.getY(); - if (bounds.getMaxX() > bottom_x) + } + if (bounds.getMaxX() > bottom_x) { bottom_x = bounds.getMaxX(); - if (bounds.getMaxY() > bottom_y) + } + if (bounds.getMaxY() > bottom_y) { bottom_y = bounds.getMaxY(); + } } map.put(GraphConstants.BOUNDS, new AttributeMap.SerializableRectangle2D( top_x - 5, top_y - 20, bottom_x - top_x + 10, bottom_y - top_y + 25)); map.put(GraphConstants.FOREGROUND, Color.black); - if (modelGraph.getModel().isRef()) + if (modelGraph.getModel().isRef()) { map.put(GraphConstants.BACKGROUND, Color.lightGray); - else + } else { map.put(GraphConstants.BACKGROUND, Color.white); - if (modelGraph.isExcused()) + } + if (modelGraph.isExcused()) { map.put(GraphConstants.GRADIENTCOLOR, Color.gray); + } map.put(GraphConstants.HORIZONTAL_ALIGNMENT, SwingConstants.LEFT); map.put(GraphConstants.VERTICAL_ALIGNMENT, SwingConstants.TOP); map.put(GraphConstants.BORDER, new LineBorder(modelGraph.getModel() @@ -740,18 +772,20 @@ public class GraphView extends DefaultTreeView { .getModel()); ((Map<Object, Object>) nested.get(cell)).put(GraphConstants.FOREGROUND, Color.black); - if (modelGraph.isExcused()) + if (modelGraph.isExcused()) { ((Map<Object, Object>) nested.get(cell)).put( GraphConstants.GRADIENTCOLOR, Color.gray); - else + } else { ((Map<Object, Object>) nested.get(cell)).put( GraphConstants.GRADIENTCOLOR, Color.white); - if (!((ModelNode) ((DefaultGraphCell) cell).getUserObject()).isRef()) + } + if (!((ModelNode) ((DefaultGraphCell) cell).getUserObject()).isRef()) { ((Map<Object, Object>) nested.get(cell)).put(GraphConstants.BACKGROUND, modelGraph.getModel().getColor()); - else + } else { ((Map<Object, Object>) nested.get(cell)).put(GraphConstants.BACKGROUND, Color.lightGray); + } return cell; } @@ -810,12 +844,14 @@ public class GraphView extends DefaultTreeView { } else { while (mouseOverGraph != null && mouseOverGraph.getParent() != null - && mouseOverGraph.getParent().getModel().isRef()) + && mouseOverGraph.getParent().getModel().isRef()) { mouseOverGraph = mouseOverGraph.getParent(); + } } - if (mouseOverGraph != null) + if (mouseOverGraph != null) { mouseOverCell = GraphView.this.m_jgAdapter .getVertexCell(mouseOverGraph.getModel()); + } } state.setSelected(mouseOverGraph); } else { @@ -845,12 +881,15 @@ public class GraphView extends DefaultTreeView { ModelGraph graph = GuiUtils.find(state.getGraphs(), ((ModelNode) ((DefaultGraphCell) cell).getUserObject()) .getId()); - if (graph.getModel().isRef()) + if (graph.getModel().isRef()) { while (graph.getParent() != null - && graph.getParent().getModel().isRef()) + && graph.getParent().getModel().isRef()) { graph = graph.getParent(); - if (GuiUtils.isDummyNode(graph.getModel())) + } + } + if (GuiUtils.isDummyNode(graph.getModel())) { graph = graph.getParent(); + } state.setSelected(graph); GraphView.this.notifyListeners(); } @@ -929,8 +968,9 @@ public class GraphView extends DefaultTreeView { if (cell instanceof DefaultGraphCell) { ModelGraph graph = GuiUtils.find(state.getGraphs(), ((ModelNode) ((DefaultGraphCell) cell).getUserObject()).getId()); - if (graph != null) + if (graph != null) { graph.addChild(newGraph); + } } } else { state.addGraph(newGraph); @@ -964,11 +1004,12 @@ public class GraphView extends DefaultTreeView { } ModelGraph parent = GuiUtils.findRoot(state.getGraphs(), graph); Point shiftPoint = null; - if (state.containsProperty(parent.getModel().getId() + "/Shift")) + if (state.containsProperty(parent.getModel().getId() + "/Shift")) { shiftPoint = new Point(Integer.parseInt(state .getFirstPropertyValue(parent.getModel().getId() + "/Shift/x")), Integer.parseInt(state.getFirstPropertyValue(parent.getModel() - .getId() + "/Shift/y"))); + .getId() + "/Shift/y"))); + } if (shiftPoint == null) { shiftPoint = new Point(100, 100); this.setShift(state, parent, shiftPoint); @@ -1017,8 +1058,9 @@ public class GraphView extends DefaultTreeView { .isCondition())); } else { boolean isCondition = false; - if (state.getGraphs().size() > 0) + if (state.getGraphs().size() > 0) { isCondition = state.getGraphs().get(0).isCondition(); + } viewReferrencedWorkflow.setEnabled(false); taskItem.setEnabled(!isCondition); condItem.setEnabled(isCondition); @@ -1066,11 +1108,13 @@ public class GraphView extends DefaultTreeView { ModelGraph graph = state.getSelected(); ModelGraph parent = graph.getParent(); if (e.getActionCommand().equals(TO_FRONT_ITEM_NAME)) { - if (parent.getChildren().remove(graph)) + if (parent.getChildren().remove(graph)) { parent.getChildren().add(0, graph); + } } else if (e.getActionCommand().equals(TO_BACK_ITEM_NAME)) { - if (parent.getChildren().remove(graph)) + if (parent.getChildren().remove(graph)) { parent.getChildren().add(graph); + } } else if (e.getActionCommand().equals(FORWARD_ITEM_NAME)) { int index = parent.getChildren().indexOf(graph); if (index != -1) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java index e5a28cf..3f7bd5f 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java @@ -66,13 +66,15 @@ public class TreeProjectView extends MultiStateView { this.selectedState = activeState; DefaultMutableTreeNode selected = null; DefaultMutableTreeNode root = new DefaultMutableTreeNode("Projects"); - for (ViewState state : states) + for (ViewState state : states) { if (selectedState != null - && state.getFile().equals(selectedState.getFile())) + && state.getFile().equals(selectedState.getFile())) { root.add(selected = new DefaultMutableTreeNode(state.getFile() - .getName())); - else + .getName())); + } else { root.add(new DefaultMutableTreeNode(state.getFile().getName())); + } + } tree = new JTree(root); tree.setEditable(true); @@ -104,10 +106,11 @@ public class TreeProjectView extends MultiStateView { for (ViewState state : states) { if (state.getFile().getName().equals(stateName)) { selectedState = state; - if (e.getClickCount() == 2) + if (e.getClickCount() == 2) { TreeProjectView.this .notifyListeners(new ViewChange.NEW_ACTIVE_STATE( selectedState, TreeProjectView.this)); + } break; } } @@ -128,12 +131,13 @@ public class TreeProjectView extends MultiStateView { } }); - if (selected != null) + if (selected != null) { tree.setSelectionPath(new TreePath(new DefaultMutableTreeNode[] { root, selected })); - else if (states.size() > 0) + } else if (states.size() > 0) { tree.setSelectionPath(new TreePath(new DefaultMutableTreeNode[] { root, (DefaultMutableTreeNode) root.getChildAt(0) })); + } tree.setRootVisible(false); this.setBorder(new EtchedBorder()); http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java index c73a2d7..4e471bf 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java @@ -75,11 +75,12 @@ public abstract class Tool extends JPanel { public void setSelected(boolean selected) { if (image != null) { Tool.this.removeAll(); - if (this.selected = selected) + if (this.selected = selected) { Tool.this.add(new JLabel(new ImageIcon(selectedImage)), BorderLayout.CENTER); - else + } else { Tool.this.add(new JLabel(new ImageIcon(image)), BorderLayout.CENTER); + } Tool.this.revalidate(); } } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java index 6fac807..1f0d943 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java @@ -62,9 +62,11 @@ public class ToolBox extends JPanel { public void setSelected(Tool selectedTool) { this.selectedTool = selectedTool; this.selectedTool.setSelected(true); - for (Tool tool : tools) - if (!this.selectedTool.equals(tool)) + for (Tool tool : tools) { + if (!this.selectedTool.equals(tool)) { tool.setSelected(false); + } + } } public Tool getSelected() { http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java index 44e4f85..2faffb3 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java @@ -45,17 +45,24 @@ public class GuiUtils { protected static AtomicInteger dummyUntitledIter = new AtomicInteger(0); public static boolean isSubGraph(ModelGraph graph, ModelGraph subGraph) { - if (graph.equals(subGraph)) + if (graph.equals(subGraph)) { return true; - for (ModelGraph child : graph.getChildren()) - if (isSubGraph(child, subGraph)) + } + for (ModelGraph child : graph.getChildren()) { + if (isSubGraph(child, subGraph)) { return true; - if (graph.getPreConditions() != null) - if (isSubGraph(graph.getPreConditions(), subGraph)) + } + } + if (graph.getPreConditions() != null) { + if (isSubGraph(graph.getPreConditions(), subGraph)) { return true; - if (graph.getPostConditions() != null) - if (isSubGraph(graph.getPostConditions(), subGraph)) + } + } + if (graph.getPostConditions() != null) { + if (isSubGraph(graph.getPostConditions(), subGraph)) { return true; + } + } return false; } @@ -75,8 +82,9 @@ public class GuiUtils { public static void addChild(List<ModelGraph> graphs, String parentId, ModelGraph child) { ModelGraph parent = find(graphs, parentId); - if (parent != null) + if (parent != null) { parent.addChild(child); + } } public static List<ModelGraph> findRootGraphs(List<ModelGraph> graphs) { @@ -112,8 +120,9 @@ public class GuiUtils { return rootGraph; } else if (graph.getParent() != null) { ModelGraph root = findRoot(rootGraphs, graph.getParent()); - if (root != null) + if (root != null) { return root; + } } } return null; @@ -123,8 +132,9 @@ public class GuiUtils { Vector<ModelGraph> foundGraphs = new Vector<ModelGraph>(); for (String id : ids) { ModelGraph graph = find(graphs, id); - if (graph != null) + if (graph != null) { foundGraphs.add(graph); + } } return foundGraphs; } @@ -132,8 +142,9 @@ public class GuiUtils { public static ModelGraph find(List<ModelGraph> graphs, String id) { for (ModelGraph graph : graphs) { ModelGraph found = graph.recursiveFind(id); - if (found != null) + if (found != null) { return found; + } } return null; } @@ -144,8 +155,9 @@ public class GuiUtils { return graphs.remove(i); } else { ModelGraph graph = removeNode(graphs.get(i), node); - if (graph != null) + if (graph != null) { return graph; + } } } return null; @@ -161,10 +173,12 @@ public class GuiUtils { return curGraph; } else { stack.addAll(curGraph.getChildren()); - if (curGraph.getPreConditions() != null) + if (curGraph.getPreConditions() != null) { stack.add(curGraph.getPreConditions()); - if (curGraph.getPostConditions() != null) + } + if (curGraph.getPostConditions() != null) { stack.add(curGraph.getPostConditions()); + } } } return null; @@ -172,8 +186,9 @@ public class GuiUtils { public static List<Line> findSequentialLines(List<ModelGraph> graphs) { Vector<Line> lines = new Vector<Line>(); - for (ModelGraph graph : graphs) + for (ModelGraph graph : graphs) { lines.addAll(findSequentialLines(graph)); + } return lines; } @@ -185,9 +200,10 @@ public class GuiUtils { while (!stack.empty()) { ModelGraph curGraph = stack.pop(); if (curGraph.getModel().getExecutionType().equals("sequential")) { - for (int i = 0; i < curGraph.getChildren().size() - 1; i++) + for (int i = 0; i < curGraph.getChildren().size() - 1; i++) { lines.add(new Line(curGraph.getChildren().get(i).getModel(), curGraph.getChildren().get(i + 1).getModel())); + } } stack.addAll(curGraph.getChildren()); } @@ -197,8 +213,9 @@ public class GuiUtils { public static List<Line> findLines(final List<ModelGraph> graphs) { Vector<Line> lines = new Vector<Line>(); - for (ModelGraph graph : graphs) + for (ModelGraph graph : graphs) { lines.addAll(findLines(graph)); + } return lines; } @@ -211,8 +228,9 @@ public class GuiUtils { ModelGraph curGraph = graphs.pop(); if (curGraph.getModel().isParentType()) { - if (curGraph.getChildren().size() == 0) + if (curGraph.getChildren().size() == 0) { curGraph.addChild(new ModelGraph(createDummyNode())); + } List<Line> relaventLines = getRelaventLines(lines, curGraph .getModel().getId()); @@ -222,43 +240,49 @@ public class GuiUtils { .equals("sequential")) { lines.remove(index); if (curGraph.getChildren().size() > 0) { - if (relaventLine.getFromModel().equals(curGraph.getModel())) + if (relaventLine.getFromModel().equals(curGraph.getModel())) { lines.add(new Line(curGraph.getChildren() - .get(curGraph.getChildren().size() - 1).getModel(), + .get(curGraph.getChildren().size() - 1).getModel(), relaventLine.getToModel())); - else + } else { lines.add(new Line(relaventLine.getFromModel(), curGraph .getChildren().get(0).getModel())); + } } } else if (curGraph.getModel().getExecutionType().toLowerCase() .equals("parallel")) { lines.remove(index); - if (relaventLine.getFromModel().equals(curGraph.getModel())) - for (ModelGraph child : curGraph.getChildren()) + if (relaventLine.getFromModel().equals(curGraph.getModel())) { + for (ModelGraph child : curGraph.getChildren()) { lines.add(new Line(child.getModel(), relaventLine .getToModel())); - else - for (ModelGraph child : curGraph.getChildren()) + } + } else { + for (ModelGraph child : curGraph.getChildren()) { lines.add(new Line(relaventLine.getFromModel(), child .getModel())); + } + } } } if (curGraph.getModel().getExecutionType().toLowerCase() .equals("sequential")) { for (int i = 0; i < curGraph.getChildren().size(); i++) { - if (i == curGraph.getChildren().size() - 1) + if (i == curGraph.getChildren().size() - 1) { lines.add(new Line(curGraph.getChildren().get(i).getModel(), null)); - else + } else { lines.add(new Line(curGraph.getChildren().get(i).getModel(), curGraph.getChildren().get(i + 1).getModel())); + } } } else if (curGraph.getModel().getExecutionType().toLowerCase() .equals("parallel")) { - for (int i = 0; i < curGraph.getChildren().size(); i++) + for (int i = 0; i < curGraph.getChildren().size(); i++) { lines .add(new Line(curGraph.getChildren().get(i).getModel(), null)); + } } graphs.addAll(curGraph.getChildren()); } @@ -299,44 +323,54 @@ public class GuiUtils { public static Line getLine(List<Line> lines, ModelNode fromModel, ModelNode toModel) { - for (Line line : lines) + for (Line line : lines) { if (line.getFromModel().equals(fromModel) - && line.getToModel().equals(toModel)) + && line.getToModel().equals(toModel)) { return line; + } + } return null; } public static List<Line> getRelaventLines(List<Line> lines, String id) { List<Line> relaventLines = new Vector<Line>(); - for (Line line : lines) + for (Line line : lines) { if ((line.getFromModel() != null && line.getFromModel().getId() - .equals(id)) - || (line.getToModel() != null && line.getToModel().getId().equals(id))) + .equals(id)) + || (line.getToModel() != null && line.getToModel().getId().equals(id))) { relaventLines.add(line); + } + } return relaventLines; } public static List<Line> getChildrenLines(List<Line> lines, String id) { List<Line> relaventLines = new Vector<Line>(); - for (Line line : lines) - if (line.getFromModel().getId().equals(id)) + for (Line line : lines) { + if (line.getFromModel().getId().equals(id)) { relaventLines.add(line); + } + } return relaventLines; } public static List<Line> getParentLines(List<Line> lines, String id) { List<Line> relaventLines = new Vector<Line>(); - for (Line line : lines) - if (line.getToModel().getId().equals(id)) + for (Line line : lines) { + if (line.getToModel().getId().equals(id)) { relaventLines.add(line); + } + } return relaventLines; } public static List<Line> getStartingLines(List<Line> lines) { Vector<Line> startingLines = new Vector<Line>(); - for (Line line : lines) - if (getParentLines(lines, line.getFromModel().getId()).size() == 0) + for (Line line : lines) { + if (getParentLines(lines, line.getFromModel().getId()).size() == 0) { startingLines.add(line); + } + } return startingLines; } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java ---------------------------------------------------------------------- diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java index 5f4c80a..6e9796b 100644 --- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java +++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java @@ -49,17 +49,18 @@ public class Line { public boolean equals(Object obj) { if (obj instanceof Line) { - if (this.fromModel == null && this.toModel == null) + if (this.fromModel == null && this.toModel == null) { return ((Line) obj).fromModel == null && ((Line) obj).toModel == null; - else if (this.fromModel == null) + } else if (this.fromModel == null) { return ((Line) obj).fromModel == null - && ((Line) obj).toModel.equals(this.toModel); - else if (this.toModel == null) + && ((Line) obj).toModel.equals(this.toModel); + } else if (this.toModel == null) { return ((Line) obj).fromModel.equals(this.fromModel) - && ((Line) obj).toModel == null; - else + && ((Line) obj).toModel == null; + } else { return ((Line) obj).fromModel.equals(this.fromModel) - && ((Line) obj).toModel.equals(this.toModel); + && ((Line) obj).toModel.equals(this.toModel); + } } else { return false; } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java index 0585045..caff615 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java @@ -38,10 +38,10 @@ import org.apache.oodt.cas.cli.exception.CmdLineActionException; */ public class PagedQueryCliAction extends CatalogServiceCliAction { - protected int pageNum = -1; - protected int pageSize = -1; - protected String query; - protected Set<String> catalogIds; + private int pageNum = -1; + private int pageSize = -1; + private String query; + private Set<String> catalogIds; public void execute(ActionMessagePrinter printer) throws CmdLineActionException { @@ -93,4 +93,24 @@ public class PagedQueryCliAction extends CatalogServiceCliAction { public void setCatalogIds(List<String> catalogIds) { this.catalogIds = new HashSet<String>(catalogIds); } + + public int getPageNum() { + return pageNum; + } + + public int getPageSize() { + return pageSize; + } + + public String getQuery() { + return query; + } + + public Set<String> getCatalogIds() { + return catalogIds; + } + + public void setCatalogIds(Set<String> catalogIds) { + this.catalogIds = catalogIds; + } } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java index 66f58d5..de9b59e 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java @@ -38,8 +38,8 @@ import org.apache.oodt.cas.cli.exception.CmdLineActionException; */ public class QueryCliAction extends CatalogServiceCliAction { - protected String query; - protected Set<String> catalogIds; + private String query; + private Set<String> catalogIds; @Override public void execute(ActionMessagePrinter printer) @@ -80,4 +80,16 @@ public class QueryCliAction extends CatalogServiceCliAction { public void setCatalogIds(List<String> catalogIds) { this.catalogIds = new HashSet<String>(catalogIds); } + + public String getQuery() { + return query; + } + + public Set<String> getCatalogIds() { + return catalogIds; + } + + public void setCatalogIds(Set<String> catalogIds) { + this.catalogIds = catalogIds; + } } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java index 5933682..b62a535 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java @@ -40,11 +40,11 @@ import org.apache.oodt.cas.cli.exception.CmdLineActionException; */ public class ReducedPagedQueryCliAction extends CatalogServiceCliAction { - protected int pageNum = -1; - protected int pageSize = -1; - protected String query; - protected Set<String> catalogIds; - protected List<String> termNames; + private int pageNum = -1; + private int pageSize = -1; + private String query; + private Set<String> catalogIds; + private List<String> termNames; @Override public void execute(ActionMessagePrinter printer) @@ -102,4 +102,33 @@ public class ReducedPagedQueryCliAction extends CatalogServiceCliAction { public void setReducedTerms(List<String> termNames) { this.termNames = termNames; } + + public int getPageNum() { + return pageNum; + } + + public int getPageSize() { + return pageSize; + } + + public String getQuery() { + return query; + } + + public Set<String> getCatalogIds() { + return catalogIds; + } + + public void setCatalogIds(Set<String> catalogIds) { + this.catalogIds = catalogIds; + } + + public List<String> getTermNames() { + return termNames; + } + + public void setTermNames(List<String> termNames) { + this.termNames = termNames; + } } + http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java index 4411950..dd42147 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java @@ -40,9 +40,9 @@ import org.apache.oodt.cas.cli.exception.CmdLineActionException; */ public class ReducedQueryCliAction extends CatalogServiceCliAction { - protected String query; - protected Set<String> catalogIds; - protected List<String> termNames; + private String query; + private Set<String> catalogIds; + private List<String> termNames; @Override public void execute(ActionMessagePrinter printer) @@ -87,4 +87,24 @@ public class ReducedQueryCliAction extends CatalogServiceCliAction { public void setReducedTerms(List<String> termNames) { this.termNames = termNames; } + + public String getQuery() { + return query; + } + + public Set<String> getCatalogIds() { + return catalogIds; + } + + public void setCatalogIds(Set<String> catalogIds) { + this.catalogIds = catalogIds; + } + + public List<String> getTermNames() { + return termNames; + } + + public void setTermNames(List<String> termNames) { + this.termNames = termNames; + } } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java index 25ea22b..a17bfab 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java @@ -48,7 +48,7 @@ import org.apache.oodt.commons.date.DateUtils; */ public class DataSourceIngestMapper implements IngestMapper { - protected DataSource dataSource; + private DataSource dataSource; public DataSourceIngestMapper(String user, String pass, String driver, String jdbcUrl) { @@ -131,8 +131,10 @@ public class DataSourceIngestMapper implements IngestMapper { stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT CAT_SERV_TRANS_ID,CAT_SERV_TRANS_FACTORY FROM CatalogServiceMapper WHERE CAT_TRANS_ID = '"+ catalogTransactionId + "' AND CATALOG_ID = '" + catalogId + "'"); - while(rs.next()) - return ((TransactionIdFactory) Class.forName(rs.getString("CAT_SERV_TRANS_FACTORY")).newInstance()).createTransactionId(rs.getString("CAT_SERV_TRANS_ID")); + while(rs.next()) { + return ((TransactionIdFactory) Class.forName(rs.getString("CAT_SERV_TRANS_FACTORY")).newInstance()) + .createTransactionId(rs.getString("CAT_SERV_TRANS_ID")); + } return null; }catch (Exception e) { @@ -161,8 +163,10 @@ public class DataSourceIngestMapper implements IngestMapper { stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT CAT_TRANS_ID,CAT_TRANS_FACTORY FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + "' AND CATALOG_ID = '" + catalogId + "'"); - while(rs.next()) - return ((TransactionIdFactory) Class.forName(rs.getString("CAT_TRANS_FACTORY")).newInstance()).createTransactionId(rs.getString("CAT_TRANS_ID")); + while(rs.next()) { + return ((TransactionIdFactory) Class.forName(rs.getString("CAT_TRANS_FACTORY")).newInstance()) + .createTransactionId(rs.getString("CAT_TRANS_ID")); + } return null; }catch (Exception e) { @@ -192,8 +196,9 @@ public class DataSourceIngestMapper implements IngestMapper { rs = stmt.executeQuery("SELECT CATALOG_ID FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + "'"); Set<String> catalogIds = new HashSet<String>(); - while(rs.next()) - catalogIds.add(rs.getString("CATALOG_ID")); + while(rs.next()) { + catalogIds.add(rs.getString("CATALOG_ID")); + } return catalogIds; }catch (Exception e) { @@ -228,8 +233,10 @@ public class DataSourceIngestMapper implements IngestMapper { + "WHERE r >= " + ((indexPager.getPageSize() * indexPager.getPageNum()) + 1)); Set<TransactionId<?>> transactionIds = new HashSet<TransactionId<?>>(); - while(rs.next()) - transactionIds.add(((TransactionIdFactory) Class.forName(rs.getString("CAT_TRANS_FACTORY")).newInstance()).createTransactionId(rs.getString("CAT_TRANS_ID"))); + while(rs.next()) { + transactionIds.add(((TransactionIdFactory) Class.forName(rs.getString("CAT_TRANS_FACTORY")).newInstance()) + .createTransactionId(rs.getString("CAT_TRANS_ID"))); + } return transactionIds; }catch (Exception e) { @@ -339,4 +346,11 @@ public class DataSourceIngestMapper implements IngestMapper { } } + public DataSource getDataSource() { + return dataSource; + } + + public void setDataSource(DataSource dataSource) { + this.dataSource = dataSource; + } } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java index 872b7d7..dff1437 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java @@ -17,6 +17,12 @@ package org.apache.oodt.cas.catalog.mapping; //JDK imports +import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException; +import org.apache.oodt.cas.catalog.page.CatalogReceipt; +import org.apache.oodt.cas.catalog.page.IndexPager; +import org.apache.oodt.cas.catalog.struct.TransactionId; +import org.apache.oodt.cas.catalog.struct.TransactionIdFactory; + import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -26,11 +32,6 @@ import java.util.logging.Level; import java.util.logging.Logger; //OODT imports -import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException; -import org.apache.oodt.cas.catalog.page.CatalogReceipt; -import org.apache.oodt.cas.catalog.page.IndexPager; -import org.apache.oodt.cas.catalog.struct.TransactionId; -import org.apache.oodt.cas.catalog.struct.TransactionIdFactory; /** * @author bfoster @@ -87,10 +88,13 @@ public class MemoryBasedIngestMapper implements IngestMapper { throws CatalogRepositoryException { TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping .get(catalogServiceTransactionId.toString()); - if (mapping != null) - for (CatalogReceipt receipt : mapping.getCatalogReceipts()) - if (receipt.getCatalogId().equals(catalogId)) - return receipt.getTransactionId(); + if (mapping != null) { + for (CatalogReceipt receipt : mapping.getCatalogReceipts()) { + if (receipt.getCatalogId().equals(catalogId)) { + return receipt.getTransactionId(); + } + } + } return null; } @@ -105,9 +109,12 @@ public class MemoryBasedIngestMapper implements IngestMapper { String catalogId) throws CatalogRepositoryException { Set<TransactionId<?>> catalogTransactionIds = new HashSet<TransactionId<?>>(); List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogId); - if (catalogReceipts != null) - for (int i = indexPager.getPageNum() * indexPager.getPageSize(); i < catalogReceipts.size() && i < (indexPager.getPageNum() + 1) * indexPager.getPageSize(); i++) - catalogTransactionIds.add(catalogReceipts.get(i).getTransactionId()); + if (catalogReceipts != null) { + for (int i = indexPager.getPageNum() * indexPager.getPageSize(); + i < catalogReceipts.size() && i < (indexPager.getPageNum() + 1) * indexPager.getPageSize(); i++) { + catalogTransactionIds.add(catalogReceipts.get(i).getTransactionId()); + } + } return catalogTransactionIds; } @@ -121,8 +128,9 @@ public class MemoryBasedIngestMapper implements IngestMapper { if (catalogReceipts != null) { for (CatalogReceipt catalogReceipt : catalogReceipts) { TransactionIdMapping mapping = this.catalogInfoKeyMapping.remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId())); - if (mapping != null) - mapping.getCatalogReceipts().remove(catalogReceipt); + if (mapping != null) { + mapping.getCatalogReceipts().remove(catalogReceipt); + } } } } @@ -135,11 +143,13 @@ public class MemoryBasedIngestMapper implements IngestMapper { TransactionId<?> catalogServiceTransactionId) throws CatalogRepositoryException { TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping.remove(catalogServiceTransactionId.toString()); - if (mapping != null) - for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) { - this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId()).remove(catalogReceipt); - this.catalogInfoKeyMapping.remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId())); - } + if (mapping != null) { + for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) { + this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId()).remove(catalogReceipt); + this.catalogInfoKeyMapping + .remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId())); + } + } } /* @@ -186,15 +196,17 @@ public class MemoryBasedIngestMapper implements IngestMapper { throws CatalogRepositoryException { TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping .get(catalogServiceTransactionId.toString()); - if (mapping == null) - mapping = new TransactionIdMapping(catalogServiceTransactionId); + if (mapping == null) { + mapping = new TransactionIdMapping(catalogServiceTransactionId); + } mapping.addCatalogReceipt(catalogReceipt); this.catalogServiceTransactionIdKeyMapping.put( catalogServiceTransactionId.toString(), mapping); this.catalogInfoKeyMapping.put(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId()), mapping); List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId()); - if (catalogReceipts == null) - catalogReceipts = new Vector<CatalogReceipt>(); + if (catalogReceipts == null) { + catalogReceipts = new Vector<CatalogReceipt>(); + } catalogReceipts.add(catalogReceipt); this.catalogIdToCatalogReceiptMapping.put(catalogReceipt.getCatalogId(), catalogReceipts); } @@ -212,8 +224,9 @@ public class MemoryBasedIngestMapper implements IngestMapper { HashSet<String> catalogs = new HashSet<String>(); TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping .get(catalogServiceTransactionId.toString()); - for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) - catalogs.add(catalogReceipt.getCatalogId()); + for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) { + catalogs.add(catalogReceipt.getCatalogId()); + } return catalogs; } @@ -221,9 +234,11 @@ public class MemoryBasedIngestMapper implements IngestMapper { TransactionId<?> catalogServiceTransactionId, String catalogId) throws CatalogRepositoryException { TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping.get(catalogServiceTransactionId); - for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) - if (catalogReceipt.getCatalogId().equals(catalogId)) - return catalogReceipt; + for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) { + if (catalogReceipt.getCatalogId().equals(catalogId)) { + return catalogReceipt; + } + } return null; } @@ -231,10 +246,10 @@ public class MemoryBasedIngestMapper implements IngestMapper { return catalogTransactionId + ":" + catalogId; } - private class TransactionIdMapping { + private static class TransactionIdMapping { private TransactionId<?> catalogServiceTransactionId; - List<CatalogReceipt> catalogReceipts; + private List<CatalogReceipt> catalogReceipts; public TransactionIdMapping(TransactionId<?> catalogServiceTransactionId) { this.catalogServiceTransactionId = catalogServiceTransactionId; @@ -253,39 +268,9 @@ public class MemoryBasedIngestMapper implements IngestMapper { return catalogServiceTransactionId; } + public void setCatalogReceipts(List<CatalogReceipt> catalogReceipts) { + this.catalogReceipts = catalogReceipts; + } } -// private class CatalogInfo { -// -// private String catalogId; -// private TransactionId<?> catalogTransactionId; -// -// public CatalogInfo(String catalogId, -// TransactionId<?> catalogTransactionId) { -// this.catalogId = catalogId; -// this.catalogTransactionId = catalogTransactionId; -// } -// -// public String getCatalogUrn() { -// return this.catalogId; -// } -// -// public TransactionId<?> getCatalogTransactionId() { -// return this.catalogTransactionId; -// } -// -// public boolean equals(Object obj) { -// if (obj instanceof CatalogInfo) { -// return this.toString().equals(obj.toString()); -// }else { -// return false; -// } -// } -// -// public String toString() { -// return this.catalogId + ":" + this.catalogTransactionId; -// } -// -// } - } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java index 4ba61a3..9c9045a 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java @@ -65,8 +65,9 @@ public class IndexPager { } public void incrementPageNumber() { - if (this.pageNum + 1 <= this.totalPages) - this.pageNum++; + if (this.pageNum + 1 <= this.totalPages) { + this.pageNum++; + } } public boolean isLastPage() { http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java index ddfffd3..af0f0f3 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java @@ -31,10 +31,11 @@ public class PageInfo { public PageInfo(int pageSize, int pageNum) { this.pageSize = pageSize; - if (pageNum < 1) - this.pageNum = 1; - else - this.pageNum = pageNum; + if (pageNum < 1) { + this.pageNum = 1; + } else { + this.pageNum = pageNum; + } } public int getPageSize() { http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java index d7f65da..59ff1f5 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java @@ -47,10 +47,12 @@ public class QueryPager extends IndexPager { public void setPageInfo(PageInfo pageInfo) { this.pageSize = Math.max(pageInfo.getPageSize(), 0); this.totalPages = this.caculateTotalPages(); - if (this.totalPages == 0) - this.pageNum = 0; - else - this.pageNum = (pageInfo.getPageNum() == PageInfo.LAST_PAGE || pageInfo.getPageNum() >= this.totalPages) ? this.totalPages : pageInfo.getPageNum(); + if (this.totalPages == 0) { + this.pageNum = 0; + } else { + this.pageNum = (pageInfo.getPageNum() == PageInfo.LAST_PAGE || pageInfo.getPageNum() >= this.totalPages) + ? this.totalPages : pageInfo.getPageNum(); + } } public List<TransactionReceipt> getTransactionReceipts() { @@ -59,9 +61,12 @@ public class QueryPager extends IndexPager { public List<TransactionReceipt> getCurrentPage() { List<TransactionReceipt> currentPage = new Vector<TransactionReceipt>(); - if (this.pageNum > 0) - for (int i = (this.getPageNum() - 1) * this.getPageSize(); i < receipts.size() && i < this.getPageNum() * this.getPageSize(); i++) - currentPage.add(receipts.get(i)); + if (this.pageNum > 0) { + for (int i = (this.getPageNum() - 1) * this.getPageSize(); + i < receipts.size() && i < this.getPageNum() * this.getPageSize(); i++) { + currentPage.add(receipts.get(i)); + } + } return currentPage; } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java index f8e4848..9dfa440 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java @@ -48,10 +48,11 @@ public class TransactionReceipt { this.catalogReceipts = new Vector<CatalogReceipt>(catalogReceipts); for (CatalogReceipt catalogReceipt : catalogReceipts) { this.catalogIds.add(catalogReceipt.getCatalogId()); - if (this.transactionDate == null) - this.transactionDate = catalogReceipt.getTransactionDate(); - else if (this.transactionDate.before(catalogReceipt.getTransactionDate())) - this.transactionDate = catalogReceipt.getTransactionDate(); + if (this.transactionDate == null) { + this.transactionDate = catalogReceipt.getTransactionDate(); + } else if (this.transactionDate.before(catalogReceipt.getTransactionDate())) { + this.transactionDate = catalogReceipt.getTransactionDate(); + } } } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java index f294e01..049e821 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java @@ -35,20 +35,21 @@ public class ComparisonQueryExpression extends TermQueryExpression { } public static Operator getOperatorBySign(String sign) { - if (EQUAL_TO.value.equals(sign)) - return EQUAL_TO; - else if (LESS_THAN_EQUAL_TO.value.equals(sign)) - return LESS_THAN_EQUAL_TO; - else if (GREATER_THAN_EQUAL_TO.value.equals(sign)) - return GREATER_THAN_EQUAL_TO; - else if (LESS_THAN.value.equals(sign)) - return LESS_THAN; - else if (GREATER_THAN.value.equals(sign)) - return GREATER_THAN; - else if (LIKE.value.equals(sign)) - return LIKE; - else - throw new IllegalArgumentException("Not matching operator for '" + sign + "'"); + if (EQUAL_TO.value.equals(sign)) { + return EQUAL_TO; + } else if (LESS_THAN_EQUAL_TO.value.equals(sign)) { + return LESS_THAN_EQUAL_TO; + } else if (GREATER_THAN_EQUAL_TO.value.equals(sign)) { + return GREATER_THAN_EQUAL_TO; + } else if (LESS_THAN.value.equals(sign)) { + return LESS_THAN; + } else if (GREATER_THAN.value.equals(sign)) { + return GREATER_THAN; + } else if (LIKE.value.equals(sign)) { + return LIKE; + } else { + throw new IllegalArgumentException("Not matching operator for '" + sign + "'"); + } } public String toString() { http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java index a39f263..544ef35 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java @@ -39,10 +39,11 @@ public class CustomQueryExpression extends QueryExpression { public CustomQueryExpression(String name, Properties properties) { super(); this.name = name; - if (properties != null) - this.properties = properties; - else - this.properties = new Properties(); + if (properties != null) { + this.properties = properties; + } else { + this.properties = new Properties(); + } } public String getName() { http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java index b7b58a6..01142a4 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java @@ -64,8 +64,9 @@ public class FreeTextQueryExpression extends TermQueryExpression { List<String> values = new Vector<String>(); while (tok.hasMoreElements()) { token = tok.nextToken(); - if (!noiseWordHash.contains(token)) - values.add(token); + if (!noiseWordHash.contains(token)) { + values.add(token); + } } if (values.size() > 0) { values.addAll(this.term.getValues()); http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java index df16b6b..1a1fdac 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java @@ -108,8 +108,9 @@ public class QueryLogicalGroup extends QueryExpression { QueryLogicalGroup qlGroup = new QueryLogicalGroup(); qlGroup.setBucketNames(this.getBucketNames()); qlGroup.setOperator(this.operator); - for (QueryExpression qe : this.queryExpressions) - qlGroup.addExpression(qe.clone()); + for (QueryExpression qe : this.queryExpressions) { + qlGroup.addExpression(qe.clone()); + } return qlGroup; } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java index 29caf00..0802a9f 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java @@ -76,8 +76,9 @@ public class MetadataTimeEventQueryFilter extends QueryFilter<MetadataTimeEvent> } public void setConverter(VersionConverter converter) { - if (converter != null) + if (converter != null) { this.converter = converter; + } } @Override @@ -85,13 +86,15 @@ public class MetadataTimeEventQueryFilter extends QueryFilter<MetadataTimeEvent> List<MetadataTimeEvent> timeEvents = new Vector<MetadataTimeEvent>(); for (TransactionalMetadata transactionalMetadata : metadataList) { double priority = 0; - if (this.getPriorityMetKey() != null) - priority = Double.parseDouble(transactionalMetadata.getMetadata().getMetadata(this.priorityMetKey)); + if (this.getPriorityMetKey() != null) { + priority = Double.parseDouble(transactionalMetadata.getMetadata().getMetadata(this.priorityMetKey)); + } long startTime = Long.parseLong(transactionalMetadata.getMetadata().getMetadata(this.startDateTimeMetKey)); String endTimeString = transactionalMetadata.getMetadata().getMetadata(this.endDateTimeMetKey); long endTime = startTime; - if (endTimeString != null) - endTime = Long.parseLong(endTimeString); + if (endTimeString != null) { + endTime = Long.parseLong(endTimeString); + } timeEvents.add(new MetadataTimeEvent(startTime, endTime, priority, transactionalMetadata)); } return Collections.unmodifiableList(timeEvents); @@ -100,8 +103,9 @@ public class MetadataTimeEventQueryFilter extends QueryFilter<MetadataTimeEvent> @Override protected List<TransactionalMetadata> filterTypeToMetadata(List<MetadataTimeEvent> filterObjects) { List<TransactionalMetadata> metadataList = new Vector<TransactionalMetadata>(); - for (MetadataTimeEvent timeEvent : filterObjects) - metadataList.add(timeEvent.getTimeObject()); + for (MetadataTimeEvent timeEvent : filterObjects) { + metadataList.add(timeEvent.getTimeObject()); + } return Collections.unmodifiableList(metadataList); } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java index 80a649d..855454b 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java @@ -30,8 +30,9 @@ public class AsciiSortableVersionConverter implements VersionConverter { public double convertToPriority(String version) { double priority = 0; char[] versionCharArray = version.toCharArray(); - for (int i = 0, j = versionCharArray.length - 1; i < versionCharArray.length; i++, j--) + for (int i = 0, j = versionCharArray.length - 1; i < versionCharArray.length; i++, j--) { priority += (((int) versionCharArray[i]) * Math.pow(10, j)); + } return priority; } http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java index a4ce38b..c892ccf 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java @@ -107,7 +107,9 @@ public class ParseException extends Exception { retval.append("Encountered \""); Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { - if (i != 0) retval.append(" "); + if (i != 0) { + retval.append(" "); + } if (tok.kind == 0) { retval.append(tokenImage[0]); break; http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java index 73d8198..cd001a4 100644 --- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java +++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java @@ -15,8 +15,9 @@ private int jjStopStringLiteralDfa_0(int pos, long active0) jjmatchedKind = 23; return 16; } - if ((active0 & 0x80L) != 0L) + if ((active0 & 0x80L) != 0L) { return 10; + } return -1; case 1: if ((active0 & 0x18000L) != 0L) @@ -41,8 +42,9 @@ private int jjStopStringLiteralDfa_0(int pos, long active0) jjmatchedPos = 3; return 16; } - if ((active0 & 0x10000L) != 0L) + if ((active0 & 0x10000L) != 0L) { return 16; + } return -1; case 4: if ((active0 & 0x8000L) != 0L) @@ -165,16 +167,18 @@ private int jjMoveStringLiteralDfa1_0(long active0) switch(curChar) { case 10: - if ((active0 & 0x8L) != 0L) + if ((active0 & 0x8L) != 0L) { return jjStopAtPos(1, 3); + } break; case 61: - if ((active0 & 0x40000L) != 0L) + if ((active0 & 0x40000L) != 0L) { return jjStopAtPos(1, 18); - else if ((active0 & 0x80000L) != 0L) + } else if ((active0 & 0x80000L) != 0L) { return jjStopAtPos(1, 19); - else if ((active0 & 0x200000L) != 0L) + } else if ((active0 & 0x200000L) != 0L) { return jjStopAtPos(1, 21); + } break; case 65: return jjMoveStringLiteralDfa2_0(active0, 0x20L); @@ -191,8 +195,9 @@ private int jjMoveStringLiteralDfa1_0(long active0) } private int jjMoveStringLiteralDfa2_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(0, old0); + if (((active0 &= old0)) == 0L) { + return jjStartNfa_0(0, old0); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); @@ -215,8 +220,9 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0) } private int jjMoveStringLiteralDfa3_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(1, old0); + if (((active0 &= old0)) == 0L) { + return jjStartNfa_0(1, old0); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); @@ -225,14 +231,16 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0) switch(curChar) { case 32: - if ((active0 & 0x40L) != 0L) + if ((active0 & 0x40L) != 0L) { return jjStopAtPos(3, 6); + } break; case 68: return jjMoveStringLiteralDfa4_0(active0, 0x20L); case 101: - if ((active0 & 0x10000L) != 0L) + if ((active0 & 0x10000L) != 0L) { return jjStartNfaWithStates_0(3, 16, 16); + } break; case 107: return jjMoveStringLiteralDfa4_0(active0, 0x8000L); @@ -243,8 +251,9 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0) } private int jjMoveStringLiteralDfa4_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(2, old0); + if (((active0 &= old0)) == 0L) { + return jjStartNfa_0(2, old0); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0); @@ -253,8 +262,9 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0) switch(curChar) { case 32: - if ((active0 & 0x20L) != 0L) + if ((active0 & 0x20L) != 0L) { return jjStopAtPos(4, 5); + } break; case 101: return jjMoveStringLiteralDfa5_0(active0, 0x8000L); @@ -265,8 +275,9 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0) } private int jjMoveStringLiteralDfa5_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(3, old0); + if (((active0 &= old0)) == 0L) { + return jjStartNfa_0(3, old0); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); @@ -283,8 +294,9 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0) } private int jjMoveStringLiteralDfa6_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(4, old0); + if (((active0 &= old0)) == 0L) { + return jjStartNfa_0(4, old0); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0); @@ -301,8 +313,9 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0) } private int jjMoveStringLiteralDfa7_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(5, old0); + if (((active0 &= old0)) == 0L) { + return jjStartNfa_0(5, old0); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0); @@ -319,8 +332,9 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0) } private int jjMoveStringLiteralDfa8_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(6, old0); + if (((active0 &= old0)) == 0L) { + return jjStartNfa_0(6, old0); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(7, active0); @@ -337,8 +351,9 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0) } private int jjMoveStringLiteralDfa9_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(7, old0); + if (((active0 &= old0)) == 0L) { + return jjStartNfa_0(7, old0); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(8, active0); @@ -355,8 +370,9 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0) } private int jjMoveStringLiteralDfa10_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(8, old0); + if (((active0 &= old0)) == 0L) { + return jjStartNfa_0(8, old0); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(9, active0); @@ -365,8 +381,9 @@ private int jjMoveStringLiteralDfa10_0(long old0, long active0) switch(curChar) { case 115: - if ((active0 & 0x8000L) != 0L) + if ((active0 & 0x8000L) != 0L) { return jjStartNfaWithStates_0(10, 15, 16); + } break; default : break; @@ -413,8 +430,9 @@ private int jjMoveNfa_0(int startState, int curPos) int j, kind = 0x7fffffff; for (;;) { - if (++jjround == 0x7fffffff) + if (++jjround == 0x7fffffff) { ReInitRounds(); + } if (curChar < 64) { long l = 1L << curChar; @@ -423,59 +441,73 @@ private int jjMoveNfa_0(int startState, int curPos) switch(jjstateSet[--i]) { case 10: - if ((0xd7ffe77a00000000L & l) != 0L) + if ((0xd7ffe77a00000000L & l) != 0L) { jjCheckNAddStates(0, 2); + } break; case 16: case 5: - if ((0x7ffe00000000000L & l) == 0L) + if ((0x7ffe00000000000L & l) == 0L) { break; - if (kind > 23) + } + if (kind > 23) { kind = 23; + } jjCheckNAdd(5); break; case 3: - if (curChar == 39) + if (curChar == 39) { jjAddStates(3, 4); + } break; case 0: - if (curChar == 58) + if (curChar == 58) { jjstateSet[jjnewStateCnt++] = 1; + } break; case 2: - if ((0x7ffe00000000000L & l) == 0L) + if ((0x7ffe00000000000L & l) == 0L) { break; - if (kind > 17) + } + if (kind > 17) { kind = 17; + } jjstateSet[jjnewStateCnt++] = 2; break; case 8: - if ((0x7ffe00000000000L & l) != 0L) + if ((0x7ffe00000000000L & l) != 0L) { jjCheckNAddTwoStates(8, 9); + } break; case 9: - if (curChar == 39 && kind > 24) + if (curChar == 39 && kind > 24) { kind = 24; + } break; case 11: - if (curChar == 32) + if (curChar == 32) { jjAddStates(5, 6); + } break; case 12: - if ((0x7ffe00000000000L & l) != 0L) + if ((0x7ffe00000000000L & l) != 0L) { jjCheckNAddStates(7, 9); + } break; case 13: - if ((0xd7ffe77a00000000L & l) != 0L) + if ((0xd7ffe77a00000000L & l) != 0L) { jjCheckNAddStates(7, 9); + } break; case 14: - if ((0xd000877a00000000L & l) != 0L) + if ((0xd000877a00000000L & l) != 0L) { jjCheckNAddStates(7, 9); + } break; case 15: - if ((0xd7ffe77a00000000L & l) != 0L) + if ((0xd7ffe77a00000000L & l) != 0L) { jjCheckNAddStates(10, 13); + } break; default : break; } @@ -489,86 +521,106 @@ private int jjMoveNfa_0(int startState, int curPos) switch(jjstateSet[--i]) { case 10: - if ((0x6fffffffffffffffL & l) != 0L) + if ((0x6fffffffffffffffL & l) != 0L) { jjCheckNAddStates(0, 2); - if ((0x7fffffe07fffffeL & l) != 0L) + } + if ((0x7fffffe07fffffeL & l) != 0L) { jjCheckNAddStates(14, 16); + } break; case 16: if ((0x7fffffe87fffffeL & l) != 0L) { - if (kind > 23) + if (kind > 23) { kind = 23; + } jjCheckNAdd(5); } if ((0x7fffffe07fffffeL & l) != 0L) { - if (kind > 23) + if (kind > 23) { kind = 23; + } jjCheckNAddTwoStates(4, 5); } break; case 3: if ((0x7fffffe07fffffeL & l) != 0L) { - if (kind > 23) + if (kind > 23) { kind = 23; + } jjCheckNAddTwoStates(4, 5); } - if (curChar == 112) + if (curChar == 112) { jjstateSet[jjnewStateCnt++] = 0; + } break; case 1: - if ((0x7fffffe07fffffeL & l) == 0L) + if ((0x7fffffe07fffffeL & l) == 0L) { break; - if (kind > 17) + } + if (kind > 17) { kind = 17; + } jjCheckNAddTwoStates(1, 2); break; case 2: - if ((0x7fffffe87fffffeL & l) == 0L) + if ((0x7fffffe87fffffeL & l) == 0L) { break; - if (kind > 17) + } + if (kind > 17) { kind = 17; + } jjCheckNAdd(2); break; case 4: - if ((0x7fffffe07fffffeL & l) == 0L) + if ((0x7fffffe07fffffeL & l) == 0L) { break; - if (kind > 23) + } + if (kind > 23) { kind = 23; + } jjCheckNAddTwoStates(4, 5); break; case 5: - if ((0x7fffffe87fffffeL & l) == 0L) + if ((0x7fffffe87fffffeL & l) == 0L) { break; - if (kind > 23) + } + if (kind > 23) { kind = 23; + } jjCheckNAdd(5); break; case 7: - if ((0x7fffffe07fffffeL & l) != 0L) + if ((0x7fffffe07fffffeL & l) != 0L) { jjCheckNAddStates(14, 16); + } break; case 8: - if ((0x7fffffe87fffffeL & l) != 0L) + if ((0x7fffffe87fffffeL & l) != 0L) { jjCheckNAddTwoStates(8, 9); + } break; case 12: - if ((0x7fffffe87fffffeL & l) != 0L) + if ((0x7fffffe87fffffeL & l) != 0L) { jjCheckNAddStates(7, 9); + } break; case 13: - if ((0x6fffffffffffffffL & l) != 0L) + if ((0x6fffffffffffffffL & l) != 0L) { jjCheckNAddStates(7, 9); + } break; case 14: - if ((0x6800000178000001L & l) != 0L) + if ((0x6800000178000001L & l) != 0L) { jjCheckNAddStates(7, 9); + } break; case 15: - if ((0x6fffffffffffffffL & l) != 0L) + if ((0x6fffffffffffffffL & l) != 0L) { jjCheckNAddStates(10, 13); + } break; default : break; } @@ -593,8 +645,9 @@ private int jjMoveNfa_0(int startState, int curPos) kind = 0x7fffffff; } ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 16 - (jjnewStateCnt = startsAt))) + if ((i = jjnewStateCnt) == (startsAt = 16 - (jjnewStateCnt = startsAt))) { return curPos; + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } @@ -622,8 +675,9 @@ private final int[] jjrounds = new int[16]; private final int[] jjstateSet = new int[32]; protected char curChar; public QueryParserTokenManager(SimpleCharStream stream){ - if (SimpleCharStream.staticFlag) + if (SimpleCharStream.staticFlag) { throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + } input_stream = stream; } public QueryParserTokenManager(SimpleCharStream stream, int lexState){ @@ -641,8 +695,9 @@ private void ReInitRounds() { int i; jjround = 0x80000001; - for (i = 16; i-- > 0;) + for (i = 16; i-- > 0;) { jjrounds[i] = 0x80000000; + } } public void ReInit(SimpleCharStream stream, int lexState) { @@ -651,10 +706,12 @@ public void ReInit(SimpleCharStream stream, int lexState) } public void SwitchTo(int lexState) { - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else + if (lexState >= 1 || lexState < 0) { + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", + TokenMgrError.INVALID_LEXICAL_STATE); + } else { curLexState = lexState; + } } protected Token jjFillToken() @@ -699,8 +756,9 @@ public Token getNextToken() } try { input_stream.backup(0); - while (curChar <= 10 && (0x400L & (1L << curChar)) != 0L) + while (curChar <= 10 && (0x400L & (1L << curChar)) != 0L) { curChar = input_stream.BeginToken(); + } } catch (java.io.IOException e1) { continue EOFLoop; } jjmatchedKind = 0x7fffffff; @@ -708,8 +766,9 @@ public Token getNextToken() curPos = jjMoveStringLiteralDfa0_0(); if (jjmatchedKind != 0x7fffffff) { - if (jjmatchedPos + 1 < curPos) + if (jjmatchedPos + 1 < curPos) { input_stream.backup(curPos - jjmatchedPos - 1); + } if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); @@ -732,8 +791,9 @@ public Token getNextToken() error_line++; error_column = 0; } - else + else { error_column++; + } } if (!EOFSeen) { input_stream.backup(1);
