Skip to content

Commit

Permalink
Fixed checkstyle errors in classes representing viewModel elemements.
Browse files Browse the repository at this point in the history
  • Loading branch information
kassandraveress committed Jan 13, 2024
1 parent 18cdf94 commit e5e1497
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public AbstractViewModelElement(T target) {
this.target = target;
}

abstract public void updateTarget();
public abstract void updateTarget();
}
40 changes: 20 additions & 20 deletions src/main/java/org/gecko/viewmodel/BlockViewModelElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ private void resize(Point2D delta) {
// Moves bottom-right corner with delta.
Point2D currentSizeValue = super.getSize().getValue();

double newXCoordinate = currentSizeValue.getX() + delta.getX();
double newYCoordinate = currentSizeValue.getY() + delta.getY();
Point2D newSize = new Point2D(newXCoordinate, newYCoordinate);
double xCoordinate = currentSizeValue.getX() + delta.getX();
double yCoordinate = currentSizeValue.getY() + delta.getY();
Point2D newSize = new Point2D(xCoordinate, yCoordinate);

super.setSize(new SimpleObjectProperty<>(newSize));
}
Expand All @@ -42,16 +42,16 @@ public void move(Point2D delta) {
Point2D currentSizeValue = super.getSize().getValue();

// Update top-left corner's position:
double newXCoordinate = currentPositionValue.getX() + delta.getX();
double newYCoordinate = currentPositionValue.getY() + delta.getY();
Point2D newPosition = new Point2D(newXCoordinate, newYCoordinate);
double xCoordinate = currentPositionValue.getX() + delta.getX();
double yCoordinate = currentPositionValue.getY() + delta.getY();
Point2D newPosition = new Point2D(xCoordinate, yCoordinate);

super.setPosition(new SimpleObjectProperty<>(newPosition));

// Update bottom-right corner's position:
newXCoordinate = currentSizeValue.getX() + delta.getX();
newYCoordinate = currentSizeValue.getY() + delta.getY();
newPosition = new Point2D(newXCoordinate, newYCoordinate);
xCoordinate = currentSizeValue.getX() + delta.getX();
yCoordinate = currentSizeValue.getY() + delta.getY();
newPosition = new Point2D(xCoordinate, yCoordinate);

super.setSize(new SimpleObjectProperty<>(newPosition));
}
Expand All @@ -74,21 +74,21 @@ public void scale(Point2D startPoint, Point2D delta) {
Point2D newPosition = currentPositionValue;
Point2D newSize = currentSizeValue;

double newXCoordinate;
double newYCoordinate;
double xCoordinate;
double yCoordinate;

if (startPoint.equals(topRightCorner)) {
newYCoordinate = currentPositionValue.getY() + delta.getY();
newPosition = new Point2D(currentPositionValue.getX(), newYCoordinate);
yCoordinate = currentPositionValue.getY() + delta.getY();
newPosition = new Point2D(currentPositionValue.getX(), yCoordinate);

newXCoordinate = currentSizeValue.getX() + delta.getX();
newSize = new Point2D(newXCoordinate, currentSizeValue.getY());
} else if (startPoint.equals(bottomLeftCorner)){
newXCoordinate = currentPositionValue.getX() + delta.getX();
newPosition = new Point2D(newXCoordinate, currentPositionValue.getY());
xCoordinate = currentSizeValue.getX() + delta.getX();
newSize = new Point2D(xCoordinate, currentSizeValue.getY());
} else if (startPoint.equals(bottomLeftCorner)) {
xCoordinate = currentPositionValue.getX() + delta.getX();
newPosition = new Point2D(xCoordinate, currentPositionValue.getY());

newYCoordinate = currentSizeValue.getY() + delta.getY();
newSize = new Point2D(currentSizeValue.getX(), newYCoordinate);
yCoordinate = currentSizeValue.getY() + delta.getY();
newSize = new Point2D(currentSizeValue.getX(), yCoordinate);
}

super.setPosition(new SimpleObjectProperty<>(newPosition));
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/gecko/viewmodel/ContractViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import org.gecko.model.Condition;
import org.gecko.model.Contract;

import java.io.IOException;

public class ContractViewModel extends AbstractViewModelElement<Contract> implements Renamable {
private StringProperty name;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/gecko/viewmodel/EdgeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import org.gecko.model.Edge;
import org.gecko.model.Kind;

@Setter @Getter
@Setter
@Getter
public class EdgeViewModel extends PositionableViewModelElement<Edge> {
private Property<Kind> kind;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/gecko/viewmodel/PortViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import org.gecko.model.Variable;
import org.gecko.model.Visibility;

@Setter @Getter
@Setter
@Getter
public class PortViewModel extends BlockViewModelElement<Variable> {
private Property<Visibility> visibility;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import lombok.Setter;
import org.gecko.model.Element;

@Getter @Setter
@Getter
@Setter
public abstract class PositionableViewModelElement<T extends Element> extends AbstractViewModelElement<T> {
private Property<Point2D> position;
private Property<Point2D> size;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/gecko/viewmodel/RegionViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.paint.Color;
import lombok.Getter;
import lombok.Setter;
import javafx.scene.paint.Color;
import org.gecko.model.Condition;
import org.gecko.model.Region;
import javafx.collections.FXCollections;

import java.util.Random;

@Getter @Setter
@Setter
@Getter
public class RegionViewModel extends BlockViewModelElement<Region> {
private Property<Color> color;
private ContractViewModel contract;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/gecko/viewmodel/Renamable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

public interface Renamable {
String getName();

void setName(String name);
}
3 changes: 2 additions & 1 deletion src/main/java/org/gecko/viewmodel/StateViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import lombok.Setter;
import org.gecko.model.State;

@Getter @Setter
@Setter
@Getter
public class StateViewModel extends BlockViewModelElement<State> {
private BooleanProperty isStartState;
private ObservableList<ContractViewModel> contracts;
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/gecko/viewmodel/SystemViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import lombok.Setter;
import org.gecko.model.System;

@Getter @Setter
@Getter
@Setter
public class SystemViewModel extends BlockViewModelElement<System> {
private StringProperty code;
private ObservableList<PortViewModel> ports;
private StringProperty code;
private ObservableList<PortViewModel> ports;

public SystemViewModel(System target) {
super(target);
Expand Down

0 comments on commit e5e1497

Please sign in to comment.