ruper2/src/java/core/org/krysalis/ruper2/resource/select VersionConstraintsSelector.java,NONE,1.1
| Newsgroups | gmane.comp.krysalis.metamorphosis.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/resource/select
In directory sc8-pr-cvs1:/tmp/cvs-serv13733/src/java/core/org/krysalis/ruper2/resource/select
Added Files:
VersionConstraintsSelector.java
Log Message:
VersionConstraintsSelector
--- NEW FILE: VersionConstraintsSelector.java ---
/*
* Created on Sep 4, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package org.krysalis.ruper2.resource.select;
import org.krysalis.ruper2.log.Logger;
import org.krysalis.ruper2.resource.Resource;
import org.krysalis.ruper2.util.text.MessageConstants;
import org.krysalis.ruper2.util.text.Messages;
import org.krysalis.version.Version;
import org.krysalis.version.constraint.ConstraintEvaluator;
import org.krysalis.version.constraint.ConstraintResultSet;
import org.krysalis.version.constraint.ConstraintSet;
import org.krysalis.version.impl.KrysalisVersion;
/**
* @author arb_jack
*/
public class VersionConstraintsSelector extends AbstractResourceSelector {
ConstraintSet m_constraints = null;
/**
* @param expression
*/
public VersionConstraintsSelector(ConstraintSet constraints) {
super(Messages.getString(MessageConstants.VERSION_SELECTOR));
m_constraints = constraints;
}
public boolean selectResource(Resource resource) {
boolean selected = false;
Logger log = Logger.g_loggingOn ? Logger.getLog() : null;
Version version = resource.getVersion();
if (null != version) {
//:TODO: More features...
if (version instanceof KrysalisVersion) {
ConstraintResultSet resultSet =
ConstraintEvaluator.evaluate(
((KrysalisVersion) version),
m_constraints);
selected = !resultSet.hasErrors();
log.debug(
"Selected ["
+ m_constraints.getName()
+ "] ["
+ ((KrysalisVersion) version)
+ "] ["
+ selected
+ "]");
}
else
log.debug(
"Non-KrysalisVersion " + version.getClass().getName());
}
else
log.debug("No Version on " + resource);
return selected;
}
public String toString() {
return super.toString()
+ ": [Leval= "
+ m_constraints.toString()
+ "]";
}
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf