This is an automated email from the ASF dual-hosted git repository. bertty pushed a commit to branch debugger in repository https://gitbox.apache.org/repos/asf/incubator-wayang.git
commit dd4e5af2218ac64fd808cb9d903c60a51a622e6e Author: Bertty Contreras-Rojas <[email protected]> AuthorDate: Tue Apr 6 13:28:37 2021 -0400 [WAYANG-28] add basic implementation on Sniff --- .../core/sniffer/sniff/CollectionTagsToSniff.java | 46 ++++++++++++++++++++++ .../core/sniffer/sniff/SingleTagToSniff.java | 42 ++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/sniffer/sniff/CollectionTagsToSniff.java b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/sniffer/sniff/CollectionTagsToSniff.java new file mode 100644 index 0000000..a2811b0 --- /dev/null +++ b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/sniffer/sniff/CollectionTagsToSniff.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.wayang.plugin.hackit.core.sniffer.sniff; + +import org.apache.wayang.plugin.hackit.core.tags.HackitTag; + +import java.util.HashSet; +import java.util.Set; + +public class CollectionTagsToSniff implements Sniff { + + public Set<HackitTag> tags2sniff; + + public CollectionTagsToSniff(){ + this.tags2sniff = new HashSet<>(); + } + + public boolean sniff(HackitTag tag){ + return this.tags2sniff.contains(tag); + } + + public void addTag2sniff(HackitTag tag) { + this.tags2sniff.add(tag); + } + + @Override + public boolean sniff(Object input) { + return false; + } +} diff --git a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/sniffer/sniff/SingleTagToSniff.java b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/sniffer/sniff/SingleTagToSniff.java new file mode 100644 index 0000000..9ce8ede --- /dev/null +++ b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/sniffer/sniff/SingleTagToSniff.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.wayang.plugin.hackit.core.sniffer.sniff; + +import org.apache.wayang.plugin.hackit.core.tags.HackitTag; + +public class SingleTagToSniff implements Sniff { + + public HackitTag tags2sniff; + + public boolean sniff(HackitTag tag){ + return this.tags2sniff.equals(tag); + } + + public void addTag2sniff(HackitTag tag) { + if(this.tags2sniff != null){ + throw new RuntimeException("The SingleTagToSniff already got the tag, if you need more of one tag use CollectionTagsToSniff class"); + } + this.tags2sniff = tag; + } + + @Override + public boolean sniff(Object input) { + return false; + } +}
