ctf: Remove deprecated datatypes
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 6 Nov 2014 16:36:49 +0000 (11:36 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 11 Nov 2014 15:34:15 +0000 (10:34 -0500)
Change-Id: I65f2e72c21ecd44993f969b1192e9f5e973be89f
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/36092
Tested-by: Hudson CI
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/ArrayDeclaration.java [deleted file]
org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/ArrayDefinition.java [deleted file]
org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/ScopedDefinition.java
org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/SequenceDeclaration.java [deleted file]
org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/SequenceDefinition.java [deleted file]
org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/Utils.java

diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/ArrayDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/ArrayDeclaration.java
deleted file mode 100644 (file)
index 2194508..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.trace.CTFReaderException;
-
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import com.google.common.collect.Multimap;
-
-/**
- * A CTF array declaration
- *
- * Arrays are fixed-length. Their length is declared in the type declaration
- * within the meta-data. They contain an array of "inner type" elements, which
- * can refer to any type not containing the type of the array being declared (no
- * circular dependency). The length is the number of elements in an array.
- *
- * @deprecated use
- *             {@link org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration}
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-@Deprecated
-public class ArrayDeclaration extends CompoundDeclaration {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private final int fLength;
-    private final IDeclaration fElemType;
-
-    /**
-     * <pre>
-     * Cache where we can pre-generate the children names
-     * Key&colon; parent name
-     * Value&colon; children names
-     * ex: field &#8594; &lbrace;field&lbrack;0&rbrack;, field&lbrack;1&rbrack;, &hellip; field&lbrack;n&rbrack;&rbrace;
-     * </pre>
-     *
-     * TODO: investigate performance
-     */
-    private final Multimap<String, String> fChildrenNames = ArrayListMultimap.<String, String> create();
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     *
-     * @param length
-     *            how many elements in the array
-     * @param elemType
-     *            what type of element is in the array
-     */
-    public ArrayDeclaration(int length, IDeclaration elemType) {
-        fLength = length;
-        fElemType = elemType;
-    }
-
-    // ------------------------------------------------------------------------
-    // Getters/Setters/Predicates
-    // ------------------------------------------------------------------------
-
-    @Override
-    public IDeclaration getElementType() {
-        return fElemType;
-    }
-
-    /**
-     *
-     * @return how many elements in the array
-     */
-    public int getLength() {
-        return fLength;
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 3.0
-     */
-    @Deprecated
-    @Override
-    public ArrayDefinition createDefinition(IDefinitionScope definitionScope,
-            @NonNull String fieldName, BitBuffer input) throws CTFReaderException {
-        alignRead(input);
-        List<Definition> definitions = read(input, definitionScope, fieldName);
-        return new ArrayDefinition(this, definitionScope, fieldName, definitions);
-    }
-
-    @Override
-    public String toString() {
-        /* Only used for debugging */
-        return "[declaration] array[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
-    }
-
-    @NonNull
-    private List<Definition> read(@NonNull BitBuffer input, IDefinitionScope definitionScope, String fieldName) throws CTFReaderException {
-        Builder<Definition> definitions = new ImmutableList.Builder<>();
-        if (!fChildrenNames.containsKey(fieldName)) {
-            for (int i = 0; i < fLength; i++) {
-                fChildrenNames.put(fieldName, fieldName + '[' + i + ']');
-            }
-        }
-        List<String> elemNames = (List<String>) fChildrenNames.get(fieldName);
-        for (int i = 0; i < fLength; i++) {
-            String name = elemNames.get(i);
-            if (name == null) {
-                throw new IllegalStateException();
-            }
-            definitions.add(fElemType.createDefinition(definitionScope, name, input));
-        }
-        @SuppressWarnings("null")
-        @NonNull ImmutableList<Definition> ret = definitions.build();
-        return ret;
-    }
-
-    /**
-     * @since 3.0
-     */
-    @Override
-    public int getMaximumSize() {
-        long val = (long) fLength * fElemType.getMaximumSize();
-        return (int) Math.min(Integer.MAX_VALUE, val);
-    }
-
-}
diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/ArrayDefinition.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/ArrayDefinition.java
deleted file mode 100644 (file)
index 5e21275..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-
-/**
- * A CTF array definition
- *
- * Arrays are fixed-length. Their length is declared in the type declaration
- * within the meta-data. They contain an array of "inner type" elements, which
- * can refer to any type not containing the type of the array being declared (no
- * circular dependency). The length is the number of elements in an array.
- *
- * @deprecated use {@link AbstractArrayDefinition}
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-@NonNullByDefault
-@Deprecated
-public final class ArrayDefinition extends AbstractArrayDefinition{
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private final ImmutableList<Definition> fDefinitions;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     *
-     * @param declaration
-     *            the parent declaration
-     * @param definitionScope
-     *            the parent scope
-     * @param fieldName
-     *            the field name
-     * @param definitions
-     *            the content of the array
-     * @since 3.0
-     */
-    public ArrayDefinition(ArrayDeclaration declaration,
-            @Nullable IDefinitionScope definitionScope,
-            String fieldName,
-            List<Definition> definitions) {
-        super(declaration, definitionScope, fieldName);
-        @SuppressWarnings("null")
-        @NonNull ImmutableList<Definition> list = ImmutableList.copyOf(definitions);
-        fDefinitions = list;
-
-    }
-
-    // ------------------------------------------------------------------------
-    // Getters/Setters/Predicates
-    // ------------------------------------------------------------------------
-
-    @Override
-    public List<Definition> getDefinitions() {
-        return fDefinitions;
-    }
-
-    /**
-     * Get the element at i
-     *
-     * @param i the index (cannot be negative)
-     * @return The element at I, if I &gt; length, null, if I &lt; 0, the method throws an out of bounds exception
-     */
-    @Nullable
-    public Definition getElem(int i) {
-        if (i > fDefinitions.size()) {
-            return null;
-        }
-
-        return fDefinitions.get(i);
-    }
-
-    @Override
-    public ArrayDeclaration getDeclaration() {
-        return (ArrayDeclaration) super.getDeclaration();
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    @Override
-    public String toString() {
-        StringBuilder b = new StringBuilder();
-
-        if (getDeclaration().isString()) {
-            for (Definition def : fDefinitions) {
-                IntegerDefinition character = (IntegerDefinition) def;
-
-                if (character.getValue() == 0) {
-                    break;
-                }
-
-                b.append(character.toString());
-            }
-        } else {
-            b.append('[');
-            Joiner joiner = Joiner.on(", ").skipNulls(); //$NON-NLS-1$
-            b.append(joiner.join(fDefinitions));
-            b.append(']');
-        }
-
-        @SuppressWarnings("null")
-        @NonNull String ret = b.toString();
-        return ret;
-    }
-}
index abe020d5afbb08276b4b1b58447f039eb9fabd43..c8de3b289cfc461b728f808d7952759e00782034 100644 (file)
@@ -74,21 +74,6 @@ public abstract class ScopedDefinition extends Definition implements IDefinition
         return (AbstractArrayDefinition) ((def instanceof AbstractArrayDefinition) ? def : null);
     }
 
