Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Saad MAHBOUBI
TD-685
Commits
d153cf1c
Commit
d153cf1c
authored
Mar 13, 2021
by
Saad MAHBOUBI
💬
Browse files
restauration
parent
6cb7d95d
Pipeline
#27328
passed with stages
in 3 minutes and 29 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/unantes/l3/construction/events/Event.java
View file @
d153cf1c
package
fr.unantes.l3.construction.events
;
import
java.time.Period
;
import
org.checkerframework.checker.nullness.qual.NonNull
;
import
static
org
.
atlanmod
.
commons
.
Preconditions
.
checkNotNull
;
public
abstract
class
Event
{
pr
ivate
String
id
;
pr
ivate
Period
slot
;
pr
otected
String
id
;
pr
otected
Period
slot
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
public
void
setId
(
@NonNull
String
id
)
{
checkNotNull
(
id
);
this
.
id
=
id
;
}
public
void
setSlot
(
Period
slot
){
public
Period
getSlot
()
{
return
slot
;
}
public
void
setSlot
(
Period
slot
)
{
checkNotNull
(
slot
);
this
.
slot
=
slot
;
}
public
abstract
boolean
conflictsWith
(
Event
other
);
public
abstract
boolean
conflictsWithSingleEvent
(
SingleEvent
other
);
public
abstract
boolean
conflictsWithRecurrentEvent
(
RecurrentEvent
other
);
}
src/main/java/fr/unantes/l3/construction/events/Period.java
0 → 100644
View file @
d153cf1c
package
fr.unantes.l3.construction.events
;
import
fr.unantes.l3.construction.exercice10.Interval
;
import
java.util.Date
;
public
class
Period
extends
Interval
<
Date
>
{
public
Period
(
Date
begin
,
Date
end
)
{
super
(
begin
,
end
);
}
}
src/main/java/fr/unantes/l3/construction/events/RecurrentEvent.java
0 → 100644
View file @
d153cf1c
package
fr.unantes.l3.construction.events
;
import
java.util.Collection
;
import
java.util.LinkedList
;
public
class
RecurrentEvent
extends
Event
{
@Override
public
boolean
conflictsWith
(
Event
other
)
{
return
other
.
conflictsWithRecurrentEvent
(
this
);
}
@Override
public
boolean
conflictsWithSingleEvent
(
SingleEvent
other
)
{
for
(
Period
each:
this
.
occurrences
())
{
if
(
each
.
overlaps
(
other
.
slot
))
{
return
true
;
}
}
return
false
;
}
@Override
public
boolean
conflictsWithRecurrentEvent
(
RecurrentEvent
other
)
{
for
(
Period
each
:
this
.
occurrences
())
{
for
(
Period
period
:
other
.
occurrences
())
{
if
(
each
.
overlaps
(
period
))
{
return
true
;
}
}
}
return
false
;
}
private
Collection
<
Period
>
occurrences
()
{
Collection
<
Period
>
calculatedOcurrences
=
new
LinkedList
<>();
// TODO
return
calculatedOcurrences
;
}
}
src/main/java/fr/unantes/l3/construction/events/SingleEvent.java
0 → 100644
View file @
d153cf1c
package
fr.unantes.l3.construction.events
;
public
class
SingleEvent
extends
Event
{
@Override
public
boolean
conflictsWith
(
Event
other
)
{
return
other
.
conflictsWithSingleEvent
(
this
);
}
@Override
public
boolean
conflictsWithSingleEvent
(
SingleEvent
other
)
{
return
other
.
slot
.
overlaps
(
this
.
slot
);
}
@Override
public
boolean
conflictsWithRecurrentEvent
(
RecurrentEvent
other
)
{
return
false
;
}
}
src/main/java/fr/unantes/l3/construction/refactorings/ArrayList.java
0 → 100644
View file @
d153cf1c
package
fr.unantes.l3.construction.refactorings
;
public
class
ArrayList
{
private
Object
[]
elements
=
new
Object
[
10
];
private
boolean
readOnly
;
private
int
size
=
0
;
public
void
add
(
Object
child
)
{
if
(
readOnly
)
{
return
;
}
int
newSize
=
size
+
1
;
if
(
newSize
>
elements
.
length
)
{
Object
[]
newElements
=
new
Object
[
elements
.
length
+
10
];
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
newElements
[
i
]
=
elements
[
i
];
}
elements
=
newElements
;
}
elements
[
size
]
=
child
;
size
++;
}
public
void
setReadOnly
(
boolean
readOnly
)
{
this
.
readOnly
=
readOnly
;
}
public
boolean
isReadOnly
()
{
return
readOnly
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment