From: <jen...@us...> - 2007-09-22 09:30:16
|
Revision: 147 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=147&view=rev Author: jenslehmann Date: 2007-09-22 02:30:01 -0700 (Sat, 22 Sep 2007) Log Message: ----------- intermediate commit for new base structure Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/Component.java trunk/src/dl-learner/org/dllearner/core/ConfigOption.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/ConfigEntry.java trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java trunk/src/dl-learner/org/dllearner/core/InvalidConfigOptionValueException.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java trunk/src/dl-learner/org/dllearner/core/ConfigOptionType.java Modified: trunk/src/dl-learner/org/dllearner/core/Component.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/Component.java 2007-09-21 14:21:49 UTC (rev 146) +++ trunk/src/dl-learner/org/dllearner/core/Component.java 2007-09-22 09:30:01 UTC (rev 147) @@ -19,10 +19,29 @@ */ package org.dllearner.core; +import java.util.Collection; + /** * @author Jens Lehmann * */ public interface Component { + /** + * + * @return The name of this component. + */ + public String getName(); + + /** + * Returns all configuration options supported by this component. + */ + public Collection<ConfigOption> getConfigOptions(); + + /** + * Applies a configuration option to this component. + * + * @param entry A configuration entry. + */ + public void applyConfigEntry(ConfigEntry entry); } Copied: trunk/src/dl-learner/org/dllearner/core/ConfigEntry.java (from rev 146, trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ConfigEntry.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/ConfigEntry.java 2007-09-22 09:30:01 UTC (rev 147) @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner 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. + * + * DL-Learner 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 this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core; + +/** + * A config entry is a configuration option and a value for the option. + * + * @author Jens Lehmann + * + */ +public class ConfigEntry { + + public ConfigEntry(ConfigOption option, Object value) throws Exception { + if(!option.isValidValue(value)) { + throw new InvalidConfigOptionValueException(option, value); + } else { + + } + } + +} Modified: trunk/src/dl-learner/org/dllearner/core/ConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ConfigOption.java 2007-09-21 14:21:49 UTC (rev 146) +++ trunk/src/dl-learner/org/dllearner/core/ConfigOption.java 2007-09-22 09:30:01 UTC (rev 147) @@ -20,9 +20,24 @@ package org.dllearner.core; /** + * This class represents a configuration option (without a value for the + * option). + * * @author Jens Lehmann * */ -public class ConfigOption { +public abstract class ConfigOption { + private String name; + + public ConfigOption(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public abstract boolean isValidValue(Object value); + } Deleted: trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java 2007-09-21 14:21:49 UTC (rev 146) +++ trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java 2007-09-22 09:30:01 UTC (rev 147) @@ -1,28 +0,0 @@ -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner 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. - * - * DL-Learner 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 this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.core; - -/** - * @author Jens Lehmann - * - */ -public class ConfigOptionInstance { - -} Deleted: trunk/src/dl-learner/org/dllearner/core/ConfigOptionType.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ConfigOptionType.java 2007-09-21 14:21:49 UTC (rev 146) +++ trunk/src/dl-learner/org/dllearner/core/ConfigOptionType.java 2007-09-22 09:30:01 UTC (rev 147) @@ -1,36 +0,0 @@ -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner 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. - * - * DL-Learner 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 this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.core; - -/** - * @author Jens Lehmann - * - */ -public enum ConfigOptionType { - - INT, - - DOUBLE, - - STRING, - - SET_STRING - -} Added: trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java 2007-09-22 09:30:01 UTC (rev 147) @@ -0,0 +1,82 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner 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. + * + * DL-Learner 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 this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core; + +/** + * A configuration option, which allows values of type integer. A minimum and + * maximum value of the argument can optionally be specified. + * + * @author Jens Lehmann + * + */ +public class IntegerConfigOption extends ConfigOption { + + private int lowerLimit = Integer.MIN_VALUE; + private int upperLimit = Integer.MAX_VALUE; + + public IntegerConfigOption(String name) { + super(name); + } + + /* (non-Javadoc) + * @see org.dllearner.core.ConfigOption#isValidValue(java.lang.Object) + */ + @Override + public boolean isValidValue(Object value) { + if(!(value instanceof Integer)) + return false; + + int intValue = (Integer) value; + + if(intValue >= lowerLimit && intValue <= upperLimit) + return true; + else + return false; + } + + /** + * @return the The lowest possible value for this configuration option. + */ + public int getLowerLimit() { + return lowerLimit; + } + + /** + * @param lowerLimit The lowest possible value for this configuration option. + */ + public void setLowerLimit(int lowerLimit) { + this.lowerLimit = lowerLimit; + } + + /** + * @return the The highest possible value for this configuration option. + */ + public int getUpperLimit() { + return upperLimit; + } + + /** + * @param upperLimit The highest possible value for this configuration option. + */ + public void setUpperLimit(int upperLimit) { + this.upperLimit = upperLimit; + } + +} Added: trunk/src/dl-learner/org/dllearner/core/InvalidConfigOptionValueException.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/InvalidConfigOptionValueException.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/InvalidConfigOptionValueException.java 2007-09-22 09:30:01 UTC (rev 147) @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner 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. + * + * DL-Learner 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 this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core; + +/** + * @author Jens Lehmann + * + */ +public class InvalidConfigOptionValueException extends Exception { + + private static final long serialVersionUID = 3286110428258072698L; + + public InvalidConfigOptionValueException(ConfigOption option, Object value) { + super("The value " + value + " is not valid for the configuration option " + option + "."); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |