Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Commit

Permalink
various changes over the past few months
Browse files Browse the repository at this point in the history
  • Loading branch information
kashike committed Jan 27, 2020
1 parent 94b508f commit 5334373
Show file tree
Hide file tree
Showing 24 changed files with 113 additions and 186 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repositories {
}

dependencies {
api 'net.kyori:component:1.0.0-SNAPSHOT'
api 'net.kyori:feature:1.0.0-SNAPSHOT'
api 'net.kyori:examination-api:1.0.0-SNAPSHOT'
api 'org.checkerframework:checker-qual:2.8.2'
testImplementation 'com.google.guava:guava-testlib:28.0-jre'
Expand Down Expand Up @@ -60,6 +60,7 @@ publishing {

pom {
name = project.name
url = 'https://github.com/KyoriPowered/filter'
description = project.description

developers {
Expand Down Expand Up @@ -91,6 +92,6 @@ publishing {
}

signing {
required { project.hasProperty('signing.keyId') && gradle.taskGraph.hasTask(':publish') && project.version.endsWith('-SNAPSHOT') }
required { project.hasProperty('signing.keyId') && gradle.taskGraph.hasTask(':publish') && !project.version.endsWith('-SNAPSHOT') }
sign publishing.publications.maven
}
2 changes: 1 addition & 1 deletion header.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This file is part of filter, licensed under the MIT License.

Copyright (c) 2018-2019 KyoriPowered
Copyright (c) 2018-2020 KyoriPowered

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018-2019 KyoriPowered
Copyright (c) 2018-2020 KyoriPowered

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/kyori/filter/AllFilter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -30,11 +30,12 @@
* A filter that responds with {@link FilterResponse#ALLOW} if all of its children also respond with {@link FilterResponse#ALLOW}.
*/
public final class AllFilter extends MultiFilter {
protected AllFilter(final @NonNull Iterable<? extends Filter> filters) {
AllFilter(final @NonNull Iterable<? extends Filter> filters) {
super(filters);
}

@Override
@SuppressWarnings("ForLoopReplaceableByForEach")
public @NonNull FilterResponse query(final @NonNull FilterQuery query) {
FilterResponse response = FilterResponse.ABSTAIN;
final List<? extends Filter> filters = this.filters;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/kyori/filter/AnyFilter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -30,11 +30,12 @@
* A filter that responds with {@link FilterResponse#ALLOW} if any of its children respond with {@link FilterResponse#ALLOW}.
*/
public final class AnyFilter extends MultiFilter {
protected AnyFilter(final @NonNull Iterable<? extends Filter> filters) {
AnyFilter(final @NonNull Iterable<? extends Filter> filters) {
super(filters);
}

@Override
@SuppressWarnings("ForLoopReplaceableByForEach")
public @NonNull FilterResponse query(final @NonNull FilterQuery query) {
FilterResponse response = FilterResponse.ABSTAIN;
final List<? extends Filter> filters = this.filters;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/kyori/filter/Filter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,13 +23,13 @@
*/
package net.kyori.filter;

import net.kyori.component.Component;
import net.kyori.feature.Feature;
import org.checkerframework.checker.nullness.qual.NonNull;

/**
* A filter.
*/
public interface Filter extends Component {
public interface Filter extends Feature {
/**
* Query this filter for a response.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/kyori/filter/FilterQuery.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/kyori/filter/FilterResponse.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/kyori/filter/Filters.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/kyori/filter/MultiFilter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -27,9 +27,9 @@
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
import net.kyori.component.Component;
import net.kyori.examination.Examinable;
import net.kyori.examination.ExaminableProperty;
import net.kyori.feature.Feature;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

Expand All @@ -51,7 +51,7 @@ protected MultiFilter(final @NonNull Iterable<? extends Filter> filters) {
}

@Override
public @NonNull Stream<? extends Component> dependencies() {
public @NonNull Stream<? extends Feature> dependencies() {
return this.filters.stream();
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/kyori/filter/NotFilter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/kyori/filter/SingleFilter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,9 +25,9 @@

import java.util.Objects;
import java.util.stream.Stream;
import net.kyori.component.Component;
import net.kyori.examination.Examinable;
import net.kyori.examination.ExaminableProperty;
import net.kyori.feature.Feature;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

Expand All @@ -42,7 +42,7 @@ protected SingleFilter(final @NonNull Filter filter) {
}

@Override
public @NonNull Stream<? extends Component> dependencies() {
public @NonNull Stream<? extends Feature> dependencies() {
return Stream.of(this.filter);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/kyori/filter/StaticFilter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -47,7 +47,7 @@ public final class StaticFilter implements Examinable, Filter {
static final StaticFilter DENY = new StaticFilter(FilterResponse.DENY);
private final FilterResponse response;

protected StaticFilter(final @NonNull FilterResponse response) {
private StaticFilter(final @NonNull FilterResponse response) {
this.response = response;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/kyori/filter/TypedFilter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 3 additions & 5 deletions src/test/java/net/kyori/filter/AllFilterTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,8 +24,6 @@
package net.kyori.filter;

import com.google.common.testing.EqualsTester;
import net.kyori.filter.data.TestFilter;
import net.kyori.filter.data.TestQuery1;
import org.junit.jupiter.api.Test;

import static com.google.common.truth.Truth8.assertThat;
Expand All @@ -34,8 +32,8 @@
class AllFilterTest {
@Test
void testQuery() {
assertTrue(Filters.all(new TestFilter(10), new TestFilter(10)).allows(TestQuery1.of(10)));
assertTrue(Filters.all(new TestFilter(10), new TestFilter(20)).denies(TestQuery1.of(10)));
assertTrue(Filters.all(new TestFilter(10), new TestFilter(10)).allows(TestFilter.Query.of(10)));
assertTrue(Filters.all(new TestFilter(10), new TestFilter(20)).denies(TestFilter.Query.of(10)));
}

@Test
Expand Down
10 changes: 4 additions & 6 deletions src/test/java/net/kyori/filter/AnyFilterTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,8 +24,6 @@
package net.kyori.filter;

import com.google.common.testing.EqualsTester;
import net.kyori.filter.data.TestFilter;
import net.kyori.filter.data.TestQuery1;
import org.junit.jupiter.api.Test;

import static com.google.common.truth.Truth8.assertThat;
Expand All @@ -35,9 +33,9 @@ class AnyFilterTest {
@Test
void testQuery() {
final AnyFilter filter = Filters.any(new TestFilter(10), new TestFilter(20));
assertTrue(filter.allows(TestQuery1.of(10)));
assertTrue(filter.denies(TestQuery1.of(15)));
assertTrue(filter.allows(TestQuery1.of(20)));
assertTrue(filter.allows(TestFilter.Query.of(10)));
assertTrue(filter.denies(TestFilter.Query.of(15)));
assertTrue(filter.allows(TestFilter.Query.of(20)));
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/net/kyori/filter/FilterResponseTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
58 changes: 0 additions & 58 deletions src/test/java/net/kyori/filter/FilterTest.java

This file was deleted.

10 changes: 4 additions & 6 deletions src/test/java/net/kyori/filter/NotFilterTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of filter, licensed under the MIT License.
*
* Copyright (c) 2018-2019 KyoriPowered
* Copyright (c) 2018-2020 KyoriPowered
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,8 +24,6 @@
package net.kyori.filter;

import com.google.common.testing.EqualsTester;
import net.kyori.filter.data.TestFilter;
import net.kyori.filter.data.TestQuery1;
import org.junit.jupiter.api.Test;

import static com.google.common.truth.Truth8.assertThat;
Expand All @@ -35,9 +33,9 @@ class NotFilterTest {
@Test
void testQuery() {
final Filter filter = Filters.not(new TestFilter(20));
assertTrue(filter.allows(TestQuery1.of(10)));
assertTrue(filter.allows(TestQuery1.of(15)));
assertTrue(filter.denies(TestQuery1.of(20)));
assertTrue(filter.allows(TestFilter.Query.of(10)));
assertTrue(filter.allows(TestFilter.Query.of(15)));
assertTrue(filter.denies(TestFilter.Query.of(20)));
}

@Test
Expand Down
Loading

0 comments on commit 5334373

Please sign in to comment.