Project

General

Profile

Download (3.09 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / scrambling / BlacklistedSignatures.java @ e342c3f7

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2022 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.objectlib.scrambling;
21

    
22
import java.util.TreeSet;
23

    
24
import org.distorted.objectlib.helpers.ObjectSignature;
25

    
26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

    
28
public class BlacklistedSignatures
29
{
30
  private static BlacklistedSignatures mThis;
31
  private final TreeSet<ObjectSignature> mBlacklisted;
32

    
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

    
35
  private BlacklistedSignatures()
36
    {
37
    mBlacklisted = new TreeSet<>();
38
    }
39

    
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

    
42
  public static BlacklistedSignatures getInstance()
43
    {
44
    if( mThis==null ) mThis = new BlacklistedSignatures();
45
    return mThis;
46
    }
47

    
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49

    
50
  public void clear()
51
    {
52
    mBlacklisted.clear();
53
    }
54

    
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

    
57
  public void add(ObjectSignature signature)
58
    {
59
    mBlacklisted.add(signature);
60
    }
61

    
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

    
64
  public boolean contains(ObjectSignature signature)
65
    {
66
    return mBlacklisted.contains(signature);
67
    }
68
}
(1-1/6)