Search in sources :

Example 21 with JsIgnore

use of jsinterop.annotations.JsIgnore in project edumips64 by lupino3.

the class Instruction method FromInstruction.

@JsIgnore()
public static Instruction FromInstruction(InstructionInterface i) {
    if (i == null) {
        return null;
    }
    Instruction instruction = new Instruction();
    instruction.Name = i.getName();
    instruction.Code = i.getFullName();
    instruction.SerialNumber = i.getSerialNumber();
    instruction.Comment = i.getComment();
    instruction.BinaryRepresentation = i.getRepr().getBinString();
    instruction.OpCode = instruction.BinaryRepresentation.substring(0, 6);
    ParsedInstructionMetadata meta = i.getParsingMetadata();
    if (meta != null) {
        instruction.Address = meta.address;
        instruction.Line = meta.sourceLine;
    }
    return instruction;
}
Also used : ParsedInstructionMetadata(org.edumips64.core.is.ParsedInstructionMetadata) JsIgnore(jsinterop.annotations.JsIgnore)

Example 22 with JsIgnore

use of jsinterop.annotations.JsIgnore in project deephaven-core by deephaven.

the class JsTotalsTableConfig method parse.

/**
 * Implementation from TotalsTableBuilder.fromDirective, plus changes required to make this able to act on plan JS
 * objects/arrays.
 *
 * Note that this omits groupBy for now, until the server directive format supports it!
 */
@JsIgnore
public static JsTotalsTableConfig parse(String configString) {
    JsTotalsTableConfig builder = new JsTotalsTableConfig();
    if (configString == null || configString.isEmpty()) {
        return builder;
    }
    final String[] splitSemi = configString.split(";");
    final String[] frontMatter = splitSemi[0].split(",");
    if (frontMatter.length < 3) {
        throw new IllegalArgumentException("Invalid Totals Table: " + configString);
    }
    builder.showTotalsByDefault = Boolean.parseBoolean(frontMatter[0]);
    builder.showGrandTotalsByDefault = Boolean.parseBoolean(frontMatter[1]);
    builder.defaultOperation = frontMatter[2];
    checkOperation(builder.defaultOperation);
    if (splitSemi.length > 1) {
        final String[] columnDirectives = splitSemi[1].split(",");
        for (final String columnDirective : columnDirectives) {
            if (columnDirective.trim().isEmpty())
                continue;
            final String[] kv = columnDirective.split("=");
            if (kv.length != 2) {
                throw new IllegalArgumentException("Invalid Totals Table: " + configString + ", bad column " + columnDirective);
            }
            final String[] operations = kv[1].split(":");
            builder.operationMap.set(kv[0], new JsArray<>());
            for (String op : operations) {
                checkOperation(op);
                builder.operationMap.get(kv[0]).push(Js.<JsString>cast(op));
            }
        }
    }
    return builder;
}
Also used : JsString(elemental2.core.JsString) JsIgnore(jsinterop.annotations.JsIgnore)

Example 23 with JsIgnore

use of jsinterop.annotations.JsIgnore in project deephaven-core by deephaven.

the class TableMap method notifyKeyAdded.

@JsIgnore
public void notifyKeyAdded(Object key) {
    LocalKey k = LocalKey.of(key);
    if (!tables.containsKey(k)) {
        put(key, k);
        CustomEventInit init = CustomEventInit.create();
        init.setDetail(key);
        fireEvent(EVENT_KEYADDED, init);
    }
}
Also used : CustomEventInit(elemental2.dom.CustomEventInit) JsIgnore(jsinterop.annotations.JsIgnore)

Example 24 with JsIgnore

use of jsinterop.annotations.JsIgnore in project deephaven-core by deephaven.

the class JsDateTimeFormat method parseWithTimezoneAsLong.