-    /**
-     * Lookup an array in a struct. If the name returns a non-array (like an
-     * int) then the method returns null
-     *
-     * @param name
-     *            the name of the array
-     * @return the array or null.
-     * @deprecated use {@link ScopedDefinition#lookupArrayDefinition(String)}
-     */
-    @Deprecated
-    @Nullable
-    public ArrayDefinition lookupArray(String name) {
-        Definition def = lookupDefinition(name);
-        return (ArrayDefinition) ((def instanceof ArrayDefinition) ? def : null);
-    }
 
     /**
      * Lookup an enum in a struct. If the name returns a non-enum (like an int)
@@ -120,24 +105,6 @@ public abstract class ScopedDefinition extends Definition implements IDefinition
         return (IntegerDefinition) ((def instanceof IntegerDefinition) ? def : null);
     }
 
-    /**
-     * Lookup a sequence in a struct. If the name returns a non-sequence (like
-     * an int) then the method returns null
-     *
-     * @param name
-     *            the name of the sequence
-     * @return the sequence or null if a definition is not found or it does not
-     *         match the desired datatype.
-     * @since 3.0
-     * @deprecated use {@link ScopedDefinition#lookupArrayDefinition(String)}
-     */
-    @Deprecated
-    @Nullable
-    public SequenceDefinition lookupSequence(String name) {
-        Definition def = lookupDefinition(name);
-        return (SequenceDefinition) ((def instanceof SequenceDefinition) ? def : null);
-    }
-
     /**
      * Lookup a string in a struct. If the name returns a non-string (like an
      * int) then the method returns null
diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/SequenceDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/SequenceDeclaration.java
deleted file mode 100644 (file)
index e8739a9..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.trace.CTFReaderException;
-
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import com.google.common.collect.Multimap;
-
-/**
- * A CTF sequence declaration.
- *
- * An array where the size is fixed but declared in the trace, unlike array
- * where it is declared with a literal
- * @deprecated use {@link org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration}
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-@Deprecated
-public class SequenceDeclaration extends CompoundDeclaration {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private final IDeclaration fElemType;
-    private final String fLengthName;
-    private final Multimap<String, String> fPaths = ArrayListMultimap.<String, String>create();
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     *
-     * @param lengthName
-     *            the name of the field describing the length
-     * @param elemType
-     *            The element type
-     */
-    public SequenceDeclaration(String lengthName, IDeclaration elemType) {
-        fElemType = elemType;
-        fLengthName = lengthName;
-    }
-
-    // ------------------------------------------------------------------------
-    // Getters/Setters/Predicates
-    // ------------------------------------------------------------------------
-
-    @Override
-    public IDeclaration getElementType() {
-        return fElemType;
-    }
-
-    /**
-     * Gets the name of the length field
-     *
-     * @return the name of the length field
-     */
-    public String getLengthName() {
-        return fLengthName;
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 3.0
-     */
-    @SuppressWarnings("null") // immutablelist
-    @Override
-    public SequenceDefinition createDefinition(
-            IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException {
-        IDefinition lenDef = null;
-
-        if (definitionScope != null) {
-            lenDef = definitionScope.lookupDefinition(getLengthName());
-        }
-
-        if (lenDef == null) {
-            throw new CTFReaderException("Sequence length field not found"); //$NON-NLS-1$
-        }
-
-        if (!(lenDef instanceof IntegerDefinition)) {
-            throw new CTFReaderException("Sequence length field not integer"); //$NON-NLS-1$
-        }
-
-        IntegerDefinition lengthDefinition = (IntegerDefinition) lenDef;
-
-        if (lengthDefinition.getDeclaration().isSigned()) {
-            throw new CTFReaderException("Sequence length must not be signed"); //$NON-NLS-1$
-        }
-
-        long length = lengthDefinition.getValue();
-        if ((length > Integer.MAX_VALUE) || (!input.canRead((int) length * fElemType.getMaximumSize()))) {
-            throw new CTFReaderException("Sequence length too long " + length); //$NON-NLS-1$
-        }
-
-        Collection<String> collection = fPaths.get(fieldName);
-        while (collection.size() < length) {
-            fPaths.put(fieldName, fieldName + '[' + collection.size() + ']');
-        }
-        List<String> paths = (List<String>) fPaths.get(fieldName);
-        Builder<Definition> definitions = new ImmutableList.Builder<>();
-        for (int i = 0; i < length; i++) {
-            definitions.add(fElemType.createDefinition(definitionScope, paths.get(i), input));
-        }
-        return new SequenceDefinition(this, definitionScope, fieldName, definitions.build());
-    }
-
-    @Override
-    public String toString() {
-        /* Only used for debugging */
-        return "[declaration] sequence[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
-    }
-
-    /**
-     * @since 3.0
-     */
-    @Override
-    public int getMaximumSize() {
-        return Integer.MAX_VALUE;
-    }
-
-}
diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/SequenceDefinition.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/SequenceDefinition.java
deleted file mode 100644 (file)
index f4fb9d8..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-
-/**
- * A CTF sequence definition (a fixed-size array).
- *
- * An array where the size is fixed but declared in the trace, unlike array
- * where it is declared with a literal
- *
- * @deprecated use {@link AbstractArrayDefinition}
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-@Deprecated
-public final class SequenceDefinition extends Definition {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private final ImmutableList<Definition> fDefinitions;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     *
-     * @param declaration
-     *            the parent declaration
-     * @param definitionScope
-     *            the parent scope
-     * @param fieldName
-     *            the field name
-     * @param definitions
-     *            Definitions
-     * @since 3.0
-     */
-    public SequenceDefinition(@NonNull SequenceDeclaration declaration, IDefinitionScope definitionScope, @NonNull String fieldName, List<Definition> definitions) {
-        super(declaration, definitionScope, fieldName);
-        fDefinitions = ImmutableList.copyOf(definitions);
-    }
-
-    // ------------------------------------------------------------------------
-    // Getters/Setters/Predicates
-    // ------------------------------------------------------------------------
-
-    @Override
-    public SequenceDeclaration getDeclaration() {
-        return (SequenceDeclaration) super.getDeclaration();
-    }
-
-    /**
-     * The length of the sequence in number of elements so a sequence of 5
-     * GIANT_rediculous_long_ints is the same as a sequence of 5 bits. (5)
-     *
-     * @return the length of the sequence
-     */
-    public int getLength() {
-        return fDefinitions.size();
-    }
-
-    /**
-     * Get the element at i
-     *
-     * @param i
-     *            the index (cannot be negative)
-     * @return The element at I, if I &gt; length, null, if I &lt; 0, the method
-     *         throws an out of bounds exception
-     */
-    public Definition getElem(int i) {
-        if (i > fDefinitions.size()) {
-            return null;
-        }
-        return fDefinitions.get(i);
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    @Override
-    public String toString() {
-        StringBuilder b = new StringBuilder();
-
-        if (getDeclaration().isString()) {
-            for (Definition def : fDefinitions) {
-                IntegerDefinition character = (IntegerDefinition) def;
-
-                if (character.getValue() == 0) {
-                    break;
-                }
-
-                b.append(character.toString());
-            }
-        } else {
-            b.append('[');
-            Joiner joiner = Joiner.on(", ").skipNulls(); //$NON-NLS-1$
-            b.append(joiner.join(fDefinitions));
-            b.append(']');
-        }
-
-        return b.toString();
-    }
-}
index 06f70e92f403c22b0cfa8b92521ad6182883a8e5..c140c80476ce826019d1c756b640fc4ebce28dae 100644 (file)
@@ -139,24 +139,6 @@ public final class Utils {
         return uuid;
     }
 
-    /**
-     * Gets a UUID from an array defintion
-     *
-     * @param uuidDef
-     *            the array defintions, must contain integer bytes
-     * @return the UUID
-     * @throws CTFReaderException
-     *             if the definition contains less than 16 elements
-     * @since 3.1
-     * @deprecated use
-     *             {@link Utils#getUUIDfromDefinition(AbstractArrayDefinition uuidDef)}
-     */
-    @Deprecated
-    public static UUID getUUIDfromDefinition(org.eclipse.tracecompass.ctf.core.event.types.ArrayDefinition uuidDef) throws CTFReaderException {
-        byte[] uuidArray = new byte[16];
-        return getUUID(uuidDef, uuidArray);
-    }
-
     /**
      * Creates a UUID object from an array of 16 bytes.
      *
This page took 0.031411 seconds and 5 git commands to generate.