Class IntArrayMappings

  • All Implemented Interfaces:
    Mappings

    public class IntArrayMappings
    extends java.lang.Object
    implements Mappings
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int[] oldToNew  
    • Constructor Summary

      Constructors 
      Constructor Description
      IntArrayMappings​(int[] oldToNew)  
      IntArrayMappings​(int size, com.google.gson.JsonArray oldMapping, com.google.gson.JsonArray newMapping)  
      IntArrayMappings​(int size, com.google.gson.JsonArray oldMapping, com.google.gson.JsonArray newMapping, boolean warnOnMissing)  
      IntArrayMappings​(int size, com.google.gson.JsonArray oldMapping, com.google.gson.JsonArray newMapping, com.google.gson.JsonObject diffMapping, boolean warnOnMissing)
      Maps old identifiers to the new ones.
      IntArrayMappings​(int size, com.google.gson.JsonObject oldMapping, com.google.gson.JsonObject newMapping)
      Maps old identifiers to the new ones.
      IntArrayMappings​(int size, com.google.gson.JsonObject oldMapping, com.google.gson.JsonObject newMapping, @Nullable com.google.gson.JsonObject diffMapping)
      Maps old identifiers to the new ones.
      IntArrayMappings​(com.google.gson.JsonArray oldMapping, com.google.gson.JsonArray newMapping)  
      IntArrayMappings​(com.google.gson.JsonArray oldMapping, com.google.gson.JsonArray newMapping, boolean warnOnMissing)  
      IntArrayMappings​(com.google.gson.JsonArray oldMapping, com.google.gson.JsonArray newMapping, com.google.gson.JsonObject diffMapping)  
      IntArrayMappings​(com.google.gson.JsonObject oldMapping, com.google.gson.JsonObject newMapping)  
      IntArrayMappings​(com.google.gson.JsonObject oldMapping, com.google.gson.JsonObject newMapping, @Nullable com.google.gson.JsonObject diffMapping)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getNewId​(int id)
      Returns the mapped id from the given id, or -1 if invalid/out of bounds.
      int[] getOldToNew()  
      void setNewId​(int id, int newId)
      Manually maps a specific id.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • oldToNew

        protected final int[] oldToNew
    • Constructor Detail

      • IntArrayMappings

        public IntArrayMappings​(int[] oldToNew)
      • IntArrayMappings

        public IntArrayMappings​(int size,
                                com.google.gson.JsonObject oldMapping,
                                com.google.gson.JsonObject newMapping,
                                @Nullable com.google.gson.JsonObject diffMapping)
        Maps old identifiers to the new ones. If an old value cannot be found in the new mappings, the diffmapping will be checked for the given entry.
        Parameters:
        size - set size of the underlying short array
        oldMapping - mappings to map from
        newMapping - mappings to map to
        diffMapping - extra mappings that will be used/scanned when an entry cannot be found
      • IntArrayMappings

        public IntArrayMappings​(com.google.gson.JsonObject oldMapping,
                                com.google.gson.JsonObject newMapping,
                                @Nullable com.google.gson.JsonObject diffMapping)
      • IntArrayMappings

        public IntArrayMappings​(int size,
                                com.google.gson.JsonObject oldMapping,
                                com.google.gson.JsonObject newMapping)
        Maps old identifiers to the new ones.
        Parameters:
        size - set size of the underlying short array
        oldMapping - mappings to map from
        newMapping - mappings to map to
      • IntArrayMappings

        public IntArrayMappings​(com.google.gson.JsonObject oldMapping,
                                com.google.gson.JsonObject newMapping)
      • IntArrayMappings

        public IntArrayMappings​(int size,
                                com.google.gson.JsonArray oldMapping,
                                com.google.gson.JsonArray newMapping,
                                com.google.gson.JsonObject diffMapping,
                                boolean warnOnMissing)
        Maps old identifiers to the new ones.
        Parameters:
        size - set size of the underlying short array
        oldMapping - mappings to map from
        newMapping - mappings to map to
        diffMapping - extra mappings that will be used/scanned when an entry cannot be found
        warnOnMissing - should "No key for x" be printed if there is no matching identifier
      • IntArrayMappings

        public IntArrayMappings​(int size,
                                com.google.gson.JsonArray oldMapping,
                                com.google.gson.JsonArray newMapping,
                                boolean warnOnMissing)
      • IntArrayMappings

        public IntArrayMappings​(com.google.gson.JsonArray oldMapping,
                                com.google.gson.JsonArray newMapping,
                                boolean warnOnMissing)
      • IntArrayMappings

        public IntArrayMappings​(int size,
                                com.google.gson.JsonArray oldMapping,
                                com.google.gson.JsonArray newMapping)
      • IntArrayMappings

        public IntArrayMappings​(com.google.gson.JsonArray oldMapping,
                                com.google.gson.JsonArray newMapping,
                                com.google.gson.JsonObject diffMapping)
      • IntArrayMappings

        public IntArrayMappings​(com.google.gson.JsonArray oldMapping,
                                com.google.gson.JsonArray newMapping)
    • Method Detail

      • getNewId

        public int getNewId​(int id)
        Description copied from interface: Mappings
        Returns the mapped id from the given id, or -1 if invalid/out of bounds.
        Specified by:
        getNewId in interface Mappings
        Parameters:
        id - unmapped id
        Returns:
        mapped id, or -1 if invalid/out of bounds
      • setNewId

        public void setNewId​(int id,
                             int newId)
        Description copied from interface: Mappings
        Manually maps a specific id.
        Specified by:
        setNewId in interface Mappings
        Parameters:
        id - unmapped id
        newId - mapped id
      • getOldToNew

        public int[] getOldToNew()