@JsIgnore
public long parseWithTimezoneAsLong(String dateTimeString, com.google.gwt.i18n.client.TimeZone timeZone, boolean needsAdjustment) {
    final long nanos = parse(dateTimeString, null).getWrapped();
    final int remainder = (int) (nanos % JsDateTimeFormat.NANOS_PER_MILLI);
    long millis = nanos / JsDateTimeFormat.NANOS_PER_MILLI;
    final Date date = new Date(millis);
    final int diff = (date.getTimezoneOffset() - timeZone.getStandardOffset()) * NUM_MILLISECONDS_IN_MINUTE;
    // Adjust time for timezone offset difference
    millis -= diff;
    final int[] transitionPoints = getTransitionPoints(timeZone);
    // If there are no transition points, skip the dst adjustment
    if (needsAdjustment && transitionPoints != null) {
        final int timeInHours = (int) (millis / 1000 / 3600);
        int index = Arrays.binarySearch(transitionPoints, timeInHours);
        if (index < 0) {
            index = Math.abs(index) - 1;
        }
        // Change to a zero based index
        index = index - 1;
        final int transitionPoint = (index < 0) ? 0 : transitionPoints[index];
        final int[] adjustments = getAdjustments(timeZone);
        final int adjustment = (index < 0) ? 0 : adjustments[index];
        // Adjust time for DST transition
        millis = millis - (adjustment * NUM_MILLISECONDS_IN_MINUTE);
        // Look for times that occur during the DST transition
        // Adjustment is in minutes, so convert everything to minutes
        final int timeInMinutes = (int) (millis / NUM_MILLISECONDS_IN_MINUTE);
        final int transitionMinutes = transitionPoint * 60;
        // This is the Spring DST transition Check
        if (timeInMinutes > transitionMinutes && timeInMinutes < transitionMinutes + adjustment) {
            // The format call is expensive, so we check the transition plus adjustment first
            final String formatAfterAdjustment = format(LongWrapper.of(millis * NANOS_PER_MILLI), new JsTimeZone(timeZone));
            if (!formatAfterAdjustment.equals(dateTimeString)) {
                throw new IllegalArgumentException(dateTimeString + " occurs during a DST transition" + " timeInMinutes = " + timeInMinutes + " transitionMinutes = " + transitionMinutes + " adjustment = " + adjustment);
            }
        }
        if (index < transitionPoints.length - 1) {
            final int nextTransitionMinutes = transitionPoints[index + 1] * 60;
            final int nextAdjustment = adjustments[index + 1];
            if (timeInMinutes > nextTransitionMinutes && timeInMinutes < nextTransitionMinutes + nextAdjustment) {
                // The format call is expensive, so we check the transition plus adjustment first
                final String formatAfterAdjustment = format(LongWrapper.of(millis * NANOS_PER_MILLI), new JsTimeZone(timeZone));
                if (!formatAfterAdjustment.equals(dateTimeString)) {
                    throw new IllegalArgumentException(dateTimeString + " occurs during a DST transition" + " timeInMinutes = " + timeInMinutes + " nextTransitionMinutes = " + nextTransitionMinutes + " nextAdjustment = " + nextAdjustment);
                }
            }
        }
        // This is the Fall DST transition check
        if (adjustment == 0 && index > 0) {
            final int prevAdjustment = adjustments[index - 1];
            if (timeInMinutes > transitionMinutes && timeInMinutes < transitionMinutes + prevAdjustment) {
                throw new IllegalArgumentException(dateTimeString + " occurs during a DST transition" + " timeInMinutes = " + timeInMinutes + " transitionMinutes = " + transitionMinutes + " prevAdjustment = " + prevAdjustment);
            }
        }
        if (index < transitionPoints.length - 1) {
            final int nextAdjustment = adjustments[index + 1];
            if (nextAdjustment == 0) {
                final int nextTransitionMinutes = transitionPoints[index + 1] * 60;
                if (timeInMinutes < nextTransitionMinutes && timeInMinutes > nextTransitionMinutes - adjustment) {
                    throw new IllegalArgumentException(dateTimeString + " occurs during a DST transition" + " timeInMinutes = " + timeInMinutes + " nextTransitionMinutes = " + nextTransitionMinutes + " adjustment = " + adjustment);
                }
            }
        }
    }
    return millis * JsDateTimeFormat.NANOS_PER_MILLI + remainder;
}
Also used : JsDate(elemental2.core.JsDate) JsIgnore(jsinterop.annotations.JsIgnore)

