StringPattern.java
/**
* Copyright 2010,2021 Nikolas S Boyd.
Permission is granted to copy this work provided this copyright statement is retained in all copies.
*/
package Hoot.Collections;
import Hoot.Runtime.Functions.*;
import Hoot.Runtime.Faces.*;
import Hoot.Runtime.Values.*;
import Hoot.Runtime.Blocks.*;
import Smalltalk.Core.*;
import Smalltalk.Blocks.*;
import Smalltalk.Magnitudes.*;
import Hoot.Behaviors.*;
import Hoot.Behaviors.Nil;
import Hoot.Behaviors.Object;
import Hoot.Behaviors.True;
import Hoot.Behaviors.False;
import Hoot.Behaviors.Boolean;
import Hoot.Magnitudes.*;
import Hoot.Magnitudes.Integer;
import Hoot.Magnitudes.Character;
import Hoot.Magnitudes.Float;
import Hoot.Magnitudes.Double;
import java.util.List;
import java.util.ArrayList;
import java.util.regex.Pattern;
public class StringPattern extends Object
{
public static Metaclass type() { return (Metaclass)Metaclass.$class; }
@Override public Metaclass $class() { return (Metaclass)Metaclass.$class; }
public static class Metaclass extends Object.Metaclass
{
static final StringPattern.Metaclass $class = new StringPattern.Metaclass();
public Metaclass() {
this(StringPattern.Metaclass.class);
}
public Metaclass(java.lang.Class aClass) {
super(aClass);
}
@Override public java.lang.Class outerClass() { return StringPattern.class; }
}
protected java.lang.String regexPattern;
/**
*
*/
public StringPattern(final CharacterString pattern)
{
java.lang.String exitID = "StringPattern>>StringPattern";
Frame f0 = new Frame(exitID);
regexPattern = pattern.primitiveString();
}
/**
* @return
*/
public Boolean accepts(final CharacterString aString)
{
java.lang.String exitID = "StringPattern>>accepts";
Frame f0 = new Frame(exitID);
return (Boolean)Boolean.from(Pattern.compile(regexPattern).matcher(aString.primitiveString()).matches());
}
}