com.github.bloodshura.ignitium.ntv.pattern.primitive.AbstractValuePattern Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ignitium-native Show documentation
Show all versions of ignitium-native Show documentation
An API for working with native system APIs, with a higher-level interface.
The newest version!
package com.github.bloodshura.ignitium.ntv.pattern.primitive;
import com.github.bloodshura.ignitium.ntv.pattern.Pattern;
import com.github.bloodshura.ignitium.ntv.util.Buffer;
import javax.annotation.Nonnull;
import java.util.function.BiFunction;
public class AbstractValuePattern implements Pattern {
private final BiFunction function;
private final int size;
private final E value;
public AbstractValuePattern(@Nonnull E value, int size, @Nonnull BiFunction function) {
this.function = function;
this.size = size;
this.value = value;
}
@Override
public final int getSize() {
return size;
}
@Override
public boolean matches(@Nonnull Buffer buffer, long address) {
return function.apply(buffer, address).equals(value);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy