Mercurial > dive4elements > river
changeset 1747:d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
flys-artifacts/trunk@3047 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 20 Oct 2011 13:45:45 +0000 |
parents | 94faf08d143c |
children | d56b94325bec |
files | flys-artifacts/ChangeLog flys-artifacts/doc/conf/themes.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java |
diffstat | 6 files changed, 509 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Oct 20 13:29:54 2011 +0000 +++ b/flys-artifacts/ChangeLog Thu Oct 20 13:45:45 2011 +0000 @@ -1,3 +1,28 @@ +2011-10-20 Ingo Weinzierl <ingo@intevation.de> + + * doc/conf/themes.xml: Added main value themes for longitudinal section + charts. + + * src/main/java/de/intevation/flys/themes/ThemeMapping.java: New. This + class stores the name of a facet, the related theme and a pattern + string. + + * src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java: + Read the pattern string and store a list of ThemeMapping objects in the + FLYSContext. + + * src/main/java/de/intevation/flys/themes/ThemeFactory.java: Modified + getTheme() which now takes the FLYSContext, the name of a facet and an + optional pattern string. Now, we can have specialized Themes for each + chart type. E.g. the facet "longitudinal_section.w" maps the default + Theme for W lines in longitudinal section charts. If the optional + pattern string matches the pattern ".*(HQ1000)(\D.*)*", the ThemeFactory + will return the Theme "LongitudinalSectionW_HQ1000". + + * src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java: + Use the description of a facet as pattern string to get the relevant + Theme from ThemeFactory. + 2011-10-20 Raimund Renkert <raimund.renkert@intevation.de> * doc/conf/themes.xml:
--- a/flys-artifacts/doc/conf/themes.xml Thu Oct 20 13:29:54 2011 +0000 +++ b/flys-artifacts/doc/conf/themes.xml Thu Oct 20 13:45:45 2011 +0000 @@ -23,6 +23,168 @@ </fields> </theme> + <theme name="LongitudinalSectionW_HQ1"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ2"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ5"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 153, 51"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ10"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 204, 204"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ20"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="153, 153, 0"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ25"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="102, 51, 0"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ50"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="255, 153, 153"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ100"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="255, 0, 51"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ200"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="255, 0, 255"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ500"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="102, 0, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQ1000"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 0"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQRZ"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="102, 0, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HSQ"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="253, 153, 0"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_MHQ"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="102, 255, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_MNQ"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 255, 255"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_MQ"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 51, 204"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_NQ"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="153, 204, 255"/> + </fields> + </theme> + + <theme name="LongitudinalSectionW_HQExtrem"> + <inherits> + <inherit from="LongitudinalSectionW"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 0"/> + </fields> + </theme> + <theme name="LongitudinalSectionQ"> <inherits> <inherit from="HiddenColorLines"/> @@ -32,6 +194,168 @@ </fields> </theme> + <theme name="LongitudinalSectionQ_HQ1"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ2"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ5"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 153, 51"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ10"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 204, 204"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ20"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="153, 153, 0"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ25"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="102, 51, 0"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ50"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="255, 153, 153"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ100"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="255, 0, 51"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ200"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="255, 0, 255"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ500"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="102, 0, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQ1000"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 0"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQRZ"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="102, 0, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HSQ"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="253, 153, 0"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_MHQ"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="102, 255, 102"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_MNQ"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 255, 255"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_MQ"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 51, 204"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_NQ"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="153, 204, 255"/> + </fields> + </theme> + + <theme name="LongitudinalSectionQ_HQExtrem"> + <inherits> + <inherit from="LongitudinalSectionQ"/> + </inherits> + <fields> + <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 0"/> + </fields> + </theme> + <!-- Computed Discharge Curves @@ -212,7 +536,43 @@ and a theme. --> <mappings> <mapping from="longitudinal_section.w" to="LongitudinalSectionW"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ1)(\D.*)*" to="LongitudinalSectionW_HQ1"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ2)(\D.*)*" to="LongitudinalSectionW_HQ2"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ5)(\D.*)*" to="LongitudinalSectionW_HQ5"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ10)(\D.*)*" to="LongitudinalSectionW_HQ10"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ20)(\D.*)*" to="LongitudinalSectionW_HQ20"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ25)(\D.*)*" to="LongitudinalSectionW_HQ25"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ50)(\D.*)*" to="LongitudinalSectionW_HQ50"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ100)(\D.*)*" to="LongitudinalSectionW_HQ100"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ200)(\D.*)*" to="LongitudinalSectionW_HQ200"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ500)(\D.*)*" to="LongitudinalSectionW_HQ500"/> + <mapping from="longitudinal_section.w" pattern=".*(HQ1000)(\D.*)*" to="LongitudinalSectionW_HQ1000"/> + <mapping from="longitudinal_section.w" pattern=".*(HQExtrem)(\D.*)*" to="LongitudinalSectionW_HQExtrem"/> + <mapping from="longitudinal_section.w" pattern=".*(HQRZ)(\D.*)*" to="LongitudinalSectionW_HQRZ"/> + <mapping from="longitudinal_section.w" pattern=".*(HSQ)(\D.*)*" to="LongitudinalSectionW_HSQ"/> + <mapping from="longitudinal_section.w" pattern=".*(MHQ)(\D.*)*" to="LongitudinalSectionW_MHQ"/> + <mapping from="longitudinal_section.w" pattern=".*(MNQ)(\D.*)*" to="LongitudinalSectionW_MNQ"/> + <mapping from="longitudinal_section.w" pattern=".*(MQ)(\D.*)*" to="LongitudinalSectionW_MQ"/> + <mapping from="longitudinal_section.w" pattern=".*(NQ)(\D.*)*" to="LongitudinalSectionW_NQ"/> <mapping from="longitudinal_section.q" to="LongitudinalSectionQ"/> + <mapping from="longitudinal_section.q" pattern="(HQ1)(\D.*)*" to="LongitudinalSectionQ_HQ1"/> + <mapping from="longitudinal_section.q" pattern="(HQ2)(\D.*)*" to="LongitudinalSectionQ_HQ2"/> + <mapping from="longitudinal_section.q" pattern="(HQ5)(\D.*)*" to="LongitudinalSectionQ_HQ5"/> + <mapping from="longitudinal_section.q" pattern="(HQ10)(\D.*)*" to="LongitudinalSectionQ_HQ10"/> + <mapping from="longitudinal_section.q" pattern="(HQ20)(\D.*)*" to="LongitudinalSectionQ_HQ20"/> + <mapping from="longitudinal_section.q" pattern="(HQ25)(\D.*)*" to="LongitudinalSectionQ_HQ25"/> + <mapping from="longitudinal_section.q" pattern="(HQ50)(\D.*)*" to="LongitudinalSectionQ_HQ50"/> + <mapping from="longitudinal_section.q" pattern="(HQ100)(\D.*)*" to="LongitudinalSectionQ_HQ100"/> + <mapping from="longitudinal_section.q" pattern="(HQ200)(\D.*)*" to="LongitudinalSectionQ_HQ200"/> + <mapping from="longitudinal_section.q" pattern="(HQ500)(\D.*)*" to="LongitudinalSectionQ_HQ500"/> + <mapping from="longitudinal_section.q" pattern="(HQ1000)(\D.*)*" to="LongitudinalSectionQ_HQ1000"/> + <mapping from="longitudinal_section.q" pattern="(HQExtrem)(\D.*)*" to="LongitudinalSectionQ_HQExtrem"/> + <mapping from="longitudinal_section.q" pattern="(HQRZ)(\D.*)*" to="LongitudinalSectionQ_HQRZ"/> + <mapping from="longitudinal_section.q" pattern="(HSQ)(\D.*)*" to="LongitudinalSectionQ_HSQ"/> + <mapping from="longitudinal_section.q" pattern="(MHQ)(\D.*)*" to="LongitudinalSectionQ_MHQ"/> + <mapping from="longitudinal_section.q" pattern="(MNQ)(\D.*)*" to="LongitudinalSectionQ_MNQ"/> + <mapping from="longitudinal_section.q" pattern="(MQ)(\D.*)*" to="LongitudinalSectionQ_MQ"/> + <mapping from="longitudinal_section.q" pattern="(NQ)(\D.*)*" to="LongitudinalSectionQ_NQ"/> <mapping from="discharge_curve.curve" to="DischargeCurve"/> <mapping from="cross_section" to="CrossSection"/> <mapping from="cross_section_water_line" to="CrossSectionWaterLine"/>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java Thu Oct 20 13:29:54 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/FLYSContextFactory.java Thu Oct 20 13:45:45 2011 +0000 @@ -30,6 +30,7 @@ import de.intevation.flys.artifacts.transitions.TransitionFactory; import de.intevation.flys.themes.Theme; import de.intevation.flys.themes.ThemeFactory; +import de.intevation.flys.themes.ThemeMapping; /** @@ -344,7 +345,8 @@ return; } - Map<String, String> mapping = new HashMap<String, String>(); + Map<String, List<ThemeMapping>> mapping = + new HashMap<String, List<ThemeMapping>>(); for (int i = 0; i < num; i++) { Node node = mappings.item(i); @@ -355,12 +357,22 @@ String to = (String) XMLUtils.xpath( node, "@to", XPathConstants.STRING); + String pattern = (String) XMLUtils.xpath( + node, "@pattern", XPathConstants.STRING); + if (from != null && to != null) { - mapping.put(from, to); + List<ThemeMapping> tm = mapping.get(from); + + if (tm == null) { + tm = new ArrayList<ThemeMapping>(); + mapping.put(from, tm); + } + + tm.add(new ThemeMapping(from, to, pattern)); } } - logger.debug("Found " + mapping.size() + " theme/facet mappings."); + logger.debug("Found " + mapping.size() + " theme mappings."); context.put(FLYSContext.THEME_MAPPING, mapping); }
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Thu Oct 20 13:29:54 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Thu Oct 20 13:45:45 2011 +0000 @@ -302,6 +302,7 @@ art, outName, facetName, + theme.getDescription(), theme.getIndex(), context), theme.getActive() == 1); @@ -473,6 +474,7 @@ String uuid, String outName, String facet, + String pattern, int index, CallContext context) throws ArtifactDatabaseException @@ -486,15 +488,10 @@ ? (FLYSContext) context : (FLYSContext) context.globalContext(); - Map<String, String> mappings = (Map<String, String>) - flysContext.get(FLYSContext.THEME_MAPPING); - - String themeName = mappings.get(facet); - Document attr = db.getCollectionItemAttribute(identifier(), uuid, meta); if (attr == null) { - attr = initItemAttribute(uuid, facet, index, context); + attr = initItemAttribute(uuid, facet, pattern, index, context); if (attr == null) { return null; @@ -514,7 +511,7 @@ return null; } - log.debug("Search theme '" + themeName + "' in attribute."); + log.debug("Search theme for facet '" + facet + "' in attribute."); Node theme = (Node) XMLUtils.xpath( tmp, @@ -526,7 +523,7 @@ if (theme == null) { log.warn("Could not find the theme in attribute of: " + uuid); - Theme t = getThemeForFacet(uuid, facet, index, context); + Theme t = getThemeForFacet(uuid, facet, pattern, index, context); if (t == null) { log.warn("No theme found for facet: " + facet); @@ -619,12 +616,13 @@ protected Document initItemAttribute( String uuid, String facet, + String pattern, int index, CallContext context) { log.info("FLYSArtifactCollection.initItemAttribute"); - Theme t = getThemeForFacet(uuid, facet, index, context); + Theme t = getThemeForFacet(uuid, facet, pattern, index, context); if (t == null) { log.info("Could not find theme for facet. Cancel initialization."); @@ -681,6 +679,7 @@ protected Theme getThemeForFacet( String uuid, String facet, + String pattern, int index, CallContext context) { @@ -690,7 +689,7 @@ ? (FLYSContext) context : (FLYSContext) context.globalContext(); - Theme t = ThemeFactory.getTheme(flysContext, facet); + Theme t = ThemeFactory.getTheme(flysContext, facet, pattern); if (t != null) { t.setFacet(facet);
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java Thu Oct 20 13:29:54 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java Thu Oct 20 13:45:45 2011 +0000 @@ -1,5 +1,6 @@ package de.intevation.flys.themes; +import java.util.List; import java.util.Map; import javax.xml.xpath.XPathConstants; @@ -61,12 +62,18 @@ * @return a theme. */ public static Theme getTheme(FLYSContext c, String name) { + return getTheme(c, name, null); + } + + + public static Theme getTheme(FLYSContext c, String name, String pattern) { + logger.debug("Search theme for: " + name + " - " + pattern); if (c == null || name == null) { logger.warn("Cannot search for theme."); return null; } - Map<String, String> map = (Map<String, String>) + Map<String, List<ThemeMapping>> map = (Map<String, List<ThemeMapping>>) c.get(FLYSContext.THEME_MAPPING); Map<String, Theme> t = (Map<String, Theme>) @@ -77,13 +84,50 @@ return null; } - String themeName = map.get(name); + List<ThemeMapping> mapping = map.get(name); - if (themeName == null) { - logger.warn("No theme found for mapping: " + name); + if (mapping == null) { + logger.warn("No theme fount for mapping: " + name); + return null; } - return t.get(themeName); + int patternLen = pattern != null ? pattern.length() : 0; + + Theme defaultTheme = null; + + for (ThemeMapping tm: mapping) { + if (name.equals(tm.getFrom())) { + String tmPattern = tm.getPatternStr(); + + int tmLen = tmPattern != null ? tmPattern.length() : 0; + + if (tmLen == 0 && patternLen == 0) { + // we want and get the default theme + return t.get(tm.getTo()); + } + else if (tmLen == 0 && patternLen > 0) { + // found a defaultTheme, lets save it + defaultTheme = t.get(tm.getTo()); + } + else if (tm.applyPattern(pattern)) { + // found the special theme we have searched for + return t.get(tm.getTo()); + } + } + } + + String msg = + "No theme found for '" + name + + "' with pattern '" + pattern + "'."; + + if (defaultTheme != null) { + logger.info(msg + " Use the default instead."); + return defaultTheme; + } + + logger.warn(msg); + + return null; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java Thu Oct 20 13:45:45 2011 +0000 @@ -0,0 +1,51 @@ +package de.intevation.flys.themes; + +import java.io.Serializable; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +public class ThemeMapping implements Serializable { + + protected String from; + protected String to; + protected String patternStr; + + protected Pattern pattern; + + + public ThemeMapping(String from, String to) { + this(from, to, null); + } + + + public ThemeMapping(String from, String to, String patternStr) { + this.from = from; + this.to = to; + this.patternStr = patternStr; + + this.pattern = Pattern.compile(patternStr); + } + + + public String getFrom() { + return from; + } + + + public String getTo() { + return to; + } + + + public String getPatternStr() { + return patternStr; + } + + + public boolean applyPattern(String text) { + Matcher m = pattern.matcher(text); + return m.matches(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :