Tabnine Logo
Parser.isAllowSameVariance
Code IndexAdd Tabnine to your IDE (free)

How to use
isAllowSameVariance
method
in
cc.redberry.core.parser.Parser

Best Java code snippets using cc.redberry.core.parser.Parser.isAllowSameVariance (Showing top 3 results out of 315)

origin: cc.redberry/core

/**
 * Returns whether repeated indices of the same variance are allowed to be parsed
 *
 * @return whether repeated indices of the same variance are allowed to be parsed
 */
public boolean getParserAllowsSameVariance() {
  return parseManager.getParser().isAllowSameVariance();
}
origin: cc.redberry/core

@Override
public final ParseTokenSimpleTensor parseToken(String expression, Parser parser) {
  expression = expression.replaceAll("\\{[\\s]*\\}", "");
  int indicesBegin = expression.indexOf('_'), i = expression.indexOf('^');
  if (indicesBegin < 0 && i >= 0)
    indicesBegin = i;
  if (indicesBegin >= 0 && i >= 0)
    indicesBegin = Math.min(indicesBegin, i);
  if (indicesBegin < 0)
    indicesBegin = expression.length();
  String name = expression.substring(0, indicesBegin);
  if (name.isEmpty())
    throw new ParserException("Simple tensor with empty name.");
  SimpleIndices indices;
  if (parser.isAllowSameVariance())
    indices = ParserIndices.parseSimpleIgnoringVariance(expression.substring(indicesBegin));
  else
    indices = ParserIndices.parseSimple(expression.substring(indicesBegin));
  return new ParseTokenSimpleTensor(indices, name);
}
origin: cc.redberry/core

@Override
public ParseToken parseToken(String expression, Parser parser) {
  ParseToken node = super.parseToken(expression, parser);
  if (node == null || !parser.isAllowSameVariance())
    return node;
  TIntHashSet indices = new TIntHashSet();
  for (ParseToken c : node.content) {
    Indices free = c.getIndices().getFree();
    for (int i = 0; i < free.size(); i++) {
      int ind = free.get(i);
      if (indices.contains(ind))
        revertIndex(c, ind);
      else indices.add(ind);
    }
  }
  return node;
}
cc.redberry.core.parserParserisAllowSameVariance

Popular methods of Parser

  • parse
    Parse string expression into AST.
  • deleteComments
  • setAllowSameVariance

Popular in Java

  • Start an intent from android
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • getSystemService (Context)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now