// Path: src/main/java/portablejim/veinminer/configuration/json/ToolStruct.java
// public class ToolStruct {
//     public String name;
//     public String icon;
//     public String[] toollist;
//     public String[] blocklist;
// }
// 
// Path: src/main/java/portablejim/veinminer/util/BlockID.java
// public class BlockID implements Comparable<BlockID>
// {
//     public String name;
//     public int metadata;
//     public IBlockState state = null;
//     
//     public BlockID(String fullDescription) {
//         int preMeta = -1;
//         Pattern p = Pattern.compile("([^/]+)(?:/([-]?\\d{1,2}))?");
//         Matcher m = p.matcher(fullDescription);
// 
//         if(m.matches()) {
//             name = m.group(1);
//             if(m.group(2) != null) {
//                 try {
//                     preMeta = Integer.parseInt(m.group(2));
//                 }
//                 catch (NumberFormatException e) {
//                     preMeta = -1;
//                 }
//             }
//         }
//         else {
//             name = "";
//         }
//         metadata = preMeta >= -1 ? preMeta : -1;
//     }
// 
//     public BlockID(String name, int meta) {
//         this.name = name;
//         this.metadata =  meta < -1 || meta == OreDictionary.WILDCARD_VALUE ? -1 : meta;
//     }
// 
//     @Deprecated
//     public BlockID(World world, BlockPos position) {
//         this(world.getBlockState(position));
//     }
// 
//     public BlockID(IBlockState state) {
//         this(Block.blockRegistry.getNameForObject(state.getBlock()).toString(), state.getBlock().getMetaFromState(state));
//         this.state = state;
//     }
// 
//     @Override
//     public boolean equals(Object obj)
//     {
//         if (this == obj)
//             return true;
//         
//         if (!(obj instanceof BlockID))
//             return false;
// 
//         BlockID o = (BlockID) obj;
//         return name.equals(o.name) && metadata == o.metadata;
//     }
// 
//     /**
//      * Compare the objects using the metadata value of -1 to be a wildcard that matches all.
//      * @param obj The object to compare to this one
//      * @return Whether this object and obj are equal, using the wildcard value.
//      */
//     public boolean wildcardEquals(Object obj)
//     {
//         if (this == obj)
//             return true;
// 
//         if (!(obj instanceof BlockID))
//             return false;
// 
//         BlockID o = (BlockID) obj;
//         if (o.metadata == -1 || metadata == -1)
//             return this.equals(obj);
//         else
//             return name.equals(o.name) && metadata == o.metadata;
//     }
//     
//     @Override
//     public int hashCode()
//     {
//         return (this.name.hashCode() << 6) + this.metadata;
//     }
//     
//     @Override
//     public String toString()
//     {
//         return (metadata == -1 ? name + "" : name + "/" + metadata);
//     }
// 
//     @Override
//     public int compareTo(BlockID blockID) {
//         if(name != null && !name.equals(blockID.name)) {
//             int result = name.compareTo(blockID.name);
//             if(result > 0) return 1;
//             else if (result < 0) return -1;
//             return 0;
//         }
//         else if(metadata < blockID.metadata) {
//             return -1;
//         }
//         else if(metadata > blockID.metadata) {
//             return 1;
//         }
//         else {
//             return 0;
//         }
//     }
// }
// 
// Path: src/main/java/portablejim/veinminer/util/PreferredMode.java
// public class PreferredMode {
//     public static final int DISABLED = 0;
//     public static final int PRESSED = 1;
//     public static final int RELEASED = 2;
//     public static final int SNEAK_ACTIVE = 3;
//     public static final int SNEAK_INACTIVE = 4;
// 
//     public static int length() {
//         return 5;
//     }
// }


import com.google.common.base.Joiner;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import portablejim.veinminer.configuration.json.ToolStruct;
import portablejim.veinminer.util.BlockID;
import portablejim.veinminer.util.PreferredMode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* This file is part of VeinMiner.
 *
 *    VeinMiner is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU Lesser General Public License as
 *    published by the Free Software Foundation, either version 3 of
 *     the License, or (at your option) any later version.
 *
 *    VeinMiner 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 Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with VeinMiner.
 *    If not, see <http://www.gnu.org/licenses/>.
 */

package portablejim.veinminer.configuration;



/**
 * Class to manage the config settings. It takes the raw values from
 * ConfigurationValues and stores the settings in much more useful types
 * and provides methods to retrieve the settings.
 */

public class ConfigurationSettings {

    private ConfigurationValues configValues;

