Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e716c59
commit 2d3c430
Showing
16 changed files
with
312 additions
and
291 deletions.
There are no files selected for viewing
66 changes: 0 additions & 66 deletions
66
src/main/java/net/fortuna/ical4j/filter/DateInRangeRule.java
This file was deleted.
Oops, something went wrong.
70 changes: 0 additions & 70 deletions
70
src/main/java/net/fortuna/ical4j/filter/ParameterEqualToRule.java
This file was deleted.
Oops, something went wrong.
82 changes: 0 additions & 82 deletions
82
src/main/java/net/fortuna/ical4j/filter/PropertyEqualToRule.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/main/java/net/fortuna/ical4j/filter/PropertyInRule.java
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
src/main/java/net/fortuna/ical4j/filter/predicate/DateInRangeRule.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,42 @@ | ||
/* | ||
* Copyright (c) 2012-2021. Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. | ||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. | ||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. | ||
* Vestibulum commodo. Ut rhoncus gravida arcu. | ||
*/ | ||
package net.fortuna.ical4j.filter.predicate; | ||
|
||
import net.fortuna.ical4j.model.DateRange; | ||
|
||
import java.util.Date; | ||
import java.util.function.Predicate; | ||
|
||
/** | ||
* @author fortuna | ||
* | ||
*/ | ||
public class DateInRangeRule implements Predicate<Date> { | ||
|
||
private final DateRange range; | ||
|
||
private final int inclusiveMask; | ||
|
||
/** | ||
* @param range the range to check | ||
* @param inclusiveMask indicates inclusiveness of start and end of the range | ||
*/ | ||
public DateInRangeRule(DateRange range, int inclusiveMask) { | ||
this.range = range; | ||
this.inclusiveMask = inclusiveMask; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public boolean test(Date date) { | ||
return range.includes(date, inclusiveMask); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/net/fortuna/ical4j/filter/predicate/ParameterEqualToRule.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,46 @@ | ||
/* | ||
* Copyright (c) 2012-2021. Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. | ||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. | ||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. | ||
* Vestibulum commodo. Ut rhoncus gravida arcu. | ||
*/ | ||
package net.fortuna.ical4j.filter.predicate; | ||
|
||
import net.fortuna.ical4j.model.Parameter; | ||
import net.fortuna.ical4j.model.ParameterList; | ||
import net.fortuna.ical4j.model.Property; | ||
|
||
import java.util.function.Predicate; | ||
|
||
/** | ||
* $Id$ | ||
* | ||
* Created on 5/02/2006 | ||
* | ||
* A rule that matches any component containing the specified property. Note that this rule ignores any parameters | ||
* matching only on the value of the property. | ||
* @author Ben Fortuna | ||
*/ | ||
public class ParameterEqualToRule<T extends Property> implements Predicate<T> { | ||
|
||
private final String parameterName; | ||
|
||
private final Object value; | ||
|
||
public ParameterEqualToRule(String parameterName, Object value) { | ||
this.parameterName = parameterName; | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public final boolean test(final Property property) { | ||
final ParameterList parameters = property.getParameters(parameterName); | ||
for (final Parameter p : parameters) { | ||
if (value.equals(p.getValue())) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/net/fortuna/ical4j/filter/predicate/ParameterExistsRule.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,34 @@ | ||
/* | ||
* Copyright (c) 2021. Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. | ||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. | ||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. | ||
* Vestibulum commodo. Ut rhoncus gravida arcu. | ||
*/ | ||
|
||
package net.fortuna.ical4j.filter.predicate; | ||
|
||
import net.fortuna.ical4j.model.Property; | ||
|
||
import java.util.function.Predicate; | ||
|
||
/** | ||
* Test for a parameter matching the provided name. | ||
*/ | ||
public class ParameterExistsRule implements Predicate<Property> { | ||
|
||
private final String parameterName; | ||
|
||
public ParameterExistsRule(String parameterName) { | ||
this.parameterName = parameterName; | ||
} | ||
|
||
@Override | ||
public boolean test(Property t) { | ||
String[] param = parameterName.split(":"); | ||
if (param.length > 1) { | ||
return new ParameterEqualToRule<>(param[0], param[1]).test(t); | ||
} | ||
return !t.getParameters(parameterName).isEmpty(); | ||
} | ||
} |
Oops, something went wrong.