Android Open Source - android-molecules-livewallpaper Molecule






From Project

Back to project page android-molecules-livewallpaper.

License

The source code is released under:

Copyright (c) 2012 Dominik Raymann <dominik.raymann@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "S...

If you think the Android project android-molecules-livewallpaper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ch.raymi.android.molecules;
//  w  w  w. ja  va  2 s.  c  om
import java.util.ArrayList;
import java.util.List;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentSkipListMap;

public final class Molecule {
  private final String mName;
  private final String mFilename;
  private final String mInitScript;


  public final static class Molecules {
    private static SortedMap<String, Molecule> mMolecules = new ConcurrentSkipListMap<String, Molecule>();

    static {
      Molecules.registerMolecule(Molecule.createMolecule("Testosterone", "testosterone.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("Vitamine C", "vitamine_c.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("TNT", "tnt.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("Water", "water.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("Nitroglycerin", "nitroglycerin.sdf", null));
      //Molecules.registerMolecule(Molecule.createMolecule("FullereneB", "fullerene.pdb", null));
      Molecules.registerMolecule(Molecule.createMolecule("Caffeine", "caffeine.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("Capsaicin", "capsaicin.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("Adrenaline", "adrenaline.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("Aspirin", "aspirin.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("Penicillin", "penicillin.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("Oestrogen", "estradiol.sdf", null));
      Molecules.registerMolecule(Molecule.createMolecule("Sulfuric Acid", "sulfuric_acid.sdf", null));
    }

    private Molecules() {
      //prevent initialization
    }

    public static void registerMolecule(Molecule molecule) {
      mMolecules.put(molecule.mName, molecule);
    }

    public static List<Molecule> getMolecules() {
      return new ArrayList<Molecule>(mMolecules.values());
    }

    public static Molecule getMolecule(String name) {
      if (name == null) {
        return null;
      }
      return mMolecules.get(name);
    }
  }

  private Molecule(String name, String filename, String initScript) {
    if (name == null) {
      throw new IllegalArgumentException("molecules must have a name");
    }
    this.mName = name;
    this.mFilename = filename;
    this.mInitScript = initScript;
  }

  public static Molecule createMolecule(String name, String filename, String initScript) {
    return new Molecule(name, filename, initScript);
  }

  public String getFilename() {
    return mFilename;
  }

  public String getInitScript() {
    return mInitScript;
  }

  public String getName() {
    return mName;
  }

}




Java Source Code List

ch.raymi.android.molecules.AndroidPlatform.java
ch.raymi.android.molecules.Image.java
ch.raymi.android.molecules.MoleculeName.java
ch.raymi.android.molecules.Molecule.java
ch.raymi.android.molecules.MoleculesWallpaperPreferences.java
ch.raymi.android.molecules.MoleculesWallpaper.java
ch.raymi.android.molecules.WallpaperElement.java