📄 filter.java
字号:
package model;//Copyright (C) 2008 Harald Unander, Wang Wenjuan//// This file is part of WlanTV.//// WlanTV is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// WlanTV is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with WlanTV. If not, see <http://www.gnu.org/licenses/>.import model.Packet.FType;import model.Transaction.OneTransaction;import view.ButtonBar;import view.ComboBar;import view.ComboBar.DIRECTION;public class Filter { long staVal; long apVal; int rssiVal; int chVal; boolean badFcs; DIRECTION dirVal; public void apply(Transaction transaction, ComboBar comboBar,ButtonBar buttonBar) { staVal = comboBar.getStaFilterValue(); apVal = comboBar.getApFilterValue(); rssiVal = comboBar.getRssiFilterValue(); dirVal = comboBar.getDirValue(); chVal = comboBar.getChannelFilterValue(); badFcs = buttonBar.getBadfcsValue(); for (OneTransaction one : transaction.list) { one.hide = !filterOne(one,transaction.conversation); } } private boolean filterOne(OneTransaction one,Conversation conv) {// System.out.println(Result.getStaList().get(one.STA)+" "+one.AP+"=="+apVal+" "+one.STA+"=="+staVal);// boolean e1 = Result.getStaList().get(one.STA)!=null; boolean e2 = conv.getApList().get(one.AP)!=null; boolean e3 = one.packetList.size()==1 && (Transaction.DataGroupCast(one.packetList.get(0)) || Transaction.ManGroupCast(one.packetList.get(0))); boolean on1 = staVal==0 || staVal==one.STA || e2 && e3 && conv.getApList().get(one.AP).STA.contains(staVal); boolean on2 = apVal==0 || rssiVal!=0 || apVal==one.AP; boolean on3 = rssiVal==0 || apVal!=0 || one.packetList.get(0).rssi>rssiVal; boolean on4 = chVal==0 || e2 && conv.getApList().get(one.AP).channel==chVal; boolean on5 = badFcs || !one.badFcs; // special AP plus RSSI filter boolean on6 = rssiVal==0 || apVal==0 || apVal==one.AP || one.packetList.get(0).rssi>rssiVal; boolean on7 = dirVal==DIRECTION.normal || one.unicastPacket==null || one.unicastPacket!=null && (!isData(one.unicastPacket) || dirVal==DIRECTION.uplink && isUplink(one.unicastPacket) || dirVal==DIRECTION.downlink && isDownlink(one.unicastPacket)); return on1 && on2 && on3 && on4 && on5 && on6 && on7; } private boolean isUplink(Packet p) { return (p.wlanToDs==1); } private boolean isDownlink(Packet p) { return (p.wlanFromDs==1); } private boolean isData(Packet p) { if (p.fType == FType.DATA || p.fType == FType.Q_DATA) return true; else return false; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -