use of org.apache.commons.lang.NotImplementedException in project systemml by apache.
the class Program method clone.
public Program clone(boolean deep) {
if (deep)
throw new NotImplementedException();
Program ret = new Program();
// shallow copy of all program blocks
ret._programBlocks.addAll(_programBlocks);
// functions, which require a deep copy
for (Entry<String, HashMap<String, FunctionProgramBlock>> e1 : _namespaceFunctions.entrySet()) for (Entry<String, FunctionProgramBlock> e2 : e1.getValue().entrySet()) {
FunctionProgramBlock fpb = e2.getValue();
if (fpb instanceof ExternalFunctionProgramBlock)
fpb = createPartialDeepCopy(ret, (ExternalFunctionProgramBlock) fpb);
ret.addFunctionProgramBlock(e1.getKey(), e2.getKey(), fpb);
}
return ret;
}
use of org.apache.commons.lang.NotImplementedException in project accumulo by apache.
the class ZooTabletStateStore method iterator.
@Override
public ClosableIterator<TabletLocationState> iterator() {
return new ClosableIterator<TabletLocationState>() {
boolean finished = false;
@Override
public boolean hasNext() {
return !finished;
}
@Override
public TabletLocationState next() {
finished = true;
try {
byte[] future = store.get(RootTable.ZROOT_TABLET_FUTURE_LOCATION);
byte[] current = store.get(RootTable.ZROOT_TABLET_LOCATION);
byte[] last = store.get(RootTable.ZROOT_TABLET_LAST_LOCATION);
TServerInstance currentSession = null;
TServerInstance futureSession = null;
TServerInstance lastSession = null;
if (future != null)
futureSession = parse(future);
if (last != null)
lastSession = parse(last);
if (current != null) {
currentSession = parse(current);
futureSession = null;
}
List<Collection<String>> logs = new ArrayList<>();
for (String entry : store.getChildren(RootTable.ZROOT_TABLET_WALOGS)) {
byte[] logInfo = store.get(RootTable.ZROOT_TABLET_WALOGS + "/" + entry);
if (logInfo != null) {
LogEntry logEntry = LogEntry.fromBytes(logInfo);
logs.add(Collections.singleton(logEntry.filename));
log.debug("root tablet log {}", logEntry.filename);
}
}
TabletLocationState result = new TabletLocationState(RootTable.EXTENT, futureSession, currentSession, lastSession, null, logs, false);
log.debug("Returning root tablet state: {}", result);
return result;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
@Override
public void remove() {
throw new NotImplementedException();
}
@Override
public void close() {
}
};
}
use of org.apache.commons.lang.NotImplementedException in project mist by snuspl.
the class CepUtils method cepActionTranslator.
/**
* Add output of cep action to cep qualifier.
* @param qualifierFilterStream
* @param cepAction cep action
*/
private static <T> void cepActionTranslator(final ContinuousStream<Map<String, List<T>>> qualifierFilterStream, final CepAction cepAction) {
final CepSink sink = cepAction.getCepSink();
final String separator = sink.getSeparator();
final List<Object> params = cepAction.getParams();
final StringBuilder outputBuilder = new StringBuilder();
for (final Object iterParam : params) {
outputBuilder.append(iterParam.toString());
outputBuilder.append(separator);
}
if (outputBuilder.length() == 0) {
throw new NullPointerException("No Parameters for cep sink!");
}
outputBuilder.delete(outputBuilder.length() - separator.length(), outputBuilder.length());
switch(sink.getCepSinkType()) {
case TEXT_SOCKET_OUTPUT:
{
qualifierFilterStream.map(s -> outputBuilder.toString()).textSocketOutput((String) sink.getSinkConfigs().get("SOCKET_SINK_ADDRESS"), (int) sink.getSinkConfigs().get("SOCKET_SINK_PORT"));
break;
}
case MQTT_OUTPUT:
{
qualifierFilterStream.map(s -> new MqttMessage(outputBuilder.toString().getBytes())).mqttOutput((String) sink.getSinkConfigs().get("MQTT_SINK_BROKER_URI"), (String) sink.getSinkConfigs().get("MQTT_SINK_TOPIC"));
}
default:
throw new NotImplementedException("TEXT_SOCKET_OUTPUT and MQTT_OUTPUT are supported now!: " + sink.getCepSinkType().toString());
}
}
use of org.apache.commons.lang.NotImplementedException in project intellij-elixir by KronicDeth.
the class Time method getComparator.
/*
* Constructors
*/
/**
* Returns the comparator used for comparing nodes in the tree.
*
* @return the comparator for comparing nodes.
*/
@Override
public Comparator getComparator() {
return new Comparator() {
@Override
public int compare(Object o1, Object o2) {
int comparison;
if (o1 instanceof Timed && o2 instanceof Timed) {
Timed timed1 = (Timed) o1;
Timed timed2 = (Timed) o2;
Timed.Time time1 = timed1.time();
Timed.Time time2 = timed2.time();
if (time1 == time2) {
comparison = 0;
} else if (time1 == Timed.Time.COMPILE && time2 == Timed.Time.RUN) {
comparison = -1;
} else if (time1 == Timed.Time.RUN && time2 == Timed.Time.COMPILE) {
comparison = 1;
} else {
throw new NotImplementedException("Only COMPILE and RUN time are expected");
}
} else if (o1 instanceof Timed && !(o2 instanceof Timed)) {
Timed timed1 = (Timed) o1;
Timed.Time time1 = timed1.time();
switch(time1) {
case COMPILE:
comparison = -1;
break;
case RUN:
comparison = 1;
break;
default:
throw new NotImplementedException("Only COMPILE and RUN time are expected");
}
} else if (!(o1 instanceof Timed) && o2 instanceof Timed) {
Timed timed2 = (Timed) o2;
Timed.Time time2 = timed2.time();
switch(time2) {
case COMPILE:
comparison = 1;
break;
case RUN:
comparison = -1;
break;
default:
throw new NotImplementedException("Only COMPILE and RUN time are expected");
}
} else {
assert !(o1 instanceof Timed) && !(o2 instanceof Timed);
comparison = 0;
}
return comparison;
}
};
}
use of org.apache.commons.lang.NotImplementedException in project OpenRefine by OpenRefine.
the class TermedStatementEntityEdit method toEntityUpdate.
/**
* In case the subject id is not new, returns the corresponding update given
* the current state of the entity.
*/
public EntityUpdate toEntityUpdate(EntityDocument entityDocument) {
Validate.isFalse(isNew(), "Cannot create a corresponding entity update for a creation of a new entity.");
if (id instanceof ItemIdValue) {
ItemDocument itemDocument = (ItemDocument) entityDocument;
// Labels
List<MonolingualTextValue> labels = getLabels().stream().collect(Collectors.toList());
labels.addAll(getLabelsIfNew().stream().filter(label -> !itemDocument.getLabels().containsKey(label.getLanguageCode())).collect(Collectors.toList()));
TermUpdate labelUpdate = Datamodel.makeTermUpdate(labels, Collections.emptyList());
// Descriptions
List<MonolingualTextValue> descriptions = getDescriptions().stream().collect(Collectors.toList());
descriptions.addAll(getDescriptionsIfNew().stream().filter(desc -> !itemDocument.getDescriptions().containsKey(desc.getLanguageCode())).collect(Collectors.toList()));
TermUpdate descriptionUpdate = Datamodel.makeTermUpdate(descriptions, Collections.emptyList());
// Aliases
Set<MonolingualTextValue> aliases = getAliases();
Map<String, List<MonolingualTextValue>> aliasesMap = aliases.stream().collect(Collectors.groupingBy(MonolingualTextValue::getLanguageCode));
Map<String, AliasUpdate> aliasMap = aliasesMap.entrySet().stream().collect(Collectors.toMap(Entry::getKey, e -> Datamodel.makeAliasUpdate(e.getValue(), Collections.emptyList())));
// Statements
StatementUpdate statementUpdate = toStatementUpdate(itemDocument);
return Datamodel.makeItemUpdate((ItemIdValue) getEntityId(), entityDocument.getRevisionId(), labelUpdate, descriptionUpdate, aliasMap, statementUpdate, Collections.emptyList(), Collections.emptyList());
} else if (id instanceof MediaInfoIdValue) {
MediaInfoDocument mediaInfoDocument = (MediaInfoDocument) entityDocument;
// Labels (captions)
List<MonolingualTextValue> labels = getLabels().stream().collect(Collectors.toList());
labels.addAll(getLabelsIfNew().stream().filter(label -> !mediaInfoDocument.getLabels().containsKey(label.getLanguageCode())).collect(Collectors.toList()));
TermUpdate labelUpdate = Datamodel.makeTermUpdate(labels, Collections.emptyList());
// Statements
StatementUpdate statementUpdate = toStatementUpdate(mediaInfoDocument);
return Datamodel.makeMediaInfoUpdate((MediaInfoIdValue) id, entityDocument.getRevisionId(), labelUpdate, statementUpdate);
} else {
throw new NotImplementedException("Editing entities of type " + id.getEntityType() + " is not supported yet.");
}
}
Aggregations