-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(): Add collection impacts, which reduce simple element impacts into typed collection impacts. It uses a collection threshold to compute. Note: DELETION type impacts are ignored for this computation Signed-off-by: sBouzols <[email protected]> Co-authored-by: Slimane AMAR <[email protected]>
- Loading branch information
Showing
22 changed files
with
470 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/org/gridsuite/modification/server/impacts/AbstractBaseImpact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
Copyright (c) 2024, All partners of the iTesla project (http://www.itesla-project.eu/consortium) | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package org.gridsuite.modification.server.impacts; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import com.powsybl.iidm.network.IdentifiableType; | ||
|
||
import lombok.*; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
/** | ||
* This class describes a base impact | ||
* This is the base type of all network impacts | ||
* | ||
* @author Sylvain Bouzols <sylvain.bouzols at rte-france.com> | ||
*/ | ||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.EXISTING_PROPERTY, | ||
property = "type", | ||
visible = true | ||
) | ||
@JsonSubTypes({ | ||
@JsonSubTypes.Type(value = SimpleElementImpact.class, name = "SIMPLE"), | ||
@JsonSubTypes.Type(value = CollectionElementImpact.class, name = "COLLECTION") | ||
}) | ||
@SuperBuilder | ||
@Data | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor | ||
public abstract class AbstractBaseImpact { | ||
|
||
|
||
public enum ImpactType { | ||
SIMPLE, | ||
COLLECTION | ||
} | ||
|
||
@Setter(AccessLevel.NONE) | ||
private ImpactType type; | ||
|
||
private IdentifiableType elementType; | ||
|
||
@JsonIgnore | ||
public abstract boolean isSimple(); | ||
|
||
@JsonIgnore | ||
public abstract boolean isCollection(); | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/org/gridsuite/modification/server/impacts/CollectionElementImpact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
Copyright (c) 2024, All partners of the iTesla project (http://www.itesla-project.eu/consortium) | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package org.gridsuite.modification.server.impacts; | ||
|
||
import lombok.*; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
/** | ||
* This class describes a collection type network impact | ||
* This type of network impact describes an impact on multiple items of the same IdentifiableType | ||
* | ||
* @author Sylvain Bouzols <sylvain.bouzols at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@Data | ||
@ToString(callSuper = true) | ||
@NoArgsConstructor | ||
@EqualsAndHashCode(callSuper = true) | ||
public class CollectionElementImpact extends AbstractBaseImpact { | ||
@Override | ||
public ImpactType getType() { | ||
return ImpactType.COLLECTION; | ||
} | ||
|
||
public boolean isSimple() { | ||
return false; | ||
} | ||
|
||
public boolean isCollection() { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.