    public ConfigurationSettings(ConfigurationValues configValues) {
        this.configValues = configValues;
        autoDetectBlocksToggle = new boolean[ToolType.values().length];
        //noinspection unchecked
        autoDetectBlocksList = new HashSet[ToolType.values().length];
        for (ToolType tool : ToolType.values()) {
            autoDetectBlocksToggle[tool.ordinal()] = false;
            autoDetectBlocksList[tool.ordinal()] = new HashSet<String>();
        }
// Path: src/main/java/portablejim/veinminer/configuration/json/ToolStruct.java
// public class ToolStruct {
//     public String name;
//     public String icon;
//     public String[] toollist;
//     public String[] blocklist;
// }
// 
// Path: src/main/java/portablejim/veinminer/util/BlockID.java
// public class BlockID implements Comparable<BlockID>
// {
//     public String name;
//     public int metadata;
//     public IBlockState state = null;
//     
//     public BlockID(String fullDescription) {
//         int preMeta = -1;
//         Pattern p = Pattern.compile("([^/]+)(?:/([-]?\\d{1,2}))?");
//         Matcher m = p.matcher(fullDescription);
// 
//         if(m.matches()) {
//             name = m.group(1);
//             if(m.group(2) != null) {
//                 try {
//                     preMeta = Integer.parseInt(m.group(2));
//                 }
//                 catch (NumberFormatException e) {
//                     preMeta = -1;
//                 }
//             }
//         }
//         else {
//             name = "";
//         }
//         metadata = preMeta >= -1 ? preMeta : -1;
//     }
// 
//     public BlockID(String name, int meta) {
//         this.name = name;
//         this.metadata =  meta < -1 || meta == OreDictionary.WILDCARD_VALUE ? -1 : meta;
//     }
// 
//     @Deprecated
//     public BlockID(World world, BlockPos position) {
//         this(world.getBlockState(position));
//     }
// 
//     public BlockID(IBlockState state) {
//         this(Block.blockRegistry.getNameForObject(state.getBlock()).toString(), state.getBlock().getMetaFromState(state));
//         this.state = state;
//     }
// 
//     @Override
//     public boolean equals(Object obj)
//     {
//         if (this == obj)
//             return true;
//         
//         if (!(obj instanceof BlockID))
//             return false;
// 
//         BlockID o = (BlockID) obj;
//         return name.equals(o.name) && metadata == o.metadata;
//     }
// 
//     /**
//      * Compare the objects using the metadata value of -1 to be a wildcard that matches all.
//      * @param obj The object to compare to this one
//      * @return Whether this object and obj are equal, using the wildcard value.
//      */
//     public boolean wildcardEquals(Object obj)
//     {
//         if (this == obj)
//             return true;
// 
//         if (!(obj instanceof BlockID))
//             return false;
// 
//         BlockID o = (BlockID) obj;
//         if (o.metadata == -1 || metadata == -1)
//             return this.equals(obj);
//         else
//             return name.equals(o.name) && metadata == o.metadata;
//     }
//     
//     @Override
//     public int hashCode()
//     {
//         return (this.name.hashCode() << 6) + this.metadata;
//     }
//     
//     @Override
//     public String toString()
//     {
//         return (metadata == -1 ? name + "" : name + "/" + metadata);
//     }
// 
//     @Override
//     public int compareTo(BlockID blockID) {
//         if(name != null && !name.equals(blockID.name)) {
//             int result = name.compareTo(blockID.name);
//             if(result > 0) return 1;
//             else if (result < 0) return -1;
//             return 0;
//         }
//         else if(metadata < blockID.metadata) {
//             return -1;
//         }
//         else if(metadata > blockID.metadata) {
//             return 1;
//         }
//         else {
//             return 0;
//         }
//     }
// }
// 
// Path: src/main/java/portablejim/veinminer/util/PreferredMode.java
// public class PreferredMode {
//     public static final int DISABLED = 0;
//     public static final int PRESSED = 1;
//     public static final int RELEASED = 2;
//     public static final int SNEAK_ACTIVE = 3;
//     public static final int SNEAK_INACTIVE = 4;
// 
//     public static int length() {
//         return 5;
//     }
// }


// Path: src/main/java/portablejim/veinminer/configuration/ConfigurationSettings.java
import com.google.common.base.Joiner;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import portablejim.veinminer.configuration.json.ToolStruct;
import portablejim.veinminer.util.BlockID;
import portablejim.veinminer.util.PreferredMode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/* This file is part of VeinMiner.
 *
 *    VeinMiner is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU Lesser General Public License as
 *    published by the Free Software Foundation, either version 3 of
 *     the License, or (at your option) any later version.
 *
 *    VeinMiner 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 Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with VeinMiner.
 *    If not, see <http://www.gnu.org/licenses/>.
 */

package portablejim.veinminer.configuration;



/**
 * Class to manage the config settings. It takes the raw values from
 * ConfigurationValues and stores the settings in much more useful types
 * and provides methods to retrieve the settings.
 */

public class ConfigurationSettings {

    private ConfigurationValues configValues;

    public ConfigurationSettings(ConfigurationValues configValues) {
        this.configValues = configValues;
        autoDetectBlocksToggle = new boolean[ToolType.values().length];
        //noinspection unchecked
        autoDetectBlocksList = new HashSet[ToolType.values().length];
        for (ToolType tool : ToolType.values()) {
            autoDetectBlocksToggle[tool.ordinal()] = false;
            autoDetectBlocksList[tool.ordinal()] = new HashSet<String>();
        }
        blockCongruenceList = new ArrayList<Set<BlockID>>();