/** Creates a mapping with required properties. */
 public static Mapping create(MappingType mappingType, int sourceCount, int targetCount) {
   switch (mappingType) {
     case BIJECTION:
       assert sourceCount == targetCount;
       return new Permutation(sourceCount);
     case INVERSE_SURJECTION:
       assert sourceCount >= targetCount;
       return new SurjectionWithInverse(sourceCount, targetCount);
     case PARTIAL_SURJECTION:
     case SURJECTION:
       return new Mappings.PartialMapping(sourceCount, targetCount, mappingType);
     case PARTIAL_FUNCTION:
     case FUNCTION:
       return new PartialFunctionImpl(sourceCount, targetCount, mappingType);
     case INVERSE_FUNCTION:
     case INVERSE_PARTIAL_FUNCTION:
       return new InverseMapping(create(mappingType.inverse(), targetCount, sourceCount));
     default:
       throw Util.needToImplement("no known implementation for mapping type " + mappingType);
   }
 }
 public Iterator<IntPair> iterator() {
   throw Util.needToImplement(this);
 }
Ejemplo n.º 3
0
 public Variable getConnectionVariable() {
   throw Util.needToImplement("getConnectionVariable");
 }
Ejemplo n.º 4
0
 public void unparse(
     SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) {
   // You probably need to override the operator's unparse
   // method.
   throw Util.needToImplement(this);
 }
Ejemplo n.º 5
0
 /**
  * Reduces a list of operators and arguments according to the rules of precedence and
  * associativity. Returns the ordinal of the node which replaced the expression.
  *
  * <p>The default implementation throws {@link UnsupportedOperationException}.
  *
  * @param ordinal indicating the ordinal of the current operator in the list on which a possible
  *     reduction can be made
  * @param list List of alternating {@link org.eigenbase.sql.parser.SqlParserUtil.ToTreeListItem}
  *     and {@link SqlNode}
  * @return ordinal of the node which replaced the expression
  */
 public int reduceExpr(int ordinal, List<Object> list) {
   throw Util.needToImplement(this);
 }