Examples of ObjectMap


Examples of com.badlogic.gdx.utils.ObjectMap

  public <T> void addResource (String name, T resource) {
    if (resource == null) throw new IllegalArgumentException("resource cannot be null.");
    ObjectMap<String, Object> typeResources = data.resources.get(resource.getClass());
    if (typeResources == null) {
      typeResources = new ObjectMap();
      data.resources.put(resource.getClass(), typeResources);
    }
    typeResources.put(name, resource);
  }
View Full Code Here

Examples of com.badlogic.gdx.utils.ObjectMap

  public <T> void addStyle (String name, T style) {
    if (style == null) throw new IllegalArgumentException("style cannot be null.");
    ObjectMap<String, Object> typeStyles = styles.get(style.getClass());
    if (typeStyles == null) {
      typeStyles = new ObjectMap();
      styles.put(style.getClass(), typeStyles);
    }
    typeStyles.put(name, style);
  }
View Full Code Here

Examples of com.badlogic.gdx.utils.ObjectMap

        json.writeField(skin, "styles");
        json.writeObjectEnd();
      }

      public Skin read (Json json, Object jsonData, Class ignored) {
        ObjectMap map = (ObjectMap)jsonData;
        readTypeMap(json, (ObjectMap)map.get("resources"), true);
        for (Entry<Class, ObjectMap<String, Object>> entry : data.resources.entries())
          json.setSerializer(entry.key, new AliasSerializer(entry.value));
        readTypeMap(json, (ObjectMap)map.get("styles"), false);
        return skin;
      }

      private void readTypeMap (Json json, ObjectMap<String, ObjectMap> typeToValueMap, boolean isResource) {
        if (typeToValueMap == null)
View Full Code Here

Examples of com.esotericsoftware.kryo.util.ObjectMap

    super(kryo, type);
  }

  public void write (Kryo kryo, Output output, T object) {
    CachedField[] fields = getFields();
    ObjectMap context = kryo.getGraphContext();
    if (!context.containsKey(this)) {
      context.put(this, null);
      if (TRACE) trace("kryo", "Write " + fields.length + " field names.");
      output.writeVarInt(fields.length, true);
      for (int i = 0, n = fields.length; i < n; i++)
        output.writeString(fields[i].field.getName());
    }
View Full Code Here

Examples of com.esotericsoftware.kryo.util.ObjectMap

  }

  public T read (Kryo kryo, Input input, Class<T> type) {
    T object = create(kryo, input, type);
    kryo.reference(object);
    ObjectMap context = kryo.getGraphContext();
    CachedField[] fields = (CachedField[])context.get(this);
    if (fields == null) {
      int length = input.readVarInt(true);
      if (TRACE) trace("kryo", "Read " + length + " field names.");
      String[] names = new String[length];
      for (int i = 0; i < length; i++)
        names[i] = input.readString();

      fields = new CachedField[length];
      CachedField[] allFields = getFields();
      outer:
      for (int i = 0, n = names.length; i < n; i++) {
        String schemaName = names[i];
        for (int ii = 0, nn = allFields.length; ii < nn; ii++) {
          if (allFields[ii].field.getName().equals(schemaName)) {
            fields[i] = allFields[ii];
            continue outer;
          }
        }
        if (TRACE) trace("kryo", "Ignore obsolete field: " + schemaName);
      }
      context.put(this, fields);
    }

    InputChunked inputChunked = new InputChunked(input, 1024);
    for (int i = 0, n = fields.length; i < n; i++) {
      CachedField cachedField = fields[i];
View Full Code Here

Examples of com.esotericsoftware.kryo.util.ObjectMap

        }
      }
      nextClass = nextClass.getSuperclass();
    }

    ObjectMap context = kryo.getContext();

    IntArray useAsm = new IntArray();

    // Sort fields by their offsets
    if (useMemRegions && !useAsmEnabled && unsafeAvailable) {
View Full Code Here

Examples of com.esotericsoftware.kryo.util.ObjectMap

    return (T)instantiator.newInstance();
  }

  /** Name/value pairs that are available to all serializers. */
  public ObjectMap getContext () {
    if (context == null) context = new ObjectMap();
    return context;
  }
View Full Code Here

Examples of com.esotericsoftware.kryo.util.ObjectMap

  }

  /** Name/value pairs that are available to all serializers and are cleared after each object graph is serialized or
   * deserialized. */
  public ObjectMap getGraphContext () {
    if (graphContext == null) graphContext = new ObjectMap();
    return graphContext;
  }
View Full Code Here

Examples of com.esotericsoftware.kryo.util.ObjectMap

        }
      }
      nextClass = nextClass.getSuperclass();
    }

    ObjectMap context = kryo.getContext();

    IntArray useAsm = new IntArray();

    // Sort fields by their offsets
    if (useMemRegions && !useAsmEnabled && unsafe() != null) {
View Full Code Here

Examples of com.esotericsoftware.kryo.util.ObjectMap

        }
      }
      nextClass = nextClass.getSuperclass();
    }

    ObjectMap context = kryo.getContext();

    IntArray useAsm = new IntArray();

    // Sort fields by their offsets
    if (useMemRegions && !useAsmEnabled && unsafeAvailable) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.