Example 25 with JsIgnore

use of jsinterop.annotations.JsIgnore in project deephaven-core by deephaven.

the class JsFigure method verifyTables.

/**
 * Verifies that the underlying tables have the columns the series are expected. Throws an FigureSourceException if
 * not found
 */
@JsIgnore
public void verifyTables() {
    Arrays.stream(charts).flatMap(c -> Arrays.stream(c.getSeries())).forEach(s -> {
        JsTable table = tableForSeries(s);
        Arrays.stream(s.getSources()).forEach(source -> {
            try {
                table.findColumn(source.getDescriptor().getColumnName());
            } catch (NoSuchElementException e) {
                throw new FigureSourceException(table, source, e.toString());
            }
        });
    });
}
Also used : Arrays(java.util.Arrays) JsOptional(jsinterop.annotations.JsOptional) JsBiConsumer(io.deephaven.web.shared.fu.JsBiConsumer) HashMap(java.util.HashMap) HasEventHandling(io.deephaven.web.client.api.HasEventHandling) Promise(elemental2.promise.Promise) JsPropertyMap(jsinterop.base.JsPropertyMap) Callbacks(io.deephaven.web.client.api.Callbacks) JsProperty(jsinterop.annotations.JsProperty) HashSet(java.util.HashSet) Js(jsinterop.base.Js) FetchObjectResponse(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.object_pb.FetchObjectResponse) WorkerConnection(io.deephaven.web.client.api.WorkerConnection) JsTable(io.deephaven.web.client.api.JsTable) Map(java.util.Map) JsType(jsinterop.annotations.JsType) NoSuchElementException(java.util.NoSuchElementException) LazyPromise(io.deephaven.web.client.fu.LazyPromise) JsObject(elemental2.core.JsObject) TableMap(io.deephaven.web.client.api.TableMap) AxisDescriptor(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.console_pb.figuredescriptor.AxisDescriptor) JsLog(io.deephaven.web.client.fu.JsLog) FigureDescriptor(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.console_pb.FigureDescriptor) Set(java.util.Set) ClientTableState(io.deephaven.web.client.state.ClientTableState) CustomEventInit(elemental2.dom.CustomEventInit) ExportedTableCreationResponse(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.ExportedTableCreationResponse) Collectors(java.util.stream.Collectors) JsArray(elemental2.core.JsArray) JsIgnore(jsinterop.annotations.JsIgnore) Stream(java.util.stream.Stream) JsTable(io.deephaven.web.client.api.JsTable) NoSuchElementException(java.util.NoSuchElementException) JsIgnore(jsinterop.annotations.JsIgnore)

Aggregations

JsIgnore (jsinterop.annotations.JsIgnore)41 ModelNode (org.jboss.hal.dmr.ModelNode)11 Composite (org.jboss.hal.dmr.Composite)10 Operation (org.jboss.hal.dmr.Operation)10 ResourceAddress (org.jboss.hal.dmr.ResourceAddress)9 Map (java.util.Map)7 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)6 CustomEventInit (elemental2.dom.CustomEventInit)6 Set (java.util.Set)6 JsProperty (jsinterop.annotations.JsProperty)6 JsType (jsinterop.annotations.JsType)5 AddResourceDialog (org.jboss.hal.core.mbui.dialog.AddResourceDialog)5 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)5 CompositeResult (org.jboss.hal.dmr.CompositeResult)5 Property (org.jboss.hal.dmr.Property)5 Iterables (com.google.common.collect.Iterables)4 EventBus (com.google.web.bindery.event.shared.EventBus)4 Collectors.toSet (java.util.stream.Collectors.toSet)4 StreamSupport.stream (java.util.stream.StreamSupport.stream)4 Nullable (javax.annotation.Nullable)4