Function bodies 391 total
setCylinderCount method · java · L53-L56 (4 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public void setCylinderCount(int cylinderCount) {
if (cylinderCount < 1) throw new IllegalArgumentException("cylinderCount must be > 0");
this.cylinderCount = cylinderCount;
}setConfiguration method · java · L58-L60 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public void setConfiguration(String configuration) {
this.configuration = requireNonBlank(configuration, "configuration");
}setSystemPowerKw method · java · L62-L65 (4 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public void setSystemPowerKw(int systemPowerKw) {
if (systemPowerKw < 1) throw new IllegalArgumentException("systemPowerKw must be > 0");
this.systemPowerKw = systemPowerKw;
}powerHp method · java · L67-L69 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public int powerHp() {
return (int) Math.round(powerKw * 1.35962);
}id method · java · L71-L73 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public EngineId id() {
return id;
}code method · java · L75-L77 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public String code() {
return code;
}name method · java · L79-L81 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public String name() {
return name;
}Repobility · severity-and-effort ranking · https://repobility.com
fuelType method · java · L83-L85 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public FuelType fuelType() {
return fuelType;
}displacementCc method · java · L87-L89 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public int displacementCc() {
return displacementCc;
}powerKw method · java · L91-L93 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public int powerKw() {
return powerKw;
}torqueNm method · java · L95-L97 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public int torqueNm() {
return torqueNm;
}cylinderCount method · java · L99-L101 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public Integer cylinderCount() {
return cylinderCount;
}configuration method · java · L103-L105 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public String configuration() {
return configuration;
}systemPowerKw method · java · L107-L109 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public Integer systemPowerKw() {
return systemPowerKw;
}validate method · java · L111-L115 (5 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
private static void validate(int cc, int kw, int nm) {
if (cc <= 0) throw new IllegalArgumentException("displacement must be > 0");
if (kw <= 0) throw new IllegalArgumentException("power must be > 0");
if (nm <= 0) throw new IllegalArgumentException("torque must be > 0");
}Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
requireNonBlank method · java · L117-L121 (5 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
private static String requireNonBlank(String v, String field) {
if (v == null || v.isBlank())
throw new IllegalArgumentException(field + " must not be blank");
return v.strip();
}GenerationId function · java · L6-L18 (13 LOC)src/main/java/live/yurii/autocatalog/domain/generation/GenerationId.java
public record GenerationId(UUID value) {
public GenerationId {
Objects.requireNonNull(value, "GenerationId value must not be null");
}
public static GenerationId generate() {
return new GenerationId(UUID.randomUUID());
}
public static GenerationId of(String value) {
return new GenerationId(UUID.fromString(value));
}
}GenerationId class · java · L6-L18 (13 LOC)src/main/java/live/yurii/autocatalog/domain/generation/GenerationId.java
public record GenerationId(UUID value) {
public GenerationId {
Objects.requireNonNull(value, "GenerationId value must not be null");
}
public static GenerationId generate() {
return new GenerationId(UUID.randomUUID());
}
public static GenerationId of(String value) {
return new GenerationId(UUID.fromString(value));
}
}generate method · java · L11-L13 (3 LOC)src/main/java/live/yurii/autocatalog/domain/generation/GenerationId.java
public static GenerationId generate() {
return new GenerationId(UUID.randomUUID());
}of method · java · L15-L17 (3 LOC)src/main/java/live/yurii/autocatalog/domain/generation/GenerationId.java
public static GenerationId of(String value) {
return new GenerationId(UUID.fromString(value));
}Generation class · java · L8-L64 (57 LOC)src/main/java/live/yurii/autocatalog/domain/generation/Generation.java
public class Generation {
private GenerationId id;
private ModelId modelId;
private String name;
private YearRange years;
private Generation() {
}
public static Generation create(ModelId modelId, String name, YearRange years) {
var g = new Generation();
g.id = GenerationId.generate();
g.modelId = Objects.requireNonNull(modelId);
g.name = requireNonBlank(name, "name");
g.years = Objects.requireNonNull(years);
return g;
}
public static Generation reconstitute(GenerationId id, ModelId modelId,
String name, YearRange years) {
var g = new Generation();
g.id = id;
g.modelId = modelId;
g.name = name;
g.years = years;
return g;
}
public void close(int year) {
if (year < years.from())
throw new IllegalArgumentException("Close year cannot be before start year");
this.years = new YearRange(years.from(), year);
}
public GenerationId id() {
return id;
}
publcreate method · java · L18-L25 (8 LOC)src/main/java/live/yurii/autocatalog/domain/generation/Generation.java
public static Generation create(ModelId modelId, String name, YearRange years) {
var g = new Generation();
g.id = GenerationId.generate();
g.modelId = Objects.requireNonNull(modelId);
g.name = requireNonBlank(name, "name");
g.years = Objects.requireNonNull(years);
return g;
}reconstitute method · java · L27-L35 (9 LOC)src/main/java/live/yurii/autocatalog/domain/generation/Generation.java
public static Generation reconstitute(GenerationId id, ModelId modelId,
String name, YearRange years) {
var g = new Generation();
g.id = id;
g.modelId = modelId;
g.name = name;
g.years = years;
return g;
}Repobility · open methodology · https://repobility.com/research/
close method · java · L37-L41 (5 LOC)src/main/java/live/yurii/autocatalog/domain/generation/Generation.java
public void close(int year) {
if (year < years.from())
throw new IllegalArgumentException("Close year cannot be before start year");
this.years = new YearRange(years.from(), year);
}id method · java · L43-L45 (3 LOC)src/main/java/live/yurii/autocatalog/domain/generation/Generation.java
public GenerationId id() {
return id;
}modelId method · java · L47-L49 (3 LOC)src/main/java/live/yurii/autocatalog/domain/generation/Generation.java
public ModelId modelId() {
return modelId;
}name method · java · L51-L53 (3 LOC)src/main/java/live/yurii/autocatalog/domain/generation/Generation.java
public String name() {
return name;
}years method · java · L55-L57 (3 LOC)src/main/java/live/yurii/autocatalog/domain/generation/Generation.java
public YearRange years() {
return years;
}requireNonBlank method · java · L59-L63 (5 LOC)src/main/java/live/yurii/autocatalog/domain/generation/Generation.java
private static String requireNonBlank(String v, String field) {
if (v == null || v.isBlank())
throw new IllegalArgumentException(field + " must not be blank");
return v.strip();
}MakeId class · java · L6-L18 (13 LOC)src/main/java/live/yurii/autocatalog/domain/make/MakeId.java
public record MakeId(UUID value) {
public MakeId {
Objects.requireNonNull(value, "MakeId value must not be null");
}
public static MakeId generate() {
return new MakeId(UUID.randomUUID());
}
public static MakeId of(String value) {
return new MakeId(UUID.fromString(value));
}
}MakeId function · java · L6-L18 (13 LOC)src/main/java/live/yurii/autocatalog/domain/make/MakeId.java
public record MakeId(UUID value) {
public MakeId {
Objects.requireNonNull(value, "MakeId value must not be null");
}
public static MakeId generate() {
return new MakeId(UUID.randomUUID());
}
public static MakeId of(String value) {
return new MakeId(UUID.fromString(value));
}
}Open data scored by Repobility · https://repobility.com
generate method · java · L11-L13 (3 LOC)src/main/java/live/yurii/autocatalog/domain/make/MakeId.java
public static MakeId generate() {
return new MakeId(UUID.randomUUID());
}of method · java · L15-L17 (3 LOC)src/main/java/live/yurii/autocatalog/domain/make/MakeId.java
public static MakeId of(String value) {
return new MakeId(UUID.fromString(value));
}Make class · java · L3-L61 (59 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
public class Make {
private MakeId id;
private String name;
private String country;
private String slug;
private Make() {
}
public static Make create(String name, String country) {
var make = new Make();
make.id = MakeId.generate();
make.name = requireNonBlank(name, "name");
make.country = requireNonBlank(country, "country");
make.slug = slugify(name);
return make;
}
public static Make reconstitute(MakeId id, String name, String country, String slug) {
var make = new Make();
make.id = id;
make.name = name;
make.country = country;
make.slug = slug;
return make;
}
public void rename(String newName) {
this.name = requireNonBlank(newName, "name");
this.slug = slugify(newName);
}
public MakeId id() {
return id;
}
public String name() {
return name;
}
public String country() {
return country;
}
public String slug() {
return slug;
}
private static String requireNonBlank(create method · java · L13-L20 (8 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
public static Make create(String name, String country) {
var make = new Make();
make.id = MakeId.generate();
make.name = requireNonBlank(name, "name");
make.country = requireNonBlank(country, "country");
make.slug = slugify(name);
return make;
}reconstitute method · java · L22-L29 (8 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
public static Make reconstitute(MakeId id, String name, String country, String slug) {
var make = new Make();
make.id = id;
make.name = name;
make.country = country;
make.slug = slug;
return make;
}rename method · java · L31-L34 (4 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
public void rename(String newName) {
this.name = requireNonBlank(newName, "name");
this.slug = slugify(newName);
}id method · java · L36-L38 (3 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
public MakeId id() {
return id;
}name method · java · L40-L42 (3 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
public String name() {
return name;
}Repobility · severity-and-effort ranking · https://repobility.com
country method · java · L44-L46 (3 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
public String country() {
return country;
}slug method · java · L48-L50 (3 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
public String slug() {
return slug;
}requireNonBlank method · java · L52-L56 (5 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
private static String requireNonBlank(String v, String field) {
if (v == null || v.isBlank())
throw new IllegalArgumentException(field + " must not be blank");
return v.strip();
}slugify method · java · L58-L60 (3 LOC)src/main/java/live/yurii/autocatalog/domain/make/Make.java
private static String slugify(String name) {
return name.strip().toLowerCase().replaceAll("[^a-z0-9]+", "-");
}CarModel class · java · L10-L78 (69 LOC)src/main/java/live/yurii/autocatalog/domain/model/CarModel.java
public class CarModel {
private final List<ModelRelation> relations = new ArrayList<>();
private ModelId id;
private MakeId makeId;
private String name;
private String slug;
private CarModel() {
}
public static CarModel create(MakeId makeId, String name) {
var m = new CarModel();
m.id = ModelId.generate();
m.makeId = Objects.requireNonNull(makeId);
m.name = requireNonBlank(name, "name");
m.slug = slugify(name);
return m;
}
public static CarModel reconstitute(ModelId id, MakeId makeId, String name, String slug) {
var m = new CarModel();
m.id = id;
m.makeId = makeId;
m.name = name;
m.slug = slug;
return m;
}
public void addRelation(ModelId targetId, ModelRelation.Type type, String note) {
if (targetId.equals(this.id))
throw new IllegalArgumentException("Model cannot relate to itself");
boolean duplicate = relations.stream()
.anyMatch(r -> r.targetModelId().equals(targetId) && r.type() == typecreate method · java · L21-L28 (8 LOC)src/main/java/live/yurii/autocatalog/domain/model/CarModel.java
public static CarModel create(MakeId makeId, String name) {
var m = new CarModel();
m.id = ModelId.generate();
m.makeId = Objects.requireNonNull(makeId);
m.name = requireNonBlank(name, "name");
m.slug = slugify(name);
return m;
}reconstitute method · java · L30-L37 (8 LOC)src/main/java/live/yurii/autocatalog/domain/model/CarModel.java
public static CarModel reconstitute(ModelId id, MakeId makeId, String name, String slug) {
var m = new CarModel();
m.id = id;
m.makeId = makeId;
m.name = name;
m.slug = slug;
return m;
}addRelation method · java · L39-L47 (9 LOC)src/main/java/live/yurii/autocatalog/domain/model/CarModel.java
public void addRelation(ModelId targetId, ModelRelation.Type type, String note) {
if (targetId.equals(this.id))
throw new IllegalArgumentException("Model cannot relate to itself");
boolean duplicate = relations.stream()
.anyMatch(r -> r.targetModelId().equals(targetId) && r.type() == type);
if (duplicate)
throw new IllegalStateException("Relation already exists");
relations.add(new ModelRelation(targetId, type, note));
}Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
id method · java · L49-L51 (3 LOC)src/main/java/live/yurii/autocatalog/domain/model/CarModel.java
public ModelId id() {
return id;
}makeId method · java · L53-L55 (3 LOC)src/main/java/live/yurii/autocatalog/domain/model/CarModel.java
public MakeId makeId() {
return makeId;
}name method · java · L57-L59 (3 LOC)src/main/java/live/yurii/autocatalog/domain/model/CarModel.java
public String name() {
return name;
}