use of org.apache.commons.lang.NotImplementedException in project h2o-2 by h2oai.
the class Tree method getSkip.
public static int getSkip(AutoBuffer ab, int leftSize, boolean regression) {
int numLeaves = 0;
int numLeftLeaves = 0;
int startPos = ab.position();
boolean prevIsS = false;
while (ab.position() < startPos + leftSize) {
byte currentNodeType = (byte) ab.get1();
if (currentNodeType == 'S' || currentNodeType == 'E') {
// skip col and split value.
ab.get2();
// skip col and split value.
ab.get4f();
int skipSize = ab.get1();
if (skipSize == 0) {
ab.get3();
}
prevIsS = true;
} else if (currentNodeType == '[') {
numLeaves++;
if (regression)
ab.get4f();
else
ab.get1();
if (prevIsS)
numLeftLeaves++;
prevIsS = false;
} else {
throw new NotImplementedException();
}
}
ab.position(startPos);
// only for regression tree.
return 2 * numLeaves - numLeftLeaves;
}
use of org.apache.commons.lang.NotImplementedException in project symmetric-ds by JumpMind.
the class AbstractTriggerTemplate method fillOutColumnTemplate.
protected ColumnString fillOutColumnTemplate(String origTableAlias, String tableAlias, String columnPrefix, Table table, Column column, DataEventType dml, boolean isOld, Channel channel, Trigger trigger) {
boolean isLob = symmetricDialect.getPlatform().isLob(column.getMappedTypeCode());
String templateToUse = null;
if (column.getJdbcTypeName() != null && (column.getJdbcTypeName().toUpperCase().contains(TypeMap.GEOMETRY)) && StringUtils.isNotBlank(geometryColumnTemplate)) {
templateToUse = geometryColumnTemplate;
} else if (column.getJdbcTypeName() != null && (column.getJdbcTypeName().toUpperCase().contains(TypeMap.GEOGRAPHY)) && StringUtils.isNotBlank(geographyColumnTemplate)) {
templateToUse = geographyColumnTemplate;
} else {
switch(column.getMappedTypeCode()) {
case Types.TINYINT:
case Types.SMALLINT:
case Types.INTEGER:
case Types.BIGINT:
case Types.FLOAT:
case Types.REAL:
case Types.DOUBLE:
case Types.NUMERIC:
case Types.DECIMAL:
templateToUse = numberColumnTemplate;
break;
case Types.CHAR:
case Types.NCHAR:
case Types.VARCHAR:
case ColumnTypes.NVARCHAR:
templateToUse = stringColumnTemplate;
break;
case ColumnTypes.SQLXML:
templateToUse = xmlColumnTemplate;
break;
case Types.ARRAY:
templateToUse = arrayColumnTemplate;
break;
case Types.LONGVARCHAR:
case ColumnTypes.LONGNVARCHAR:
if (!isLob) {
templateToUse = stringColumnTemplate;
break;
}
case Types.CLOB:
if (isOld && symmetricDialect.needsToSelectLobData()) {
templateToUse = emptyColumnTemplate;
} else {
templateToUse = clobColumnTemplate;
}
break;
case Types.BINARY:
case Types.VARBINARY:
if (isNotBlank(binaryColumnTemplate)) {
templateToUse = binaryColumnTemplate;
break;
}
case Types.BLOB:
if (requiresWrappedBlobTemplateForBlobType()) {
templateToUse = wrappedBlobColumnTemplate;
break;
}
case Types.LONGVARBINARY:
case // SQL-Server ntext binary type
-10:
if (column.getJdbcTypeName() != null && (column.getJdbcTypeName().toUpperCase().contains(TypeMap.IMAGE)) && StringUtils.isNotBlank(imageColumnTemplate)) {
if (isOld) {
templateToUse = emptyColumnTemplate;
} else {
templateToUse = imageColumnTemplate;
}
} else if (isOld && symmetricDialect.needsToSelectLobData()) {
templateToUse = emptyColumnTemplate;
} else {
templateToUse = blobColumnTemplate;
}
break;
case Types.DATE:
if (noDateColumnTemplate()) {
templateToUse = datetimeColumnTemplate;
break;
}
templateToUse = dateColumnTemplate;
break;
case Types.TIME:
if (noTimeColumnTemplate()) {
templateToUse = datetimeColumnTemplate;
break;
}
templateToUse = timeColumnTemplate;
break;
case Types.TIMESTAMP:
templateToUse = datetimeColumnTemplate;
break;
case Types.BOOLEAN:
case Types.BIT:
templateToUse = booleanColumnTemplate;
break;
default:
if (column.getJdbcTypeName() != null) {
if (column.getJdbcTypeName().toUpperCase().equals(TypeMap.INTERVAL)) {
templateToUse = numberColumnTemplate;
break;
} else if (column.getMappedType().equals(TypeMap.TIMESTAMPTZ) && StringUtils.isNotBlank(this.dateTimeWithTimeZoneColumnTemplate)) {
templateToUse = this.dateTimeWithTimeZoneColumnTemplate;
break;
} else if (column.getMappedType().equals(TypeMap.TIMESTAMPLTZ) && StringUtils.isNotBlank(this.dateTimeWithLocalTimeZoneColumnTemplate)) {
templateToUse = this.dateTimeWithLocalTimeZoneColumnTemplate;
break;
}
}
if (StringUtils.isBlank(templateToUse) && StringUtils.isNotBlank(this.otherColumnTemplate)) {
templateToUse = this.otherColumnTemplate;
break;
}
throw new NotImplementedException(column.getName() + " is of type " + column.getMappedType() + " with JDBC type of " + column.getJdbcTypeName());
}
}
if (dml == DataEventType.DELETE && isLob && requiresEmptyLobTemplateForDeletes()) {
templateToUse = emptyColumnTemplate;
} else if (isLob && trigger.isUseStreamLobs()) {
templateToUse = emptyColumnTemplate;
}
if (templateToUse != null) {
templateToUse = templateToUse.trim();
} else {
throw new NotImplementedException();
}
String formattedColumnText = FormatUtils.replace("columnName", String.format("%s%s", columnPrefix, column.getName()), templateToUse);
formattedColumnText = FormatUtils.replace("columnSize", getColumnSize(table, column), formattedColumnText);
formattedColumnText = FormatUtils.replace("masterCollation", symmetricDialect.getMasterCollation(), formattedColumnText);
if (isLob) {
formattedColumnText = symmetricDialect.massageForLob(formattedColumnText, channel);
}
formattedColumnText = FormatUtils.replace("origTableAlias", origTableAlias, formattedColumnText);
formattedColumnText = FormatUtils.replace("tableAlias", tableAlias, formattedColumnText);
formattedColumnText = FormatUtils.replace("prefixName", symmetricDialect.getTablePrefix(), formattedColumnText);
return new ColumnString(formattedColumnText, isLob);
}
use of org.apache.commons.lang.NotImplementedException in project intellij-elixir by KronicDeth.
the class ElixirPsiImplUtil method quote.
@Contract(pure = true)
@NotNull
public static OtpErlangObject quote(@NotNull final In in) {
PsiElement[] children = in.getChildren();
if (children.length != 3) {
throw new NotImplementedException("BinaryOperation expected to have 3 children (left operand, operator, right operand");
}
Quotable leftOperand = (Quotable) children[0];
OtpErlangObject quotedLeftOperand = leftOperand.quote();
Quotable operator = (Quotable) children[1];
OtpErlangObject quotedOperator = operator.quote();
Quotable rightOperand = (Quotable) children[2];
OtpErlangObject quotedRightOperand = rightOperand.quote();
OtpErlangObject quoted = null;
// @see https://github.com/elixir-lang/elixir/blob/6c288be7300509ff7b809002a3563c6a02dc13fa/lib/elixir/src/elixir_parser.yrl#L583
if (Macro.isExpression(quotedLeftOperand)) {
OtpErlangTuple leftExpression = (OtpErlangTuple) quotedLeftOperand;
OtpErlangObject leftOperator = leftExpression.elementAt(0);
for (OtpErlangAtom rearrangedUnaryOperator : REARRANGED_UNARY_OPERATORS) {
/* build_op({_Kind, Line, 'in'}, {UOp, _, [Left]}, Right) when ?rearrange_uop(UOp) ->
{UOp, meta(Line), [{'in', meta(Line), [Left, Right]}]}; */
if (leftOperator.equals(rearrangedUnaryOperator)) {
OtpErlangObject unaryOperatorArguments = leftExpression.elementAt(2);
OtpErlangObject originalUnaryOperand;
if (unaryOperatorArguments instanceof OtpErlangString) {
OtpErlangString unaryOperatorPrintableArguments = (OtpErlangString) unaryOperatorArguments;
int codePoint = unaryOperatorPrintableArguments.stringValue().codePointAt(0);
originalUnaryOperand = new OtpErlangLong(codePoint);
} else if (unaryOperatorArguments instanceof OtpErlangList) {
OtpErlangList unaryOperatorArgumentList = (OtpErlangList) unaryOperatorArguments;
originalUnaryOperand = unaryOperatorArgumentList.elementAt(0);
} else {
throw new NotImplementedException("Expected REARRANGED_UNARY_OPERATORS operand to be quoted as an OtpErlangString or OtpErlangList");
}
OtpErlangList operatorMetadata = metadata(operator);
quoted = quotedFunctionCall(leftOperator, operatorMetadata, quotedFunctionCall(quotedOperator, operatorMetadata, originalUnaryOperand, quotedRightOperand));
}
}
}
if (quoted == null) {
quoted = quotedFunctionCall(quotedOperator, metadata(operator), quotedLeftOperand, quotedRightOperand);
}
return quoted;
}
use of org.apache.commons.lang.NotImplementedException in project iaf by ibissource.
the class XMLSchemaFactory method newSchema.
public Schema newSchema(Source[] schemas) throws SAXException {
// this will let the loader store parsed Grammars into the pool.
XMLGrammarPoolImplExtension pool = new XMLGrammarPoolImplExtension();
fXMLGrammarPoolWrapper.setGrammarPool(pool);
XMLInputSource[] xmlInputSources = new XMLInputSource[schemas.length];
InputStream inputStream;
Reader reader;
for (int i = 0; i < schemas.length; ++i) {
Source source = schemas[i];
if (source instanceof StreamSource) {
StreamSource streamSource = (StreamSource) source;
String publicId = streamSource.getPublicId();
String systemId = streamSource.getSystemId();
inputStream = streamSource.getInputStream();
reader = streamSource.getReader();
XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, null);
xmlInputSource.setByteStream(inputStream);
xmlInputSource.setCharacterStream(reader);
xmlInputSources[i] = xmlInputSource;
} else if (source instanceof SAXSource) {
SAXSource saxSource = (SAXSource) source;
InputSource inputSource = saxSource.getInputSource();
if (inputSource == null) {
throw new SAXException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "SAXSourceNullInputSource", null));
}
xmlInputSources[i] = new SAXInputSource(saxSource.getXMLReader(), inputSource);
} else if (source instanceof DOMSource) {
DOMSource domSource = (DOMSource) source;
Node node = domSource.getNode();
String systemID = domSource.getSystemId();
xmlInputSources[i] = new DOMInputSource(node, systemID);
} else // }
if (source == null) {
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "SchemaSourceArrayMemberNull", null));
} else {
throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "SchemaFactorySourceUnrecognized", new Object[] { source.getClass().getName() }));
}
}
try {
fXMLSchemaLoader.loadGrammar(xmlInputSources);
} catch (XNIException e) {
// this should have been reported to users already.
throw Util.toSAXException(e);
} catch (IOException e) {
// this hasn't been reported, so do so now.
SAXParseException se = new SAXParseException(e.getMessage(), null, e);
if (fErrorHandler != null) {
fErrorHandler.error(se);
}
// and we must throw it.
throw se;
}
// Clear reference to grammar pool.
fXMLGrammarPoolWrapper.setGrammarPool(null);
// Select Schema implementation based on grammar count.
final int grammarCount = pool.getGrammarCount();
AbstractXMLSchema schema = null;
if (fUseGrammarPoolOnly) {
throw new NotImplementedException("fUseGrammarPoolOnly");
// if (grammarCount > 1) {
// schema = new XMLSchemaHack(new ReadOnlyGrammarPool(pool));
// }
// else if (grammarCount == 1) {
// Grammar[] grammars = pool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
// schema = new XMLSchemaHack(grammars[0]);
// }
// else {
// schema = new XMLSchemaHack();
// }
} else {
schema = new XMLSchema(new ReadOnlyGrammarPool(pool), false);
}
propagateFeatures(schema);
return schema;
}
use of org.apache.commons.lang.NotImplementedException in project accumulo by apache.
the class VolumeManagerImpl method rename.
@Override
public boolean rename(Path path, Path newPath) throws IOException {
Volume srcVolume = getVolumeByPath(path);
Volume destVolume = getVolumeByPath(newPath);
FileSystem source = srcVolume.getFileSystem();
FileSystem dest = destVolume.getFileSystem();
if (source != dest) {
throw new NotImplementedException("Cannot rename files across volumes: " + path + " -> " + newPath);
}
return source.rename(path, newPath);
}
Aggregations