Search in sources :

Example 26 with NotImplementedException

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;
}
Also used : Entry(java.util.Map.Entry) DMLProgram(org.apache.sysml.parser.DMLProgram) HashMap(java.util.HashMap) NotImplementedException(org.apache.commons.lang.NotImplementedException)

Example 27 with NotImplementedException

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() {
        }
    };
}
Also used : NotImplementedException(org.apache.commons.lang.NotImplementedException) ArrayList(java.util.ArrayList) Collection(java.util.Collection) LogEntry(org.apache.accumulo.core.tabletserver.log.LogEntry) IOException(java.io.IOException) NotImplementedException(org.apache.commons.lang.NotImplementedException)

Example 28 with NotImplementedException

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());
    }
}
Also used : MqttMessage(org.eclipse.paho.client.mqttv3.MqttMessage) NotImplementedException(org.apache.commons.lang.NotImplementedException)

Example 29 with NotImplementedException

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;
        }
    };
}
Also used : Timed(org.elixir_lang.structure_view.element.Timed) NotImplementedException(org.apache.commons.lang.NotImplementedException) Comparator(java.util.Comparator)

Example 30 with NotImplementedException

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.");
    }
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) StatementUpdateBuilder(org.wikidata.wdtk.datamodel.helpers.StatementUpdateBuilder) HashMap(java.util.HashMap) MediaInfoDocument(org.wikidata.wdtk.datamodel.interfaces.MediaInfoDocument) EntityDocument(org.wikidata.wdtk.datamodel.interfaces.EntityDocument) ArrayList(java.util.ArrayList) StatementGroup(org.wikidata.wdtk.datamodel.interfaces.StatementGroup) TermUpdate(org.wikidata.wdtk.datamodel.interfaces.TermUpdate) HashSet(java.util.HashSet) StatementEditingMode(org.openrefine.wikidata.schema.strategies.StatementEditingMode) TermedStatementDocument(org.wikidata.wdtk.datamodel.interfaces.TermedStatementDocument) ItemIdValue(org.wikidata.wdtk.datamodel.interfaces.ItemIdValue) Map(java.util.Map) NotImplementedException(org.apache.commons.lang.NotImplementedException) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) EntityUpdate(org.wikidata.wdtk.datamodel.interfaces.EntityUpdate) EntityIdValue(org.wikidata.wdtk.datamodel.interfaces.EntityIdValue) StatementDocument(org.wikidata.wdtk.datamodel.interfaces.StatementDocument) LinkedList(java.util.LinkedList) MonolingualTextValue(org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue) Validate(org.jsoup.helper.Validate) Collection(java.util.Collection) PropertyIdValue(org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue) Set(java.util.Set) Statement(org.wikidata.wdtk.datamodel.interfaces.Statement) Collectors(java.util.stream.Collectors) AliasUpdate(org.wikidata.wdtk.datamodel.interfaces.AliasUpdate) MediaInfoIdValue(org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValue) StatementUpdate(org.wikidata.wdtk.datamodel.interfaces.StatementUpdate) List(java.util.List) Datamodel(org.wikidata.wdtk.datamodel.helpers.Datamodel) Entry(java.util.Map.Entry) ItemDocument(org.wikidata.wdtk.datamodel.interfaces.ItemDocument) Collections(java.util.Collections) MediaInfoIdValue(org.wikidata.wdtk.datamodel.interfaces.MediaInfoIdValue) StatementUpdate(org.wikidata.wdtk.datamodel.interfaces.StatementUpdate) MediaInfoDocument(org.wikidata.wdtk.datamodel.interfaces.MediaInfoDocument) NotImplementedException(org.apache.commons.lang.NotImplementedException) MonolingualTextValue(org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue) ItemIdValue(org.wikidata.wdtk.datamodel.interfaces.ItemIdValue) ItemDocument(org.wikidata.wdtk.datamodel.interfaces.ItemDocument) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) AliasUpdate(org.wikidata.wdtk.datamodel.interfaces.AliasUpdate) TermUpdate(org.wikidata.wdtk.datamodel.interfaces.TermUpdate)

Aggregations

NotImplementedException (org.apache.commons.lang.NotImplementedException)36 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Path (org.apache.hadoop.fs.Path)4 ASTNode (com.intellij.lang.ASTNode)3 IElementType (com.intellij.psi.tree.IElementType)3 File (java.io.File)3 Collection (java.util.Collection)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 Entry (java.util.Map.Entry)3 NotNull (org.jetbrains.annotations.NotNull)3 LeafPsiElement (com.intellij.psi.impl.source.tree.LeafPsiElement)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Set (java.util.Set)2 TableName (org.apache.hadoop.hbase.TableName)2 DMLProgram (org.apache.sysml.parser.DMLProgram)2 XSDConstrainingFacet (org.eclipse.xsd.XSDConstrainingFacet)2