Skip to content

Commit

Permalink
JavaDoc improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
kno10 committed Sep 14, 2023
1 parent dc677b6 commit df83bd2
Show file tree
Hide file tree
Showing 115 changed files with 1,046 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ public static Filter handleURL(ParsedURL url) {
private static class InternalParsedURLData extends ParsedURLData {
/**
* Constructor.
*
* @param id ID string
*/
public InternalParsedURLData(String id) {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ protected synchronized void updateVisualizerMenus() {
menubar.repaint();
}

/**
* Build the menu bar
*
* @param items Menu items collection
* @param r Root object
* @param vistree Visualization tree
* @param proj Projection
*/
private void recursiveBuildMenu(Collection<JMenuItem> items, Object r, Hierarchy<Object> vistree, Projection proj) {
// Make a submenu for this element
final String nam;
Expand Down Expand Up @@ -289,6 +297,12 @@ private void recursiveBuildMenu(Collection<JMenuItem> items, Object r, Hierarchy
items.add(submenu);
}

/**
* Make a menu item for a visualizer.
*
* @param r Visualizer
* @return Menu item
*/
private JMenuItem makeMenuItemForVisualizer(Object r) {
if(r instanceof VisualizationMenuAction) {
final VisualizationMenuAction action = (VisualizationMenuAction) r;
Expand Down Expand Up @@ -365,6 +379,9 @@ public void enableWriter(boolean b) {
}
}

/**
* Menu bar
*/
private DynamicMenu menubar;

/**
Expand Down Expand Up @@ -517,7 +534,7 @@ public void showOverview() {
/**
* Navigate to a subplot.
*
* @param e
* @param e Event
*/
protected void showSubplot(DetailViewSelectedEvent e) {
if(!single) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ private void initializePlot() {
* @param it Plot item
* @param task Task
* @param parent Parent element to draw to
* @return Visualization
*/
private Visualization embedOrThumbnail(final int thumbsize, PlotItem it, VisualizationTask task, Element parent) {
final Visualization vis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,19 @@ public String toString() {
* @author Erich Schubert
*/
private static class ItmItr implements Iterator<PlotItem> {
/** Next item to return */
PlotItem next;

/** Current iterator */
Iterator<PlotItem> cur;

/** Subitem iterator */
Iterator<PlotItem> sub;

/**
* Constructor.
*
* @param start Start item
*/
public ItmItr(PlotItem start) {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class RectangleArranger<T> {
/**
* Constructor.
*
* @param ratio
* @param ratio Window ratio
*/
public RectangleArranger(double ratio) {
this(ratio, 1.0);
Expand Down Expand Up @@ -289,11 +289,24 @@ public void put(double w, double h, T data) {
}
}

/**
* Compute the area increase of a change.
*
* @param winc Width increase
* @param hinc Height increase
* @return Area increase
*/
protected double computeIncreaseArea(double winc, double hinc) {
double inc = Math.max(winc, hinc * ratio);
return inc * (hinc + inc / ratio + winc / ratio);
}

/**
* Split a row.
*
* @param bestey Row index
* @param besthi Row height to split off
*/
protected void splitRow(int bestey, double besthi) {
assert (bestey < heights.size());
if(heights.get(bestey) - besthi <= Double.MIN_NORMAL) {
Expand All @@ -308,6 +321,12 @@ protected void splitRow(int bestey, double besthi) {
usage.add(bestey + 1, new ArrayList<>(usage.get(bestey)));
}

/**
* Split a column.
*
* @param bestex Column id
* @param bestwi Width to split off
*/
protected void splitCol(int bestex, double bestwi) {
assert (bestex < widths.size());
if(widths.get(bestex) - bestwi <= Double.MIN_NORMAL) {
Expand All @@ -326,6 +345,11 @@ protected void splitCol(int bestex, double bestwi) {
assert assertConsistent();
}

/**
* Resize the canvas by an increment.
*
* @param inc Increment to add to the x axis
*/
private void resize(double inc) {
final int cols = widths.size(), rows = heights.size();
if(LOG.isDebuggingFine()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ public LinearScale getAxisScale(int axis) {
return scales[dimOrder[axis]];
}

/**
* Check if a dimension is hidden
*
* @param truedim Original dimension (not display offset)
* @return {@code true} if hidden
*/
protected boolean isDimHidden(int truedim) {
return (flags[truedim] & FLAG_HIDDEN) == FLAG_HIDDEN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public void processNewResult(VisualizerContext context, Object start) {
});
}

/**
* Get the dimensionality of a relation.
*
* @param rel Relation
* @return Dimensionality
*/
private int dimensionality(Relation<?> rel) {
if(TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) {
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public PrettyMarkers(StyleLibrary style) {
* @param y position
* @param style marker style (enumerated)
* @param size size
* @param intensity intensity
* @return container element
*/
public Element plotMarker(SVGPlot plot, double x, double y, int style, double size, double intensity) {
Expand Down Expand Up @@ -264,6 +265,7 @@ public Element plotMarker(SVGPlot plot, double x, double y, int style, double si
* @param y Y position
* @param size Size
* @param color Color string
* @return SVG element
*/
protected Element plotSimple(SVGPlot plot, double x, double y, double size, String color) {
Element marker = plot.svgCircle(x, y, size * .5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ public Instance(VisualizerContext context, VisualizationTask task, Visualization
addListeners();
}

/**
* Toggle showing the unclustered pairs
*
* @param show Show unclusered pairs
*/
public void toggleUnclusteredPairs(boolean show) {
noIncrementalRedraw = true;
showUnclusteredPairs = show;
Expand Down Expand Up @@ -313,6 +318,8 @@ public void fullRedraw() {

/**
* Define and add required CSS classes
*
* @param maxClusterSize Maximum number of clusters
*/
protected void addCSSClasses(int maxClusterSize) {
StyleLibrary style = context.getStyleLibrary();
Expand Down Expand Up @@ -477,6 +484,9 @@ private void drawSegments() {
}
}

/**
* Redraw the current selection
*/
private void redrawSelection() {
final StyleLibrary style = context.getStyleLibrary();
LOG.debug("Updating selection only.");
Expand Down Expand Up @@ -551,6 +561,11 @@ protected String[] makeGradient(int shades, String[] colors) {
return colorShades;
}

/**
* Draw the clustering information
*
* @return SVG element
*/
protected Element drawClusteringInfo() {
Element thumbnail = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG);

Expand All @@ -577,6 +592,13 @@ protected Element drawClusteringInfo() {
return thumbnail;
}

/**
* Hover handling for segments.
*
* @param segment Segment
* @param ringid Ring ID (depth)
* @param active Activate or deactivate hover
*/
protected void segmentHover(Segment segment, int ringid, boolean active) {
if(active) {
// abort if this are the unclustered pairs
Expand Down Expand Up @@ -627,6 +649,13 @@ protected void segmentHover(Segment segment, int ringid, boolean active) {
}
}

/**
* Click handler for a segment.
*
* @param segment Segment clicked
* @param evt Click event
* @param dblClick Double click?
*/
protected void segmentClick(Segment segment, Event evt, boolean dblClick) {
MouseEvent mouse = (MouseEvent) evt;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void fullRedraw() {
super.fullRedraw();
addCSSClasses(svgp);
E root = tree.getRootEntry();
visualizeRTreeEntry(svgp, layer, proj, tree, root, 0, 0);
visualizeRTreeEntry(svgp, layer, proj, tree, root, 0);
}

/**
Expand Down Expand Up @@ -186,7 +186,7 @@ private void addCSSClasses(SVGPlot svgp) {
* @param entry Current entry
* @param depth Current depth
*/
private void visualizeRTreeEntry(SVGPlot svgp, Element layer, ProjectionParallel proj, AbstractRStarTree<? extends N, E, ?> rtree, E entry, int depth, int step) {
private void visualizeRTreeEntry(SVGPlot svgp, Element layer, ProjectionParallel proj, AbstractRStarTree<? extends N, E, ?> rtree, E entry, int depth) {
final int dim = proj.getVisibleDimensions();
double[] min = proj.fastProjectDataToRenderSpace(SpatialUtil.getMin(entry));
double[] max = proj.fastProjectDataToRenderSpace(SpatialUtil.getMax(entry));
Expand All @@ -207,7 +207,7 @@ private void visualizeRTreeEntry(SVGPlot svgp, Element layer, ProjectionParallel
for(int i = 0; i < node.getNumEntries(); i++) {
E child = node.getEntry(i);
if(!(child instanceof LeafEntry)) {
visualizeRTreeEntry(svgp, layer, proj, rtree, child, depth + 1, ++step);
visualizeRTreeEntry(svgp, layer, proj, rtree, child, depth + 1);
}
}
}
Expand All @@ -221,6 +221,7 @@ private void visualizeRTreeEntry(SVGPlot svgp, Element layer, ProjectionParallel
* @author Erich Schubert
*/
public static class Par implements Parameterizer {
/** Fill areas */
protected boolean fill = true;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ private void deleteChildren(Element container) {
* @param x2 max x-value
* @param y1 min y-value
* @param y2 max y-value
* @param ranges HyperBoundingBox for the selected ranges
*/
private void updateSelectionRectKoordinates(double x1, double x2, double y1, double y2, ModifiableHyperBoundingBox ranges) {
final int dims = proj.getVisibleDimensions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public void processNewResult(VisualizerContext context, Object start) {
/**
* Compute the size of the clustering.
*
* @param <M> Model type
* @param c Clustering
* @return Array storing the depth and the number of leaf nodes.
*/
Expand All @@ -103,6 +104,7 @@ protected static <M extends Model> int[] findDepth(Clustering<M> c) {
/**
* Recursive depth computation.
*
* @param <M> Model type
* @param hier Hierarchy
* @param cluster Current cluster
* @param size Counting array.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ public DBIDs getNeighbors(DBIDRef reference) {
return resultList;
}

/**
* Check a pair of samples.
*
* @param o1 First object
* @param o2 Second object
* @return {@code true} if close
*/
private boolean checkSamples(UncertainObject o1, UncertainObject o2) {
final SquaredEuclideanDistance distance = SquaredEuclideanDistance.STATIC;
// Optimization for discrete objects:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ public ClassLabel classify(O instance) {
return bestl;
}

/**
* Class probabilities
*
* @param instance Object to classify
* @param labels Labels to classify into
* @return Class probabilities
*/
public double[] classProbabilities(O instance, ArrayList<ClassLabel> labels) {
int[] occurences = new int[labels.size()];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ public PriorProbabilityClassifier() {
super();
}

/**
* Learns the prior probability for all classes.
*/
@Override
public void buildClassifier(Database database, Relation<? extends ClassLabel> labelrep) {
Object2IntOpenHashMap<ClassLabel> count = new Object2IntOpenHashMap<>();
Expand All @@ -92,6 +89,13 @@ public void buildClassifier(Database database, Relation<? extends ClassLabel> la
}
}

/**
* Class probabilities.
*
* @param instance Instance to classify
* @param labels Labels to classify into
* @return Probabilities
*/
public double[] classProbabilities(Object instance, ArrayList<ClassLabel> labels) {
return alignLabels(this.labels, distribution, labels);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@
*/
public class StratifiedCrossValidation extends AbstractHoldout {
/**
* Holds the number of folds, current fold.
* Holds the number of folds
*/
protected int nfold, fold;
protected int nfold;

/**
* Current fold
*/
protected int fold;

/**
* Partition assignment, sizes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public class TrainingAndTestSet {
/**
* Provides a pair of training and test data sets out of the given two
* databases.
*
* @param training the training data set
* @param test the test data set
* @param labels union of all labels present in training and test
*/
public TrainingAndTestSet(MultipleObjectsBundle training, MultipleObjectsBundle test, ArrayList<ClassLabel> labels) {
this.training = training;
Expand Down
Loading

0 comments on commit df83bd2

Please sign in to comment.