use of org.matheclipse.core.patternmatching.RulesData in project symja_android_library by axkr.
the class BuiltInDummy method readRules.
/**
* {@inheritDoc}
*/
@Override
public void readRules(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
fSymbolName = stream.readUTF();
fAttributes = stream.read();
boolean hasDownRulesData = stream.readBoolean();
if (hasDownRulesData) {
fRulesData = new RulesData();
fRulesData = (RulesData) stream.readObject();
}
}
use of org.matheclipse.core.patternmatching.RulesData in project symja_android_library by axkr.
the class SerializableTest method testIntegrateDefinition.
public void testIntegrateDefinition() {
RulesData rulesData = F.Integrate.getRulesData();
AbstractVisitor visitor = Share.createVisitor();
rulesData.accept(visitor);
equalsStringCopy(rulesData);
}
use of org.matheclipse.core.patternmatching.RulesData in project symja_android_library by axkr.
the class SerializableTest method testSinDefinition.
public void testSinDefinition() {
// try to share common sub-IASTs first:
RulesData rulesData = F.Sin.getRulesData();
AbstractVisitor visitor = Share.createVisitor();
rulesData.accept(visitor);
equalsCopy(rulesData);
}
use of org.matheclipse.core.patternmatching.RulesData in project symja_android_library by axkr.
the class PatternMatching method messageName.
public static IExpr messageName(ISymbol symbol, IExpr expr) {
RulesData rules = symbol.getRulesData();
if (rules != null) {
Map<IExpr, PatternMatcherEquals> map = rules.getEqualDownRules();
PatternMatcherEquals matcher = map.get(F.MessageName(symbol, expr));
if (matcher != null) {
return matcher.getRHS();
}
}
return F.NIL;
}
use of org.matheclipse.core.patternmatching.RulesData in project symja_android_library by axkr.
the class PatternMatching method optionsList.
/**
* Returns a list of the default options of a symbol defined by <code>Option(f)={a->b,...}</code>.
*
* @param symbol
* @param optionValueRules convert to "string"" rules, suitable for <code>OptionValue
* </code>
* @return
*/
public static IAST optionsList(ISymbol symbol, boolean optionValueRules) {
RulesData rules = symbol.getRulesData();
if (rules != null) {
Map<IExpr, PatternMatcherEquals> map = rules.getEqualDownRules();
PatternMatcherEquals matcher = map.get(F.Options(symbol));
if (matcher != null) {
IExpr temp = matcher.getRHS();
if (optionValueRules) {
IASTAppendable result = F.ListAlloc(10);
extractRules(temp, result);
return result;
}
if (temp.isList()) {
return (IAST) temp;
}
return F.list(temp);
}
}
return F.CEmptyList;
}
Aggregations