mresultcache.java

来自「httptunnel.jar httptunnel java 源码」· Java 代码 · 共 70 行

JAVA
70
字号
package net.jumperz.app.MGuardian.rule;

import java.util.*;
import java.io.*;

public class MResultCache
{
private Set matchedRuleSet;
private Set unmatchedRuleSet;
private Set delayedRuleSet;
//------------------------------------------------------------------------------------
public MResultCache()
{
matchedRuleSet   = new HashSet();
unmatchedRuleSet = new HashSet();
delayedRuleSet   = new HashSet();
}
//------------------------------------------------------------------------------------
public boolean containsResult( MAbstractRule rule )
{
if( matchedRuleSet.contains( rule )
 || unmatchedRuleSet.contains( rule )
  )
	{
	return true;
	}
return false;
}
//------------------------------------------------------------------------------------
public boolean getResult( MAbstractRule rule )
{
if( matchedRuleSet.contains( rule ) )
	{
	return true;
	}
else if( unmatchedRuleSet.contains( rule ) )
	{
	return false;
	}
else
	{
	Exception e = new Exception( "Exception. should not happen." );
	e.printStackTrace();
	return false;
	}
}
//------------------------------------------------------------------------------------
public void setDelayed( MAbstractResponseRule rule )
{
delayedRuleSet.add( rule );
}
//------------------------------------------------------------------------------------
public boolean isDelayed( MAbstractResponseRule rule )
{
return delayedRuleSet.contains( rule );
}
//------------------------------------------------------------------------------------
public void cacheResult( MAbstractRule rule, boolean matches )
{
if( matches )
	{
	matchedRuleSet.add( rule );
	}
else
	{
	unmatchedRuleSet.add( rule );
	}
}
//------------------------------------------------------------------------------------
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?